Exemple #1
0
 public function init()
 {
     $list_detail = new Model_ListDetail();
     $list_detail->form_values = array('master_id' => Model_ListMaster::USER_ROLE_CATEGORIES);
     $result = $list_detail->getListDetailByMasterId();
     $this->_list["category_id"][''] = "Select";
     foreach ($result as $rs) {
         $this->_list["category_id"][$rs['pkId']] = $rs['listValue'];
     }
     foreach ($this->_fields as $col => $name) {
         switch ($col) {
             case "role_name":
             case "description":
                 $this->addElement("text", $col, array("attribs" => array("class" => "form-control"), "allowEmpty" => false, "filters" => array("StringTrim", "StripTags"), "validators" => array()));
                 $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag");
                 break;
             default:
                 break;
         }
         if (in_array($col, array_keys($this->_list))) {
             $this->addElement("select", $col, array("attribs" => array("class" => "form-control"), "filters" => array("StringTrim", "StripTags"), "allowEmpty" => true, "required" => false, "registerInArrayValidator" => false, "multiOptions" => $this->_list[$col], "validators" => array()));
             $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag");
         }
     }
 }
 public function init()
 {
     //Generate Vehicle Type Combo
     $list = new Model_ListDetail();
     $list->form_values = array('listMaster' => Model_ListMaster::VEHICLE_TYPE);
     $result1 = $list->getListDetail();
     $this->_list["vehicle_type_id"][''] = "Select Vehicle Type";
     if ($result1) {
         foreach ($result1 as $row) {
             $this->_list["vehicle_type_id"][$row->getPkId()] = $row->getListValue();
         }
     }
     $this->_list["number"][''] = "Select Vehicle Type First";
     foreach ($this->_fields as $col => $name) {
         switch ($col) {
             case "vehicle_type_id":
             case "gatepass_vehicle_id":
             case "vehicle_other":
                 $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;
             case "stock_master_id":
                 $this->addElement("text", $col, array("attribs" => array("class" => "form-control"), "allowEmpty" => true, "multiple" => "multiple", "filters" => array("StringTrim", "StripTags"), "validators" => array()));
                 $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag");
                 break;
             case "date_from":
             case "date_to":
             case "transaction_date":
                 $this->addElement("text", $col, array("attribs" => array("class" => "form-control", 'readonly' => 'true'), "allowEmpty" => false, "filters" => array("StringTrim", "StripTags"), "validators" => array()));
                 $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag");
                 break;
             case "transaction_number":
                 $this->addElement("text", $col, array("attribs" => array("class" => "form-control"), "allowEmpty" => false, "filters" => array("StringTrim", "StripTags"), "validators" => array()));
                 $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag");
                 break;
             case "quantity":
                 $this->addElement("text", $col, array("attribs" => array("class" => "form-control"), "allowEmpty" => false, "filters" => array("StringTrim", "StripTags"), "validators" => array()));
                 $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag");
                 break;
             case "other":
                 $this->addElement("checkbox", $col, array("attribs" => array("class" => "form-control"), "allowEmpty" => false, "filters" => array("StringTrim", "StripTags"), "validators" => array()));
                 $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag");
                 break;
             default:
                 break;
         }
         if (in_array($col, array_keys($this->_list))) {
             $this->addElement("select", $col, array("attribs" => array("class" => "form-control"), "filters" => array("StringTrim", "StripTags"), "allowEmpty" => true, "required" => false, "registerInArrayValidator" => false, "multiOptions" => $this->_list[$col], "validators" => array(array("validator" => "Float", "breakChainOnFailure" => false, "options" => array("messages" => array("notFloat" => $name . " must be a valid option"))))));
             $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag");
         }
     }
 }
 public function indexAction()
 {
     $form = new Form_Cadmin_ListSearch();
     $form_add = new Form_Cadmin_List();
     $params = array();
     $list_detail = new Model_ListDetail();
     if ($this->_request->isPost()) {
         if ($form->isValid($this->_request->getPost())) {
             $list_master = $form->getValue('list_master');
             $list_value = $form->getValue('list_value');
             if (!empty($list_master)) {
                 $params['listMaster'] = $list_master;
             }
             if (!empty($list_value)) {
                 $params['listValue'] = $list_value;
             }
         }
         $form->list_master->setValue($list_master);
         $form->list_value->setValue($list_value);
     } else {
         $list_master = $this->_getParam('list_master');
         $list_value = $this->_getParam('list_value');
         if (!empty($list_master)) {
             $params['listMaster'] = $list_master;
         }
         $form->list_master->setValue($list_master);
         if (!empty($list_value)) {
             $params['listValue'] = $list_value;
             $form->list_value->setValue($list_value);
         }
     }
     $sort = $this->_getParam("sort", "asc");
     $order = $this->_getParam("order", "list_value");
     $list_detail->form_values = $params;
     $result = $list_detail->getListDetail($order, $sort);
     //Paginate the contest results
     $paginator = Zend_Paginator::factory($result);
     $page = $this->_getParam("page", 1);
     $counter = $this->_getParam("counter", 10);
     $paginator->setCurrentPageNumber((int) $page);
     $paginator->setItemCountPerPage((int) $counter);
     $this->view->form = $form;
     $this->view->form_add = $form_add;
     $this->view->paginator = $paginator;
     $this->view->sort = $sort;
     $this->view->order = $order;
     $this->view->counter = $counter;
     $this->view->pagination_params = $params;
 }
 public function init()
 {
     //Generate Vehicle Type Combo
     $list = new Model_ListDetail();
     $list->form_values = array('listMaster' => Model_ListMaster::VEHICLE_TYPE);
     $result1 = $list->getListDetail();
     $this->_list["vehicle_type_id"][''] = "Select Vehicle Type";
     if ($result1) {
         foreach ($result1 as $row) {
             $this->_list["vehicle_type_id"][$row->getPkId()] = $row->getListValue();
         }
     }
     //Generate Item Combo
     $item_pack_size = new Model_ItemPackSizes();
     $result = $item_pack_size->getItemsAll();
     $this->_list["item_pack_size_id"][''] = "Select Product";
     if ($result) {
         foreach ($result as $row) {
             $this->_list["item_pack_size_id"][$row->getPkId()] = $row->getItemName();
         }
     }
     //Generate Batch Number Combo
     $this->_list["stock_batch_id"][''] = "Select Item First";
     //$date_from = date('Y-m' . '-01');
     //$date_to = date('Y-m-d');
     foreach ($this->_fields as $col => $name) {
         switch ($col) {
             case "vehicle_type_id":
             case "item_pack_size_id":
             case "stock_batch_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;
             case "date_from":
             case "date_to":
                 $this->addElement("text", $col, array("attribs" => array("class" => "form-control", 'readonly' => 'true'), "allowEmpty" => true, "filters" => array("StringTrim", "StripTags"), "validators" => array()));
                 $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag");
                 break;
             default:
                 break;
         }
         if (in_array($col, array_keys($this->_list))) {
             $this->addElement("select", $col, array("attribs" => array("class" => "form-control"), "filters" => array("StringTrim", "StripTags"), "allowEmpty" => true, "required" => false, "registerInArrayValidator" => false, "multiOptions" => $this->_list[$col], "validators" => array(array("validator" => "Float", "breakChainOnFailure" => false, "options" => array("messages" => array("notFloat" => $name . " must be a valid option"))))));
             $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag");
         }
     }
 }
 public function init()
 {
     //Generate Area Combo
     $list = new Model_ListDetail();
     $list->form_values = array('listMaster' => Model_ListMaster::AREA);
     $result1 = $list->getListDetail();
     //print_r($result1);
     $this->_list["area"][''] = "Select";
     if ($result1) {
         foreach ($result1 as $area) {
             $this->_list["area"][$area->getPkId()] = $area->getListValue();
         }
     }
     //Generate Level Combo
     $list = new Model_ListDetail();
     $list->form_values = array('listMaster' => Model_ListMaster::ROW);
     $result2 = $list->getListDetail();
     $this->_list["level"][''] = "Select";
     if ($result2) {
         foreach ($result2 as $row) {
             $this->_list["level"][$row->getPkId()] = $row->getListValue();
         }
     }
     foreach ($this->_fields as $col => $name) {
         switch ($col) {
             case "area":
             case "level":
                 $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 (in_array($col, array_keys($this->_list))) {
             $this->addElement("select", $col, array("attribs" => array("class" => "form-control"), "filters" => array("StringTrim", "StripTags"), "allowEmpty" => true, "required" => false, "registerInArrayValidator" => false, "multiOptions" => $this->_list[$col], "validators" => array(array("validator" => "Float", "breakChainOnFailure" => false, "options" => array("messages" => array("notFloat" => $name . " must be a valid option"))))));
             $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag");
         }
     }
 }
 public function init()
 {
     //Generate Item Combo
     $item_pack_size = new Model_ItemPackSizes();
     $result = $item_pack_size->getItemsAll();
     $this->_list["item_pack_size_id"][''] = "Select Product";
     $this->_list["item_pack_size_id_update"][''] = "Select Product";
     if ($result) {
         foreach ($result as $row) {
             $this->_list["item_pack_size_id"][$row->getPkId()] = $row->getItemName();
             $this->_list["item_pack_size_id_update"][$row->getPkId()] = $row->getItemName();
         }
     }
     //Generate Pack type combo
     $list = new Model_ListDetail();
     $list->form_values = array('listMaster' => Model_ListMaster::packaging_level);
     $result2 = $list->getListDetail();
     $this->_list["packaging_level"][''] = "Select Packaging Level";
     $this->_list["packaging_level_update"][''] = "Select Packaging Level";
     if ($result2) {
         foreach ($result2 as $packagingLevel) {
             $this->_list["packaging_level"][$packagingLevel->getPkId()] = $packagingLevel->getListValue();
             $this->_list["packaging_level_update"][$packagingLevel->getPkId()] = $packagingLevel->getListValue();
         }
     }
     foreach ($this->_hidden as $col => $name) {
         switch ($col) {
             case "barcode_id":
                 $this->addElement("hidden", $col);
                 $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag");
                 break;
             case "barcode_ty_id":
                 $this->addElement("hidden", $col);
                 $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag");
                 break;
             default:
                 break;
         }
     }
     foreach ($this->_fields as $col => $name) {
         switch ($col) {
             case "item_gtin":
             case "quantity_per_pack":
             case "volum_per_vial":
                 $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;
             case "pack_size_description":
                 $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;
             case "length":
                 $this->addElement("text", $col, array("attribs" => array("class" => "form-control", "placeholder" => "Length"), "allowEmpty" => true, "filters" => array("StringTrim", "StripTags"), "validators" => array()));
                 $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag");
                 break;
             case "width":
                 $this->addElement("text", $col, array("attribs" => array("class" => "form-control", "placeholder" => "Width"), "allowEmpty" => true, "filters" => array("StringTrim", "StripTags"), "validators" => array()));
                 $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag");
                 break;
             case "height":
                 $this->addElement("text", $col, array("attribs" => array("class" => "form-control", "placeholder" => "Height"), "allowEmpty" => true, "filters" => array("StringTrim", "StripTags"), "validators" => array()));
                 $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag");
                 break;
             default:
                 break;
         }
         if (in_array($col, array_keys($this->_list))) {
             $this->addElement("select", $col, array("attribs" => array("class" => "form-control"), "filters" => array("StringTrim", "StripTags"), "allowEmpty" => true, "required" => false, "registerInArrayValidator" => false, "multiOptions" => $this->_list[$col], "validators" => array(array("validator" => "Float", "breakChainOnFailure" => false, "options" => array("messages" => array("notFloat" => $name . " must be a valid option"))))));
             $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag");
         }
     }
     foreach ($this->_hidden as $col => $name) {
         switch ($col) {
             case "item_pack_size_id_hidden":
             case "stakeholder_id_update_hidden":
                 $this->addElement("hidden", $col);
                 $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag");
                 break;
             default:
                 break;
         }
     }
 }
 public function init()
 {
     //Generate Makes Combo
     $makes = new Model_CcmMakes();
     $makes->form_values = array('type_id' => Model_CcmAssetTypes::TRANSPORT);
     $result1 = $makes->getAllMakesByAssetType();
     $this->_list["ccm_make_id"][''] = "Select Makes";
     if ($result1) {
         foreach ($result1 as $row) {
             $this->_list["ccm_make_id"][$row['pkId']] = $row['ccmMakeName'];
         }
     }
     //Generate Models Combo
     $this->_list["ccm_model_id"][''] = "Select Make First";
     //Generate Asset Sub Type Combo
     $asset_types = new Model_CcmAssetTypes();
     $asset_types->form_values = array('parent_id' => Model_CcmAssetTypes::TRANSPORT);
     $result3 = $asset_types->getAssetSubTypes();
     $this->_list["ccm_asset_sub_type_id"][''] = "Select Asset Sub Types";
     if ($result3) {
         foreach ($result3 as $assetsubtype) {
             $this->_list["ccm_asset_sub_type_id"][$assetsubtype['pkId']] = $assetsubtype['assetTypeName'];
         }
     }
     //Generate Fuel Type Combo
     $list = new Model_ListDetail();
     $list->form_values = array('fuel_type_id' => Model_ListMaster::FUEL_TYPE);
     $result4 = $list->getFuelTypes();
     $this->_list["fuel_type_id"][''] = "Select Fuel Types";
     if ($result4) {
         foreach ($result4 as $fueltype) {
             $this->_list["fuel_type_id"][$fueltype['pkId']] = $fueltype['listValue'];
         }
     }
     foreach ($this->_fields as $col => $name) {
         switch ($col) {
             case "registration_no":
             case "used_for_epi":
             case "comments":
                 $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;
             case "manufacture_year":
                 $this->addElement("text", $col, array("attribs" => array("class" => "form-control", 'readonly' => 'true'), "allowEmpty" => false, "filters" => array("StringTrim", "StripTags"), "validators" => array()));
                 $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag");
                 break;
             default:
                 break;
         }
         if (in_array($col, array_keys($this->_list))) {
             $this->addElement("select", $col, array("attribs" => array("class" => "form-control"), "filters" => array("StringTrim", "StripTags"), "allowEmpty" => true, "required" => false, "registerInArrayValidator" => false, "multiOptions" => $this->_list[$col], "validators" => array(array("validator" => "Float", "breakChainOnFailure" => false, "options" => array("messages" => array("notFloat" => $name . " must be a valid option"))))));
             $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag");
         }
     }
     foreach ($this->_hidden as $col => $name) {
         switch ($col) {
             case "ccm_id":
             case "model_hidden":
                 $this->addElement("hidden", $col);
                 $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag");
                 break;
             default:
                 break;
         }
     }
 }
 public function init()
 {
     //Generate Area Combo
     $list = new Model_ListDetail();
     $list->form_values = array('listMaster' => Model_ListMaster::AREA);
     $result1 = $list->getListDetail();
     $this->_list["area"][''] = "Select Store";
     if ($result1) {
         foreach ($result1 as $area) {
             $this->_list["area"][$area->getPkId()] = $area->getListValue();
         }
     }
     //Generate Row Combo
     $list = new Model_ListDetail();
     $list->form_values = array('listMaster' => Model_ListMaster::ROW);
     $result2 = $list->getListDetail();
     $this->_list["row"][''] = "Select Row";
     if ($result2) {
         foreach ($result2 as $row) {
             $this->_list["row"][$row->getPkId()] = $row->getListValue();
         }
     }
     //Generate Rack Combo
     $list = new Model_ListDetail();
     $list->form_values = array('listMaster' => Model_ListMaster::RACK);
     $result3 = $list->getListDetail();
     $this->_list["rack"][''] = "Select Rack";
     if ($result3) {
         foreach ($result3 as $rack) {
             $this->_list["rack"][$rack->getPkId()] = $rack->getListValue();
         }
     }
     //Generate Rack Type Combo
     $rack_information = new Model_RackInformation();
     $result4 = $rack_information->getRackInformation();
     $this->_list["rack_information_id"][''] = "Select Rack Type";
     if ($result4) {
         foreach ($result4 as $rackinformation) {
             $this->_list["rack_information_id"][$rackinformation['pkId']] = $rackinformation['rackType'];
         }
     }
     //Generate Pallet Combo
     $list = new Model_ListDetail();
     $list->form_values = array('listMaster' => Model_ListMaster::PALLET);
     $result5 = $list->getListDetail();
     $this->_list["pallet"][''] = "Select Bin";
     if ($result5) {
         foreach ($result5 as $pallet) {
             $this->_list["pallet"][$pallet->getPkId()] = $pallet->getListValue();
         }
     }
     //Generate Level Combo
     $list = new Model_ListDetail();
     $list->form_values = array('listMaster' => Model_ListMaster::LEVEL);
     $result6 = $list->getListDetail();
     $this->_list["level"][''] = "Select Shelf";
     if ($result6) {
         foreach ($result6 as $level) {
             $this->_list["level"][$level->getPkId()] = $level->getListValue();
         }
     }
     foreach ($this->_hidden as $col => $name) {
         switch ($col) {
             case "placement_id":
                 $this->addElement("hidden", $col);
                 $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag");
                 break;
             default:
                 break;
         }
     }
     foreach ($this->_fields as $col => $name) {
         switch ($col) {
             case "area":
             case "row":
             case "rack":
             case "rack_information_id":
             case "pallet":
             case "level":
             case "location_name":
                 $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 (in_array($col, array_keys($this->_list))) {
             $this->addElement("select", $col, array("attribs" => array("class" => "form-control"), "filters" => array("StringTrim", "StripTags"), "allowEmpty" => true, "required" => false, "registerInArrayValidator" => false, "multiOptions" => $this->_list[$col], "validators" => array(array("validator" => "Float", "breakChainOnFailure" => false, "options" => array("messages" => array("notFloat" => $name . " must be a valid option"))))));
             $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag");
         }
     }
 }
 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 Makes Combo
     $makes = new Model_CcmMakes();
     $makes->form_values = array('type_id' => Model_CcmAssetTypes::TRANSPORT);
     $result1 = $makes->getAllMakesByAssetType();
     $this->_list["ccm_make_id"][''] = "Select Makes";
     if ($result1) {
         foreach ($result1 as $row) {
             $this->_list["ccm_make_id"][$row['pkId']] = $row['ccmMakeName'];
         }
     }
     //Generate Models Combo
     $this->_list["ccm_model_id"][''] = "Select Make First";
     //Generate Asset Sub Type Combo
     $asset_types = new Model_CcmAssetTypes();
     $asset_types->form_values = array('parent_id' => Model_CcmAssetTypes::TRANSPORT);
     $result3 = $asset_types->getAssetSubTypes();
     $this->_list["ccm_asset_sub_type_id"][''] = "Select Asset Sub Types";
     if ($result3) {
         foreach ($result3 as $assetsubtype) {
             $this->_list["ccm_asset_sub_type_id"][$assetsubtype['pkId']] = $assetsubtype['assetTypeName'];
         }
     }
     //Generate Fuel Type Combo
     $list = new Model_ListDetail();
     $list->form_values = array('fuel_type_id' => Model_ListMaster::FUEL_TYPE);
     $result4 = $list->getFuelTypes();
     $this->_list["fuel_type_id"][''] = "Select Fuel Types";
     if ($result4) {
         foreach ($result4 as $fueltype) {
             $this->_list["fuel_type_id"][$fueltype['pkId']] = $fueltype['listValue'];
         }
     }
     //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'];
     }
     foreach ($this->_hidden as $col => $name) {
         switch ($col) {
             case "office_id":
             case "combo1_id":
             case "warehouse_id":
             case "model_id":
                 $this->addElement("hidden", $col);
                 $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag");
                 break;
             default:
                 break;
         }
     }
     foreach ($this->_fields as $col => $name) {
         switch ($col) {
             case "registration_no":
                 $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;
             case "manufacture_year_from":
             case "manufacture_year_to":
                 $this->addElement("text", $col, array("attribs" => array("class" => "form-control", 'readonly' => 'true'), "allowEmpty" => false, "filters" => array("StringTrim", "StripTags"), "validators" => array()));
                 $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag");
                 break;
             default:
             default:
                 break;
         }
         if (in_array($col, array_keys($this->_list))) {
             $this->addElement("select", $col, array("attribs" => array("class" => "form-control"), "filters" => array("StringTrim", "StripTags"), "allowEmpty" => true, "required" => false, "registerInArrayValidator" => false, "multiOptions" => $this->_list[$col], "validators" => array(array("validator" => "Float", "breakChainOnFailure" => false, "options" => array("messages" => array("notFloat" => $name . " must be a valid option"))))));
             $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 ajaxEditAction()
 {
     $this->_helper->layout->setLayout("ajax");
     $ccm_warehouse_id = $this->_request->getParam('ccm_warehouse_id', '');
     $ccm_warehouses = $this->_em->find('CcmWarehouses', $ccm_warehouse_id);
     $form = new Form_Cadmin_HealthFacility();
     $form->addFields();
     $form->addHidden();
     $form->routine_immunization_ice_pack->setValue($ccm_warehouses->getRoutineImmunizationIcepackRequirments());
     $form->snid_nid_ice_pack->setValue($ccm_warehouses->getCampaignIcepackRequirments());
     $form->grid_electricity_availibility->setValue($ccm_warehouses->getElectricityAvailability()->getPkId());
     $form->vaccine_supply_mode->setValue($ccm_warehouses->getVaccineSupplyMode()->getPkId());
     //$form->vaccine_supply_mode->setValue($ccm_warehouses->vaccineSupplyMode()->getPkId());
     $form->id->setValue($ccm_warehouses->getPkId());
     $list_detail = new Model_ListDetail();
     $list_detail->form_values['master_id'] = Model_ListMaster::Service_Types;
     $result23 = $list_detail->getListDetailByMasterId();
     $this->view->services_type = $result23;
     $list_detail->form_values['master_id'] = Model_ListMaster::VACCINATION_STAFF;
     $result1 = $list_detail->getListDetailByMasterId();
     $this->view->epi_vaccination_staff = $result1;
     $ccm_wh_vaccination_staff = $this->_em->getRepository("CcmWarehousesVaccinationStaff")->findBy(array('ccmWarehouse' => $ccm_warehouse_id));
     $this->view->update_vaccination_staff = $ccm_wh_vaccination_staff;
     $vac_staff = array();
     foreach ($ccm_wh_vaccination_staff as $row_1) {
         array_push($vac_staff, $row_1->getVaccinationStaff()->getPkId());
     }
     $this->view->vac_staff = $vac_staff;
     $services_type = $this->_em->getRepository("WarehousesServiceTypes")->findBy(array('warehouse' => $ccm_warehouses->getWarehouse()->getPkId()));
     $this->view->update_services_type = $services_type;
     $ser_type = array();
     foreach ($services_type as $row) {
         array_push($ser_type, $row->getServiceType()->getPkId());
     }
     $this->view->ser_type = $ser_type;
     $warehouse_table = $this->_em->getRepository("Warehouses")->find($ccm_warehouses->getWarehouse()->getPkId());
     $form->health_facility_type->setValue($warehouse_table->getWarehouseType()->getPkId());
     $list_detail->form_values['master_id'] = Model_ListMaster::SOLAR_ENERGY;
     $result2 = $list_detail->getListDetailByMasterId();
     $this->view->solar_energy = $result2;
     $solar_energy = $this->_em->getRepository("CcmWarehousesSolarEnergy")->findBy(array('ccmWarehouse' => $ccm_warehouse_id));
     // $this->view->update_solar_energy = $solar_energy->getSolarEnergy()->getPkId();
     $so_energy = array();
     foreach ($solar_energy as $row_2) {
         array_push($so_energy, $row_2->getSolarEnergy()->getPkId());
     }
     $form->old_warehouse->setValue($ccm_warehouses->getWarehouse()->getWarehouseName());
     $form->old_warehouse_val->setValue($ccm_warehouses->getWarehouse()->getpkId());
     $warehouses = $this->_em->find('Warehouses', $ccm_warehouses->getWarehouse()->getpkId());
     $form->office_level->setValue($warehouses->getStakeholderOffice()->getPkId());
     $this->view->so_energy = $so_energy;
     $this->view->form = $form;
     $base_url = Zend_Registry::get("baseurl");
     $this->view->inlineScript()->appendFile($base_url . '/js/all_level_combos2.js');
 }
 public function init()
 {
     $list_detail = new Model_ListDetail();
     $list_detail->form_values['master_id'] = Model_ListMaster::GRID_ELECTRICITY_AVAL;
     $result = $list_detail->getListDetailByMasterId();
     foreach ($result as $list) {
         $this->_list["grid_electricity_availibility"][''] = 'Select';
         $this->_list["grid_electricity_availibility"][$list['pkId']] = $list['listValue'];
     }
     $warehouse = new Model_Warehouses();
     $res_warehouse = $warehouse->getHealthFacilityTypes();
     foreach ($res_warehouse as $row) {
         //  $this->_checkbox["vaccine_supply_mode"][$list12['pkId']] = $list12['listValue'];
         $this->_list["health_facility_type"][''] = 'Select';
         $this->_list["health_facility_type"][$row['pkId']] = $row['warehouseTypeName'];
     }
     $list_detail->form_values['master_id'] = Model_ListMaster::VACCINATION_STAFF;
     $result1 = $list_detail->getListDetailByMasterId();
     foreach ($result1 as $list1) {
         $this->_checkbox["epi_vaccination_staff"][$list1['pkId']] = $list1['listValue'];
     }
     $list_detail->form_values['master_id'] = Model_ListMaster::Service_Types;
     $result13 = $list_detail->getListDetailByMasterId();
     foreach ($result13 as $list13) {
         $this->_checkbox["services_type"][$list13['pkId']] = $list13['listValue'];
     }
     $list_detail->form_values['master_id'] = Model_ListMaster::Vaccine_Supply_Mode;
     $result12 = $list_detail->getListDetailByMasterId();
     foreach ($result12 as $list12) {
         //  $this->_checkbox["vaccine_supply_mode"][$list12['pkId']] = $list12['listValue'];
         $this->_list["vaccine_supply_mode"][''] = 'Select';
         $this->_list["vaccine_supply_mode"][$list12['pkId']] = $list12['listValue'];
     }
     $list_detail->form_values['master_id'] = Model_ListMaster::SOLAR_ENERGY;
     $result2 = $list_detail->getListDetailByMasterId();
     foreach ($result2 as $list2) {
         $this->_checkbox["solar_energy"][$list2['pkId']] = $list2['listValue'];
     }
     foreach ($this->_fields as $col => $name) {
         switch ($col) {
             case "routine_immunization_ice_pack":
             case "snid_nid_ice_pack":
             case "vaccine_supply_mode":
             case "facility_total_population":
             case "live_birth_per_year":
             case "pregnant_women_per_year":
             case "women_of_child_bearing_age":
                 $this->addElement("text", $col, array("attribs" => array("class" => "form-control"), "allowEmpty" => true, "required" => false, "filters" => array("StringTrim", "StripTags"), "validators" => array()));
                 $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag");
                 break;
             case "estimation_year":
                 $this->addElement("text", $col, array("attribs" => array("class" => "form-control", 'readonly' => 'true'), "allowEmpty" => false, "filters" => array("StringTrim", "StripTags"), "validators" => array()));
                 $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag");
                 break;
             default:
                 break;
         }
         if (in_array($col, array_keys($this->_list))) {
             $this->addElement("select", $col, array("attribs" => array("class" => "form-control"), "filters" => array("StringTrim", "StripTags"), "allowEmpty" => true, "required" => false, "registerInArrayValidator" => false, "multiOptions" => $this->_list[$col]));
             $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag");
         }
         if (in_array($col, array_keys($this->_checkbox))) {
             $this->addElement("checkbox", $col, array("attribs" => array(), "allowEmpty" => true, 'separator' => '', "filters" => array("StringTrim", "StripTags"), "validators" => array(), "multiOptions" => $this->_checkbox[$col]));
             $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag");
         }
     }
     foreach ($this->_hidden as $col => $name) {
         switch ($col) {
             case "old_warehouse_val":
             case "office_level":
                 $this->addElement("hidden", $col);
                 $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag");
                 break;
             default:
                 break;
         }
     }
 }
 public function init()
 {
     //Generate Item Combo
     $item_pack_size = new Model_ItemPackSizes();
     $result = $item_pack_size->getItemsAll();
     $this->_list["item_pack_size_id"][''] = "Select Product";
     $this->_list["item_pack_size_id_update"][''] = "Select Product";
     if ($result) {
         foreach ($result as $row) {
             $this->_list["item_pack_size_id"][$row->getPkId()] = $row->getItemName();
             $this->_list["item_pack_size_id_update"][$row->getPkId()] = $row->getItemName();
         }
     }
     //Generate Manufacturer Combo
     /* $stakeholder = new Model_Stakeholders();
        $result1 = $stakeholder->getManufacturer();
        $this->_list["stakeholder_id"][''] = "Select Manufacturer";
        if ($result1) {
        foreach ($result1 as $manufacturer) {
        $this->_list["stakeholder_id"][$manufacturer['pkId']] = $manufacturer['stakeholderName'];
        }
        } */
     //Generate Batch Type Combo
     $list = new Model_ListDetail();
     $list->form_values = array('listMaster' => Model_ListMaster::packaging_level);
     $result2 = $list->getListDetail();
     $this->_list["packaging_level"][''] = "Select Packaging Level";
     $this->_list["packaging_level_update"][''] = "Select Packaging Level";
     if ($result2) {
         foreach ($result2 as $packagingLevel) {
             $this->_list["packaging_level"][$packagingLevel->getPkId()] = $packagingLevel->getListValue();
             $this->_list["packaging_level_update"][$packagingLevel->getPkId()] = $packagingLevel->getListValue();
         }
     }
     /* /Generate Expiry Date Format Combo
        $list = new Model_ListDetail();
        $list->form_values = array('listMaster' => Model_ListMaster::EXPIRY_DATE_FORMAT);
        $result3 = $list->getListDetail();
        $this->_list["expiry_date_format"][''] = "Select Expiry Date Format";
        if ($result3) {
        foreach ($result3 as $expirydateformat) {
        $this->_list["expiry_date_format"][$expirydateformat->getPkId()] = $expirydateformat->getListValue();
        }
        } */
     foreach ($this->_hidden as $col => $name) {
         switch ($col) {
             case "barcode_id":
                 $this->addElement("hidden", $col);
                 $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag");
                 break;
             case "barcode_ty_id":
                 $this->addElement("hidden", $col);
                 $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag");
                 break;
             default:
                 break;
         }
     }
     foreach ($this->_fields as $col => $name) {
         switch ($col) {
             case "item_gtin":
             case "batch_length":
             case "gtin_start_position":
             case "batch_no_start_position":
             case "expiry_date_start_position":
             case "gtin_end_position":
             case "batch_no_end_position":
             case "expiry_date_end_position":
                 //case "expiry_date_format";
             //case "expiry_date_format";
             case "quantity_per_pack":
             case "volume_per_unit_net":
                 $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;
                 /* case "expiry_date_format":
                    $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");
                    $this->getElement($col)->setValue("YYMMDD");
                    break; */
             /* case "expiry_date_format":
                $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");
                $this->getElement($col)->setValue("YYMMDD");
                break; */
             case "pack_size_description":
                 $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;
             case "gtin":
             case "batch":
             case "expiry":
                 $this->addElement("checkbox", $col, array("attribs" => array("class" => "form-control"), "allowEmpty" => true, "filters" => array("StringTrim", "StripTags"), "validators" => array()));
                 $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag");
                 break;
             case "length":
                 $this->addElement("text", $col, array("attribs" => array("class" => "form-control", "placeholder" => "Length"), "allowEmpty" => true, "filters" => array("StringTrim", "StripTags"), "validators" => array()));
                 $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag");
                 break;
             case "width":
                 $this->addElement("text", $col, array("attribs" => array("class" => "form-control", "placeholder" => "Width"), "allowEmpty" => true, "filters" => array("StringTrim", "StripTags"), "validators" => array()));
                 $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag");
                 break;
             case "height":
                 $this->addElement("text", $col, array("attribs" => array("class" => "form-control", "placeholder" => "Height"), "allowEmpty" => true, "filters" => array("StringTrim", "StripTags"), "validators" => array()));
                 $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag");
                 break;
             case "pre_printed_barcode":
                 $this->addElement("checkbox", $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 (in_array($col, array_keys($this->_list))) {
             $this->addElement("select", $col, array("attribs" => array("class" => "form-control"), "filters" => array("StringTrim", "StripTags"), "allowEmpty" => true, "required" => false, "registerInArrayValidator" => false, "multiOptions" => $this->_list[$col], "validators" => array(array("validator" => "Float", "breakChainOnFailure" => false, "options" => array("messages" => array("notFloat" => $name . " must be a valid option"))))));
             $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag");
         }
     }
     foreach ($this->_hidden as $col => $name) {
         switch ($col) {
             case "item_pack_size_id_hidden":
             case "stakeholder_id_update_hidden":
                 $this->addElement("hidden", $col);
                 $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag");
                 break;
             default:
                 break;
         }
     }
 }