예제 #1
0
 public function init()
 {
     //Generate working status Combo
     $ccm_status_list = new Model_CcmStatusList();
     $result1 = $ccm_status_list->getStatusLists();
     $this->_list["ccm_status_list_id"][''] = "Select working status";
     foreach ($result1 as $row) {
         $this->_list["ccm_status_list_id"][$row['pkId']] = $row['ccmStatusListName'];
     }
     //Generate source of supply Combo
     $stakeholder = new Model_Stakeholders();
     $stakeholder->form_values['type'] = 1;
     $result2 = $stakeholder->getAllStakeholders();
     $this->_list["source_id"][''] = "Select Source Of Supply";
     foreach ($result2 as $row2) {
         $this->_list["source_id"][$row2['pkId']] = $row2['stakeholderName'];
     }
     //Generate Utilizations Combo
     $ccm_status_list1 = new Model_CcmStatusList();
     $data = $ccm_status_list1->getAllUtilizations();
     $this->_list["utilization"][''] = "Select ";
     foreach ($data as $utilization) {
         $this->_list["utilization"][$utilization['pkId']] = $utilization['ccmStatusListName'];
     }
     foreach ($this->_fields as $col => $name) {
         switch ($col) {
             case "asset_id":
                 $this->addElement("text", $col, array("attribs" => array("class" => "form-control"), "allowEmpty" => true, "filters" => array("StringTrim", "StripTags"), "validators" => array()));
                 $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag");
                 break;
             default:
                 break;
         }
         /* if ($col == "reason" || $col == "utilization") {
            $str_style_hidden = "hidden";
            } */
         if (in_array($col, array_keys($this->_list))) {
             $this->addElement("select", $col, array("attribs" => array("class" => "form-control form-group"), "filters" => array("StringTrim", "StripTags"), "allowEmpty" => true, "required" => false, "registerInArrayValidator" => false, "multiOptions" => $this->_list[$col], "validators" => array()));
             $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag");
         }
         if (in_array($col, array_keys($this->_radio))) {
             $this->addElement("radio", $col, array("attribs" => array(), "allowEmpty" => true, 'separator' => '', "filters" => array("StringTrim", "StripTags"), "validators" => array(), "multiOptions" => $this->_radio[$col]));
             $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag")->removeDecorator("<br>");
         }
     }
 }
 public function updateWorkingStatusAction()
 {
     $warehouse_id = $this->_request->getParam('id', '');
     $status_list = new Model_CcmStatusList();
     $result1 = $status_list->getStatusLists();
     $this->view->working_list = $result1;
     $result2 = $status_list->getAllReasons();
     $this->view->reason_list = $result2;
     $result3 = $status_list->getAllUtilizations();
     $this->view->utilization_list = $result3;
     $this->view->warehouse_id = $warehouse_id;
     if ($this->_request->isPost()) {
         $ccm_status_histroy = new Model_CcmStatusHistory();
         $data = $this->_request->getPost();
         $ccm_status_histroy->form_values = $data;
         $ccm_status_histroy->updateColdChainStatus();
         $role_id = $this->_identity->getRoleId();
         if ($role_id == 7) {
             $this->redirect("/stock/monthly-consumption2");
         } else {
             $this->redirect("/cold-chain/status-working-update?success=1");
         }
     }
 }
 public function ajaxGetUtilizationsAction()
 {
     $this->_helper->layout->disableLayout();
     $ccm_status_list = new Model_CcmStatusList();
     $ccm_status_list->form_values['working_status'] = $this->_request->working_status;
     $data = $ccm_status_list->getAllUtilizations();
     $this->view->arr_data = $data;
 }