Пример #1
0
function rSF($tableName)
{
    $fields = tableFields($tableName);
    $new_array = array();
    foreach ($fields as $field) {
        if (!gParam($field)) {
            continue;
        }
        $new_array[$field] = gParam($field);
    }
    return $new_array;
}
Пример #2
0
 function add()
 {
     $this->load->library('form_validation');
     if (arrIndex($_POST, 'type') == "dropdown") {
         if (empty(array_filter($_POST['drop']))) {
             $this->form_validation->set_rules('dropdown', 'Dropdown values', 'trim|required');
         }
     }
     $model = tableFields('units_attributes', true);
     $model['sort'] = 0;
     unset($model['id']);
     self::save($model, 0);
 }
Пример #3
0
 function getExtraFields($id)
 {
     $this->db->select('*');
     $this->db->where('id', $id);
     $query = $this->db->get('user_extra_detail')->row();
     if ($query) {
         $return = (array) $query;
     } else {
         $return = tableFields('user_extra_detail', true);
     }
     return $return;
 }
Пример #4
0
 function profile()
 {
     $uid = curUsrId();
     $path = '../../js/ckfinder';
     $width = '100%';
     $this->editor($path, $width);
     $this->load->library('form_validation');
     $this->load->helper('form');
     $this->load->helper('string');
     $this->load->library('encrypt');
     $this->load->model('practitioner/Practitionermodel');
     $this->load->model('therapies/Therapiesmodel');
     //check user
     $login_user = $this->userauth->checkAuth();
     if (!$this->checkAccess('EDIT_USER')) {
         $this->utility->accessDenied();
         return;
     }
     if ($uid == 1 && $this->aauth->isFrsUser()) {
         $this->session->set_flashdata('ERROR', 'premission_denied_user');
         redirect(createUrl('practitioner/index'));
     }
     //Fetch user details
     $user = array();
     $user = $this->Practitionermodel->fetchByID($uid);
     $get_therapies = $this->Therapiesmodel->getlistAll();
     $get_document_list = $this->Practitionermodel->getlistDocument($uid);
     if (!$user) {
         $this->utility->show404();
         return;
     }
     //validation check
     $this->form_validation->set_rules('protected_resource_id[]', 'Permission', 'trim');
     $this->form_validation->set_rules('name', 'name', 'trim|required|callback_valid_login_e');
     $this->form_validation->set_rules('email', 'Email', 'trim|required|valid_email|callback_valid_email_e');
     $this->form_validation->set_rules('passwd', 'Password', 'trim');
     $this->form_validation->set_rules('passwd1', 'confirm Password', 'trim|callback_check_pwd');
     $this->form_validation->set_rules('firstname', 'First name', 'trim|required');
     $this->form_validation->set_rules('lastname', 'Last name', 'trim|required');
     $this->form_validation->set_rules('address', 'Address', 'trim|required');
     $this->form_validation->set_rules('qualifications', 'Qualifications', 'trim|required');
     $this->form_validation->set_rules('city', 'City', 'trim|required');
     $this->form_validation->set_rules('county', 'County', 'trim|required');
     $this->form_validation->set_rules('post_code', 'Post Code', 'trim|required');
     $this->form_validation->set_rules('phone', 'Phone', 'trim|required');
     $this->form_validation->set_rules('open_time', 'Open Time', 'trim|required');
     $this->form_validation->set_rules('close_time', 'Close Time', 'trim|required');
     $this->form_validation->set_rules('app_fees', 'Appointment Fees', 'trim|required');
     $this->form_validation->set_rules('fees', 'Fees', 'trim');
     $this->form_validation->set_rules('website', 'Website', 'trim');
     //        $this->form_validation->set_rules('facebook', 'Facebook', 'trim');
     //        $this->form_validation->set_rules('twitter', 'Twitter', 'trim');
     //        $this->form_validation->set_rules('googlep', 'Google Plus', 'trim');
     //        $this->form_validation->set_rules('pinterest', 'Pinterest', 'trim');
     //        $this->form_validation->set_rules('paypal', 'Paypal', 'trim');
     $this->form_validation->set_error_delimiters('<li>', '</li>');
     //Render View
     if ($this->form_validation->run() == FALSE) {
         $inner = array();
         $inner['user'] = $user;
         $inner['uid'] = $uid;
         $inner['county_list'] = $this->usermodel->county_list();
         $inner['therapies'] = $get_therapies;
         $inner['get_document_list'] = $get_document_list;
         $page = array();
         $inner['extrafields'] = tableFields('user_extra_detail');
         $inner['user'] = array_merge($inner['user'], $this->Practitionermodel->getExtraFields($uid));
         //e($inner['user']);
         $inner['edit'] = $uid;
         $page['content'] = $this->load->view('about-page', $inner, TRUE);
         $this->load->view($this->customer, $page);
     } else {
         $this->Practitionermodel->updateProfileRecord($uid);
         $this->session->set_flashdata('SUCCESS', 'user_updated');
         redirect(createUrl('therapist/profile/'));
         exit;
     }
 }
 function addToCallHistory($call_info)
 {
     // mark all previous history entries as not being the current one
     $this->db->Execute("UPDATE call_history SET current='0' WHERE call_id='{$call_info['call_id']}'");
     $fields = tableFields('call_history');
     $call_info['comments'] = stripslashes($call_info['comments']);
     foreach ($call_info as $key => $val) {
         if (in_array($key, $fields)) {
             $keys .= $key . ",";
             if ($val == 'NOW()') {
                 $values .= 'NOW(),';
                 unset($call_info[$key]);
             } else {
                 $values .= "?,";
             }
             //end else
         }
         //end if
     }
     // end foreach
     $keys = trim($keys, ',');
     $values = trim($values, ',');
     $query = "INSERT INTO call_history ({$keys}) VALUES ({$values})";
     if ($this->db->Execute($query, $call_info)) {
         return true;
     } else {
         $_SESSION['user_message'] = 'Error inserting new call into call_history table in addToCallHistory().';
         return false;
     }
 }
