Пример #1
0
 public function index()
 {
     $data = array();
     $data['result'] = $this->property_model->dashboardProperties(getLoginUserId(), 0);
     $data['title'] = "Dashobard";
     $this->render('admin/dashboard', $data);
 }
Пример #2
0
 function update($id)
 {
     $data = $this->input->post();
     $array = array('alert_type' => $data['alert_type'], 'property_type_id' => $data['property_type_id'], 'property_purpose_id' => $data['property_purpose_id'], 'price_range' => $data['price_range'], 'beds' => $data['beds'], 'baths' => $data['baths'], 'city_id' => $data['city_id'], 'location_id' => $data['location_id'], 'keyword' => $data['keyword'], 'covered_area' => $data['covered_area'], 'agent_id' => $data['agent_id'], 'modified_on' => date("Y-m-d H:i:s"), 'modified_by' => getLoginUserId());
     $this->db->where('alert_id', $id);
     $this->db->update('alert', $array);
     //return ($this->db->affected_rows() != 1) ? false : true;
     return true;
 }
Пример #3
0
 public function change_password()
 {
     if ($this->input->post('submit')) {
         try {
             $Verify_Result = $this->misc_model->verify_password(getLoginUserId());
             if (is_object($Verify_Result)) {
                 $result = $this->misc_model->update_password(getLoginUserId());
                 if ($result) {
                     setNotification('success', 'Record updated successfully');
                     redirect(base_url('admin/profile/change_password'));
                 }
             } else {
                 setNotification('danger', 'New & Confirm password does not match.');
                 redirect(base_url('admin/profile/change_password'));
             }
         } catch (Exception $e) {
             setNotification('danger', 'Error in updating record');
         }
     }
     $data = array();
     $data['title'] = "Change Password";
     $this->render('admin/profile/change_password', $data);
 }
Пример #4
0
 function updateProfile($id)
 {
     $data = $this->input->post();
     $array = array('name' => $data['name'], 'email' => $data['email'], 'cell_no' => $data['cell_no'], 'phone_no' => $data['phone_no'], 'city_id' => $data['city_id'], 'location_id' => $data['location_id'], 'zipcode' => $data['zipcode'], 'address' => $data['address'], 'about' => $data['about'], 'modified_on' => date("Y-m-d H:i:s"), 'modified_by' => getLoginUserId());
     $this->db->where('user_id', $id);
     $this->db->update('user', $array);
     //return ($this->db->affected_rows() != 1) ? false : true;
     return true;
 }
Пример #5
0
 public function quick($id = NULL)
 {
     if ($this->input->post('submit') && $id !== NULL) {
         try {
             $result = $this->property_model->update($id);
             if ($result) {
                 setNotification('success', 'Record updated successfully');
                 redirect(base_url('admin/property/pending'));
             }
         } catch (Exception $e) {
             setNotification('error', 'Error in updating record');
         }
     } else {
         if ($this->input->post('submit') && $id == NULL) {
             try {
                 $PropertyID = $this->property_model->insert();
                 $PostData = $this->input->post();
                 if (array_key_exists('is_client_property', $PostData) && $PostData['is_new_client'] == 'true') {
                     $ClientID = $this->property_model->insertClient();
                     $this->property_model->updateClientIDofProperty($ClientID, $PropertyID);
                 }
                 $this->property_model->insertContactPerson($PropertyID);
                 if ($PropertyID) {
                     $this->uploadPropertyImages($PropertyID);
                     setNotification('success', 'Property added successfully');
                     redirect(base_url('admin/property/pending'));
                 }
             } catch (Exception $e) {
                 setNotification('error', 'Error in adding record');
             }
         }
     }
     $data = array();
     $data['purpose_list'] = $this->misc_model->getPropertyPurposeList();
     $type_list = $this->misc_model->getPropertyTypeList();
     //        foreach ($type_list as $value) {
     //            if($value->parent_property_type_id == NULL) {
     //                $data['type_list'][] = $value;
     //                foreach ($type_list as $value2) {
     //                    if($value2->parent_property_type_id == $value->property_type_id) {
     //                        $data['type_list'][] = $value2;
     //                    }
     //                }
     //            }
     //        }
     $data['type_list'] = sortedPropertyTypes($type_list);
     $data['cities'] = $this->misc_model->getCities(1);
     // country_id
     $data['area_units'] = $this->misc_model->getAreaUnits();
     $data['construction_status'] = $this->misc_model->getConstructionStatus();
     $data['clients'] = $this->misc_model->getClients(getLoginUserId());
     $data['title'] = "Post New Listing";
     $this->render('admin/property/quick', $data);
 }
Пример #6
0
 function delete($id)
 {
     $array = array('is_deleted' => 1, 'modified_on' => date("Y-m-d H:i:s"), 'modified_by' => getLoginUserId());
     $this->db->where('property_id', $id);
     $this->db->update('property', $array);
     return $this->db->affected_rows() != 1 ? false : true;
 }
