예제 #1
0
 function set_option(&$options, $key)
 {
     if ($value = urldecode($this->input->get($key))) {
         bake_cookie($key, $value);
         $options[$key] = $value;
     } else {
         burn_cookie($key);
     }
 }
예제 #2
0
파일: Po.php 프로젝트: iHunt101/inventory
 function search()
 {
     $this->load->model("vendor_model", "vendor");
     $vendors = $this->vendor->get_all("vendor");
     $data["vendors"] = get_keyed_pairs($vendors, array("id", "name"), TRUE);
     $methods = $this->po->get_distinct("method");
     $data["methods"] = get_keyed_pairs($methods, array("method", "method"));
     $payment_types = $this->po->get_distinct("payment_type");
     $data["payment_types"] = get_keyed_pairs($payment_types, array("payment_type", "payment_type"));
     $categories = $this->po->get_distinct("category");
     $data["categories"] = get_keyed_pairs($categories, array("category", "category"));
     $users = $this->ion_auth->users()->result();
     $data["users"] = get_keyed_pairs($users, array("id", "first_name"), TRUE);
     $data["target"] = "po/search";
     $data["title"] = "Search Purchase Orders";
     $data["po"] = FALSE;
     $variables = array("vendor_id", "po", "method", "po_date", "payment_type", "category", "orderer_id", "billing_contact", "description", "sku", "quote");
     $where = NULL;
     foreach ($variables as $variable) {
         if ($my_variable = $this->input->get($variable)) {
             $where[$variable] = $my_variable;
             bake_cookie($variable, $my_variable);
         } else {
             burn_cookie($variable, $my_variable);
         }
     }
     $date_range = array();
     if ($start_date = $this->input->get("start_date")) {
         $date_range["start_date"] = $start_date;
     }
     if ($end_date = $this->input->get("end_date")) {
         $date_range["end_date"] = $end_date;
     }
     $data["refine"] = FALSE;
     $pos = array();
     if ($this->input->get("is_search")) {
         // active search has been submitted
         $pos = $this->po->search($where, $date_range);
         $this->load->model("item_model", "item");
         foreach ($pos as $po) {
             $po->items = $this->item->get_for_po($po->id);
         }
         $data["refine"] = TRUE;
     }
     $data['pos'] = NULL;
     if (count($pos) > 0) {
         $data['pos'] = $pos;
     }
     if ($this->input->get("ajax") == 1) {
         $this->load->view("page/modal", $data);
     } else {
         $this->load->view("page/index", $data);
     }
 }
예제 #3
0
 function search()
 {
     $this->load->model("vendor_model", "vendor");
     $data["developers"] = $this->_developer_list(TRUE);
     $data["statuses"] = $this->_status_list();
     $data["types"] = $this->_type_list();
     $assets = array();
     $variables = array("type", "status", "vendor_id", "name", "product", "version", "source", "po", "year_acquired", "year_removed", "serial_number");
     $where = NULL;
     foreach ($variables as $variable) {
         if ($my_variable = $this->input->get($variable)) {
             $where[$variable] = $my_variable;
             bake_cookie($variable, $my_variable);
         } else {
             burn_cookie($variable, $my_variable);
         }
     }
     if ($this->input->get("is_search")) {
         // active search has been submitted
         $assets = $this->asset->search($where);
         $data["refine"] = TRUE;
     }
     $data['assets'] = NULL;
     if (count($assets) > 0) {
         $data['assets'] = $assets;
     }
     $data["title"] = "Search Assets";
     if ($this->input->get("export")) {
         $this->load->helper("download");
         $this->load->view('asset/export', $data);
     } else {
         $data['target'] = 'asset/search';
         $this->load->view('page/index', $data);
     }
 }