示例#1
0
 public function add()
 {
     $form = array('building_id' => '', 'name' => '', 'index' => '', 'img_uri' => '', 'active' => '');
     $errors = $form;
     if ($_POST) {
         $post = new Validation($_POST);
         $post->pre_filter('trim', true);
         $post->add_rules('buildings_id', 'required', 'digit');
         $post->add_rules('name', 'required');
         $post->add_rules('index', 'required');
         $post->add_rules('img_uri', 'required');
         $post->add_rules('active', 'required');
         if ($post->validate()) {
             // check for invilid
             $form = arr::overwrite($form, $post->as_array());
             $people = new Person_Model();
             $result = $people->save($this->input->get('person'), $person_id);
         } else {
             $form = arr::overwrite($form, $post->as_array());
             client::validation_results(arr::overwrite($errors, $post->errors('hiring_employee_form_validations')));
             client::messageSend("There were errors in some fields", E_USER_WARNING);
         }
     }
     $building = new Building_Model();
     $buildings_list = $building->select_list();
     $this->template->title = 'Seating::Spaces::Add';
     $this->template->content = new View('pages/spaces_add');
     $this->template->content->form = $form;
     $this->template->content->buildings_list = $buildings_list;
 }
示例#2
0
 public function remove($person_id = null)
 {
     $person_id = (int) preg_replace('/\\.json$/i', '', $person_id);
     $result = null;
     $people = new Person_Model();
     $result = $people->remove($person_id);
     if ($this->is_json_request()) {
         $this->json_response($result);
     }
     //    die($update_context);
 }
示例#3
0
 function __construct($data = null)
 {
     parent::__construct($data);
     $this->table_name = 'users';
     $this->primary_key = 'users.userId';
     if ($data != null) {
         $this->id = $data->userId;
         $this->userName = $data->userName;
         $this->password = $data->password;
         $this->accesslevel = $data->accesslevel;
     }
 }
 public function delete()
 {
     $this->db->trans_start();
     $this->db->where('persons.personId', $this->personId);
     $affected = $this->db->delete('persons') + parent::_delete();
     $this->db->trans_commit();
     $this->db->trans_complete();
     return $affected;
 }