function listAllAsGrp($offset = FALSE, $limit = FALSE, $columns = null, $param = array()) { if ($columns) { $this->db->select($columns); } if ($offset) { $this->db->offset($offset); } if ($limit) { $this->db->limit($limit); } if ($this->aauth->isFranshisee()) { $this->db->where('dpd_aauth_users.pid', curUsrId()); } if ($this->aauth->isUser()) { $this->db->where('dpd_aauth_users.pid', curUsrPid()); } $this->db->from(convertToAuthStr('users')); $this->db->join(convertToAuthStr('user_to_group'), convertToAuthStr('user_to_group') . '.user_id = ' . convertToAuthStr('users') . '.id'); if (isset($param['where'])) { $this->db->where($param['where']); } $rs = $this->db->get(); // echo $this->db->last_query(); // exit; return $rs->result_array(); }
function init() { if ($this->aauth->isFranshisee()) { $this->ids = $this->usermodel->getFranchiseUsersId(curUsrId()); } elseif ($this->aauth->isUser()) { $this->ids = $this->usermodel->getFranchiseUsersId(curUsrPid()); } }
function init() { if ($this->aauth->isCompany()) { $this->company_id = curUsrId(); $this->ids = $this->usermodel->getCompanyUsersId(curUsrId()); } elseif ($this->aauth->isUser()) { $this->company_id = curUsrPid(); $this->ids = $this->usermodel->getCompanyUsersId(curUsrPid()); } }
function listAll($ids = array()) { if (count($ids)) { $this->db->where_in('pid', $ids); $this->db->or_where_in('id', $ids); } $this->db->where('id !=', curUsrId()); $this->db->where('id !=', curUsrPid()); $this->db->from(convertToAuthStr('users')); $this->db->join(convertToAuthStr('user_to_group'), convertToAuthStr('user_to_group') . '.user_id = ' . convertToAuthStr('users') . '.id' . ' and dpd_' . convertToAuthStr('user_to_group') . '.group_id=5'); $rs = $this->db->get(); return $rs->result_array(); }
function listAll($ids = array()) { if (count($ids)) { $this->db->where_in('pid', $ids); $this->db->or_where_in('id', $ids); } if ($this->input->post('search_name')) { $unit_number = $this->input->post('search_name'); $search = substr($unit_number, 0, 3); $this->db->like('LOWER(name)', strtolower($search)); } if ($this->input->post('search_email')) { $search_email = $this->input->post('search_email'); $this->db->like('LOWER(email)', strtolower($search_email)); } $this->db->where('id !=', curUsrId()); $this->db->where('id !=', curUsrPid()); $this->db->from(convertToAuthStr('users')); $this->db->join(convertToAuthStr('user_to_group'), convertToAuthStr('user_to_group') . '.user_id = ' . convertToAuthStr('users') . '.id' . ' and dpd_' . convertToAuthStr('user_to_group') . '.group_id!=6'); $rs = $this->db->get(); return $rs->result_array(); }
function insertRecord() { $data = array(); $data['pname'] = $this->input->post('pname'); $data['type'] = $this->input->post('ptype'); $data['units'] = $this->input->post('units'); $data['owner'] = $this->input->post('owner'); $data['street'] = $this->input->post('street'); $data['city'] = $this->input->post('city'); $data['state'] = $this->input->post('state'); $data['post_code'] = $this->input->post('postcode'); $data['is_active'] = $this->input->post('active'); $data['datetime'] = date('Y-m-d H:i:s'); //e($data); if ($this->aauth->isCompany()) { $data['company_id'] = curUsrId(); } elseif ($this->aauth->isUser()) { $data['company_id'] = curUsrPid(); } $config['upload_path'] = $this->config->item('PROPERTY_IMAGE_PATH'); $config['allowed_types'] = 'gif|jpg|png'; $config['overwrite'] = FALSE; $this->load->library('upload', $config); if (count($_FILES) > 0) { if ($_FILES['photo']['error'] == UPLOAD_ERR_OK && is_uploaded_file($_FILES['photo']['tmp_name'])) { if (!$this->upload->do_upload('photo')) { show_error($this->upload->display_errors('<p class="err">', '</p>')); return FALSE; } else { $upload_data = $this->upload->data(); $data['photo'] = $upload_data['file_name']; } } } $this->db->insert('properties', $data); echo $this->db->last_query(); return $this->db->insert_id(); }
function sendMailToFranchisee($order) { $this->load->library('email'); $this->email->initialize($this->config->item('EMAIL_CONFIG')); $from = $this->commonmodel->configSetting('EMAIL_FROM'); $this->email->from($from); $curuser = (array) $this->aauth->get_user(curUsrId()); $franchise = (array) $this->usermodel->getFranchise(curUsrPid()); $this->email->to(arrIndex($franchise, 'email')); $this->email->subject('Booking Placed'); $content = array(); $content['content'] = 'Hi , ' . ucfirst(arrIndex($curuser, 'name')) . ' had placed booking for ' . arrIndex($order, 'ctn') . ' Tickets of "' . arrIndex($order, 'event_title') . '" event'; $content = $this->load->view('user/emails/allemailtemplate', $content, true); $this->email->message($content); $status = $this->email->send(); }
function insertRecord() { $data = array(); $data = rSF('units'); // echo "<pre>"; // print_r($data); // die(); $data['is_active'] = $this->input->post('active'); $data['description'] = $this->input->post('description'); $data['datetime'] = date('Y-m-d H:i:s'); $data['amount_type'] = $this->input->post('amount_type'); $data['is_featured'] = $this->input->post('is_featured'); // $data['property_type'] = $this->input->post('ptype'); $data['post_code'] = $this->input->post('post_code'); $data['county'] = $this->input->post('county'); // $data['country'] = $this->input->post('country'); $data['country'] = 'GB'; $data['ptenure'] = $this->input->post('ptenure'); $data['flat_no'] = $this->input->post('flat_no'); $config_slug = array('field' => 'uri', 'table' => 'units', 'id' => 'id'); $this->load->library('slug', $config_slug); $data_uri = array('title' => $this->input->post('unit_number')); $data['uri'] = $this->slug->create_uri($data_uri); if (!empty($_POST['features'])) { $data['features'] = implode($_POST['features'], '|'); } else { $data['features'] = ''; } $config['upload_path'] = $this->config->item('UNIT_IMAGE_PATH'); $config['allowed_types'] = 'gif|jpg|png'; $config['overwrite'] = FALSE; $this->load->library('upload', $config); $map_img = $_FILES['map_image']['name']; if ($map_img != '') { if ($_FILES['map_image']['error'] == UPLOAD_ERR_OK && is_uploaded_file($_FILES['map_image']['tmp_name'])) { if (!$this->upload->do_upload('map_image')) { show_error($this->upload->display_errors('<p class="err">', '</p>')); return FALSE; } else { $upload_data = $this->upload->data(); $data['map_image'] = $upload_data['file_name']; } } } if (count($_FILES) > 0) { //e($_FILES); if ($_FILES['photo']['error'] == UPLOAD_ERR_OK && is_uploaded_file($_FILES['photo']['tmp_name'])) { if (!$this->upload->do_upload('photo')) { show_error($this->upload->display_errors('<p class="err">', '</p>')); return FALSE; } else { $upload_data = $this->upload->data(); $data['unit_image'] = $upload_data['file_name']; } } } if ($this->aauth->isCompany()) { $data['company_id'] = curUsrId(); } elseif ($this->aauth->isUser()) { $data['company_id'] = curUsrPid(); } $status = $this->db->insert('units', $data); // echo $this->db->last_query(); if ($status) { $unit_id = $this->db->insert_id(); if ($unit_id) { $attributes = gParam('attributes') ? gParam('attributes') : array(); foreach ($attributes as $key => $value) { $data = array(); $data['unit_id'] = $unit_id; $data['attribute_id'] = $key; $data['value'] = $value; $this->db->insert('units_attributes_value', $data); } } } $unit_id = $this->db->insert_id(); $this->upload->initialize(array("upload_path" => $this->config->item('UNIT_IMAGE_PATH'), 'allowed_types' => 'gif|jpg|png')); if ($this->upload->do_multi_upload("galleryImages")) { //Print data for all uploaded files. foreach ($this->upload->get_multi_upload_data() as $images) { $this->db->insert('unit_image', array('image' => $images['file_name'], 'unit_id' => $unit_id)); } } }
function index() { $this->load->library('form_validation'); $this->load->helper('form'); $this->load->library('pagination'); if (!$this->checkAccess('MANAGE_USERS')) { $this->utility->accessDenied(); return; } ///Setup pagination $this->load->model('invoicemodel'); if ($this->aauth->isUser()) { $data = $this->invoicemodel->getFranshiseType(curUsrPid()); } else { $data = $this->invoicemodel->getFranshiseType(curUsrId()); } $ftype = $data->mon_fee_type; // e($data); ///Setup pagination $perpage = 20; $config['base_url'] = base_url() . "invoice/index/"; $config['uri_segment'] = 3; if ($ftype == 'W') { $config['total_rows'] = $this->invoicemodel->countAllWeekly(); $config['per_page'] = $perpage; $this->pagination->initialize($config); //$inner["row"] = $temp; $inner['pagination'] = $this->pagination->create_links(); if ($this->aauth->isUser()) { $inner["weekly_data_detail"] = $this->invoicemodel->getWeeklyDetailInvoice(curUsrPid()); } else { $inner["weekly_data_detail"] = $this->invoicemodel->getWeeklyDetailInvoice(curUsrId()); } $page = array(); $page['content'] = $this->load->view('invoice-index-detail', $inner, TRUE); $this->load->view($this->default, $page); } if ($ftype == 'M') { $config['total_rows'] = $this->invoicemodel->countAllMonthly(); $config['per_page'] = $perpage; $this->pagination->initialize($config); //$inner["row"] = $temp; $inner['pagination'] = $this->pagination->create_links(); if ($this->aauth->isUser()) { $inner["monthly_data_detail"] = $this->invoicemodel->getMonthlyDetailInvoice(curUsrPid()); } else { $inner["monthly_data_detail"] = $this->invoicemodel->getMonthlyDetailInvoice(curUsrId()); } $page = array(); $page['content'] = $this->load->view('invoice-monthly-detail', $inner, TRUE); $this->load->view($this->default, $page); } if ($ftype == 'Q') { $config['total_rows'] = $this->invoicemodel->countAllQuaterly(); $config['per_page'] = $perpage; $this->pagination->initialize($config); // $inner["row"] = $temp; $inner['pagination'] = $this->pagination->create_links(); if ($this->aauth->isUser()) { $inner["quarterly_data_detail"] = $this->invoicemodel->getQuarterlyDetailInvoice(curUsrPid()); } else { $inner["quarterly_data_detail"] = $this->invoicemodel->getQuarterlyDetailInvoice(curUsrId()); } $page = array(); $page['content'] = $this->load->view('invoice-quarterly-detail', $inner, TRUE); $this->load->view($this->default, $page); } if ($ftype == 'HY') { $config['total_rows'] = $this->invoicemodel->countAllHalfyearly(); $config['per_page'] = $perpage; $this->pagination->initialize($config); // $inner["row"] = $temp; $inner['pagination'] = $this->pagination->create_links(); if ($this->aauth->isUser()) { $inner["halfyearly_data_detail"] = $this->invoicemodel->getHalfYearlyDetailInvoice(curUsrPid()); } else { $inner["halfyearly_data_detail"] = $this->invoicemodel->getHalfYearlyDetailInvoice(curUsrId()); } $page = array(); $page['content'] = $this->load->view('invoice-halfyearly-detail', $inner, TRUE); $this->load->view($this->default, $page); } }
function getMonthlyInvoice() { if ($this->aauth->isCompany()) { $sql = "SELECT concat(month(created_on),year(created_on)) as test, month(created_on) as month, year(created_on) as year, SUM(total_amount) as final_price, SUM(IF(is_paid = '1', total_amount, 0)) AS 'paid_amount',SUM(IF(is_paid = '0', total_amount, 0)) AS 'unpaid_amount' FROM dpd_invoice_new WHERE 1 and invoice_type='M' and company_id=" . curUsrId() . " GROUP BY test"; } elseif ($this->aauth->isUser()) { $sql = "SELECT concat(month(created_on),year(created_on)) as test, month(created_on) as month, year(created_on) as year, SUM(total_amount) as final_price, SUM(IF(is_paid = '1', total_amount, 0)) AS 'paid_amount',SUM(IF(is_paid = '0', total_amount, 0)) AS 'unpaid_amount' FROM dpd_invoice_new WHERE 1 and invoice_type='M' and company_id=" . curUsrPid() . " GROUP BY test"; } else { $sql = "SELECT concat(month(created_on),year(created_on)) as test, month(created_on) as month, year(created_on) as year, SUM(total_amount) as final_price, SUM(IF(is_paid = '1', total_amount, 0)) AS 'paid_amount',SUM(IF(is_paid = '0', total_amount, 0)) AS 'unpaid_amount' FROM dpd_invoice_new WHERE 1 and invoice_type='M' GROUP BY test"; } $sql = "SELECT concat(month(created_on),year(created_on)) as test, month(created_on) as month, year(created_on) as year, SUM(total_amount) as final_price, SUM(IF(is_paid = '1', total_amount, 0)) AS 'paid_amount',SUM(IF(is_paid = '0', total_amount, 0)) AS 'unpaid_amount' FROM dpd_invoice_new WHERE 1 and invoice_type='M' and company_id='{$this->company_id}' GROUP BY test"; $sql_query = $this->db->query($sql); return $sql_query->result_array(); }
function index($listingCompany = null) { //e(current_url()); $this->load->model('user/usermodel'); $page = array(); $inner = array(); $this->load->helper('text'); $this->load->helper('form'); $this->load->library('pagination'); $this->load->library('form_validation'); $company_id = null; if (!$listingCompany) { if ($this->aauth->isCompany()) { $company_id = curUsrId(); } elseif ($this->aauth->isCompany()) { $company_id = curUsrPid(); } else { $company_id = curUsrId(); } } else { $company_id = $listingCompany; } $inner['users'] = $this->Usermodel->listAll(0, 0, 'id, name'); $inner['userOwnFiles'] = null; $inner['userSharedFiles'] = null; $inner['countfiles'] = $this->VirtualCabinetmodel->getAllGroupBy('filetype'); $inner['allAvailGrps'] = $this->aauth->list_groups(); foreach ($inner['allAvailGrps'] as $kval) { if ($this->aauth->isCustomer()) { if ($kval->id != 3) { continue; } } elseif ($this->aauth->isCompany()) { if ($kval->id != 6) { continue; } } $inner['AvailGrps'][$kval->id] = $kval->name; } // e($inner['AvailGrps']); $myShareFileOpt = array('columns' => 'filetype, id, visible_name, actual_name, assignes,creator_id', 'order-field' => 'filetype', 'order-by' => 'desc', $this->VirtualCabinetmodel->creator_id => $company_id); $othrShareFile = array('shared' => true, 'columns' => 'virtualCab.id, visible_name, filetype, actual_name, creator_id, aauth_users.name,assignes', $this->VirtualCabinetmodel->assignes => $company_id, 'order-field' => 'aauth_users.name', 'order-by' => 'desc'); $tab1 = ' active '; $tab2 = ''; if (isset($_POST['searchfile'])) { if ($_POST['currentTab'] == 2) { $tab1 = ' '; $tab2 = ' active '; $myShareFileOpt['searchKey'] = $_POST['searchfile']; } if ($_POST['currentTab'] == 1) { $tab2 = ' '; $tab1 = ' active '; $othrShareFile['searchKey'] = $_POST['searchfile']; } } $inner['tab1'] = $tab1; $inner['tab2'] = $tab2; $inner['myShareFiles'] = $this->VirtualCabinetmodel->listAll(0, 0, $myShareFileOpt); ///$inner['allFiles'] = $inner['userOwnFiles']; $inner['userSharedFiles'] = $this->VirtualCabinetmodel->listAll(0, 0, $othrShareFile); $inner['sharedWithMeHtml'] = $this->localFileDisplay($inner['userSharedFiles'], true, !$listingCompany); $inner['myFilesHtml'] = $this->localFileDisplay($inner['myShareFiles'], true, false); $inner['addEditJs'] = false; if (!is_null($inner['myFilesHtml']) || !empty($inner['myFilesHtml'])) { $inner['addEditJs'] = true; } $inner['imgArray'] = $this->imgArray; $inner['docArray'] = $this->docArray; $inner['extImgArray'] = $this->extImgArray; $page['content'] = $this->load->view('index', $inner, TRUE); $this->load->view($this->default, $page); }