Пример #7
0
 public function index()
 {
     if ($this->input->post('submit') && $this->input->post('submit') == 'submit_profile') {
         $result = $this->user_model->updateProfile(getLoginUserId());
         if ($result) {
             setNotification('success', 'Record updated successfully');
             redirect(base_url('admin/profile'));
         } else {
             setNotification('error', 'Error in updating record');
             redirect(base_url('admin/profile'));
         }
     }
     // Change Profile image
     if ($this->input->post('submit') && $this->input->post('submit') == 'submit_profile_pic') {
         try {
             $config['upload_path'] = $_SERVER['DOCUMENT_ROOT'] . '/property/public/uploads/user/' . getLoginUserId();
             $config['allowed_types'] = 'gif|jpg|jpeg|png';
             $config['overwrite'] = TRUE;
             if (!file_exists($config['upload_path']) && !is_dir($config['upload_path'])) {
                 mkdir($config['upload_path'], 0777, TRUE);
             }
             $this->load->library('upload', $config);
             $this->upload->initialize($config);
             if (!$this->upload->do_upload('profile_pic')) {
                 $error = $this->upload->display_errors();
                 setNotification('danger', 'Error. File not uploaded. ' . $error);
             } else {
                 $result = $this->user_model->updateProfileImage(getLoginUserId());
                 if ($result) {
                     setNotification('success', 'Profile image updated successfully');
                     $data = array('upload_data' => $this->upload->data());
                 }
             }
             redirect(base_url('user/profile'));
         } catch (Exception $e) {
             setNotification('danger', 'Error. Coudn\'t register. Try later.');
         }
     }
     // Change Password
     if ($this->input->post('submit') && $this->input->post('submit') == 'submit_change_password') {
         try {
             $Verify_Result = $this->misc_model->verify_password(getLoginUserId());
             if (is_object($Verify_Result)) {
                 $result = $this->misc_model->update_password(getLoginUserId());
                 if ($result) {
                     setNotification('success', 'Password updated successfully');
                     redirect(base_url('user/profile'));
                 }
             } else {
                 setNotification('danger', 'New & Confirm password does not match.');
                 redirect(base_url('user/profile'));
             }
         } catch (Exception $e) {
             setNotification('danger', 'Error in updating record');
         }
     }
     // Save Roles
     if ($this->input->post('submit') && $this->input->post('submit') == 'submit_user_roles') {
         try {
             $result = $this->user_model->updateUserRoles(getLoginUserId());
             if ($result) {
                 setNotification('success', 'Your user roles sent for approval sucessfully.');
                 redirect(base_url('user/profile'));
             }
         } catch (Exception $e) {
             setNotification('danger', 'Error. Coudn\'t save data. Try later.');
         }
     }
     $data = array();
     $data['user'] = $this->user_model->fetch(getLoginUserId());
     //        var_dump($data['user']->location_id); exit;
     $data['image_path'] = "http://" . $_SERVER['SERVER_NAME'] . '/property/public/uploads/user/' . $data['user']->user_id . '/' . $data['user']->profile_pic;
     $data['cities'] = $this->misc_model->getCities(1);
     // country_id
     // Follwoing code will fetch all possible user roles
     $UserRoles = $this->user_model->getUserRoles();
     $data['role_list'] = sortedUserRoles($UserRoles);
     // Current User's already saved roles
     $AgentUserRoles = $this->user_model->getAgentUserRoles(getLoginUserId());
     foreach ($AgentUserRoles as $value) {
         $data['agent_role_list'][] = $value->role_id;
     }
     //        var_dump($data['agent_role_list']); exit;
     $data['title'] = "My Profile";
     $this->render('user/profile/index', $data);
 }
Пример #8
0
 function addPropertyToFavoriteList()
 {
     $data = $this->input->post();
     $this->db->select('*');
     $this->db->from('favorite_property');
     $this->db->where('property_id', $data['property_id']);
     $this->db->where('is_deleted', 0);
     $this->db->where('created_by', getLoginUserId());
     $query = $this->db->get();
     $result = $query->row();
     if ($result == null) {
         $array = array('property_id' => $data['property_id'], 'created_by' => getLoginUserId());
         $this->db->insert('favorite_property', $array);
         return $this->db->affected_rows() != 1 ? false : true;
     } else {
         $array = array('is_deleted' => 1);
         $this->db->where('property_id', $data['property_id']);
         $this->db->where('created_by', getLoginUserId());
         $this->db->update('favorite_property', $array);
         return $this->db->affected_rows() != 1 ? false : true;
     }
 }
Пример #9
0
 function getFavoriteAgents()
 {
     $this->db->select('fa.favorite_agent_id, u.name, lo.name as location_name');
     $this->db->from('favorite_agent fa');
     $this->db->join('user u', 'u.user_id = fa.created_by');
     $this->db->join('location lo', 'lo.location_id = u.location_id');
     $this->db->where('fa.is_deleted', 0);
     $this->db->where('fa.created_by', getLoginUserId());
     $query = $this->db->get();
     return $query->result();
 }