function listEntries($objTpl, $intView, $googleMapPlaceholder = null)
    {
        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_TITLE' => contrexx_raw2xhtml($arrEntry['entryFields'][0]), $this->moduleLangVar . '_ENTRY_TITLE_URL_ENCODED' => urlencode($arrEntry['entryFields'][0]), $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_TITLE' => contrexx_raw2xhtml($arrEntry['entryFields'][0]), $this->moduleLangVar . '_ENTRY_TITLE_URL_ENCODED' => urlencode($arrEntry['entryFields'][0]), $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
                if (!isset($googleMapPlaceholder)) {
                    $googleMapPlaceholder = $this->moduleLangVar . '_GOOGLE_MAP';
                }
                // abort in case the relevant placeholder is missing in the template
                if (!$objTpl->placeholderExists($googleMapPlaceholder)) {
                    break;
                }
                $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) {
                        $intEntryId = intval($arrEntry['entryId']);
                        $intEntryFormId = intval($arrEntry['entryFormId']);
                        $query = "\n                            SELECT\n                                inputfield.`id` AS `id`,\n                                rel_inputfield.`value` AS `value`\n                            FROM\n                                " . DBPREFIX . "module_" . $this->moduleTablePrefix . "_inputfields AS inputfield,\n                                " . DBPREFIX . "module_" . $this->moduleTablePrefix . "_rel_entry_inputfields AS rel_inputfield\n                            WHERE\n                                inputfield.`form` = '" . $intEntryFormId . "'\n                            AND\n                                inputfield.`type`= '15'\n                            AND\n                                rel_inputfield.`field_id` = inputfield.`id`\n                            AND\n                                rel_inputfield.`entry_id` = '" . $intEntryId . "'\n                            LIMIT 1\n                        ";
                        $objRSMapKoordinates = $objDatabase->Execute($query);
                        if ($objRSMapKoordinates === false || empty($objRSMapKoordinates->fields['value'])) {
                            continue;
                        }
                        $arrValues = explode(',', $objRSMapKoordinates->fields['value']);
                        $strValueLon = empty($arrValues[1]) ? 0 : $arrValues[1];
                        $strValueLat = empty($arrValues[0]) ? 0 : $arrValues[0];
                        if (empty($strValueLon) && empty($strValueLat)) {
                            continue;
                        }
                        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>';
                        $mapIndex = $objGoogleMap->getMapIndex();
                        $clickFunction = <<<JSCODE
infoWindow = cx.variables.get('map_{$mapIndex}_infoWindow', '{$objGoogleMap->getMapId()}');
if (infoWindow) {
    infoWindow.close();
}
mapMarker = cx.variables.get('map_{$mapIndex}_markers', '{$objGoogleMap->getMapId()}')[{$intEntryId}];
infoWindow.setContent(mapMarker.info);
infoWindow.open(map_{$mapIndex}, mapMarker.marker);
JSCODE;
                        $objGoogleMap->addMapMarker($intEntryId, $strValueLon, $strValueLat, $strEntryTitle . "<br />" . $strEntryLink, true, $clickFunction);
                    }
                }
                $objTpl->setVariable(array($googleMapPlaceholder => $objGoogleMap->getMap()));
                break;
        }
    }
