Ejemplo n.º 1
0
 function display($tpl = null)
 {
     $document = JFactory::getDocument();
     if (FST_Helper::Is16()) {
         JHtml::_('behavior.framework');
     }
     $mainframe = JFactory::getApplication();
     JHTML::_('behavior.tooltip');
     JHTML::_('behavior.modal', 'a.fst_modal');
     $user = JFactory::getUser();
     $userid = $user->id;
     $db = JFactory::getDBO();
     $query = "SELECT * FROM #__fst_user WHERE user_id = '" . FSTJ3Helper::getEscaped($db, $userid) . "'";
     $db->setQuery($query);
     $this->_permissions = $db->loadAssoc();
     $this->params =& FST_Settings::GetViewSettingsObj('test');
     $this->test_show_prod_mode = $this->params->get('test_show_prod_mode', 'accordian');
     $this->test_always_prod_select = $this->params->get('test_always_prod_select', '0');
     $layout = JRequest::getVar('layout', '');
     $this->prodid = JRequest::getVar('prodid');
     if ($this->prodid == "") {
         $this->prodid = -1;
     }
     $this->products = $this->get('Products');
     //print_p($this->products);
     if (count($this->products) == 0) {
         $this->prodid = 0;
     }
     $this->comments = new FST_Comments("test", $this->prodid);
     if ($this->prodid == -1) {
         $this->comments->opt_show_posted_message_only = 1;
     }
     $onlyprodid = JRequest::getVar('onlyprodid', 'x');
     if ($onlyprodid != 'x') {
         $this->comments->itemid = (int) $onlyprodid;
         $this->comments->show_item_select = false;
     }
     echo "Hide Add : " . $this->params->get('hide_add', 0) . "<br>";
     if ($this->params->get('hide_add', 0)) {
         $this->comments->can_add = 0;
     }
     if ($layout == "create") {
         $this->setupCommentsCreate();
     }
     if ($this->comments->Process()) {
         return;
     }
     if ($layout == "create") {
         return $this->displayCreate();
     }
     if ($this->prodid != -1) {
         return $this->displaySingleProduct();
     }
     return $this->displayAllProducts();
 }