/** * Display the view * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * * @return void */ public function display($tpl = null) { $app = JFactory::getApplication(); $user = JFactory::getUser(); if (!$user->id) { ?> <div class="<?php echo Q2C_WRAPPER_CLASS; ?> my-coupons"> <div class="well" > <div class="alert alert-error"> <span><?php echo JText::_('QTC_LOGIN'); ?> </span> </div> </div> </div> <?php return false; } $zoneHelper = new zoneHelper(); // Check whether view is accessible to user if (!$zoneHelper->isUserAccessible()) { return; } $this->state = $this->get('State'); $this->items = $this->get('Items'); $this->pagination = $this->get('Pagination'); $this->params = $app->getParams('com_quick2cart'); // Check for errors. if (count($errors = $this->get('Errors'))) { throw new Exception(implode("\n", $errors)); } $this->publish_states = array('' => JText::_('JOPTION_SELECT_PUBLISHED'), '1' => JText::_('JPUBLISHED'), '0' => JText::_('JUNPUBLISHED')); // Get toolbar path $comquick2cartHelper = new comquick2cartHelper(); $this->toolbar_view_path = $comquick2cartHelper->getViewpath('vendor', 'toolbar'); // get store id (list))from model and pass to getManagecoupon() $this->store_role_list = $store_role_list = $comquick2cartHelper->getStoreIds(); if ($this->store_role_list) { $this->store_id = $store_id = !empty($change_storeto) ? $change_storeto : $store_role_list[0]['store_id']; $this->selected_store = $store_id; if ($this->store_id) { //$this->authorized_store_id= storeid of user $this->authorized_store_id = $authorized_store_id = $comquick2cartHelper->createCouponAuthority($store_id); } } // Setup TJ toolbar $this->addTJtoolbar(); $this->_prepareDocument(); parent::display($tpl); }
function display($tpl = null) { $mainframe = JFactory::getApplication(); $input = $mainframe->input; $comquick2cartHelper = new comquick2cartHelper(); // check for multivender COMPONENT PARAM $isMultivenderOFFmsg = $comquick2cartHelper->isMultivenderOFF(); if (!empty($isMultivenderOFFmsg)) { print $isMultivenderOFFmsg; return false; } $option = $input->get('option'); $filter_order_Dir = $mainframe->getUserStateFromRequest("{$option}.filter_order_Dir", 'filter_order_Dir', 'desc', 'word'); $filter_type = $mainframe->getUserStateFromRequest("{$option}.filter_type", 'filter_type', 0, 'string'); $filter_state = $mainframe->getUserStateFromRequest($option . 'search_list', 'search_list', '', 'string'); $search = $mainframe->getUserStateFromRequest($option . 'search', 'search', '', 'string'); $search = JString::strtolower($search); $limit = ''; $limitstart = ''; $cid[0] = ''; if ($search == null) { $search = ''; } $edit = $input->get('edit', ''); $layout = $input->get('layout', ''); $cid = $input->get('cid', '', 'ARRAY'); $model = $this->getModel('Managecoupon'); // get store id (list))from model and pass to getManagecoupon() $this->store_role_list = $store_role_list = $comquick2cartHelper->getStoreIds(); // retrun store_id,role etc with order by role,store_id $change_store = $input->get->get('change_store', 0, 'INT'); // $this->authorized_store_id=$comquick2cartHelper->store_authorize("managecoupon_default",isset($change_storeto)?$change_storeto:$store_role_list[0]['store_id']); $this->store_id = $store_id = !empty($change_storeto) ? $change_storeto : $store_role_list[0]['store_id']; $this->selected_store = $store_id; // if user has store OR has ROLE to create then only create coupon or view list :: following coupon return store_id if EXIST if ($cid) { //$total = $this->get( 'Total'); $pagination = $this->get('Pagination'); $this->authorized_store_id = $authorized_store_id = $comquick2cartHelper->createCouponAuthority($store_id, $cid[0]); //$this->authorized_store_id= storeid of user $coupons = $model->Editlist($cid[0]); $limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', 'limit', 'int'); $limitstart = $mainframe->getUserStateFromRequest($option . 'limitstart', 'limitstart', 0, 'int'); $model->setState('limit', $limit); // Set the limit variable for query later on $model->setState('limitstart', $limitstart); } else { /************ list view and new *******************/ $this->authorized_store_id = $authorized_store_id = $comquick2cartHelper->createCouponAuthority($store_id); //$this->authorized_store_id= storeid of user if (!empty($authorized_store_id)) { if (!empty($store_id)) { $coupons = $model->getManagecoupon($store_id); //($authorized_store_id); $pagination = $model->getPagination($store_id); } /*if( !empty($change_storeto)) // fetch coupon list according to new store { $coupons = $model->getManagecoupon($change_storeto);//($authorized_store_id); $this->selected_store=$change_storeto; } else if( !empty($store_role_list)) { $this->selected_store=$store_role_list[0]['store_id']; $coupons = $model->getManagecoupon($store_role_list[0]['store_id']);//($authorized_store_id); }*/ } $limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', 'limit', 'int'); $limitstart = $mainframe->getUserStateFromRequest($option . 'limitstart', 'limitstart', 0, 'int'); $model->setState('limit', $limit); // Set the limit variable for query later on $model->setState('limitstart', $limitstart); } // search filter $lists['search_select'] = $search; $lists['search'] = $search; $lists['search_list'] = $filter_state; $lists['order'] = $filter_type; $lists['order_Dir'] = $filter_order_Dir; $lists['limit'] = $limit; $lists['limitstart'] = $limitstart; // Get data from the model $this->assignRef('lists', $lists); $this->assignRef('pagination', $pagination); if (!empty($coupons)) { $this->assignRef('coupons', $coupons); } $this->_setToolBar(); parent::display($tpl); }