Example #1
0
 /**
  * get oage
  *
  * Reads the act and selects the right action
  *
  * @access   public
  * @return   string  parsed content
  */
 function getPage()
 {
     global $_CONFIG;
     \JS::activate('shadowbox');
     \JS::activate('jquery');
     if ($this->arrSettings['settingsAllowVotes']) {
         $objVoting = new MediaDirectoryVoting($this->moduleName);
         $this->setJavascript($objVoting->getVoteJavascript());
         if (isset($_GET['vote']) && intval($_GET['eid']) != 0) {
             $objVoting->saveVote(intval($_GET['eid']), intval($_GET['vote']));
         }
     }
     if ($this->arrSettings['settingsAllowComments'] == 1) {
         $objComment = new MediaDirectoryComment($this->moduleName);
         $this->setJavascript($objComment->getCommentJavascript());
         $comment = isset($_GET['comment']) ? $_GET['comment'] : '';
         if ($comment == 'add' && intval($_GET['eid']) != 0) {
             $objComment->saveComment(intval($_GET['eid']), $_POST);
         }
         if ($comment == 'refresh' && intval($_GET['eid']) != 0) {
             $objComment->refreshComments(intval($_GET['eid']), $_GET['pageSection'], $_GET['pageCmd']);
         }
     }
     switch ($_REQUEST['cmd']) {
         case 'delete':
             if (!empty($_REQUEST['eid']) || !empty($_REQUEST['entryId'])) {
                 parent::checkAccess('delete_entry');
                 $this->deleteEntry();
             } else {
                 header("Location: index.php?section=" . $this->moduleName);
                 exit;
             }
             break;
         case 'latest':
             $this->showLatest();
             break;
         case 'popular':
             $this->showPopular();
             break;
         case 'map':
             $this->showMap();
             break;
         case 'myentries':
             parent::checkAccess('my_entries');
             $this->showMyEntries();
             break;
         case 'detail':
             parent::checkAccess('show_entry');
             $this->showEntry();
             break;
         case 'adduser':
             $this->showAddUser();
             break;
         case 'confirm_in_progress':
             $this->_objTpl->setTemplate($this->pageContent);
             break;
         case 'alphabetical':
             $this->showAlphabetical();
             break;
         default:
             if (isset($_REQUEST['check'])) {
                 parent::checkDisplayduration();
             }
             if (substr($_REQUEST['cmd'], 0, 6) == 'detail') {
                 parent::checkAccess('show_entry');
                 $this->showEntry();
             } else {
                 if (substr($_REQUEST['cmd'], 0, 3) == 'add') {
                     parent::checkAccess('add_entry');
                     $this->modifyEntry();
                 } else {
                     if (substr($_REQUEST['cmd'], 0, 4) == 'edit') {
                         if (intval($_REQUEST['eid']) != 0 || intval($_REQUEST['entryId']) != 0) {
                             parent::checkAccess('edit_entry');
                             $this->modifyEntry();
                         } else {
                             header("Location: index.php?section=" . $this->moduleName);
                             exit;
                         }
                     } else {
                         if (isset($_REQUEST['search'])) {
                             $this->showSearch();
                         } else {
                             $this->showOverview();
                         }
                     }
                 }
             }
     }
     $this->_objTpl->setVariable(array($this->moduleLangVar . '_JAVASCRIPT' => $this->getJavascript()));
     return $this->_objTpl->get();
 }
    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;
        }
    }
 function manageComments()
 {
     global $_ARRAYLANG, $_CORELANG, $objDatabase, $_LANGID;
     \Permission::checkAccess(MediaDirectoryAccessIDs::ModifyEntry, 'static');
     $this->_objTpl->loadTemplateFile('module_' . $this->moduleNameLC . '_manage_comments.html', true, true);
     $this->pageTitle = $_ARRAYLANG['TXT_MEDIADIR_MANAGE_COMMENTS'];
     //parse global variables
     $this->_objTpl->setGlobalVariable(array('TXT_DELETE' => $_ARRAYLANG['TXT_MEDIADIR_DELETE'], 'TXT_SELECT_ALL' => $_CORELANG['TXT_SELECT_ALL'], 'TXT_DESELECT_ALL' => $_CORELANG['TXT_DESELECT_ALL'], 'TXT_SELECT_ACTION' => $_CORELANG['TXT_MULTISELECT_SELECT'], 'TXT_CONFIRM_ALL' => $_ARRAYLANG['TXT_MEDIADIR_CONFIRM_ALL'], 'TXT_DELETE_ALL' => $_CORELANG['TXT_MULTISELECT_DELETE'], 'TXT_' . $this->moduleLangVar . '_NAME' => $_CORELANG['TXT_NAME'], 'TXT_' . $this->moduleLangVar . '_DATE' => $_CORELANG['TXT_DATE'], 'TXT_' . $this->moduleLangVar . '_ADDED_BY' => $_ARRAYLANG['TXT_MEDIADIR_ADDED_BY'], 'TXT_' . $this->moduleLangVar . '_ACTION' => $_CORELANG['TXT_HISTORY_ACTION'], '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_' . $this->moduleLangVar . '_SUBMIT' => $_ARRAYLANG['TXT_' . $this->moduleLangVar . '_SUBMIT'], 'TXT_' . $this->moduleLangVar . '_IP' => $_ARRAYLANG['TXT_MEDIADIR_IP'], 'TXT_' . $this->moduleLangVar . '_COMMENT' => $_ARRAYLANG['TXT_MEDIADIR_COMMENT'], 'TXT_' . $this->moduleLangVar . '_PAGE_TITLE' => $_ARRAYLANG['TXT_MEDIADIR_MANAGE_COMMENTS'], $this->moduleLangVar . '_ENTRY_ID' => intval($_GET['id'])));
     $objComment = new MediaDirectoryComment($this->moduleName);
     switch ($_GET['act']) {
         case 'delete_comment':
             if (!isset($_GET['cid'])) {
                 foreach ($_POST["commentsFormSelected"] as $intCommentId) {
                     $strStatus = $objComment->deleteComment(intval($intCommentId));
                 }
             } else {
                 $strStatus = $objComment->deleteComment(intval($_GET['cid']));
             }
             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;
     }
     //get comments
     $objComment->getComments($this->_objTpl, $_GET['id']);
 }