Exemplo n.º 1
0
 public function showContainerContent()
 {
     global $ilUser, $rbacreview, $ilToolbar, $tpl;
     if ($rbacreview->isAssigned($ilUser->getId(), SYSTEM_ROLE_ID)) {
         $ilToolbar->addButton($this->lng->txt('edit_page'), $this->ctrl->getLinkTargetByClass(array('ilshoppagegui'), 'edit'));
     }
     include_once './Services/Payment/classes/class.ilPaymentObject.php';
     $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.shop_content.html', 'Services/Payment');
     $this->tpl->setVariable('PAGE_CONTENT', $this->getPageHTML());
     $is_buyable = ilPaymentObject::_isBuyable($this->cur_ref_id);
     if ($is_buyable) {
         $pobjects = ilPaymentObject::_getObjectData(ilPaymentObject::_lookupPobjectId($this->cur_ref_id));
         $obj_id = ilObject::_lookupObjId($this->cur_ref_id);
         $title = ilObject::_lookupTitle($obj_id);
         $description = ilObject::_lookupDescription($obj_id);
         $type = ilObject::_lookupType($obj_id);
         $presentation_results[$pobjects['pt_topic_fk']][$type][] = array('ref_id' => $pobjects['ref_id'], 'title' => $title, 'description' => $description, 'type' => $type, 'obj_id' => $obj_id, 'topic_id' => $pobjects['pt_topic_fk'], 'child' => $pobjects['child']);
     } else {
         $pobjects = ilPaymentObject::_getContainerObjects($this->cur_ref_id);
         if (count($pobjects) >= 1) {
             foreach ($pobjects as $result) {
                 $obj_id = $result['obj_id'];
                 $title = $result['title'];
                 $description = $result['description'];
                 $type = $result['type'];
                 $presentation_results[$result['pt_topic_fk']][$type][] = array('ref_id' => $result['ref_id'], 'title' => $title, 'description' => $description, 'type' => $type, 'obj_id' => $obj_id, 'topic_id' => $result['pt_topic_fk'], 'child' => $result['child']);
             }
         }
     }
     include_once 'Services/Payment/classes/class.ilShopResultPresentationGUI.php';
     $search_result_presentation = new ilShopResultPresentationGUI($presentation_results);
     $search_result_presentation->setSortField(strtolower(trim($this->getSortField())));
     $search_result_presentation->setSortDirection(trim($this->getSortDirection()));
     if (!$presentation_results) {
         $this->tpl->setVariable('RESULTS', $this->lng->txt('payment_shop_not_objects_found'));
     } else {
         $html = $search_result_presentation->showSpecials();
         $this->tpl->setVariable('RESULTS', $html);
     }
     $this->showFilters();
 }
 public function showContainerContent()
 {
     global $ilUser, $rbacreview, $ilToolbar;
     if ($rbacreview->isAssigned($ilUser->getId(), SYSTEM_ROLE_ID)) {
         $ilToolbar->addButton($this->lng->txt('edit_page'), $this->ctrl->getLinkTargetByClass(array('ilpageobjectgui'), 'edit'));
     }
     include_once './Services/Payment/classes/class.ilPaymentObject.php';
     $is_buyable = ilPaymentObject::_isBuyable($this->cur_ref_id);
     if ($is_buyable) {
         $pobjects = ilPaymentObject::_getObjectData(ilPaymentObject::_lookupPobjectId($this->cur_ref_id));
         $obj_id = ilObject::_lookupObjId($this->cur_ref_id);
         $title = ilObject::_lookupTitle($obj_id);
         $description = ilObject::_lookupDescription($obj_id);
         $type = ilObject::_lookupType($obj_id);
         $presentation_results[$pobjects['pt_topic_fk']][$type][] = array('ref_id' => $pobjects['ref_id'], 'title' => $title, 'description' => $description, 'type' => $type, 'obj_id' => $obj_id, 'topic_id' => $pobjects['pt_topic_fk'], 'child' => $pobjects['child']);
     } else {
         $pobjects = ilPaymentObject::_getContainerObjects($this->cur_ref_id);
         if (count($pobjects) >= 1) {
             foreach ($pobjects as $result) {
                 $obj_id = $result['obj_id'];
                 $title = $result['title'];
                 $description = $result['description'];
                 $type = $result['type'];
                 $presentation_results[$result['pt_topic_fk']][$type][] = array('ref_id' => $result['ref_id'], 'title' => $title, 'description' => $description, 'type' => $type, 'obj_id' => $obj_id, 'topic_id' => $result['pt_topic_fk'], 'child' => $result['child']);
             }
         }
     }
     $shop_content_tpl = new ilTemplate('tpl.shop_content.html', true, true, 'Services/Payment');
     $shop_content_tpl->setVariable('PAGE_CONTENT', $this->getPageHTML());
     include_once 'Services/Payment/classes/class.ilShopResultPresentationGUI.php';
     $search_result_presentation = new ilShopResultPresentationGUI($presentation_results);
     $search_result_presentation->setSortField(strtolower(trim($this->getSortField())));
     $search_result_presentation->setSortDirection(trim($this->getSortDirection()));
     $html = $search_result_presentation->showSpecials();
     $shop_content_tpl->setVariable('RESULTS', $html);
     $show_general_filter = $this->oGeneralSettings->get('show_general_filter');
     $show_topics_filter = $this->oGeneralSettings->get('show_topics_filter');
     $show_shop_explorer = $this->oGeneralSettings->get('show_shop_explorer');
     if ($show_general_filter) {
         $g_filter_html = $this->showGeneralFilter(count($search_result_presentation));
         $shop_content_tpl->setVariable('FORM', $g_filter_html);
     }
     if ($show_topics_filter) {
         $this->showTopicsFilter(count($search_result_presentation));
     }
     if ($show_shop_explorer) {
         $this->showShopExplorer();
     }
     global $tpl;
     $tpl->setContent($shop_content_tpl->parse());
 }