コード例 #1
0
 /**
  * Searches the content and returns an array that is built as needed by the search module.
  *
  * @param string $searchTerm
  *
  * @return array
  */
 public function searchResultsForSearchModule($searchTerm)
 {
     $em = \Env::get('cx')->getDb()->getEntityManager();
     $pageRepo = $em->getRepository('Cx\\Core\\ContentManager\\Model\\Entity\\Page');
     // only list results in case the associated page of the module is active
     $page = $pageRepo->findOneBy(array('module' => 'MediaDir', 'lang' => FRONTEND_LANG_ID, 'type' => \Cx\Core\ContentManager\Model\Entity\Page::TYPE_APPLICATION));
     //If page is not exists or page is inactive then return empty result
     if (!$page || !$page->isActive()) {
         return array();
     }
     //get the config site values
     \Cx\Core\Setting\Controller\Setting::init('Config', 'site', 'Yaml');
     $coreListProtectedPages = \Cx\Core\Setting\Controller\Setting::getValue('coreListProtectedPages', 'Config');
     $searchVisibleContentOnly = \Cx\Core\Setting\Controller\Setting::getValue('searchVisibleContentOnly', 'Config');
     //get the config otherConfigurations value
     \Cx\Core\Setting\Controller\Setting::init('Config', 'otherConfigurations', 'Yaml');
     $searchDescriptionLength = \Cx\Core\Setting\Controller\Setting::getValue('searchDescriptionLength', 'Config');
     $hasPageAccess = true;
     $isNotVisible = $searchVisibleContentOnly == 'on' && !$page->isVisible();
     if ($coreListProtectedPages == 'off' && $page->isFrontendProtected()) {
         $hasPageAccess = \Permission::checkAccess($page->getFrontendAccessId(), 'dynamic', true);
     }
     //If the page is invisible and frontend access is denied then return empty result
     if ($isNotVisible || !$hasPageAccess) {
         return array();
     }
     //get the media directory entry by the search term
     $entries = new \Cx\Modules\MediaDir\Controller\MediaDirectoryEntry($this->moduleName);
     $entries->getEntries(null, null, null, $searchTerm);
     //if no entries found then return empty result
     if (empty($entries->arrEntries)) {
         return array();
     }
     $results = array();
     $formEntries = array();
     $defaultEntries = null;
     $objForm = new \Cx\Modules\MediaDir\Controller\MediaDirectoryForm(null, $this->moduleName);
     $numOfEntries = intval($entries->arrSettings['settingsPagingNumEntries']);
     foreach ($entries->arrEntries as $entry) {
         $pageUrlResult = null;
         $entryForm = $objForm->arrForms[$entry['entryFormId']];
         //Get the entry's link url
         //check the entry's form detail view exists if not,
         //check the entry's form overview exists if not,
         //check the default overview exists if not, dont show the corresponding entry in entry
         switch (true) {
             case $entries->checkPageCmd('detail' . $entry['entryFormId']):
                 $pageUrlResult = \Cx\Core\Routing\Url::fromModuleAndCmd($entries->moduleName, 'detail' . $entry['entryFormId'], FRONTEND_LANG_ID, array('eid' => $entry['entryId']));
                 break;
             case $pageCmdExists = $entries->checkPageCmd($entryForm['formCmd']):
             case $entries->checkPageCmd(''):
                 if ($pageCmdExists && !isset($formEntries[$entryForm['formCmd']])) {
                     $formEntries[$entryForm['formCmd']] = new \Cx\Modules\MediaDir\Controller\MediaDirectoryEntry($entries->moduleName);
                     $formEntries[$entryForm['formCmd']]->getEntries(null, null, null, null, null, null, 1, null, 'n', null, null, $entryForm['formId']);
                 }
                 if (!$pageCmdExists && !isset($defaultEntries)) {
                     $defaultEntries = new \Cx\Modules\MediaDir\Controller\MediaDirectoryEntry($entries->moduleName);
                     $defaultEntries->getEntries();
                 }
                 //get entry's form overview / default page paging position
                 $entriesPerPage = $numOfEntries;
                 if ($pageCmdExists) {
                     $entriesPerPage = !empty($entryForm['formEntriesPerPage']) ? $entryForm['formEntriesPerPage'] : $numOfEntries;
                 }
                 $pageCmd = $pageCmdExists ? $entryForm['formCmd'] : '';
                 $entryKeys = $pageCmdExists ? array_keys($formEntries[$entryForm['formCmd']]->arrEntries) : array_keys($defaultEntries->arrEntries);
                 $entryPos = array_search($entry['entryId'], $entryKeys);
                 $position = floor($entryPos / $entriesPerPage);
                 $pageUrlResult = \Cx\Core\Routing\Url::fromModuleAndCmd($entries->moduleName, $pageCmd, FRONTEND_LANG_ID, array('pos' => $position * $entriesPerPage));
                 break;
             default:
                 break;
         }
         //If page url is empty then dont show it in the result
         if (!$pageUrlResult) {
             continue;
         }
         //Get the search results title and content from the form context field 'title' and 'content'
         $title = current($entry['entryFields']);
         $content = '';
         $objInputfields = new MediaDirectoryInputfield($entry['entryFormId'], false, $entry['entryTranslationStatus'], $this->moduleName);
         $inputFields = $objInputfields->getInputfields();
         foreach ($inputFields as $arrInputfield) {
             $contextType = isset($arrInputfield['context_type']) ? $arrInputfield['context_type'] : '';
             if (!in_array($contextType, array('title', 'content'))) {
                 continue;
             }
             $strType = isset($arrInputfield['type_name']) ? $arrInputfield['type_name'] : '';
             $strInputfieldClass = "\\Cx\\Modules\\MediaDir\\Model\\Entity\\MediaDirectoryInputfield" . ucfirst($strType);
             try {
                 $objInputfield = safeNew($strInputfieldClass, $this->moduleName);
                 $arrTranslationStatus = contrexx_input2int($arrInputfield['type_multi_lang']) == 1 ? $entry['entryTranslationStatus'] : null;
                 $arrInputfieldContent = $objInputfield->getContent($entry['entryId'], $arrInputfield, $arrTranslationStatus);
                 if (\Cx\Core\Core\Controller\Cx::instanciate()->getMode() == \Cx\Core\Core\Controller\Cx::MODE_FRONTEND && \Cx\Core\Setting\Controller\Setting::getValue('blockStatus', 'Config')) {
                     $arrInputfieldContent[$this->moduleLangVar . '_INPUTFIELD_VALUE'] = preg_replace('/\\[\\[(BLOCK_[A-Z0-9_-]+)\\]\\]/', '{\\1}', $arrInputfieldContent[$this->moduleLangVar . '_INPUTFIELD_VALUE']);
                     \Cx\Modules\Block\Controller\Block::setBlocks($arrInputfieldContent[$this->moduleLangVar . '_INPUTFIELD_VALUE'], \Cx\Core\Core\Controller\Cx::instanciate()->getPage());
                 }
             } catch (\Exception $e) {
                 \DBG::log($e->getMessage());
                 continue;
             }
             $inputFieldValue = $arrInputfieldContent[$this->moduleConstVar . '_INPUTFIELD_VALUE'];
             if (empty($inputFieldValue)) {
                 continue;
             }
             if ($contextType == 'title') {
                 $title = $inputFieldValue;
             } elseif ($contextType == 'content') {
                 $content = \Cx\Core_Modules\Search\Controller\Search::shortenSearchContent($inputFieldValue, $searchDescriptionLength);
             }
         }
         $results[] = array('Score' => 100, 'Title' => html_entity_decode(contrexx_strip_tags($title), ENT_QUOTES, CONTREXX_CHARSET), 'Content' => $content, 'Link' => $pageUrlResult->toString());
     }
     return $results;
 }
