Ejemplo 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();
 }
Ejemplo n.º 2
0
 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());
 }
 public function showForm($result = null)
 {
     $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.shop_advanced_search.html', 'Services/Payment');
     include_once 'Services/Payment/classes/class.ilAdvancedSearchFilterGUI.php';
     $filterGUI = new ilAdvancedSearchFilterGUI($this, $this->cmd);
     $filterGUI->initFilter();
     if ($this->cmd == 'setFilter') {
         $filterGUI->writeFilterToSession();
     } else {
         $_SESSION['shop_advanced_search'] = array();
         $filterGUI->resetFilter();
     }
     $this->tpl->setVariable('FILTER', $filterGUI->getHtml());
     // show results
     if ($result && count($result->getResults())) {
         include_once 'Services/Payment/classes/class.ilShopResultPresentationGUI.php';
         $search_result_presentation = new ilShopResultPresentationGUI($result);
         $this->tpl->setVariable('RESULTS', $search_result_presentation->showAdvancedSearchResults());
     } else {
         $this->tpl->setVariable('RESULTS', $this->lng->txt('payment_shop_not_objects_found'));
     }
     if ($result) {
         $this->addPager($result);
     }
     //		return true;
 }
 public function showForm($result = null)
 {
     global $ilUser;
     $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.shop_advanced_search.html', 'Services/Payment');
     $this->tpl->setVariable('TBL_TITLE', $this->lng->txt('advanced_search'));
     $this->tpl->setVariable('SEARCH_ACTION', $this->ctrl->getFormAction($this));
     $this->tpl->setVariable('TXT_SEARCHTERM', $this->lng->txt('search_search_term'));
     $this->tpl->setVariable('TXT_AND', $this->lng->txt('search_all_words'));
     $this->tpl->setVariable('TXT_OR', $this->lng->txt('search_any_word'));
     $this->tpl->setVariable('TXT_OBJECT_TYPE', $this->lng->txt('obj_type'));
     $this->tpl->setVariable('TXT_TOPIC', $this->lng->txt('topic'));
     $this->tpl->setVariable('BTN_SEARCH', $this->lng->txt('search'));
     $this->tpl->setVariable('FORM_SEARCH_STR', ilUtil::prepareFormOutput($this->getString(), true));
     if ($this->getCombination() == self::SEARCH_AND) {
         $this->tpl->setVariable('AND_CHECKED', 'checked="checked"');
     } else {
         $this->tpl->setVariable('OR_CHECKED', 'checked="checked"');
     }
     $this->tpl->setVariable('CRS', $this->lng->txt('courses'));
     $this->tpl->setVariable('LMS', $this->lng->txt('learning_resources'));
     $this->tpl->setVariable('TST', $this->lng->txt('tests'));
     $this->tpl->setVariable('FIL', $this->lng->txt('objs_file'));
     $details = $this->getDetails();
     $this->tpl->setVariable('CHECK_CRS', ilUtil::formCheckbox($details['crs'] ? 1 : 0, 'search[details][crs]', 1));
     $this->tpl->setVariable('CHECK_LMS', ilUtil::formCheckbox($details['lms'] ? 1 : 0, 'search[details][lms]', 1));
     $this->tpl->setVariable('CHECK_TST', ilUtil::formCheckbox($details['tst'] ? 1 : 0, 'search[details][tst]', 1));
     $this->tpl->setVariable('CHECK_FIL', ilUtil::formCheckbox($details['fil'] ? 1 : 0, 'search[details][fil]', 1));
     $selectable_topics = array();
     $selectable_topics[''] = $this->lng->txt('search_any');
     ilShopTopics::_getInstance()->setIdFilter(false);
     ilShopTopics::_getInstance()->read();
     foreach (ilShopTopics::_getInstance()->getTopics() as $oTopic) {
         $selectable_topics[$oTopic->getId()] = $oTopic->getTitle();
     }
     $this->tpl->setVariable('SELECT_TOPIC', ilUtil::formSelect(array($this->getTopicId()), 'search[topic]', $selectable_topics, false, true));
     // show results
     if (count($result->getResults())) {
         include_once 'Services/Payment/classes/class.ilShopResultPresentationGUI.php';
         $search_result_presentation = new ilShopResultPresentationGUI($result);
         $this->tpl->setVariable('RESULTS', $search_result_presentation->showResults());
         $objects = (bool) $this->oGeneralSettings->get('objects_allow_custom_sorting');
         $topics = (bool) $this->oGeneralSettings->get('topics_allow_custom_sorting');
         if ($objects) {
             $this->tpl->setCurrentBlock('objects_sort_block');
             $order_fields = array('title' => $this->lng->txt('title'), 'author' => $this->lng->txt('author'), 'price' => $this->lng->txt('price_a'));
             foreach ($order_fields as $key => $value) {
                 $this->tpl->setCurrentBlock('order_field');
                 $this->tpl->setVariable('ORDER_FIELD_VALUE', $key);
                 $this->tpl->setVariable('ORDER_FIELD_TEXT', $value);
                 if (strcmp(trim($this->getSortField()), $key) == 0) {
                     $this->tpl->setVariable('ORDER_FIELD_SELECTED', ' selected="selected"');
                 }
                 $this->tpl->parseCurrentBlock();
             }
             $this->tpl->setVariable('SORT_BY_TEXT', $this->lng->txt('sort_by'));
             $this->tpl->setVariable('ASCENDING_TEXT', $this->lng->txt('sort_asc'));
             $this->tpl->setVariable('DESCENDING_TEXT', $this->lng->txt('sort_desc'));
             $this->tpl->setVariable('ORDER_DIRECTION_' . strtoupper(trim($this->getSortDirection())) . '_SELECTED', " selected=\"selected\"");
             $this->tpl->parseCurrentBlock();
         }
         if ($topics) {
             $this->tpl->setCurrentBlock('topics_sort_block');
             $this->tpl->setVariable('SORT_TOPICS_BY_TEXT', $this->lng->txt('sort_topics_by'));
             $this->tpl->setVariable('SORTING_TYPE_BY_TITLE', ilShopTopics::TOPICS_SORT_BY_TITLE);
             $this->tpl->setVariable('SORTING_TYPE_BY_TITLE_TEXT', $this->lng->txt('sort_topics_by_title'));
             if ($this->getSortingTypeTopics() == ilShopTopics::TOPICS_SORT_BY_TITLE) {
                 $this->tpl->setVariable('SORTING_TYPE_BY_TITLE_SELECTED', ' selected="selected"');
             }
             $this->tpl->setVariable('SORTING_TYPE_BY_DATE', ilShopTopics::TOPICS_SORT_BY_CREATEDATE);
             $this->tpl->setVariable('SORTING_TYPE_BY_DATE_TEXT', $this->lng->txt('sort_topics_by_date'));
             if ($this->getSortingTypeTopics() == ilShopTopics::TOPICS_SORT_BY_CREATEDATE) {
                 $this->tpl->setVariable('SORTING_TYPE_BY_DATE_SELECTED', ' selected="selected"');
             }
             if (ANONYMOUS_USER_ID != $ilUser->getId()) {
                 $this->tpl->setCurrentBlock('sort_manually');
                 $this->tpl->setVariable('SORTING_TYPE_MANUALLY', ilShopTopics::TOPICS_SORT_MANUALLY);
                 $this->tpl->setVariable('SORTING_TYPE_MANUALLY_TEXT', $this->lng->txt('sort_topics_manually'));
                 if ($this->getSortingTypeTopics() == ilShopTopics::TOPICS_SORT_MANUALLY) {
                     $this->tpl->setVariable('SORTING_TYPE_MANUALLY_SELECTED', ' selected="selected"');
                 }
                 $this->tpl->parseCurrentBlock();
             }
             $this->tpl->setVariable('SORTING_DIRECTION_ASCENDING_TEXT', $this->lng->txt('sort_asc'));
             $this->tpl->setVariable('SORTING_DIRECTION_DESCENDING_TEXT', $this->lng->txt('sort_desc'));
             if (in_array(strtoupper($this->getSortingDirectionTopics()), array('ASC', 'DESC'))) {
                 $this->tpl->setVariable('SORTING_DIRECTION_' . strtoupper($this->getSortingDirectionTopics()) . '_SELECTED', ' selected="selected"');
             } else {
                 $this->tpl->setVariable('SORTING_DIRECTION_' . strtoupper(ilShopTopics::DEFAULT_SORTING_DIRECTION) . '_SELECTED', ' selected="selected"');
             }
             $this->tpl->parseCurrentBlock();
         }
         if ($objects || $topics) {
             $this->tpl->setCurrentBlock('sort_button');
             $this->tpl->setVariable('SORTING_FORM_ACTION', $this->ctrl->getFormAction($this, 'setSorting'));
             $this->tpl->setVariable('CMD_SORT', 'setSorting');
             $this->tpl->setVariable('SORT_TEXT', $this->lng->txt('sort'));
             $this->tpl->parseCurrentBlock();
         }
         $this->tpl->setCurrentBlock('sorting');
         $this->tpl->parseCurrentBlock();
     }
     $this->addPager($result, 'shop_advanced_search_maxpage');
     return true;
 }