Beispiel #1
0
 function __construct()
 {
     $jinput = JFactory::getApplication()->input;
     $this->Itemid = $jinput->get('Itemid');
     $this->view = $jinput->get('view');
     $this->layout = $jinput->get('layout');
     $this->cid = $jinput->get('cid');
     // product id or other type of id?
     $this->task = $jinput->get('task');
     // e.g. show
     $this->ctrl = $jinput->get('ctrl');
     // e.g. product
     $this->option = $jinput->get('option');
     $this->step = $jinput->get('step');
     $this->name = $jinput->get('name');
     $this->layout = $jinput->get('layout');
     // e.g. listing
     $this->product_id = $jinput->get('product_id');
     // e.g. on direct product pages
     $this->menu_main_category = $jinput->get('menu_main_category');
     // e.g. 2
     if ($this->option == 'com_hikashop' and $this->view == 'product' and $this->layout == 'show' and $this->cid == '') {
         // for some reason you can specify more than 1 item when setting up this type of menu item,
         // but the page only actually displays the 1st one.
         $tmp_cid_arr = JomGeniusParent::menuItemParam('product_id');
         if (is_array($tmp_cid_arr) and count($tmp_cid_arr)) {
             $this->cid = $tmp_cid_arr[0];
         }
     }
     return;
     // use the following as a template for how to deal with different page types for Hikashop, when necessary...
     // What happens when the URL is "&option=com_hikashop&Itemid=XXX", so there's no "page" in the query string?
     // Borrowed from hikashop_parser.php to get the logic of how to interpret a request when there's a menu item
     // and itemid for the page, but the _GET has no "page" in it.
     if ($this->option == 'com_hikashop' and !isset($_REQUEST['page'])) {
         /* need to revisit all these for VM1.98 / J1.7 FIXME */
         $tmp_product_id = JomGeniusParent::menuItemParam('product_id');
         $tmp_category_id = JomGeniusParent::menuItemParam('category_id');
         $tmp_flypage = JomGeniusParent::menuItemParam('flypage');
         $tmp_page = JomGeniusParent::menuItemParam('page');
         if (!empty($tmp_product_id)) {
             $this->product_id = $tmp_product_id;
             $this->view = 'productdetails';
             // new
         } elseif (!empty($tmp_category_id)) {
             $this->category_id = $tmp_category_id;
             $this->view = 'category';
             // new
         }
         if ((!empty($tmp_product_id) || !empty($tmp_category_id)) && !empty($tmp_flypage)) {
             $this->flypage = $tmp_flypage;
             // not actually used here...
         }
         if (!empty($tmp_page)) {
             $this->page = $tmp_page;
         }
     }
 }
Beispiel #2
0
	function __construct() {
		$this->Itemid		= JRequest::getVar('Itemid');
		$this->product_id	= JRequest::getVar('virtuemart_product_id');
		$this->view			= JRequest::getWord('view');
		$this->option		= JRequest::getVar('option');
		$this->category_id	= JRequest::getVar('virtuemart_category_id');
		$this->layout		= JRequest::getVar('layout');
		$this->addrtype		= JRequest::getVar('addrtype');
		$this->task			= JRequest::getVar('task');
		
		// What happens when the URL is "&option=com_virtuemart&Itemid=XXX", so there's no "page" in the query string?
		// Borrowed from virtuemart_parser.php to get the logic of how to interpret a request when there's a menu item
		// and itemid for the page, but the _GET has no "page" in it.
		
		if ( $this->option == 'com_virtuemart' and !isset( $_REQUEST['page']) ) {
			
			/* need to revisit all these for VM1.98 / J1.7 FIXME */
			$tmp_product_id			= JomGeniusParent::menuItemParam( 'product_id' );
			$tmp_category_id		= JomGeniusParent::menuItemParam( 'category_id' );
			$tmp_flypage			= JomGeniusParent::menuItemParam( 'flypage' );
			$tmp_page				= JomGeniusParent::menuItemParam( 'page' );

			if( !empty( $tmp_product_id ) ) {
				$this->product_id	= $tmp_product_id;
				$this->view			= 'productdetails'; // new
			} elseif( !empty( $tmp_category_id ) ) {
				$this->category_id	= $tmp_category_id ;
				$this->view			= 'category'; // new
			}

			if( ( !empty( $tmp_product_id ) || !empty( $tmp_category_id ) ) && !empty( $tmp_flypage ) ) {
				$this->flypage		= $tmp_flypage; // not actually used here...
			}

			if( !empty( $tmp_page ) ) {
				$this->page			= $tmp_page;
			}
		}
	}
 /**
  * grab just one parameter value
  */
 function menuItemParam($paramName, $default = null)
 {
     static $params = null;
     if ($params == null) {
         $params = JomGeniusParent::menuItemParams();
     }
     if ($params == null) {
         return null;
     }
     return $params->get($paramName, $default);
 }
Beispiel #4
0
Datei: k2.php Projekt: JozefAB/qk
 function ancestorCategoryNames()
 {
     if ($this->option != 'com_k2') {
         return null;
     }
     $category_ids = null;
     // 1 - get the category id if we are on a category page (single category itemlist)
     if ($this->view == "itemlist" and $this->task == "category" and ($this->layout == "category" or $this->layout == '') and $this->id != '') {
         /* category list pages with a single category */
         $category_ids = array((int) $this->id);
     }
     // multiple categories:
     if ($this->view == "itemlist" and $this->layout == "category" and $this->id == '') {
         /* category list pages with a single category */
         $category_ids = parent::menuItemParam('categories');
     }
     // 2 - get the category ids if we are on a latest items page with any number of categories selected
     if ($this->view == "latest" and $this->layout == "latest") {
         // On this type of page, it's only showing items directly in the categories specified, NOT their ancestors.
         // However, we will use this function to return the list of all ancestors as well as
         $category_ids = parent::menuItemParam('categoryIDs');
     }
     // if the layout is blank, that means we're on an an-hoc user page, and (int)$id refers to the
     // user. In that case I don't think there's a category filter active.
     if ($this->view == 'itemlist' and $this->task == 'user' and $this->layout == 'user') {
         $category_ids = parent::menuItemParam('userCategoriesFilter');
     }
     // 3 - get the category ids if we are on an item page.
     if ($this->view == 'item') {
         $row = $this->_infoForItemId((int) $this->id);
         // this has all the ancestors in it. No need to re-query to get the list.
         return @$row->ancestor_category_names;
     }
     // if we got to here, we have a list of category ids that the page was DIRECTLY
     // about. So we need to query this database for all ancestors of the categories
     // mentioned.
     if (!is_null($category_ids)) {
         if (!is_array($category_ids)) {
             $category_ids = array($category_ids);
         }
         $rows = $this->_infoForCategoryIds($category_ids);
         if ($rows) {
             $ret = array();
             foreach ($rows as $row) {
                 $ret = array_unique(array_merge($ret, $row->ancestor_category_names));
             }
             return $ret;
         }
     }
 }