public function profile() { $data = array(); $ObjQuery = new queryModel(); $ObjContactsTemp = new contactsTempModel(); $ObjContacts = new contactsModel(); $ObjCompanies = new companiesModel(); $contcol = $ObjContacts->get_loggin_user_info(); $data = $ObjQuery->object_to_array($contcol); if (isset($contcol->cont_status) && $contcol->cont_status == 'Validate Company') { $company_col = $ObjContacts->get_record_join(array('`j1`.`company_id`=' => $contcol->company_id)); $data['comp_name'] = $company_col->comp_name; $data['cont_email'] = $company_col->cont_email; $data['cont_firstname'] = $company_col->cont_firstname; $data['cont_lastname'] = $company_col->cont_lastname; } $secret_question = isset($contcol->secret_question) ? $contcol->secret_question : ''; $data['select_secret_question'] = $ObjContacts->select_secret_question($secret_question); return View::make('profile', $data); }
public function update_uploaded_contacts_value($fields, $cut_id) { $ObjContacts = new contactsModel(); $ObjCompanies = new companiesModel(); $error_message = ''; $result = TRUE; $email_address = ''; $last_name = ''; $first_name = ''; $address1 = ''; $city = ''; $state_code = ''; $zipcode = ''; $company = ''; foreach ($fields as $col) { $column = $col->cuff_column; $fieldname = $col->cuff_fieldname; $status = $col->cuff_status; $col = Input::get($column); $value = $col[$cut_id]; if ($status == 'close' && $fieldname != '') { ${$fieldname} = $value; } } $company_exist = $ObjCompanies->get_company_id_check_if_company_exist($company, $address1, $city, $state_code, $zipcode); if ($email_address == '') { $error_message = 'Email Address required'; $result = FALSE; } elseif ($company == '') { $error_message = 'Company Name required'; $result = FALSE; } elseif ($email_address) { $where_params = array('`j`.`email_address`=' => $email_address, '`j1`.`company_name`=' => $company, '`j1`.`address1`=' => $address1, '`j1`.`city`=' => $city, '`j1`.`state_code`=' => $state_code, '`j1`.`zipcode`=' => $zipcode); $check_email = $ObjContacts->get_record_join($where_params); if ($check_email) { $error_message = 'Email Address already exist.'; $result = FALSE; } } elseif ($last_name && $first_name) { $where_params = array('`last_name`=' => $last_name, '`first_name`=' => $first_name); $check_contact = $ObjContacts->get_record($where_params); if ($check_contact) { $error_message = 'Contact Name already exist.'; $result = FALSE; } } elseif ($company_exist != '') { $error_message = 'Contact Joe Smith and ask him to add you to to your companies account.'; $result = FALSE; } foreach ($fields as $col) { $column = $col->cuff_column; $fieldname = $col->cuff_fieldname; $status = $col->cuff_status; $col = Input::get($column); $value = $col[$cut_id]; if ($status == 'close' && $fieldname != '') { $data[$column] = $value; } } $data[$this->tblpref . 'error_message'] = $error_message; $this->update_data($data, $cut_id); return $result; }