Пример #1
0
 public function getTable($pkey = '')
 {
     _has_user_access_permission(TRUE, array('admin', 'management_company', 'staff', 'engineer'));
     $params = ($params = unserialize_object($pkey)) && is_array($params) ? $params : array();
     $company_id = in_array($this->current_user->group_id, array(GROUP_ADMIN, GROUP_STAFF, GROUP_ENGINEER)) ? isset($params[SYS_COMPANY_ID]) && gtzero_integer($params[SYS_COMPANY_ID]) ? to_int($params[SYS_COMPANY_ID]) : 0 : $this->current_user->company_id;
     $params = array('iDisplayStart' => $this->input->post('iDisplayStart', true), 'iDisplayLength' => $this->input->post('iDisplayLength', true), 'iSortCol_0' => $this->input->post('iSortCol_0', true), 'iSortingCols' => $this->input->post('iSortingCols', true), 'sSearch' => $this->input->post('sSearch', true), 'sEcho' => $this->input->post('sEcho', true), 'company_id' => in_array($this->current_user->group_id, array(GROUP_ADMIN, GROUP_STAFF, GROUP_ENGINEER)) ? $this->_post_args('company_id', ARGS_TYPE_INT, $company_id) : $this->current_user->company_id, 'name' => $this->_post_args('name', ARGS_TYPE_STRING), 'postcode' => $this->_post_args('postcode', ARGS_TYPE_STRING), 'contact_name' => $this->_post_args('contact_name', ARGS_TYPE_STRING));
     $qrows = $this->site_m->ajax_gets($params);
     foreach ($qrows['aaData'] as &$qrow) {
         $actions = array();
         if (in_array($this->current_user->group_id, array(GROUP_ADMIN, GROUP_MANAGEMENT_COMPANY, GROUP_STAFF, GROUP_ENGINEER))) {
             $actions['view'] = array('href' => site_url('sites/show/' . serialize_object(array(SYS_SITE_ID => $qrow->site_id))), 'title' => 'Site Detail<small>' . $qrow->site_code . '</small>', 'text' => 'Site Detail', 'params' => 'data-ajax="wdpajax" data-options=\'{"form_method" : "GET", "data_type" : "HTML", "role" : "modal", "created_new" : true, "title" : "Site Detail <small>' . $qrow->site_code . '</small>", "modal" : {"buttons" : false, "size" : "modal-lg", "footer" : true, "wizard" : false}, "params" : "echo"}\'', 'class' => array());
         }
         if (in_array($this->current_user->group_id, array(GROUP_ADMIN))) {
             $actions['edit'] = array('href' => site_url('sites/edit/' . serialize_object(array(SYS_SITE_ID => $qrow->site_id))), 'title' => 'Site Detail<small>' . $qrow->site_code . '</small>', 'text' => 'Edit Site', 'params' => 'data-ajax="wdpajax" data-options=\'{"form_method" : "GET", "data_type" : "HTML", "role" : "modal", "created_new" : true, "title" : "Site Detail", "modal" : {"buttons" : false, "footer" : false, "size" : "modal-lg", "wizard" : true, "override" : true, "modal_success_callback" : "gl.site.listing.load_grid(g);"}, "params" : "echo", "grid" : {"_init" : true, "gType" : "default"}}\'', 'class' => array());
         }
         if (in_array($this->current_user->group_id, array(GROUP_ADMIN))) {
             $actions['delete'] = array('href' => site_url('sites/delete/' . serialize_object(array(SYS_SITE_ID => $qrow->site_id))), 'title' => 'Site <small>' . $qrow->site_code . '</small>', 'text' => 'Delete Site', 'params' => 'data-ajax="wdpajax" data-options=\'{"form_method" : "GET", "data_type" : "HTML", "role" : "modal", "created_new" : true, "title" : "Delete Site <small>' . $qrow->site_code . '</small>", "modal" : {"buttons" : true, "override" : true, "modal_success_callback" : "gl.site.listing.load_grid(g);"}, "params" : "echo", "grid" : {"_init" : true, "gType" : "default"}}\'', 'class' => array());
         }
         $qrow = array($qrow->site_code, $qrow->company_name, $qrow->address, $qrow->street, $qrow->town, $qrow->postcode, $qrow->upload_date, $qrow->created_by_name, local_time($qrow->created_on, 'M d, Y @ h:ia'), theme_button_dropdown($actions));
         if (_check_company_user_access()) {
             unset($qrow[1]);
             $qrow = array_values($qrow);
         }
     }
     echo json_encode($qrows);
 }
