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