Exemplo n.º 1
0
 function display($tpl = null)
 {
     $task = JRequest::getVar('task');
     if ($task == "save" || $task == "apply") {
         return $this->save($task);
     }
     if ($task == "cancel") {
         return $this->cancel();
     }
     FSS_Helper::IncludeModal();
     FSS_CSSParse::OutputCSS('components/com_fss/assets/css/bootstrap/bootstrap_fssonly.less');
     $model = $this->getModel();
     $this->item = $this->get('Item');
     $this->section = $this->get('Section');
     $this->formid = $this->get('FormID');
     if ($this->section == "com_fss.support_admin" && JRequest::getVar('nojs') != 1) {
         $document = JFactory::getDocument();
         $document->addScript(JURI::root() . 'administrator/components/com_fss/assets/js/perm.group.support_admin.js');
     }
     $this->getTexts();
     $this->form = $model->getForm($this->formid);
     JToolBarHelper::title(JText::_("Permissions") . ': <small><small>[ ' . $this->title . ' ]</small></small>', 'fss_prods');
     JToolBarHelper::apply();
     JToolBarHelper::save();
     JToolBarHelper::cancel();
     JToolBarHelper::custom("nojs", "", "", "Old Version", false);
     FSSAdminHelper::DoSubToolbar(true);
     parent::display($tpl);
 }
Exemplo n.º 2
0
 function displayRegistered()
 {
     if (FSS_Settings::get('support_no_admin_for_user_open')) {
         JFactory::getApplication()->redirect("index.php?option=com_fss&view=admin_support");
     }
     FSS_Helper::IncludeModal();
     $this->_display("registered");
 }
Exemplo n.º 3
0
 function display($tpl = NULL)
 {
     // view a ticket!
     $this->ticketid = FSS_Input::getInt('ticketid');
     $document = JFactory::getDocument();
     $document->addScript(JURI::root() . 'components/com_fss/assets/js/bootstrap/bootstrap-timepicker.min.js');
     $this->ticket = new SupportTicket();
     if (!$this->ticket->load($this->ticketid)) {
         if ($this->ticket->checkExist($this->ticketid)) {
             return $this->_display("noperm");
         } else {
             return JError::raiseWarning(404, JText::_('Ticket not found'));
         }
     }
     if ($this->ticket->merged > 0 && FSS_Input::getInt('no_redirect') != '1') {
         JFactory::getApplication()->redirect(FSSRoute::_('index.php?option=com_fss&view=admin_support&layout=ticket&ticketid=' . $this->ticket->merged . "&Itemid=" . FSS_Input::getInt('Itemid'), false));
     }
     $reverse = JRequest::getInt('sort', null);
     if ($reverse !== null) {
         if ($reverse) {
             // we want messages in opposite order to normal
             if (SupportUsers::getSetting("reverse_order")) {
                 $reverse = true;
             } else {
                 $reverse = false;
             }
         } else {
             // we want messages in normal order
             $reverse = null;
         }
     }
     $this->ticket->loadAll($reverse);
     $this->loadMerged();
     $pathway = JFactory::getApplication()->getPathway();
     $pathway->addItem(JText::_("SUPPORT"), FSSRoute::_('index.php?option=com_fss&view=admin_support&tickets=' . $this->ticket_view));
     $pathway->addItem(JText::_("VIEW_TICKET") . " : " . $this->ticket->reference . " - " . $this->ticket->title);
     $this->assignOnOpen();
     $this->tryLock();
     if ($this->ticket->admin_id > 0) {
         $this->adminuser = SupportUsers::getUser($this->ticket->admin_id);
     }
     $this->ticket_view = $this->ticket->ticket_status_id;
     $this->HandleRefresh();
     if (FSS_Settings::get('time_tracking') == "auto") {
         $session = JFactory::getSession();
         $session->set('ticket_' . $this->ticket->id . "_opened", time());
     }
     FSS_Helper::IncludeModal();
     FSS_Helper::AddSCEditor();
     $this->HandleRefresh();
     $this->print = FSS_Input::getCmd('print');
     if ($this->print) {
         return $this->_display("print");
     }
     $this->_display();
 }