Пример #2
0
 public function getTable($pkey = '')
 {
     _has_user_access_permission(TRUE, array('admin', 'management_company', 'user_company'));
     $params = ($params = unserialize_object($pkey)) && is_array($params) ? $params : array();
     $company_id = $this->current_user->group_id == 1 ? isset($params[SYS_COMPANY_ID]) && gtzero_integer($params[SYS_COMPANY_ID]) ? to_int($params[SYS_COMPANY_ID]) : 0 : $this->current_user->company_id;
     $params = array('iDisplayStart' => $this->input->post('iDisplayStart', true), 'iDisplayLength' => $this->input->post('iDisplayLength', true), 'iSortCol_0' => $this->input->post('iSortCol_0', true), 'iSortingCols' => $this->input->post('iSortingCols', true), 'sSearch' => $this->input->post('sSearch', true), 'sEcho' => $this->input->post('sEcho', true), 'company_id' => $this->current_user->group_id == 1 ? $this->_post_args('company_id', ARGS_TYPE_INT, $company_id) : $this->current_user->company_id, 'name' => $this->_post_args('name', ARGS_TYPE_STRING), 'postcode' => $this->_post_args('postcode', ARGS_TYPE_STRING), 'contact_name' => $this->_post_args('contact_name', ARGS_TYPE_STRING));
     $qrows = $this->client_m->ajax_gets($params);
     foreach ($qrows['aaData'] as &$qrow) {
         $actions = array();
         if (in_array($this->current_user->group_id, array(GROUP_ADMIN, GROUP_MANAGEMENT_COMPANY))) {
             $actions['view'] = array('href' => site_url('clients/show/' . serialize_object(array(SYS_CLIENT_ID => $qrow->client_id))), 'title' => 'Client Detail<small>' . $qrow->full_name . '</small>', 'text' => 'Client Detail', 'params' => 'data-ajax="wdpajax" data-options=\'{"form_method" : "GET", "data_type" : "HTML", "role" : "modal", "created_new" : true, "title" : "Client Detail <small>' . $qrow->full_name . '</small>", "modal" : {"buttons" : false, "size" : "modal-lg", "footer" : false, "wizard" : true}, "params" : "echo"}\'', 'class' => array());
         }
         if (in_array($this->current_user->group_id, array(GROUP_ADMIN, GROUP_MANAGEMENT_COMPANY))) {
             $actions['edit'] = array('href' => site_url('clients/edit/' . serialize_object(array(SYS_CLIENT_ID => $qrow->client_id))), 'title' => 'Client Detail<small>' . $qrow->full_name . '</small>', 'text' => 'Edit Client', 'params' => 'data-ajax="wdpajax" data-options=\'{"form_method" : "GET", "data_type" : "HTML", "role" : "modal", "created_new" : true, "title" : "Client Detail", "modal" : {"buttons" : false, "footer" : false, "size" : "modal-lg", "wizard" : true, "override" : true, "modal_success_callback" : "gl.client.listing.load_grid(g);"}, "params" : "echo", "grid" : {"_init" : true, "gType" : "default"}}\'', 'class' => array());
         }
         if (in_array($this->current_user->group_id, array(GROUP_ADMIN, GROUP_MANAGEMENT_COMPANY))) {
             $actions['delete'] = array('href' => site_url('clients/delete/' . serialize_object(array(SYS_CLIENT_ID => $qrow->client_id))), 'title' => 'Client <small>' . $qrow->full_name . '</small>', 'text' => 'Delete Client', 'params' => 'data-ajax="wdpajax" data-options=\'{"form_method" : "GET", "data_type" : "HTML", "role" : "modal", "created_new" : true, "title" : "Delete Client <small>' . $qrow->full_name . '</small>", "modal" : {"buttons" : true, "override" : true, "modal_success_callback" : "gl.client.listing.load_grid(g);"}, "params" : "echo", "grid" : {"_init" : true, "gType" : "default"}}\'', 'class' => array());
         }
         /*if( in_array($this->current_user->group_id, array(GROUP_ADMIN, GROUP_MANAGEMENT_COMPANY)) ) {
         			$actions['notes'] = array(
         						'href' 		=> site_url('notes/index/'.serialize_object(array( SYS_REF_ID => $qrow->client_id, SYS_NOTE_TYPE_ID => NOTE_TYPE_CLIENT) )),
         						'title'		=> 'Notes <small>(Client: '.$qrow->full_name.')</small>',
         						'text'		=> 'Notes',
         						'params'	=> 'data-ajax="wdpajax" data-options=\'{"form_method" : "GET", "data_type" : "HTML", "role" : "modal", "created_new" : true, "title" : "Notes <small>(Client: '.$qrow->full_name.')</small>", "modal" : {"buttons" : false, "footer" : false, "size" : "modal-lg", "wizard" : true, "override" : true, "nopadd" : false, "modal_before_close_callback" : "gl.note.listing.close_grid(g);", "callback" : "gl.note.listing.load_grid(g);"}, "params" : "echo", "grid" : {"_init" : true, "gType" : "next"}}\'',
         						'class'		=> array()
         					);
         		
         		}
         		
         		if( in_array($this->current_user->group_id, array(GROUP_ADMIN, GROUP_MANAGEMENT_COMPANY)) ) {
         			$actions['new_note'] = array(
         						'href' 		=> site_url('notes/create/'.serialize_object(array( SYS_REF_ID => $qrow->client_id, SYS_NOTE_TYPE_ID => NOTE_TYPE_CLIENT))),
         						'title'		=> 'New Note <small>(Client: '.$qrow->full_name.')</small>',
         						'text'		=> 'New Note',
         						'params'	=> 'data-ajax="wdpajax" data-options=\'{"form_method" : "POST", "data_type" : "HTML", "role" : "modal", "created_new" : true, "title" : "Note Detail <small>(Client: '.$qrow->full_name.')</small>", "modal" : {"buttons" : true}, "params" : "echo"}\'',
         						'class'		=> array()
         					);
         		
         		}*/
         if (in_array($this->current_user->group_id, array(GROUP_ADMIN, GROUP_MANAGEMENT_COMPANY))) {
             $actions['contacts'] = array('href' => site_url('contacts/index/' . serialize_object(array(SYS_REF_ID => $qrow->client_id, SYS_CONTACT_TYPE_ID => CONTACT_TYPE_CLIENT))), 'title' => 'Contacts <small>(Client: ' . $qrow->full_name . ')</small>', 'text' => 'Contacts', 'params' => 'data-ajax="wdpajax" data-options=\'{"form_method" : "GET", "data_type" : "HTML", "role" : "modal", "created_new" : true, "title" : "Contacts <small>(Client: ' . $qrow->full_name . ')</small>", "modal" : {"buttons" : false, "footer" : false, "size" : "modal-lg", "wizard" : true, "override" : true, "nopadd" : false, "modal_before_close_callback" : "gl.contact.listing.close_grid(g);", "callback" : "gl.contact.listing.load_grid(g);"}, "params" : "echo", "grid" : {"_init" : true, "gType" : "next"}}\'', 'class' => array());
         }
         if (in_array($this->current_user->group_id, array(GROUP_ADMIN, GROUP_MANAGEMENT_COMPANY))) {
             $actions['new_contact'] = array('href' => site_url('contacts/create/' . serialize_object(array(SYS_REF_ID => $qrow->client_id, SYS_CONTACT_TYPE_ID => CONTACT_TYPE_CLIENT))), 'title' => 'Contact Detail <small>(Client: ' . $qrow->full_name . ')</small>', 'text' => 'New Contact', 'params' => 'data-ajax="wdpajax" data-options=\'{"form_method" : "POST", "data_type" : "HTML", "role" : "modal", "created_new" : true, "title" : "Contact Detail <small>(Client: ' . $qrow->full_name . ')</small>", "modal" : {"buttons" : true}, "params" : "echo"}\'', 'class' => array());
         }
         $qrow = array($qrow->full_name, $qrow->company_name, $qrow->address, $qrow->phone, $qrow->postcode, $qrow->contact_email, $qrow->created_by_name, local_time($qrow->created_on, 'M d, Y @ h:ia'), theme_button_dropdown($actions));
         if (_check_company_user_access()) {
             unset($qrow[1]);
             $qrow = array_values($qrow);
         }
     }
     echo json_encode($qrows);
 }
