コード例 #1
0
 /**
  * Returns the Select box view with possible variants of rows
  * per page.
  *
  * @return Select box with possible page values outputted on the page.
  * @ finish the functions on this page
  */
 function output($pag_name, $viewname, $items_name = 'PGNTR_REC_ITEMS', $add_keys = null)
 {
     global $application;
     $obj =& $application->getInstance('MessageResources');
     $retval = '';
     $rows_per_page = modAPIFunc('Paginator', 'getPaginatorRowsPerPage', $pag_name);
     if (!$rows_per_page) {
         $rows_per_page = ROWS_PER_PAGE;
     }
     $currentrows = $rows_per_page;
     $rows_per_page = modApiFunc('Paginator', 'getRowsPerPage');
     $Row_Options = '';
     for ($i = 0; $i < sizeof($rows_per_page); $i++) {
         if ($rows_per_page[$i] == $currentrows) {
             $Row_Options .= '<option selected="selected" value="' . $rows_per_page[$i] . '">' . $rows_per_page[$i] . '</option>';
         } else {
             $Row_Options .= '<option value="' . $rows_per_page[$i] . '">' . $rows_per_page[$i] . '</option>';
         }
     }
     $request = new Request();
     $request->setView(CURRENT_REQUEST_URL);
     $url = $request->getURL();
     $this->paginator_rows = array('ViewName' => $url, 'AdditionalKeyList' => $this->getAdditionalKeyList($add_keys), 'Items_Name' => $obj->getMessage($items_name), 'Row_Options' => $Row_Options, 'pgname' => $pag_name);
     $application->registerAttributes($this->paginator_rows);
     if (modAPIFunc('Paginator', 'getCurrentPaginatorTotalRows') > MIN_ROWS_PER_PAGE) {
         $retval = modApiFunc('TmplFiller', 'fill', "paginator/", "container_rows.tpl.html", array());
     }
     return $retval;
 }
コード例 #2
0
 /**
  * Outputs the search result.
  *
  * @return string.
  */
 function output()
 {
     global $application;
     #define whether to output the view or not
     if ($this->NoView) {
         $application->outputTagErrors(true, "SearchResult", "Errors");
         return "";
     } else {
         $application->outputTagErrors(true, "SearchResult", "Warnings");
     }
     $this->templateFiller = new TemplateFiller();
     $this->template = $application->getBlockTemplate('SearchResult');
     $this->templateFiller->setTemplate($this->template);
     /*
     If the search id doesn't exist in the session, then putput the empty
     template.
     */
     if (modApiFunc('Session', 'is_Set', 'search_result_id')) {
         $this->search_id = $search_id = modApiFunc('Session', 'get', 'search_result_id');
         modAPIFunc('paginator', 'setCurrentPaginatorName', "Catalog_SearchResult_{$search_id}");
         $this->prodlist = modApiFunc('CatalogSearch', 'getProdsListInSearchResult', $search_id, true);
         #If the search result is empty, then output a special template created
         #for such case
         if (NULL != $this->prodlist) {
             $html = $this->templateFiller->fill("Container");
         } else {
             $html = $this->templateFiller->fill("ContainerNotMatch");
         }
     } else {
         $html = $this->templateFiller->fill("ContainerEmpty");
     }
     return $html;
 }
コード例 #3
0
 /**
  * AvactisHomeNews constructor.
  */
 function AcceptedCurrencies()
 {
     $paginator = modAPIFunc('paginator', 'setCurrentPaginatorName', "AcceptedCurrencies");
     if (modApiFunc("Session", "is_Set", "SessionPost")) {
         $this->copyFormData();
         modApiFunc('Session', 'un_Set', 'SessionPost');
     } else {
         $this->initFormData();
     }
 }
 /**
  * The view constructor.
  *
  * @ finish the functions on this page
  */
 function PromoCodesNavigationBar()
 {
     global $application;
     modAPIFunc('Paginator', 'setCurrentPaginatorName', "PromoCodes_List");
     $codes = modApiFunc('PromoCodes', 'getPromoCodesNumber');
     $session =& $application->getInstance('Session');
     if ($session->is_Set('PromoCodeAdded')) {
         modApiFunc('Paginator', 'setPaginatorPageToLast', 'PromoCodes_List', $codes);
         $session->un_Set('PromoCodeAdded');
     }
     $this->mTmplFiller =& $application->getInstance('TmplFiller');
 }