Exemplo n.º 4
0
 function displayType()
 {
     require_once JPATH_SITE . DS . 'components' . DS . 'com_fss' . DS . 'helper' . DS . 'content' . DS . $this->type . '.php';
     $class = "FSS_ContentEdit_{$this->type}";
     $content = new $class();
     $content->layout = $this->layout;
     $content->type = $this->type;
     $content->view = $this->view;
     FSS_Helper::IncludeModal();
     $content->Display();
 }
Exemplo n.º 5
0
 function display($tpl = NULL)
 {
     $preview = FSS_Input::getCmd('preview');
     if ($preview) {
         return $this->showPreview($preview);
     }
     FSS_Helper::IncludeModal();
     $this->state = FSS_Input::getCmd('state');
     $this->ticket_view = "";
     $this->getLimits();
     $this->pending = $this->loadPending();
     $this->_display();
 }
Exemplo n.º 6
0
 function display($tpl = null)
 {
     $task = JRequest::getVar('task');
     if ($task == "save" || $task == "apply" || $task == "save2new") {
         return $this->save($task);
     }
     if ($task == "cancel") {
         return $this->cancel();
     }
     FSS_CSSParse::OutputCSS('components/com_fss/assets/css/bootstrap/bootstrap_fssonly.less');
     $model = $this->getModel();
     $user = $this->get('Data');
     $isNew = $user->id < 1;
     $model->user = $user;
     $db = JFactory::getDBO();
     $text = $isNew ? JText::_("NEW") : JText::_("EDIT");
     JToolBarHelper::title(JText::_("USER") . ': <small><small>[ ' . $text . ' ]</small></small>', 'fss_users');
     JToolBarHelper::apply();
     JToolBarHelper::save();
     JToolBarHelper::save2new();
     if ($isNew) {
         JToolBarHelper::cancel();
     } else {
         // for existing items the button is renamed `close`
         JToolBarHelper::cancel('cancel', 'Close');
     }
     FSSAdminHelper::DoSubToolbar();
     $username = !empty($user->name) ? $user->name : "";
     $userid = !empty($user->user_id) ? $user->user_id : 0;
     $input = "<input type='hidden' name='user_id' id='user_id' value='" . $userid . "' class='input-mini' />";
     $input .= "<input type='text' name='user_name' id='user_name' value='" . $username . "' class='input-xlarge' disabled='disabled' />";
     $newLink = JRoute::_('index.php?option=com_fss&view=listusers&tmpl=component&tpl=fuser');
     if ($isNew) {
         $input .= "&nbsp;<a href='{$newLink}' class='btn btn-default show_modal_iframe'>Choose User</a>";
     }
     $this->users = $input;
     $this->user = $user;
     $this->sort_load_data();
     $this->form = $model->getForm();
     FSS_Helper::IncludeModal();
     parent::display($tpl);
 }
Exemplo n.º 7
0
 function searchTickets()
 {
     FSS_Helper::IncludeModal();
     FSS_Helper::AllowCache();
     $this->ticket_count = 0;
     $this->refresh = 0;
     $this->do_refresh = 0;
     $pathway = JFactory::getApplication()->getPathway();
     $pathway->addItem(JText::_("SUPPORT"), FSSRoute::_('index.php?option=com_fss&view=admin_support&tickets=' . $this->ticket_view, false));
     $pathway->addItem(JText::_("SEARCH_RESULTS"));
     $tags = FSS_Input::getString('tags');
     $tags = trim($tags, ';');
     if ($tags) {
         $tags = explode(";", $tags);
         $this->tags = $tags;
     }
     $this->ticket_list = new SupportTickets();
     $this->ticket_list->limitstart = $this->limitstart;
     $this->ticket_list->limit = $this->limit;
     $this->ticket_list->loadTicketsBySearch();
     $this->ticket_count = $this->ticket_list->ticket_count;
     $this->pagination = new JPaginationJS($this->ticket_count, $this->limitstart, $this->limit);
     $this->displayTicketList();
 }