Пример #3
0
 public function getTable()
 {
     ensure_user_access(TRUE, array('admin'));
     $params = array('iDisplayStart' => $this->input->get_post('iDisplayStart', true), 'iDisplayLength' => $this->input->get_post('iDisplayLength', true), 'iSortCol_0' => $this->input->get_post('iSortCol_0', true), 'iSortingCols' => $this->input->get_post('iSortingCols', true), 'sSearch' => $this->input->get_post('sSearch', true), 'sEcho' => $this->input->get_post('sEcho', true));
     $listing = $this->company_m->ajax_get_parts($params);
     foreach ($listing['aaData'] as &$qrow) {
         $ID = $qrow['ID'];
         $company_name = $qrow['company_name'];
         /*$qrow[count($qrow)-3] = tz_text($qrow[count($qrow)-3]);*/
         /* data-ajax="wdpajax" data-options=\'{"form_method" : "GET", "data_type" : "HTML", "role" : "modal", "created_new" : true, "title" : "Event permission <small>'.$company_name.'</small>", "modal" : {"buttons" : true}, "params" : "echo"}\'*/
         $qrow = array($qrow['company_name'], $qrow['phone'], $qrow['default_contact'], tz_text($qrow['gmt_offset']), $qrow['created_by_name'], theme_button_dropdown(array('edit' => array('href' => site_url('companies/edit/' . $ID), 'title' => 'Edit Company', 'text' => 'Edit Company', 'params' => ' data-ajax="wdpajax" data-options=\'{"form_method" : "GET", "data_type" : "HTML", "role" : "modal", "created_new" : true, "title" : "Edit Company <small>' . $company_name . '</small>", "modal" : {"buttons" : true}, "params" : "echo"}\'', 'class' => array()), 'delete' => array('href' => site_url('companies/delete/' . $ID), 'title' => 'Delete Company', 'text' => 'Delete Company', 'params' => ' data-ajax="wdpajax" data-options=\'{"form_method" : "GET", "data_type" : "HTML", "role" : "modal", "created_new" : true, "title" : "Delete Company <small>' . $company_name . '</small>", "modal" : {"buttons" : true}, "params" : "echo"}\'', 'class' => array()), 'notes' => array('href' => site_url('notes/index/' . wdp_arr_encode(array(WDP_REF_ID => $ID, WDP_NOTE_TYPE_ID => NOTE_TYPE_COMPANY))), 'title' => 'Notes <small>(Company: ' . $company_name . ')</small>', 'text' => 'Notes', 'params' => 'data-ajax="wdpajax" data-options=\'{"form_method" : "GET", "data_type" : "HTML", "role" : "modal", "created_new" : true, "title" : "Notes <small>(Company: ' . $company_name . ')</small>", "modal" : {"buttons" : false, "footer" : false, "size" : "modal-lg", "wizard" : true, "override" : true, "nopadd" : false, "modal_before_close_callback" : "wdp.notes.close_grid(g);", "callback" : "wdp.notes.load_grid(g);"}, "params" : "echo", "grid" : {"_init" : true, "gType" : "next"}}\'', 'class' => array()), 'new_note' => array('href' => site_url('notes/create/' . wdp_arr_encode(array(WDP_REF_ID => $ID, WDP_NOTE_TYPE_ID => NOTE_TYPE_COMPANY))), 'title' => 'Add Note <small>(Company: ' . $company_name . ')</small>', 'text' => 'Add Note', 'params' => 'data-ajax="wdpajax" data-options=\'{"form_method" : "GET", "data_type" : "HTML", "role" : "modal", "created_new" : true, "title" : "Note Detail <small>(Company: ' . $company_name . ')</small>", "modal" : {"buttons" : true}, "params" : "echo"}\'', 'class' => array()), 'contacts' => array('href' => site_url('contacts/index/' . wdp_arr_encode(array(WDP_REF_ID => $ID, WDP_TYPE_ID => CONTACT_TYPE_COMPANY))), 'title' => 'Show Contacts <small>(Company: ' . $company_name . ')</small>', 'text' => 'Show Contacts', 'params' => 'data-ajax="wdpajax" data-options=\'{"form_method" : "GET", "data_type" : "HTML", "role" : "modal", "created_new" : true, "title" : "Contacts <small>(Company: ' . $company_name . ')</small>", "modal" : {"buttons" : false, "footer" : false, "size" : "modal-lg", "wizard" : true, "override" : true, "nopadd" : false, "modal_before_close_callback" : "wdp.contacts.close_grid(g);", "callback" : "wdp.contacts.load_grid(g);"}, "params" : "echo", "grid" : {"_init" : true, "gType" : "next"}}\'', 'class' => array()), 'new_contact' => array('href' => site_url('contacts/create/' . wdp_arr_encode(array(WDP_REF_ID => $ID, WDP_TYPE_ID => CONTACT_TYPE_COMPANY))), 'title' => 'Contact Detail<small>(Company: ' . $company_name . ')</small>', 'text' => 'Add Contact', 'params' => 'data-ajax="wdpajax" data-options=\'{"form_method" : "GET", "data_type" : "HTML", "role" : "modal", "created_new" : true, "title" : "Contact Detail <small>(Company: ' . $company_name . ')</small>", "modal" : {"buttons" : true}, "params" : "echo"}\'', 'class' => array())), array('detail_icon' => ICON_COMPANIES)) . theme_button_dropdown(array('settings' => array('href' => site_url('settings/triggers/index/' . $ID), 'title' => 'Trigger Settings', 'text' => 'Trigger Settings', 'params' => '', 'class' => array()), 'account_settings' => array('href' => site_url('settings/myaccount/' . wdp_arr_encode(array(WDP_COMPANY_ID => $ID))), 'title' => 'Company Settings', 'text' => 'Company Settings', 'params' => 'data-ajax="wdpajax" data-options=\'{"form_method" : "POST", "data_type" : "HTML", "role" : "modal", "created_new" : true, "title" : "Account Settings' . ($this->current_user->group_id == 1 ? ' (' . $qrow['company_name'] . ')' : '') . '", "modal" : {"buttons" : false, "footer" : false, "size" : "modal-lg", "wizard" : true, "override" : true}, "params" : "echo"}\'', 'class' => array()), 'permission_settings' => array('href' => site_url('settings/mygroups/' . wdp_arr_encode(array(WDP_COMPANY_ID => $ID))), 'title' => 'Permission Settings', 'text' => 'Permission Settings', 'params' => 'data-ajax="wdpajax" data-options=\'{"form_method" : "POST", "data_type" : "HTML", "role" : "modal", "created_new" : true, "title" : "Account Permission Settings' . ($this->current_user->group_id == 1 ? ' (' . $qrow['company_name'] . ')' : '') . '", "modal" : {"buttons" : false, "footer" : false, "size" : "modal-lg", "wizard" : true, "override" : true}, "params" : "echo"}\'', 'class' => array()), 'cstfld_settings' => array('href' => site_url('settings/custom_fields/' . wdp_arr_encode(array(WDP_COMPANY_ID => $ID))), 'title' => 'Custom Field Settings', 'text' => 'Custom Field Settings', 'params' => 'data-ajax="wdpajax" data-options=\'{"form_method" : "GET", "data_type" : "HTML", "role" : "modal", "created_new" : true, "title" : "Custom Field Settings' . ($this->current_user->group_id == 1 ? ' (' . $qrow['company_name'] . ')' : '') . '", "modal" : {"buttons" : true, "override" : true}, "params" : "echo"}\'', 'class' => array()), 'my_pdf_templates_settings' => array('href' => site_url('settings/pdf_templates/' . wdp_arr_encode(array(WDP_COMPANY_ID => $ID))), 'title' => 'PDF Template Settings', 'text' => 'PDF Template Settings', 'params' => '', 'class' => array()), 'timesheet' => array('href' => site_url('jobs/timesheet/index/' . wdp_arr_encode(array(WDP_COMPANY_ID => $ID))), 'title' => 'Timesheet', 'text' => 'Timesheet', 'params' => '', 'class' => array()), 'cost' => array('href' => site_url('cost/index/' . $ID), 'title' => 'Unassigned Labour/Mileage', 'text' => 'Unassigned Labour/Mileage', 'params' => '', 'class' => array())), array('detail_icon' => ICON_SETTING, 'detail_margin' => 'ml5', 'group_seperator' => FALSE)) . theme_button_dropdown(array('clients' => array('href' => site_url('clients/index/' . wdp_arr_encode(array(WDP_COMPANY_ID => $ID))), 'title' => 'Clients <small>' . $company_name . '</small>', 'text' => 'Clients', 'params' => 'data-ajax="wdpajax" data-options=\'{"form_method" : "GET", "data_type" : "HTML", "role" : "modal", "created_new" : true, "title" : "Clients <small>(Company: ' . $company_name . ')</small>", "modal" : {"buttons" : false, "footer" : false, "size" : "modal-lg", "wizard" : true, "override" : true, "nopadd" : false, "modal_before_close_callback" : "wdp.clients.close_grid(g);", "callback" : "wdp.clients.load_grid(g);"}, "params" : "echo", "grid" : {"_init" : true, "gType" : "next"}}\'', 'class' => array()), 'new_client' => array('href' => site_url('clients/create/' . wdp_arr_encode(array(WDP_COMPANY_ID => $ID))), 'title' => 'New Client <small>' . $company_name . '</small>', 'text' => 'New Client', 'params' => 'data-ajax="wdpajax" data-options=\'{"form_method" : "GET", "data_type" : "HTML", "role" : "modal", "created_new" : true, "title" : "Client Detail", "modal" : {"buttons" : true}, "params" : "echo", "form_data" : {"company_id" : ' . $ID . '}}\'', 'class' => array()), 'invoices' => array('href' => site_url('invoices/index/' . wdp_arr_encode(array(WDP_COMPANY_ID => $ID))), 'title' => 'Invoices <small>' . $company_name . '</small>', 'text' => 'Invoices', 'params' => 'data-ajax="wdpajax" data-options=\'{"form_method" : "GET", "data_type" : "HTML", "role" : "modal", "created_new" : true, "title" : "Invoices <small>(Company: ' . $company_name . ')</small>", "modal" : {"buttons" : false, "footer" : false, "size" : "modal-lg", "wizard" : true, "override" : true, "nopadd" : false, "modal_before_close_callback" : "wdp.invoice.listing.close_grid(g);", "callback" : "wdp.invoice.listing.load_grid(g);"}, "params" : "echo", "grid" : {"_init" : true, "gType" : "next"}}\'', 'class' => array()), 'new_invoice' => array('href' => site_url('invoices/create/' . wdp_arr_encode(array(WDP_COMPANY_ID => $ID))), 'title' => 'New Invoice <small>' . $company_name . '</small>', 'text' => 'New Invoice', 'params' => 'data-ajax="wdpajax" data-options=\'{"form_method" : "GET", "data_type" : "HTML", "role" : "modal", "created_new" : true, "title" : "Invoice Detail", "modal" : {"buttons" : true}, "params" : "echo", "form_data" : {"company_id" : ' . $ID . '}}\'', 'class' => array()), 'consumables' => array('href' => site_url('consumables/index/' . wdp_arr_encode(array(WDP_COMPANY_ID => $ID))), 'title' => 'Consumables <small>' . $company_name . '</small>', 'text' => 'Consumables', 'params' => 'data-ajax="wdpajax" data-options=\'{"form_method" : "GET", "data_type" : "HTML", "role" : "modal", "created_new" : true, "title" : "Consumables <small>(Company: ' . $company_name . ')</small>", "modal" : {"buttons" : false, "footer" : false, "size" : "modal-lg", "wizard" : true, "override" : true, "nopadd" : false, "modal_before_close_callback" : "wdp.consumable.listing.close_grid(g);", "callback" : "wdp.consumable.listing.load_grid(g);"}, "params" : "echo", "grid" : {"_init" : true, "gType" : "next"}}\'', 'class' => array()), 'new_consumable' => array('href' => site_url('consumables/create/' . wdp_arr_encode(array(WDP_COMPANY_ID => $ID))), 'title' => 'New Consumable Set <small>' . $company_name . '</small>', 'text' => 'New Consumable Set', 'params' => 'data-ajax="wdpajax" data-options=\'{"form_method" : "GET", "data_type" : "HTML", "role" : "modal", "created_new" : true, "title" : "Consumable Set", "modal" : {"buttons" : false, "footer" : false, "size" : "modal-lg", "wizard" : true, "override" : true}, "params" : "echo"}\'', 'class' => array()), 'suppliers' => array('href' => site_url('suppliers/index/' . wdp_arr_encode(array(WDP_COMPANY_ID => $ID))), 'title' => 'Suppliers <small>' . $company_name . '</small>', 'text' => 'Suppliers', 'params' => 'data-ajax="wdpajax" data-options=\'{"form_method" : "GET", "data_type" : "HTML", "role" : "modal", "created_new" : true, "title" : "Suppliers <small>(Company: ' . $company_name . ')</small>", "modal" : {"buttons" : false, "footer" : false, "size" : "modal-lg", "wizard" : true, "override" : true, "nopadd" : false, "modal_before_close_callback" : "wdp.supplier.listing.close_grid(g);", "callback" : "wdp.supplier.listing.load_grid(g);"}, "params" : "echo", "grid" : {"_init" : true, "gType" : "next"}}\'', 'class' => array()), 'new_supplier' => array('href' => site_url('suppliers/create/' . wdp_arr_encode(array(WDP_COMPANY_ID => $ID))), 'title' => 'New Supplier <small>' . $company_name . '</small>', 'text' => 'New Supplier', 'params' => 'data-ajax="wdpajax" data-options=\'{"form_method" : "GET", "data_type" : "HTML", "role" : "modal", "created_new" : true, "title" : "Suppliers Detail", "modal" : {"buttons" : true}, "params" : "echo"}\'', 'class' => array()), 'parts' => array('href' => site_url('parts_list/index/' . wdp_arr_encode(array(WDP_COMPANY_ID => $ID))), 'title' => 'Parts <small>' . $company_name . '</small>', 'text' => 'Parts', 'params' => 'data-ajax="wdpajax" data-options=\'{"form_method" : "GET", "data_type" : "HTML", "role" : "modal", "created_new" : true, "title" : "Parts <small>(Company: ' . $company_name . ')</small>", "modal" : {"buttons" : false, "footer" : false, "size" : "modal-lg", "wizard" : true, "override" : true, "nopadd" : false, "modal_before_close_callback" : "wdp.parts.listing.close_grid(g);", "callback" : "wdp.parts.listing.load_grid(g);"}, "params" : "echo", "grid" : {"_init" : true, "gType" : "next"}}\'', 'class' => array()), 'new_part' => array('href' => site_url('parts_list/create/' . wdp_arr_encode(array(WDP_COMPANY_ID => $ID))), 'title' => 'New Part <small>' . $company_name . '</small>', 'text' => 'New Part', 'params' => 'data-ajax="wdpajax" data-options=\'{"form_method" : "GET", "data_type" : "HTML", "role" : "modal", "created_new" : true, "title" : "Part Detail", "modal" : {"buttons" : true}, "params" : "echo"}\'', 'class' => array()), 'quotes' => array('href' => site_url('quotes/index/' . wdp_arr_encode(array(WDP_COMPANY_ID => $ID))), 'title' => 'Quotes <small>' . $company_name . '</small>', 'text' => 'Quotes', 'params' => 'data-ajax="wdpajax" data-options=\'{"form_method" : "GET", "data_type" : "HTML", "role" : "modal", "created_new" : true, "title" : "Quotes <small>(Company: ' . $company_name . ')</small>", "modal" : {"buttons" : false, "footer" : false, "size" : "modal-lg", "wizard" : true, "override" : true, "nopadd" : false, "modal_before_close_callback" : "wdp.quotes.listing.close_grid(g);", "callback" : "wdp.quotes.listing.load_grid(g);"}, "params" : "echo", "grid" : {"_init" : true, "gType" : "next"}}\'', 'class' => array()), 'new_quote' => array('href' => site_url('quotes/create/' . wdp_arr_encode(array(WDP_COMPANY_ID => $ID))), 'title' => 'New Quote <small>' . $company_name . '</small>', 'text' => 'New Quote', 'params' => 'data-ajax="wdpajax" data-options=\'{"form_method" : "GET", "data_type" : "HTML", "role" : "modal", "created_new" : true, "title" : "Quote Detail", "modal" : {"buttons" : false, "footer" : false, "size" : "modal-lg", "wizard" : true, "override" : true}, "params" : "echo"}\'', 'class' => array()), 'jobs' => array('href' => site_url('summary/index/' . wdp_arr_encode(array(WDP_COMPANY_ID => $ID))), 'title' => 'Jobs <small>(Company: ' . $company_name . ')</small>', 'text' => 'Jobs', 'params' => 'data-ajax="wdpajax" data-options=\'{"form_method" : "GET", "data_type" : "HTML", "role" : "modal", "created_new" : true, "title" : "Jobs <small>(Company: ' . $company_name . ')</small>", "modal" : {"buttons" : false, "footer" : false, "size" : "modal-lg", "wizard" : true, "override" : true, "nopadd" : false, "modal_before_close_callback" : "wdp.jobs.close_grid(g);", "callback" : "wdp.jobs.fm(frm, g);"}, "params" : "echo", "grid" : {"_init" : true, "gType" : "next"}}\'', 'class' => array()), 'new_job' => array('href' => site_url('job/create'), 'title' => 'Job Detail <small>(Company: ' . $company_name . ')</small>', 'text' => 'New Job', 'params' => 'data-ajax="wdpajax" data-options=\'{"form_method" : "POST", "data_type" : "HTML", "role" : "modal", "created_new" : true, "title" : "Job Detail", "modal" : {"buttons" : false, "footer" : false, "size" : "modal-lg", "wizard" : true, "override" : true}, "params" : "echo", "form_data" : {"company_id" : ' . $ID . '}}\'', 'class' => array())), array('detail_icon' => ICON_TASKS, 'detail_margin' => 'ml5', 'group_seperator' => FALSE)));
     }
     echo json_encode($listing);
 }
