/**
  * @author: Jasdeep Singh <*****@*****.**>
  * @purpose: Add Collection Function
  * @created_at: Oct 17, 2015 
  * @library: form_validation
  * @models:   Collection
  * @helpers:   url
  * @3rdparty:     
  **/
 function add()
 {
     $this->load->library('form_validation');
     $this->load->model('Collections');
     $this->load->model('Categories');
     $this->load->model('Products');
     $this->load->model('Users');
     $this->load->model('Tags');
     $collection_id = collection_id();
     $this->load->library('breadcrumbs');
     $this->breadcrumbs->push('Administrator', '/');
     $this->breadcrumbs->push('Collection', '/collections');
     $this->breadcrumbs->push('Add', '/collections/add');
     $categories_all = $this->Categories->getCategoryList();
     $collections['categories'] = $categories_all;
     $sql = "SELECT sku_no FROM products  ORDER BY id DESC limit 1  ";
     $last_id = $this->db->query($sql);
     $result = $last_id->result();
     $last_sku = $result[0]->sku_no;
     $explode_query = explode('CURATIGO00', $last_sku);
     $e = $explode_query[1];
     $incr = $e + 1;
     $var1 = 'CURATIGO00';
     $sku = $var1 . '' . $incr;
     $collections['single_sku'] = $sku;
     $tags_all = $this->Tags->getTagList();
     $html = "[";
     foreach ($tags_all as $val) {
         $html .= "'" . $val['title'] . "',";
     }
     $html .= "]";
     $collections['tags_html'] = $html;
     $collections['single_id_collection'] = $collection_id;
     $collections["allUsers"] = $this->users->get_all_users();
     $collections['product_collections'] = $this->Collections->getProductsCollectionDetail();
     $collections['product_collections_single'] = $this->Collections->getProductsCollectionDetails($collection_id);
     $this->template->build(config_item('current_theme_path') . 'collection_add', $collections);
     $categories_rules = array(array('field' => 'collection_id', 'label' => 'Collection id is empty', 'rules' => 'trim|required'), array('field' => 'category_id', 'label' => 'Please Select Category', 'rules' => 'trim|required'), array('field' => 'url_slug', 'label' => 'Please ', 'rules' => 'trim|required'));
     $this->form_validation->set_rules($categories_rules);
     /* If the collection is not featured */
     if ($this->form_validation->run() == FALSE) {
         $this->template->build(config_item('current_theme_path') . 'collection_add');
     } else {
         if ($query = $this->Collections->createCollection()) {
             $this->session->set_flashdata('msg', '<div class="alert alert-success text-center">Collection Record is Successfully Saved!</div>');
             redirect('collections/index');
         } else {
             $this->session->set_flashdata('msg', '<div class="alert alert-success text-center">You have Entered a Duplicate Collection URL Slug</div>');
             redirect('collections/add');
         }
     }
 }
Пример #2
0
            } else {
                echo '<td class="results">' . $stats[$key] . '</td>';
                echo '<td class="results">' . sprintf("%d%%", $rel_stats[$key]) . '</td>';
            }
            echo '</tr>';
        }
    }
    echo '</table>';
    if ($total > 0) {
        $chart_data = implode(',', array_values($rel_stats));
        $chart_labels = implode('|', array_values($values));
        echo '<img src="http://chart.apis.google.com/chart?cht=p3&amp;chf=bg,s,E0E0F0&amp;chd=t:' . $chart_data . '&amp;chs=350x100&amp;chl=' . $chart_labels . '"  alt="Google Chart">';
    }
    echo '<br clear="all">';
}
$collection_id = collection_id($session_id);
?>

<div class="sqamenu" style="text-align: right"><span class="sqamenu"><a href="../index.php">Welcome</a></span> <span class="sqamenu"><a href="../checked_in.php?session_code=<?php 
echo session_code();
?>
">Participate</a></span> <span class="sqamenu"><a href="../admin_audits.php">Administrate</a></span> <p>
<span class="sqamenusel">MUGA</span></div>



<h1 class="sqa">Software Quality Assurance</h1>
  <div class="sqah1">&nbsp;</div>