コード例 #2
0
 function settings()
 {
     global $_ARRAYLANG, $_CORELANG;
     \Permission::checkAccess(MediaDirectoryAccessIDs::Settings, 'static');
     $this->_objTpl->loadTemplateFile('module_' . $this->moduleNameLC . '_settings.html', true, true);
     $this->pageTitle = $_CORELANG['TXT_SETTINGS'];
     $objSettings = new MediaDirectorySettings($this->moduleName);
     $tpl = isset($_GET['tpl']) ? $_GET['tpl'] : '';
     //save settings global
     if (isset($_POST['submitSettingsForm'])) {
         switch ($tpl) {
             case 'modify_form':
                 if (intval($_POST['formId']) != 0) {
                     $objInputfields = new MediaDirectoryInputfield(intval($_POST['formId']), false, null, $this->moduleName);
                     $strStatus = $objInputfields->saveInputfields($_POST);
                 }
                 $objForms = new MediaDirectoryForm(null, $this->moduleName);
                 $strStatus = $objForms->saveForm($_POST, intval($_POST['formId']));
                 break;
             case 'forms':
                 $objForms = new MediaDirectoryForm(null, $this->moduleName);
                 $strStatus = $objForms->saveOrder($_POST);
                 break;
             case 'mails':
                 $strStatus = $objSettings->settings_save_mail($_POST);
                 break;
             case 'masks':
                 $strStatus = $objSettings->settings_save_mask($_POST);
                 break;
             case 'map':
                 $strStatus = $objSettings->settings_save_map($_POST);
                 break;
             default:
                 $strStatus = $objSettings->saveSettings($_POST);
         }
         if ($strStatus == true) {
             $this->strOkMessage = $_CORELANG['TXT_SETTINGS_UPDATED'];
         } else {
             $this->strErrMessage = $_CORELANG['TXT_DATABASE_QUERY_ERROR'];
         }
     }
     $this->_objTpl->setGlobalVariable(array('TXT_' . $this->moduleLangVar . '_ENTRIES' => $_ARRAYLANG['TXT_MEDIADIR_ENTRIES'], 'TXT_' . $this->moduleLangVar . '_LEVELS_AND_CATEGORIES' => $_ARRAYLANG['TXT_MEDIADIR_LEVELS_AND_CATEGORIES'], 'TXT_' . $this->moduleLangVar . '_SUBMIT' => $_ARRAYLANG['TXT_' . $this->moduleLangVar . '_SUBMIT'], 'TXT_' . $this->moduleLangVar . '_DELETE' => $_CORELANG['TXT_DELETE'], 'TXT_' . $this->moduleLangVar . '_ACTIVATE' => $_ARRAYLANG['TXT_MEDIADIR_ACTIVATE'], 'TXT_' . $this->moduleLangVar . '_DEACTIVATE' => $_ARRAYLANG['TXT_MEDIADIR_DEAVTIVATE'], 'TXT_' . $this->moduleLangVar . '_FORMS' => $_ARRAYLANG['TXT_MEDIADIR_FORMS'], 'TXT_' . $this->moduleLangVar . '_MAIL_TEMPLATES' => $_ARRAYLANG['TXT_MEDIADIR_MAIL_TEMPLATES'], 'TXT_' . $this->moduleLangVar . '_PICS_AND_FILES' => $_ARRAYLANG['TXT_MEDIADIR_PICS_AND_FILES'], 'TXT_' . $this->moduleLangVar . '_GOOGLE' => $_ARRAYLANG['TXT_MEDIADIR_GOOGLE'], 'TXT_' . $this->moduleLangVar . '_HITS_AND_LATEST' => $_ARRAYLANG['TXT_MEDIADIR_HITS_AND_LATEST'], 'TXT_' . $this->moduleLangVar . '_COMMENTS_AND_VOTING' => $_ARRAYLANG['TXT_MEDIADIR_COMMENTS_AND_VOTING'], 'TXT_' . $this->moduleLangVar . '_CLASSIFICATION' => $_ARRAYLANG['TXT_MEDIADIR_CLASSIFICATION'], 'TXT_' . $this->moduleLangVar . '_EXPORT_MASKS' => $_ARRAYLANG['TXT_MEDIADIR_EXPORT_MASKS']));
     switch ($tpl) {
         case 'delete_mask':
         case 'masks':
             $objSettings->settings_masks($this->_objTpl);
             break;
         case 'modify_mask':
             $objSettings->settings_modify_mask($this->_objTpl);
             break;
         case 'delete_form':
         case 'forms':
             $objSettings->settings_forms($this->_objTpl);
             break;
         case 'modify_form':
             $objSettings->settings_modify_form($this->_objTpl);
             break;
         case 'delete_template':
         case 'mails':
             $objSettings->settings_mails($this->_objTpl);
             break;
         case 'modify_mail':
             $objSettings->settings_modify_mail($this->_objTpl);
             break;
         case 'files':
             $objSettings->settings_files($this->_objTpl);
             break;
         case 'map':
             $objSettings->settings_map($this->_objTpl);
             break;
         case 'votes':
             $objSettings->settings_votes($this->_objTpl);
             break;
         case 'levels_categories':
             $objSettings->settings_levels_categories($this->_objTpl);
             break;
         case 'classification':
             $objSettings->settings_classification($this->_objTpl);
             break;
         case 'entries':
         default:
             $objSettings->settings_entries($this->_objTpl);
     }
     $this->_objTpl->parse('settings_content');
 }
コード例 #3
0
 function modifyEntry()
 {
     global $_ARRAYLANG, $_CORELANG;
     $this->_objTpl->setTemplate($this->pageContent, true, true);
     parent::getSettings();
     $bolFileSizesStatus = true;
     $strOkMessage = '';
     $strErrMessage = '';
     $strOnSubmit = '';
     //count forms
     $objForms = new MediaDirectoryForm(null, $this->moduleName);
     $arrActiveForms = array();
     foreach ($objForms->arrForms as $intFormId => $arrForm) {
         if ($arrForm['formActive'] == 1) {
             $arrActiveForms[] = $intFormId;
         }
     }
     //check id and form
     if (!empty($_REQUEST['eid']) || !empty($_REQUEST['entryId'])) {
         if (!empty($_REQUEST['eid'])) {
             $intEntryId = intval($_REQUEST['eid']);
         }
         if (!empty($_REQUEST['entryId'])) {
             $intEntryId = intval($_REQUEST['entryId']);
         }
         $intFormId = intval(substr($_GET['cmd'], 4));
     } else {
         $intEntryId = null;
         $intFormId = intval(substr($_GET['cmd'], 3));
     }
     $intCountForms = count($arrActiveForms);
     if ($intCountForms > 0) {
         //check form
         if (intval($intEntryId) == 0 && empty($_REQUEST['selectedFormId']) && empty($_POST['formId']) && $intCountForms > 1 && $intFormId == 0) {
             $intFormId = null;
             //get form selector
             $objForms = new MediaDirectoryForm(null, $this->moduleName);
             $objForms->listForms($this->_objTpl, 3, $intFormId);
             //parse blocks
             $this->_objTpl->hideBlock($this->moduleNameLC . 'Inputfields');
         } else {
             //save entry data
             if (isset($_POST['submitEntryModfyForm'])) {
                 $objEntry = new MediaDirectoryEntry($this->moduleName);
                 $strStatus = $objEntry->saveEntry($_POST, intval($_POST['entryId']));
                 if (!empty($_POST['entryId'])) {
                     $objEntry->getEntries(intval($_POST['entryId']));
                     if ($strStatus == true) {
                         if (intval($_POST['readyToConfirm']) == 1) {
                             if ($objEntry->arrEntries[intval($_POST['entryId'])]['entryConfirmed'] == 1) {
                                 $bolReadyToConfirmMessage = false;
                                 $bolSaveOnlyMessage = false;
                             } else {
                                 $bolReadyToConfirmMessage = true;
                                 $bolSaveOnlyMessage = false;
                             }
                         } else {
                             $bolReadyToConfirmMessage = false;
                             $bolSaveOnlyMessage = true;
                         }
                         $strOkMessage = $_ARRAYLANG['TXT_MEDIADIR_ENTRY'] . " " . $_ARRAYLANG['TXT_MEDIADIR_SUCCESSFULLY_EDITED'];
                     } else {
                         $strErrMessage = $_ARRAYLANG['TXT_MEDIADIR_ENTRY'] . " " . $_ARRAYLANG['TXT_MEDIADIR_CORRUPT_EDITED'];
                     }
                 } else {
                     if ($strStatus == true) {
                         if (intval($_POST['readyToConfirm']) == 1) {
                             $bolReadyToConfirmMessage = true;
                             $bolSaveOnlyMessage = false;
                         } else {
                             $bolReadyToConfirmMessage = false;
                             $bolSaveOnlyMessage = true;
                         }
                         $strOkMessage = $_ARRAYLANG['TXT_MEDIADIR_ENTRY'] . " " . $_ARRAYLANG['TXT_MEDIADIR_SUCCESSFULLY_ADDED'];
                     } else {
                         $strErrMessage = $_ARRAYLANG['TXT_MEDIADIR_ENTRY'] . " " . $_ARRAYLANG['TXT_MEDIADIR_CORRUPT_ADDED'];
                     }
                 }
                 if (!empty($_POST['entryId'])) {
                     if ($strStatus == true) {
                         $strOkMessage = $_ARRAYLANG['TXT_MEDIADIR_ENTRY'] . " " . $_ARRAYLANG['TXT_MEDIADIR_SUCCESSFULLY_EDITED'];
                     } else {
                         $strErrMessage = $_ARRAYLANG['TXT_MEDIADIR_ENTRY'] . " " . $_ARRAYLANG['TXT_MEDIADIR_CORRUPT_EDITED'];
                     }
                 } else {
                     if ($strStatus == true) {
                         $strOkMessage = $_ARRAYLANG['TXT_MEDIADIR_ENTRY'] . " " . $_ARRAYLANG['TXT_MEDIADIR_SUCCESSFULLY_ADDED'];
                     } else {
                         $strErrMessage = $_ARRAYLANG['TXT_MEDIADIR_ENTRY'] . " " . $_ARRAYLANG['TXT_MEDIADIR_CORRUPT_ADDED'];
                     }
                 }
             } else {
                 //get form id
                 if (intval($intEntryId) != 0) {
                     //get entry data
                     $objEntry = new MediaDirectoryEntry($this->moduleName);
                     if ($this->arrSettings['settingsReadyToConfirm'] == 1) {
                         $objEntry->getEntries($intEntryId, null, null, null, null, null, true, null, 'n', null, null, null, true);
                     } else {
                         $objEntry->getEntries($intEntryId);
                     }
                     $intFormId = $objEntry->arrEntries[$intEntryId]['entryFormId'];
                 } else {
                     //set form id
                     if ($intCountForms == 1) {
                         $intFormId = intval($arrActiveForms[0]);
                     } else {
                         if ($intFormId == 0) {
                             $intFormId = intval($_REQUEST['selectedFormId']);
                         }
                     }
                 }
                 //get inputfield object
                 $objInputfields = new MediaDirectoryInputfield($intFormId, false, null, $this->moduleName);
                 //list inputfields
                 $objInputfields->listInputfields($this->_objTpl, 2, $intEntryId);
                 //get translation status date
                 if ($this->arrSettings['settingsTranslationStatus'] == 1) {
                     foreach ($this->arrFrontendLanguages as $key => $arrLang) {
                         if ($arrLang['id'] == 2) {
                             $strLangStatus = 'checked="checked" disabled="disabled"';
                         } elseif ($intEntryId != 0) {
                             if (in_array($arrLang['id'], $objEntry->arrEntries[$intEntryId]['entryTranslationStatus'])) {
                                 $strLangStatus = 'checked="checked"';
                             } else {
                                 $strLangStatus = '';
                             }
                         } else {
                             $strLangStatus = '';
                         }
                         $this->_objTpl->setVariable(array('TXT_' . $this->moduleLangVar . '_TRANSLATION_LANG_NAME' => htmlspecialchars($arrLang['name'], ENT_QUOTES, CONTREXX_CHARSET), $this->moduleLangVar . '_TRANSLATION_LANG_ID' => intval($arrLang['id']), $this->moduleLangVar . '_TRANSLATION_LANG_STATUS' => $strLangStatus));
                         $this->_objTpl->parse($this->moduleNameLC . 'TranslationLangList');
                     }
                 } else {
                     $this->_objTpl->hideBlock($this->moduleNameLC . 'TranslationStatus');
                 }
                 //get ready to confirm
                 if ($this->arrSettings['settingsReadyToConfirm'] == 1 && empty($objEntry->arrEntries[$intEntryId]['entryReadyToConfirm']) && empty($objEntry->arrEntries[$intEntryId]['entryConfirmed'])) {
                     $objForm = new MediaDirectoryForm($intFormId, $this->moduleName);
                     if ($objForm->arrForms[$intFormId]['formUseReadyToConfirm'] == 1) {
                         $strReadyToConfirm = '<p><input class="' . $this->moduleNameLC . 'InputfieldCheckbox" name="readyToConfirm" id="' . $this->moduleNameLC . 'Inputfield_ReadyToConfirm" value="1" type="checkbox">&nbsp;' . $_ARRAYLANG['TXT_MEDIADIR_READY_TO_CONFIRM'] . '</p>';
                     } else {
                         $strReadyToConfirm = '<input type="hidden" name="readyToConfirm" value="1" />';
                     }
                 } else {
                     $strReadyToConfirm = '<input type="hidden" name="readyToConfirm" value="1" />';
                 }
                 $this->_objTpl->setVariable(array($this->moduleLangVar . '_READY_TO_CONFIRM' => $strReadyToConfirm));
                 //generate javascript
                 parent::setJavascript($this->getSelectorJavascript());
                 parent::setJavascript($objInputfields->getInputfieldJavascript());
                 //parent::setJavascript("\$J().ready(function(){ \$J('.mediadirInputfieldHint').inputHintBox({className:'mediadirInputfieldInfobox',incrementLeft:3,incrementTop:-6}); });");
                 //get form onsubmit
                 $strOnSubmit = parent::getFormOnSubmit($objInputfields->arrJavascriptFormOnSubmit);
                 //parse blocks
                 $this->_objTpl->hideBlock($this->moduleNameLC . 'Forms');
             }
         }
         if (!empty($_SESSION[$this->moduleNameLC]) && empty($_SESSION[$this->moduleNameLC]['bolFileSizesStatus'])) {
             $strFileMessage = '<div class="' . $this->moduleNameLC . 'FileErrorMessage">' . $_ARRAYLANG['TXT_MEDIADIR_IMAGE_ERROR_MESSAGE'] . '</div>';
             unset($_SESSION[$this->moduleNameLC]['bolFileSizesStatus']);
         } else {
             $strFileMessage = '';
         }
         //parse global variables
         $this->_objTpl->setVariable(array($this->moduleLangVar . '_ENTRY_ID' => $intEntryId, $this->moduleLangVar . '_FORM_ID' => $intFormId, 'TXT_' . $this->moduleLangVar . '_SUBMIT' => $_ARRAYLANG['TXT_' . $this->moduleLangVar . '_SUBMIT'], $this->moduleLangVar . '_FORM_ONSUBMIT' => $strOnSubmit, 'TXT_' . $this->moduleLangVar . '_PLEASE_CHECK_INPUT' => $_ARRAYLANG['TXT_MEDIADIR_PLEASE_CHECK_INPUT'], 'TXT_' . $this->moduleLangVar . '_OK_MESSAGE' => $strOkMessage . $strFileMessage, 'TXT_' . $this->moduleLangVar . '_ERROR_MESSAGE' => $strErrMessage . $strFileMessage, $this->moduleLangVar . '_MAX_CATEGORY_SELECT' => $strErrMessage, 'TXT_' . $this->moduleLangVar . '_TRANSLATION_STATUS' => $_ARRAYLANG['TXT_MEDIADIR_TRANSLATION_STATUS']));
         if (!empty($strOkMessage)) {
             $this->_objTpl->touchBlock($this->moduleNameLC . 'EntryOkMessage');
             $this->_objTpl->hideBlock($this->moduleNameLC . 'EntryErrMessage');
             $this->_objTpl->hideBlock($this->moduleNameLC . 'EntryModifyForm');
             if ($bolReadyToConfirmMessage) {
                 $this->_objTpl->touchBlock($this->moduleNameLC . 'EntryReadyToConfirmMessage');
                 $this->_objTpl->hideBlock($this->moduleNameLC . 'EntryOkMessage');
             }
             if ($bolSaveOnlyMessage) {
                 $this->_objTpl->touchBlock($this->moduleNameLC . 'EntrySaveOnlyMessage');
                 $this->_objTpl->hideBlock($this->moduleNameLC . 'EntryOkMessage');
             }
         } else {
             if (!empty($strErrMessage)) {
                 $this->_objTpl->hideBlock($this->moduleNameLC . 'EntryOkMessage');
                 $this->_objTpl->touchBlock($this->moduleNameLC . 'EntryErrMessage');
                 $this->_objTpl->hideBlock($this->moduleNameLC . 'EntryModifyForm');
             } else {
                 $this->_objTpl->hideBlock($this->moduleNameLC . 'EntryOkMessage');
                 $this->_objTpl->hideBlock($this->moduleNameLC . 'EntryErrMessage');
                 $this->_objTpl->parse($this->moduleNameLC . 'EntryModifyForm');
                 $this->_objTpl->hideBlock($this->moduleNameLC . 'EntryReadyToConfirmMessage');
                 $this->_objTpl->hideBlock($this->moduleNameLC . 'EntrySaveOnlyMessage');
             }
         }
     } else {
         header("Location: index.php?section=" . $_GET['section']);
         exit;
     }
 }