Пример #4
0
 public function getTable($pkey = '')
 {
     _has_user_access_permission(TRUE, array('admin', 'management_company'));
     $params = ($params = unserialize_object($pkey)) && is_array($params) ? $params : array();
     $company_id = $this->current_user->group_id == 1 ? array_key_exists(SYS_COMPANY_ID, $params) && gtzero_integer($params[SYS_COMPANY_ID]) ? to_int($params[SYS_COMPANY_ID]) : 0 : $this->current_user->company_id;
     $input = array('iDisplayStart' => $this->_post_args('iDisplayStart', ARGS_TYPE_INT), 'iDisplayLength' => $this->_post_args('iDisplayLength', ARGS_TYPE_INT, 0, array('gtzero' => FALSE)), 'iSortCol_0' => $this->_post_args('iSortCol_0', ARGS_TYPE_STRING), 'iSortingCols' => $this->_post_args('iSortingCols', ARGS_TYPE_INT), 'sSearch' => $this->_post_args('sSearch', ARGS_TYPE_STRING), 'sEcho' => $this->_post_args('sEcho', ARGS_TYPE_STRING), 'company_id' => $this->current_user->group_id == 1 ? $this->_post_args('company_id', ARGS_TYPE_INT, $company_id, array('override' => TRUE)) : $this->current_user->company_id, 'group_id' => $this->_post_args('group_id', ARGS_TYPE_INT));
     $qrows = $this->user_m->ajax_gets($input);
     foreach ($qrows['aaData'] as &$qrow) {
         $actions = array('view' => array('href' => site_url('users/show/' . serialize_object(array(SYS_USER_ID => $qrow->user_id))), 'title' => 'User Detail (<small>' . $qrow->full_name . '</small>)', 'text' => 'User Detail', 'params' => 'data-ajax="wdpajax" data-options=\'{"form_method" : "GET", "data_type" : "HTML", "role" : "modal", "created_new" : true, "title" : "User Detail <small>' . $qrow->full_name . '</small>", "modal" : {"buttons" : false, "size" : ""}, "params" : "echo"}\'', 'class' => array()), 'edit' => array('href' => site_url('users/edit/' . serialize_object(array(SYS_USER_ID => $qrow->user_id))), 'title' => 'User Detail (<small>' . $qrow->full_name . '</small>)', 'text' => 'Edit User', 'params' => 'data-ajax="wdpajax" data-options=\'{"form_method" : "GET", "data_type" : "HTML", "role" : "modal", "created_new" : true, "title" : "User Detail <small>' . $qrow->full_name . '</small>", "modal" : {"buttons" : true, "override" : true, "size" : "", "modal_success_callback" : "gl.user.listing.load_grid(g);"}, "params" : "echo", "grid" : {"_init" : true, "gType" : "default"}}\'', 'class' => array()), 'delete' => array('href' => site_url('users/delete/' . serialize_object(array(SYS_USER_ID => $qrow->user_id))), 'title' => 'User <small>' . $qrow->full_name . '</small>', 'text' => 'Delete User', 'params' => 'data-ajax="wdpajax" data-options=\'{"form_method" : "GET", "data_type" : "HTML", "role" : "modal", "created_new" : true, "title" : "User Detail <small>' . $qrow->full_name . '</small>", "modal" : {"buttons" : true, "override" : true, "modal_success_callback" : "gl.user.listing.load_grid(g);"}, "params" : "echo", "grid" : {"_init" : true, "gType" : "default"}}\'', 'class' => array()));
         $qrow = array($qrow->company_name, $qrow->full_name, $qrow->email, $qrow->phone, $qrow->group_description, $qrow->user_id == $this->current_user->user_id ? gtzero_integer($qrow->active) ? 'Active' : 'Inactive' : theme_anchor_button(array('type' => BUTTON_TYPE_ANCHOR, 'href' => gtzero_integer($qrow->active) ? site_url("users/deactivate/" . serialize_object(array(SYS_USER_ID => $qrow->user_id))) : site_url("users/activate/" . serialize_object(array(SYS_USER_ID => $qrow->user_id))), 'title' => gtzero_integer($qrow->active) ? 'De-activate User' : 'Activate User', 'params' => 'data-ajax="wdpajax" data-options=\'{"form_method" : "GET", "data_type" : "HTML", "role" : "modal", "created_new" : true, "title" : "' . (gtzero_integer($qrow->active) ? 'Deactivate' : 'Activate') . ' User <small>' . $qrow->full_name . '</small>", "modal" : {"buttons" : true, "override" : true, "modal_success_callback" : "gl.user.listing.load_grid(g);"}, "params" : "echo", "grid" : {"_init" : true, "gType" : "default"}}\'', 'class' => implode(' ', array(NOICON_BUTTON, gtzero_integer($qrow->active) ? 'btn-success' : 'btn-danger', 'btn-xs btip')), 'icon' => ICON_STATUS_CHANGE . ' mr5', 'text' => gtzero_integer($qrow->active) ? 'Active' : 'Inactive')), local_time($qrow->created_on, 'M d, Y @ h:ia'), $qrow->user_id == $this->current_user->user_id ? '' : theme_button_dropdown($actions));
         if (_check_company_user_access()) {
             unset($qrow[0]);
             $qrow = array_values($qrow);
         }
     }
     echo json_encode($qrows);
 }