コード例 #5
0
 /**
  * AvactisHomeNews constructor.
  */
 function StatesSettings()
 {
     $paginator = modAPIFunc('paginator', 'setCurrentPaginatorName', "States");
     $this->countries = modApiFunc("Location", "getCountries");
     foreach ($this->countries as $id => $name) {
         if (modApiFunc("Location", "getCountStatesInCountry", $id) == 0) {
             unset($this->countries[$id]);
         }
     }
     if (modApiFunc("Session", "is_Set", "SessionPost")) {
         $this->copyFormData();
         modApiFunc('Session', 'un_Set', 'SessionPost');
     } else {
         $this->initFormData();
     }
 }
コード例 #6
0
 function getItemList()
 {
     $this->paginator_name = 'GiftCertificateList_AZ';
     $paginator = modAPIFunc('paginator', 'setCurrentPaginatorName', $this->paginator_name);
     $f = new GiftCertificateFilter();
     $l = new GiftCertificateList($f);
     $html = '';
     $counter = 0;
     $l->reset();
     while ($gc = $l->next()) {
         $this->__gc_item = $gc;
         $html .= $this->filler->fill("", "items.tpl.html", array());
         $counter++;
     }
     if ($counter < 10) {
         for ($i = 0; $i < 10 - $counter; $i++) {
             $html .= $this->filler->fill("", "items_empty.tpl.html", array());
         }
     }
     return $html;
 }
コード例 #7
0
 /**
  * The view constructor.
  *
  * @ finish the functions on this page
  */
 function ProductList()
 {
     $this->CatID = modApiFunc('CProductListFilter', 'getCurrentCategoryId');
     $this->_Cat_Info = new CCategoryInfo($this->CatID);
     $this->psf_filter = array();
     if (modApiFunc('Session', 'is_set', 'SearchProductFormFilter')) {
         // if product search form is used
         $this->psf_filter = modApiFunc('Session', 'get', 'SearchProductFormFilter');
         // getting the PRODUCT_LIST_PARAMS object to manipulate
         $obj_params = new PRODUCT_LIST_PARAMS();
         $obj_params->category_id = 1;
         $obj_params->select_mode_recursiveness = IN_CATEGORY_RECURSIVELY;
         $obj_params->product_id_list_to_select = $this->psf_filter['result'];
         $obj_params->use_paginator = true;
         // setting the paginator
         $this->paginator_name = 'Catalog_ProdsList_PSF_' . count($this->psf_filter['result']);
         $paginator = modApiFunc('paginator', 'setCurrentPaginatorName', $this->paginator_name);
         // getting the products
         $this->pl = modApiFunc('Catalog', 'getProductListByFilter', $obj_params);
         $this->ProdNumInCat = count($this->psf_filter['result']) - 1;
     } else {
         // otherwise browsing by category
         $this->paginator_name = 'Catalog_ProdsList_' . $this->CatID;
         $paginator = modAPIFunc('paginator', 'setCurrentPaginatorName', $this->paginator_name);
         $this->pl = modApiFunc('Catalog', 'getProductListByGlobalFilter', PAGINATOR_ENABLE, RETURN_AS_ID_LIST);
         $this->ProdNumInCat = $this->_Cat_Info->getCategoryTagValue('productsnumber');
     }
     $SizeOfList = sizeof($this->pl);
     $paginator_offset = modApiFunc('paginator', 'getCurrentPaginatorOffset');
     if ($paginator_offset >= 0 && sizeof($this->pl) > 0) {
         $this->From = 1 + $paginator_offset;
         $this->To = -1 + $this->From + sizeof($this->pl);
     } else {
         $this->From = 0;
         $this->To = 0;
     }
     $this->_build_cats_paths();
     loadClass('CategoriesBrowser');
     $this->cb_params = array('show_category_path' => true, 'category_path_prefix' => '', 'show_products_count' => true, 'buttons' => array());
 }
