Exemplo n.º 1
0
 function __construct()
 {
     parent::__construct();
     $mainframe = JFactory::getApplication();
     global $option;
     // Get pagination request variables
     $aparams = FSF_Settings::GetViewSettingsObj('faqs');
     $this->_enable_pages = $aparams->get('enable_pages', 1);
     $limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', FSF_Settings::Get('faq_per_page'), 'int');
     if ($this->_enable_pages == 0) {
         $limit = 999999;
     }
     $limitstart = JRequest::getVar('limitstart', 0, '', 'int');
     // In case limit has been changed, adjust it
     $limitstart = $limit != 0 ? floor($limitstart / $limit) * $limit : 0;
     $this->setState('limit', $limit);
     $this->setState('limitstart', $limitstart);
     $this->_curcatid = JRequest::getInt('catid');
     $this->_search = JRequest::getVar('search', '', '', 'string');
     $this->_catlist = $this->_getCatList();
     if ($this->_search != "") {
         $this->_curcattitle = JText::_("SEARCH_RESULTS");
         $this->_curcatid = -1;
         $this->_curcatimage = "/components/com_fsf/assets/images/search.png";
     } else {
         if ($this->_curcatid == "0") {
             $this->_curcattitle = JText::_("ALL_FAQS");
             $this->_curcatimage = "/components/com_fsf/assets/images/allfaqs.png";
         } else {
             foreach ($this->_catlist as $cat) {
                 if ($cat['id'] == $this->_curcatid) {
                     $this->_curcattitle = $cat['title'];
                     $this->_curcatimage = $cat['image'];
                     $this->_curcatdesc = $cat['description'];
                 }
             }
         }
     }
 }
Exemplo n.º 2
0
 function display($tpl = null)
 {
     $mainframe = JFactory::getApplication();
     JHTML::_('behavior.modal', 'a.fsf_modal');
     //JHTML::_('behavior.mootools');
     $db = JFactory::getDBO();
     $aparams = FSF_Settings::GetViewSettingsObj('glossary');
     $this->use_letter_bar = $aparams->get('use_letter_bar', 0);
     if ($this->use_letter_bar) {
         $this->letters = array();
         if (FSF_Settings::get('glossary_all_letters')) {
             $letters = 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');
             foreach ($letters as $letter) {
                 $this->letters[$letter] = 0;
             }
         }
         $qry = "SELECT UPPER(SUBSTR(word,1,1)) as letter FROM #__fsf_glossary";
         $where = array();
         $where[] = "published = 1";
         if (FSF_Helper::Is16()) {
             $where[] = 'language in (' . $db->Quote(JFactory::getLanguage()->getTag()) . ',' . $db->Quote('*') . ')';
             $user = JFactory::getUser();
             $where[] = 'access IN (' . implode(',', $user->getAuthorisedViewLevels()) . ')';
         }
         if (count($where) > 0) {
             $qry .= " WHERE " . implode(" AND ", $where);
         }
         $qry .= " GROUP BY letter ORDER BY letter";
         $db->setQuery($qry);
         $letters = $db->loadObjectList();
         foreach ($letters as $letter) {
             $this->letters[$letter->letter] = 1;
         }
         if (count($this->letters) == 0) {
             return parent::display("empty");
         }
     }
     $this->curletter = "";
     // if we are showing on a per letter basis only
     if ($this->use_letter_bar == 2) {
         $this->curletter = JRequest::getVar('letter', $this->letters[0]->letter);
     }
     $where = array();
     $where[] = "published = 1";
     $query = "SELECT * FROM #__fsf_glossary";
     if ($this->curletter) {
         $where[] = "SUBSTR(word,1,1) = '" . FSFJ3Helper::getEscaped($db, $this->curletter) . "'";
     }
     if (FSF_Helper::Is16()) {
         $where[] = 'language in (' . $db->Quote(JFactory::getLanguage()->getTag()) . ',' . $db->Quote('*') . ')';
         $user = JFactory::getUser();
         $where[] = 'access IN (' . implode(',', $user->getAuthorisedViewLevels()) . ')';
     }
     if (count($where) > 0) {
         $query .= " WHERE " . implode(" AND ", $where);
     }
     $query .= " ORDER BY word";
     $db->setQuery($query);
     $this->rows = $db->loadObjectList();
     $pathway =& $mainframe->getPathway();
     if (FSF_Helper::NeedBaseBreadcrumb($pathway, array('view' => 'glossary'))) {
         $pathway->addItem("Glossary");
     }
     if (FSF_Settings::get('glossary_use_content_plugins')) {
         // apply plugins to article body
         $dispatcher =& JDispatcher::getInstance();
         JPluginHelper::importPlugin('content');
         $art = new stdClass();
         if (FSF_Helper::Is16()) {
             //$aparams = new JParameter(null);
         } else {
             $aparams = new stdClass();
         }
         $this->params =& $mainframe->getParams('com_fsf');
         foreach ($this->rows as &$row) {
             if ($row->description) {
                 $art->text = $row->description;
                 $art->noglossary = 1;
                 if (FSF_Helper::Is16()) {
                     $results = $dispatcher->trigger('onContentPrepare', array('com_fsf.glossary', &$art, &$this->params, 0));
                 } else {
                     $results = $dispatcher->trigger('onPrepareContent', array(&$art, &$this->params, 0));
                 }
                 $row->description = $art->text;
             }
             if ($row->longdesc) {
                 $art->text = $row->longdesc;
                 $art->noglossary = 1;
                 if (FSF_Helper::Is16()) {
                     $results = $dispatcher->trigger('onContentPrepare', array('com_fsf.glossary.long', &$art, &$this->params, 0));
                 } else {
                     $results = $dispatcher->trigger('onPrepareContent', array(&$art, &$this->params, 0));
                 }
                 $row->longdesc = $art->text;
             }
         }
     }
     parent::display($tpl);
 }
Exemplo n.º 3
0
 function listTags()
 {
     $mainframe = JFactory::getApplication();
     $aparams = FSF_Settings::GetViewSettingsObj('faqs');
     $pathway = $mainframe->getPathway();
     $pathway->addItem(JText::_("TAGS"));
     $db =& JFactory::getDBO();
     $qry = "SELECT tag FROM #__fsf_faq_tags ";
     $qry .= ' WHERE language in (' . $db->Quote(JFactory::getLanguage()->getTag()) . ',' . $db->Quote('*') . ')';
     $qry .= "GROUP BY tag ORDER BY tag";
     $db->setQuery($qry);
     $this->tags = $db->loadObjectList();
     parent::display("tags");
 }