Пример #5
0
 public function getTable($pkey = '')
 {
     _has_user_access_permission(TRUE, array('admin', 'staff'));
     $params = ($params = unserialize_object($pkey)) && is_array($params) ? $params : array();
     $input = array('iDisplayStart' => $this->_post_args('iDisplayStart', ARGS_TYPE_INT), 'iDisplayLength' => $this->_post_args('iDisplayLength', ARGS_TYPE_INT, 0, array('gtzero' => FALSE)), 'iSortCol_0' => $this->_post_args('iSortCol_0', ARGS_TYPE_STRING), 'iSortingCols' => $this->_post_args('iSortingCols', ARGS_TYPE_INT), 'sSearch' => $this->_post_args('sSearch', ARGS_TYPE_STRING), 'sEcho' => $this->_post_args('sEcho', ARGS_TYPE_STRING));
     $listing = $this->company_m->ajax_get_parts($input);
     foreach ($listing['aaData'] as &$qrow) {
         $company_id = $qrow->company_id;
         $company_name = $qrow->company_name;
         $actions = array();
         $actions['view'] = array('href' => site_url('agencies/show/' . serialize_object(array(SYS_COMPANY_ID => $qrow->company_id))), 'title' => 'Agency Detail (<small>' . $company_name . '</small>)', 'text' => 'Agency Detail', 'params' => 'data-ajax="wdpajax" data-options=\'{"form_method" : "GET", "data_type" : "HTML", "role" : "modal", "created_new" : true, "title" : "Agency Detail <small>' . $company_name . '</small>", "modal" : {"buttons" : false}, "params" : "echo"}\'', 'class' => array());
         if ($this->current_user->group_id == GROUP_ADMIN) {
             $actions['edit'] = array('href' => site_url('agencies/edit/' . serialize_object(array(SYS_COMPANY_ID => $qrow->company_id))), 'title' => 'Agency Detail (<small>' . $company_name . '</small>)', 'text' => 'Edit Agency', 'params' => 'data-ajax="wdpajax" data-options=\'{"form_method" : "GET", "data_type" : "HTML", "role" : "modal", "created_new" : true, "title" : "Agency Detail <small>' . $company_name . '</small>", "modal" : {"buttons" : true, "override" : true, "modal_success_callback" : "updateData();"}, "params" : "echo", "grid" : {"_init" : true, "gType" : "default"}}\'', 'class' => array());
             $actions['delete'] = array('href' => site_url('agencies/delete/' . serialize_object(array(SYS_COMPANY_ID => $qrow->company_id))), 'title' => 'Agency <small>' . $company_name . '</small>', 'text' => 'Delete Agency', 'params' => 'data-ajax="wdpajax" data-options=\'{"form_method" : "GET", "data_type" : "HTML", "role" : "modal", "created_new" : true, "title" : "Agency Detail <small>' . $company_name . '</small>", "modal" : {"buttons" : true, "override" : true, "modal_success_callback" : "updateData();"}, "params" : "echo", "grid" : {"_init" : true, "gType" : "default"}}\'', 'class' => array());
         }
         /*
         if( in_array($this->current_user->group_id, array(GROUP_ADMIN)) ) {
         	$actions['contacts'] = array(
         				'href' 		=> site_url('contacts/index/'.serialize_object(array( SYS_REF_ID => $qrow->company_id, SYS_CONTACT_TYPE_ID => CONTACT_TYPE_COMPANY) )),
         				'title'		=> 'Contacts <small>(Client: '.$company_name.')</small>',
         				'text'		=> 'Contacts',
         				'params'	=> 'data-ajax="wdpajax" data-options=\'{"form_method" : "GET", "data_type" : "HTML", "role" : "modal", "created_new" : true, "title" : "Contacts <small>(Agency: '.$company_name.')</small>", "modal" : {"buttons" : false, "footer" : false, "size" : "modal-lg", "wizard" : true, "override" : true, "nopadd" : false, "modal_before_close_callback" : "gl.contact.listing.close_grid(g);", "callback" : "gl.contact.listing.load_grid(g);"}, "params" : "echo", "grid" : {"_init" : true, "gType" : "next"}}\'',
         				'class'		=> array()
         			);
         
         }
         
         if( in_array($this->current_user->group_id, array(GROUP_ADMIN)) ) {
         	$actions['new_contact'] = array(
         				'href' 		=> site_url('contacts/create/'.serialize_object(array( SYS_REF_ID => $qrow->company_id, SYS_CONTACT_TYPE_ID => CONTACT_TYPE_COMPANY))),
         				'title'		=> 'Contact Detail <small>(Client: '.$company_name.')</small>',
         				'text'		=> 'New Contact',
         				'params'	=> 'data-ajax="wdpajax" data-options=\'{"form_method" : "POST", "data_type" : "HTML", "role" : "modal", "created_new" : true, "title" : "Contact Detail <small>(Agency: '.$company_name.')</small>", "modal" : {"buttons" : true}, "params" : "echo"}\'',
         				'class'		=> array()
         			);
         
         }
         */
         $qrow = array($qrow->company_name, $qrow->address, !empty($qrow->gmt_offset) ? _date_lang_shorttag($qrow->gmt_offset) : '', $this->current_user->group_id == GROUP_ADMIN ? theme_anchor_button(array('type' => BUTTON_TYPE_ANCHOR, 'href' => gtzero_integer($qrow->active) ? site_url("agencies/deactivate/" . serialize_object(array(SYS_COMPANY_ID => $qrow->company_id))) : site_url("agencies/activate/" . serialize_object(array(SYS_COMPANY_ID => $qrow->company_id))), 'title' => gtzero_integer($qrow->active) ? 'De-activate Agency' : 'Activate Agency', 'params' => 'data-ajax="wdpajax" data-options=\'{"form_method" : "GET", "data_type" : "HTML", "role" : "modal", "created_new" : true, "title" : "' . (gtzero_integer($qrow->active) ? 'Deactivate' : 'Activate') . ' Agency <small>' . $company_name . '</small>", "modal" : {"buttons" : true, "override" : true, "modal_success_callback" : "updateData();"}, "params" : "echo", "grid" : {"_init" : true, "gType" : "default"}}\'', 'class' => implode(' ', array(NOICON_BUTTON, gtzero_integer($qrow->active) ? 'btn-success' : 'btn-danger', 'btn-xs btip')), 'icon' => ICON_STATUS_CHANGE . ' mr5', 'text' => gtzero_integer($qrow->active) ? 'Active' : 'Inactive')) : (gtzero_integer($qrow->active) ? 'Active' : 'Inactive'), local_time($qrow->created_on, 'M d, Y @ h:ia'), $qrow->created_by_name, theme_button_dropdown($actions));
     }
     echo json_encode($listing);
 }