コード例 #8
0
 /**
  * Outputs the search result.
  *
  * @return string.
  */
 function output()
 {
     global $application;
     /*
     If the search id doesn't exist in the session, then output the empty
     template.
     */
     if (modApiFunc('Session', 'is_Set', 'search_result_id')) {
         $this->search_id = $search_id = modApiFunc('Session', 'get', 'search_result_id');
         modAPIFunc('paginator', 'setCurrentPaginatorName', "Catalog_SearchResult_{$search_id}");
         $this->prodlist = modApiFunc('CatalogSearch', 'getProdsListInSearchResult', $search_id, true);
         # If the search result is empty, then output a special template created
         #for such case
         if (NULL != $this->prodlist) {
             $html = modApiFunc('TmplFiller', 'fill', "catalog/search_result/", "search-result-container.tpl.html", array());
         } else {
             $html = modApiFunc('TmplFiller', 'fill', "catalog/search_result/", "search-result-container-notmatch.tpl.html", array());
         }
     } else {
         $html = modApiFunc('TmplFiller', 'fill', "catalog/search_result/", "search-result-container-empty.tpl.html", array());
     }
     return $html;
 }
コード例 #9
0
 function initQuery($params)
 {
     $tables = Catalog::getTables();
     $pa = $tables['product_attributes']['columns'];
     if (modAPIFunc('Catalog', 'isMLAttribute', $params['aid'])) {
         $this->addMultiLangUpdateValue($pa['attr_value'], $params['value'], $pa['id'], '', 'Catalog');
     } else {
         $this->addUpdateValue($pa['attr_value'], $params['value']);
     }
     $this->WhereValue($pa['p_id'], DB_EQ, $params['pid']);
     $this->WhereAND();
     $this->WhereValue($pa['a_id'], DB_EQ, $params['aid']);
 }
コード例 #10
0
 /**
  * Updates the product quantity in the stock after the order confirmation.
  */
 function updateProductsQuantity($products, $mult)
 {
     $_affected_products = array();
     foreach ($products as $prodInfo) {
         //: the attribute is used by the id, it needs to be rewritten
         //check if the attribute of the QuantityInStock product is visible
         if (!modApiFunc("Catalog", "isProductAttributeVisible", $prodInfo['storeProductID'], 3)) {
             continue;
         }
         $prodObj = new CProductInfo($prodInfo['storeProductID']);
         if ($prodObj->_fProductIDIsIncorrect === false) {
             //                                    ,      QuantityInStock
             $productQuantityInStock = $prodObj->getProductTagValue('QuantityInStock', PRODUCTINFO_NOT_LOCALIZED_DATA);
             if (!is_numeric($productQuantityInStock)) {
                 /*
                                          ,                   ,                      ,
                                  QuantityInStock,  . .                    .
                                                 .
                 */
                 continue;
             }
             execQuery('UPDATE_PRODUCT_QUANTITY_ATTRIBUTE', array('mult' => $mult, 'qty' => $prodInfo['qty'], 'p_id' => $prodInfo['storeProductID']));
             $_affected_products[] = $prodInfo['storeProductID'];
             $cats_ids = $prodObj->getCategoriesIDs();
             foreach ($cats_ids as $category_id) {
                 modAPIFunc('paginator', 'resetPaginator', "Catalog_ProdsList_" . $category_id);
             }
         }
     }
     modApiFunc('EventsManager', 'throwEvent', 'ProductQuantityChanged', $_affected_products);
 }
コード例 #11
0
 /**
  * Returns the HTML code of the product number in the list outputted on
  * the page.
  *
  * @return HTML code
  */
 function outputRows_Per_Page($CatID)
 {
     return modAPIFunc('application', 'output', 'PaginatorRows', "Catalog_DeleteProducts_{$CatID}", 'DeleteProducts', 'products');
 }
