Example #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);
 }
Example #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);
 }
Example #3
0
 public function edit($pkey, $method = "echo")
 {
     _has_user_access_permission(TRUE, array('admin', 'management_company'));
     $output = array('message' => "", 'status' => "");
     $params = ($params = unserialize_object($pkey)) && is_array($params) ? $params : array();
     $company_id = $this->current_user->group_id == GROUP_ADMIN ? 0 : $this->current_user->company_id;
     $user_id = isset($params[SYS_USER_ID]) && gtzero_integer($params[SYS_USER_ID]) ? to_int($params[SYS_USER_ID]) : 0;
     $redirect_url = $this->_post_args('redirect_url', ARGS_TYPE_STRING, $this->agent->referrer());
     $user_info = $this->user_m->details($user_id);
     if (!$user_info || _has_company_group_access($this->current_user->group_id) && $user_info->company_id != $this->current_user->company_id || $this->current_user->user_id == $user_id) {
         $this->show_permission_denied_error($method);
     }
     $group_id = $this->_post_args("group_id", ARGS_TYPE_INT, $user_info->group_id);
     $company_id = $this->current_user->group_id == GROUP_ADMIN ? $this->_post_args('company_id', ARGS_TYPE_INT, $user_info->company_id) : $this->current_user->company_id;
     $this->form_validation->set_rules('group_id', 'Group', 'required|callback__check_user_group');
     if ($this->current_user->group_id == GROUP_ADMIN) {
         $this->form_validation->set_rules('company_id', 'Agency', 'callback__check_user_company');
     }
     $this->form_validation->set_rules('client_ids', 'Client', 'callback__check_user_company_clients');
     if ($this->current_user->group_id == GROUP_ADMIN) {
         $this->form_validation->set_rules('email', 'Email Address', 'required|valid_email|is_unique[users.email.id.' . $user_id . ']');
     }
     $this->form_validation->set_rules('first_name', 'First Name', 'required|xss_clean');
     $this->form_validation->set_rules('last_name', 'Last Name', 'trim|xss_clean');
     $this->form_validation->set_rules('phone', 'Phone Number', 'required|xss_clean|min_length[3]');
     //$this->form_validation->set_rules('postcode', 'Postcode', 'trim|xss_clean');
     //$this->form_validation->set_rules('workhours', 'Working Hours', 'trim|xss_clean');
     if ($this->input->post('password')) {
         $this->form_validation->set_rules('password', 'Password', 'required|min_length[' . $this->config->item('min_password_length', 'ion_auth') . ']|max_length[' . $this->config->item('max_password_length', 'ion_auth') . ']|matches[password_confirm]');
         $this->form_validation->set_rules('password_confirm', 'Password Confirmation', 'required');
     }
     if ($this->form_validation->run() == TRUE) {
         $company_id = $this->current_user->group_id == GROUP_ADMIN ? $this->_post_args('company_id', ARGS_TYPE_INT) : $this->current_user->company_id;
         //$company_info = $this->company_m->company_detail($company_id);
         //$company_settings = $this->company_m->company_settings($company_id);
         //$gmt_offset = ( _check_company_user_access($group_id) && $company_id > 0) ? $company_settings->gmt_offset : ( ( $this->current_user->group_id == GROUP_ADMIN ) ? $this->current_user->gmt_offset : $this->current_user->company_settings->gmt_offset);
         $input_data = array('email' => $this->current_user->group_id == GROUP_ADMIN ? $this->_post_args('email', ARGS_TYPE_STRING) : $user_info->email, 'first_name' => $this->_post_args('first_name', ARGS_TYPE_STRING), 'last_name' => $this->_post_args('last_name', ARGS_TYPE_STRING), 'phone' => $this->_post_args('phone', ARGS_TYPE_STRING), 'gmt_offset' => $this->_post_args('gmt_offset', ARGS_TYPE_STRING, $this->cfg->gmt_offset, array('override' => TRUE)));
         if ($this->_post_args('password', ARGS_TYPE_STRING)) {
             $input_data['password'] = $this->_post_args('password', ARGS_TYPE_STRING);
         }
         /*$user_avatar = $this->_post_args('user_avatar_img', ARGS_TYPE_STRING);
         		
         		if( array_key_exists('user_avatar_img', $_POST) && !empty($user_avatar) ){
         			
         			$additional_data['avatar'] = $user_avatar;
         		
         		} elseif( ($user_avatar = $this->upload_avatar()) && empty($user_avatar['error']) && !empty($user_avatar['file_name']) ) {
         			
         			$additional_data['avatar'] = $user_avatar['file_name'];
         		}*/
         $is_record_updated = $this->ion_auth->update($user_id, $input_data);
         $group = array($group_id);
         $this->user_m->update_user_group($user_id, $group_id);
         if (_has_company_resources($group_id)) {
             if (gtzero_integer($user_info->company_id) && $user_info->company_id != $company_id) {
                 $this->user_m->delete_user_company($user_id);
             }
             $this->user_m->update_user_company($user_id, $company_id, $group_id);
             $this->user_m->delete_user_clients($user_id);
         } elseif (_has_company_non_resources($group_id)) {
             $this->user_m->delete_user_company($user_id);
             $client_ids = $this->_post_args('client_ids', ARGS_TYPE_ARRAY);
             $this->user_m->update_user_clients($user_id, $client_ids, $company_id);
         } elseif ($group_id == GROUP_ADMIN) {
             $this->user_m->delete_user_clients($user_id);
             $this->user_m->delete_user_company($user_id);
         }
         if ($is_record_updated) {
             $output['message'] = sprintf('The user "%s" was updated.', $user_info->first_name . ' ' . $user_info->last_name);
             $output['status'] = SUCCESS_MESSAGE;
             $output['user_id'] = $user_id;
             $this->user_m->clear_user_profile_cache(array('user_id' => $user_id, 'company_id' => $company_id, 'old_company_id' => $user_info->company_id));
             //trigger_trip("user_updated", $company_id, array('user_id' => $user_id, 'updated_by' => $this->current_user->user_id));
         } else {
             $output['message'] = sprintf('Unable to Update Account Information for user "%s". Please report the issue to %s', $user_info->first_name . ' ' . $user_info->last_name, $this->cfg->contact_email);
             $output['status'] = ERROR_MESSAGE;
         }
         $this->_output_request($output, $redirect_url);
     } else {
         if (validation_errors()) {
             $output['message'] = validation_errors();
             $output['status'] = ERROR_MESSAGE;
         }
     }
     $company_settings = $this->company_m->company_settings($company_id);
     $doc_key = $this->_post_args('doc_key', ARGS_TYPE_STRING) ? $this->_post_args('doc_key', ARGS_TYPE_STRING) : keygen();
     $csrf = _get_csrf_nonce();
     $gmt_offset = _check_company_user_access($group_id) && $company_id > 0 ? $company_settings->gmt_offset : ($this->current_user->group_id == GROUP_ADMIN ? $this->current_user->gmt_offset : $this->current_user->company_settings->gmt_offset);
     $data = array("user_id" => $user_id, 'form_action_type' => FORM_ACTION_EDIT, 'form_action' => site_url('users/edit/' . $pkey), 'cancel_url' => $redirect_url, 'page' => 'user/form', 'title' => 'User Detail', 'submit_btn_text' => 'Save Changes', 'first_name' => $this->_post_args('first_name', ARGS_TYPE_STRING, $user_info->first_name), 'last_name' => $this->_post_args('last_name', ARGS_TYPE_STRING, $user_info->last_name), 'email' => $this->_post_args('email', ARGS_TYPE_STRING, $user_info->email), 'phone' => $this->_post_args('phone', ARGS_TYPE_STRING, $user_info->phone), 'password' => '', 'password_confirm' => '', 'company_id' => $company_id, 'client_ids' => $this->_post_args('client_ids', ARGS_TYPE_ARRAY, isset($user_info->client_ids) ? $user_info->client_ids : array()), 'group_id' => $this->_post_args('group_id', ARGS_TYPE_INT, $user_info->group_id), 'gmt_offset' => $this->_post_args('gmt_offset', ARGS_TYPE_STRING, !empty($user_info->gmt_offset) ? $user_info->gmt_offset : $gmt_offset), 'scripts' => array('user/form.js'), 'hiddenvars' => array_merge($csrf, array('redirect_url' => $redirect_url)), 'doc_key' => $doc_key);
     if ($this->input->is_ajax_request()) {
         $html = $this->template->raw_view('pages/user/form_modal', $data, TRUE);
         if ($method == "ajax") {
             $output['html'] = $html;
             $this->_output_request($output, $redirect_url);
         } else {
             echo $html;
         }
     } else {
         if (!empty($output['status'])) {
             set_flash_data($output['status'], $output['message'], FALSE);
         }
         $this->template->load('default', $data);
     }
 }
