private function _default_report() { $this->data->report_type = "productpricing"; $this->session->set_userdata("report_type", $this->data->report_type); $this->data->my = 'productpricing'; $this->data->report_chart = 'line'; $this->data->icon = 'ico-report'; $this->data->widget = 'mv-report'; $this->data->date_from = 'Start'; $this->data->date_to = 'Stop'; $this->data->mode = ''; $this->data->report_name = $this->data->file_name = ''; $this->data->flagDates24 = false; $this->data->report_where = array(); $this->data->product_ids = array(); $this->data->searchProducts = array(); $this->data->merchants = array(); $this->data->markets = array(); $this->data->displayBookmark = true; $this->data->Data = null; $this->data->show_comparison = false; // for filter by merchant/marketplace $this->data->proMerchants = array(); //$this->data->markertArr = getMarketArray($this->store_id); $this->data->marketplaceArr = getMarketplaceArray($this->store_id); $this->data->retailerArr = getRetailerArray(false, $this->store_id); $this->data->all_markets = (bool) $this->input->post('all_markets'); $this->data->all_retailers = ((bool) $this->input->post('all_retailers') and !empty($this->subscriber_retailer_addons)); //display data $this->data->submitted = (bool) $this->input->post('formSubmit'); $this->data->time_frame = $this->data->submitted ? $this->input->post('time_frame') : ''; $this->data->dateStartField = !$this->data->submitted || $this->data->submitted && $this->data->time_frame != '' ? 'Start' : $this->input->post('date_from'); $this->data->dateEndField = !$this->data->submitted || $this->data->submitted && $this->data->time_frame != '' ? 'Stop' : $this->input->post('date_to'); $this->data->noRecord = $this->config->item('no_record'); }
private function _default_report() { $this->data->report_name = ''; $this->data->report_type = $this->data->my = 'pricingviolation'; $this->data->icon = 'ico-report'; $this->data->widget = 'mv-report'; $this->data->displayBookmark = true; //almost all of the controller functions use the same basic data $this->data->report_chart = NULL; $this->data->Data = NULL; $this->data->graphDataType = 'chart'; $this->data->products = $this->data->productNames = $this->data->merchants = $this->data->markets = $this->data->proMerchants = array(); $this->data->markertArr = getMarketArray(); $this->data->marketplaceArr = getMarketplaceArray(); $this->data->retailerArr = getRetailerArray(false, $this->store_id); $this->data->all_markets = (bool) $this->input->post('all_markets'); $this->data->all_retailers = ((bool) $this->input->post('all_retailers') and !empty($this->subscriber_retailer_addons)); $this->data->show_comparison = (bool) $this->input->post('show_comparison'); $this->submit = $this->input->post('formSubmit'); $this->data->report_where = array(); if ($this->submit) { $this->data->report = $this->input->post('report'); $this->data->date_from = $this->input->post('date_from'); $this->data->date_to = $this->input->post('date_to'); $this->data->time_frame = $this->input->post('time_frame'); $this->data->merchants = $this->input->post('merchants'); $this->data->markets = $this->input->post('markets'); $this->data->flagDates24 = $this->data->date_from == $this->data->date_to ? true : false; $this->data->report_chart = 'scatter'; $this->data->graphImageName = ''; $this->data->productNames = array(); if ($this->input->post('product_name')) { $this->data->productNames = $this->input->post('product_name'); } $this->data->products = array(); if ($this->input->post('products')) { $this->data->products = $this->input->post('products'); } elseif ($this->input->post('group_id')) { $this->data->selected_group_id = $this->input->post('group_id'); $this->data->product_groups = $this->Product->getGroups($this->store_id); $group_prods = $this->Product->getProductsByGroupId((int) $this->input->post('group_id')); if (!empty($group_prods)) { foreach ($group_prods as $prod) { $prod = $this->Product->getProductsByID($this->store_id, $prod['product_id']); $this->data->products[] = $prod[0]['id']; $this->data->productNames[] = $prod[0]['title']; } } } } $this->data->noRecord = $this->config->item('no_record'); //log_message('info', 'violations data: '. print_r($this->data,true)); $this->_prep_report(); }
private function _prep_whois_report() { $this->data->my = 'whois'; $this->data->report_chart = 'na'; // Separate marketplaces from retailers and // group marketplace_products by marketplace $this->data->marketplaces = array(); $this->data->retailers = array(); $markets = $this->report_info->whoisSwitch === 'marketplace' ? getMarketplaceArray($this->report_info->store_id) : getRetailerArray(false, $this->report_info->store_id); $markets = array_to_lower($markets); foreach ($markets as $market) { $crawl_info = $this->crawl_data_m->last_crawl($market); if ($crawl_info) { $from = $crawl_info->start_datetime; $to = $crawl_info->end_datetime; $marketplace_products = $this->merchant_products_m->getCountByMarketplace($this->report_info->store_id, $market, $from, $to); if (!empty($marketplace_products)) { $this->data->marketplace_products[] = $marketplace_products[0]; } } } if (isset($this->data->marketplace_products)) { for ($i = 0, $n = count($this->data->marketplace_products); $i < $n; $i++) { $marketplace = $this->data->marketplace_products[$i]['marketplace']; if ($this->data->marketplace_products[$i]['is_retailer'] === '1') { $merchant = $this->merchant_products_m->getMerchantDetailsByMarketplace($marketplace); if (isset($merchant[0]['id'])) { $this->data->marketplace_products[$i] = array_merge($this->data->marketplace_products[$i], $merchant[0]); $this->data->retailers[] = $this->data->marketplace_products[$i]; } } else { $this->data->marketplaces[] = $this->data->marketplace_products[$i]; } $this->data->marketplace_products[$marketplace] = $this->data->marketplace_products[$i]; unset($this->data->marketplace_products[$i]); } } // sort by keys $this->data->marketplace_keys = array(); if (!empty($this->data->marketplace_products)) { ksort($this->data->marketplace_products); $this->data->marketplace_keys = array_keys($this->data->marketplace_products); // graph data $this->data->gData = mvFormat::whoIsSellingMyProductDefault($this->data->marketplace_products); } $this->data->Data->retailers = $this->data->retailers; $this->data->Data->marketplaces = $this->data->marketplaces; }
/** * load all user information for use on all pages * * @todo move function to a library class * @todo handle terms check here? * @author unknown, Christophe */ private function _load_user($user) { if ($user['role_id'] === 0 || $user['role_id'] == '0') { $user['role_id'] = 2; } $this->user = $user; $this->user_id = intval($user['id']); $this->logged_in = TRUE; $this->role_id = intval($user['role_id']); $this->permission_id = $this->role_id; // set session //store.user_id can be viewed by anyone belonging to that particular team $session_data = array('user_id' => $user['id'], 'user_name' => $user['user_name'], 'user_email' => $user['email'], 'rid' => $user['role_id'], 'permission_id' => $user['role_id']); $this->session->set_userdata($session_data); //comment/remove this when the payment/lookup portion above works properly... $this->subscriber_addons = array('iherb', 'livamed', 'luckyvitamin', 'swansonvitamins', 'vitacost', 'vitaminshoppe', 'vitanherbs'); $this->subscriber_retailer_addons = getRetailerArray(); }