コード例 #4
0
    function getExpandedInputfields()
    {
        global $_ARRAYLANG, $objDatabase, $_LANGID;
        $formId = null;
        $strPleaseChoose = $_ARRAYLANG['TXT_MEDIADIR_PLEASE_CHOOSE'];
        $strExpandedInputfields = '';
        //get ids
        if (!empty($_GET['cmd'])) {
            $bolShowLevelSelector = false;
            $bolShowCategorySelector = false;
            $arrIds = explode('-', $_GET['cmd']);
            if ($arrIds[0] != 'search' && $arrIds[0] != 'alphabetical') {
                $objForms = new MediaDirectoryForm(null, $this->moduleName);
                foreach ($objForms->arrForms as $id => $arrForm) {
                    if (!empty($arrForm['formCmd']) && $arrForm['formCmd'] == $_GET['cmd']) {
                        $formId = intval($id);
                    }
                }
                if ($objForms->arrForms[$formId]['formUseLevel'] == 1 && $this->arrSettings['levelSelectorExpSearch'][$formId] == 1) {
                    $bolShowLevelSelector = true;
                }
                if ($objForms->arrForms[$formId]['formUseCategory'] == 1 && $this->arrSettings['categorySelectorExpSearch'][$formId] == 1) {
                    $bolShowCategorySelector = true;
                }
            } else {
                $bolShowLevelSelector = in_array(1, $this->arrSettings['levelSelectorExpSearch']);
                $bolShowCategorySelector = in_array(1, $this->arrSettings['categorySelectorExpSearch']);
            }
        } else {
            $bolShowLevelSelector = in_array(1, $this->arrSettings['levelSelectorExpSearch']);
            $bolShowCategorySelector = in_array(1, $this->arrSettings['categorySelectorExpSearch']);
        }
        if ($this->arrSettings['settingsShowLevels'] && $bolShowLevelSelector) {
            if (intval($arrIds[0]) != 0) {
                $intLevelId = intval($arrIds[0]);
            } else {
                $intLevelId = 0;
            }
            $intLevelId = isset($_GET['lid']) ? intval($_GET['lid']) : $intLevelId;
            $objLevels = new MediaDirectoryLevel(null, null, 1, $this->moduleName);
            $strLevelDropdown = $objLevels->listLevels($this->_objTpl, 3, $intLevelId);
            $strLevelName = $_ARRAYLANG['TXT_MEDIADIR_LEVEL'];
            $strInputfieldSearch = $this->moduleNameLC . "InputfieldSearch";
            $strExpandedInputfields .= <<<EOF
<p><label>{$strLevelName}</label><select class="{$strInputfieldSearch}" name="lid"><option value="">{$strPleaseChoose}</option>{$strLevelDropdown}</select></p>
EOF;
            if (!empty($arrIds[1])) {
                $intCategoryCmd = $arrIds[1];
            } else {
                $intCategoryCmd = 0;
            }
        } else {
            if (intval($arrIds[0]) != 0) {
                $intCategoryCmd = $arrIds[0];
            } else {
                $intCategoryCmd = 0;
            }
        }
        if ($intCategoryCmd != 0) {
            $intCategoryId = intval($intCategoryCmd);
        } else {
            $intCategoryId = 0;
        }
        $intCategoryId = isset($_GET['cid']) ? intval($_GET['cid']) : $intCategoryId;
        if ($bolShowCategorySelector) {
            $objCategories = new MediaDirectoryCategory(null, null, 1, $this->moduleName);
            $strCategoryDropdown = $objCategories->listCategories($this->_objTpl, 3, $intCategoryId);
            $strCategoryName = $_ARRAYLANG['TXT_MEDIADIR_CATEGORY'];
            $strExpandedInputfields .= <<<EOF
<p><label>{$strCategoryName}</label><select class="mediadirInputfieldSearch" name="cid"><option value="">{$strPleaseChoose}</option>{$strCategoryDropdown}</select></p>
EOF;
        }
        $objInputfields = new MediaDirectoryInputfield($formId, true, null, $this->moduleName);
        $strExpandedInputfields .= $objInputfields->listInputfields(null, 4, null);
        return $strExpandedInputfields;
    }
