示例#1
0
	function get_info_customer($customer_id)
	{
		$this->db->from('employees');	
		$this->db->join('people', 'people.person_id = employees.person_id');
		// $this->db->join('app_files', 'people.image_id = app_files.file_id');
		$this->db->where('employees.person_id',$customer_id);
		$query = $this->db->get();
		
		if($query->num_rows()==1)
		{
			return $query->row();
		}
		else
		{
			//Get empty base parent object, as $customer_id is NOT an customer
			$person_obj=parent::get_info(-1);
			
			//Get all the fields from customer table
			$fields = $this->db->list_fields('employees');
			
			//append those fields to base parent object, we we have a complete empty object
			foreach ($fields as $field)
			{
				$person_obj->$field='';
			}
			
			return $person_obj;
		}
	}
示例#2
0
 function get_info($user_id)
 {
     $this->db->from('user');
     $this->db->where('user_id', $user_id);
     $query = $this->db->get();
     if ($query->num_rows() == 1) {
         return $query->row();
     } else {
         //Get empty base parent object, as $employee_id is NOT an employee
         $person_obj = parent::get_info(-1);
         //Get all the fields from employee table
         $fields = $this->db->list_fields('user_name');
         //append those fields to base parent object, we we have a complete empty object
         foreach ($fields as $field) {
             $person_obj->{$field} = '';
         }
         return $person_obj;
     }
 }
 function get_info($supplier_id)
 {
     $this->db->from('suppliers');
     $this->db->join('people', 'people.person_id = suppliers.person_id');
     $this->db->where('suppliers.person_id', $supplier_id);
     $query = $this->db->get();
     if ($query->num_rows() == 1) {
         return $query->row();
     } else {
         //Get empty base parent object, as $supplier_id is NOT an supplier
         $person_obj = parent::get_info(-1);
         //Get all the fields from supplier table
         $fields = $this->db->list_fields('suppliers');
         //append those fields to base parent object, we we have a complete empty object
         foreach ($fields as $field) {
             $person_obj->{$field} = '';
         }
         return $person_obj;
     }
 }