예제 #1
0
파일: Item.php 프로젝트: iHunt101/inventory
 function edit($id)
 {
     $categories = $this->po->get_distinct("category");
     $data["categories"] = get_keyed_pairs($categories, array("category", "category"));
     $data["item"] = $this->item->get($id);
     $data["po"] = $data["item"]->po;
     $data["po_id"] = $data["item"]->po_id;
     $data["action"] = "update";
     $data["target"] = "item/edit";
     $data["title"] = sprintf("Editing an order item");
     if ($this->input->get("ajax")) {
         $this->load->view("page/modal", $data);
     } else {
         $this->load->view("page/index", $data);
     }
 }
예제 #2
0
파일: Code.php 프로젝트: iHunt101/inventory
 function edit($id)
 {
     $types = $this->variable->get_types("code_type");
     $data["types"] = get_keyed_pairs($types, array("var_key", "var_value"), TRUE, TRUE);
     $data["title"] = "Edit an Asset Code";
     $data["target"] = "code/edit";
     $data["action"] = "update";
     $data["code"] = $this->code->get($id);
     $data["asset_id"] = $data["code"]->asset_id;
     if ($this->input->get("ajax")) {
         $this->load->view("page/modal", $data);
     } elseif ($this->input->get("inline")) {
         $this->load->view($data["target"], $data);
     } else {
         $this->load->view("page/index", $data);
     }
 }
예제 #3
0
파일: Po.php 프로젝트: iHunt101/inventory
 function request_approval($id = FALSE)
 {
     $this->load->model("user_model", "user");
     $approvers = $this->user->get_group_members(4);
     //approvers cannot approve their own POs.
     foreach ($approvers as $key => $approver) {
         if ($approver->id == $this->ion_auth->get_user_id()) {
             unset($approvers[$key]);
         }
     }
     if ($id) {
         $data["target"] = "po/approval";
         $data["title"] = "Request Approval";
         $data["id"] = $id;
         $data['approvers'] = get_keyed_pairs($approvers, array("id", "user"));
         if ($this->input->get("ajax")) {
             $this->load->view("page/modal", $data);
         } else {
             $this->load->view("page/index", $data);
         }
     } elseif ($id = $this->input->post("id")) {
         $approver_id = $this->input->post("approver_id");
         $this->po->update($id, array("approver_id" => $approver_id));
         $po = $this->po->get($id);
         $this->_notify("approval_request", $po);
         $this->session->set_flashdata("warning", sprintf("The approval request has been sent to %s at %s", $po->approver, $po->approver_email));
         redirect("po/view/{$po->po}");
     }
 }
예제 #4
0
 function _get_multiselect($category, $value, $field)
 {
     $categories = $this->variable->get_pairs($category, array("field" => "value", "direction" => "ASC"));
     $pairs = get_keyed_pairs($categories, array("key", "value"));
     $output = array();
     $output[] = form_multiselect($field, $pairs, explode(",", $value), "id='{$field}'");
     $buttons = implode(" ", $output);
     echo $buttons . sprintf("<span class='button save-multiselect' target='%s'>Save</span>", $field);
 }
예제 #5
0
 function _status_list()
 {
     $statuses = $this->asset->get_distinct("status");
     return get_keyed_pairs($statuses, array("status", "status"), TRUE);
 }
예제 #6
0
 public function edit($id)
 {
     $entry = $this->timesheet->get($id);
     $data['entry'] = $entry;
     $user_id = $entry->user_id;
     $user = $this->user->get_user($user_id);
     $data['user'] = $user;
     $data['title'] = sprintf('Edit a Timesheet entry for %s %s', $user->first_name, $user->last_name);
     $data['target'] = 'timesheet/edit';
     $categories = $this->variable->get_pairs("time_category_{$user_id}", array("field" => "var_key", "direction" => "ASC"));
     $data['categories'] = get_keyed_pairs($categories, array("var_key", "var_value"), TRUE, TRUE);
     $data['action'] = 'update';
     if ($this->input->get('ajax')) {
         $this->load->view('page/modal', $data);
     } else {
         $this->load->view('page/index', $data);
     }
 }