コード例 #5
0
 function settings_modify_form($objTpl)
 {
     global $_ARRAYLANG, $_CORELANG, $_LANGID, $objDatabase;
     $objTpl->addBlockfile($this->moduleLangVar . '_SETTINGS_CONTENT', 'settings_content', 'module_' . $this->moduleNameLC . '_settings_modify_form.html');
     $objTpl->setGlobalVariable(array('TXT_' . $this->moduleLangVar . '_SETTINGS_INPUTFIELDS' => $_ARRAYLANG['TXT_MEDIADIR_INPUTFIELDS'], 'TXT_' . $this->moduleLangVar . '_SETTINGS_FORM' => $_ARRAYLANG['TXT_MEDIADIR_FORM'], 'TXT_' . $this->moduleLangVar . '_SETTINGS_PLACEHOLDER' => $_ARRAYLANG['TXT_MEDIADIR_PLACEHOLDER'], 'TXT_' . $this->moduleLangVar . '_SETTINGS_GLOBAL_PLACEHOLDER_INFO' => $_ARRAYLANG['TXT_MEDIADIR_SETTINGS_GLOBAL_PLACEHOLDER_INFO'], 'TXT_' . $this->moduleLangVar . '_SETTINGS_PLACEHOLDER_INFO' => $_ARRAYLANG['TXT_MEDIADIR_SETTINGS_PLACEHOLDER_INFO'], 'TXT_' . $this->moduleLangVar . '_SETTINGS_FIELD_SHOW_IN' => $_ARRAYLANG['TXT_MEDIADIR_FIELD_SHOW_IN'], 'TXT_' . $this->moduleLangVar . '_SETTINGS_INPUTFIELDS_ADD_NEW' => $_ARRAYLANG['TXT_MEDIADIR_SETTINGS_INPUTFIELDS_ADD_NEW'], 'TXT_' . $this->moduleLangVar . '_SETTINGS_INPUTFIELDS_ID' => $_CORELANG['TXT_GROUP_ID'], 'TXT_' . $this->moduleLangVar . '_SETTINGS_INPUTFIELDS_SORT' => $_CORELANG['TXT_CORE_SORTING_ORDER'], 'TXT_' . $this->moduleLangVar . '_SETTINGS_INPUTFIELDS_NAME' => $_ARRAYLANG['TXT_MEDIADIR_FIELD_NAME'], 'TXT_' . $this->moduleLangVar . '_SETTINGS_INPUTFIELDS_TYPE' => $_ARRAYLANG['TXT_MEDIADIR_FIELD_TYPE'], 'TXT_' . $this->moduleLangVar . '_SETTINGS_INPUTFIELDS_DEFAULTVALUE' => $_ARRAYLANG['TXT_MEDIADIR_DEFAULTVALUE'], 'TXT_' . $this->moduleLangVar . '_SETTINGS_INPUTFIELDS_CONTEXT' => $_ARRAYLANG['TXT_MEDIADIR_VALUE_CONTEXT'], 'TXT_' . $this->moduleLangVar . '_SETTINGS_INPUTFIELDS_CONTEXT_TOOLTIP' => $_ARRAYLANG['TXT_MEDIADIR_VALUE_CONTEXT_TOOLTIP'], 'TXT_' . $this->moduleLangVar . '_SETTINGS_INPUTFIELDS_CHECK' => $_ARRAYLANG['TXT_MEDIADIR_VALUE_CHECK'], 'TXT_' . $this->moduleLangVar . '_SETTINGS_INPUTFIELDS_MUSTFIELD' => $_ARRAYLANG['TXT_MEDIADIR_MUSTFIELD'], 'TXT_' . $this->moduleLangVar . '_SETTINGS_INPUTFIELDS_ACTION' => $_CORELANG['TXT_HISTORY_ACTION'], 'TXT_' . $this->moduleLangVar . '_SETTINGS_INPUTFIELD_SYSTEM_FIELD_CANT_DELETE' => $_ARRAYLANG['TXT_MEDIADIR_SETTINGS_INPUTFIELD_SYSTEM_FIELD_CANT_DELETE'], 'TXT_' . $this->moduleLangVar . '_DELETE' => $_ARRAYLANG['TXT_MEDIADIR_DELETE'], 'TXT_' . $this->moduleLangVar . '_SETTINGS_INPUTFIELDS_EXP_SEARCH' => $_ARRAYLANG['TXT_MEDIADIR_EXP_SEARCH'], $this->moduleLangVar . '_SETTINGS_INPUTFIELDS_DEFAULT_LANG_ID' => $_LANGID, $this->moduleLangVar . '_SETTINGS_FORM_DEFAULT_LANG_ID' => $_LANGID, 'TXT_' . $this->moduleLangVar . '_NAME' => $_CORELANG['TXT_NAME'], 'TXT_' . $this->moduleLangVar . '_DESCRIPTION' => $_CORELANG['TXT_DESCRIPTION'], 'TXT_' . $this->moduleLangVar . '_PICTURE' => $_CORELANG['TXT_IMAGE'], 'TXT_' . $this->moduleLangVar . '_BROWSE' => $_CORELANG['TXT_BROWSE'], 'TXT_' . $this->moduleLangVar . '_MORE' => $_ARRAYLANG['TXT_MEDIADIR_MORE'], 'TXT_' . $this->moduleLangVar . '_SETTINGS_PERMISSIONS' => $_CORELANG['TXT_PERMISSIONS'], 'TXT_' . $this->moduleLangVar . '_SETTINGS_PERMISSIONS_INFO' => $_ARRAYLANG['TXT_MEDIADIR_SETTINGS_PERMISSIONS_INFO'], 'TXT_' . $this->moduleLangVar . '_SETTINGS_COMMUNITY_GROUP' => $_ARRAYLANG['TXT_MEDIADIR_COMMUNITY_GROUP'], 'TXT_' . $this->moduleLangVar . '_SETTINGS_ALLOW_GHROUP_ADD_ENTRIES' => $_ARRAYLANG['TXT_MEDIADIR_SETTINGS_ALLOW_GHROUP_ADD_ENTRIES'], 'TXT_' . $this->moduleLangVar . '_CMD' => $_ARRAYLANG['TXT_MEDIADIR_CMD'], 'TXT_' . $this->moduleLangVar . '_CMD_INFO' => $_ARRAYLANG['TXT_MEDIADIR_CMD_INFO'], 'TXT_' . $this->moduleLangVar . '_USE_CATEGORY' => $_ARRAYLANG['TXT_MEDIADIR_USE_CATEGORY'], 'TXT_' . $this->moduleLangVar . '_USE_CATEGORY_INFO' => $_ARRAYLANG['TXT_MEDIADIR_USE_CATEGORY_INFO'], 'TXT_' . $this->moduleLangVar . '_USE_LEVEL' => $_ARRAYLANG['TXT_MEDIADIR_USE_LEVEL'], 'TXT_' . $this->moduleLangVar . '_USE_LEVEL_INFO' => $_ARRAYLANG['TXT_MEDIADIR_USE_LEVEL_INFO'], $this->moduleLangVar . '_USE_CATEGORY_ON' => 'checked="checked"', $this->moduleLangVar . '_USE_LEVEL_ON' => 'checked="checked"', $this->moduleLangVar . '_USE_READY_TO_CONFIRM_ON' => 'checked="checked"', 'TXT_' . $this->moduleLangVar . '_USE_READY_TO_CONFIRM' => $_ARRAYLANG['TXT_MEDIADIR_SETTINGS_READY_TO_CONFIRM'], 'TXT_' . $this->moduleLangVar . '_FORM_ENTRIES_PER_PAGE' => $_ARRAYLANG['TXT_MEDIADIR_FORM_ENTRIES_PER_PAGE']));
     if (isset($_GET['ajax'])) {
         $ajax = $_GET['ajax'];
     } else {
         if (isset($_POST['ajax'])) {
             $ajax = $_POST['ajax'];
         } else {
             $ajax = null;
         }
     }
     //ajax functions
     switch ($ajax) {
         case 'add':
             $objInputfields = new MediaDirectoryInputfield(intval($_GET['id']), false, null, $this->moduleName);
             $intInsertId = $objInputfields->addInputfield();
             die($intInsertId);
             break;
         case 'delete':
             $objInputfields = new MediaDirectoryInputfield(intval($_GET['id']), false, null, $this->moduleName);
             $intInsertId = $objInputfields->deleteInputfield($_GET['field']);
             die('1');
             break;
         case 'save':
             $objInputfields = new MediaDirectoryInputfield(intval($_POST['formId']), false, null, $this->moduleName);
             $strInputfields = $objInputfields->saveInputfields($_POST);
             die('1');
             break;
         case 'move':
             $objInputfields = new MediaDirectoryInputfield(intval($_GET['id']), false, null, $this->moduleName);
             $strInputfields = $objInputfields->moveInputfield($_GET['field'], $_GET['direction']);
             die('1');
             break;
         case 'refresh':
             $objInputfields = new MediaDirectoryInputfield(intval($_GET['id']), false, null, $this->moduleName);
             $strInputfields = $objInputfields->refreshInputfields($objTpl);
             //return
             echo $strInputfields;
             die;
             break;
     }
     //load form data
     if (!empty($_GET['id'])) {
         $pageTitle = $_ARRAYLANG['TXT_MEDIADIR_EDIT_FORM_TEMPLATE'];
         $intFormId = intval($_GET['id']);
         $objForm = new MediaDirectoryForm($intFormId, $this->moduleName);
         //parse data variables
         $objTpl->setGlobalVariable(array($this->moduleLangVar . '_FORM_ID' => $intFormId, $this->moduleLangVar . '_FORM_NAME_MASTER' => contrexx_raw2xhtml($objForm->arrForms[$intFormId]['formName'][0]), $this->moduleLangVar . '_FORM_DESCRIPTION_MASTER' => contrexx_raw2xhtml($objForm->arrForms[$intFormId]['formDescription'][0]), $this->moduleLangVar . '_FORM_PICTURE' => $objForm->arrForms[$intFormId]['formPicture'], $this->moduleLangVar . '_FORM_CMD' => $objForm->arrForms[$intFormId]['formCmd'], $this->moduleLangVar . '_USE_CATEGORY_ON' => $objForm->arrForms[$intFormId]['formUseCategory'] == 1 ? 'checked="checked"' : '', $this->moduleLangVar . '_USE_CATEGORY_OFF' => $objForm->arrForms[$intFormId]['formUseCategory'] == 0 ? 'checked="checked"' : '', $this->moduleLangVar . '_USE_LEVEL_ON' => $objForm->arrForms[$intFormId]['formUseLevel'] == 1 ? 'checked="checked"' : '', $this->moduleLangVar . '_USE_LEVEL_OFF' => $objForm->arrForms[$intFormId]['formUseLevel'] == 0 ? 'checked="checked"' : '', $this->moduleLangVar . '_USE_READY_TO_CONFIRM_ON' => $objForm->arrForms[$intFormId]['formUseReadyToConfirm'] == 1 ? 'checked="checked"' : '', $this->moduleLangVar . '_USE_READY_TO_CONFIRM_OFF' => $objForm->arrForms[$intFormId]['formUseReadyToConfirm'] == 0 ? 'checked="checked"' : '', $this->moduleLangVar . '_FORM_ENTRIES_PER_PAGE' => contrexx_raw2xhtml($objForm->arrForms[$intFormId]['formEntriesPerPage'])));
         parent::getCommunityGroups();
         //permissions community groups
         if (empty($this->arrCommunityGroups)) {
             $objTpl->setVariable(array('TXT_' . $this->moduleLangVar . '_SETTINGS_NO_COMMUNITY_GROUPS' => $_ARRAYLANG['TXT_MEDIADIR_NO_COMMUNITY_GROUPS']));
             $objTpl->parse($this->moduleNameLC . 'FormNoCommunityGroup');
         } else {
             $i = 0;
             foreach ($this->arrCommunityGroups as $intGroupId => $arrGroup) {
                 if ($arrGroup['type'] == 'frontend' && $arrGroup['active'] == 1) {
                     if (intval($arrGroup['status_group'][$intFormId]) == 1) {
                         $strGroupStatus = 'checked="checked"';
                     } else {
                         $strGroupStatus = '';
                     }
                     $objTpl->setVariable(array($this->moduleLangVar . '_SETTINGS_COMMUNITY_GROUP_ROW_CLASS' => $i % 2 == 0 ? 'row1' : 'row2', 'TXT_' . $this->moduleLangVar . '_SETTINGS_COMMUNITY_GROUP_NAME' => $arrGroup['name'], $this->moduleLangVar . '_SETTINGS_COMMUNITY_GROUP_ACTIVE' => $strGroupStatus, $this->moduleLangVar . '_SETTINGS_COMMUNITY_GROUP_ID' => $intGroupId));
                     $i++;
                     $objTpl->parse($this->moduleNameLC . 'FormCommunityGroupList');
                 }
             }
         }
         //load inputfields data
         $objInputfields = new MediaDirectoryInputfield($intFormId, false, null, $this->moduleName);
         $objInputfields->listInputfields($objTpl, 1);
         $objInputfields->listPlaceholders($objTpl);
     } else {
         $pageTitle = $_ARRAYLANG['TXT_MEDIADIR_NEW_FORM_TEMPLATE'];
         $objTpl->hideBlock($this->moduleNameLC . 'InputfieldsForm');
     }
     $objTpl->setGlobalVariable(array($this->moduleLangVar . '_FORM_IMAGE_BROWSE' => $this->getMediaBrowserButton($_ARRAYLANG['TXT_BROWSE'], array('data-cx-mb-views' => 'filebrowser', 'data-cx-mb-startmediatype' => $this->moduleNameLC, 'type' => 'button', 'data-input-id' => 'formImage2'), 'mediaBrowserCallback')));
     $strFormName = '';
     $strFormDescription = '';
     //form name language block
     foreach ($this->arrFrontendLanguages as $key => $arrLang) {
         if (!empty($intFormId)) {
             $strFormName = empty($objForm->arrForms[$intFormId]['formName'][$arrLang['id']]) ? $objForm->arrForms[$intFormId]['formName'][0] : $objForm->arrForms[$intFormId]['formName'][$arrLang['id']];
         } else {
             $intFormId = '';
         }
         $objTpl->setVariable(array($this->moduleLangVar . '_FORM_NAME_LANG_ID' => $arrLang['id'], 'TXT_' . $this->moduleLangVar . '_FORM_NAME_LANG_NAME' => $arrLang['name'], 'TXT_' . $this->moduleLangVar . '_FORM_NAME_LANG_SHORTCUT' => $arrLang['lang'], $this->moduleLangVar . '_FORM_NAME' => $strFormName));
         if ($key + 1 == count($this->arrFrontendLanguages)) {
             $objTpl->setVariable(array($this->moduleLangVar . '_MINIMIZE' => '<a href="javascript:ExpandMinimizeForm(\'formName\');">&laquo;&nbsp;' . $_ARRAYLANG['TXT_MEDIADIR_MINIMIZE'] . '</a>'));
         }
         $objTpl->parse($this->moduleNameLC . 'FormNameList');
     }
     //form decription language block
     foreach ($this->arrFrontendLanguages as $key => $arrLang) {
         if (!empty($intFormId)) {
             $strFormDescription = empty($objForm->arrForms[$intFormId]['formDescription'][$arrLang['id']]) ? $objForm->arrForms[$intFormId]['formDescription'][0] : $objForm->arrForms[$intFormId]['formDescription'][$arrLang['id']];
         } else {
             $intFormId = '';
         }
         $objTpl->setVariable(array($this->moduleLangVar . '_FORM_DESCRIPTION_LANG_ID' => $arrLang['id'], 'TXT_' . $this->moduleLangVar . '_FORM_DESCRIPTION_LANG_NAME' => $arrLang['name'], 'TXT_' . $this->moduleLangVar . '_FORM_DESCRIPTION_LANG_SHORTCUT' => $arrLang['lang'], $this->moduleLangVar . '_FORM_DESCRIPTION' => $strFormDescription));
         if ($key + 1 == count($this->arrFrontendLanguages)) {
             $objTpl->setVariable(array($this->moduleLangVar . '_MINIMIZE' => '<a href="javascript:ExpandMinimizeForm(\'formDescription\');">&laquo;&nbsp;' . $_ARRAYLANG['TXT_MEDIADIR_MINIMIZE'] . '</a>'));
         }
         $objTpl->parse($this->moduleNameLC . 'FormDescriptionList');
     }
     //use level block
     if ($this->arrSettings['settingsShowLevels'] == 1) {
         $objTpl->touchBlock($this->moduleNameLC . 'FormUseLevel');
     } else {
         $objTpl->hideBlock($this->moduleNameLC . 'FormUseLevel');
     }
     //use ready to confirm block
     if ($this->arrSettings['settingsReadyToConfirm'] == 1) {
         $objTpl->touchBlock($this->moduleNameLC . 'FormUseReadyToConfirm');
     } else {
         $objTpl->hideBlock($this->moduleNameLC . 'FormUseReadyToConfirm');
     }
     $objTpl->setVariable(array('TXT_' . $this->moduleLangVar . '_PAGE_TITLE' => $pageTitle));
     $objTpl->parse('settings_content');
 }