Пример #6
0
 function edit($uid = 0)
 {
     $path = '../../js/ckfinder';
     $width = '698px';
     $this->editor($path, $width);
     $this->load->library('form_validation');
     $this->load->helper('form');
     $this->load->helper('string');
     $this->load->library('encrypt');
     //check user
     $login_user = $this->userauth->checkAuth();
     if (!$this->checkAccess('EDIT_USER')) {
         $this->utility->accessDenied();
         return;
     }
     if ($uid == 1 && $this->aauth->isFrsUser()) {
         $this->session->set_flashdata('ERROR', 'premission_denied_user');
         redirect(createUrl('user/index'));
     }
     //Fetch user details
     $user = array();
     $user = $this->Usermodel->fetchByID($uid);
     if (!$user) {
         $this->utility->show404();
         return;
     }
     //validation check
     $this->form_validation->set_rules('protected_resource_id[]', 'Permission', 'trim');
     $this->form_validation->set_rules('name', 'name', 'trim|required|callback_valid_login_e');
     $this->form_validation->set_rules('email', 'Email', 'trim|required|valid_email|callback_valid_email_e');
     $this->form_validation->set_rules('passwd', 'Password', 'trim');
     $this->form_validation->set_rules('passwd1', 'confirm Password', 'trim|callback_check_pwd');
     $this->form_validation->set_rules('firstname', 'First name', 'trim|required');
     $this->form_validation->set_rules('lastname', 'Last name', 'trim|required');
     $this->form_validation->set_rules('address', 'Address', 'trim|required');
     $this->form_validation->set_rules('qualifications', 'Qualifications', 'trim|required');
     $this->form_validation->set_rules('city', 'City', 'trim|required');
     $this->form_validation->set_rules('county', 'County', 'trim|required');
     $this->form_validation->set_rules('post_code', 'Post Code', 'trim|required');
     $this->form_validation->set_rules('phone', 'Phone', 'trim|required');
     $this->form_validation->set_error_delimiters('<li>', '</li>');
     //Render View
     if ($this->form_validation->run() == FALSE) {
         $inner = array();
         $inner['user'] = $user;
         $inner['uid'] = $uid;
         $inner['county_list'] = $this->usermodel->county_list();
         $page = array();
         $inner['extrafields'] = tableFields('user_extra_detail');
         $inner['user'] = array_merge($inner['user'], $this->Usermodel->getExtraFields($uid));
         //e($inner['user']);
         $inner['edit'] = $uid;
         $page['content'] = $this->load->view('edit-user', $inner, TRUE);
         $this->load->view($this->customer, $page);
     } else {
         $this->Usermodel->updateRecord($uid);
         $this->session->set_flashdata('SUCCESS', 'user_updated');
         redirect(createUrl('user/index/'));
         exit;
     }
 }