Пример #2
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;
     }
 }
 function modifyEntry()
 {
     global $_ARRAYLANG, $_CORELANG, $objDatabase, $_LANGID;
     \JS::activate('cx');
     \JS::activate('jqueryui');
     $this->_objTpl->loadTemplateFile('module_' . $this->moduleNameLC . '_modify_entry.html', true, true);
     $this->pageTitle = $_ARRAYLANG['TXT_MEDIADIR_ENTRIES'];
     //get seting values
     parent::getSettings();
     $intEntryDourationAlways = '';
     $intEntryDourationPeriod = '';
     $intEntryDourationShowPeriod = 'none';
     $intEntryDourationEnd = 0;
     $intEntryDourationStart = 0;
     $strOnSubmit = '';
     if (!empty($_GET['id'])) {
         \Permission::checkAccess(MediaDirectoryAccessIDs::ModifyEntry, 'static');
         $pageTitle = $_ARRAYLANG['TXT_MEDIADIR_ENTRY'] . " " . $_ARRAYLANG['TXT_MEDIADIR_EDIT'];
         $intEntryId = intval($_GET['id']);
     } else {
         \Permission::checkAccess(MediaDirectoryAccessIDs::AddEntry, 'static');
         $pageTitle = $_ARRAYLANG['TXT_MEDIADIR_ENTRY'] . " " . $_ARRAYLANG['TXT_MEDIADIR_ADD'];
         $intEntryId = null;
     }
     //count forms
     $objForms = new MediaDirectoryForm(null, $this->moduleName);
     $arrActiveForms = array();
     foreach ($objForms->arrForms as $intFormId => $arrForm) {
         if ($arrForm['formActive'] == 1) {
             $arrActiveForms[] = $intFormId;
         }
     }
     $intCountForms = count($arrActiveForms);
     if ($intCountForms > 0) {
         if (intval($intEntryId) == 0 && (empty($_POST['selectedFormId']) && empty($_POST['formId'])) && $intCountForms > 1) {
             $intFormId = null;
             //get form selector
             $objForms->listForms($this->_objTpl, 2, $intFormId);
             //parse blocks
             $this->_objTpl->hideBlock($this->moduleNameLC . 'EntryStatus');
             $this->_objTpl->hideBlock($this->moduleNameLC . 'InputfieldList');
             $this->_objTpl->hideBlock($this->moduleNameLC . 'SpezfieldList');
         } else {
             //save entry data
             if (isset($_POST['submitEntryModfyForm']) && !empty($_POST['formId'])) {
                 $objEntry = new MediaDirectoryEntry($this->moduleName);
                 $intEntryId = intval($_POST['entryId']);
                 $intEntryId = $objEntry->saveEntry($_POST, $intEntryId);
                 if (!empty($_POST['entryId'])) {
                     if ($intEntryId) {
                         $this->strOkMessage = $_ARRAYLANG['TXT_MEDIADIR_ENTRY'] . ' ' . $_ARRAYLANG['TXT_MEDIADIR_SUCCESSFULLY_EDITED'];
                     } else {
                         $intEntryId = intval($_POST['entryId']);
                         $this->strErrMessage = $_ARRAYLANG['TXT_MEDIADIR_ENTRY'] . ' ' . $_ARRAYLANG['TXT_MEDIADIR_CORRUPT_EDITED'];
                     }
                 } else {
                     if ($intEntryId) {
                         $this->strOkMessage = $_ARRAYLANG['TXT_MEDIADIR_ENTRY'] . ' ' . $_ARRAYLANG['TXT_MEDIADIR_SUCCESSFULLY_ADDED'];
                     } else {
                         $this->strErrMessage = $_ARRAYLANG['TXT_MEDIADIR_ENTRY'] . ' ' . $_ARRAYLANG['TXT_MEDIADIR_CORRUPT_ADDED'];
                     }
                 }
             }
             //get form id
             if (intval($intEntryId) != 0) {
                 //get entry data
                 $objEntry = new MediaDirectoryEntry($this->moduleName);
                 $objEntry->getEntries($intEntryId, null, null, null, null, false, false);
                 if (empty($objEntry->arrEntries)) {
                     $objEntry->getEntries($intEntryId, null, null, null, null, true, false);
                 }
                 $intFormId = $objEntry->arrEntries[$intEntryId]['entryFormId'];
             } else {
                 //set form id
                 if ($intCountForms == 1) {
                     $intFormId = intval($arrActiveForms[0]);
                 } else {
                     $intFormId = intval($_POST['selectedFormId']);
                 }
                 if (!empty($_POST['formId'])) {
                     $intFormId = intval($_POST['formId']);
                 }
             }
             //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) {
                 $ownerRowClass = "row1";
                 foreach ($this->arrFrontendLanguages as $key => $arrLang) {
                     $strLangStatus = '';
                     if ($intEntryId != 0) {
                         if (in_array($arrLang['id'], $objEntry->arrEntries[$intEntryId]['entryTranslationStatus'])) {
                             $strLangStatus = 'checked="checked"';
                         }
                     }
                     $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');
                 }
                 $this->_objTpl->parse($this->moduleNameLC . 'TranslationStatus');
             } else {
                 $ownerRowClass = "row2";
                 $this->_objTpl->hideBlock($this->moduleNameLC . 'TranslationStatus');
             }
             //get user data
             $objFWUser = \FWUser::getFWUserObject();
             $addedBy = isset($objEntry) ? $objEntry->arrEntries[$intEntryId]['entryAddedBy'] : '';
             if (!empty($addedBy) && ($objUser = $objFWUser->objUser->getUser($addedBy))) {
                 $userId = $objUser->getId();
             } else {
                 $userId = $objFWUser->objUser->getId();
             }
             $this->_objTpl->setVariable(array('TXT_' . $this->moduleLangVar . '_OWNER' => $_ARRAYLANG['TXT_MEDIADIR_OWNER'], $this->moduleLangVar . '_OWNER_ROW' => $ownerRowClass, $this->moduleLangVar . '_OWNER_ID' => $userId));
             \FWUser::getUserLiveSearch();
             if ($intEntryId != 0) {
                 $intEntryDourationStart = 1;
                 $intEntryDourationEnd = 2;
                 //parse contact data
                 $objUser = $objFWUser->objUser;
                 $intUserId = intval($objUser->getId());
                 $strUserMail = '<a href="mailto:' . contrexx_raw2xhtml($objUser->getEmail()) . '">' . contrexx_raw2xhtml($objUser->getEmail()) . '</a>';
                 $intUserLang = intval($objUser->getFrontendLanguage());
                 if ($objUser = $objUser->getUser($id = $intUserId)) {
                     //get lang
                     foreach ($this->arrFrontendLanguages as $intKey => $arrLang) {
                         if ($arrLang['id'] == $intUserLang) {
                             $strUserLang = $arrLang['name'];
                         }
                     }
                     //get country
                     $arrCountry = \Cx\Core\Country\Controller\Country::getById(intval($objUser->getProfileAttribute('country')));
                     $strCountry = $arrCountry['name'];
                     //get title
                     $objTitle = $objDatabase->Execute("SELECT `title` FROM " . DBPREFIX . "access_user_title WHERE id = '" . intval($objUser->getProfileAttribute('title')) . "' LIMIT 1");
                     $strTitle = $objTitle->fields['title'];
                     $this->_objTpl->setVariable(array('TXT_' . $this->moduleLangVar . '_CONTACT_DATA' => "Kontaktangaben", $this->moduleLangVar . '_CONTACT_ATTRIBUT_TITLE' => contrexx_raw2xhtml($strTitle), $this->moduleLangVar . '_CONTACT_ATTRIBUT_FIRSTNAME' => contrexx_raw2xhtml($objUser->getProfileAttribute('firstname')), $this->moduleLangVar . '_CONTACT_ATTRIBUT_LASTNAME' => contrexx_raw2xhtml($objUser->getProfileAttribute('lastname')), $this->moduleLangVar . '_CONTACT_ATTRIBUT_COMPANY' => contrexx_raw2xhtml($objUser->getProfileAttribute('company')), $this->moduleLangVar . '_CONTACT_ATTRIBUT_ADRESS' => contrexx_raw2xhtml($objUser->getProfileAttribute('address')), $this->moduleLangVar . '_CONTACT_ATTRIBUT_CITY' => contrexx_raw2xhtml($objUser->getProfileAttribute('city')), $this->moduleLangVar . '_CONTACT_ATTRIBUT_ZIP' => contrexx_raw2xhtml($objUser->getProfileAttribute('zip')), $this->moduleLangVar . '_CONTACT_ATTRIBUT_COUNTRY' => contrexx_raw2xhtml($strCountry), $this->moduleLangVar . '_CONTACT_ATTRIBUT_PHONE' => contrexx_raw2xhtml($objUser->getProfileAttribute('phone_office')), $this->moduleLangVar . '_CONTACT_ATTRIBUT_FAX' => contrexx_raw2xhtml($objUser->getProfileAttribute('phone_fax')), $this->moduleLangVar . '_CONTACT_ATTRIBUT_WEBSITE' => '<a href="' . contrexx_raw2xhtml($objUser->getProfileAttribute('website')) . '" target="_blank">' . contrexx_raw2xhtml($objUser->getProfileAttribute('website')) . '</a>', $this->moduleLangVar . '_CONTACT_ATTRIBUT_MAIL' => $strUserMail, $this->moduleLangVar . '_CONTACT_ATTRIBUT_LANG' => $strUserLang));
                 }
                 $this->_objTpl->parse($this->moduleNameLC . 'ContactData');
             } else {
                 $intEntryDourationStart = 1;
                 $intEntryDourationEnd = 2;
                 $this->_objTpl->hideBlock($this->moduleNameLC . 'ContactData');
             }
             //get display duration  data
             switch ($this->arrSettings['settingsEntryDisplaydurationValueType']) {
                 case 1:
                     $intDiffDay = $this->arrSettings['settingsEntryDisplaydurationValue'];
                     $intDiffMonth = 0;
                     $intDiffYear = 0;
                     break;
                 case 2:
                     $intDiffDay = 0;
                     $intDiffMonth = $this->arrSettings['settingsEntryDisplaydurationValue'];
                     $intDiffYear = 0;
                     break;
                 case 3:
                     $intDiffDay = 0;
                     $intDiffMonth = 0;
                     $intDiffYear = $this->arrSettings['settingsEntryDisplaydurationValue'];
                     break;
             }
             if ($intEntryId != 0) {
                 if (intval($objEntry->arrEntries[$intEntryId]['entryDurationType']) == 1) {
                     $intEntryDourationAlways = 'selected="selected"';
                     $intEntryDourationStart = date("d.m.Y", mktime());
                     $intEntryDourationEnd = date("d.m.Y", mktime(0, 0, 0, date("m") + $intDiffMonth, date("d") + $intDiffDay, date("Y") + $intDiffYear));
                 } else {
                     $intEntryDourationPeriod = 'selected="selected"';
                     $intEntryDourationShowPeriod = 'inline';
                     $intEntryDourationStart = date("d.m.Y", $objEntry->arrEntries[$intEntryId]['entryDurationStart']);
                     $intEntryDourationEnd = date("d.m.Y", $objEntry->arrEntries[$intEntryId]['entryDurationEnd']);
                 }
                 if (intval($objEntry->arrEntries[$intEntryId]['entryDurationNotification']) == 1) {
                     $this->_objTpl->setVariable(array($this->moduleLangVar . '_DISPLAYDURATION_RESET_NOTIFICATION_STATUS' => '<br /><input type="checkbox" name="durationResetNotification" value="1" />&nbsp;' . $_ARRAYLANG['TXT_MEDIADIR_DISPLAYDURATION_RESET_NOTIFICATION_STATUS']));
                 }
             } else {
                 if (intval($this->arrSettings['settingsEntryDisplaydurationType']) == 1) {
                     $intEntryDourationAlways = 'selected="selected"';
                 } else {
                     $intEntryDourationPeriod = 'selected="selected"';
                     $intEntryDourationShowPeriod = 'inline';
                 }
                 $intEntryDourationStart = date("d.m.Y", mktime());
                 $intEntryDourationEnd = date("d.m.Y", mktime(0, 0, 0, date("m") + $intDiffMonth, date("d") + $intDiffDay, date("Y") + $intDiffYear));
             }
             //parse spez fields
             $this->_objTpl->touchBlock($this->moduleNameLC . 'SpezfieldList');
             //generate javascript
             parent::setJavascript($this->getSelectorJavascript());
             parent::setJavascript($objInputfields->getInputfieldJavascript());
             //get form onsubmit
             $strOnSubmit = parent::getFormOnSubmit($objInputfields->arrJavascriptFormOnSubmit);
             $this->_objTpl->setVariable(array($this->moduleLangVar . '_ENTRY_STATUS' => $intEntryId && intval($objEntry->arrEntries[$intEntryId]['entryActive']) ? 'checked="checked"' : '', $this->moduleLangVar . '_MEDIABROWSER_BUTTON' => $this->getMediaBrowserButton($_ARRAYLANG['TXT_BROWSE'], array('type' => 'button', 'id' => 'mediabrowser_button', 'style' => 'display:none;'))));
             //parse blocks
             $this->_objTpl->hideBlock($this->moduleNameLC . 'FormList');
         }
         //parse global variables
         $this->_objTpl->setGlobalVariable(array('TXT_' . $this->moduleLangVar . '_PAGE_TITLE' => $pageTitle, $this->moduleLangVar . '_ENTRY_ID' => $intEntryId, $this->moduleLangVar . '_FORM_ID' => $intFormId, 'TXT_' . $this->moduleLangVar . '_SUBMIT' => $_ARRAYLANG['TXT_' . $this->moduleLangVar . '_SUBMIT'], $this->moduleLangVar . '_JAVASCRIPT' => $this->getJavascript(), $this->moduleLangVar . '_FORM_ONSUBMIT' => $strOnSubmit, 'TXT_' . $this->moduleLangVar . '_PLEASE_CHECK_INPUT' => $_ARRAYLANG['TXT_MEDIADIR_PLEASE_CHECK_INPUT'], $this->moduleLangVar . '_DEFAULT_LANG_ID' => $_LANGID, 'TXT_' . $this->moduleLangVar . '_SPEZ_FIELDS' => $_ARRAYLANG['TXT_MEDIADIR_SPEZ_FIELDS'], 'TXT_' . $this->moduleLangVar . '_DISPLAYDURATION' => $_ARRAYLANG['TXT_MEDIADIR_DISPLAYDURATION'], 'TXT_' . $this->moduleLangVar . '_DISPLAYDURATION_ALWAYS' => $_ARRAYLANG['TXT_MEDIADIR_DISPLAYDURATION_ALWAYS'], 'TXT_' . $this->moduleLangVar . '_DISPLAYDURATION_PERIOD' => $_ARRAYLANG['TXT_MEDIADIR_DISPLAYDURATION_PERIOD'], 'TXT_' . $this->moduleLangVar . '_DISPLAYDURATION_FROM' => $_CORELANG['TXT_FROM'], 'TXT_' . $this->moduleLangVar . '_DISPLAYDURATION_TO' => $_CORELANG['TXT_TO'], $this->moduleLangVar . '_DISPLAYDURATION_START' => $intEntryDourationStart, $this->moduleLangVar . '_DISPLAYDURATION_END' => $intEntryDourationEnd, $this->moduleLangVar . '_DISPLAYDURATION_SELECT_ALWAYS' => $intEntryDourationAlways, $this->moduleLangVar . '_DISPLAYDURATION_SELECT_PERIOD' => $intEntryDourationPeriod, $this->moduleLangVar . '_DISPLAYDURATION_SHOW_PERIOD' => $intEntryDourationShowPeriod, 'TXT_' . $this->moduleLangVar . '_TRANSLATION_STATUS' => $_ARRAYLANG['TXT_MEDIADIR_TRANSLATION_STATUS'], 'TXT_' . $this->moduleLangVar . '_ENTRY_STATUS' => $_ARRAYLANG['TXT_MEDIADIR_ACTIVE']));
     } else {
         \Cx\Core\Csrf\Controller\Csrf::header("Location: index.php?cmd=" . $this->moduleName . "&act=settings&tpl=forms");
         exit;
     }
 }
    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 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');
 }
    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;
    }