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');
     }
 }
예제 #2
0
 function deleteEntry()
 {
     global $_ARRAYLANG, $_CORELANG;
     $this->_objTpl->setTemplate($this->pageContent, true, true);
     //save entry data
     if (isset($_POST['submitEntryModfyForm']) && intval($_POST['entryId'])) {
         $objEntry = new MediaDirectoryEntry($this->moduleName);
         $strStatus = $objEntry->deleteEntry(intval($_POST['entryId']));
         if ($strStatus == true) {
             $strOkMessage = $_ARRAYLANG['TXT_MEDIADIR_ENTRY'] . " " . $_ARRAYLANG['TXT_MEDIADIR_SUCCESSFULLY_DELETED'];
         } else {
             $strErrMessage = $_ARRAYLANG['TXT_MEDIADIR_ENTRY'] . " " . $_ARRAYLANG['TXT_MEDIADIR_CORRUPT_DELETED'];
         }
     }
     //check id
     if (intval($_GET['eid']) != 0) {
         $intEntryId = intval($_GET['eid']);
     } else {
         $intEntryId = null;
     }
     $objEntry = new MediaDirectoryEntry($this->moduleName);
     if ($this->arrSettings['settingsReadyToConfirm'] == 1) {
         $objEntry->getEntries($intEntryId, null, null, null, null, null, true, null, 1, null, null, null, true);
     } else {
         $objEntry->getEntries($intEntryId, null, null, null, null, null, 1, null, 1);
     }
     $objEntry->listEntries($this->_objTpl, 2);
     //parse global variables
     $this->_objTpl->setVariable(array($this->moduleLangVar . '_ENTRY_ID' => $intEntryId, 'TXT_' . $this->moduleLangVar . '_DELETE' => $_CORELANG['TXT_ACCESS_DELETE_ENTRY'], 'TXT_' . $this->moduleLangVar . '_ABORT' => $_CORELANG['TXT_CANCEL'], 'TXT_' . $this->moduleLangVar . '_OK_MESSAGE' => $strOkMessage, 'TXT_' . $this->moduleLangVar . '_ERROR_MESSAGE' => $strErrMessage));
     if (!empty($strOkMessage)) {
         $this->_objTpl->parse($this->moduleNameLC . 'EntryOkMessage');
         $this->_objTpl->hideBlock($this->moduleNameLC . 'EntryErrMessage');
         $this->_objTpl->hideBlock($this->moduleNameLC . 'EntryModifyForm');
     } else {
         if (!empty($strErrMessage)) {
             $this->_objTpl->hideBlock($this->moduleNameLC . 'EntryOkMessage');
             $this->_objTpl->parse($this->moduleNameLC . 'EntryErrMessage');
             $this->_objTpl->parse($this->moduleNameLC . 'EntryModifyForm');
         } else {
             $this->_objTpl->hideBlock($this->moduleNameLC . 'EntryOkMessage');
             $this->_objTpl->hideBlock($this->moduleNameLC . 'EntryErrMessage');
             $this->_objTpl->parse($this->moduleNameLC . 'EntryModifyForm');
         }
     }
 }
 protected function parseGoogleMapPlaceholder($template, $placeholder)
 {
     if (!$template->placeholderExists($placeholder)) {
         return false;
     }
     if (!isset(self::$currentFetchedEntryDataObject)) {
         return false;
     }
     self::$currentFetchedEntryDataObject->listEntries($template, 4, $placeholder);
 }