コード例 #6
0
 function listEntries($objTpl, $intView)
 {
     global $_ARRAYLANG, $_CORELANG, $objDatabase;
     $objFWUser = \FWUser::getFWUserObject();
     $intToday = time();
     $i = 0;
     switch ($intView) {
         case 1:
             //Backend View
             if (!empty($this->arrEntries)) {
                 foreach ($this->arrEntries as $key => $arrEntry) {
                     if (intval($arrEntry['entryAddedBy']) != 0) {
                         if ($objUser = $objFWUser->objUser->getUser(intval($arrEntry['entryAddedBy']))) {
                             $strAddedBy = $objUser->getUsername();
                         } else {
                             $strAddedBy = "unknown";
                         }
                     } else {
                         $strAddedBy = "unknown";
                     }
                     if ($arrEntry['entryActive'] == 1) {
                         $strStatus = '../core/Core/View/Media/icons/status_green.gif';
                         $intStatus = 0;
                         if (($arrEntry['entryDurationStart'] > $intToday || $arrEntry['entryDurationEnd'] < $intToday) && $arrEntry['entryDurationType'] == 2) {
                             $strStatus = '../core/Core/View/Media/icons/status_yellow.gif';
                         }
                     } else {
                         $strStatus = '../core/Core/View/Media/icons/status_red.gif';
                         $intStatus = 1;
                     }
                     $objForm = new MediaDirectoryForm($arrEntry['entryFormId'], $this->moduleName);
                     //get votes
                     if ($this->arrSettings['settingsAllowVotes']) {
                         $objVoting = new MediaDirectoryVoting($this->moduleName);
                         $objVoting->getVotes($objTpl, $arrEntry['entryId']);
                         if ($objTpl->blockExists('mediadirEntryVotes')) {
                             $objTpl->parse('mediadirEntryVotes');
                         }
                     } else {
                         if ($objTpl->blockExists('mediadirEntryVotes')) {
                             $objTpl->hideBlock('mediadirEntryVotes');
                         }
                     }
                     //get comments
                     if ($this->arrSettings['settingsAllowComments']) {
                         $objComment = new MediaDirectoryComment($this->moduleName);
                         $objComment->getComments($objTpl, $arrEntry['entryId']);
                         if ($objTpl->blockExists('mediadirEntryComments')) {
                             $objTpl->parse('mediadirEntryComments');
                         }
                     } else {
                         if ($objTpl->blockExists('mediadirEntryComments')) {
                             $objTpl->hideBlock('mediadirEntryComments');
                         }
                     }
                     $objTpl->setVariable(array($this->moduleLangVar . '_ROW_CLASS' => $i % 2 == 0 ? 'row1' : 'row2', $this->moduleLangVar . '_ENTRY_ID' => $arrEntry['entryId'], $this->moduleLangVar . '_ENTRY_STATUS' => $strStatus, $this->moduleLangVar . '_ENTRY_SWITCH_STATUS' => $intStatus, $this->moduleLangVar . '_ENTRY_VALIDATE_DATE' => date("H:i:s - d.m.Y", $arrEntry['entryValdateDate']), $this->moduleLangVar . '_ENTRY_CREATE_DATE' => date("H:i:s - d.m.Y", $arrEntry['entryCreateDate']), $this->moduleLangVar . '_ENTRY_AUTHOR' => htmlspecialchars($strAddedBy, ENT_QUOTES, CONTREXX_CHARSET), $this->moduleLangVar . '_ENTRY_HITS' => $arrEntry['entryHits'], $this->moduleLangVar . '_ENTRY_FORM' => $objForm->arrForms[$arrEntry['entryFormId']]['formName'][0]));
                     foreach ($arrEntry['entryFields'] as $key => $strFieldValue) {
                         $intPos = $key + 1;
                         $objTpl->setVariable(array($this->moduleLangVar . '_ENTRY_FIELD_' . $intPos . '_POS' => contrexx_raw2xhtml(substr($strFieldValue, 0, 255))));
                     }
                     //get order
                     if ($this->arrSettings['settingsIndividualEntryOrder'] == 1) {
                         $objTpl->setVariable(array($this->moduleLangVar . '_ENTRY_ORDER' => '<input name="entriesOrder[' . $arrEntry['entryId'] . ']" style="width: 30px; margin-right: 5px;" value="' . $arrEntry['entryOrder'] . '" onfocus="this.select();" type="text">'));
                         if (intval($objTpl->blockExists($this->moduleNameLC . 'EntriesSaveOrder')) != 0) {
                             $objTpl->touchBlock($this->moduleNameLC . 'EntriesSaveOrder');
                         }
                     } else {
                         if (intval($objTpl->blockExists($this->moduleNameLC . 'EntriesSaveOrder')) != 0) {
                             $objTpl->hideBlock($this->moduleNameLC . 'EntriesSaveOrder');
                         }
                     }
                     $i++;
                     $objTpl->parse($this->strBlockName);
                     $objTpl->hideBlock('noEntriesFound');
                     $objTpl->clearVariables();
                 }
             } else {
                 $objTpl->setGlobalVariable(array('TXT_' . $this->moduleLangVar . '_NO_ENTRIES_FOUND' => $_ARRAYLANG['TXT_MEDIADIR_NO_ENTRIES_FOUND']));
                 $objTpl->touchBlock('noEntriesFound');
                 $objTpl->clearVariables();
             }
             break;
         case 2:
             //Frontend View
             if (!empty($this->arrEntries)) {
                 foreach ($this->arrEntries as $key => $arrEntry) {
                     if ($arrEntry['entryDurationStart'] < $intToday && $arrEntry['entryDurationEnd'] > $intToday || $arrEntry['entryDurationType'] == 1) {
                         $objInputfields = new MediaDirectoryInputfield(intval($arrEntry['entryFormId']), false, $arrEntry['entryTranslationStatus'], $this->moduleName);
                         $objInputfields->listInputfields($objTpl, 3, intval($arrEntry['entryId']));
                         if (intval($arrEntry['entryAddedBy']) != 0) {
                             if ($objUser = $objFWUser->objUser->getUser(intval($arrEntry['entryAddedBy']))) {
                                 $strAddedBy = $objUser->getUsername();
                             } else {
                                 $strAddedBy = "unknown";
                             }
                         } else {
                             $strAddedBy = "unknown";
                         }
                         $strCategoryLink = $this->intCatId != 0 ? '&amp;cid=' . $this->intCatId : null;
                         $strLevelLink = $this->intLevelId != 0 ? '&amp;lid=' . $this->intLevelId : null;
                         if ($this->checkPageCmd('detail' . intval($arrEntry['entryFormId']))) {
                             $strDetailCmd = 'detail' . intval($arrEntry['entryFormId']);
                         } else {
                             $strDetailCmd = 'detail';
                         }
                         if ($arrEntry['entryReadyToConfirm'] == 1 || $arrEntry['entryConfirmed'] == 1) {
                             $strDetailUrl = 'index.php?section=' . $this->moduleName . '&amp;cmd=' . $strDetailCmd . $strLevelLink . $strCategoryLink . '&amp;eid=' . $arrEntry['entryId'];
                         } else {
                             $strDetailUrl = '#';
                         }
                         $objForm = new MediaDirectoryForm($arrEntry['entryFormId'], $this->moduleName);
                         $objTpl->setVariable(array($this->moduleLangVar . '_ROW_CLASS' => $i % 2 == 0 ? 'row1' : 'row2', $this->moduleLangVar . '_ENTRY_ID' => $arrEntry['entryId'], $this->moduleLangVar . '_ENTRY_VALIDATE_DATE' => date("H:i:s - d.m.Y", $arrEntry['entryValdateDate']), $this->moduleLangVar . '_ENTRY_CREATE_DATE' => date("H:i:s - d.m.Y", $arrEntry['entryCreateDate']), $this->moduleLangVar . '_ENTRY_AUTHOR' => htmlspecialchars($strAddedBy, ENT_QUOTES, CONTREXX_CHARSET), $this->moduleLangVar . '_ENTRY_CATEGORIES' => $this->getCategoriesLevels(1, $arrEntry['entryId'], $objForm->arrForms[$arrEntry['entryFormId']]['formCmd']), $this->moduleLangVar . '_ENTRY_LEVELS' => $this->getCategoriesLevels(2, $arrEntry['entryId'], $objForm->arrForms[$arrEntry['entryFormId']]['formCmd']), $this->moduleLangVar . '_ENTRY_HITS' => $arrEntry['entryHits'], $this->moduleLangVar . '_ENTRY_POPULAR_HITS' => $arrEntry['entryPopularHits'], $this->moduleLangVar . '_ENTRY_DETAIL_URL' => $strDetailUrl, $this->moduleLangVar . '_ENTRY_EDIT_URL' => 'index.php?section=' . $this->moduleName . '&amp;cmd=edit&amp;eid=' . $arrEntry['entryId'], $this->moduleLangVar . '_ENTRY_DELETE_URL' => 'index.php?section=' . $this->moduleName . '&amp;cmd=delete&amp;eid=' . $arrEntry['entryId'], 'TXT_' . $this->moduleLangVar . '_ENTRY_DELETE' => $_ARRAYLANG['TXT_MEDIADIR_DELETE'], 'TXT_' . $this->moduleLangVar . '_ENTRY_EDIT' => $_ARRAYLANG['TXT_MEDIADIR_EDIT'], 'TXT_' . $this->moduleLangVar . '_ENTRY_DETAIL' => $_ARRAYLANG['TXT_MEDIADIR_DETAIL'], 'TXT_' . $this->moduleLangVar . '_ENTRY_CATEGORIES' => $_ARRAYLANG['TXT_MEDIADIR_CATEGORIES'], 'TXT_' . $this->moduleLangVar . '_ENTRY_LEVELS' => $_ARRAYLANG['TXT_MEDIADIR_LEVELS']));
                         $this->parseCategoryLevels(1, $arrEntry['entryId'], $objTpl);
                         $this->parseCategoryLevels(2, $arrEntry['entryId'], $objTpl);
                         foreach ($arrEntry['entryFields'] as $key => $strFieldValue) {
                             $intPos = $key + 1;
                             $objTpl->setVariable(array('MEDIADIR_ENTRY_FIELD_' . $intPos . '_POS' => substr($strFieldValue, 0, 255)));
                         }
                         if ($this->arrSettings['settingsAllowVotes']) {
                             $objVoting = new MediaDirectoryVoting($this->moduleName);
                             if (intval($objTpl->blockExists($this->moduleNameLC . 'EntryVoteForm')) != 0) {
                                 $objVoting->getVoteForm($objTpl, $arrEntry['entryId']);
                             }
                             if (intval($objTpl->blockExists($this->moduleNameLC . 'EntryVotes')) != 0) {
                                 $objVoting->getVotes($objTpl, $arrEntry['entryId']);
                             }
                         }
                         if ($this->arrSettings['settingsAllowComments']) {
                             $objComment = new MediaDirectoryComment($this->moduleName);
                             if (intval($objTpl->blockExists($this->moduleNameLC . 'EntryComments')) != 0) {
                                 $objComment->getComments($objTpl, $arrEntry['entryId']);
                             }
                             if (intval($objTpl->blockExists($this->moduleNameLC . 'EntryCommentForm')) != 0) {
                                 $objComment->getCommentForm($objTpl, $arrEntry['entryId']);
                             }
                         }
                         if (!$this->arrSettings['settingsAllowEditEntries'] && intval($objTpl->blockExists($this->moduleNameLC . 'EntryEditLink')) != 0) {
                             $objTpl->hideBlock($this->moduleNameLC . 'EntryEditLink');
                         }
                         if (!$this->arrSettings['settingsAllowDelEntries'] && intval($objTpl->blockExists($this->moduleNameLC . 'EntryDeleteLink')) != 0) {
                             $objTpl->hideBlock($this->moduleNameLC . 'EntryDeleteLink');
                         }
                         $i++;
                         $objTpl->parse($this->strBlockName);
                         $objTpl->clearVariables();
                     }
                 }
             } else {
                 $objTpl->setVariable(array('TXT_' . $this->moduleLangVar . '_SEARCH_MESSAGE' => $_ARRAYLANG['TXT_MEDIADIR_NO_ENTRIES_FOUND']));
                 $objTpl->parse($this->moduleNameLC . 'NoEntriesFound');
                 $objTpl->clearVariables();
             }
             break;
         case 3:
             //Alphabetical View
             if (!empty($this->arrEntries)) {
                 $arrAlphaIndexes = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '0-9', '#');
                 $arrAlphaGroups = array();
                 foreach ($this->arrEntries as $key => $arrEntry) {
                     $strTitle = $arrEntry['entryFields'][0];
                     $strAlphaIndex = strtoupper(substr($strTitle, 0, 1));
                     if (!in_array($strAlphaIndex, $arrAlphaIndexes)) {
                         if (is_numeric($strAlphaIndex)) {
                             $strAlphaIndex = '0-9';
                         } else {
                             $strAlphaIndex = '#';
                         }
                     }
                     $arrAlphaGroups[$strAlphaIndex][] = $arrEntry;
                 }
                 if (intval($objTpl->blockExists($this->moduleNameLC . 'AlphaIndex')) != 0) {
                     $objTpl->touchBlock($this->moduleNameLC . 'AlphaIndex');
                     foreach ($arrAlphaIndexes as $key => $strIndex) {
                         if (array_key_exists($strIndex, $arrAlphaGroups)) {
                             $strAlphaIndex = '<a href="#' . $strIndex . '">' . $strIndex . '</a>';
                         } else {
                             $strAlphaIndex = '' . $strIndex . '';
                         }
                         $objTpl->setVariable(array($this->moduleLangVar . '_ALPHA_INDEX_LINK' => $strAlphaIndex));
                         $objTpl->parse($this->moduleNameLC . 'AlphaIndexElement');
                     }
                 }
                 foreach ($arrAlphaGroups as $strAlphaIndex => $arrEntries) {
                     if (intval($objTpl->blockExists($this->moduleNameLC . 'AlphabeticalTitle')) != 0) {
                         $objTpl->setVariable(array($this->moduleLangVar . '_ALPHABETICAL_ANCHOR' => $strAlphaIndex, 'TXT_' . $this->moduleLangVar . '_ALPHABETICAL_TITLE' => $strAlphaIndex));
                         $objTpl->parse($this->moduleNameLC . 'AlphabeticalTitle');
                     }
                     foreach ($arrEntries as $key => $arrEntry) {
                         if ($arrEntry['entryDurationStart'] < $intToday && $arrEntry['entryDurationEnd'] > $intToday || $arrEntry['entryDurationType'] == 1) {
                             $objInputfields = new MediaDirectoryInputfield(intval($arrEntry['entryFormId']), false, $arrEntry['entryTranslationStatus'], $this->moduleName);
                             $objInputfields->listInputfields($objTpl, 3, intval($arrEntry['entryId']));
                             $strStatus = $arrEntry['entryActive'] == 1 ? 'active' : 'inactive';
                             if (intval($arrEntry['entryAddedBy']) != 0) {
                                 if ($objUser = $objFWUser->objUser->getUser(intval($arrEntry['entryAddedBy']))) {
                                     $strAddedBy = $objUser->getUsername();
                                 } else {
                                     $strAddedBy = "unknown";
                                 }
                             } else {
                                 $strAddedBy = "unknown";
                             }
                             $strCategoryLink = $this->intCatId != 0 ? '&amp;cid=' . $this->intCatId : null;
                             $strLevelLink = $this->intLevelId != 0 ? '&amp;lid=' . $this->intLevelId : null;
                             if ($this->checkPageCmd('detail' . intval($arrEntry['entryFormId']))) {
                                 $strDetailCmd = 'detail' . intval($arrEntry['entryFormId']);
                             } else {
                                 $strDetailCmd = 'detail';
                             }
                             if ($arrEntry['entryReadyToConfirm'] == 1 || $arrEntry['entryConfirmed'] == 1) {
                                 $strDetailUrl = 'index.php?section=' . $this->moduleName . '&amp;cmd=' . $strDetailCmd . $strLevelLink . $strCategoryLink . '&amp;eid=' . $arrEntry['entryId'];
                             } else {
                                 $strDetailUrl = '#';
                             }
                             $objForm = new MediaDirectoryForm($arrEntry['entryFormId'], $this->moduleName);
                             $objTpl->setVariable(array($this->moduleLangVar . '_ROW_CLASS' => $i % 2 == 0 ? 'row1' : 'row2', $this->moduleLangVar . '_ENTRY_ID' => $arrEntry['entryId'], $this->moduleLangVar . '_ENTRY_STATUS' => $strStatus, $this->moduleLangVar . '_ENTRY_VALIDATE_DATE' => date("H:i:s - d.m.Y", $arrEntry['entryValdateDate']), $this->moduleLangVar . '_ENTRY_CREATE_DATE' => date("H:i:s - d.m.Y", $arrEntry['entryCreateDate']), $this->moduleLangVar . '_ENTRY_AUTHOR' => htmlspecialchars($strAddedBy, ENT_QUOTES, CONTREXX_CHARSET), $this->moduleLangVar . '_ENTRY_CATEGORIES' => $this->getCategoriesLevels(1, $arrEntry['entryId'], $objForm->arrForms[$arrEntry['entryFormId']]['formCmd']), $this->moduleLangVar . '_ENTRY_LEVELS' => $this->getCategoriesLevels(2, $arrEntry['entryId'], $objForm->arrForms[$arrEntry['entryFormId']]['formCmd']), $this->moduleLangVar . '_ENTRY_HITS' => $arrEntry['entryHits'], $this->moduleLangVar . '_ENTRY_POPULAR_HITS' => $arrEntry['entryPopularHits'], $this->moduleLangVar . '_ENTRY_DETAIL_URL' => $strDetailUrl, $this->moduleLangVar . '_ENTRY_EDIT_URL' => 'index.php?section=' . $this->moduleName . '&amp;cmd=edit&amp;eid=' . $arrEntry['entryId'], $this->moduleLangVar . '_ENTRY_DELETE_URL' => 'index.php?section=' . $this->moduleName . '&amp;cmd=delete&amp;eid=' . $arrEntry['entryId'], 'TXT_' . $this->moduleLangVar . '_ENTRY_DELETE' => $_ARRAYLANG['TXT_MEDIADIR_DELETE'], 'TXT_' . $this->moduleLangVar . '_ENTRY_EDIT' => $_ARRAYLANG['TXT_MEDIADIR_EDIT'], 'TXT_' . $this->moduleLangVar . '_ENTRY_DETAIL' => $_ARRAYLANG['TXT_MEDIADIR_DETAIL'], 'TXT_' . $this->moduleLangVar . '_ENTRY_CATEGORIES' => $_ARRAYLANG['TXT_MEDIADIR_CATEGORIES'], 'TXT_' . $this->moduleLangVar . '_ENTRY_LEVELS' => $_ARRAYLANG['TXT_MEDIADIR_LEVELS']));
                             $this->parseCategoryLevels(1, $arrEntry['entryId'], $objTpl);
                             $this->parseCategoryLevels(2, $arrEntry['entryId'], $objTpl);
                             foreach ($arrEntry['entryFields'] as $key => $strFieldValue) {
                                 $intPos = $key + 1;
                                 $objTpl->setVariable(array('MEDIADIR_ENTRY_FIELD_' . $intPos . '_POS' => contrexx_raw2xhtml(substr($strFieldValue, 0, 255))));
                             }
                             if ($this->arrSettings['settingsAllowVotes']) {
                                 $objVoting = new MediaDirectoryVoting($this->moduleName);
                                 if (intval($objTpl->blockExists($this->moduleNameLC . 'EntryVoteForm')) != 0) {
                                     $objVoting->getVoteForm($objTpl, $arrEntry['entryId']);
                                 }
                                 if (intval($objTpl->blockExists($this->moduleNameLC . 'EntryVotes')) != 0) {
                                     $objVoting->getVotes($objTpl, $arrEntry['entryId']);
                                 }
                             }
                             if ($this->arrSettings['settingsAllowComments']) {
                                 $objComment = new MediaDirectoryComment($this->moduleName);
                                 if (intval($objTpl->blockExists($this->moduleNameLC . 'EntryComments')) != 0) {
                                     $objComment->getComments($objTpl, $arrEntry['entryId']);
                                 }
                                 if (intval($objTpl->blockExists($this->moduleNameLC . 'EntryCommentForm')) != 0) {
                                     $objComment->getCommentForm($objTpl, $arrEntry['entryId']);
                                 }
                             }
                             if (!$this->arrSettings['settingsAllowEditEntries'] && intval($objTpl->blockExists($this->moduleNameLC . 'EntryEditLink')) != 0) {
                                 $objTpl->hideBlock($this->moduleNameLC . 'EntryEditLink');
                             }
                             if (!$this->arrSettings['settingsAllowDelEntries'] && intval($objTpl->blockExists($this->moduleNameLC . 'EntryDeleteLink')) != 0) {
                                 $objTpl->hideBlock($this->moduleNameLC . 'EntryDeleteLink');
                             }
                             $i++;
                             $objTpl->parse($this->moduleNameLC . 'EntryList');
                             $objTpl->clearVariables();
                         }
                     }
                 }
             } else {
                 $objTpl->setVariable(array('TXT_' . $this->moduleLangVar . '_SEARCH_MESSAGE' => $_ARRAYLANG['TXT_MEDIADIR_NO_ENTRIES_FOUND']));
                 $objTpl->parse($this->moduleNameLC . 'NoEntriesFound');
                 $objTpl->clearVariables();
             }
         case 4:
             //Google Map
             $objGoogleMap = new \googleMap();
             $objGoogleMap->setMapId($this->moduleNameLC . 'GoogleMap');
             $objGoogleMap->setMapStyleClass('mapLarge');
             $objGoogleMap->setMapType($this->arrSettings['settingsGoogleMapType']);
             $arrValues = explode(',', $this->arrSettings['settingsGoogleMapStartposition']);
             $objGoogleMap->setMapZoom($arrValues[2]);
             $objGoogleMap->setMapCenter($arrValues[1], $arrValues[0]);
             foreach ($this->arrEntries as $key => $arrEntry) {
                 if ($arrEntry['entryDurationStart'] < $intToday && $arrEntry['entryDurationEnd'] > $intToday || $arrEntry['entryDurationType'] == 1) {
                     $arrValues = array();
                     if ($this->checkPageCmd('detail' . intval($arrEntry['entryFormId']))) {
                         $strDetailCmd = 'detail' . intval($arrEntry['entryFormId']);
                     } else {
                         $strDetailCmd = 'detail';
                     }
                     $strEntryLink = '<a href="index.php?section=' . $this->moduleName . '&amp;cmd=' . $strDetailCmd . '&amp;eid=' . $arrEntry['entryId'] . '">' . $_ARRAYLANG['TXT_MEDIADIR_DETAIL'] . '</a>';
                     $strEntryTitle = '<b>' . contrexx_raw2xhtml($arrEntry['entryFields']['0']) . '</b>';
                     $intEntryId = intval($arrEntry['entryId']);
                     $intEntryFormId = intval($arrEntry['entryFormId']);
                     $query = "\n\t                        SELECT\n\t                            inputfield.`id` AS `id`,\n\t                            rel_inputfield.`value` AS `value`\n\t                        FROM\n\t                            " . DBPREFIX . "module_" . $this->moduleTablePrefix . "_inputfields AS inputfield,\n\t                            " . DBPREFIX . "module_" . $this->moduleTablePrefix . "_rel_entry_inputfields AS rel_inputfield\n\t                        WHERE\n\t                            inputfield.`form` = '" . $intEntryFormId . "'\n\t                        AND\n\t                            inputfield.`type`= '15'\n\t                        AND\n\t                            rel_inputfield.`field_id` = inputfield.`id`\n\t                        AND\n\t                            rel_inputfield.`entry_id` = '" . $intEntryId . "'\n\t                        LIMIT 1\n\t                    ";
                     $objRSMapKoordinates = $objDatabase->Execute($query);
                     if ($objRSMapKoordinates !== false) {
                         $arrValues = explode(',', $objRSMapKoordinates->fields['value']);
                     }
                     $strValueLon = empty($arrValues[1]) ? 0 : $arrValues[1];
                     $strValueLat = empty($arrValues[0]) ? 0 : $arrValues[0];
                     $mapIndex = $objGoogleMap->getMapIndex();
                     $clickFunction = "if (infowindow_{$mapIndex}) { infowindow_{$mapIndex}.close(); }\n                                infowindow_{$mapIndex}.setContent(info{$intEntryId});\n                                infowindow_{$mapIndex}.open(map_{$mapIndex}, marker{$intEntryId})";
                     $objGoogleMap->addMapMarker($intEntryId, $strValueLon, $strValueLat, $strEntryTitle . "<br />" . $strEntryLink, true, $clickFunction);
                 }
             }
             $objTpl->setVariable(array($this->moduleLangVar . '_GOOGLE_MAP' => $objGoogleMap->getMap()));
             break;
     }
 }
