示例#1
0
 /**
  * Performs the box view
  * 
  * @return null
  */
 function showThreeBoxes()
 {
     global $_ARRAYLANG;
     $objEventManager = new \Cx\Modules\Calendar\Controller\CalendarEventManager($this->startDate, $this->endDate, $this->categoryId, $this->searchTerm, true, $this->needAuth, true, 0, 'n', $this->sortDirection, true, $this->author);
     $objEventManager->getEventList();
     $this->_objTpl->setTemplate($this->pageContent);
     if ($_REQUEST['cmd'] == 'boxes') {
         $objEventManager->calendarBoxUrl = \Cx\Core\Routing\Url::fromModuleAndCmd('Calendar', 'boxes')->toString() . "?act=list";
         $objEventManager->calendarBoxMonthNavUrl = \Cx\Core\Routing\Url::fromModuleAndCmd('Calendar', 'boxes')->toString();
     } else {
         $objEventManager->calendarBoxUrl = \Cx\Core\Routing\Url::fromModuleAndCmd('Calendar', '')->toString() . "?act=list";
         $objEventManager->calendarBoxMonthNavUrl = \Cx\Core\Routing\Url::fromModuleAndCmd('Calendar', '')->toString();
     }
     if (empty($_GET['catid'])) {
         $catid = 0;
     } else {
         $catid = $_GET['catid'];
     }
     if (isset($_GET['yearID']) && isset($_GET['monthID']) && isset($_GET['dayID'])) {
         $day = $_GET['dayID'];
         $month = $_GET['monthID'];
         $year = $_GET['yearID'];
     } elseif (isset($_GET['yearID']) && isset($_GET['monthID']) && !isset($_GET['dayID'])) {
         $day = 0;
         $month = $_GET['monthID'];
         $year = $_GET['yearID'];
     } elseif (isset($_GET['yearID']) && !isset($_GET['monthID']) && !isset($_GET['dayID'])) {
         $day = 0;
         $month = 0;
         $year = $_GET['yearID'];
     } else {
         $day = date("d");
         $month = date("m");
         $year = date("Y");
     }
     $calendarbox = $objEventManager->getBoxes($this->boxCount, $year, $month, $day, $catid);
     $objCategoryManager = new \Cx\Modules\Calendar\Controller\CalendarCategoryManager(true);
     $objCategoryManager->getCategoryList();
     $this->_objTpl->setVariable(array("TXT_{$this->moduleLangVar}_ALL_CAT" => $_ARRAYLANG['TXT_CALENDAR_ALL_CAT'], "{$this->moduleLangVar}_BOX" => $calendarbox, "{$this->moduleLangVar}_JAVA_SCRIPT" => $objEventManager->getCalendarBoxJS(), "{$this->moduleLangVar}_CATEGORIES" => $objCategoryManager->getCategoryDropdown($catid, 1)));
 }
 /**
  * Return's settings element html by given properties
  *
  * @param integer $id      Field id
  * @param string  $name    Html input name of the field
  * @param string  $title   Name/Title of the field
  * @param string  $value   Value of the field
  * @param string  $info    Info about the field
  * @param integer $type    Type of the settings field
  * @param string  $options options array
  * @param string  $special integer value of special field
  *
  * @return string Html of the setting field
  */
 function _getSettingProperties($id, $name, $title, $value, $info, $type, $options, $special)
 {
     global $_ARRAYLANG, $_CORELANG;
     $arrSetting = array();
     switch (intval($type)) {
         case 1:
             //input text
             $output = '<input type="text" style="width: 250px;" name="settings[' . $name . ']" value="' . $value . '" />';
             break;
         case 2:
             //textarea
             $output = '<textarea style="width: 250px; height: 60px;" name="settings[' . $name . ']">' . $value . '"</textarea>';
             break;
         case 3:
             //radio
             switch ($name) {
                 case 'placeData':
                 case 'placeDataHost':
                     $addBreak = true;
                     break;
                 default:
                     $addBreak = false;
                     break;
             }
             $arrOptions = array();
             if (!empty($options)) {
                 $arrOptions = explode(",", $options);
                 $first = true;
                 foreach ($arrOptions as $key => $label) {
                     $checked = $key + 1 == $value ? 'checked="checked"' : '';
                     $output .= !$first && $addBreak ? "<br />" : '';
                     $output .= '<label><input type="radio" ' . $checked . ' value="' . ($key + 1) . '" name="settings[' . $name . ']" />&nbsp;' . $_ARRAYLANG[$label] . '</label>';
                     $first = false;
                 }
             }
             break;
         case 4:
             //checkbox
             $arrOptions = array();
             if (!empty($options)) {
                 $arrOptions = explode(",", $options);
                 foreach ($arrOptions as $key => $label) {
                     $checked = $key == $value ? 'checked="checked"' : '';
                     $output .= '<label><input type="checkbox" ' . $checked . ' value="' . $key . '" name="settings[' . $name . ']" />&nbsp;' . $_ARRAYLANG[$label] . '</label>';
                 }
             } else {
                 $checked = $value == '1' ? 'checked="checked"' : '';
                 $value = '<input type="checkbox" ' . $checked . ' value="1" name="settings[' . $name . ']" />';
             }
             break;
         case 5:
             //dropdown
             if (!empty($options)) {
                 $options = explode(",", $options);
                 $output = '<select style="width: 252px;" name="settings[' . $name . ']" >';
                 foreach ($options as $key => $title) {
                     $checked = $key == $value ? 'selected="selected"' : '';
                     $output .= '<option ' . $checked . ' value="' . $key . '" />' . $_ARRAYLANG[$title] . '</option>';
                 }
                 $output .= '</select>';
             }
             if (!empty($special)) {
                 switch ($special) {
                     case 'getCategoryDorpdown':
                         $objCategoryManager = new \Cx\Modules\Calendar\Controller\CalendarCategoryManager(true);
                         $objCategoryManager->getCategoryList();
                         $output = '<select style="width: 252px;" name="settings[' . $name . ']" >';
                         $output .= $objCategoryManager->getCategoryDropdown(intval($value), 1);
                         $output .= '</select>';
                         break;
                     case 'getPlaceDataDorpdown':
                         $objMediadirForms = new \Cx\Modules\MediaDir\Controller\MediaDirectoryForm(null, 'MediaDir');
                         $objMediadirForms->getForms();
                         $objMediadirForms->listForms($objTpl, 4);
                         $output = $_ARRAYLANG['TXT_CALENDAR_SELECT_FORM_MEDIADIR'] . ": <br />";
                         $output .= '<select style="width: 252px;" name="settings[' . $name . ']" >';
                         $output .= $objMediadirForms->listForms($objTpl, 4, intval($value));
                         $output .= '</select>';
                         break;
                 }
             }
             break;
         case 6:
             //checkbox multi-select
             $arrOptions = array();
             if (!empty($options)) {
                 $arrOptions = explode(",", $options);
                 $arrValue = explode(',', $value);
                 foreach ($arrOptions as $key => $label) {
                     $checked = in_array($key, $arrValue) ? 'checked="checked"' : '';
                     $output .= '<label><input type="checkbox" ' . $checked . ' value="' . $key . '" name="settings[' . $name . '][]" />&nbsp;' . $_ARRAYLANG[$label] . '</label>';
                 }
             } else {
                 $checked = $value == '1' ? 'checked="checked"' : '';
                 $value = '<input type="checkbox" ' . $checked . ' value="1" name="settings[' . $name . '][]" />';
             }
             break;
         case 7:
             if ($special == 'listPreview') {
                 $output = "<div id='listPreview'></div>";
             } elseif ($special == 'detailPreview') {
                 $output = "<div id='detailPreview'></div>";
             }
             break;
     }
     if (!empty($info)) {
         $infobox = '&nbsp;<span class="icon-info tooltip-trigger"></span><span class="tooltip-message">' . $_ARRAYLANG[$info] . '</span>';
     } else {
         $infobox = '';
     }
     $arrSetting['output'] = $output;
     $arrSetting['infobox'] = $infobox;
     return $arrSetting;
 }
 /**
  * Add / Edit  of the category
  *
  * @param type $categoryId
  *
  * @return null
  */
 function modifyCategory($categoryId)
 {
     global $objDatabase, $_ARRAYLANG, $_CORELANG, $_LANGID;
     $this->_objTpl->loadTemplateFile('module_calendar_modify_category.html');
     if ($categoryId != 0) {
         $this->_pageTitle = $_ARRAYLANG['TXT_CALENDAR_CATEGORY'] . " " . $_ARRAYLANG['TXT_CALENDAR_EDIT'];
     } else {
         $this->_pageTitle = $_ARRAYLANG['TXT_CALENDAR_INSERT_CATEGORY'];
     }
     $this->_objTpl->setGlobalVariable(array('TXT_' . $this->moduleLangVar . '_CATEGORY' => $this->_pageTitle, 'TXT_' . $this->moduleLangVar . '_FORMCHECK_NAME' => $_ARRAYLANG['TXT_CALENDAR_FORMCHECK_NAME'], 'TXT_' . $this->moduleLangVar . '_SAVE' => $_ARRAYLANG['TXT_CALENDAR_SAVE'], 'TXT_' . $this->moduleLangVar . '_CATEGORY_NAME' => $_ARRAYLANG['TXT_CALENDAR_CATEGORY_NAME'], 'TXT_' . $this->moduleLangVar . '_CATEGORY_HOSTS' => $_ARRAYLANG['TXT_CALENDAR_HOSTS'], 'TXT_' . $this->moduleLangVar . '_CATEGORY_HOSTS_INFO' => $_ARRAYLANG['TXT_CALENDAR_HOSTS_INFO'], 'TXT_' . $this->moduleLangVar . '_MORE' => $_ARRAYLANG['TXT_CALENDAR_MORE'], $this->moduleLangVar . '_CATEGORY_DEFAULT_LANG_ID' => $_LANGID));
     if ($categoryId != 0) {
         $objCategoryManager = new \Cx\Modules\Calendar\Controller\CalendarCategoryManager();
         $objCategoryManager->showCategory($this->_objTpl, $categoryId);
         $objCategory = $objCategoryManager->categoryList[$categoryId];
     }
     $this->getFrontendLanguages();
     $this->getSettings();
     foreach ($this->arrFrontendLanguages as $key => $arrLang) {
         if ($categoryId != 0) {
             $categoryName = empty($objCategory->arrData['name'][$arrLang['id']]) ? $objCategory->arrData['name'][0] : $objCategory->arrData['name'][$arrLang['id']];
         } else {
             $categoryName = '';
         }
         $this->_objTpl->setVariable(array($this->moduleLangVar . '_CATEGORY_NAME_LANG_ID' => $arrLang['id'], 'TXT_' . $this->moduleLangVar . '_CATEGORY_NAME_LANG_NAME' => $arrLang['name'], $this->moduleLangVar . '_CATEGORY_NAME_LANG_SHORTCUT' => $arrLang['lang'], $this->moduleLangVar . '_CATEGORY_NAME' => $categoryName));
         if ($key + 1 == count($this->arrFrontendLanguages)) {
             $this->_objTpl->setVariable(array($this->moduleLangVar . '_MINIMIZE' => '<a href="javascript:ExpandMinimize(\'name\');">&laquo;&nbsp;' . $_ARRAYLANG['TXT_MEDIADIR_MINIMIZE'] . '</a>'));
         }
         $this->_objTpl->parse('categoryNameList');
     }
     if (count($this->arrFrontendLanguages) > 1) {
         $this->_objTpl->touchBlock('categoryNameExpand');
     } else {
         $this->_objTpl->hideBlock('categoryNameExpand');
     }
     /* if($this->arrSettings['publicationStatus'] == 1) {
                 $objHostManager = new \Cx\Modules\Calendar\Controller\CalendarHostManager(null,true);
                 $objHostManager->getHostList();
     
                 foreach ($objHostManager->hostList as $key => $objHost) {
                     if($objHost->catId == $categoryId || $objHost->catId == 0) {
                         if($objHost->catId == $categoryId && $objHost->catId != 0) {
                             $selectetHosts .= '<option value="'.$objHost->id.'">'.$objHost->title.'</option>';
                         } else {
                             $deselectetHosts .= '<option value="'.$objHost->id.'">'.$objHost->title.'</option>';
                         }
                     }
                 }
     
                 $this->_objTpl->setVariable(array(
                     $this->moduleLangVar.'_CATEGORY_DESELECTED_HOSTS'    => $deselectetHosts,
                     $this->moduleLangVar.'_CATEGORY_SELECTED_HOSTS'      => $selectetHosts,
                 ));
     
                 $this->_objTpl->parse('hostSelector');
             } else { */
     $this->_objTpl->hideBlock('hostSelector');
     /* } */
     \Cx\Core\Core\Controller\Cx::instanciate()->getComponent('Cache')->deleteComponentFiles('Calendar');
 }