Exemplo n.º 1
0
 public function getProductsSponsoredLinks()
 {
     $view = $this->input->get('view');
     $siteId = $this->input->get('site_id');
     $termId = $this->input->get('term_id');
     $brandId = $this->input->get('brand_id');
     $dateOfUpload = $this->input->get('date_of_upload');
     $productLists = $this->input->get('product_lists');
     $preparedData = array();
     if (!empty($view) && !empty($siteId) && !empty($termId) && !empty($brandId) && !empty($dateOfUpload) && !empty($productLists)) {
         $this->load->model('product_model');
         $products = $this->product_model->getSponsoredLinks(array('view' => $view, 'site_id' => $siteId, 'term_id' => $termId, 'brand_id' => $brandId, 'date_of_upload' => $dateOfUpload, 'product_list' => $productLists));
         foreach ($products as $product) {
             $preparedData[$product->site_id][$product->keyword]['dates'][$product->date_of_upload][] = $product;
             if (empty($preparedData[$product->site_id][$product->keyword]['count'])) {
                 $preparedData[$product->site_id][$product->keyword]['count'] = 1;
             } else {
                 $preparedData[$product->site_id][$product->keyword]['count']++;
             }
         }
     }
     $responseTemplate = $this->load->view('assess/scorecard/content/sponsored-links.php', array('preparedData' => $preparedData, 'keywordsDependent' => empty($termId)), true);
     $this->output->set_content_type('text/html')->set_output($responseTemplate);
 }