コード例 #7
0
 /**
  * This function is called after the activation of new language
  * update existing forms, inputfields and entries values for activated new language
  *
  * @return null
  */
 public function updateFormsAndEntries()
 {
     global $objDatabase;
     foreach ($this->arrFrontendLanguages as $lang) {
         $activeLang[] = $lang['id'];
     }
     $objForms = new MediaDirectoryForm(null, $this->moduleName);
     foreach ($objForms->arrForms as $objForm) {
         $formId = $objForm['formId'];
         $formName = $objForm['formName'];
         $formDescription = $objForm['formDescription'];
         //update form values
         $objForms->updateFormLocale($formName, $formDescription, $formId);
         $objInputField = new MediaDirectoryInputfield($formId, false, null, $this->moduleName);
         $inputFields = $objInputField->getInputfields();
         //Before updating the form InputFields names, remove the corresponding InputFields names from db.
         $objDatabase->Execute('DELETE FROM ' . DBPREFIX . 'module_' . $this->moduleTablePrefix . '_inputfield_names WHERE form_id="' . $formId . '" AND lang_id IN("' . implode('","', $activeLang) . '")');
         foreach ($inputFields as $inputField) {
             // skip '1' => categories, '2' => levels
             if (in_array($inputField['id'], array(1, 2))) {
                 continue;
             }
             $intFieldId = intval($inputField['id']);
             $arrFieldNames = $inputField['name'];
             $arrFieldDefaultValues = $inputField['default_value'];
             $arrFieldInfos = $inputField['info'];
             //update form inputfields
             $objInputField->updateInputFields($intFieldId, $arrFieldNames, $arrFieldDefaultValues, $arrFieldInfos);
         }
     }
     $objEntries = new MediaDirectoryEntry($this->moduleName);
     //update entries
     $objEntries->updateEntries();
 }
