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
    • ContentRssCreator
    • ContentSitemapHtml
    • ContentSitemapXml
    • ContentUserForum
    • NavigationTop
    • ScriptCookieDirective
  • mpAutoloaderClassMap
  • None
  • Plugin
    • ContentAllocation
    • CronjobOverview
    • FormAssistant
    • FrontendLogic
    • FrontendUsers
    • Linkchecker
    • ModRewrite
    • Newsletter
    • Repository
      • FrontendNavigation
      • KeywordDensity
    • SearchSolr
    • 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
  • 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
  • conGetUsedModules
  • conHtmlentities
  • conHtmlEntityDecode
  • conHtmlSpecialChars
  • conIsLocked
  • conLock
  • conLockBulkEditing
  • conMakeArticleIndex
  • conMakeCatOnline
  • conMakeInlineScript
  • conMakeOnline
  • conMakeOnlineBulkEditing
  • conMakePublic
  • conMakeStart
  • conMoveArticles
  • conPhp54Check
  • conRemoveOldCategoryArticle
  • conSaveContentEntry
  • conSetCodeFlag
  • conSetCodeFlagBulkEditing
  • conSetMetaValue
  • 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
  • getFileContents
  • getFileInformation
  • getFileType
  • getGroupOrUserName
  • getIDForArea
  • getJsHelpContext
  • getLanguageNamesByClient
  • getLanguagesByClient
  • getmicrotime
  • getNamedFrame
  • getParam
  • getParentAreaId
  • 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
  • putFileContents
  • 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
  • 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(strtolower(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:  * @return string
118:  */
119: function addSortImages($index, $text) {
120:     global $cfg;
121:     $sortUp = '<img src="' . $cfg["path"]["contenido_fullhtml"] . $cfg['path']['images'] . 'sort_up.gif" alt="' . i18n("Sort") . '" title="' . i18n("Sort") . '">';
122:     $sortDown = '<img src="' . $cfg["path"]["contenido_fullhtml"] . $cfg['path']['images'] . 'sort_down.gif" alt="' . i18n("Sort") . '" title="' . i18n("Sort") . '">';
123: 
124:     if ($_REQUEST["sortby"] == $index) {
125:         if ($_REQUEST["sortmode"] == 'ASC') {
126:             $sortString = $text . $sortUp;
127:         } else {
128:             $sortString = $text . $sortDown;
129:         }
130:     } else {
131:         $sortString = $text . $sortUp . $sortDown;
132:     }
133:     return $sortString;
134: }
135: 
136: $page = new cGuiPage("con_translate");
137: 
138: if (empty($action)) {
139:     $action = 'con_translate_view';
140: }
141: 
142: // Check permission for current user
143: if (!$perm->have_perm_area_action($area, $action)) {
144:     $page->displayCriticalError(i18n('Permission denied'));
145:     $page->render();
146:     return;
147: }
148: 
149: // If there is no client selected, display empty pag
150: if (!(int) $client > 0) {
151:     $page->render();
152:     return;
153: }
154: 
155: $inUseCollection = new cApiInUseCollection();
156: list($inUse, $message) = $inUseCollection->checkAndMark("translations", $client, true, i18n("Translations are used by %s (%s)"), true, "main.php?area=$area&frame=$frame");
157: unset($inUseCollection);
158: if ($inUse == true) {
159:     $message .= "<br>";
160: }
161: 
162: // Initialize
163: $elemPerPage = array(
164:     25 => "25",
165:     50 => "50"
166: );
167: 
168: // Set noResults variable standard to false (= results available)
169: $noResults = false;
170: 
171: $db = cRegistry::getDb();
172: 
173: $langobj = new cApiLanguage($lang);
174: 
175: $langstring = $langobj->get('name') . ' (' . $lang . ')';
176: 
177: $aTmpExtraLanguages = $_REQUEST["extralang"];
178: $extraLanguages = array();
179: if (is_array($aTmpExtraLanguages)) {
180:     foreach ($aTmpExtraLanguages as $idlang) {
181:         if ($idlang != $_REQUEST["dellang"]) {
182:             $extraLanguages[] = $idlang;
183:         }
184:     }
185: }
186: $allLanguages = array_merge(array(
187:     $lang
188: ), $extraLanguages);
189: 
190: $editstring = $_REQUEST["editstring"];
191: $editlang = $_REQUEST["editlang"];
192: if ($editlang != 'all') {
193:     $editlang = cSecurity::toInteger($editlang);
194: }
195: 
196: $search = strtolower(trim($_REQUEST["search"]));
197: $filter = $_REQUEST["filter"];
198: 
199: $cApiModuleCollection = new cApiModuleCollection();
200: $modulesInUse = $cApiModuleCollection->getModulesInUse();
201: 
202: $iNextPage = cSecurity::toInteger($_GET['nextpage']);
203: if ($iNextPage <= 0) {
204:     $iNextPage = 1;
205: }
206: 
207: if ($_REQUEST["sortmode"] !== "DESC") {
208:     $_REQUEST["sortmode"] = "ASC";
209: }
210: 
211: // no value found in request for items per page -> get it from db or set default
212: $oUser = new cApiUser($auth->auth["uid"]);
213: if (!isset($_REQUEST["elemperpage"]) || !is_numeric($_REQUEST['elemperpage']) || $_REQUEST['elemperpage'] < 0) {
214:     $_REQUEST["elemperpage"] = $oUser->getProperty("itemsperpage", $area);
215: }
216: if (!is_numeric($_REQUEST["elemperpage"])) {
217:     $_REQUEST["elemperpage"] = 25;
218: }
219: if ($_REQUEST["elemperpage"] > 0) {
220:     // -- All -- will not be stored, as it may be impossible to change this back
221:     // to something more useful
222:     $oUser->setProperty("itemsperpage", $area, $_REQUEST["elemperpage"]);
223: }
224: unset($oUser);
225: 
226: if (!isset($_REQUEST["page"]) || !is_numeric($_REQUEST['page']) || $_REQUEST['page'] <= 0 || $_REQUEST["elemperpage"] == 0) {
227:     $_REQUEST["page"] = 1;
228: }
229: 
230: // Save translations
231: if ($action == 'con_translate_edit') {
232:     $error = false;
233: 
234:     $savetranslations = $_REQUEST['modtrans'];
235:     if (is_array($savetranslations)) {
236:         foreach ($savetranslations as $idmod => $savemodtranslations) {
237: 
238:             // get translation keywords from module
239:             $module = new cApiModule($idmod);
240:             $moduleKeywords = $module->parseModuleForStringsLoadFromFile($cfg, $client, $lang);
241:             $moduleKeywordsHashes = array();
242:             foreach ($moduleKeywords as $keyword) {
243:                 $moduleKeywordsHashes[md5($keyword)] = $keyword;
244:             }
245: 
246:             foreach ($savemodtranslations as $hash => $stringtranslations) {
247:                 foreach ($stringtranslations as $idlang => $modlangtranslation) {
248:                     $contenidoTranslateFromFile = new cModuleFileTranslation($idmod, false, $idlang);
249:                     $fileTranslations = $contenidoTranslateFromFile->getTranslationArray();
250: 
251:                     $hashparts = explode('_', $hash);
252:                     $translationKey = $moduleKeywordsHashes[$hashparts[1]];
253:                     $fileTranslations[stripslashes($translationKey)] = stripslashes($modlangtranslation);
254:                     $thislangerror = $contenidoTranslateFromFile->saveTranslationArray($fileTranslations);
255:                     if (!$thislangerror) {
256:                         $error = true;
257:                     }
258:                 }
259:             }
260:         }
261:     }
262: 
263:     if (!empty($_POST['modtrans'])) {
264:         if (!$error) {
265:             $page->displayOk(i18n('Saved translation successfully!'));
266:         } else {
267:             $page->displayError(i18n("Can't save translation!"));
268:         }
269:     }
270: }
271: 
272: // Get all modules and translations for current client
273: $sql = sprintf("SELECT idmod, name FROM %s WHERE idclient = %s ORDER BY name", $cfg['tab']['mod'], $client);
274: $db->query($sql);
275: 
276: $allModules = array();
277: $allTranslations = array();
278: 
279: while ($db->nextRecord()) {
280:     $idmod = $db->f('idmod');
281:     $allModules[$idmod] = $db->f('name');
282:     $module = new cApiModule($idmod);
283: 
284:     // Get the mi18n strings from modul input/output
285:     $strings = $module->parseModuleForStringsLoadFromFile($cfg, $client, $lang);
286: 
287:     foreach ($allLanguages as $idlang) {
288: 
289:         // Get the strings from translation file
290:         $contenidoTranslateFromFile = new cModuleFileTranslation($idmod, false, $idlang);
291:         $fileTranslations = $contenidoTranslateFromFile->getTranslationArray();
292: 
293:         $translations = array();
294:         foreach ($fileTranslations as $key => $value) {
295:             $hash = $idmod . '_' . md5($key);
296:             $translations[$hash] = $value;
297:         }
298: 
299:         $currentModuleTranslations = array();
300: 
301:         // Insert new strings
302:         foreach ($strings as $string) {
303:             $hash = $idmod . '_' . md5($string);
304:             if (isset($translations[$hash])) {
305:                 $currentTranslation = $translations[$hash];
306:             } else {
307:                 $currentTranslation = '';
308:             }
309:             if (isset($allTranslations[$hash])) {
310:                 $allTranslations[$hash]['translations'][$idlang] = $currentTranslation;
311:             } else {
312:                 $allTranslations[$hash] = array(
313:                     'string' => $string,
314:                     'translations' => array(
315:                         $idlang => $currentTranslation
316:                     ),
317:                     'idmod' => $idmod
318:                 );
319:             }
320:         }
321:     }
322: }
323: 
324: // Get all templates for current client
325: $aAllTemplates = array();
326: $sql = "SELECT
327:             *
328:         FROM
329:             " . $cfg["tab"]["tpl"] . "
330:         WHERE
331:             idclient = '" . cSecurity::toInteger($client) . "'
332:         ORDER BY
333:             name";
334: 
335: $db->query($sql);
336: while ($db->nextRecord()) {
337:     $aAllTemplates[$db->f("idtpl")] = $db->f('name');
338: }
339: 
340: // filter by module/template or by search string
341: if ($search != '' || ($filter != '' && $filter != -1)) {
342:     foreach ($allTranslations as $hash => $aTranslation) {
343:         // filter by search
344:         if ($search != '') {
345:             $bFoundSearch = false;
346:             if (stripos($aTranslation['string'], $search) !== false) {
347:                 $bFoundSearch = true;
348:             }
349:             foreach ($aTranslation['translations'] as $idlang => $langTranslation) {
350:                 if (stripos($langTranslation, $search) !== false) {
351:                     $bFoundSearch = true;
352:                 }
353:             }
354:         } else {
355:             $bFoundSearch = true;
356:         }
357: 
358:         // filter by module or template
359:         if ($filter != '' && $filter != -1) {
360:             $bFoundFilter = false;
361:             $aFilterType = explode('_', $filter);
362:             if ($aFilterType[0] == 'module') {
363:                 $iFilterModule = $aFilterType[1];
364:                 if ($aTranslation['idmod'] == $iFilterModule) {
365:                     $bFoundFilter = true;
366:                 }
367:             } else {
368:                 $iFilterTemplate = $aFilterType[1];
369:                 if (is_array($modulesInUse[$aTranslation['idmod']]) && array_key_exists($iFilterTemplate, $modulesInUse[$aTranslation['idmod']])) {
370:                     $bFoundFilter = true;
371:                 }
372:             }
373:         } else {
374:             $bFoundFilter = true;
375:         }
376: 
377:         if (!$bFoundSearch || !$bFoundFilter) {
378:             unset($allTranslations[$hash]);
379:         }
380:     }
381: }
382: 
383: if (empty($allTranslations)) {
384:     $page->displayInfo(i18n("Can not find some module translations for your selection."));
385:     $noResults = true;
386: }
387: 
388: unset($strings);
389: unset($fileTranslations);
390: unset($translations);
391: 
392: // Form for adding languages
393: $formExtraLangsString = '';
394: if (is_array($allLanguages)) {
395: 
396:     $formExtraLangs = new cHTMLForm('extralangs');
397:     $formExtraLangs->setVar('area', $area);
398:     $formExtraLangs->setVar('frame', $frame);
399:     $formExtraLangs->setVar("elemperpage", $_REQUEST["elemperpage"]);
400:     $formExtraLangs->setVar("sortby", $_REQUEST["sortby"]);
401:     $formExtraLangs->setVar("sortmode", $_REQUEST["sortmode"]);
402:     $formExtraLangs->setVar("search", $search);
403:     $formExtraLangs->setVar("filter", $filter);
404:     foreach ($extraLanguages as $idExtraLang) {
405:         $formExtraLangs->setVar('extralang[]', $idExtraLang);
406:     }
407: 
408:     $labelExtraLangs = new cHTMLSpan(i18n("New language for editing") . ': ', "vALignMiddle");
409:     $selectExtraLangs = new cHTMLSelectElement('extralang[]', "100px", 'newlang');
410:     $selectExtraLangs->setClass("vAlignTop");
411: 
412:     $sql = "SELECT
413:               A.name AS name, A.idlang AS idlang, B.idclientslang AS idclientslang
414:             FROM
415:               " . $cfg["tab"]["lang"] . " AS A,
416:               " . $cfg["tab"]["clients_lang"] . " AS B
417:             WHERE
418:               A.idlang = B.idlang AND
419:               B.idclient = '" . cSecurity::toInteger($client) . "'
420:             ORDER BY A.idlang";
421: 
422:     $db->query($sql);
423: 
424:     $langNames = array();
425:     $countExtraLangOptions = 0;
426:     while ($db->nextRecord()) {
427:         $idlang = $db->f("idlang");
428:         $langString = $db->f("name") . " (" . $db->f("idlang") . ")";
429:         $langNames[$idlang] = $langString;
430:         if (!in_array($idlang, $allLanguages)) {
431:             $option = new cHTMLOptionElement($langString, $idlang);
432:             $selectExtraLangs->addOptionElement($idlang, $option);
433:             $countExtraLangOptions++;
434:         }
435:     }
436:     $submitExtraLangs = new cHTMLButton('newlangsubmit', i18n("Add"), 'newlangsubmit', false, NULL, '', 'image', "vAlignTop tableElement");
437:     $submitExtraLangs->setImageSource($cfg["path"]["contenido_fullhtml"] . $cfg['path']['images'] . 'but_art_new.gif');
438: 
439:     $formExtraLangs->setContent($labelExtraLangs->render() . $selectExtraLangs->render() . $submitExtraLangs->render());
440:     if ($countExtraLangOptions > 0) {
441:         $formExtraLangsString = $formExtraLangs->render();
442:     }
443: }
444: 
445: // Form for choosing elements per page
446: $formElementsPerPage = new cHTMLForm('elementsperpage');
447: $formElementsPerPage->setVar('area', $area);
448: $formElementsPerPage->setVar('frame', $frame);
449: $formElementsPerPage->setVar('idclient', $client);
450: $formElementsPerPage->setVar("sortby", $_REQUEST["sortby"]);
451: $formElementsPerPage->setVar("sortmode", $_REQUEST["sortmode"]);
452: $formElementsPerPage->setVar("search", $search);
453: $formElementsPerPage->setVar("filter", $filter);
454: foreach ($extraLanguages as $idExtraLang) {
455:     $formElementsPerPage->setVar('extralang[]', $idExtraLang);
456: }
457: $labelElementsPerPage = new cHTMLLabel(i18n("Items per page:") . ':', 'elemperpage');
458: $selectElementsPerPage = new cHTMLSelectElement('elemperpage');
459: 
460: foreach ($elemPerPage as $value => $option) {
461:     $option = new cHTMLOptionElement($option, $value);
462:     if ($_REQUEST["elemperpage"] == $value) {
463:         $option->setSelected(true);
464:     }
465:     $selectElementsPerPage->addOptionElement($value, $option);
466: }
467: $selectElementsPerPage->setAttribute('class', 'elemperpage');
468: $submitElementsPerPage = new cHTMLButton('elemperpagesubmit', i18n("Submit"), 'elemperpagesubmit', false, NULL, '', 'image');
469: $submitElementsPerPage->setImageSource($cfg["path"]["contenido_fullhtml"] . $cfg['path']['images'] . 'but_ok.gif');
470: 
471: $formElementsPerPage->setContent($labelElementsPerPage->render() . $selectElementsPerPage->render() . $submitElementsPerPage->render());
472: 
473: // Form for filtering by module/template and searching by given strings
474: $formSearch = new cHTMLForm('searchfilter');
475: $formSearch->setVar('area', $area);
476: $formSearch->setVar('frame', $frame);
477: $formSearch->setVar("elemperpage", $elemperpage);
478: $formSearch->setVar("sortby", $_REQUEST["sortby"]);
479: $formSearch->setVar("sortmode", $_REQUEST["sortmode"]);
480: foreach ($extraLanguages as $idExtraLang) {
481:     $formSearch->setVar('extralang[]', $idExtraLang);
482: }
483: $filterSelect = '<select name="filter">';
484: $filterSelect .= '<option value="-1">' . i18n("-- filter by --") . '</option>';
485: if (is_array($allModules) && count($allModules) > 0) {
486:     $filterSelect .= '<optgroup label="' . i18n("Module name") . '">';
487:     foreach ($allModules as $idmod => $sModule) {
488:         if ($_REQUEST["filter"] == 'module_' . $idmod) {
489:             $sSelected = ' selected';
490:         } else {
491:             $sSelected = '';
492:         }
493:         $filterSelect .= '<option value="module_' . $idmod . '"' . $sSelected . '>' . $sModule . '</option>';
494:     }
495:     $filterSelect .= '</optgroup>';
496: }
497: if (is_array($aAllTemplates) && count($aAllTemplates) > 0) {
498:     $filterSelect .= '<optgroup label="' . i18n("Template") . '">';
499:     foreach ($aAllTemplates as $idtpl => $sTemplate) {
500:         if ($_REQUEST["filter"] == 'template_' . $idtpl) {
501:             $sSelected = ' selected';
502:         } else {
503:             $sSelected = '';
504:         }
505:         $filterSelect .= '<option value="template_' . $idtpl . '"' . $sSelected . '>' . $sTemplate . '</option>';
506:     }
507:     $filterSelect .= '</optgroup>';
508: }
509: $searchInput = new cHTMLTextbox('search', $search, 20);
510: 
511: $searchSubmit = ' <input type="image" name="searchsubmit" class="vAlignTop" value="submit" src="' . $cfg["path"]["contenido_fullhtml"] . $cfg['path']['images'] . 'but_preview.gif">';
512: 
513: $formSearch->setContent($filterSelect . $searchInput->render() . $searchSubmit);
514: 
515: // The list of translations
516: $list = new cGuiScrollListAlltranslations();
517: // building parameter array
518: $tableHeaders = array(
519:     addSortImages($i, i18n('Module name')),
520:     addSortImages($i, i18n('In use by')),
521:     addSortImages(0, i18n('Translation ID')),
522:     addSortImages(1, i18n('Current language') . ': ' . $langstring)
523: );
524: $i = 4;
525: foreach ($extraLanguages as $idExtraLang) {
526:     $tableHeaders[] = '<span class="del" rel="' . $idExtraLang . '"></span> ' . addSortImages($i, i18n('Language') . ': ' . $langNames[$idExtraLang]);
527:     $i++;
528: }
529: $tableHeaders[] = i18n('Edit row');
530: 
531: call_user_func_array(array(
532:     $list,
533:     "setHeader"
534: ), $tableHeaders);
535: 
536: $iHeaders = count($tableHeaders);
537: for ($i = 0; $i < $iHeaders; $i++) {
538:     $list->setSortable($i, true);
539: }
540: $list->setCustom("nextpage", $iNextPage);
541: $list->setCustom("elemperpage", $_REQUEST["elemperpage"]);
542: $list->setCustom("sortby", $_REQUEST["sortby"]);
543: $list->setCustom("sortmode", $_REQUEST["sortmode"]);
544: $list->setCustom("search", $search);
545: $list->setCustom("filter", $filter);
546: foreach ($extraLanguages as $idExtraLang) {
547:     $list->setCustom("extralang[]", $idExtraLang);
548: }
549: $list->setResultsPerPage($_REQUEST["elemperpage"]);
550: $list->objHeaderItem->updateAttributes(array(
551:     'width' => 52
552: ));
553: $list->objRow->updateAttributes(array(
554:     'valign' => 'top'
555: ));
556: 
557: $submit = ' <input type="image" class="vAlignTop" value="submit" src="' . $cfg["path"]["contenido_fullhtml"] . $cfg['path']['images'] . 'but_ok.gif">';
558: 
559: $counter = 0;
560: 
561: foreach ($allTranslations as $hash => $translationArray) {
562: 
563:     if (!$inUse && $perm->have_perm_area_action($area, 'con_translate_edit') && $action == 'con_translate_edit' && ($editstring == 'all' || $editstring == $hash) && ($editlang == 'all' || $editlang == $lang)) {
564:         $oTranslation = new cHTMLTextarea('modtrans[' . $translationArray['idmod'] . '][' . $hash . '][' . $lang . ']', conHtmlSpecialChars($translationArray['translations'][$lang]));
565:         $oTranslation->setWidth(30);
566:         $sTranslationFirstLang = $oTranslation->render();
567:         if ($editstring == $hash && $editlang == $lang) {
568:             $sTranslationFirstLang = $sTranslationFirstLang . $submit;
569:         }
570:     } else {
571:         if (!$inUse && $perm->have_perm_area_action($area, 'con_translate_edit') && $editstring != 'all') {
572:             $linkEdit = new cHTMLLink();
573:             $linkEdit->setCLink($area, $frame, "con_translate_edit");
574:             $linkEdit->setContent('<img src="' . $cfg["path"]["contenido_fullhtml"] . $cfg['path']['images'] . 'editieren.gif" alt="' . i18n("Edit") . '" title="' . i18n("Edit") . '">');
575:             $linkEdit->setCustom("editstring", $hash);
576:             $linkEdit->setCustom("editlang", $lang);
577:             $linkEdit->setCustom("elemperpage", $_REQUEST["elemperpage"]);
578:             $linkEdit->setCustom("page", $_REQUEST["page"]);
579:             $linkEdit->setCustom("sortby", $_REQUEST["sortby"]);
580:             $linkEdit->setCustom("sortmode", $_REQUEST["sortmode"]);
581:             $linkEdit->setCustom("search", $search);
582:             $linkEdit->setCustom("filter", $filter);
583: 
584:             $idExtraLangCount = 0;
585:             foreach ($extraLanguages as $idExtraLangTemp) {
586:                 $linkEdit->setCustom("extralang[$idExtraLangCount]", $idExtraLangTemp);
587:                 $idExtraLangCount++;
588:             }
589: 
590:             $sLinkEdit = ' ' . $linkEdit->render();
591:         } else {
592:             $sLinkEdit = '';
593:         }
594:         $sTranslationFirstLang = trim(conHtmlentities($translationArray['translations'][$lang])) . $sLinkEdit;
595:     }
596:     // building parameter array
597:     $countCurrentModuleInUse = count($modulesInUse[$translationArray['idmod']]);
598:     if ($countCurrentModuleInUse == 0) {
599:         $inUseString = '';
600:         $currentModuleInUse = i18n('No template');
601:     } else {
602: 
603:         $inUseString = i18n("Click for more information about usage");
604:         $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>';
605:     }
606:     $fields = array(
607:         $counter,
608:         $allModules[$translationArray['idmod']],
609:         $currentModuleInUse,
610:         $translationArray['string'],
611:         $sTranslationFirstLang
612:     );
613:     foreach ($extraLanguages as $idExtraLang) {
614:         if (!$inUse && $perm->have_perm_area_action($area, 'con_translate_edit') && $action == 'con_translate_edit' && ($editstring == 'all' || $editstring == $hash) && ($editlang == 'all' || $editlang == $idExtraLang)) {
615: 
616:             $oExtraTranslation = new cHTMLTextarea('modtrans[' . $translationArray['idmod'] . '][' . $hash . '][' . $idExtraLang . ']', conHtmlSpecialChars($translationArray['translations'][$idExtraLang]));
617:             $oExtraTranslation->setWidth(30);
618: 
619:             if ($editstring == $hash && $editlang == $idExtraLang) {
620:                 $submitTranslation = $submit;
621:             } else {
622:                 $submitTranslation = '';
623:             }
624:             $fields[] = $oExtraTranslation->render() . $submitTranslation;
625:         } else {
626:             if (!$inUse && $perm->have_perm_area_action($area, 'con_translate_edit') && $editstring != 'all') {
627:                 $linkEdit = new cHTMLLink();
628:                 $linkEdit->setCLink($area, $frame, "con_translate_edit");
629:                 $linkEdit->setContent('<img src="' . $cfg["path"]["contenido_fullhtml"] . $cfg['path']['images'] . 'editieren.gif" alt="' . i18n("Edit") . '" title="' . i18n("Edit") . '">');
630:                 $linkEdit->setCustom("editstring", $hash);
631:                 $linkEdit->setCustom("editlang", $idExtraLang);
632:                 $linkEdit->setCustom("elemperpage", $_REQUEST["elemperpage"]);
633:                 $linkEdit->setCustom("page", $_REQUEST["page"]);
634:                 $linkEdit->setCustom("sortby", $_REQUEST["sortby"]);
635:                 $linkEdit->setCustom("sortmode", $_REQUEST["sortmode"]);
636:                 $linkEdit->setCustom("search", $search);
637:                 $linkEdit->setCustom("filter", $filter);
638: 
639:                 $idExtraLangCount = 0;
640:                 foreach ($extraLanguages as $idExtraLangTemp) {
641:                     $linkEdit->setCustom("extralang[$idExtraLangCount]", $idExtraLangTemp);
642:                     $idExtraLangCount++;
643:                 }
644: 
645:                 $sLinkEdit = ' ' . $linkEdit->render();
646:             } else {
647:                 $sLinkEdit = '';
648:             }
649:             $fields[] = trim(conHtmlentities($translationArray['translations'][$idExtraLang])) . $sLinkEdit;
650:         }
651:     }
652:     if ($action == 'con_translate_edit' && $editstring == $hash && $editlang == 'all') {
653:         $fields[] = $submit;
654:     } else {
655:         if (!$inUse && $perm->have_perm_area_action($area, 'con_translate_edit')) {
656:             $linkEditRow = new cHTMLLink();
657:             $linkEditRow->setCLink($area, $frame, "con_translate_edit");
658:             $linkEditRow->setContent('<img src="' . $cfg["path"]["contenido_fullhtml"] . $cfg['path']['images'] . 'editieren.gif" alt="' . i18n("Edit") . '" title="' . i18n("Edit") . '">');
659:             $linkEditRow->setCustom("editstring", $hash);
660:             $linkEditRow->setCustom("editlang", 'all');
661:             $linkEditRow->setCustom("elemperpage", $_REQUEST["elemperpage"]);
662:             $linkEditRow->setCustom("page", $_REQUEST["page"]);
663:             $linkEditRow->setCustom("sortby", $_REQUEST["sortby"]);
664:             $linkEditRow->setCustom("sortmode", $_REQUEST["sortmode"]);
665:             $linkEditRow->setCustom("search", $search);
666:             $linkEditRow->setCustom("filter", $filter);
667: 
668:             $idExtraLangCount = 0;
669:             foreach ($extraLanguages as $idExtraLangTemp) {
670:                 $linkEditRow->setCustom("extralang[$idExtraLangCount]", $idExtraLangTemp);
671:                 $idExtraLangCount++;
672:             }
673: 
674:             $sLinkEditRow = ' ' . $linkEditRow->render();
675:         } else {
676:             $sLinkEditRow = '&nbsp;';
677:         }
678:         $fields[] = $sLinkEditRow;
679:     }
680: 
681:     call_user_func_array(array(
682:         $list,
683:         "setData"
684:     ), $fields);
685:     $counter++;
686: }
687: 
688: // Count all found translations
689: // Important to calculate needed pages
690: $counter = count($allTranslations);
691: 
692: $list->sort($_REQUEST["sortby"], $_REQUEST["sortmode"]);
693: $list->setListStart($_REQUEST["page"]);
694: $form = new cHTMLForm('all_mod_translations');
695: $form->setVar('area', $area);
696: $form->setVar('action', 'con_translate_edit');
697: $form->setVar('frame', 4);
698: $form->setVar("elemperpage", $_REQUEST["elemperpage"]);
699: $form->setVar("page", $_REQUEST["page"]);
700: $form->setVar("sortby", $_REQUEST["sortby"]);
701: $form->setVar("sortmode", $_REQUEST["sortmode"]);
702: $form->setVar("search", $search);
703: $form->setVar("filter", $filter);
704: 
705: $idExtraLangCount = 0;
706: foreach ($extraLanguages as $idExtraLangTemp) {
707:     $form->setVar("extralang[$idExtraLangCount]", $idExtraLangTemp);
708:     $idExtraLangCount++;
709: }
710: 
711: $form->setVar('contenido', $contenido);
712: $form->setContent($list->render());
713: 
714: // Generate current content for Object Pager
715: $pagerLink = new cHTMLLink();
716: $pagerl = "pagerlink";
717: $pagerLink->setTargetFrame('right_bottom');
718: $pagerLink->setLink("main.php");
719: $pagerLink->setCustom("elemperpage", $elemperpage);
720: $pagerLink->setCustom("sortby", $_REQUEST["sortby"]);
721: $pagerLink->setCustom("sortmode", $_REQUEST["sortmode"]);
722: $pagerLink->setCustom("search", $search);
723: $pagerLink->setCustom("frame", $frame);
724: $pagerLink->setCustom("area", $area);
725: $pagerLink->setCustom("search", $search);
726: $pagerLink->setCustom("filter", $filter);
727: 
728: $idExtraLangCount = 0;
729: foreach ($extraLanguages as $idExtraLangTemp) {
730:     $pagerLink->setCustom("extralang[$idExtraLangCount]", $idExtraLangTemp);
731:     $idExtraLangCount++;
732: }
733: 
734: $pagerLink->setCustom("contenido", $sess->id);
735: $pager = new cGuiObjectPager("02420d6b-a77e-4a97-9395-7f6be480f471", $counter, $_REQUEST["elemperpage"], $_REQUEST["page"], $pagerLink, "page", $pagerl);
736: 
737: $delLangLink = new cHTMLLink();
738: $delLangLink->setTargetFrame('right_bottom');
739: $delLangLink->setLink("main.php");
740: $delLangLink->setCustom("elemperpage", $elemperpage);
741: $delLangLink->setCustom("sortby", $_REQUEST["sortby"]);
742: $delLangLink->setCustom("sortmode", $_REQUEST["sortmode"]);
743: $delLangLink->setCustom("search", $search);
744: $delLangLink->setCustom("filter", $filter);
745: $delLangLink->setCustom("frame", $frame);
746: $delLangLink->setCustom("area", $area);
747: $delLangLink->setCustom("contenido", $sess->id);
748: 
749: $idExtraLangCount = 0;
750: foreach ($extraLanguages as $idExtraLangTemp) {
751:     $delLangLink->setCustom("extralang[$idExtraLangCount]", $idExtraLangTemp);
752:     $idExtraLangCount++;
753: }
754: 
755: $delLangLink->setCustom("dellang", '');
756: $delLangHref = $delLangLink->getHref();
757: 
758: $page->set("s", "NEWLANG", $formExtraLangsString);
759: $page->set("s", "SEARCH", $formSearch->render());
760: $page->set("s", "ELEMPERPAGE", $formElementsPerPage->render());
761: $page->set("s", "FORM", $form->render());
762: $page->set("s", "PAGER", $pager->render(true));
763: $page->set("s", "DELLANGIMG", $cfg["path"]["contenido_fullhtml"] . $cfg['path']['images'] . 'but_cancel.gif');
764: $page->set("s", "DELLANGALT", i18n("Delete"));
765: $page->set("s", "DELLANGHREF", $delLangHref);
766: $page->set("s", "MODULEINUSETEXT", i18n("The module &quot;%s&quot; is used for following templates"));
767: 
768: if (!$noResults) {
769:     $page->set("s", "INFO", $message . '<p class="notify_general notify_warning">' . i18n("WARNING: Translations have effects on every article that uses the module!") . '</p>');
770: } else {
771:     $page->set("s", "INFO", "");
772: }
773: 
774: $page->setMarkScript(2);
775: $page->setEncoding($langobj->get('encoding'));
776: $page->render();
777: 
CMS CONTENIDO 4.9.11 API documentation generated by ApiGen 2.8.0