Пример #7
0
 function create($id = null)
 {
     $this->load->model('email_message/Emailmessagesmodel');
     $model = array();
     if ($id) {
         $model = $this->Emailmessagesmodel->detail($id);
     }
     $inner = $page = array();
     $inner['model'] = $model;
     $inner['fields'] = tableFields('email_content');
     $inner['templates'] = $this->Emailmessagesmodel->adminTemplate();
     if (!empty($_POST['email_name']) && !empty($_POST['email_alias']) && !empty($_POST['email_subject'])) {
         $this->Emailmessagesmodel->insertRecord($id);
         redirect('marketing/template');
     }
     $page['content'] = $this->load->view('email-templates/template', $inner, TRUE);
     $this->load->view($this->default, $page);
 }
Пример #8
0
 function edit($uid = 0)
 {
     $this->load->library('form_validation');
     $this->load->helper('form');
     $this->load->helper('string');
     $this->load->library('encrypt');
     $Countries = $this->Usermodel->getCountries();
     //check user
     $login_user = $this->userauth->checkAuth();
     if (!$this->checkAccess('EDIT_USER')) {
         $this->utility->accessDenied();
         return;
     }
     //        if (($uid == 1) && ($this->aauth->isFrsUser())) {
     //            $this->session->set_flashdata('ERROR', 'premission_denied_user');
     //            redirect(createUrl('user/index'));
     //        }
     //Fetch user details
     $user = array();
     $user = $this->Usermodel->fetchByID($uid);
     if (!$user) {
         $this->utility->show404();
         return;
     }
     //validation check
     $this->form_validation->set_rules('name', 'Name', 'trim|required|callback_valid_login');
     $this->form_validation->set_rules('email', 'Email', 'trim|required|valid_email|callback_email_check');
     if ($this->input->post('pass') != NULL) {
         if ($this->input->post('pass') != $this->input->post('pass1')) {
             $this->session->set_flashdata('ERROR', 'pass_invalid');
             redirect(createUrl('user/edit/' . $uid));
             $valid = false;
         }
     }
     //        $this->form_validation->set_rules('city', 'City', 'trim|required');
     //        $this->form_validation->set_rules('state', 'State', 'trim|required');
     //        $this->form_validation->set_rules('country', 'Country', 'trim|required');
     //        $this->form_validation->set_rules('mobile', 'Mobile', 'trim|required');
     //        $this->form_validation->set_rules('address', 'Address', 'trim|required');
     $this->form_validation->set_error_delimiters('<li>', '</li>');
     //Render View
     if ($this->form_validation->run() == FALSE) {
         $inner = array();
         $inner['user'] = $user;
         $inner['uid'] = $uid;
         $page = array();
         $inner['extrafields'] = tableFields('user_extra_detail');
         $inner['user'] = array_merge($inner['user'], $this->Usermodel->getExtraFields($uid));
         $inner['country'] = $Countries;
         $inner['edit'] = $uid;
         $page['content'] = $this->load->view('add-user', $inner, TRUE);
         $this->load->view($this->customer, $page);
     } else {
         $this->Usermodel->updateRecord($uid);
         $this->session->set_flashdata('SUCCESS', 'user_updated');
         redirect(createUrl('user/dashboard/'));
         exit;
     }
 }