Esempio n. 1
0
 public function irrigationprofile()
 {
     $crud = new Grocery_CRUD();
     $crud->set_model('crud_model');
     $crud->set_table('irr_history')->set_theme('datatables')->columns('irr_id', 'province', 'municipality', 'barangay', 'service_area', 'farmers_served', 'year')->display_as('irr_id', 'Name of Irrigation')->display_as('service_area', 'Area served (ha)')->display_as('farmers_served', 'No. of farmers served')->set_relation('irr_id', 'irrigation', 'irr_name')->unset_read()->fields('irr_id', 'province', 'municipality', 'barangay', 'harvest_fac', 'fm_road', 'year');
     $crud->required_fields('irr_id', 'province');
     $crud->callback_before_insert(array($this, '_callback_place_id'));
     $crud->callback_before_update(array($this, '_callback_place_id'));
     $crud->callback_field('province', array($this, '_callback_province'));
     $this->dependent_dropdown_place($crud, 'irr_history', 'irrhist_id');
 }
Esempio n. 2
0
 public function cropprofile()
 {
     $crud = new Grocery_CRUD();
     $crud->set_model('crud_model');
     $crud->set_table('crop_history')->set_theme('datatables')->columns('crop_id', 'province', 'municipality', 'barangay', 'area', 'volume', 'value', 'year')->display_as('crop_id', 'Crops')->display_as('area', 'Area planted or harvested (ha)')->display_as('volume', 'Volume of Production (metric tons)')->display_as('value', 'Value of Production (thousand php)')->set_relation('crop_id', 'crops', 'crop_species')->unset_read();
     $crud->fields('place_id', 'crop_id', 'province', 'municipality', 'barangay', 'area', 'volume', 'value');
     $crud->field_type('place_id', 'invisible');
     $crud->required_fields('province', 'crop_id');
     $crud->callback_field('province', array($this, '_callback_province'));
     $crud->callback_before_insert(array($this, '_callback_place_id'));
     $crud->callback_before_update(array($this, '_callback_place_id'));
     $this->dependent_dropdown_place($crud);
 }
Esempio n. 3
0
 function placeprofile()
 {
     $crud = new Grocery_CRUD();
     $crud->set_model('crud_model');
     $crud->set_table('place_history');
     $crud->columns('province', 'municipality', 'barangay', 'land_area', 'population', 'year');
     $crud->unset_read();
     $crud->set_theme('datatables');
     $crud->fields('place_id', 'province', 'municipality', 'barangay', 'land_area', 'population', 'year');
     $crud->field_type('place_id', 'invisible');
     $crud->required_fields('province');
     $crud->callback_before_insert(array($this, '_callback_place_id'));
     $crud->callback_before_update(array($this, '_callback_place_id'));
     $crud->callback_field('province', array($this, '_callback_province'));
     $this->dependent_dropdown_place($crud);
     $output = $crud->render();
 }
Esempio n. 4
0
 public function waterbodies()
 {
     $crud = new Grocery_CRUD();
     $crud->set_model('crud_model');
     $crud->set_table('water_body')->set_theme('datatables')->columns('water_name', 'water_type', 'province', 'municipality', 'barangay', 'count')->display_as('water_name', 'Name of water body')->display_as('water_type', 'Type / kind of water body')->display_as('area', 'Area planted or harvested (ha)')->display_as('area', 'Area covered (ha)')->unset_read();
     $crud->fields('water_id', 'water_name', 'water_type', 'place_id', 'province', 'municipality', 'barangay', 'count');
     $crud->field_type('place_id', 'invisible');
     $crud->field_type('water_id', 'invisible');
     $crud->required_fields('water_type', 'province');
     $crud->change_field_type('water_type', 'enum', $this->aquatic_model->get_watertype());
     $crud->callback_before_insert(array($this, '_callback_place_id'));
     $crud->callback_before_update(array($this, '_callback_place_id'));
     $crud->callback_field('province', array($this, '_callback_province'));
     $this->dependent_dropdown_place($crud, 'water_body', 'water_id');
 }
Esempio n. 5
0
 public function view_irrigation()
 {
     $crud = new Grocery_CRUD();
     $crud->set_model('crud_model');
     $crud->set_table('irr_history')->set_theme('datatables')->columns('irr_name', 'province', 'municipality', 'barangay', 'service_area', 'farmers_served', 'year')->display_as('irr_id', 'Name of Irrigation')->display_as('service_area', 'Area served (ha)')->display_as('farmers_served', 'No. of farmers served')->unset_edit()->unset_read()->unset_delete()->unset_add()->where('irr_history.place_id', $this->place_id);
     foreach ($this->sub_place as $sub) {
         $crud->or_where('irr_history.place_id', $sub->place_id);
     }
     $output = $crud->render();
     $profile = array();
     $profile['id'] = "irrigation";
     $output->data = $profile;
     $this->load->view('profile', $output);
 }