コード例 #12
0
 /**
  * Returns the page links line.
  *
  * @return string paginator view in the type of paginal references
  * @ finish the functions on this page
  */
 function output($pag_name, $viewname, $cat_id = -1, $prod_id = -1)
 {
     global $application;
     $viewname = CURRENT_REQUEST_URL;
     #Define whether to output the view or not
     if ($this->NoView) {
         $application->outputTagErrors(true, "PaginatorLine", "Errors");
         return "";
     }
     $this->templateFiller =& $application->getInstance('TemplateFiller');
     $this->template = $application->getBlockTemplate('PaginatorLine');
     $this->templateFiller->setTemplate($this->template);
     $retval = '';
     //Output a paginator view with the page number,
     //form the link of the type ?action=setpage&pgname=$pag_name&pgnum=$i
     $rows_per_page = modAPIFunc('Paginator', 'getPaginatorRowsPerPage', $pag_name);
     if (!$rows_per_page) {
         $rows_per_page = ROWS_PER_PAGE;
     }
     $pages = ceil(modAPIFunc('Paginator', 'getCurrentPaginatorTotalRows') / $rows_per_page);
     $lines = ceil($pages / PAGES_PER_LINE);
     $currentpage = modAPIFunc('Paginator', 'getPaginatorPage', $pag_name);
     $currentrows = modAPIFunc('Paginator', 'getPaginatorRowsPerPage', $pag_name);
     $currentline = ceil($currentpage / PAGES_PER_LINE);
     //$firstpageinline = ($currentline - 1)*PAGES_PER_LINE+1;
     $lastpageinline = $currentline * PAGES_PER_LINE;
     if ($lastpageinline > $pages) {
         $lastpageinline = $pages;
     }
     $firstpageinline = $lastpageinline - PAGES_PER_LINE + 1;
     if ($firstpageinline <= 0) {
         $firstpageinline = 1;
     }
     $this->_Data = array('Local_Items' => '', 'Local_From' => '', 'Local_To' => '', 'Local_Of' => '', 'Local_CurrentPage' => '', 'Local_PagesQty' => '', 'Local_ViewAll' => '');
     $request = new Request();
     $request->setView($viewname);
     $request->setAction('Paginator_SetPage');
     $request->setKey('pgname', $pag_name);
     $request->setKey('pgnum', $currentpage - 1);
     $request->setCategoryID($cat_id);
     $request->setProductID($prod_id);
     $this->_Data = array_merge($this->_Data, array('Local_PageLink' => $request->getURL(), 'Local_PageNumber' => ''));
     $retval = '';
     $paginator_line = '';
     if ($currentpage != 1) {
         $application->registerAttributes($this->_Data);
         $paginator_line .= $this->templateFiller->fill("Prev");
     }
     if ($firstpageinline != 1) {
         $paginator_line .= CZ_getMsg("PAGINATOR_DOTS");
     }
     for ($i = $firstpageinline; $i <= $lastpageinline; $i++) {
         $request = new Request();
         $request->setView($viewname);
         $request->setAction('Paginator_SetPage');
         $request->setKey('pgname', $pag_name);
         $request->setKey('pgnum', $i);
         $request->setCategoryID($cat_id);
         $this->_Data = array_merge($this->_Data, array('Local_PageLink' => $request->getURL(), 'Local_PageNumber' => $i));
         $application->registerAttributes($this->_Data);
         if ($i == $currentpage) {
             $paginator_line .= $this->templateFiller->fill("ItemSelected");
         } else {
             $paginator_line .= $this->templateFiller->fill("Item");
         }
     }
     if ($lastpageinline != $pages) {
         $paginator_line .= CZ_getMsg("PAGINATOR_DOTS");
     }
     $request = new Request();
     $request->setView($viewname);
     $request->setAction('Paginator_SetPage');
     $request->setKey('pgname', $pag_name);
     $request->setKey('pgnum', $currentpage + 1);
     $request->setCategoryID($cat_id);
     $this->_Data = array_merge($this->_Data, array('Local_PageLink' => $request->getURL(), 'Local_PageNumber' => ''));
     if ($currentpage != $pages && $pages != 0) {
         $paginator_line .= $this->templateFiller->fill("Next");
     }
     $request = new Request();
     $request->setView($viewname);
     $request->setAction('Paginator_SetRowsPerPage');
     $request->setKey('pgname', $pag_name);
     $request->setKey('rows', modAPIFunc('Paginator', 'getCurrentPaginatorTotalRows'));
     $request->setCategoryID($cat_id);
     $to = $currentpage * $rows_per_page;
     $total_rows = modAPIFunc('Paginator', 'getCurrentPaginatorTotalRows');
     if ($to > $total_rows) {
         $to = $total_rows;
     }
     $this->_Data = array_merge($this->_Data, array('Local_Items' => $pages > 1 ? $paginator_line : "", 'Local_From' => ($currentpage - 1) * $rows_per_page + 1, 'Local_To' => $to, 'Local_Of' => $total_rows, 'Local_CurrentPage' => $currentpage, 'Local_PagesQty' => $pages, 'Local_ViewAll' => $request->getURL()));
     $application->registerAttributes($this->_Data);
     if ($pages > 1) {
         $retval = $this->templateFiller->fill("Container");
     } else {
         $retval = $this->templateFiller->fill("Empty");
     }
     //        $retval = $this->templateFiller->fill("Container");
     return $retval;
 }