Exemplo n.º 8
0
    if ($mode == "accordion") {
        $maxheight = 0;
    }
    $db = JFactory::getDBO();
    $qry = "SELECT * FROM #__fss_faq_faq";
    $where = array();
    $where[] = "published = 1";
    // for cats
    if ($catid > 0) {
        $where[] = "faq_cat_id = " . FSSJ3Helper::getEscaped($db, $catid);
    } else {
        if ($catid == -5) {
            $where[] = "featured = 1";
        }
    }
    if (count($where) > 0) {
        $qry .= " WHERE " . implode(" AND ", $where);
    }
    $order = "ordering";
    $qry .= " ORDER BY {$order} ";
    if ($dispcount > 0) {
        $qry .= " LIMIT {$dispcount}";
    }
    $db->setQuery($qry);
    $data = $db->loadObjectList();
    $posdata = array();
    if ($mode == "popup") {
        FSS_Helper::IncludeModal();
    }
    require JModuleHelper::getLayoutPath('mod_fss_faqs');
}
Exemplo n.º 9
0
 function display($tpl = null)
 {
     if (!FSS_Permission::auth("fss.view", "com_fss.glossary")) {
         return FSS_Helper::NoPerm();
     }
     $mainframe = JFactory::getApplication();
     $db = JFactory::getDBO();
     $aparams = FSS_Settings::GetViewSettingsObj('glossary');
     $this->use_letter_bar = $aparams->get('use_letter_bar', 0);
     $this->long_desc = $aparams->get('long_desc', 0);
     if ($this->use_letter_bar) {
         $this->letters = array();
         if (FSS_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 #__fss_glossary";
         $where = array();
         $where[] = "published = 1";
         $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) {
         reset($this->letters);
         $this->curletter = FSS_Input::getString('letter', key($this->letters));
     }
     if (FSS_Input::getCmd('layout') == "word") {
         return $this->showWord();
     }
     $where = array();
     $where[] = "published = 1";
     $query = "SELECT * FROM #__fss_glossary";
     if ($this->curletter) {
         $where[] = "SUBSTR(word,1,1) = '" . FSSJ3Helper::getEscaped($db, $this->curletter) . "'";
     }
     $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 (FSS_Helper::NeedBaseBreadcrumb($pathway, array('view' => 'glossary'))) {
         $pathway->addItem("Glossary");
     }
     if (FSS_Settings::get('glossary_use_content_plugins')) {
         // apply plugins to article body
         $dispatcher = JDispatcher::getInstance();
         JPluginHelper::importPlugin('content');
         $art = new stdClass();
         $this->params = $mainframe->getParams('com_fss');
         foreach ($this->rows as &$row) {
             if ($row->description) {
                 $art->text = $row->description;
                 $art->noglossary = 1;
                 $results = $dispatcher->trigger('onContentPrepare', array('com_fss.glossary', &$art, &$this->params, 0));
                 $row->description = $art->text;
             }
             if ($row->longdesc) {
                 $art->text = $row->longdesc;
                 $art->noglossary = 1;
                 $results = $dispatcher->trigger('onContentPrepare', array('com_fss.glossary.long', &$art, &$this->params, 0));
                 $row->longdesc = $art->text;
             }
         }
     }
     FSS_Helper::IncludeModal();
     parent::display($tpl);
 }
Exemplo n.º 10
0
 function Display($tpl = NULL)
 {
     if (!FSS_Permission::auth("core.edit", $this->getAsset()) && !FSS_Permission::auth("core.edit.own", $this->getAsset())) {
         return FSS_Admin_Helper::NoPerm();
     }
     $this->Init();
     $db = JFactory::getDBO();
     $this->what = FSS_Input::getCmd('what', '');
     $user = JFactory::getUser();
     $userid = $user->get('id');
     $this->viewurl = "";
     $return = FSS_Input::getString('return', '');
     if ($return == 1) {
         JRequest::setVar('return', $_SERVER['HTTP_REFERER']);
     }
     if ($this->what == "pick") {
         return $this->HandlePick();
     }
     if ($this->what == "author") {
         return $this->HandleAuthor();
     }
     if ($this->what == "publish" || $this->what == "unpublish") {
         return $this->HandlePublish();
     }
     if ($this->what == "cancel") {
         $mainframe = JFactory::getApplication();
         $link = FSSRoute::_('index.php?option=com_fss&view=admin_content&type=' . $this->id, false);
         $return = FSS_Input::getString('return', '');
         if ($return && $return != 1) {
             $link = $return;
         }
         $mainframe->redirect($link);
     }
     if ($this->what == "save" || $this->what == "apply" || $this->what == "savenew") {
         return $this->Save();
     }
     if ($this->what == "new") {
         return $this->Create();
     }
     if ($this->what == "edit") {
         $this->item = $this->getSingle();
         $this->viewurl = $this->getArtLink();
         if (FSS_Permission::auth("core.edit", $this->getAsset())) {
             $this->authorselect = $this->AuthorSelect($this->item);
         }
         FSS_Helper::IncludeModal();
         $this->Output("form");
         return;
     }
     $this->GetListFilter();
     $this->data = $this->getList();
     $this->Output("list");
 }
Exemplo n.º 11
0
 function doDisplayTicket()
 {
     if (!FSS_Permission::auth("fss.ticket.view", "com_fss.support_user")) {
         return FSS_Helper::NoPerm();
     }
     if (!$this->GetTicket()) {
         return;
     }
     $this->readonly = false;
     SupportSource::doUser_View_Redirect($this->ticket);
     $this->redirectMergedTickets();
     $this->getCCInfo();
     // update lang code on ticket
     $lang = JFactory::getLanguage()->getTag();
     $db = JFactory::getDBO();
     $qry = "UPDATE #__fss_ticket_ticket SET lang = '" . FSSJ3Helper::getEscaped($db, $lang) . "' WHERE id = " . $this->ticket['id'];
     $db->setQuery($qry);
     $db->Query();
     $what = FSS_Input::getCmd('what');
     if ($what == "print") {
         return parent::display("print");
     }
     $this->FixTicketStatus();
     FSS_Helper::IncludeModal();
     parent::display();
 }
Exemplo n.º 12
0
 function display($tpl = null)
 {
     if (!FSS_Permission::auth("fss.view", "com_fss.kb")) {
         return FSS_Helper::NoPerm();
     }
     $mainframe = JFactory::getApplication();
     require_once JPATH_SITE . DS . 'components' . DS . 'com_fss' . DS . 'helper' . DS . 'content' . DS . 'kb.php';
     $this->content = new FSS_ContentEdit_KB();
     $this->content->Init();
     $this->pagetitle = "";
     $model = $this->getModel();
     $model->content = $this->content;
     $this->assign('search', '');
     $what = FSS_Input::getCmd('what');
     // basic permissions on article stats stop people seeing stats when disabled
     if (!FSS_Settings::get('kb_show_views')) {
         $what = "";
     }
     if ($what == "recent" && !FSS_Settings::get('kb_show_recent')) {
         $what = "";
     }
     if ($what == "viewed" && !FSS_Settings::get('kb_show_viewed')) {
         $what = "";
     }
     if ($what == "rated" && !FSS_Settings::get('kb_show_rated')) {
         $what = "";
     }
     $user = JFactory::getUser();
     $userid = $user->id;
     /*$db = JFactory::getDBO();
     		$query = "SELECT * FROM #__fss_user WHERE user_id = '".FSSJ3Helper::getEscaped($db, $userid)."'";
     		$db->setQuery($query);
     		$this->_permissions = $db->loadAssoc();*/
     $fileid = FSS_Input::getInt('fileid');
     if ($fileid > 0) {
         return $this->downloadFile();
     }
     FSS_Helper::IncludeModal();
     if ($what != "") {
         return $this->showWhat();
     }
     $search = FSS_Input::getString('kbsearch');
     if ($search != "") {
         return $this->searchArticles();
     }
     $search = FSS_Input::getString('prodsearch');
     if ($search != "") {
         return $this->searchProducts();
     }
     $kbartid = FSS_Input::getInt('kbartid');
     if ($kbartid > 0) {
         return $this->showArt();
     }
     $catid = FSS_Input::getInt('catid');
     if ($catid > 0) {
         return $this->showCat();
     }
     $prodid = FSS_Input::getInt('prodid');
     if ($prodid > 0) {
         return $this->showProd();
     }
     $this->showMain();
 }
Exemplo n.º 13
0
 function doReply()
 {
     $this->ticketid = FSS_Input::getInt('ticketid');
     $this->ticket = new SupportTicket();
     if (!$this->ticket->load($this->ticketid)) {
         return JError::raiseWarning(404, JText::_('Ticket not found'));
     }
     $this->ticket->loadAll();
     if (FSS_Settings::get('time_tracking') != "") {
         if (FSS_Settings::get('time_tracking_type') == 'se') {
             $this->time_start = FSS_Helper::Date(time(), FSS_DATE_CUSTOM, "H:i:s");
             $this->time_end = FSS_Helper::Date(time(), FSS_DATE_CUSTOM, "H:i:s");
         } elseif (FSS_Settings::get('time_tracking_type') == 'tm') {
             $this->time_start = FSS_Helper::Date(time(), FSS_DATE_CUSTOM, FSS_Helper::getFormat());
             $this->time_end = FSS_Helper::Date(time(), FSS_DATE_CUSTOM, FSS_Helper::getFormat());
         } else {
             $this->taken_hours = 0;
             $this->taken_mins = 0;
         }
     }
     if (FSS_Settings::get('time_tracking') == "auto") {
         $session = JFactory::getSession();
         $taken = $session->get('ticket_' . $this->ticket->id . "_opened");
         if (FSS_Settings::get('time_tracking_type') == 'se') {
             $document = JFactory::getDocument();
             $document->addScript(JURI::root() . 'components/com_fss/assets/js/bootstrap/bootstrap-timepicker.min.js');
             $document->addScriptDeclaration("jQuery(document).ready(function () {jQuery('#timetaken_start').timepicker({minuteStep:5, showMeridian: false});jQuery('#timetaken_end').timepicker({minuteStep:5, showMeridian: false});});");
             $this->time_start = FSS_Helper::Date($taken, FSS_DATE_CUSTOM, "H:i:s");
         } else {
             if ($taken > 0) {
                 $taken = time() - $taken;
             }
             $this->time_taken = $taken;
             $taken = ceil($taken / 60);
             $this->taken_hours = floor($taken / 60);
             $this->taken_mins = $taken % 60 + 1;
         }
     }
     $this->fields = FSSCF::GetCustomFields($this->ticket->id, $this->ticket->prod_id, $this->ticket->ticket_dept_id, 3);
     $this->fieldvalues = FSSCF::GetTicketValues($this->ticket->id, $this->ticket);
     $pathway = JFactory::getApplication()->getPathway();
     $pathway->addItem(JText::_("SUPPORT"), FSSRoute::_('index.php?option=com_fss&view=admin_support&tickets=' . $this->ticket_view, false));
     $pathway->addItem(JText::_("VIEW_TICKET") . " : " . $this->ticket->reference . " - " . $this->ticket->title, FSSRoute::_('index.php?option=com_fss&view=admin_support&tickets=' . $this->ticket_view . "&ticketid=" . $this->ticket->id, false));
     $this->reply_type = FSS_Input::getCmd('type', 'reply');
     if ($this->reply_type == "") {
         $this->reply_type = "reply";
     }
     switch ($this->reply_type) {
         case 'reply':
             $this->reply_title = "REPLY_TO_SUPORT_TICKET";
             $this->reply_button = "POST_REPLY";
             $pathway->addItem(JText::_("POST_REPLY"));
             break;
         case 'private':
             $this->reply_title = "ADD_HANDLER_COMMENT_TO_TICKET";
             $this->reply_button = "POST_COMMENT";
             $pathway->addItem(JText::_("ADD_COMMENT"));
             break;
         case 'user':
             $this->reply_title = "FORWARD_TICKET_TO_A_DIFFERENT_USER";
             $this->reply_button = "FORWARD_TICKET";
             if ($this->ticket->user_id > 0) {
                 $user = JFactory::getUser($this->ticket->user_id);
             } else {
                 $user = new stdClass();
                 $user->username = $this->ticket->email;
                 $user->name = $this->ticket->unregname;
             }
             $this->user = $user;
             $pathway->addItem(JText::_("FORWARD_TO_USER"));
             break;
         case 'product':
             $this->reply_title = "FORWARD_TICKET_TO_A_DIFFERENT_DEPARTMENT";
             $this->reply_button = "FORWARD_TICKET";
             $this->handlers = SupportUsers::getHandlers(false, true);
             $pathway->addItem(JText::_("FORWARD_TO_DEPARTMENT"));
             break;
         case 'handler':
             $this->reply_title = "FORWARD_TICKET_TO_A_DIFFERENT_HANDLER";
             $this->reply_button = "FORWARD_TICKET";
             $this->handlers = SupportUsers::getHandlers(false, true);
             $pathway->addItem(JText::_("FORWARD_TO_HANDLER"));
             break;
     }
     $this->draft = FSS_Input::getInt('draft');
     $this->user_message = $this->loadDraft($this->draft);
     $this->support_assign_reply = FSS_Settings::get('support_assign_reply');
     FSS_Helper::IncludeModal();
     FSS_Helper::AddSCEditor();
     parent::_display();
 }
Exemplo n.º 14
0
 function DisplayGroupList()
 {
     $this->groups = $this->get('Groups');
     $mainframe = JFactory::getApplication();
     $pathway = $mainframe->getPathway();
     if (FSS_Helper::NeedBaseBreadcrumb($pathway, array('view' => 'groups'))) {
         $pathway->addItem(JText::_('TICKET_GROUPS'), FSSRoute::_('index.php?option=com_fss&view=admin_groups'));
     }
     FSS_Helper::IncludeModal();
     parent::display();
 }
Exemplo n.º 15
0
 function display($tpl = null)
 {
     if (!FSS_Permission::auth("fss.view", "com_fss.faq")) {
         return FSS_Helper::NoPerm();
     }
     require_once JPATH_SITE . DS . 'components' . DS . 'com_fss' . DS . 'helper' . DS . 'content' . DS . 'faqs.php';
     $this->content = new FSS_ContentEdit_FAQs();
     $this->content->Init();
     $model = $this->getModel();
     $model->content = $this->content;
     $mainframe = JFactory::getApplication();
     $faqid = FSS_Input::getInt('faqid');
     $aparams = FSS_Settings::GetViewSettingsObj('faqs');
     if ($faqid > 0) {
         $tmpl = FSS_Input::getCmd('tmpl');
         $this->tmpl = $tmpl;
         $this->setLayout("faq");
         $faq = $this->get("Faq");
         $this->faq = $faq;
         if (!$this->faq) {
             return JError::raiseWarning(404, JText::_('FAQ NOT FOUND'));
         }
         $pathway = $mainframe->getPathway();
         if (FSS_Helper::NeedBaseBreadcrumb($pathway, array('view' => 'faq'))) {
             $pathway->addItem(JText::_('FREQUENTLY_ASKED_QUESTIONS'), FSSRoute::_('index.php?option=com_fss&view=faq'));
         }
         $pathway->addItem($faq['title'], FSSRoute::_('&limitstart=&layout=&faqid=&catid=' . $faq['faq_cat_id']));
         // FIX LINK
         $pathway->addItem($faq['question']);
         if (FSS_Settings::get('faq_use_content_plugins')) {
             // apply plugins to article body
             $dispatcher =& JDispatcher::getInstance();
             JPluginHelper::importPlugin('content');
             $art = new stdClass();
             $art->text = $faq['answer'];
             $art->noglossary = 1;
             $this->params = $mainframe->getParams('com_fss');
             $results = $dispatcher->trigger('onContentPrepare', array('com_fss.faq', &$art, &$this->params, 0));
             $faq['answer'] = $art->text;
         }
         // load tags
         $db = JFactory::getDBO();
         $qry = "SELECT * FROM #__fss_faq_tags WHERE faq_id IN (" . FSSJ3Helper::getEscaped($db, $faqid) . ") GROUP BY tag ORDER BY tag";
         $db->setQuery($qry);
         $rows = $db->loadObjectList();
         $this->tags = array();
         foreach ($rows as &$row) {
             $id = $row->faq_id;
             $this->tags[] = "<a href='" . FSSRoute::_('index.php?option=com_fss&view=faq&tag=' . urlencode($row->tag) . '&Itemid=' . FSS_Input::getInt('Itemid')) . "'>{$row->tag}</a>";
         }
         //$document = JFactory::getDocument();
         //$document->setTitle(JText::_("FAQS") . ' - ' . $faq['title']);
         if (FSS_Input::getCmd('tmpl') == "component") {
             return parent::display("popup");
         }
         parent::display();
         return;
     }
     $pathway = $mainframe->getPathway();
     if (FSS_Helper::NeedBaseBreadcrumb($pathway, array('view' => 'faq'))) {
         $pathway->addItem(JText::_('FREQUENTLY_ASKED_QUESTIONS'), FSSRoute::_('index.php?option=com_fss&view=faq'));
     }
     $hide_allfaqs = $aparams->get('hide_allfaqs', 0);
     $show_featured = $aparams->get('show_featured', 0);
     $hide_tags = $aparams->get('hide_tags', 0);
     $hide_search = $aparams->get('hide_search', 0);
     $view_mode = $aparams->get('view_mode', 'questionwithpopup');
     $view_mode_cat = $aparams->get('view_mode_cat', 'list');
     $view_mode_incat = $aparams->get('view_mode_incat', 'list');
     $enable_pages = $aparams->get('enable_pages', 1);
     $num_cat_colums = $aparams->get('num_cat_colums', 1);
     if ($num_cat_colums < 1 && !$num_cat_colums) {
         $num_cat_colums = 1;
     }
     if ($view_mode_cat != "list") {
         $num_cat_colums = 1;
     }
     $catlist = $this->get("CatList");
     $search = $this->get("Search");
     $curcatdesc = $this->get("CurCatDesc");
     $curcatimage = $this->get("CurCatImage");
     $curcattitle = $this->get("CurCatTitle");
     $curcatid = $this->get("CurCatID");
     // Get data from the model
     if ($curcatid == -4) {
         return $this->listTags();
     }
     if ($curcatid == -5) {
         $curcattitle = "Featured FAQs";
         $curcatimage = "/components/com_fss/assets/images/featured.png";
     }
     $pagination = $this->get('Pagination');
     $model = $this->getModel();
     $search = $model->_search;
     if ($search || $curcatid > 0 || FSS_Input::getInt('catid') != "" || FSS_Input::getString('tag') != "") {
         $view_mode_cat = "";
     }
     if ($search) {
         FSS_Helper::AllowCache();
     }
     $items = array();
     if ($view_mode_cat == "inline" || $view_mode_cat == "accordian") {
         //echo "Getting all data!<br>";
         $alldata = $this->get("AllData");
         if (FSS_Settings::get('faq_use_content_plugins_list')) {
             // apply plugins to article body
             $dispatcher = JDispatcher::getInstance();
             JPluginHelper::importPlugin('content');
             $art = new stdClass();
             foreach ($alldata as &$item) {
                 $art->text = $item['answer'];
                 $art->noglossary = 1;
                 $this->params = $mainframe->getParams('com_fss');
                 $results = $dispatcher->trigger('onContentPrepare', array('com_fss.faq', &$art, &$this->params, 0));
                 $item['answer'] = $art->text;
             }
         }
         foreach ($catlist as &$cat) {
             $catid = $cat['id'];
             foreach ($alldata as $faq) {
                 if ($faq['faq_cat_id'] == $catid) {
                     $cat['faqs'][] = $faq;
                 }
             }
         }
         // inline mode, so if we have featured faqs listed, load the data for those
         $this->featured_faqs = $this->get('FeaturedFaqs');
     } else {
         $items = $this->get('Data');
         if (FSS_Settings::get('faq_use_content_plugins_list')) {
             // apply plugins to article body
             $dispatcher =& JDispatcher::getInstance();
             JPluginHelper::importPlugin('content');
             $art = new stdClass();
             foreach ($items as &$item) {
                 $art->text = $item['answer'];
                 $art->noglossary = 1;
                 $this->params =& $mainframe->getParams('com_fss');
                 $results = $dispatcher->trigger('onContentPrepare', array('com_fss.faq', &$art, &$this->params, 0));
                 $item['answer'] = $art->text;
             }
         }
     }
     $showfaqs = true;
     $showcats = true;
     if (FSS_Input::getString('tag') != "") {
         // got tag selected
         $showfaqs = true;
         $showcats = false;
         $curcatid = -2;
         $pathway = $mainframe->getPathway();
         $pathway->addItem(JText::_("TAGS"), FSSRoute::_('index.php?option=com_fss&view=faq&catid=-4&Itemid=' . FSS_Input::getInt('Itemid')));
         $pathway->addItem(FSS_Input::getString('tag'));
         $curcattitle = FSS_Input::getString('tag');
         // do we have a category specified???
     } else {
         if (FSS_Input::getInt('catid', '') == '' && FSS_Input::getInt('search', '') == '') {
             // no cat specified
             $showfaqs = false;
             $curcatid = -2;
         } else {
             // got a cat specced
             $pathway = $mainframe->getPathway();
             $pathway->addItem($curcattitle);
             $showcats = false;
         }
     }
     // load tags
     $faqids = array();
     if ($items && is_array($items)) {
         foreach ($items as &$item) {
             $faqids[] = FSSJ3Helper::getEscaped($db, $item['id']);
         }
     }
     $db = JFactory::getDBO();
     $this->tags = array();
     if (count($faqids) > 0) {
         $qry = "SELECT * FROM #__fss_faq_tags WHERE faq_id IN (" . implode(", ", $faqids) . ") GROUP BY tag ORDER BY tag";
         $db->setQuery($qry);
         $rows = $db->loadObjectList();
         foreach ($rows as $row) {
             $id = $row->faq_id;
             if (!array_key_exists($id, $this->tags)) {
                 $this->tags[$id] = array();
             }
             $this->tags[$id][] = "<a href='" . FSSRoute::_('index.php?option=com_fss&view=faq&tag=' . urlencode($row->tag) . '&Itemid=' . FSS_Input::getInt('Itemid')) . "'>{$row->tag}</a>";
         }
     }
     // hide tags if none have been set
     $qry = "SELECT count(*) as cnt FROM #__fss_faq_tags";
     $db->setQuery($qry);
     $row = $db->loadObject();
     if ($row->cnt == 0) {
         $hide_tags = true;
     }
     $this->catlist = $catlist;
     $this->search = $search;
     $this->curcattitle = $curcattitle;
     $this->curcatimage = $curcatimage;
     $this->curcatdesc = $curcatdesc;
     // push data into the template
     $this->pagination = $pagination;
     $this->items = $items;
     $this->assign('curcatid', $curcatid);
     $this->assign('showcats', $showcats);
     $this->assign('showfaqs', $showfaqs);
     $this->assign('hide_allfaqs', $hide_allfaqs);
     $this->assign('show_featured', $show_featured);
     $this->assign('hide_tags', $hide_tags);
     $this->assign('hide_search', $hide_search);
     $this->assign('view_mode', $view_mode);
     $this->assign('num_cat_colums', $num_cat_colums);
     $this->assign('view_mode_cat', $view_mode_cat);
     $this->assign('view_mode_incat', $view_mode_incat);
     $this->assign('enable_pages', $enable_pages);
     $db = JFactory::getDBO();
     $qry = "SELECT tag FROM #__fss_faq_tags ";
     $qry .= ' WHERE language in (' . $db->Quote(JFactory::getLanguage()->getTag()) . ',' . $db->Quote('*') . ')';
     $qry .= "GROUP BY tag ORDER BY tag";
     $db->setQuery($qry);
     $this->all_tags = $db->loadObjectList();
     FSS_Helper::IncludeModal();
     parent::display($tpl);
 }