コード例 #8
0
    function getExpandedInputfields()
    {
        global $_ARRAYLANG, $objDatabase, $_LANGID;
        $formId = null;
        $strPleaseChoose = $_ARRAYLANG['TXT_MEDIADIR_PLEASE_CHOOSE'];
        $strExpandedInputfields = '';
        $bolShowLevelSelector = false;
        $bolShowCategorySelector = false;
        $formDefinition = null;
        // determine if we shall display the level and/or category selection dropdown
        if (!empty($_GET['cmd'])) {
            $arrIds = explode('-', $_GET['cmd']);
            if ($arrIds[0] != 'search' && $arrIds[0] != 'alphabetical') {
                $objForms = new MediaDirectoryForm(null, $this->moduleName);
                foreach ($objForms->arrForms as $id => $arrForm) {
                    if (!empty($arrForm['formCmd']) && $arrForm['formCmd'] == $_GET['cmd']) {
                        $formId = intval($id);
                        $formDefinition = $objForms->arrForms[$formId];
                        break;
                    }
                }
            }
            // in case the section of a specific form has been requested, do determine
            // the usage of the level and/or category selection dropdown based on that
            // form's configuration
            //
            // note: in a previous version of Cloudrexx the following was
            //       always true. which resulted in a bug, that if a specific
            //       category was request through the page's CMD, then the
            //       level and category selection dropdowns were never used.
            //       The legacyBehavior mode does simulate this fixed bug.
            if ($formId || $this->arrSettings['legacyBehavior']) {
                if ($formDefinition['formUseLevel'] == 1 && $this->arrSettings['levelSelectorExpSearch'][$formId] == 1) {
                    $bolShowLevelSelector = true;
                }
                if ($formDefinition['formUseCategory'] == 1 && $this->arrSettings['categorySelectorExpSearch'][$formId] == 1) {
                    $bolShowCategorySelector = true;
                }
            } else {
                // on search (section=mediadir&cmd=search) and alphabetical section (section=mediadir&cmd=alphabetical)
                //
                // activate level and category selection in case they are active in any forms
                $bolShowLevelSelector = in_array(1, $this->arrSettings['levelSelectorExpSearch']);
                $bolShowCategorySelector = in_array(1, $this->arrSettings['categorySelectorExpSearch']);
            }
        } else {
            // on main application page (section=mediadir):
            //
            // activate level and category selection in case they are active in any forms
            $bolShowLevelSelector = in_array(1, $this->arrSettings['levelSelectorExpSearch']);
            $bolShowCategorySelector = in_array(1, $this->arrSettings['categorySelectorExpSearch']);
        }
        if ($this->arrSettings['settingsShowLevels'] && $bolShowLevelSelector) {
            if (intval($arrIds[0]) != 0) {
                $intLevelId = intval($arrIds[0]);
            } else {
                $intLevelId = 0;
            }
            $intLevelId = isset($_GET['lid']) ? intval($_GET['lid']) : $intLevelId;
            $objLevels = new MediaDirectoryLevel(null, null, 1, $this->moduleName);
            $strLevelDropdown = $objLevels->listLevels($this->_objTpl, 3, $intLevelId);
            $strLevelName = $_ARRAYLANG['TXT_MEDIADIR_LEVEL'];
            $strInputfieldSearch = $this->moduleNameLC . "InputfieldSearch";
            $strExpandedInputfields .= <<<EOF
<p><label>{$strLevelName}</label><select class="{$strInputfieldSearch}" name="lid"><option value="">{$strPleaseChoose}</option>{$strLevelDropdown}</select></p>
EOF;
            if (!empty($arrIds[1])) {
                $intCategoryCmd = $arrIds[1];
            } else {
                $intCategoryCmd = 0;
            }
        } else {
            if (intval($arrIds[0]) != 0) {
                $intCategoryCmd = $arrIds[0];
            } else {
                $intCategoryCmd = 0;
            }
        }
        if ($intCategoryCmd != 0) {
            $intCategoryId = intval($intCategoryCmd);
        } else {
            $intCategoryId = 0;
        }
        $intCategoryId = isset($_GET['cid']) ? intval($_GET['cid']) : $intCategoryId;
        if ($bolShowCategorySelector) {
            $objCategories = new MediaDirectoryCategory(null, null, 1, $this->moduleName);
            $strCategoryDropdown = $objCategories->listCategories($this->_objTpl, 3, $intCategoryId);
            $strCategoryName = $_ARRAYLANG['TXT_MEDIADIR_CATEGORY'];
            $strExpandedInputfields .= <<<EOF
<p><label>{$strCategoryName}</label><select class="mediadirInputfieldSearch" name="cid"><option value="">{$strPleaseChoose}</option>{$strCategoryDropdown}</select></p>
EOF;
        }
        $objInputfields = new MediaDirectoryInputfield($formId, true, null, $this->moduleName);
        $strExpandedInputfields .= $objInputfields->listInputfields(null, 4, null);
        return $strExpandedInputfields;
    }