コード例 #13
0
 function getCFldValues()
 {
     global $application;
     $values = "";
     if ($this->mode == "add") {
         $values = "";
         if (isset($this->field_data['postdata']['customFieldValues'])) {
             $values = $this->field_data['postdata']['customFieldValues'];
         }
     } else {
         $itid = $this->field_data[0]['input_type_id'];
         $tables = modAPIFunc("Catalog", "getTables");
         $t_input_type_values = $tables['input_type_values']['columns'];
         $query = new DB_Select();
         $query->setMultiLangAlias('_ml_value', 'input_type_values', $t_input_type_values['value'], $t_input_type_values['id'], 'Catalog');
         $query->addSelectField($query->getMultiLangAlias('_ml_value'), 'value');
         $query->WhereValue($t_input_type_values['it_id'], DB_EQ, $itid);
         $query->SelectOrder($t_input_type_values['id'], 'ASC');
         $result = $application->db->getDB_Result($query);
         foreach ($result as $r) {
             $values .= modApiFunc('Catalog', 'getInputTypeActualValue', $r['value']) . "\n";
         }
     }
     return "<textarea class=\"form-control\"" . $this->HtmlForm->genInputTextAreaField(20, 'customFieldValues', 5) . " id='customFieldValues' disabled=disabled>" . $values . "</textarea>";
 }
コード例 #14
0
 function getTimelineHeaders()
 {
     modAPIFunc('paginator', 'setCurrentPaginatorName', "TimelinePaginator");
     $text_filter_data = modApiFunc('Timeline', 'getFilterByText');
     if ($text_filter_data != null and isset($text_filter_data[0]) and isset($text_filter_data[1]) and is_array($text_filter_data[1])) {
         list($user_input, $index_words_list) = $text_filter_data;
     } else {
         $index_words_list = null;
     }
     $params = array('index_words_list' => $index_words_list, 'types' => $this->getFilterByTypes(), 'paginator' => null);
     $params['paginator'] = execQueryPaginator('SELECT_TIMELINE_HEADERS', $params);
     return execQuery('SELECT_TIMELINE_HEADERS', $params);
 }
コード例 #15
0
 /**
  * Returns the Product Listing view.
  *
  * @return string the Products List view.
  */
 function output()
 {
     global $application;
     $this->__index = 0;
     //                                           .
     $in_param = @func_get_arg(0);
     //                        -                        CProductSetTagSettings,
     if (_is_a($in_param, 'CProductSetTagSettings')) {
         $this->__tag_settings = $in_param;
     } else {
         //                            CProductSetTagSettings
         $this->__tag_settings = new CProductSetTagSettings();
     }
     //                                         hash
     $this->__filter_hash = $this->__tag_settings->filter->category_id;
     $this->__paginator_name = "Catalog_ProductSet_" . $this->__filter_hash;
     modAPIFunc('paginator', 'setCurrentPaginatorName', $this->__paginator_name);
     //                    -      (         )
     $this->registerAttributes();
     //
     $this->__tmpl_filler = new TmplFiller($this->__tag_settings->template['Directory']);
     $cols = @func_get_arg(1);
     if ($cols !== false && is_numeric($cols)) {
         $this->columns = $cols;
     } else {
         $this->columns = 3;
     }
     //
     $this->__product_list_to_display = $this->getProductListToDisplay();
     if (NULL == $this->__product_list_to_display || empty($this->__product_list_to_display)) {
         $retval = $this->__tmpl_filler->fill("", $this->__tag_settings->template['ContainerEmpty'], array(), true);
     } else {
         $retval = $this->__tmpl_filler->fill("", $this->__tag_settings->template['Container'], array(), true);
     }
     return $retval;
 }
