PHP User::set_welf_name Examples

PHP User::set_welf_name - 2 examples found. These are the top rated real world PHP examples of User::set_welf_name extracted from open source projects. You can rate examples to help us improve the quality of examples.
 public function get_all()
 {
     //ARRAY OBJECT HARU PASS GARNA
     $user_list = array();
     //DATABASE CONNECTION
     $this->db->connect();
     //SELECT ALL QUERY
     $sql = "SELECT user_id,user_name,first_name,last_name,contact_number,user_type,user_status,name,doe,img,address,service,objective FROM user INNER JOIN welfare ON user_id = u_id";
     //fetchquery
     $result = $this->db->fetchquery($sql);
     //STORE IN OBJECT AND SEND TO VIEW
     while ($row = $result->fetch_assoc()) {
         $user = new User();
         $user->set_user_id($row['user_id']);
         $user->set_user_name($row['user_name']);
         $user->set_first_name($row['first_name']);
         $user->set_last_name($row['last_name']);
         $user->set_contact_number($row['contact_number']);
         $user->set_user_type($row['user_type']);
         $user->set_user_status($row['user_status']);
         $user->set_welf_name($row['name']);
         $user->set_welf_doe($row['doe']);
         $user->set_welf_img($row['img']);
         $user->set_welf_address($row['address']);
         $user->set_welf_objective($row['objective']);
         $user->set_welf_service($row['service']);
         array_push($user_list, $user);
     }
     $this->db->close();
     return $user_list;
 }
Example #2
0
 private function _map_posted_data()
 {
     $user = new User();
     $user->set_user_name($_POST['user_name']);
     $user->set_first_name($_POST['first_name']);
     $user->set_last_name($_POST['last_name']);
     $user->set_contact_number($_POST['contact_number']);
     if (isset($_POST['user_type'])) {
         $user->set_user_type($_POST['user_type']);
     }
     $user->set_user_status($_POST['user_status']);
     if (isset($_POST['password'])) {
         $user->set_password($_POST['password']);
     }
     if ($_POST['user_type'] == 'organization') {
         $user->set_name($_POST['name']);
         $user->set_doe($_POST['doe']);
         $user->set_address($_POST['address']);
         $user->set_objective($_POST['objective']);
         //store file
         $filename = $_FILES['img']['name'];
         $path = PUBLIC_PATH . "/pictures/orgPictures/";
         move_uploaded_file($_FILES['img']['tmp_name'], $path . $filename);
         $savepath = PUBLIC_PATH2 . "/pictures/orgPictures/";
         $user->set_img($savepath . $filename);
     } elseif ($_POST['user_type'] == 'welfare') {
         $user->set_welf_name($_POST['welf_name']);
         $user->set_welf_doe($_POST['welf_doe']);
         $user->set_welf_service($_POST['welf_service']);
         $user->set_welf_address($_POST['welf_address']);
         $user->set_welf_objective($_POST['welf_objective']);
         //store file
         $filename = $_FILES['img']['name'];
         $path = PUBLIC_PATH . "/pictures/welfPictures/";
         move_uploaded_file($_FILES['img']['tmp_name'], $path . $filename);
         $savepath = PUBLIC_PATH2 . "/pictures/welfPictures/";
         $user->set_welf_img($savepath . $filename);
     }
     return $user;
 }