Example #4
0
 public function index($pkey = '', $method = 'echo')
 {
     ensure_user_access(TRUE, array('admin', 'management_company'));
     $params = ($params = wdp_arr_decode($pkey)) && is_array($params) ? $params : array();
     $company_id = $this->current_user->group_id == 1 ? 0 : $this->current_user->company_id;
     $grid_column_type_id = isset($params[GRID_CTYPE]) && gtzero_integer($params[GRID_CTYPE]) ? to_int($params[GRID_CTYPE]) : 0;
     $redirect_url = $this->_post_args('redirect_url', ARGS_TYPE_STRING, $this->agent->referrer());
     $params = array('user_id' => $this->current_user->user_id, 'grid_column_type_id' => $grid_column_type_id);
     if (_check_company_user_access()) {
         $params['company_id'] = $company_id;
     }
     $grid_columns = $this->setting_m->grid_columns_by_many($params);
     if (!$grid_columns) {
         $this->show_permission_denied_error($method);
     }
     $this->form_validation->set_rules('grid_column_rows', '', '');
     $output = array('message' => "", 'status' => "");
     if ($this->form_validation->run() == TRUE) {
         $grid_column_rows = $this->_post_args('grid_column_rows', ARGS_TYPE_ARRAY);
         if ($this->current_user->group_id == 2) {
             $this->setting_m->delete_company_grid_columns($company_id, $grid_column_type_id);
             foreach ($grid_column_rows as $grid_column_id => $is_visible) {
                 $this->setting_m->add_company_grid_columns(array('company_id' => $company_id, 'grid_column_id' => $grid_column_id, 'grid_column_type_id' => $grid_column_type_id, 'visible' => to_int($is_visible)));
             }
             $this->setting_m->user_grid_columns_by_many($company_id, array('company_id' => $company_id, 'grid_column_type_id' => $grid_column_type_id), TRUE);
         } else {
             $this->setting_m->delete_user_grid_columns($this->current_user->user_id, $grid_column_type_id);
             foreach ($grid_column_rows as $grid_column_id => $is_visible) {
                 $this->setting_m->add_user_grid_columns(array('user_id' => $this->current_user->user_id, 'grid_column_id' => $grid_column_id, 'grid_column_type_id' => $grid_column_type_id, 'visible' => to_int($is_visible)));
             }
             $this->setting_m->user_grid_columns_by_many($company_id, array('user_id' => $this->current_user->user_id, 'grid_column_type_id' => $grid_column_type_id), TRUE);
         }
         $gparams = array('grid_column_type_id' => $grid_column_type_id, 'user_id' => $this->current_user->user_id);
         if (_check_company_user_access()) {
             $gparams['company_id'] = $this->current_user->company_id;
         }
         $grid_columns = $this->setting_m->user_grid_columns_by_many($this->current_user->company_id, $gparams);
         $output['message'] = 'Setting Saved';
         $output['status'] = SUCCESS_MESSAGE;
         $output['grid_columns'] = $grid_columns;
         //$output['redirect'] 	= $redirect_url;
         $this->_output_request($output, $redirect_url);
     } else {
         if (validation_errors()) {
             $output['message'] = validation_errors();
             $output['status'] = ERROR_MESSAGE;
         }
     }
     $details = $this->company_m->company_settings($company_id);
     $data = array('form_action' => site_url('settings/gcolumns/index/' . $pkey), 'cancel_url' => $redirect_url, 'page' => 'settings/my_grid_permission', 'title' => 'Grid Setting', 'submit_btn_text' => 'Save Changes', 'company_id' => $company_id, 'grid_columns' => $grid_columns->columns, 'js_files' => array('settings/gcolumns.js'), 'hiddenvars' => array('redirect_url' => $redirect_url));
     if ($this->input->is_ajax_request()) {
         $html = $this->template->raw_view('pages/settings/my_grid_permission_modal', $data, TRUE);
         if ($method == "ajax") {
             $output['html'] = $html;
             $this->_output_request($output, $redirect_url);
         } else {
             echo $html;
         }
     } else {
         $this->template->load('default', $data);
     }
 }