コード例 #16
0
 /**
  * Returns the Select box view with possible variants of rows
  * per the page.
  *
  * @return Select box with possible page values outputted on the page.
  * @ finish the functions on this page
  */
 function output($pag_name, $viewname, $items_name = 'products')
 {
     global $application;
     #Define whether to output the view or not
     if ($this->NoView) {
         $application->outputTagErrors(true, "PaginatorRows", "Errors");
         return "";
     }
     $this->templateFiller =& $application->getInstance('TemplateFiller');
     $this->template = $application->getBlockTemplate('PaginatorDropdown');
     $this->templateFiller->setTemplate($this->template);
     $retval = '';
     $rows_per_page = modAPIFunc('Paginator', 'getPaginatorRowsPerPage', $pag_name);
     if (!$rows_per_page) {
         $rows_per_page = ROWS_PER_PAGE;
     }
     $currentrows = $rows_per_page;
     $rows_per_page = modApiFunc('Paginator', 'getRowsPerPage');
     $_rows_per_page = array();
     foreach ($rows_per_page as $value) {
         $_rows_per_page[$value] = $value;
     }
     $Row_Options = '';
     $selected_flag = false;
     foreach ($_rows_per_page as $option_value => $option_text) {
         if ($option_value == $currentrows) {
             $Row_Options .= '<option selected="selected" value="' . $option_value . '">' . $option_text . '</option>';
             $selected_flag = true;
         } else {
             $Row_Options .= '<option value="' . $option_value . '">' . $option_text . '</option>';
         }
     }
     $Row_Options .= '<option ' . ($selected_flag ? '' : 'selected="selected"') . 'value="' . modAPIFunc('Paginator', 'getCurrentPaginatorTotalRows') . '">' . CZ_getMsg("PAGINATOR_VIEW_ALL") . '</option>';
     $request = new Request();
     $request->setView(CURRENT_REQUEST_URL);
     $url = $request->getURL();
     $this->_Page = array('Local_FormAction' => $url, 'Local_FormId' => 'Paginator', 'Local_FormActionFieldName' => 'asc_action', 'Local_FormActionFieldValue' => 'Paginator_SetRowsPerPage', 'Local_FormPaginatorFieldName' => 'pgname', 'Local_FormPaginatorFieldValue' => $pag_name, 'Local_ItemsName' => $items_name, 'Local_FormSelectFieldName' => 'rows', 'Local_FormSelectOptions' => $Row_Options);
     $application->registerAttributes($this->_Page);
     if (modAPIFunc('Paginator', 'getCurrentPaginatorTotalRows') > MIN_ROWS_PER_PAGE) {
         $retval = $this->templateFiller->fill("Container");
     } else {
         $retval = $this->templateFiller->fill("Empty");
     }
     return $retval;
 }
コード例 #17
0
 function initShowTopic()
 {
     $this->_search_email = trim(modApiFunc('Request', 'getValueByKey', 'email'));
     $var = 'Subscription_Email_Search_' . $this->_topic_id;
     $this->_prev_search_email = modApifunc('Session', 'is_set', $var) ? modApifunc('Session', 'get', $var) : '';
     modApiFunc('Session', 'set', $var, $this->_search_email);
     $this->_topic = modApiFunc('Subscriptions', 'getTopic', $this->_topic_id);
     if (empty($this->_topic)) {
         return;
     }
     $this->_pager_name = 'Subscription_Topic_' . $this->_topic_id;
     modAPIFunc('Paginator', 'setCurrentPaginatorName', $this->_pager_name);
     $page = modApiFunc('Paginator', 'getPaginatorPage', $this->_pager_name);
     if ($page <= 0) {
         modapiFunc('Paginator', 'resetPaginator', $this->_pager_name);
     }
     if ($this->_search_email != $this->_prev_search_email) {
         modApiFunc('Paginator', 'resetPaginator', $this->_pager_name);
     }
     $this->emails =& $this->fetchEmails();
     $paginator_offset = modApiFunc('paginator', 'getCurrentPaginatorOffset');
     $this->emails_total = modAPIFunc('paginator', 'getCurrentPaginatorTotalRows');
     $emails_per_page = modAPIFunc('paginator', 'getPaginatorRowsPerPage', $this->_pager_name);
     if ($paginator_offset >= 0 && $this->emails_total > 0) {
         $this->emails_from = 1 + $paginator_offset;
         $this->emails_to = min($paginator_offset + $emails_per_page, $this->emails_total);
     } else {
         $this->emails_from = 0;
         $this->emails_to = 0;
     }
 }
