示例#1
0
 function onAfterRender()
 {
     global $mainframe;
     if (!isset($this->_plugin)) {
         return;
     }
     if (JRequest::getVar("option") == "com_menus" && JRequest::getVar("task") == "edit") {
         $path = JPATH_PLUGINS . DS . 'system' . DS . 'S5FlexMenu' . DS . 'element' . DS . 'S5FlexMenu.xml';
         $params = $this->getSystemParams($path);
         JView::assignRef('params', $params);
         $item = $this->getModulesData();
         ob_start();
         $pane =& JPane::getInstance('sliders', array('allowAllClose' => true));
         JView::assignRef('pane', $pane);
         echo $this->pane->startPanel(JText::_('Parameters - S5 Flex Menu'), "S5SM-page");
         echo $params;
         echo $this->pane->endPanel();
         $thexml = ob_get_clean();
         $body = JResponse::getBody();
         $start_string = '<div id="menu-pane" class="pane-sliders">';
         $body = str_replace($start_string, $start_string . $thexml, $body);
         JResponse::setBody($body);
     }
     if (JRequest::getVar("option") == "com_templates" && JRequest::getVar("task") == "edit") {
         $path = JPATH_PLUGINS . DS . 'system' . DS . 'S5FlexMenu' . DS . 'element' . DS . 'S5FlexTemplate.xml';
         $params = $this->getSystemParams($path);
         $template_params = $this->getTemplateParams();
         JView::assignRef('params', $params);
         $item = $this->getModulesData();
         $body = JResponse::getBody();
         $start_string = '<legend>Parameters</legend>';
         $body = str_replace($start_string, $start_string . $params, $body);
         JResponse::setBody($body);
     }
     return true;
 }
 function fetchTemplateChiaSe($templatePath, $templateName, $data = null)
 {
     $template = new JView();
     $template->addTemplatePath($templatePath);
     if (!empty($data)) {
         $template->assignRef('data', $data);
     }
     $template->setLayout($templateName);
     return $template->loadTemplate();
 }
示例#3
0
 function fetchTienIchTemplate($tienIchIds, $templatePath, $templateName, $listAllFlag = true, $lang)
 {
     // TODO: remove hard code
     //    	$tienIchIds = '1-1,1-2,2-6';
     $data = null;
     // $lang = ilandCommonUtils::getLanguage();
     // lay tat ca du lieu tien ich
     $allList = U_ReModelProperties::layDanhSachTienIch($lang);
     $data = U_ReModelProperties::parseTienIch($tienIchIds, $allList, $listAllFlag);
     // fetch template tien ich
     $template = new JView();
     $template->addTemplatePath($templatePath);
     $template->assignRef('allFlag', $listAllFlag);
     $template->assignRef('tienIchAllList', $data);
     $template->setLayout($templateName);
     return $template->loadTemplate();
     return $data;
 }
