Overview

Packages

  • Core
    • Authentication
    • Backend
    • Cache
    • CEC
    • Chain
    • ContentType
    • Database
    • Datatype
    • Debug
    • Exception
    • Frontend
      • Search
      • URI
      • Util
    • GenericDB
      • Model
    • GUI
      • HTML
    • I18N
    • LayoutHandler
    • Log
    • Security
    • Session
    • Util
    • Validation
    • Versioning
    • XML
  • Module
    • ContentSitemapHtml
    • ContentSitemapXml
    • ContentUserForum
    • NavigationTop
  • 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
  • cTinyMCEEditor
  • cWYSIWYGEditor
  • FrontendList
  • HtmlParser
  • TreeItem
  • UploadList
  • UploadSearchResultList

Functions

  • _processCmsTags
  • addArtspec
  • addslashes_deep
  • 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
  • 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
  • endsWith
  • extractNumber
  • generateDisplayFilePath
  • generateJs
  • getAktuellType
  • 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
  • modTestModule
  • 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
  • setHelpContext
  • setSystemProperty
  • showTree
  • startTiming
  • statCreateLocationString
  • statDisplayTopChooser
  • statDisplayYearlyTopChooser
  • statGetAvailableMonths
  • statGetAvailableYears
  • statResetStatistic
  • statsArchive
  • statsDisplayInfo
  • statsOverviewAll
  • statsOverviewTop
  • statsOverviewTopYear
  • statsOverviewYear
  • strAssignTemplate
  • strBuildSqlValues
  • strCheckTreeForErrors
  • strCopyCategory
  • strCopyTree
  • strDeeperCategoriesArray
  • strDeleteCategory
  • strHasArticles
  • strHasStartArticle
  • stripslashes_deep
  • 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
  • tplGetContainerTypes
  • tplGetInUsedData
  • tplIsTemplateInUse
  • tplPreparseLayout
  • updateClientCache
  • updateFileInformation
  • uplCreateFriendlyName
  • uplDirectoryListRecursive
  • uplGetDirectoriesToExclude
  • uplGetFileExtension
  • uplGetFileIcon
  • uplGetFileTypeDescription
  • uplGetThumbnail
  • uplHasFiles
  • uplHasSubdirs
  • uplmkdir
  • uplRecursiveDBDirectoryList
  • uplRecursiveDirectoryList
  • uplRenameDirectory
  • uplSearch
  • uplSyncDirectory
  • uplSyncDirectoryDBFS
  • xmlFileToArray
  • Overview
  • Package
  • Function
  • Tree
  • Deprecated
  • Todo
  1: <?php
  2: /**
  3:  * This file contains the mass module translation backend page in content area.
  4:  *
  5:  * @package Core
  6:  * @subpackage Backend
  7:  * @version SVN Revision $Rev:$
  8:  *
  9:  * @author Ingo van Peeren
 10:  * @copyright four for business AG <www.4fb.de>
 11:  * @license http://www.contenido.org/license/LIZENZ.txt
 12:  * @link http://www.4fb.de
 13:  * @link http://www.contenido.org
 14:  */
 15: 
 16: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
 17: 
 18: /**
 19:  * Extend cGuiScrollList for some special features like CSS class for table data
 20:  */
 21: class cGuiScrollListAlltranslations extends cGuiScrollList {
 22: 
 23:     function __construct() {
 24:         parent::__construct(false);
 25:         $this->objTable->setClass("generic alltranslations");
 26:         $this->objTable->updateAttributes(array(
 27:             "cellpadding" => "2"
 28:         ));
 29:     }
 30: 
 31:     /**
 32:      * Is called when a new row is rendered
 33:      *
 34:      * @param $row The current row which is being rendered
 35:      */
 36:     public function onRenderRow($row) {
 37:     }
 38: 
 39:     /**
 40:      * Is called when a new column is rendered
 41:      *
 42:      * @param $column The current column which is being rendered
 43:      */
 44:     public function onRenderColumn($column) {
 45:         $iColums = count($this->data[0]);
 46: 
 47:         switch ($column) {
 48:             case 1:
 49:                 $sClass = 'module';
 50:                 break;
 51:             case 2:
 52:                 $sClass = 'inuse';
 53:                 break;
 54:             case 3:
 55:                 $sClass = 'keyword';
 56:                 break;
 57:             case $iColums:
 58:                 $sClass = 'actions';
 59:                 break;
 60: 
 61:             default:
 62:                 $sClass = 'translation';
 63:                 break;
 64:         }
 65: 
 66:         $this->objItem->setClass($sClass);
 67:     }
 68: 
 69:     /**
 70:      * Sorts the list by a given field and a given order.
 71:      *
 72:      * @param $field Field index
 73:      * @param $order Sort order (see php's sort documentation)
 74:      */
 75:     public function sort($field, $order) {
 76:         if ($order == "") {
 77:             $order = SORT_ASC;
 78:         }
 79: 
 80:         if ($order == "ASC") {
 81:             $order = SORT_ASC;
 82:         }
 83: 
 84:         if ($order == "DESC") {
 85:             $order = SORT_DESC;
 86:         }
 87: 
 88:         $this->sortkey = $field;
 89:         $this->sortmode = $order;
 90: 
 91:         $field = $field + 1;
 92: 
 93:         if ($field > 3) {
 94:             $sortby = array();
 95:             foreach ($this->data as $row => $cols) {
 96:                 $sortby[$row] = trim(strtolower(strip_tags($cols[$field])));
 97:             }
 98:             $this->data = cArray::csort($this->data, $sortby, $order);
 99:         } else {
100:             $this->data = cArray::csort($this->data, "$field", $order);
101:         }
102:     }
103: 
104: }
105: 
106: /**
107:  * Adds sorting images to string
108:  *
109:  * @param int $index
110:  * @param string $sText
111:  * @return string
112:  */
113: function addSortImages($index, $text) {
114:     global $cfg;
115:     $sortUp = '<img src="' . $cfg["path"]["contenido_fullhtml"] . $cfg['path']['images'] . 'sort_up.gif" alt="' . i18n("Sort") . '" title="' . i18n("Sort") . '">';
116:     $sortDown = '<img src="' . $cfg["path"]["contenido_fullhtml"] . $cfg['path']['images'] . 'sort_down.gif" alt="' . i18n("Sort") . '" title="' . i18n("Sort") . '">';
117: 
118:     if ($_REQUEST["sortby"] == $index) {
119:         if ($_REQUEST["sortmode"] == 'ASC') {
120:             $sortString = $text . $sortUp;
121:         } else {
122:             $sortString = $text . $sortDown;
123:         }
124:     } else {
125:         $sortString = $text . $sortUp . $sortDown;
126:     }
127:     return $sortString;
128: }
129: 
130: $page = new cGuiPage("con_translate");
131: 
132: if (empty($action)) {
133:     $action = 'con_translate_view';
134: }
135: 
136: // Check permission for current user
137: if (!$perm->have_perm_area_action($area, $action)) {
138:     $page->displayCriticalError(i18n('Permission denied'));
139:     $page->render();
140:     return;
141: }
142: 
143: // If there is no client selected, display empty pag
144: if (!(int) $client > 0) {
145:     $page->render();
146:     return;
147: }
148: 
149: $inUseCollection = new cApiInUseCollection();
150: list($inUse, $message) = $inUseCollection->checkAndMark("translations", $client, true, i18n("Translations are used by %s (%s)"), true, "main.php?area=$area&frame=$frame");
151: unset($inUseCollection);
152: if ($inUse == true) {
153:     $message .= "<br>";
154: }
155: 
156: // Initialize
157: $elemPerPage = array(
158:     25 => "25",
159:     50 => "50"
160: );
161: 
162: $db = cRegistry::getDb();
163: 
164: $langobj = new cApiLanguage($lang);
165: 
166: $langstring = $langobj->get('name') . ' (' . $lang . ')';
167: 
168: $aTmpExtraLanguages = $_REQUEST["extralang"];
169: $extraLanguages = array();
170: if (is_array($aTmpExtraLanguages)) {
171:     foreach ($aTmpExtraLanguages as $idlang) {
172:         if ($idlang != $_REQUEST["dellang"]) {
173:             $extraLanguages[] = $idlang;
174:         }
175:     }
176: }
177: $allLanguages = array_merge(array(
178:     $lang
179: ), $extraLanguages);
180: 
181: $editstring = $_REQUEST["editstring"];
182: $editlang = $_REQUEST["editlang"];
183: if ($editlang != 'all') {
184:     $editlang = cSecurity::toInteger($editlang);
185: }
186: 
187: $search = strtolower(trim($_REQUEST["search"]));
188: $filter = $_REQUEST["filter"];
189: 
190: $cApiModuleCollection = new cApiModuleCollection();
191: $modulesInUse = $cApiModuleCollection->getModulesInUse();
192: 
193: $iNextPage = cSecurity::toInteger($_GET['nextpage']);
194: if ($iNextPage <= 0) {
195:     $iNextPage = 1;
196: }
197: 
198: if ($_REQUEST["sortmode"] !== "DESC") {
199:     $_REQUEST["sortmode"] = "ASC";
200: }
201: 
202: // no value found in request for items per page -> get it from db or set default
203: $oUser = new cApiUser($auth->auth["uid"]);
204: if (!isset($_REQUEST["elemperpage"]) || !is_numeric($_REQUEST['elemperpage']) || $_REQUEST['elemperpage'] < 0) {
205:     $_REQUEST["elemperpage"] = $oUser->getProperty("itemsperpage", $area);
206: }
207: if (!is_numeric($_REQUEST["elemperpage"])) {
208:     $_REQUEST["elemperpage"] = 25;
209: }
210: if ($_REQUEST["elemperpage"] > 0) {
211:     // -- All -- will not be stored, as it may be impossible to change this back
212:     // to something more useful
213:     $oUser->setProperty("itemsperpage", $area, $_REQUEST["elemperpage"]);
214: }
215: unset($oUser);
216: 
217: if (!isset($_REQUEST["page"]) || !is_numeric($_REQUEST['page']) || $_REQUEST['page'] <= 0 || $_REQUEST["elemperpage"] == 0) {
218:     $_REQUEST["page"] = 1;
219: }
220: 
221: // Save translations
222: if ($action == 'con_translate_save') {
223:     $error = false;
224: 
225:     $savetranslations = $_REQUEST["modtrans"];
226:     if (is_array($savetranslations)) {
227:         foreach ($savetranslations as $idmod => $savemodtranslations) {
228: 
229:             // get translation keywords from module
230:             $module = new cApiModule($idmod);
231:             $moduleKeywords = $module->parseModuleForStringsLoadFromFile($cfg, $client, $lang);
232:             $moduleKeywordsHashes = array();
233:             foreach ($moduleKeywords as $keyword) {
234:                 $moduleKeywordsHashes[md5($keyword)] = $keyword;
235:             }
236: 
237:             foreach ($savemodtranslations as $hash => $stringtranslations) {
238:                 foreach ($stringtranslations as $idlang => $modlangtranslation) {
239:                     $contenidoTranslateFromFile = new cModuleFileTranslation($idmod, false, $idlang);
240:                     $fileTranslations = $contenidoTranslateFromFile->getTranslationArray();
241: 
242:                     $hashparts = explode('_', $hash);
243:                     $translationKey = $moduleKeywordsHashes[$hashparts[1]];
244:                     $fileTranslations[stripslashes($translationKey)] = stripslashes($modlangtranslation);
245:                     $thislangerror = $contenidoTranslateFromFile->saveTranslationArray($fileTranslations);
246:                     if (!$thislangerror) {
247:                         $error = true;
248:                     }
249:                 }
250:             }
251:         }
252:     }
253: 
254:     if (!$error) {
255:         $page->displayInfo(i18n('Saved translation successfully!'));
256:     } else {
257:         $page->displayError(i18n("Can't save translation!"));
258:     }
259: }
260: 
261: // Get all modules and translations for current client
262: $sql = sprintf("SELECT idmod, name FROM %s WHERE idclient = %s ORDER BY name", $cfg['tab']['mod'], $client);
263: $db->query($sql);
264: 
265: $allModules = array();
266: $allTranslations = array();
267: 
268: while ($db->nextRecord()) {
269:     $idmod = $db->f('idmod');
270:     $allModules[$idmod] = $db->f('name');
271:     $module = new cApiModule($idmod);
272: 
273:     // Get the mi18n strings from modul input/output
274:     $strings = $module->parseModuleForStringsLoadFromFile($cfg, $client, $lang);
275: 
276:     foreach ($allLanguages as $idlang) {
277: 
278:         // Get the strings from translation file
279:         $contenidoTranslateFromFile = new cModuleFileTranslation($idmod, false, $idlang);
280:         $fileTranslations = $contenidoTranslateFromFile->getTranslationArray();
281:         $translations = array();
282:         foreach ($fileTranslations as $key => $value) {
283:             $hash = $idmod . '_' . md5($key);
284:             $translations[$hash] = $value;
285:         }
286: 
287:         $currentModuleTranslations = array();
288: 
289:         // Insert new strings
290:         foreach ($strings as $string) {
291:             $hash = $idmod . '_' . md5($string);
292:             if (isset($translations[$hash])) {
293:                 $currentTranslation = $translations[$hash];
294:             } else {
295:                 $currentTranslation = '';
296:             }
297:             if (isset($allTranslations[$hash])) {
298:                 $allTranslations[$hash]['translations'][$idlang] = $currentTranslation;
299:             } else {
300:                 $allTranslations[$hash] = array(
301:                     'string' => $string,
302:                     'translations' => array(
303:                         $idlang => $currentTranslation
304:                     ),
305:                     'idmod' => $idmod
306:                 );
307:             }
308:         }
309:     }
310: }
311: 
312: // Get all templates for current client
313: $aAllTemplates = array();
314: $sql = "SELECT
315:             *
316:         FROM
317:             " . $cfg["tab"]["tpl"] . "
318:         WHERE
319:             idclient = '" . cSecurity::toInteger($client) . "'
320:         ORDER BY
321:             name";
322: 
323: $db->query($sql);
324: while ($db->nextRecord()) {
325:     $aAllTemplates[$db->f("idtpl")] = $db->f('name');
326: }
327: 
328: // filter by module/template or by search string
329: if ($search != '' || ($filter != '' && $filter != -1)) {
330:     foreach ($allTranslations as $hash => $aTranslation) {
331:         // filter by search
332:         if ($search != '') {
333:             $bFoundSearch = false;
334:             if (stripos($aTranslation['string'], $search) !== false) {
335:                 $bFoundSearch = true;
336:             }
337:             foreach ($aTranslation['translations'] as $idlang => $langTranslation) {
338:                 if (stripos($langTranslation, $search) !== false) {
339:                     $bFoundSearch = true;
340:                 }
341:             }
342:         } else {
343:             $bFoundSearch = true;
344:         }
345: 
346:         // filter by module or template
347:         if ($filter != '' && $filter != -1) {
348:             $bFoundFilter = false;
349:             $aFilterType = explode('_', $filter);
350:             if ($aFilterType[0] == 'module') {
351:                 $iFilterModule = $aFilterType[1];
352:                 if ($aTranslation['idmod'] == $iFilterModule) {
353:                     $bFoundFilter = true;
354:                 }
355:             } else {
356:                 $iFilterTemplate = $aFilterType[1];
357:                 if (is_array($modulesInUse[$aTranslation['idmod']]) && array_key_exists($iFilterTemplate, $modulesInUse[$aTranslation['idmod']])) {
358:                     $bFoundFilter = true;
359:                 }
360:             }
361:         } else {
362:             $bFoundFilter = true;
363:         }
364: 
365:         if (!$bFoundSearch || !$bFoundFilter) {
366:             unset($allTranslations[$hash]);
367:         }
368:     }
369: }
370: 
371: unset($strings);
372: unset($fileTranslations);
373: unset($translations);
374: 
375: // Form for adding languages
376: $formExtraLangsString = '';
377: if (is_array($allLanguages)) {
378: 
379:     $formExtraLangs = new cHTMLForm('extralangs');
380:     $formExtraLangs->setVar('area', $area);
381:     $formExtraLangs->setVar('frame', $frame);
382:     $formExtraLangs->setVar("elemperpage", $_REQUEST["elemperpage"]);
383:     $formExtraLangs->setVar("sortby", $_REQUEST["sortby"]);
384:     $formExtraLangs->setVar("sortmode", $_REQUEST["sortmode"]);
385:     $formExtraLangs->setVar("search", $search);
386:     $formExtraLangs->setVar("filter", $filter);
387:     foreach ($extraLanguages as $idExtraLang) {
388:         $formExtraLangs->setVar('extralang[]', $idExtraLang);
389:     }
390: 
391:     $labelExtraLangs = new cHTMLSpan(i18n("New language for editing") . ': ', "vALignMiddle");
392:     $selectExtraLangs = new cHTMLSelectElement('extralang[]', "100px", 'newlang');
393:     $selectExtraLangs->setClass("vAlignTop");
394: 
395:     $sql = "SELECT
396:               A.name AS name, A.idlang AS idlang, B.idclientslang AS idclientslang
397:             FROM
398:               " . $cfg["tab"]["lang"] . " AS A,
399:               " . $cfg["tab"]["clients_lang"] . " AS B
400:             WHERE
401:               A.idlang = B.idlang AND
402:               B.idclient = '" . cSecurity::toInteger($client) . "'
403:             ORDER BY A.idlang";
404: 
405:     $db->query($sql);
406: 
407:     $langNames = array();
408:     $countExtraLangOptions = 0;
409:     while ($db->nextRecord()) {
410:         $idlang = $db->f("idlang");
411:         $langString = $db->f("name") . " (" . $db->f("idlang") . ")";
412:         $langNames[$idlang] = $langString;
413:         if (!in_array($idlang, $allLanguages)) {
414:             $option = new cHTMLOptionElement($langString, $idlang);
415:             $selectExtraLangs->addOptionElement($idlang, $option);
416:             $countExtraLangOptions++;
417:         }
418:     }
419:     $submitExtraLangs = new cHTMLButton('newlangsubmit', i18n("Add"), 'newlangsubmit', false, NULL, '', 'image', "vAlignTop tableElement");
420:     $submitExtraLangs->setImageSource($cfg["path"]["contenido_fullhtml"] . $cfg['path']['images'] . 'but_art_new.gif');
421: 
422:     $formExtraLangs->setContent($labelExtraLangs->render() . $selectExtraLangs->render() . $submitExtraLangs->render());
423:     if ($countExtraLangOptions > 0) {
424:         $formExtraLangsString = $formExtraLangs->render();
425:     }
426: }
427: 
428: // Form for choosing elements per page
429: $formElementsPerPage = new cHTMLForm('elementsperpage');
430: $formElementsPerPage->setVar('area', $area);
431: $formElementsPerPage->setVar('frame', $frame);
432: $formElementsPerPage->setVar('idclient', $client);
433: $formElementsPerPage->setVar("sortby", $_REQUEST["sortby"]);
434: $formElementsPerPage->setVar("sortmode", $_REQUEST["sortmode"]);
435: $formElementsPerPage->setVar("search", $search);
436: $formElementsPerPage->setVar("filter", $filter);
437: foreach ($extraLanguages as $idExtraLang) {
438:     $formElementsPerPage->setVar('extralang[]', $idExtraLang);
439: }
440: $labelElementsPerPage = new cHTMLLabel(i18n("Items per page:") . ':', 'elemperpage');
441: $selectElementsPerPage = new cHTMLSelectElement('elemperpage');
442: 
443: foreach ($elemPerPage as $value => $option) {
444:     $option = new cHTMLOptionElement($option, $value);
445:     if ($_REQUEST["elemperpage"] == $value) {
446:         $option->setSelected(true);
447:     }
448:     $selectElementsPerPage->addOptionElement($value, $option);
449: }
450: $selectElementsPerPage->setAttribute('class', 'elemperpage');
451: $submitElementsPerPage = new cHTMLButton('elemperpagesubmit', i18n("Submit"), 'elemperpagesubmit', false, NULL, '', 'image');
452: $submitElementsPerPage->setImageSource($cfg["path"]["contenido_fullhtml"] . $cfg['path']['images'] . 'but_ok.gif');
453: 
454: $formElementsPerPage->setContent($labelElementsPerPage->render() . $selectElementsPerPage->render() . $submitElementsPerPage->render());
455: 
456: // Form for filtering by module/template and searching by given strings
457: $formSearch = new cHTMLForm('searchfilter');
458: $formSearch->setVar('area', $area);
459: $formSearch->setVar('frame', $frame);
460: $formSearch->setVar("elemperpage", $elemperpage);
461: $formSearch->setVar("sortby", $_REQUEST["sortby"]);
462: $formSearch->setVar("sortmode", $_REQUEST["sortmode"]);
463: foreach ($extraLanguages as $idExtraLang) {
464:     $formSearch->setVar('extralang[]', $idExtraLang);
465: }
466: $filterSelect = '<select name="filter">';
467: $filterSelect .= '<option value="-1">' . i18n("-- filter by --") . '</option>';
468: if (is_array($allModules) && count($allModules) > 0) {
469:     $filterSelect .= '<optgroup label="' . i18n("Module name") . '">';
470:     foreach ($allModules as $idmod => $sModule) {
471:         if ($_REQUEST["filter"] == 'module_' . $idmod) {
472:             $sSelected = ' selected';
473:         } else {
474:             $sSelected = '';
475:         }
476:         $filterSelect .= '<option value="module_' . $idmod . '"' . $sSelected . '>' . $sModule . '</option>';
477:     }
478:     $filterSelect .= '</optgroup>';
479: }
480: if (is_array($aAllTemplates) && count($aAllTemplates) > 0) {
481:     $filterSelect .= '<optgroup label="' . i18n("Template") . '">';
482:     foreach ($aAllTemplates as $idtpl => $sTemplate) {
483:         if ($_REQUEST["filter"] == 'template_' . $idtpl) {
484:             $sSelected = ' selected';
485:         } else {
486:             $sSelected = '';
487:         }
488:         $filterSelect .= '<option value="template_' . $idtpl . '"' . $sSelected . '>' . $sTemplate . '</option>';
489:     }
490:     $filterSelect .= '</optgroup>';
491: }
492: $searchInput = new cHTMLTextbox('search', $search, 20);
493: 
494: $searchSubmit = ' <input type="image" name="searchsubmit" class="vAlignTop" value="submit" src="' . $cfg["path"]["contenido_fullhtml"] . $cfg['path']['images'] . 'but_preview.gif">';
495: 
496: $formSearch->SetContent($filterSelect . $searchInput->render() . $searchSubmit);
497: 
498: // The list of translations
499: $list = new cGuiScrollListAlltranslations();
500: // building parameter array
501: $tableHeaders = array(
502:     addSortImages($i, i18n('Module name')),
503:     addSortImages($i, i18n('In use by')),
504:     addSortImages(0, i18n('Translation ID')),
505:     addSortImages(1, i18n('Current language') . ': ' . $langstring)
506: );
507: $i = 4;
508: foreach ($extraLanguages as $idExtraLang) {
509:     $tableHeaders[] = '<span class="del" rel="' . $idExtraLang . '"></span> ' . addSortImages($i, i18n('Language') . ': ' . $langNames[$idExtraLang]);
510:     $i++;
511: }
512: $tableHeaders[] = i18n('Edit row');
513: 
514: call_user_func_array(array(
515:     $list,
516:     "setHeader"
517: ), $tableHeaders);
518: 
519: $iHeaders = count($tableHeaders);
520: for ($i = 0; $i < $iHeaders; $i++) {
521:     $list->setSortable($i, true);
522: }
523: $list->setCustom("nextpage", $iNextPage);
524: $list->setCustom("elemperpage", $_REQUEST["elemperpage"]);
525: $list->setCustom("sortby", $_REQUEST["sortby"]);
526: $list->setCustom("sortmode", $_REQUEST["sortmode"]);
527: $list->setCustom("search", $search);
528: $list->setCustom("filter", $filter);
529: foreach ($extraLanguages as $idExtraLang) {
530:     $list->setCustom("extralang[]", $idExtraLang);
531: }
532: $list->setResultsPerPage($_REQUEST["elemperpage"]);
533: $list->objHeaderItem->updateAttributes(array(
534:     'width' => 52
535: ));
536: $list->objRow->updateAttributes(array(
537:     'valign' => 'top'
538: ));
539: 
540: $submit = ' <input type="image" class="vAlignTop" value="submit" src="' . $cfg["path"]["contenido_fullhtml"] . $cfg['path']['images'] . 'but_ok.gif">';
541: 
542: foreach ($allTranslations as $hash => $translationArray) {
543:     if (!$inUse && $perm->have_perm_area_action($area, 'con_translate_edit') && $action == 'con_translate_edit' && ($editstring == 'all' || $editstring == $hash) && ($editlang == 'all' || $editlang == $lang)) {
544:         $oTranslation = new cHTMLTextarea('modtrans[' . $translationArray['idmod'] . '][' . $hash . '][' . $lang . ']', $translationArray['translations'][$lang]);
545:         $oTranslation->setWidth(30);
546:         $sTranslationFirstLang = $oTranslation->render();
547:         if ($editstring == $hash && $editlang == $lang) {
548:             $sTranslationFirstLang = $sTranslationFirstLang . $submit;
549:         }
550:     } else {
551:         if (!$inUse && $perm->have_perm_area_action($area, 'con_translate_edit') && $editstring != 'all') {
552:             $linkEdit = new cHTMLLink();
553:             $linkEdit->setCLink($area, $frame, "con_translate_edit");
554:             $linkEdit->setContent('<img src="' . $cfg["path"]["contenido_fullhtml"] . $cfg['path']['images'] . 'editieren.gif" alt="' . i18n("Edit") . '" title="' . i18n("Edit") . '">');
555:             $linkEdit->setCustom("editstring", $hash);
556:             $linkEdit->setCustom("editlang", $lang);
557:             $linkEdit->setCustom("elemperpage", $_REQUEST["elemperpage"]);
558:             $linkEdit->setCustom("page", $_REQUEST["page"]);
559:             $linkEdit->setCustom("sortby", $_REQUEST["sortby"]);
560:             $linkEdit->setCustom("sortmode", $_REQUEST["sortmode"]);
561:             $linkEdit->setCustom("search", $search);
562:             $linkEdit->setCustom("filter", $filter);
563:             foreach ($extraLanguages as $idExtraLang) {
564:                 $linkEdit->setCustom("extralang[]", $idExtraLang);
565:             }
566:             $sLinkEdit = ' ' . $linkEdit->render();
567:         } else {
568:             $sLinkEdit = '';
569:         }
570:         $sTranslationFirstLang = trim(strip_tags($translationArray['translations'][$lang])) . $sLinkEdit;
571:     }
572:     // building parameter array
573:     $countCurrentModuleInUse = count($modulesInUse[$translationArray['idmod']]);
574:     if ($countCurrentModuleInUse == 0) {
575:         $inUseString = '';
576:         $currentModuleInUse = i18n('No template');
577:     } else {
578: 
579:         $inUseString = i18n("Click for more information about usage");
580:         $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>';
581:     }
582:     $fields = array(
583:         $counter,
584:         $allModules[$translationArray['idmod']],
585:         $currentModuleInUse,
586:         $translationArray['string'],
587:         $sTranslationFirstLang
588:     );
589:     foreach ($extraLanguages as $idExtraLang) {
590:         if (!$inUse && $perm->have_perm_area_action($area, 'con_translate_edit') && $action == 'con_translate_edit' && ($editstring == 'all' || $editstring == $hash) && ($editlang == 'all' || $editlang == $idExtraLang)) {
591:             $oExtraTranslation = new cHTMLTextarea('modtrans[' . $translationArray['idmod'] . '][' . $hash . '][' . $idExtraLang . ']', $translationArray['translations'][$idExtraLang]);
592:             $oExtraTranslation->setWidth(30);
593: 
594:             if ($editstring == $hash && $editlang == $idExtraLang) {
595:                 $submitTranslation = $submit;
596:             } else {
597:                 $submitTranslation = '';
598:             }
599:             $fields[] = $oExtraTranslation->render() . $submitTranslation;
600:         } else {
601:             if (!$inUse && $perm->have_perm_area_action($area, 'con_translate_edit') && $editstring != 'all') {
602:                 $linkEdit = new cHTMLLink();
603:                 $linkEdit->setCLink($area, $frame, "con_translate_edit");
604:                 $linkEdit->setContent('<img src="' . $cfg["path"]["contenido_fullhtml"] . $cfg['path']['images'] . 'editieren.gif" alt="' . i18n("Edit") . '" title="' . i18n("Edit") . '">');
605:                 $linkEdit->setCustom("editstring", $hash);
606:                 $linkEdit->setCustom("editlang", $idExtraLang);
607:                 $linkEdit->setCustom("elemperpage", $_REQUEST["elemperpage"]);
608:                 $linkEdit->setCustom("page", $_REQUEST["page"]);
609:                 $linkEdit->setCustom("sortby", $_REQUEST["sortby"]);
610:                 $linkEdit->setCustom("sortmode", $_REQUEST["sortmode"]);
611:                 $linkEdit->setCustom("search", $search);
612:                 $linkEdit->setCustom("filter", $filter);
613:                 foreach ($extraLanguages as $idExtraLang) {
614:                     $linkEdit->setCustom("extralang[]", $idExtraLang);
615:                 }
616:                 $sLinkEdit = ' ' . $linkEdit->render();
617:             } else {
618:                 $sLinkEdit = '';
619:             }
620:             $fields[] = trim(strip_tags($translationArray['translations'][$idExtraLang])) . $sLinkEdit;
621:         }
622:     }
623:     if ($action == 'con_translate_edit' && $editstring == $hash && $editlang == 'all') {
624:         $fields[] = $submit;
625:     } else {
626:         if (!$inUse && $perm->have_perm_area_action($area, 'con_translate_edit')) {
627:             $linkEditRow = new cHTMLLink();
628:             $linkEditRow->setCLink($area, $frame, "con_translate_edit");
629:             $linkEditRow->setContent('<img src="' . $cfg["path"]["contenido_fullhtml"] . $cfg['path']['images'] . 'editieren.gif" alt="' . i18n("Edit") . '" title="' . i18n("Edit") . '">');
630:             $linkEditRow->setCustom("editstring", $hash);
631:             $linkEditRow->setCustom("editlang", 'all');
632:             $linkEditRow->setCustom("elemperpage", $_REQUEST["elemperpage"]);
633:             $linkEditRow->setCustom("page", $_REQUEST["page"]);
634:             $linkEditRow->setCustom("sortby", $_REQUEST["sortby"]);
635:             $linkEditRow->setCustom("sortmode", $_REQUEST["sortmode"]);
636:             $linkEditRow->setCustom("search", $search);
637:             $linkEditRow->setCustom("filter", $filter);
638:             foreach ($extraLanguages as $idExtraLang) {
639:                 $linkEditRow->setCustom("extralang[]", $idExtraLang);
640:             }
641:             $sLinkEditRow = ' ' . $linkEditRow->render();
642:         } else {
643:             $sLinkEditRow = '&nbsp;';
644:         }
645:         $fields[] = $sLinkEditRow;
646:     }
647: 
648:     call_user_func_array(array(
649:         $list,
650:         "setData"
651:     ), $fields);
652:     $counter++;
653: }
654: 
655: // Count all founded translations
656: // Important to calculate needed pages
657: $counter = count($allTranslations);
658: 
659: $list->sort($_REQUEST["sortby"], $_REQUEST["sortmode"]);
660: $list->setListStart($_REQUEST["page"]);
661: $form = new cHTMLForm('all_mod_translations');
662: $form->setVar('area', $area);
663: $form->setVar('action', 'con_translate_save');
664: $form->setVar('frame', 4);
665: $form->setVar("elemperpage", $_REQUEST["elemperpage"]);
666: $form->setVar("page", $_REQUEST["page"]);
667: $form->setVar("sortby", $_REQUEST["sortby"]);
668: $form->setVar("sortmode", $_REQUEST["sortmode"]);
669: $form->setVar("search", $search);
670: $form->setVar("filter", $filter);
671: foreach ($extraLanguages as $idExtraLang) {
672:     $form->setVar("extralang[]", $idExtraLang);
673: }
674: $form->setVar('contenido', $contenido);
675: $form->setContent($list->render());
676: 
677: // Generate current content for Object Pager
678: $pagerLink = new cHTMLLink();
679: $pagerl = "pagerlink";
680: $pagerLink->setTargetFrame('right_bottom');
681: $pagerLink->setLink("main.php");
682: $pagerLink->setCustom("elemperpage", $elemperpage);
683: $pagerLink->setCustom("sortby", $_REQUEST["sortby"]);
684: $pagerLink->setCustom("sortmode", $_REQUEST["sortmode"]);
685: $pagerLink->setCustom("search", $search);
686: $pagerLink->setCustom("frame", $frame);
687: $pagerLink->setCustom("area", $area);
688: $pagerLink->setCustom("search", $search);
689: $pagerLink->setCustom("filter", $filter);
690: foreach ($extraLanguages as $idExtraLang) {
691:     $pagerLink->setCustom("extralang[]", $idExtraLang);
692: }
693: $pagerLink->setCustom("contenido", $sess->id);
694: $pager = new cGuiObjectPager("02420d6b-a77e-4a97-9395-7f6be480f471", $counter, $_REQUEST["elemperpage"], $_REQUEST["page"], $pagerLink, "page", $pagerl);
695: 
696: $delLangLink = new cHTMLLink();
697: $delLangLink->setTargetFrame('right_bottom');
698: $delLangLink->setLink("main.php");
699: $delLangLink->setCustom("elemperpage", $elemperpage);
700: $delLangLink->setCustom("sortby", $_REQUEST["sortby"]);
701: $delLangLink->setCustom("sortmode", $_REQUEST["sortmode"]);
702: $delLangLink->setCustom("search", $search);
703: $delLangLink->setCustom("filter", $filter);
704: $delLangLink->setCustom("frame", $frame);
705: $delLangLink->setCustom("area", $area);
706: $delLangLink->setCustom("contenido", $sess->id);
707: foreach ($extraLanguages as $idExtraLang) {
708:     $delLangLink->setCustom("extralang[]", $idExtraLang);
709: }
710: $delLangLink->setCustom("dellang", '');
711: $delLangHref = $delLangLink->getHref();
712: 
713: $page->set("s", "NEWLANG", $formExtraLangsString);
714: $page->set("s", "SEARCH", $formSearch->render());
715: $page->set("s", "ELEMPERPAGE", $formElementsPerPage->render());
716: $page->set("s", "FORM", $form->render());
717: $page->set("s", "PAGER", $pager->render(true));
718: $page->set("s", "DELLANGIMG", $cfg["path"]["contenido_fullhtml"] . $cfg['path']['images'] . 'but_cancel.gif');
719: $page->set("s", "DELLANGALT", i18n("Delete"));
720: $page->set("s", "DELLANGHREF", $delLangHref);
721: $page->set("s", "MODULEINUSETEXT", i18n("The module &quot;%s&quot; is used for following templates"));
722: $page->set("s", "INFO", $message . '<p class="notify_general notify_warning">' . i18n("WARNING: Translations have effects on every article that uses the module!") . '</p>');
723: $page->setMarkScript(2);
724: $page->setEncoding($langobj->get('encoding'));
725: $page->render();
726: 
CMS CONTENIDO 4.9.2 API documentation generated by ApiGen 2.8.0