コード例 #18
0
 /**
  * Returns the page links line.
  *
  * @return string paginator view in the type of paginal references
  * @ finish the functions on this page
  */
 function output($pag_name, $viewname, $add_keys = null)
 {
     global $application;
     $obj =& $application->getInstance('MessageResources');
     $retval = '';
     //Output a paginator view with the page number,
     //form the link of the type ?action=setpage&pgname=$pag_name&pgnum=$i
     $rows_per_page = modAPIFunc('Paginator', 'getPaginatorRowsPerPage', $pag_name);
     if (!$rows_per_page) {
         $rows_per_page = ROWS_PER_PAGE;
     }
     $pages = ceil(modAPIFunc('Paginator', 'getCurrentPaginatorTotalRows') / $rows_per_page);
     $lines = ceil($pages / PAGES_PER_LINE);
     $currentpage = modAPIFunc('Paginator', 'getPaginatorPage', $pag_name);
     $currentrows = modAPIFunc('Paginator', 'getPaginatorRowsPerPage', $pag_name);
     $currentline = ceil($currentpage / PAGES_PER_LINE);
     $firstpageinline = ($currentline - 1) * PAGES_PER_LINE + 1;
     $lastpageinline = $currentline * PAGES_PER_LINE;
     if ($lastpageinline > $pages) {
         $lastpageinline = $pages;
     }
     $request = new Request();
     $request->setView($viewname);
     $request->setAction('Paginator_SetPage');
     $this->addKeysToRequest($request, $add_keys);
     $request->setKey('pgname', $pag_name);
     $request->setKey('pgnum', $firstpageinline - 1);
     $this->prefix = array('Pre_Item_Link' => $request->getURL(), 'Pre_Item' => $obj->getMessage('PGNTR_PREV'));
     $request = new Request();
     $request->setView($viewname);
     $request->setAction('Paginator_SetPage');
     $this->addKeysToRequest($request, $add_keys);
     $request->setKey('pgname', $pag_name);
     $request->setKey('pgnum', $lastpageinline + 1);
     $this->postfix = array('Post_Item_Link' => $request->getURL(), 'Post_Item' => $obj->getMessage('PGNTR_NEXT'));
     $application->registerAttributes($this->prefix);
     $application->registerAttributes($this->postfix);
     $retval = '';
     $paginator_line = '';
     if ($currentline != 1) {
         $paginator_line .= modApiFunc('TmplFiller', 'fill', "paginator/", "item_prev.tpl.html", array());
     }
     for ($i = $firstpageinline; $i <= $lastpageinline; $i++) {
         $request = new Request();
         $request->setView($viewname);
         $request->setAction('Paginator_SetPage');
         $this->addKeysToRequest($request, $add_keys);
         $request->setKey('pgname', $pag_name);
         $request->setKey('pgnum', $i);
         $this->page = array('Item_Link' => $request->getURL(), 'Item' => $i);
         $application->registerAttributes($this->page);
         if ($i == $currentpage) {
             $paginator_line .= modApiFunc('TmplFiller', 'fill', "paginator/", "selected_item.tpl.html", array());
         } else {
             $paginator_line .= modApiFunc('TmplFiller', 'fill', "paginator/", "item.tpl.html", array());
         }
     }
     if ($currentline != $lines && $lines != 0) {
         $paginator_line .= modApiFunc('TmplFiller', 'fill', "paginator/", "item_next.tpl.html", array());
     }
     $this->paginator = $paginator_line;
     if ($pages > 1) {
         $retval = modApiFunc('TmplFiller', 'fill', "paginator/", "container.tpl.html", array());
     }
     return $retval;
 }
