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
 public function incidencias()
 {
     $crud = new Grocery_CRUD();
     $crud->set_table('incidencias');
     $crud->set_relation('idtipo', 'tipos_incidencias', 'descripcion');
     $crud->set_relation('idusuario', 'usuarios', 'nombre');
     $crud->columns('numero', 'idtipo', 'descripcion', 'estado', 'fecha_alta', 'idusuario');
     $crud->add_fields('numero', 'idtipo', 'descripcion', 'fecha_alta', 'Idusuario');
     $crud->field_type('numero', 'hidden');
     $crud->field_type('fecha_alta', 'hidden');
     $crud->field_type('Idusuario', 'hidden');
     $crud->edit_fields('id', 'idtipo', 'descripcion', 'estado', 'Idusuario', 'fecha_fin');
     $crud->callback_before_insert(array($this->User_Model, 'alta_incidencia_callback'));
     $crud->callback_before_update(array($this->User_Model, 'editar_incidencia_callback'));
     $crud->display_as('idtipo', 'Tipo');
     $output = $crud->render();
     $this->cargarVista($output);
 }
Esempio n. 4
0
 public function callback_before_insert($callback = null, $override_all = 0)
 {
     if (!$override_all) {
         $this->callback_before_insert_ext[] = $callback;
         if ($this->callback_before_insert == null) {
             $this->callback_before_insert = array($this, 'extended_callback_before_insert');
         }
     } else {
         parent::callback_before_insert($callback);
     }
     return $this;
 }
Esempio n. 5
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. 6
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();
 }