示例#4
0
 /**
  * Method to get the events
  *
  * @access public
  * @return array
  */
 function getList(&$params)
 {
     global $mainframe;
     $db =& JFactory::getDBO();
     $user =& JFactory::getUser();
     $user_gid = (int) $user->get('aid');
     //all upcoming events
     if ($params->get('type') == 1) {
         $where = ' WHERE a.dates > CURDATE()';
         //	$where = ' WHERE a.published = 1';
         $order = ' ORDER BY a.dates, a.times';
     }
     //archived events only
     if ($params->get('type') == 2) {
         $where = ' WHERE a.published = -1';
         $order = ' ORDER BY a.dates DESC, a.times DESC';
     }
     //currently running events only
     if ($params->get('type') == 3) {
         $where = ' WHERE a.published = 1';
         $where .= ' AND ( a.dates = CURDATE()';
         $where .= ' OR ( a.enddates >= CURDATE() AND a.dates <= CURDATE() ))';
         $order = ' ORDER BY a.dates, a.times';
     }
     //clean parameter data
     $catid = trim($params->get('catid'));
     $venid = trim($params->get('venid'));
     $state = JString::strtolower(trim($params->get('stateloc')));
     //Build category selection query statement
     if ($catid) {
         $ids = explode(',', $catid);
         JArrayHelper::toInteger($ids);
         $categories = ' AND (c.id=' . implode(' OR c.id=', $ids) . ')';
     }
     //Build venue selection query statement
     if ($venid) {
         $ids = explode(',', $venid);
         JArrayHelper::toInteger($ids);
         $venues = ' AND (l.id=' . implode(' OR l.id=', $ids) . ')';
     }
     //Build state selection query statement
     if ($state) {
         $rawstate = explode(',', $state);
         foreach ($rawstate as $val) {
             if ($val) {
                 $states[] = '"' . trim($db->getEscaped($val)) . '"';
             }
         }
         JArrayHelper::toString($states);
         $stat = ' AND (LOWER(l.state)=' . implode(' OR LOWER(l.state)=', $states) . ')';
     }
     //perform select query
     $query = 'SELECT a.title, a.dates, a.enddates, a.times, a.endtimes, a.datdescription, a.datimage, l.venue, l.state, l.locimage, l.city, l.locdescription, c.catname,' . ' CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(\':\', a.id, a.alias) ELSE a.id END as slug,' . ' CASE WHEN CHAR_LENGTH(l.alias) THEN CONCAT_WS(\':\', l.id, l.alias) ELSE l.id END as venueslug,' . ' CASE WHEN CHAR_LENGTH(c.alias) THEN CONCAT_WS(\':\', c.id, c.alias) ELSE c.id END as categoryslug' . ' FROM #__eventlist_events AS a' . ' LEFT JOIN #__eventlist_venues AS l ON l.id = a.locid' . ' LEFT JOIN #__eventlist_categories AS c ON c.id = a.catsid' . $where . ' AND c.access <= ' . $user_gid . ($catid ? $categories : '') . ($venid ? $venues : '') . ($state ? $stat : '') . $order . ' LIMIT ' . (int) $params->get('count', '2');
     $db->setQuery($query);
     $rows = $db->loadObjectList();
     //assign datemethod value to jview
     jimport('joomla.application.component.view');
     JView::assignRef('datemethod', $params->get('datemethod', 1));
     JView::assignRef('use_modal', $params->get('use_modal', 0));
     if ($params->get('use_modal', 0)) {
         JHTML::_('behavior.modal');
     }
     //Loop through the result rows and prepare data
     $i = 0;
     $lists = array();
     foreach ($rows as $row) {
         //create thumbnails if needed and receive imagedata
         $dimage = ELImage::flyercreator($row->datimage, 'event');
         $limage = ELImage::flyercreator($row->locimage);
         //cut titel
         $length = strlen(htmlspecialchars($row->title));
         if ($length > $params->get('cuttitle', '25')) {
             $row->title = substr($row->title, 0, $params->get('cuttitle', '18'));
             $row->title = $row->title . '...';
         }
         $lists[$i]->title = htmlspecialchars($row->title, ENT_COMPAT, 'UTF-8');
         $lists[$i]->venue = htmlspecialchars($row->venue, ENT_COMPAT, 'UTF-8');
         $lists[$i]->catname = htmlspecialchars($row->catname, ENT_COMPAT, 'UTF-8');
         $lists[$i]->state = htmlspecialchars($row->state, ENT_COMPAT, 'UTF-8');
         $lists[$i]->eventlink = $params->get('linkevent', 1) ? JRoute::_(EventListHelperRoute::getRoute($row->slug)) : '';
         $lists[$i]->venuelink = $params->get('linkvenue', 1) ? JRoute::_(EventListHelperRoute::getRoute($row->venueslug, 'venueevents')) : '';
         $lists[$i]->categorylink = $params->get('linkcategory', 1) ? JRoute::_(EventListHelperRoute::getRoute($row->categoryslug, 'categoryevents')) : '';
         $lists[$i]->date = modEventListwideHelper::_format_date($row, $params);
         $lists[$i]->time = $row->times ? modEventListwideHelper::_format_time($row->dates, $row->times, $params) : '';
         $lists[$i]->eventimage = JURI::base(true) . '/' . $dimage['thumb'];
         $lists[$i]->eventimageorig = JURI::base(true) . '/' . $dimage['original'];
         $lists[$i]->venueimage = JURI::base(true) . '/' . $limage['thumb'];
         $lists[$i]->venueimageorig = JURI::base(true) . '/' . $limage['original'];
         $lists[$i]->eventdescription = strip_tags($row->datdescription);
         $lists[$i]->venuedescription = strip_tags($row->locdescription);
         $i++;
     }
     return $lists;
 }