Overview

Packages

  • CONTENIDO
  • Core
    • Authentication
    • Backend
    • Cache
    • CEC
    • Chain
    • ContentType
    • Database
    • Debug
    • Exception
    • Frontend
      • Search
      • URI
      • Util
    • GenericDB
      • Model
    • GUI
      • HTML
    • I18N
    • LayoutHandler
    • Log
    • Security
    • Session
    • Util
    • Validation
    • Versioning
    • XML
  • Module
    • ContentSitemapHtml
    • ContentSitemapXml
    • ContentUserForum
    • NavigationTop
    • ScriptCookieDirective
  • mpAutoloaderClassMap
  • None
  • PHP
  • Plugin
    • ContentAllocation
    • CronjobOverview
    • FormAssistant
    • FrontendLogic
    • FrontendUsers
    • Linkchecker
    • ModRewrite
    • Newsletter
    • Repository
      • FrontendNavigation
      • KeywordDensity
    • SmartyWrapper
    • UrlShortener
    • UserForum
    • Workflow
  • PluginManager
  • Setup
    • Form
    • GUI
    • Helper
      • Environment
      • Filesystem
      • MySQL
      • PHP
    • UpgradeJob

Classes

  • cAjaxRequest
  • cAutoload
  • cBackend
  • cEffectiveSetting
  • cGuiScrollListAlltranslations
  • cHTMLValidator
  • cMailer
  • cModuleFileTranslation
  • cModuleHandler
  • cModuleSearch
  • cModuleSynchronizer
  • cModuleTemplateHandler
  • CodeMirror
  • cPasswordRequest
  • cPermission
  • cRegistry
  • cSystemPurge
  • cSystemtest
  • cTinymce4Configuration
  • cTinyMCE4Editor
  • cTinyMCEEditor
  • cWYSIWYGEditor
  • FrontendList
  • HtmlParser
  • TODOBackendList
  • TreeItem
  • UploadList
  • UploadSearchResultList

