function showExport($step, $objTpl)
 {
     global $_ARRAYLANG, $_CORELANG, $_LANGID, $objDatabase;
     $objTpl->addBlockfile($this->moduleLangVar . '_INTERFACES_CONTENT', 'interfaces_content', 'module_' . $this->moduleNameLC . '_interfaces_export.html');
     if ($this->arrSettings['settingsShowLevels'] == 1) {
         $strFormOnSubmit = "selectAll(document.interfacesExportForm.elements['selectedCategories']); ";
         $strFormOnSubmit .= "selectAll(document.interfacesExportForm.elements['selectedLevels']); ";
         $objLevels = new MediaDirectoryLevel(null, null, true, $this->moduleName);
         $arrLevels = $objLevels->listLevels($objTpl, 4);
         $objTpl->parse($this->moduleNameLC . 'InterfacesExportSelectLevels');
     } else {
         $strFormOnSubmit = "selectAll(document.interfacesExportForm.elements['selectedCategories']); ";
         $objTpl->hideBlock($this->moduleNameLC . 'InterfacesExportSelectLevels');
     }
     $objCategories = new MediaDirectoryCategory(null, null, true, $this->moduleName);
     $arrCategories = $objCategories->listCategories($objTpl, 4);
     $objForms = new MediaDirectoryForm(null, $this->moduleName);
     $strForms = $objForms->listForms($objTpl, 4);
     $strMasks = '<option value="0">' . $_ARRAYLANG['TXT_MEDIADIR_NO_EXPORT_MASK'] . '</option>';
     $objResultMasks = $objDatabase->Execute("SELECT\n                                                    id,title,form_id \n                                                FROM\n                                                    " . DBPREFIX . "module_" . $this->moduleTablePrefix . "_masks \n                                                WHERE active = '1'    \n                                                ORDER BY title ASC     \n                                               ");
     if ($objResultMasks !== false) {
         while (!$objResultMasks->EOF) {
             $objForm = new MediaDirectoryForm($objResultMasks->fields['form_id'], $this->moduleName);
             $strFormName = $objForm->arrForms[$objResultMasks->fields['form_id']]['formName'][0];
             $strMasks .= '<option value="' . $objResultMasks->fields['id'] . '">' . $objResultMasks->fields['title'] . ' (' . $strFormName . ')</option>';
             $objResultMasks->MoveNext();
         }
     }
     $objTpl->setVariable(array($this->moduleLangVar . '_INTERFACES_EXPORT_DESELECTED_CATEGORIES' => $arrCategories['not_selected'], $this->moduleLangVar . '_INTERFACES_EXPORT_DESELECTED_LEVELS' => $arrLevels['not_selected'], $this->moduleLangVar . '_INTERFACES_EXPORT_FORMS' => $strForms, $this->moduleLangVar . '_INTERFACES_EXPORT_MASKS' => $strMasks, $this->moduleLangVar . '_FORM_ONSUBMIT' => $strFormOnSubmit, 'TXT_' . $this->moduleLangVar . '_EXPORT_FORMAT' => $_ARRAYLANG['TXT_MEDIADIR_EXPORT_FORMAT'], 'TXT_' . $this->moduleLangVar . '_FORM_TEMPLATE' => $_ARRAYLANG['TXT_MEDIADIR_FORM_TEMPLATE'], 'TXT_' . $this->moduleLangVar . '_EXPORT_MASK' => $_ARRAYLANG['TXT_MEDIADIR_EXPORT_MASK'], 'TXT_' . $this->moduleLangVar . '_CATEGORIES' => $_ARRAYLANG['TXT_MEDIADIR_CATEGORIES'], 'TXT_' . $this->moduleLangVar . '_LEVELS' => $_ARRAYLANG['TXT_MEDIADIR_LEVELS']));
     $objTpl->parse('interfaces_content');
 }
 function getNavigationPlacholder()
 {
     $this->strPlaceholder = null;
     if ($this->arrSettings['settingsShowLevels'] == 1) {
         $objLevels = new MediaDirectoryLevel(null, null, 0, $this->moduleName);
         $intLevelId = isset($_GET['lid']) ? intval($_GET['lid']) : null;
         $this->strPlaceholder = $objLevels->listLevels($this->_objTpl, 6, $intLevelId);
     } else {
         $objCategories = new MediaDirectoryCategory(null, null, 0, $this->moduleName);
         $intCategoryId = isset($_GET['cid']) ? intval($_GET['cid']) : null;
         $this->strPlaceholder = $objCategories->listCategories($this->_objTpl, 6, $intCategoryId, null, null, null, 1);
     }
     return '<ul id="' . $this->moduleNameLC . 'NavigationPlacholder">' . $this->strPlaceholder . '</ul>';
 }
 function showOverview()
 {
     global $_ARRAYLANG, $_CORELANG;
     $this->_objTpl->setTemplate($this->pageContent, true, true);
     $intCmdFormId = 0;
     $bolFormUseCategory = false;
     $bolFormUseLevel = false;
     //search existing category&level blocks
     $arrExistingBlocks = array();
     for ($i = 1; $i <= 10; $i++) {
         if ($this->_objTpl->blockExists($this->moduleNameLC . 'CategoriesLevels_row_' . $i)) {
             array_push($arrExistingBlocks, $i);
         }
     }
     //get ids
     if (isset($_GET['cmd'])) {
         $arrIds = explode("-", $_GET['cmd']);
     }
     if ($this->arrSettings['settingsShowLevels'] == 1) {
         if (intval($arrIds[0]) != 0) {
             $intLevelId = intval($arrIds[0]);
         } else {
             $intLevelId = 0;
         }
         $intLevelId = isset($_GET['lid']) ? intval($_GET['lid']) : $intLevelId;
         if (!empty($arrIds[1])) {
             $intCategoryCmd = $arrIds[1];
         } else {
             $intCategoryCmd = 0;
         }
     } else {
         $intLevelId = 0;
         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;
     // show block {$this->moduleNameLC}Overview
     if (empty($intCategoryId) && empty($intLevelId) && $this->_objTpl->blockExists($this->moduleNameLC . 'Overview')) {
         $this->_objTpl->touchBlock($this->moduleNameLC . 'Overview');
     }
     //get navtree
     if ($this->_objTpl->blockExists($this->moduleNameLC . 'Navtree') && ($intCategoryId != 0 || $intLevelId != 0)) {
         $this->getNavtree($intCategoryId, $intLevelId);
     }
     //get searchform
     if ($this->_objTpl->blockExists($this->moduleNameLC . 'Searchform')) {
         $objSearch = new MediaDirectorySearch($this->moduleName);
         $objSearch->getSearchform($this->_objTpl, 1);
     }
     //get level / category details
     if ($this->_objTpl->blockExists($this->moduleNameLC . 'CategoryLevelDetail')) {
         if ($intCategoryId == 0 && $intLevelId != 0 && $this->arrSettings['settingsShowLevels'] == 1) {
             $objLevel = new MediaDirectoryLevel($intLevelId, null, 0, $this->moduleName);
             $objLevel->listLevels($this->_objTpl, 5, $intLevelId);
         }
         if ($intCategoryId != 0) {
             $objCategory = new MediaDirectoryCategory($intCategoryId, null, 0, $this->moduleName);
             $objCategory->listCategories($this->_objTpl, 5, $intCategoryId);
         }
     }
     //check form cmd
     if (!empty($_GET['cmd']) && $arrIds[0] != 'search') {
         $arrFormCmd = array();
         $objForms = new MediaDirectoryForm(null, $this->moduleName);
         foreach ($objForms->arrForms as $intFormId => $arrForm) {
             if (!empty($arrForm['formCmd'])) {
                 $arrFormCmd[$arrForm['formCmd']] = intval($intFormId);
             }
         }
         if (!empty($arrFormCmd[$_GET['cmd']])) {
             $intCmdFormId = intval($arrFormCmd[$_GET['cmd']]);
         }
     }
     //list levels / categories
     if ($this->_objTpl->blockExists($this->moduleNameLC . 'CategoriesLevelsList')) {
         if ($intCmdFormId != 0) {
             $bolFormUseCategory = $objForms->arrForms[intval($intCmdFormId)]['formUseCategory'];
             $bolFormUseLevel = $objForms->arrForms[intval($intCmdFormId)]['formUseLevel'];
         } else {
             $bolFormUseCategory = true;
             $bolFormUseLevel = $this->arrSettings['settingsShowLevels'];
         }
         if ($this->arrSettings['settingsShowLevels'] == 1 && $intCategoryId == 0 && $bolFormUseLevel) {
             $objLevels = new MediaDirectoryLevel(null, $intLevelId, 1, $this->moduleName);
             $objCategories = new MediaDirectoryCategory(null, $intCategoryId, 1, $this->moduleName);
             $objLevels->listLevels($this->_objTpl, 2, null, null, null, $arrExistingBlocks);
             $this->_objTpl->clearVariables();
             $this->_objTpl->parse($this->moduleNameLC . 'CategoriesLevelsList');
         }
         if (isset($objLevel) && $objLevel->arrLevels[$intLevelId]['levelShowCategories'] == 1 || $intLevelId === 0 || $this->arrSettings['settingsShowLevels'] == 0 || $intCategoryId != 0 || $bolFormUseCategory && !$bolFormUseLevel) {
             $objCategories = new MediaDirectoryCategory(null, $intCategoryId, 1, $this->moduleName);
             $objCategories->listCategories($this->_objTpl, 2, null, null, null, $arrExistingBlocks);
             $this->_objTpl->clearVariables();
             $this->_objTpl->parse($this->moduleNameLC . 'CategoriesLevelsList');
         }
         if (empty($objLevel->arrLevels) && empty($objCategories->arrCategories)) {
             $this->_objTpl->hideBlock($this->moduleNameLC . 'CategoriesLevelsList');
             $this->_objTpl->clearVariables();
         }
     }
     //latest title
     if ($this->_objTpl->blockExists($this->moduleNameLC . 'LatestTitle') && $intCategoryId == 0 && $intLevelId == 0) {
         $this->_objTpl->touchBlock($this->moduleNameLC . 'LatestTitle');
     }
     //list entries
     if ($this->_objTpl->blockExists($this->moduleNameLC . 'EntryList')) {
         $intLimitStart = isset($_GET['pos']) ? intval($_GET['pos']) : 0;
         //check category / level
         if ($intCategoryId == 0 && $bolFormUseCategory || $intLevelId == 0 && $bolFormUseLevel) {
             $bolLatest = true;
             $intLimitEnd = intval($this->arrSettings['settingsLatestNumOverview']);
         } else {
             $bolLatest = false;
             $intLimitEnd = intval($this->arrSettings['settingsPagingNumEntries']);
             if (!empty($intCmdFormId) && !empty($objForms->arrForms[$intCmdFormId]['formEntriesPerPage'])) {
                 $intLimitEnd = $objForms->arrForms[$intCmdFormId]['formEntriesPerPage'];
             }
         }
         //check show entries
         if (isset($objLevel) && $objLevel->arrLevels[$intLevelId]['levelShowEntries'] == 1 || isset($objCategory) && $objCategory->arrCategories[$intCategoryId]['catShowEntries'] == 1 || $bolLatest == true || !$bolFormUseCategory && !$bolFormUseLevel) {
             $objEntries = new MediaDirectoryEntry($this->moduleName);
             $objEntries->getEntries(null, $intLevelId, $intCategoryId, null, $bolLatest, null, 1, $intLimitStart, $intLimitEnd, null, null, $intCmdFormId);
             $objEntries->listEntries($this->_objTpl, 2);
             if (!$bolLatest) {
                 $intNumEntries = intval($objEntries->countEntries());
                 if ($intNumEntries > $intLimitEnd) {
                     $objUrl = clone \Env::get('Resolver')->getUrl();
                     $currentUrlParams = $objUrl->getSuggestedParams();
                     $strPaging = getPaging($intNumEntries, $intLimitStart, $currentUrlParams, "<b>" . $_ARRAYLANG['TXT_MEDIADIR_ENTRIES'] . "</b>", true, $intLimitEnd);
                     $this->_objTpl->setGlobalVariable(array($this->moduleLangVar . '_PAGING' => $strPaging));
                 }
             }
         }
         //no entries found
         if (empty($objEntries->arrEntries)) {
             $this->_objTpl->hideBlock($this->moduleNameLC . 'EntryList');
             $this->_objTpl->clearVariables();
         }
     }
 }
 function manageEntries()
 {
     global $_ARRAYLANG, $_CORELANG, $objDatabase, $_LANGID;
     $this->_objTpl->loadTemplateFile('module_' . $this->moduleNameLC . '_manage_entries.html', true, true);
     $this->pageTitle = $_ARRAYLANG['TXT_MEDIADIR_MANAGE_ENTRIES'];
     $this->initFilterSession();
     if (isset($_REQUEST['cat_id'])) {
         $_SESSION[$this->moduleName]['searchFilter']['cat_id'] = intval($_REQUEST['cat_id']);
     }
     if (isset($_REQUEST['level_id'])) {
         $_SESSION[$this->moduleName]['searchFilter']['level_id'] = intval($_REQUEST['level_id']);
     }
     if (isset($_REQUEST['form_id'])) {
         $_SESSION[$this->moduleName]['searchFilter']['form_id'] = intval($_REQUEST['form_id']);
     }
     if (isset($_REQUEST['term'])) {
         $_SESSION[$this->moduleName]['searchFilter']['term'] = $_REQUEST['term'] != $_ARRAYLANG['TXT_MEDIADIR_ID_OR_SEARCH_TERM'] ? $_REQUEST['term'] : null;
     }
     //assign the searchFilter session values to corresponding variables
     $intCategoryId = $_SESSION[$this->moduleName]['searchFilter']['cat_id'];
     $intLevelId = $_SESSION[$this->moduleName]['searchFilter']['level_id'];
     $intFormId = $_SESSION[$this->moduleName]['searchFilter']['form_id'];
     $strTerm = $_SESSION[$this->moduleName]['searchFilter']['term'];
     $objCategories = new MediaDirectoryCategory(null, null, 1, $this->moduleName);
     $catDropdown = $objCategories->listCategories(null, 3, $intCategoryId);
     $objLevels = new MediaDirectoryLevel(null, null, 1, $this->moduleName);
     $levelDropdown = $objLevels->listLevels(null, 3, $intLevelId);
     $objForms = new MediaDirectoryForm(null, $this->moduleName);
     $formDropdown = $objForms->listForms(null, 4, $intFormId);
     //parse global variables
     $this->_objTpl->setGlobalVariable(array('TXT_' . $this->moduleLangVar . '_PAGE_TITLE' => $this->pageTitle, 'TXT_' . $this->moduleLangVar . '_SUBMIT' => $_ARRAYLANG['TXT_' . $this->moduleLangVar . '_SUBMIT'], 'TXT_EDIT' => $_ARRAYLANG['TXT_MEDIADIR_EDIT'], 'TXT_SEARCH' => $_CORELANG['TXT_SEARCH'], 'TXT_MEDIADIR_STATUS' => $_CORELANG['TXT_STATUS'], 'TXT_SELECT_ALL' => $_CORELANG['TXT_SELECT_ALL'], 'TXT_DESELECT_ALL' => $_CORELANG['TXT_DESELECT_ALL'], 'TXT_SELECT_ACTION' => $_CORELANG['TXT_MULTISELECT_SELECT'], 'TXT_FUNCTIONS' => $_ARRAYLANG['TXT_MEDIADIR_FUNCTIONS'], 'TXT_DELETE' => $_ARRAYLANG['TXT_MEDIADIR_DELETE'], 'TXT_DELETE_ALL' => $_CORELANG['TXT_MULTISELECT_DELETE'], 'TXT_' . $this->moduleLangVar . '_VOTING' => $_ARRAYLANG['TXT_MEDIADIR_VOTING'], 'TXT_' . $this->moduleLangVar . '_COMMENTS' => $_ARRAYLANG['TXT_MEDIADIR_COMMENTS'], 'TXT_' . $this->moduleLangVar . '_NAME' => $_CORELANG['TXT_NAME'], 'TXT_' . $this->moduleLangVar . '_DATE' => $_CORELANG['TXT_DATE'], 'TXT_' . $this->moduleLangVar . '_AUTHOR' => $_ARRAYLANG['TXT_MEDIADIR_AUTHOR'], 'TXT_' . $this->moduleLangVar . '_HITS' => $_ARRAYLANG['TXT_MEDIADIR_HITS'], 'TXT_' . $this->moduleLangVar . '_ACTION' => $_CORELANG['TXT_HISTORY_ACTION'], $this->moduleLangVar . '_SEARCH_TERM' => $strTerm != null ? $strTerm : $_ARRAYLANG['TXT_MEDIADIR_ID_OR_SEARCH_TERM'], 'TXT_' . $this->moduleLangVar . '_ID_OR_SEARCH_TERM' => $_ARRAYLANG['TXT_MEDIADIR_ID_OR_SEARCH_TERM'], $this->moduleLangVar . '_SEARCH_CATEGORY_ID' => $intCategoryId, $this->moduleLangVar . '_SEARCH_LEVEL_ID' => $intLevelId, 'TXT_' . $this->moduleLangVar . '_MOVE_ALL' => $_ARRAYLANG['TXT_MEDIADIR_MOVE_ALL'], 'TXT_' . $this->moduleLangVar . '_RESTORE_VOTING_ALL' => $_ARRAYLANG['TXT_MEDIADIR_RESTORE_VOTING_ALL'], 'TXT_' . $this->moduleLangVar . '_RESTORE_COMMENTS_ALL' => $_ARRAYLANG['TXT_MEDIADIR_RESTORE_COMMENTS_ALL'], 'TXT_' . $this->moduleLangVar . '_CONFIRM_DELETE_DATA' => $_ARRAYLANG['TXT_MEDIADIR_CONFIRM_DELETE_DATA'], 'TXT_' . $this->moduleLangVar . '_ACTION_IS_IRREVERSIBLE' => $_ARRAYLANG['TXT_MEDIADIR_ACTION_IS_IRREVERSIBLE'], 'TXT_' . $this->moduleLangVar . '_MAKE_SELECTION' => $_ARRAYLANG['TXT_MEDIADIR_MAKE_SELECTION'], 'TXT_SELECT_ALL' => $_CORELANG['TXT_SELECT_ALL'], 'TXT_DESELECT_ALL' => $_CORELANG['TXT_DESELECT_ALL'], 'TXT_SELECT_ACTION' => $_CORELANG['TXT_MULTISELECT_SELECT'], 'TXT_DELETE_ALL' => $_CORELANG['TXT_MULTISELECT_DELETE'], 'TXT_' . $this->moduleLangVar . '_MOVE_ALL' => $_ARRAYLANG['TXT_MEDIADIR_MOVE_ALL'], 'TXT_' . $this->moduleLangVar . '_ALL_LEVELS' => $_ARRAYLANG['TXT_MEDIADIR_ALL_LEVELS'], 'TXT_' . $this->moduleLangVar . '_ALL_CATEGORIES' => $_ARRAYLANG['TXT_MEDIADIR_ALL_CATEGORIES'], 'TXT_' . $this->moduleLangVar . '_ALL_FORMS' => $_ARRAYLANG['TXT_MEDIADIR_ALL_FORMS'], $this->moduleLangVar . '_CATEGORIES_DROPDOWN_OPTIONS' => $catDropdown, $this->moduleLangVar . '_LEVELS_DROPDOWN_OPTIONS' => $levelDropdown, $this->moduleLangVar . '_FORMS_DROPDOWN_OPTIONS' => $formDropdown, 'TXT_' . $this->moduleLangVar . '_FORM' => $_ARRAYLANG['TXT_MEDIADIR_FORM']));
     //get seting values
     parent::getSettings();
     if ($this->arrSettings['settingsShowLevels'] == 1) {
         $this->_objTpl->touchBlock($this->moduleNameLC . 'LevelDropdown');
     } else {
         $this->_objTpl->hideBlock($this->moduleNameLC . 'LevelDropdown');
     }
     if (count($objForms->arrForms) > 1) {
         $this->_objTpl->touchBlock($this->moduleNameLC . 'FormDropdown');
     } else {
         $this->_objTpl->hideBlock($this->moduleNameLC . 'FormDropdown');
     }
     $objEntries = new MediaDirectoryEntry($this->moduleName);
     if (isset($_POST['submitEntriesOrderForm'])) {
         if ($objEntries->saveOrder($_POST)) {
             $this->strOkMessage = $_CORELANG['TXT_SETTINGS_UPDATED'];
         } else {
             $this->strErrMessage = $_CORELANG['TXT_DATABASE_QUERY_ERROR'];
         }
     }
     $objSettings = new MediaDirectorySettings($this->moduleName);
     if ($this->_objTpl->blockExists('mediadirTableHeaderComments')) {
         if ($objSettings->arrSettings['settingsAllowComments']) {
             $this->_objTpl->touchBlock('mediadirTableHeaderComments');
         }
     }
     if ($this->_objTpl->blockExists('mediadirTableHeaderVotes')) {
         if ($objSettings->arrSettings['settingsAllowVotes']) {
             $this->_objTpl->touchBlock('mediadirTableHeaderVotes');
         }
     }
     switch ($_GET['act']) {
         case 'move_entry':
             $this->strErrMessage = "Diese Funktion ist zurzeit noch nicht implementiert.";
             break;
         case 'delete_entry':
             \Permission::checkAccess(MediaDirectoryAccessIDs::ModifyEntry, 'static');
             if (!isset($_GET['id'])) {
                 foreach ($_POST["entriesFormSelected"] as $intEntryId) {
                     $strStatus = $objEntries->deleteEntry(intval($intEntryId));
                 }
             } else {
                 $strStatus = $objEntries->deleteEntry(intval($_GET['id']));
             }
             if ($strStatus) {
                 $this->strOkMessage = $_ARRAYLANG['TXT_MEDIADIR_ENTRY'] . " " . $_ARRAYLANG['TXT_MEDIADIR_SUCCESSFULLY_DELETED'];
             } else {
                 $this->strErrMessage = $_ARRAYLANG['TXT_MEDIADIR_ENTRY'] . " " . $_ARRAYLANG['TXT_MEDIADIR_CORRUPT_DELETED'];
             }
             break;
         case 'restore_voting':
             \Permission::checkAccess(MediaDirectoryAccessIDs::ModifyEntry, 'static');
             $objVotes = new MediaDirectoryVoting($this->moduleName);
             if (!isset($_GET['id'])) {
                 foreach ($_POST["entriesFormSelected"] as $intEntryId) {
                     $strStatus = $objVotes->restoreVoting(intval($intEntryId));
                 }
             } else {
                 $strStatus = $objVotes->restoreVoting(intval($_GET['id']));
             }
             if ($strStatus) {
                 $this->strOkMessage = $_ARRAYLANG['TXT_MEDIADIR_VOTING'] . " " . $_ARRAYLANG['TXT_MEDIADIR_SUCCESSFULLY_DELETED'];
             } else {
                 $this->strErrMessage = $_ARRAYLANG['TXT_MEDIADIR_VOTING'] . " " . $_ARRAYLANG['TXT_MEDIADIR_CORRUPT_DELETED'];
             }
             break;
         case 'restore_comments':
             \Permission::checkAccess(MediaDirectoryAccessIDs::ModifyEntry, 'static');
             $objComments = new MediaDirectoryComment($this->moduleName);
             if (!isset($_GET['id'])) {
                 foreach ($_POST["entriesFormSelected"] as $intEntryId) {
                     $strStatus = $objComments->restoreComments(intval($intEntryId));
                 }
             } else {
                 $strStatus = $objComments->restoreComments(intval($_GET['id']));
             }
             if ($strStatus) {
                 $this->strOkMessage = $_ARRAYLANG['TXT_MEDIADIR_COMMENTS'] . " " . $_ARRAYLANG['TXT_MEDIADIR_SUCCESSFULLY_DELETED'];
             } else {
                 $this->strErrMessage = $_ARRAYLANG['TXT_MEDIADIR_COMMENTS'] . " " . $_ARRAYLANG['TXT_MEDIADIR_CORRUPT_DELETED'];
             }
             break;
             break;
         case 'confirm_entry':
             \Permission::checkAccess(MediaDirectoryAccessIDs::ModifyEntry, 'static');
             if (!isset($_GET['id'])) {
                 foreach ($_POST["entriesFormSelected"] as $intEntryId) {
                     $strStatus = $objEntries->confirmEntry(intval($intEntryId));
                 }
             } else {
                 $strStatus = $objEntries->confirmEntry(intval($_GET['id']));
             }
             if ($strStatus) {
                 $this->strOkMessage = $_ARRAYLANG['TXT_MEDIADIR_ENTRY'] . " " . $_ARRAYLANG['TXT_MEDIADIR_SUCCESSFULLY_CONFIRM'];
             } else {
                 $this->strErrMessage = $_ARRAYLANG['TXT_MEDIADIR_ENTRY'] . " " . $_ARRAYLANG['TXT_MEDIADIR_CORRUPT_CONFIRM'];
             }
             break;
     }
     $objEntries->getEntries(null, $intLevelId, $intCategoryId, $strTerm, null, null, null, null, 'n', null, null, $intFormId, null, $this->limit, $this->offset);
     $objEntries->listEntries($this->_objTpl, 1);
     // Paging
     $count = $objEntries->countEntries();
     $filter = (!empty($strTerm) ? '&term=' . $strTerm : '') . (!empty($intCategoryId) ? '&cat_id=' . $intCategoryId : '') . (!empty($intFormId) ? '&form_id=' . $intFormId : '') . (!empty($intLevelId) ? '&level_id=' . $intLevelId : '');
     $term = !empty($strTerm) ? '&term=' . $strTerm : '';
     $paging = getPaging($count, $this->offset, '&cmd=' . $this->moduleName . '&act=entries' . $filter, '', true);
     $this->_objTpl->setGlobalVariable($this->moduleLangVar . '_PAGING', $paging);
     if (!empty($strTerm)) {
         $this->_objTpl->setVariable($this->moduleLangVar . '_SEARCH_TERM_PARAMETER', '&term=' . $strTerm);
     }
     if (empty($objEntries->arrEntries)) {
         $this->_objTpl->hideBlock($this->moduleNameLC . 'EntriesSelectAction');
     } else {
         $this->_objTpl->touchBlock($this->moduleNameLC . 'EntriesSelectAction');
     }
 }
 function listInputfields($objTpl, $intView, $intEntryId)
 {
     global $_ARRAYLANG, $_CORELANG, $objDatabase, $_LANGID, $objInit;
     usort($this->arrInputfields, array(__CLASS__, "sortInputfields"));
     switch ($intView) {
         case 1:
             //Settings View
             $objTpl->addBlockfile($this->moduleLangVar . '_SETTINGS_INPUTFIELDS_CONTENT', 'settings_inputfields_content', 'module_' . $this->moduleNameLC . '_settings_inputfields.html');
             $objForms = new MediaDirectoryForm($this->intFormId, $this->moduleName);
             $arrShow = array(1 => $_ARRAYLANG['TXT_MEDIADIR_SHOW_BACK_N_FRONTEND'], 2 => $_ARRAYLANG['TXT_MEDIADIR_SHOW_FRONTEND'], 3 => $_ARRAYLANG['TXT_MEDIADIR_SHOW_BACKEND']);
             $i = 0;
             $intLastId = 0;
             foreach ($this->arrInputfields as $key => $arrInputfield) {
                 $strMustfield = $arrInputfield['required'] == 1 ? 'checked="checked"' : '';
                 $strExpSearch = $arrInputfield['search'] == 1 ? 'checked="checked"' : '';
                 if ($arrInputfield['id'] > $intLastId) {
                     $intLastId = $arrInputfield['id'];
                 }
                 $objTpl->setGlobalVariable(array($this->moduleLangVar . '_SETTINGS_INPUTFIELD_ROW_CLASS' => $i % 2 == 0 ? 'row1' : 'row2', $this->moduleLangVar . '_SETTINGS_INPUTFIELD_LASTID' => $intLastId));
                 if ($arrInputfield['id'] != 1 && $arrInputfield['id'] != 2) {
                     $objTpl->setGlobalVariable(array($this->moduleLangVar . '_SETTINGS_INPUTFIELD_ID' => $arrInputfield['id'], $this->moduleLangVar . '_SETTINGS_INPUTFIELD_FORM_ID' => $this->intFormId, $this->moduleLangVar . '_SETTINGS_INPUTFIELD_ORDER' => $arrInputfield['order'], $this->moduleLangVar . '_SETTINGS_INPUTFIELD_TYPE' => $this->buildDropdownmenu($this->getInputfieldTypes(), $arrInputfield['type']), $this->moduleLangVar . '_SETTINGS_INPUTFIELD_VERIFICATION' => $this->buildDropdownmenu($this->getInputfieldVerifications(), $arrInputfield['verification']), $this->moduleLangVar . '_SETTINGS_INPUTFIELD_SHOW' => $this->buildDropdownmenu($arrShow, $arrInputfield['show_in']), $this->moduleLangVar . '_SETTINGS_INPUTFIELD_CONTEXT' => $this->buildDropdownmenu($this->getInputContexts(), $arrInputfield['context_type']), $this->moduleLangVar . '_SETTINGS_INPUTFIELD_MUSTFIELD' => $strMustfield, $this->moduleLangVar . '_SETTINGS_INPUTFIELD_EXP_SEARCH' => $strExpSearch, $this->moduleLangVar . '_SETTINGS_INPUTFIELD_NAME_MASTER' => $arrInputfield['name'][0], $this->moduleLangVar . '_SETTINGS_INPUTFIELD_DEFAULTVALUE_MASTER' => contrexx_raw2xhtml($arrInputfield['default_value'][0]), $this->moduleLangVar . '_SETTINGS_INPUTFIELD_INFO_MASTER' => $arrInputfield['info'][0]));
                     //fieldname
                     foreach ($this->arrFrontendLanguages as $key => $arrLang) {
                         $objTpl->setVariable(array($this->moduleLangVar . '_INPUTFIELD_NAME_LANG_ID' => $arrLang['id'], $this->moduleLangVar . '_INPUTFIELD_NAME_LANG_SHORTCUT' => $arrLang['lang'], $this->moduleLangVar . '_INPUTFIELD_NAME_LANG_NAME' => $arrLang['name'], $this->moduleLangVar . '_SETTINGS_INPUTFIELD_NAME' => $arrInputfield['name'][$arrLang['id']]));
                         $objTpl->parse($this->moduleNameLC . 'InputfieldNameList');
                     }
                     //default values
                     foreach ($this->arrFrontendLanguages as $key => $arrLang) {
                         $objTpl->setVariable(array($this->moduleLangVar . '_INPUTFIELD_DEFAULTVALUE_LANG_ID' => $arrLang['id'], $this->moduleLangVar . '_INPUTFIELD_DEFAULTVALUE_LANG_SHORTCUT' => $arrLang['lang'], $this->moduleLangVar . '_INPUTFIELD_DEFAULTVALUE_LANG_NAME' => $arrLang['name'], $this->moduleLangVar . '_SETTINGS_INPUTFIELD_DEFAULTVALUE' => contrexx_raw2xhtml($arrInputfield['default_value'][$arrLang['id']])));
                         $objTpl->parse($this->moduleNameLC . 'InputfieldDefaultvalueList');
                     }
                     //infotext
                     foreach ($this->arrFrontendLanguages as $key => $arrLang) {
                         $objTpl->setVariable(array($this->moduleLangVar . '_INPUTFIELD_INFO_LANG_ID' => $arrLang['id'], $this->moduleLangVar . '_INPUTFIELD_INFO_LANG_SHORTCUT' => $arrLang['lang'], $this->moduleLangVar . '_INPUTFIELD_INFO_LANG_NAME' => $arrLang['name'], $this->moduleLangVar . '_SETTINGS_INPUTFIELD_INFO' => $arrInputfield['info'][$arrLang['id']]));
                         $objTpl->parse($this->moduleNameLC . 'InputfieldInfoList');
                     }
                     //language names
                     foreach ($this->arrFrontendLanguages as $key => $arrLang) {
                         if ($key + 1 == count($this->arrFrontendLanguages)) {
                             $minimize = "<a id=\"inputfieldMinimize_" . $arrInputfield['id'] . "\" href=\"javascript:ExpandMinimizeInputfields('inputfieldName', '" . $arrInputfield['id'] . "'); ExpandMinimizeInputfields('inputfieldDefaultvalue', '" . $arrInputfield['id'] . "'); ExpandMinimizeInputfields('inputfieldLanguages', '" . $arrInputfield['id'] . "'); ExpandMinimizeInputfields('inputfieldInfo', '" . $arrInputfield['id'] . "');\">&laquo;&nbsp;" . $_ARRAYLANG['TXT_MEDIADIR_MINIMIZE'] . "</a>";
                         } else {
                             $minimize = "";
                         }
                         $objTpl->setVariable(array($this->moduleLangVar . '_INPUTFIELD_LANG_NAME' => $arrLang['name'], $this->moduleLangVar . '_INPUTFIELD_MINIMIZE' => $minimize));
                         $objTpl->parse($this->moduleNameLC . 'InputfieldLanguagesList');
                     }
                     if ($arrInputfield['exp_search'] == 0) {
                         $objTpl->hideBlock($this->moduleNameLC . 'InputfieldAdvancedSearch');
                     } else {
                         $objTpl->touchBlock($this->moduleNameLC . 'InputfieldAdvancedSearch');
                     }
                     $objTpl->parse($this->moduleNameLC . 'Inputfield');
                 } else {
                     if ($arrInputfield['id'] == 2 && $objForms->arrForms[$this->intFormId]['formUseLevel'] || $arrInputfield['id'] == 1 && $objForms->arrForms[$this->intFormId]['formUseCategory']) {
                         $objTpl->setVariable(array($this->moduleLangVar . '_SETTINGS_SELECTOR_ID' => $arrInputfield['id'], $this->moduleLangVar . '_SETTINGS_SELECTOR_NAME' => $arrInputfield['name'][0], $this->moduleLangVar . '_SETTINGS_SELECTOR_ORDER' => $arrInputfield['order'], $this->moduleLangVar . '_SETTINGS_SELECTOR_EXP_SEARCH' => $strExpSearch));
                         $objTpl->parse($this->moduleNameLC . 'Selector');
                     }
                 }
                 $i++;
                 $objTpl->parse($this->moduleNameLC . 'InputfieldList');
             }
             $objTpl->parse('settings_inputfields_content');
             break;
         case 2:
             //modify (add/edit) View
             $objAddStep = new MediaDirectoryAddStep($this->moduleName);
             $i = 0;
             $isFileInputFound = false;
             foreach ($this->arrInputfields as $key => $arrInputfield) {
                 $strInputfield = null;
                 if ($arrInputfield['required'] == 1) {
                     $strRequiered = '<font color="#ff0000"> *</font>';
                 } else {
                     $strRequiered = null;
                 }
                 if (!empty($arrInputfield['type'])) {
                     if (!$isFileInputFound && in_array($arrInputfield['type_name'], array('image', 'file', 'downloads'))) {
                         $isFileInputFound = true;
                     }
                     $strType = $arrInputfield['type_name'];
                     $strInputfieldClass = "\\Cx\\Modules\\MediaDir\\Model\\Entity\\MediaDirectoryInputfield" . ucfirst($strType);
                     try {
                         $objInputfield = safeNew($strInputfieldClass, $this->moduleName);
                         switch ($strType) {
                             case 'add_step':
                                 $objAddStep->addNewStep(empty($arrInputfield['name'][$_LANGID]) ? $arrInputfield['name'][0] . $strRequiered : $arrInputfield['name'][$_LANGID]);
                                 $strInputfield = $objInputfield->getInputfield(1, $arrInputfield, $intEntryId, $objAddStep);
                                 break;
                             case 'field_group':
                                 //to do
                                 break;
                             default:
                                 if ($arrInputfield['show_in'] == 1) {
                                     $bolGetInputfield = true;
                                 } else {
                                     if ($objInit->mode == 'backend' && $arrInputfield['show_in'] == 3) {
                                         $bolGetInputfield = true;
                                     } else {
                                         if ($objInit->mode == 'frontend' && $arrInputfield['show_in'] == 2) {
                                             $bolGetInputfield = true;
                                         } else {
                                             $bolGetInputfield = false;
                                         }
                                     }
                                 }
                                 if ($bolGetInputfield) {
                                     $strInputfield = $objInputfield->getInputfield(1, $arrInputfield, $intEntryId);
                                 } else {
                                     $strInputfield = null;
                                 }
                                 break;
                         }
                         if ($strInputfield != null) {
                             $this->makeJavascriptInputfieldArray($arrInputfield['id'], $this->moduleNameLC . "Inputfield[" . $arrInputfield['id'] . "]", $arrInputfield['required'], $arrInputfield['regex'], $strType);
                             $this->strJavascriptInputfieldCheck[$strType] = $objInputfield->getJavascriptCheck();
                             $this->arrJavascriptFormOnSubmit[$arrInputfield['id']] = $objInputfield->getFormOnSubmit($arrInputfield['id']);
                         }
                     } catch (Exception $error) {
                         echo "Error: " . $error->getMessage();
                     }
                 } else {
                     $objForms = new MediaDirectoryForm($this->intFormId, $this->moduleName);
                     /*if($objInit->mode == 'backend') {
                           $strStyle = 'style="overflow: auto; border: 1px solid #0A50A1; background-color: #ffffff; width: 298px; height: 200px; float: left; list-style: none; padding: 0px; margin: 0px 5px 0px 0px;"';
                       } else {
                           $strStyle = 'style="overflow: auto; float: left; list-style: none; padding: 0px; margin: 0px 5px 0px 0px;"';
                       }*/
                     if ($arrInputfield['id'] == 2 && $objForms->arrForms[$this->intFormId]['formUseLevel'] || $arrInputfield['id'] == 1 && $objForms->arrForms[$this->intFormId]['formUseCategory']) {
                         if ($arrInputfield['id'] == 2) {
                             $objLevel = new MediaDirectoryLevel(null, null, 1, $this->moduleName);
                             $arrSelectorOptions = $objLevel->listLevels($objTpl, 4, null, null, $intEntryId);
                             $strSelectedOptionsName = "selectedLevels";
                             $strNotSelectedOptionsName = "deselectedLevels";
                         } else {
                             $objCategory = new MediaDirectoryCategory(null, null, 1, $this->moduleName);
                             $arrSelectorOptions = $objCategory->listCategories($objTpl, 4, null, null, $intEntryId);
                             $strSelectedOptionsName = "selectedCategories";
                             $strNotSelectedOptionsName = "deselectedCategories";
                         }
                         $strInputfield .= '<div class="mediadirSelector container-fluid"><div class="row"><div class="col-md-offset-3">';
                         $strInputfield .= '<div class="col-md-4 col-sm-12 col-xs-12 mediadirSelectorLeft"><div class="row"><select id="' . $strNotSelectedOptionsName . '" name="' . $strNotSelectedOptionsName . '[]" size="12" multiple="multiple">';
                         $strInputfield .= $arrSelectorOptions['not_selected'];
                         $strInputfield .= '</select></div></div>';
                         $strInputfield .= '<div class="mediadirSelectorCenter col-md-2 col-sm-12 col-xs-12">';
                         $strInputfield .= '<input class="btn btn-default" value=" &gt;&gt; " name="addElement" onclick="moveElement(document.entryModfyForm.elements[\'' . $strNotSelectedOptionsName . '\'],document.entryModfyForm.elements[\'' . $strSelectedOptionsName . '\'],addElement,removeElement);" type="button">';
                         $strInputfield .= '<br />';
                         $strInputfield .= '<input class="btn btn-default" value=" &lt;&lt; " name="removeElement" onclick="moveElement(document.entryModfyForm.elements[\'' . $strSelectedOptionsName . '\'],document.entryModfyForm.elements[\'' . $strNotSelectedOptionsName . '\'],removeElement,addElement);" type="button">';
                         $strInputfield .= '</div>';
                         $strInputfield .= '<div class="col-md-4 col-sm-12 col-xs-12 mediadirSelectorRight"><div class="row"><select id="' . $strSelectedOptionsName . '" name="' . $strSelectedOptionsName . '[]" size="12" multiple="multiple">';
                         $strInputfield .= $arrSelectorOptions['selected'];
                         $strInputfield .= '</select></div></div>';
                         $strInputfield .= '</div></div></div>';
                         $this->makeJavascriptInputfieldArray($arrInputfield['id'], $strSelectedOptionsName, 1, 1, "selector");
                         $this->arrJavascriptFormOnSubmit[$arrInputfield['id']] = "selectAll(document.entryModfyForm.elements['" . $strSelectedOptionsName . "[]']); ";
                     }
                 }
                 if ($arrInputfield['type_name'] == 'add_step' && $objInit->mode != 'backend') {
                     $objTpl->setVariable(array($this->moduleLangVar . '_INPUTFIELD_ADDSTEP' => $strInputfield));
                     $objTpl->parse($this->moduleNameLC . 'InputfieldAddStep');
                 } else {
                     if ($strInputfield != null) {
                         if ($arrInputfield['type_name'] == 'title') {
                             $strStartTitle = '<h2>';
                             $strEndTitle = '</h2>';
                         } else {
                             $strStartTitle = '';
                             $strEndTitle = '';
                         }
                         $objTpl->setVariable(array('TXT_' . $this->moduleLangVar . '_INPUTFIELD_NAME' => $strStartTitle . (empty($arrInputfield['name'][$_LANGID]) ? $arrInputfield['name'][0] . $strRequiered : $arrInputfield['name'][$_LANGID] . $strRequiered) . $strEndTitle, $this->moduleLangVar . '_INPUTFIELD_FIELD' => $strInputfield, $this->moduleLangVar . '_INPUTFIELD_ROW_CLASS' => $i % 2 == 0 ? 'row1' : 'row2'));
                         if ($arrInputfield['type_name'] != 'add_step') {
                             $i++;
                             $objTpl->parse($this->moduleNameLC . 'InputfieldList');
                         }
                     }
                 }
                 if ($objInit->mode != 'backend') {
                     $objTpl->parse($this->moduleNameLC . 'InputfieldElement');
                 }
             }
             if ($isFileInputFound && $objInit->mode != 'backend') {
                 // init uploader to upload images
                 $uploader = new \Cx\Core_Modules\Uploader\Model\Entity\Uploader();
                 $uploader->setCallback($this->moduleNameLC . 'UploaderCallback');
                 $uploader->setOptions(array('id' => $this->moduleNameLC . 'ImageUploader', 'style' => 'display:none', 'data-upload-limit' => 1));
                 $objTpl->setVariable(array($this->moduleLangVar . '_UPLOADER_ID' => $uploader->getId(), $this->moduleLangVar . '_UPLOADER_CODE' => $uploader->getXHtml()));
             }
             if (!empty($objAddStep->arrSteps) && $objInit->mode != 'backend') {
                 $objAddStep->getStepNavigation($objTpl);
                 $objTpl->parse($this->moduleNameLC . 'EntryAddStepNavigation');
                 $objTpl->setVariable(array($this->moduleLangVar . '_INPUTFIELD_ADDSTEP_TERMINATOR' => "</div>"));
             }
             break;
         case 3:
             //frontend View
             foreach ($this->arrInputfields as $key => $arrInputfield) {
                 $intInputfieldId = intval($arrInputfield['id']);
                 $intInputfieldType = intval($arrInputfield['type']);
                 if (($objTpl->blockExists($this->moduleNameLC . '_inputfield_' . $intInputfieldId) || $objTpl->blockExists($this->moduleNameLC . '_inputfields')) && ($intInputfieldType != 16 && $intInputfieldType != 17)) {
                     if (!empty($arrInputfield['type'])) {
                         $strType = $arrInputfield['type_name'];
                         $strInputfieldClass = "\\Cx\\Modules\\MediaDir\\Model\\Entity\\MediaDirectoryInputfield" . ucfirst($strType);
                         try {
                             $objInputfield = safeNew($strInputfieldClass, $this->moduleName);
                             if (intval($arrInputfield['type_multi_lang']) == 1) {
                                 $arrInputfieldContent = $objInputfield->getContent($intEntryId, $arrInputfield, $this->arrTranslationStatus);
                             } else {
                                 $arrInputfieldContent = $objInputfield->getContent($intEntryId, $arrInputfield, null);
                             }
                             if (!empty($arrInputfieldContent)) {
                                 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('/\\[\\[([A-Z][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());
                                 }
                                 foreach ($arrInputfieldContent as $strPlaceHolder => $strContent) {
                                     $objTpl->setVariable(array(strtoupper($strPlaceHolder) => $strContent));
                                 }
                                 if ($objTpl->blockExists($this->moduleNameLC . '_inputfields')) {
                                     $objTpl->parse($this->moduleNameLC . '_inputfields');
                                 } else {
                                     if ($objTpl->blockExists($this->moduleNameLC . '_inputfield_' . $intInputfieldId)) {
                                         $objTpl->parse($this->moduleNameLC . '_inputfield_' . $intInputfieldId);
                                     }
                                 }
                             } else {
                                 if ($objTpl->blockExists($this->moduleNameLC . '_inputfield_' . $intInputfieldId)) {
                                     $objTpl->hideBlock($this->moduleNameLC . '_inputfield_' . $intInputfieldId);
                                 }
                             }
                         } catch (Exception $error) {
                             echo "Error: " . $error->getMessage();
                         }
                     }
                 }
                 $objTpl->clearVariables();
             }
             break;
         case 4:
             //Exp Search View
             $strInputfields = '';
             foreach ($this->arrInputfields as $key => $arrInputfield) {
                 if ($this->checkFieldTypeIsExpSeach($arrInputfield['type'])) {
                     if (!empty($arrInputfield['type'])) {
                         $strType = $arrInputfield['type_name'];
                         $strInputfieldClass = "\\Cx\\Modules\\MediaDir\\Model\\Entity\\MediaDirectoryInputfield" . ucfirst($strType);
                         try {
                             $objInputfield = safeNew($strInputfieldClass, $this->moduleName);
                             $strInputfield = $objInputfield->getInputfield(2, $arrInputfield);
                             if ($strInputfield != null) {
                                 $strInputfields .= '<p><label>' . $arrInputfield['name'][0] . '</label>' . $strInputfield . '</p>';
                             }
                         } catch (Exception $error) {
                             echo "Error: " . $error->getMessage();
                         }
                     }
                 }
             }
             return $strInputfields;
             break;
     }
 }
    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;
    }
    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;
    }