コード例 #19
0
 /**
  * Outputs the total line for search results
  */
 function outputSearchTotal()
 {
     $total = modAPIFunc('Paginator', 'getCurrentPaginatorTotalRows');
     if ($total > 0) {
         $output = $total . ' ' . ($total == 1 ? getMsg('ML', 'ML_ONE_LABEL_FOUND') : getMsg('ML', 'ML_SEVERAL_LABELS_FOUND')) . ' ' . getMsg('ML', 'ML_SHOWING') . ' ';
         if (isset($this->_search_filter['paginator'])) {
             $output .= $this->_search_filter['paginator'][0] + 1 . ' - ' . min($this->_search_filter['paginator'][0] + $this->_search_filter['paginator'][1], $total);
         } else {
             $output .= '1 - ' . $total;
         }
     } else {
         $output = getMsg('ML', 'ML_NO_LABELS_FOUND');
     }
     return $output;
 }
コード例 #20
0
 /**
  * Returns the Product Listing view.
  *
  * @return string the Products List view.
  */
 function output()
 {
     global $application;
     #define whether to output the view or not
     if ($this->NoView) {
         $application->outputTagErrors(true, __CLASS__, "Errors");
         return "";
     } else {
         $application->outputTagErrors(true, __CLASS__, "Warnings");
     }
     //                                           .
     $in_param = @func_get_arg(0);
     //                        -                        CProductListTagSettings,
     if (_is_a($in_param, 'CProductListTagSettings')) {
         $this->pl_tag_settings = $in_param;
     } else {
         //                            CProductListTagSettings
         $this->pl_tag_settings = new CProductListTagSettings();
         //                                       ,
         if ($in_param === false || $in_param === null) {
             $this->pl_tag_settings->filter = modApiFunc('CProductListFilter', 'getProductListParamsObject');
             //                                 (default                                       )
             //                                                   -
             $this->pl_tag_settings->filter->use_paginator = true;
         } else {
             //                        ,                  CProductListTagSettings,
             //                 Category Id,
             $category_id_to_read_from = $in_param;
             if (modApiFunc('Catalog', 'isCorrectCategoryId', $category_id_to_read_from)) {
                 //                         ,                                         Show products from all subcategories
                 $this->pl_tag_settings->product_list_filter_object->disableSynchronization();
                 $this->pl_tag_settings->product_list_filter_object->changeCurrentCategoryId($category_id_to_read_from);
                 $this->pl_tag_settings->updateFilterParams();
             }
         }
     }
     //
     $this->pagParam = $this->pl_tag_settings->filter->category_id;
     $category = new CCategoryInfo($this->pagParam);
     $category_status = $category->getCategoryTagValue('status');
     if ($category_status == CATEGORY_STATUS_OFFLINE) {
         $request = new Request();
         $request->setView('Index');
         $application->redirect($request);
         return;
     }
     $this->pagName = modApiFunc('CProductListFilter', 'getMnfPaginatorName');
     if (!$this->pagName) {
         $this->pagName = "Catalog_ProdsList_" . $this->pl_tag_settings->filter->category_id;
     }
     modAPIFunc('paginator', 'setCurrentPaginatorName', $this->getPagName());
     //
     $this->registerAttributes();
     $this->templateFiller = new TemplateFiller();
     $this->templateFiller->setTemplate($this->pl_tag_settings->getTemplate());
     $this->_product_form_action = getpageurl('CartContent');
     $cols = @func_get_arg(1);
     if ($cols !== false && is_numeric($cols)) {
         $this->columns = $cols;
     } else {
         $this->columns = intval($application->getBlockOption($this->pl_tag_settings->getTemplate(), "Columns"));
     }
     //
     $this->pl = $this->getPL();
     if (NULL == $this->pl) {
         $retval = $this->templateFiller->fill("ContainerEmpty");
     } else {
         $retval = $this->templateFiller->fill("Container");
     }
     return $retval;
 }