Functions

  • addArtspec
  • addSortImages
  • backToMainArea
  • buildArticleSelect
  • buildCategorySelect
  • buildCategorySelectRights
  • buildHeapTable
  • buildStackString
  • buildTree
  • buildUserOrGroupPermsFromRequest
  • callPluginStore
  • cApiCatGetLevelNode
  • cApiImageCheckCachedImageValidity
  • cApiImageCheckImageEditingPosibility
  • cApiImageCheckImageEditingPossibility
  • cApiImageGetCacheFileName
  • cApiImageGetTargetDimensions
  • cApiImageIsAnimGif
  • cApiImgScale
  • cApiImgScaleGetMD5CacheFile
  • cApiImgScaleHQ
  • cApiImgScaleImageMagick
  • cApiImgScaleLQ
  • cApiIsImageMagickAvailable
  • cApiStrCleanURLCharacters
  • cApiStrNormalizeLineEndings
  • cApiStrRecodeString
  • cApiStrReplaceDiacritics
  • cApiStrTrimAfterWord
  • cApiStrTrimHard
  • cApiStrTrimSentence
  • cDeprecated
  • cDie
  • cError
  • checkLangInClients
  • checkPathInformation
  • cInclude
  • compareUrlStrings
  • conChangeTemplateForCat
  • conCopyArticle
  • conCopyArtLang
  • conCopyContainerConf
  • conCopyContent
  • conCopyMetaTags
  • conCopyTemplateConfiguration
  • conCreateLocationString
  • conDeeperCategoriesArray
  • conDeleteart
  • conEditArt
  • conEditFirstTime
  • conFetchCategoryTree
  • conFlagOnOffline
  • conGenerateCode
  • conGenerateCodeForAllArts
  • conGenerateCodeForAllArtsInCategory
  • conGenerateCodeForAllartsUsingLayout
  • conGenerateCodeForAllartsUsingMod
  • conGenerateCodeForAllArtsUsingTemplate
  • conGenerateCodeForArtInAllCategories
  • conGenerateCodeForClient
  • conGenerateKeywords
  • conGetAvailableMetaTagTypes
  • conGetCategoryArticleId
  • conGetCategoryAssignments
  • conGetContainerConfiguration
  • conGetContentFromArticle
  • conGetHtmlTranslationTable
  • conGetMetaValue
  • conGetTemplateConfigurationIdForArticle
  • conGetTemplateConfigurationIdForCategory
  • conGetTopmostCat
  • conGetUniqueArticleUrlname
  • conGetUsedModules
  • conHtmlentities
  • conHtmlEntityDecode
  • conHtmlSpecialChars
  • conIsArticleUrlnameUnique
  • conIsLocked
  • conLock
  • conLockBulkEditing
  • conMakeArticleIndex
  • conMakeCatOnline
  • conMakeInlineScript
  • conMakeOnline
  • conMakeOnlineBulkEditing
  • conMakePublic
  • conMakeStart
  • conMoveArticles
  • conPhp54Check
  • conRemoveOldCategoryArticle
  • conSaveContentEntry
  • conSetCodeFlag
  • conSetCodeFlagBulkEditing
  • conSetMetaValue
  • conSetStartArticle
  • consoleLog
  • conSyncArticle
  • copyRightsForElement
  • createBulkEditingFunction
  • createRandomName
  • createRightsForElement
  • cWarning
  • dbGetColumns
  • dbGetIndexes
  • dbGetPrimaryKeyName
  • dbTableExists
  • dbUpgradeTable
  • defineIfNotDefined
  • deleteArtspec
  • deleteRightsForElement
  • deleteSystemProperty
  • displayDatetime
  • emptyLogFile
  • endAndLogTiming
  • extractNumber
  • generateDisplayFilePath
  • generateJs
  • getAllClientsAndLanguages
  • getArtLang
  • getArtspec
  • getAvailableContentTypes
  • getCanonicalDay
  • getCanonicalMonth
  • getDirectorySize
  • getEffectiveSetting
  • getEffectiveSettingsByType
  • getEncodingByLanguage
  • getFileInformation
  • getFileType
  • getGroupOrUserName
  • getIDForArea
  • getJsHelpContext
  • getLanguageNamesByClient
  • getLanguagesByClient
  • getmicrotime
  • getNamedFrame
  • getParentAreaId
  • getRightsList
  • getSearchResults
  • getStrExpandCollapseButton
  • getSystemProperties
  • getSystemPropertiesByType
  • getSystemProperty
  • getTemplateSelect
  • getUplExpandCollapseButton
  • htmldecode
  • htmlentities_iso88592
  • humanReadableSize
  • includePlugins
  • insertEmptyStrRow
  • ipMatch
  • isAlphanumeric
  • isArchive
  • isArtInMultipleUse
  • isFunctionDisabled
  • isGroup
  • isIPv4
  • isRunningFromWeb
  • isStartArticle
  • isUtf8
  • isValidMail
  • langActivateDeactivateLanguage
  • langDeleteLanguage
  • langEditLanguage
  • langGetTextDirection
  • langNewLanguage
  • langRenameLanguage
  • layDeleteLayout
  • layEditLayout
  • machineReadableSize
  • mailLogBulkEditingFunctions
  • mailLogDecodeAddresses
  • markSubMenuItem
  • mask
  • modDeleteModule
  • modEditModule
  • phpInfoToHtml
  • plugin_include
  • prCreateURLNameLocationString
  • prDeleteCacheFileContent
  • prGetCacheFileContent
  • prResolvePathViaCategoryNames
  • prResolvePathViaURLNames
  • prWriteCacheFileContent
  • recursiveCopy
  • removeFileInformation
  • renderBackendBreadcrumb
  • renderLabel
  • renderSelectProperty
  • renderTextProperty
  • saveGroupRights
  • saveRights
  • scanDirectory
  • scanPlugins
  • sendEncodingHeader
  • set_magic_quotes_gpc
  • setArtspecDefault
  • setArtspecOnline
  • setSystemProperty
  • showTree
  • startTiming
  • statCreateLocationString
  • statDisplayTopChooser
  • statDisplayYearlyTopChooser
  • statGetAvailableMonths
  • statGetAvailableYears
  • statResetStatistic
  • statsArchive
  • statsDisplayInfo
  • statsOverviewAll
  • statsOverviewTop
  • statsOverviewTopYear
  • statsOverviewYear
  • strAssignTemplate
  • strBuildSqlValues
  • strCheckAlias
  • strCheckTreeForErrors
  • strCopyCategory
  • strCopyTree
  • strDeeperCategoriesArray
  • strDeleteCategory
  • strHasArticles
  • strHasStartArticle
  • strMakePublic
  • strMakeVisible
  • strMoveCatTargetallowed
  • strMoveDownCategory
  • strMoveSubtree
  • strMoveUpCategory
  • strNewCategory
  • strNewTree
  • strNextBackwards
  • strNextDeeper
  • strNextDeeperAll
  • strNextPost
  • strOrderedPostTreeList
  • strRemakeTreeTable
  • strRenameCategory
  • strRenameCategoryAlias
  • strSortPrePost
  • strSyncCategory
  • systemHavePerm
  • tplAutoFillModules
  • tplBrowseLayoutForContainers
  • tplcfgDuplicate
  • tplDeleteTemplate
  • tplDuplicateTemplate
  • tplEditTemplate
  • tplGetContainerDefault
  • tplGetContainerMode
  • tplGetContainerName
  • tplGetContainerNumbersInLayout
  • tplGetContainerTypes
  • tplGetInUsedData
  • tplIsTemplateInUse
  • tplPreparseLayout
  • tplProcessSendContainerConfiguration
  • updateClientCache
  • updateFileInformation
  • uplCreateFriendlyName
  • uplDirectoryListRecursive
  • uplGetDirectoriesToExclude
  • uplGetFileExtension
  • uplGetFileIcon
  • uplGetFileTypeDescription
  • uplGetThumbnail
  • uplHasFiles
  • uplHasSubdirs
  • uplmkdir
  • uplRecursiveDBDirectoryList
  • uplRecursiveDirectoryList
  • uplRenameDirectory
  • uplSearch
  • uplSyncDirectory
  • uplSyncDirectoryDBFS
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
  • Todo
  1: <?php
  2: 
  3: /**
  4:  * This file contains the mass module translation backend page in content area.
  5:  *
  6:  * @package Core
  7:  * @subpackage Backend
  8:  * @author Ingo van Peeren
  9:  * @copyright four for business AG <www.4fb.de>
 10:  * @license http://www.contenido.org/license/LIZENZ.txt
 11:  * @link http://www.4fb.de
 12:  * @link http://www.contenido.org
 13:  */
 14: 
 15: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
 16: 
 17: /**
 18:  * Extend cGuiScrollList for some special features like CSS class for table data
 19:  */
 20: class cGuiScrollListAlltranslations extends cGuiScrollList {
 21: 
 22:     /**
 23:      * Constructor to create an instance of this class.
 24:      */
 25:     function __construct() {
 26:         parent::__construct(false);
 27:         $this->objTable->setClass("generic alltranslations");
 28:         $this->objTable->updateAttributes(array(
 29:             "cellpadding" => "2"
 30:         ));
 31:     }
 32: 
 33:     /**
 34:      * Is called when a new row is rendered
 35:      *
 36:      * @param unknown_type $row
 37:      *         The current row which is being rendered
 38:      */
 39:     public function onRenderRow($row) {
 40:     }
 41: 
 42:     /**
 43:      * Is called when a new column is rendered
 44:      *
 45:      * @param int $column
 46:      *         The current column which is being rendered
 47:      */
 48:     public function onRenderColumn($column) {
 49:         $iColums = count($this->data[0]);
 50: 
 51:         switch ($column) {
 52:             case 1:
 53:                 $sClass = 'module';
 54:                 break;
 55:             case 2:
 56:                 $sClass = 'inuse';
 57:                 break;
 58:             case 3:
 59:                 $sClass = 'keyword';
 60:                 break;
 61:             case $iColums:
 62:                 $sClass = 'actions';
 63:                 break;
 64: 
 65:             default:
 66:                 $sClass = 'translation';
 67:                 break;
 68:         }
 69: 
 70:         $this->objItem->setClass($sClass);
 71:     }
 72: 
 73:     /**
 74:      * Sorts the list by a given field and a given order.
 75:      *
 76:      * @param int $field
 77:      *         Field index
 78:      * @param string $order
 79:      *         Sort order (see php's sort documentation)
 80:      */
 81:     public function sort($field, $order) {
 82:         if ($order == "") {
 83:             $order = SORT_ASC;
 84:         }
 85: 
 86:         if ($order == "ASC") {
 87:             $order = SORT_ASC;
 88:         }
 89: 
 90:         if ($order == "DESC") {
 91:             $order = SORT_DESC;
 92:         }
 93: 
 94:         $this->sortkey = $field;
 95:         $this->sortmode = $order;
 96: 
 97:         $field = $field + 1;
 98: 
 99:         if ($field > 3) {
100:             $sortby = array();
101:             foreach ($this->data as $row => $cols) {
102:                 $sortby[$row] = trim(cString::toLowerCase(conHtmlentities($cols[$field])));
103:             }
104:             $this->data = cArray::csort($this->data, $sortby, $order);
105:         } else {
106:             $this->data = cArray::csort($this->data, "$field", $order);
107:         }
108:     }
109: 
110: }
111: 
112: /**
113:  * Adds sorting images to string
114:  *
115:  * @param int    $index
116:  * @param string $text
117:  *
118:  * @return string
119:  * 
120:  * @throws cException
121:  */
122: function addSortImages($index, $text) {
123:     global $cfg;
124:     $sortUp = '<img src="' . $cfg["path"]["contenido_fullhtml"] . $cfg['path']['images'] . 'sort_up.gif" alt="' . i18n("Sort") . '" title="' . i18n("Sort") . '">';
125:     $sortDown = '<img src="' . $cfg["path"]["contenido_fullhtml"] . $cfg['path']['images'] . 'sort_down.gif" alt="' . i18n("Sort") . '" title="' . i18n("Sort") . '">';
126: 
127:     if ($_REQUEST["sortby"] == $index) {
128:         if ($_REQUEST["sortmode"] == 'ASC') {
129:             $sortString = $text . $sortUp;
130:         } else {
131:             $sortString = $text . $sortDown;
132:         }
133:     } else {
134:         $sortString = $text . $sortUp . $sortDown;
135:     }
136:     return $sortString;
137: }
138: 
139: $page = new cGuiPage("con_translate");
140: 
141: if (empty($action)) {
142:     $action = 'con_translate_view';
143: }
144: 
145: // Check permission for current user
146: if (!$perm->have_perm_area_action($area, $action)) {
147:     $page->displayCriticalError(i18n('Permission denied'));
148:     $page->render();
149:     return;
150: }
151: 
152: // If there is no client selected, display empty pag
153: if (!(int) $client > 0) {
154:     $page->render();
155:     return;
156: }
157: 
158: $inUseCollection = new cApiInUseCollection();
159: list($inUse, $message) = $inUseCollection->checkAndMark("translations", $client, true, i18n("Translations are used by %s (%s)"), true, "main.php?area=$area&frame=$frame");
160: unset($inUseCollection);
161: if ($inUse == true) {
162:     $message .= "<br>";
163: }
164: 
165: // Initialize
166: $elemPerPage = array(
167:     25 => "25",
168:     50 => "50"
169: );
170: 
171: // Set noResults variable standard to false (= results available)
172: $noResults = false;
173: 
174: $db = cRegistry::getDb();
175: 
176: $langobj = new cApiLanguage($lang);
177: 
178: $langstring = $langobj->get('name') . ' (' . $lang . ')';
179: 
180: $aTmpExtraLanguages = $_REQUEST["extralang"];
181: $extraLanguages = array();
182: if (is_array($aTmpExtraLanguages)) {
183:     foreach ($aTmpExtraLanguages as $idlang) {
184:         if ($idlang != $_REQUEST["dellang"]) {
185:             $extraLanguages[] = $idlang;
186:         }
187:     }
188: }
189: $allLanguages = array_merge(array(
190:     $lang
191: ), $extraLanguages);
192: 
193: $editstring = $_REQUEST["editstring"];
194: $editlang = $_REQUEST["editlang"];
195: if ($editlang != 'all') {
196:     $editlang = cSecurity::toInteger($editlang);
197: }
198: 
199: $search = cString::toLowerCase(trim($_REQUEST["search"]));
200: $filter = $_REQUEST["filter"];
201: 
202: $cApiModuleCollection = new cApiModuleCollection();
203: $modulesInUse = $cApiModuleCollection->getModulesInUse();
204: 
205: $iNextPage = cSecurity::toInteger($_GET['nextpage']);
206: if ($iNextPage <= 0) {
207:     $iNextPage = 1;
208: }
209: 
210: if ($_REQUEST["sortmode"] !== "DESC") {
211:     $_REQUEST["sortmode"] = "ASC";
212: }
213: 
214: // no value found in request for items per page -> get it from db or set default
215: $oUser = new cApiUser($auth->auth["uid"]);
216: if (!isset($_REQUEST["elemperpage"]) || !is_numeric($_REQUEST['elemperpage']) || $_REQUEST['elemperpage'] < 0) {
217:     $_REQUEST["elemperpage"] = $oUser->getProperty("itemsperpage", $area);
218: }
219: if (!is_numeric($_REQUEST["elemperpage"])) {
220:     $_REQUEST["elemperpage"] = 25;
221: }
222: if ($_REQUEST["elemperpage"] > 0) {
223:     // -- All -- will not be stored, as it may be impossible to change this back
224:     // to something more useful
225:     $oUser->setProperty("itemsperpage", $area, $_REQUEST["elemperpage"]);
226: }
227: unset($oUser);
228: 
229: if (!isset($_REQUEST["page"]) || !is_numeric($_REQUEST['page']) || $_REQUEST['page'] <= 0 || $_REQUEST["elemperpage"] == 0) {
230:     $_REQUEST["page"] = 1;
231: }
232: 
233: // Save translations
234: if ($action == 'con_translate_edit') {
235:     $error = false;
236: 
237:     $savetranslations = $_REQUEST['modtrans'];
238:     if (is_array($savetranslations)) {
239:         foreach ($savetranslations as $idmod => $savemodtranslations) {
240: 
241:             // get translation keywords from module
242:             $module = new cApiModule($idmod);
243:             $moduleKeywords = $module->parseModuleForStringsLoadFromFile($cfg, $client, $lang);
244:             $moduleKeywordsHashes = array();
245:             foreach ($moduleKeywords as $keyword) {
246:                 $moduleKeywordsHashes[md5($keyword)] = $keyword;
247:             }
248: 
249:             foreach ($savemodtranslations as $hash => $stringtranslations) {
250:                 foreach ($stringtranslations as $idlang => $modlangtranslation) {
251:                     $contenidoTranslateFromFile = new cModuleFileTranslation($idmod, false, $idlang);
252:                     $fileTranslations = $contenidoTranslateFromFile->getTranslationArray();
253: 
254:                     $hashparts = explode('_', $hash);
255:                     $translationKey = $moduleKeywordsHashes[$hashparts[1]];
256:                     $fileTranslations[stripslashes($translationKey)] = stripslashes($modlangtranslation);
257:                     $thislangerror = $contenidoTranslateFromFile->saveTranslationArray($fileTranslations);
258:                     if (!$thislangerror) {
259:                         $error = true;
260:                     }
261:                 }
262:             }
263:         }
264:     }
265: 
266:     if (!empty($_POST['modtrans'])) {
267:         if (!$error) {
268:             $page->displayOk(i18n('Saved translation successfully!'));
269:         } else {
270:             $page->displayError(i18n("Can't save translation!"));
271:         }
272:     }
273: }
274: 
275: // Get all modules and translations for current client
276: $sql = sprintf("SELECT idmod, name FROM %s WHERE idclient = %s ORDER BY name", $cfg['tab']['mod'], $client);
277: $db->query($sql);
278: 
279: $allModules = array();
280: $allTranslations = array();
281: 
282: while ($db->nextRecord()) {
283:     $idmod = $db->f('idmod');
284:     $allModules[$idmod] = $db->f('name');
285:     $module = new cApiModule($idmod);
286: 
287:     // Get the mi18n strings from modul input/output
288:     $strings = $module->parseModuleForStringsLoadFromFile($cfg, $client, $lang);
289: 
290:     foreach ($allLanguages as $idlang) {
291: 
292:         // Get the strings from translation file
293:         $contenidoTranslateFromFile = new cModuleFileTranslation($idmod, false, $idlang);
294:         $fileTranslations = $contenidoTranslateFromFile->getTranslationArray();
295: 
296:         $translations = array();
297:         foreach ($fileTranslations as $key => $value) {
298:             $hash = $idmod . '_' . md5($key);
299:             $translations[$hash] = $value;
300:         }
301: 
302:         $currentModuleTranslations = array();
303: 
304:         // Insert new strings
305:         foreach ($strings as $string) {
306:             $hash = $idmod . '_' . md5($string);
307:             if (isset($translations[$hash])) {
308:                 $currentTranslation = $translations[$hash];
309:             } else {
310:                 $currentTranslation = '';
311:             }
312:             if (isset($allTranslations[$hash])) {
313:                 $allTranslations[$hash]['translations'][$idlang] = $currentTranslation;
314:             } else {
315:                 $allTranslations[$hash] = array(
316:                     'string' => $string,
317:                     'translations' => array(
318:                         $idlang => $currentTranslation
319:                     ),
320:                     'idmod' => $idmod
321:                 );
322:             }
323:         }
324:     }
325: }
326: 
327: // Get all templates for current client
328: $aAllTemplates = array();
329: $sql = "SELECT
330:             *
331:         FROM
332:             " . $cfg["tab"]["tpl"] . "
333:         WHERE
334:             idclient = '" . cSecurity::toInteger($client) . "'
335:         ORDER BY
336:             name";
337: 
338: $db->query($sql);
339: while ($db->nextRecord()) {
340:     $aAllTemplates[$db->f("idtpl")] = $db->f('name');
341: }
342: 
343: // filter by module/template or by search string
344: if ($search != '' || ($filter != '' && $filter != -1)) {
345:     foreach ($allTranslations as $hash => $aTranslation) {
346:         // filter by search
347:         if ($search != '') {
348:             $bFoundSearch = false;
349:             if (cString::findFirstPosCI($aTranslation['string'], $search) !== false) {
350:                 $bFoundSearch = true;
351:             }
352:             foreach ($aTranslation['translations'] as $idlang => $langTranslation) {
353:                 if (cString::findFirstPosCI($langTranslation, $search) !== false) {
354:                     $bFoundSearch = true;
355:                 }
356:             }
357:         } else {
358:             $bFoundSearch = true;
359:         }
360: 
361:         // filter by module or template
362:         if ($filter != '' && $filter != -1) {
363:             $bFoundFilter = false;
364:             $aFilterType = explode('_', $filter);
365:             if ($aFilterType[0] == 'module') {
366:                 $iFilterModule = $aFilterType[1];
367:                 if ($aTranslation['idmod'] == $iFilterModule) {
368:                     $bFoundFilter = true;
369:                 }
370:             } else {
371:                 $iFilterTemplate = $aFilterType[1];
372:                 if (is_array($modulesInUse[$aTranslation['idmod']]) && array_key_exists($iFilterTemplate, $modulesInUse[$aTranslation['idmod']])) {
373:                     $bFoundFilter = true;
374:                 }
375:             }
376:         } else {
377:             $bFoundFilter = true;
378:         }
379: 
380:         if (!$bFoundSearch || !$bFoundFilter) {
381:             unset($allTranslations[$hash]);
382:         }
383:     }
384: }
385: 
386: if (empty($allTranslations)) {
387:     $page->displayInfo(i18n("Can not find some module translations for your selection."));
388:     $noResults = true;
389: }
390: 
391: unset($strings);
392: unset($fileTranslations);
393: unset($translations);
394: 
395: // Form for adding languages
396: $formExtraLangsString = '';
397: if (is_array($allLanguages)) {
398: 
399:     $formExtraLangs = new cHTMLForm('extralangs');
400:     $formExtraLangs->setVar('area', $area);
401:     $formExtraLangs->setVar('frame', $frame);
402:     $formExtraLangs->setVar("elemperpage", $_REQUEST["elemperpage"]);
403:     $formExtraLangs->setVar("sortby", $_REQUEST["sortby"]);
404:     $formExtraLangs->setVar("sortmode", $_REQUEST["sortmode"]);
405:     $formExtraLangs->setVar("search", $search);
406:     $formExtraLangs->setVar("filter", $filter);
407:     foreach ($extraLanguages as $idExtraLang) {
408:         $formExtraLangs->setVar('extralang[]', $idExtraLang);
409:     }
410: 
411:     $labelExtraLangs = new cHTMLSpan(i18n("New language for editing") . ': ', "vALignMiddle");
412:     $selectExtraLangs = new cHTMLSelectElement('extralang[]', "100px", 'newlang');
413:     $selectExtraLangs->setClass("vAlignTop");
414: 
415:     $sql = "SELECT
416:               A.name AS name, A.idlang AS idlang, B.idclientslang AS idclientslang
417:             FROM
418:               " . $cfg["tab"]["lang"] . " AS A,
419:               " . $cfg["tab"]["clients_lang"] . " AS B
420:             WHERE
421:               A.idlang = B.idlang AND
422:               B.idclient = '" . cSecurity::toInteger($client) . "'
423:             ORDER BY A.idlang";
424: 
425:     $db->query($sql);
426: 
427:     $langNames = array();
428:     $countExtraLangOptions = 0;
429:     while ($db->nextRecord()) {
430:         $idlang = $db->f("idlang");
431:         $langString = $db->f("name") . " (" . $db->f("idlang") . ")";
432:         $langNames[$idlang] = $langString;
433:         if (!in_array($idlang, $allLanguages)) {
434:             $option = new cHTMLOptionElement($langString, $idlang);
435:             $selectExtraLangs->addOptionElement($idlang, $option);
436:             $countExtraLangOptions++;
437:         }
438:     }
439:     $submitExtraLangs = new cHTMLButton('newlangsubmit', i18n("Add"), 'newlangsubmit', false, NULL, '', 'image', "vAlignTop tableElement");
440:     $submitExtraLangs->setImageSource($cfg["path"]["contenido_fullhtml"] . $cfg['path']['images'] . 'but_art_new.gif');
441: 
442:     $formExtraLangs->setContent($labelExtraLangs->render() . $selectExtraLangs->render() . $submitExtraLangs->render());
443:     if ($countExtraLangOptions > 0) {
444:         $formExtraLangsString = $formExtraLangs->render();
445:     }
446: }
447: 
448: // Form for choosing elements per page
449: $formElementsPerPage = new cHTMLForm('elementsperpage');
450: $formElementsPerPage->setVar('area', $area);
451: $formElementsPerPage->setVar('frame', $frame);
452: $formElementsPerPage->setVar('idclient', $client);
453: $formElementsPerPage->setVar("sortby", $_REQUEST["sortby"]);
454: $formElementsPerPage->setVar("sortmode", $_REQUEST["sortmode"]);
455: $formElementsPerPage->setVar("search", $search);
456: $formElementsPerPage->setVar("filter", $filter);
457: foreach ($extraLanguages as $idExtraLang) {
458:     $formElementsPerPage->setVar('extralang[]', $idExtraLang);
459: }
460: $labelElementsPerPage = new cHTMLLabel(i18n("Items per page:") . ':', 'elemperpage');
461: $selectElementsPerPage = new cHTMLSelectElement('elemperpage');
462: 
463: foreach ($elemPerPage as $value => $option) {
464:     $option = new cHTMLOptionElement($option, $value);
465:     if ($_REQUEST["elemperpage"] == $value) {
466:         $option->setSelected(true);
467:     }
468:     $selectElementsPerPage->addOptionElement($value, $option);
469: }
470: $selectElementsPerPage->setAttribute('class', 'elemperpage');
471: $submitElementsPerPage = new cHTMLButton('elemperpagesubmit', i18n("Submit"), 'elemperpagesubmit', false, NULL, '', 'image');
472: $submitElementsPerPage->setImageSource($cfg["path"]["contenido_fullhtml"] . $cfg['path']['images'] . 'but_ok.gif');
473: 
474: $formElementsPerPage->setContent($labelElementsPerPage->render() . $selectElementsPerPage->render() . $submitElementsPerPage->render());
475: 
476: // Form for filtering by module/template and searching by given strings
477: $formSearch = new cHTMLForm('searchfilter');
478: $formSearch->setVar('area', $area);
479: $formSearch->setVar('frame', $frame);
480: $formSearch->setVar("elemperpage", $elemperpage);
481: $formSearch->setVar("sortby", $_REQUEST["sortby"]);
482: $formSearch->setVar("sortmode", $_REQUEST["sortmode"]);
483: foreach ($extraLanguages as $idExtraLang) {
484:     $formSearch->setVar('extralang[]', $idExtraLang);
485: }
486: $filterSelect = '<select name="filter">';
487: $filterSelect .= '<option value="-1">' . i18n("-- filter by --") . '</option>';
488: if (is_array($allModules) && count($allModules) > 0) {
489:     $filterSelect .= '<optgroup label="' . i18n("Module name") . '">';
490:     foreach ($allModules as $idmod => $sModule) {
491:         if ($_REQUEST["filter"] == 'module_' . $idmod) {
492:             $sSelected = ' selected';
493:         } else {
494:             $sSelected = '';
495:         }
496:         $filterSelect .= '<option value="module_' . $idmod . '"' . $sSelected . '>' . $sModule . '</option>';
497:     }
498:     $filterSelect .= '</optgroup>';
499: }
500: if (is_array($aAllTemplates) && count($aAllTemplates) > 0) {
501:     $filterSelect .= '<optgroup label="' . i18n("Template") . '">';
502:     foreach ($aAllTemplates as $idtpl => $sTemplate) {
503:         if ($_REQUEST["filter"] == 'template_' . $idtpl) {
504:             $sSelected = ' selected';
505:         } else {
506:             $sSelected = '';
507:         }
508:         $filterSelect .= '<option value="template_' . $idtpl . '"' . $sSelected . '>' . $sTemplate . '</option>';
509:     }
510:     $filterSelect .= '</optgroup>';
511: }
512: $searchInput = new cHTMLTextbox('search', $search, 20);
513: 
514: $searchSubmit = ' <input type="image" name="searchsubmit" class="vAlignTop" value="submit" src="' . $cfg["path"]["contenido_fullhtml"] . $cfg['path']['images'] . 'but_preview.gif">';
515: 
516: $formSearch->setContent($filterSelect . $searchInput->render() . $searchSubmit);
517: 
518: // The list of translations
519: $list = new cGuiScrollListAlltranslations();
520: // building parameter array
521: $tableHeaders = array(
522:     addSortImages($i, i18n('Module name')),
523:     addSortImages($i, i18n('In use by')),
524:     addSortImages(0, i18n('Translation ID')),
525:     addSortImages(1, i18n('Current language') . ': ' . $langstring)
526: );
527: $i = 4;
528: foreach ($extraLanguages as $idExtraLang) {
529:     $tableHeaders[] = '<span class="del" rel="' . $idExtraLang . '"></span> ' . addSortImages($i, i18n('Language') . ': ' . $langNames[$idExtraLang]);
530:     $i++;
531: }
532: $tableHeaders[] = i18n('Edit row');
533: 
534: call_user_func_array(array(
535:     $list,
536:     "setHeader"
537: ), $tableHeaders);
538: 
539: $iHeaders = count($tableHeaders);
540: for ($i = 0; $i < $iHeaders; $i++) {
541:     $list->setSortable($i, true);
542: }
543: $list->setCustom("nextpage", $iNextPage);
544: $list->setCustom("elemperpage", $_REQUEST["elemperpage"]);
545: $list->setCustom("sortby", $_REQUEST["sortby"]);
546: $list->setCustom("sortmode", $_REQUEST["sortmode"]);
547: $list->setCustom("search", $search);
548: $list->setCustom("filter", $filter);
549: foreach ($extraLanguages as $idExtraLang) {
550:     $list->setCustom("extralang[]", $idExtraLang);
551: }
552: $list->setResultsPerPage($_REQUEST["elemperpage"]);
553: $list->objHeaderItem->updateAttributes(array(
554:     'width' => 52
555: ));
556: $list->objRow->updateAttributes(array(
557:     'valign' => 'top'
558: ));
559: 
560: $submit = ' <input type="image" class="vAlignTop" value="submit" src="' . $cfg["path"]["contenido_fullhtml"] . $cfg['path']['images'] . 'but_ok.gif">';
561: 
562: $counter = 0;
563: 
564: foreach ($allTranslations as $hash => $translationArray) {
565: 
566:     if (!$inUse && $perm->have_perm_area_action($area, 'con_translate_edit') && $action == 'con_translate_edit' && ($editstring == 'all' || $editstring == $hash) && ($editlang == 'all' || $editlang == $lang)) {
567:         $oTranslation = new cHTMLTextarea('modtrans[' . $translationArray['idmod'] . '][' . $hash . '][' . $lang . ']', conHtmlSpecialChars($translationArray['translations'][$lang]));
568:         $oTranslation->setWidth(30);
569:         $sTranslationFirstLang = $oTranslation->render();
570:         if ($editstring == $hash && $editlang == $lang) {
571:             $sTranslationFirstLang = $sTranslationFirstLang . $submit;
572:         }
573:     } else {
574:         if (!$inUse && $perm->have_perm_area_action($area, 'con_translate_edit') && $editstring != 'all') {
575:             $linkEdit = new cHTMLLink();
576:             $linkEdit->setCLink($area, $frame, "con_translate_edit");
577:             $linkEdit->setContent('<img src="' . $cfg["path"]["contenido_fullhtml"] . $cfg['path']['images'] . 'editieren.gif" alt="' . i18n("Edit") . '" title="' . i18n("Edit") . '">');
578:             $linkEdit->setCustom("editstring", $hash);
579:             $linkEdit->setCustom("editlang", $lang);
580:             $linkEdit->setCustom("elemperpage", $_REQUEST["elemperpage"]);
581:             $linkEdit->setCustom("page", $_REQUEST["page"]);
582:             $linkEdit->setCustom("sortby", $_REQUEST["sortby"]);
583:             $linkEdit->setCustom("sortmode", $_REQUEST["sortmode"]);
584:             $linkEdit->setCustom("search", $search);
585:             $linkEdit->setCustom("filter", $filter);
586: 
587:             $idExtraLangCount = 0;
588:             foreach ($extraLanguages as $idExtraLangTemp) {
589:                 $linkEdit->setCustom("extralang[$idExtraLangCount]", $idExtraLangTemp);
590:                 $idExtraLangCount++;
591:             }
592: 
593:             $sLinkEdit = ' ' . $linkEdit->render();
594:         } else {
595:             $sLinkEdit = '';
596:         }
597:         $sTranslationFirstLang = trim(conHtmlentities($translationArray['translations'][$lang])) . $sLinkEdit;
598:     }
599:     // building parameter array
600:     $countCurrentModuleInUse = count($modulesInUse[$translationArray['idmod']]);
601:     if ($countCurrentModuleInUse == 0) {
602:         $inUseString = '';
603:         $currentModuleInUse = i18n('No template');
604:     } else {
605:         $inUseString = i18n("Click for more information about usage");
606:         $currentModuleInUse = '<a href="javascript:;" rel="' . $translationArray['idmod'] . '" class="in_used_mod"><img src="' . $cfg['path']['images'] . 'info.gif" border="0" title="' . $inUseString . '" alt="' . $inUseString . '">' . $countCurrentModuleInUse . ' ' . ($countCurrentModuleInUse == 1? i18n('Template') : i18n('Templates')) . ' </a>';
607:     }
608:     $fields = array(
609:         $counter,
610:         $allModules[$translationArray['idmod']],
611:         $currentModuleInUse,
612:         $translationArray['string'],
613:         $sTranslationFirstLang
614:     );
615:     foreach ($extraLanguages as $idExtraLang) {
616:         if (!$inUse && $perm->have_perm_area_action($area, 'con_translate_edit') && $action == 'con_translate_edit' && ($editstring == 'all' || $editstring == $hash) && ($editlang == 'all' || $editlang == $idExtraLang)) {
617: 
618:             $oExtraTranslation = new cHTMLTextarea('modtrans[' . $translationArray['idmod'] . '][' . $hash . '][' . $idExtraLang . ']', conHtmlSpecialChars($translationArray['translations'][$idExtraLang]));
619:             $oExtraTranslation->setWidth(30);
620: 
621:             if ($editstring == $hash && $editlang == $idExtraLang) {
622:                 $submitTranslation = $submit;
623:             } else {
624:                 $submitTranslation = '';
625:             }
626:             $fields[] = $oExtraTranslation->render() . $submitTranslation;
627:         } else {
628:             if (!$inUse && $perm->have_perm_area_action($area, 'con_translate_edit') && $editstring != 'all') {
629:                 $linkEdit = new cHTMLLink();
630:                 $linkEdit->setCLink($area, $frame, "con_translate_edit");
631:                 $linkEdit->setContent('<img src="' . $cfg["path"]["contenido_fullhtml"] . $cfg['path']['images'] . 'editieren.gif" alt="' . i18n("Edit") . '" title="' . i18n("Edit") . '">');
632:                 $linkEdit->setCustom("editstring", $hash);
633:                 $linkEdit->setCustom("editlang", $idExtraLang);
634:                 $linkEdit->setCustom("elemperpage", $_REQUEST["elemperpage"]);
635:                 $linkEdit->setCustom("page", $_REQUEST["page"]);
636:                 $linkEdit->setCustom("sortby", $_REQUEST["sortby"]);
637:                 $linkEdit->setCustom("sortmode", $_REQUEST["sortmode"]);
638:                 $linkEdit->setCustom("search", $search);
639:                 $linkEdit->setCustom("filter", $filter);
640: 
641:                 $idExtraLangCount = 0;
642:                 foreach ($extraLanguages as $idExtraLangTemp) {
643:                     $linkEdit->setCustom("extralang[$idExtraLangCount]", $idExtraLangTemp);
644:                     $idExtraLangCount++;
645:                 }
646: 
647:                 $sLinkEdit = ' ' . $linkEdit->render();
648:             } else {
649:                 $sLinkEdit = '';
650:             }
651:             $fields[] = trim(conHtmlentities($translationArray['translations'][$idExtraLang])) . $sLinkEdit;
652:         }
653:     }
654:     if ($action == 'con_translate_edit' && $editstring == $hash && $editlang == 'all') {
655:         $fields[] = $submit;
656:     } else {
657:         if (!$inUse && $perm->have_perm_area_action($area, 'con_translate_edit')) {
658:             $linkEditRow = new cHTMLLink();
659:             $linkEditRow->setCLink($area, $frame, "con_translate_edit");
660:             $linkEditRow->setContent('<img src="' . $cfg["path"]["contenido_fullhtml"] . $cfg['path']['images'] . 'editieren.gif" alt="' . i18n("Edit") . '" title="' . i18n("Edit") . '">');
661:             $linkEditRow->setCustom("editstring", $hash);
662:             $linkEditRow->setCustom("editlang", 'all');
663:             $linkEditRow->setCustom("elemperpage", $_REQUEST["elemperpage"]);
664:             $linkEditRow->setCustom("page", $_REQUEST["page"]);
665:             $linkEditRow->setCustom("sortby", $_REQUEST["sortby"]);
666:             $linkEditRow->setCustom("sortmode", $_REQUEST["sortmode"]);
667:             $linkEditRow->setCustom("search", $search);
668:             $linkEditRow->setCustom("filter", $filter);
669: 
670:             $idExtraLangCount = 0;
671:             foreach ($extraLanguages as $idExtraLangTemp) {
672:                 $linkEditRow->setCustom("extralang[$idExtraLangCount]", $idExtraLangTemp);
673:                 $idExtraLangCount++;
674:             }
675: 
676:             $sLinkEditRow = ' ' . $linkEditRow->render();
677:         } else {
678:             $sLinkEditRow = '&nbsp;';
679:         }
680:         $fields[] = $sLinkEditRow;
681:     }
682: 
683:     call_user_func_array(array(
684:         $list,
685:         "setData"
686:     ), $fields);
687:     $counter++;
688: }
689: 
690: // Count all found translations
691: // Important to calculate needed pages
692: $counter = count($allTranslations);
693: 
694: $list->sort($_REQUEST["sortby"], $_REQUEST["sortmode"]);
695: $list->setListStart($_REQUEST["page"]);
696: $form = new cHTMLForm('all_mod_translations');
697: $form->setVar('area', $area);
698: $form->setVar('action', 'con_translate_edit');
699: $form->setVar('frame', 4);
700: $form->setVar("elemperpage", $_REQUEST["elemperpage"]);
701: $form->setVar("page", $_REQUEST["page"]);
702: $form->setVar("sortby", $_REQUEST["sortby"]);
703: $form->setVar("sortmode", $_REQUEST["sortmode"]);
704: $form->setVar("search", $search);
705: $form->setVar("filter", $filter);
706: 
707: $idExtraLangCount = 0;
708: foreach ($extraLanguages as $idExtraLangTemp) {
709:     $form->setVar("extralang[$idExtraLangCount]", $idExtraLangTemp);
710:     $idExtraLangCount++;
711: }
712: 
713: $form->setVar('contenido', $contenido);
714: $form->setContent($list->render());
715: 
716: // Generate current content for Object Pager
717: $pagerLink = new cHTMLLink();
718: $pagerl = "pagerlink";
719: $pagerLink->setTargetFrame('right_bottom');
720: $pagerLink->setLink("main.php");
721: $pagerLink->setCustom("elemperpage", $elemperpage);
722: $pagerLink->setCustom("sortby", $_REQUEST["sortby"]);
723: $pagerLink->setCustom("sortmode", $_REQUEST["sortmode"]);
724: $pagerLink->setCustom("search", $search);
725: $pagerLink->setCustom("frame", $frame);
726: $pagerLink->setCustom("area", $area);
727: $pagerLink->setCustom("search", $search);
728: $pagerLink->setCustom("filter", $filter);
729: 
730: $idExtraLangCount = 0;
731: foreach ($extraLanguages as $idExtraLangTemp) {
732:     $pagerLink->setCustom("extralang[$idExtraLangCount]", $idExtraLangTemp);
733:     $idExtraLangCount++;
734: }
735: 
736: $pagerLink->setCustom("contenido", $sess->id);
737: $pager = new cGuiObjectPager("02420d6b-a77e-4a97-9395-7f6be480f471", $counter, $_REQUEST["elemperpage"], $_REQUEST["page"], $pagerLink, "page", $pagerl);
738: 
739: $delLangLink = new cHTMLLink();
740: $delLangLink->setTargetFrame('right_bottom');
741: $delLangLink->setLink("main.php");
742: $delLangLink->setCustom("elemperpage", $elemperpage);
743: $delLangLink->setCustom("sortby", $_REQUEST["sortby"]);
744: $delLangLink->setCustom("sortmode", $_REQUEST["sortmode"]);
745: $delLangLink->setCustom("search", $search);
746: $delLangLink->setCustom("filter", $filter);
747: $delLangLink->setCustom("frame", $frame);
748: $delLangLink->setCustom("area", $area);
749: $delLangLink->setCustom("contenido", $sess->id);
750: 
751: $idExtraLangCount = 0;
752: foreach ($extraLanguages as $idExtraLangTemp) {
753:     $delLangLink->setCustom("extralang[$idExtraLangCount]", $idExtraLangTemp);
754:     $idExtraLangCount++;
755: }
756: 
757: $delLangLink->setCustom("dellang", '');
758: $delLangHref = $delLangLink->getHref();
759: 
760: $page->set("s", "NEWLANG", $formExtraLangsString);
761: $page->set("s", "SEARCH", $formSearch->render());
762: $page->set("s", "ELEMPERPAGE", $formElementsPerPage->render());
763: $page->set("s", "FORM", $form->render());
764: $page->set("s", "PAGER", $pager->render(true));
765: $page->set("s", "DELLANGIMG", $cfg["path"]["contenido_fullhtml"] . $cfg['path']['images'] . 'but_cancel.gif');
766: $page->set("s", "DELLANGALT", i18n("Delete"));
767: $page->set("s", "DELLANGHREF", $delLangHref);
768: $page->set("s", "MODULEINUSETEXT", i18n("The module &quot;%s&quot; is used for following templates"));
769: 
770: if (!$noResults) {
771:     $page->set("s", "INFO", $message . '<p class="notify_general notify_warning">' . i18n("WARNING: Translations have effects on every article that uses the module!") . '</p>');
772: } else {
773:     $page->set("s", "INFO", "");
774: }
775: 
776: $page->setMarkScript(2);
777: $page->setEncoding($langobj->get('encoding'));
778: $page->render();
779: 
CMS CONTENIDO 4.10.0 API documentation generated by ApiGen 2.8.0