Esempio n. 1
0
 public function init()
 {
     $locations = new Model_Locations();
     $result = $locations->getAllProvinces();
     if ($result) {
         $this->_list["province"][''] = "Select";
         foreach ($result as $row) {
             $this->_list["province"][$row['pkId']] = $row['locationName'];
         }
     }
     //Generate
     $locations = new Model_Locations();
     $result = $locations->getSindhDistricts();
     $this->_list["district"][''] = "Select";
     if ($result) {
         foreach ($result as $row) {
             $this->_list["district"][$row['pkId']] = $row['locationName'];
         }
     }
     $date_from = date('01/m/Y');
     $date_to = date('d/m/Y');
     foreach ($this->_fields as $col => $name) {
         switch ($col) {
             case "name":
             case "father_name":
             case "age":
             case "contact":
             case "address":
             case "item_1":
             case "item_2":
             case "item_3":
             case "item_4":
             case "item_5":
             case "reffers_to":
             case "remarks":
                 $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 "vaccination_date_from":
                 $this->addElement("text", $col, array("attribs" => array("class" => "form-control", 'readonly' => 'true', 'style' => 'position: relative; z-index: 100000;'), "allowEmpty" => false, "filters" => array("StringTrim", "StripTags"), "validators" => array(), "value" => $date_from));
                 $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag");
                 break;
             case "vaccination_date_to":
                 $this->addElement("text", $col, array("attribs" => array("class" => "form-control", 'readonly' => 'true', 'style' => 'position: relative; z-index: 100000;'), "allowEmpty" => false, "filters" => array("StringTrim", "StripTags"), "validators" => array(), "value" => $date_to));
                 $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");
         }
         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], 'value' => '1'));
             $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag")->removeDecorator("<br>");
         }
     }
 }
 public function init()
 {
     //Generate month Combo
     $this->_list["month"][''] = 'Select';
     $this->_list["month"]['01'] = 'January';
     $this->_list["month"]['02'] = 'February';
     $this->_list["month"]['03'] = 'March';
     $this->_list["month"]['04'] = 'April';
     $this->_list["month"]['05'] = 'May';
     $this->_list["month"]['06'] = 'June';
     $this->_list["month"]['07'] = 'July';
     $this->_list["month"]['08'] = 'August';
     $this->_list["month"]['09'] = 'September';
     $this->_list["month"]['10'] = 'October';
     $this->_list["month"]['11'] = 'November';
     $this->_list["month"]['12'] = 'December';
     //Generate year Combo
     $this->_list["year"][''] = 'Select';
     //        for ($y = 2013; $y <= date("Y"); $y++) {
     //            $this->_list["year"][$y] = $y;
     //        }
     $this->_list["year"][date("Y")] = date("Y");
     //Generate Province/Region Combo
     $locations = new Model_Locations();
     $result = $locations->getAllProvinces();
     if ($result) {
         $this->_list["province_region"][''] = "Select";
         foreach ($result as $row) {
             $this->_list["province_region"][$row['pkId']] = $row['locationName'];
         }
     }
     //Generate Antigen(items) Combo
     $item_pack_sizes = new Model_ItemPackSizes();
     $result2 = $item_pack_sizes->getAllVaccines();
     foreach ($result2 as $item) {
         $this->_list["product"][''] = 'Select';
         $this->_list["product"][$item['pkId']] = $item['itemName'];
     }
     foreach ($this->_fields as $col => $name) {
         //            switch ($col) {
         //
         //                case "year":
         //                    $this->addElement("text", $col, array(
         //                        "attribs" => array("class" => "form-control", 'readonly' => 'true', 'style' => 'position: relative; z-index: 100000;'),
         //                        "allowEmpty" => false,
         //                        "filters" => array("StringTrim", "StripTags"),
         //                        "validators" => array(),
         //                        "value" => date("Y")
         //                    ));
         //                    $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag");
         //                    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()
 {
     $locations = new Model_Locations();
     $result2 = $locations->getAllProvinces();
     foreach ($result2 as $item) {
         $this->_list["province"][''] = 'Select';
         $this->_list["province"][$item['pkId']] = $item['locationName'];
     }
     $this->_list["district"][''] = 'Select';
     $this->_list["user"][''] = 'Select';
     foreach ($this->_fields as $col => $name) {
         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");
         }
         switch ($col) {
             case "starting_on":
             case "working_uptil":
             case "from_edit":
                 $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->_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");
         }
     }
     foreach ($this->_hidden as $col => $name) {
         switch ($col) {
             case "user_hidden":
             case "district_hidden":
             case "province_hidden":
                 $this->addElement("hidden", $col);
                 $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag");
                 break;
             default:
                 break;
         }
     }
 }
 public function init()
 {
     //Generate Provinces Combo
     $locations = new Model_Locations();
     $provinces = $locations->getAllProvinces();
     $this->_list["combo1"][''] = "Select";
     $this->_list["combo1_add"][''] = "Select";
     if ($provinces) {
         foreach ($provinces as $row) {
             $this->_list["combo1"][$row['pkId']] = $row['locationName'];
             $this->_list["combo1_add"][$row['pkId']] = $row['locationName'];
         }
     }
     $this->_list["combo2_add"][''] = "Select Province";
     $this->_list["combo2"][''] = "Select Province";
     //Generate Facility Type Combo
     $warehouse = new Model_Warehouses();
     $warehouse->form_values['stakeholder_id'] = 1;
     $wh_types = $warehouse->getAllHealthFacilityTypesByStakeholder();
     $this->_list["facility_type"][''] = "Select";
     if ($wh_types) {
         foreach ($wh_types as $row) {
             $this->_list["facility_type"][$row['pkId']] = $row['warehouseTypeName'];
         }
     }
     $this->_list["year"][''] = "Select";
     $yy = date('Y');
     $end_year = 2014;
     for ($i = $yy; $i >= $end_year; $i = $i - 1) {
         $this->_list["year"][$i] = $i;
     }
     $campaign = new Model_Campaigns();
     $result1 = $campaign->allCampaigns();
     $this->_list["campaign_id"][''] = 'Select';
     foreach ($result1 as $row) {
         $this->_list["campaign_id"][$row['pkId']] = $row['campaignName'];
     }
     foreach ($this->_fields as $col => $name) {
         switch ($col) {
             /* case "abc":
                $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");
         }
     }
     foreach ($this->_hidden as $col => $name) {
         switch ($col) {
             case "district_id_hidden":
                 $this->addElement("hidden", $col);
                 $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag");
                 break;
             default:
                 break;
         }
     }
 }