public function index() { //$data['main_content'] = 'login_form'; //$this->load->view('includes/template',$data); //$this->load->view('admin/configuration'); //$this->load->view('admin/homepage'); $crud = new grocery_CRUD(); $crud->set_theme('datatables'); $crud->set_table('ips_disposition'); $crud->set_subject('Disposition'); $crud->required_fields('NAME'); $crud->columns('NAME', 'DISABLE'); $crud->fields('NAME'); // $crud->unset_add(); // $crud->unset_edit(); $crud->unset_delete(); $crud->set_lang_string('insert_success_message', 'Your data has been successfully stored into the database.<br/>Please wait while you are redirecting to the list page. <script type="text/javascript"> window.location = "' . site_url('admin/disposition') . '"; </script> <div style="display:none"> '); $crud->callback_after_insert(array($this, 'disposition_generation')); $output = $crud->render(); // $this->grocery_crud->set_table('ips_login'); // $output = $this->grocery_crud->render(); $this->_example_output($output); }
public function group() { $crud = new grocery_CRUD(); $crud->set_table('cms_group'); $crud->set_subject('User Group'); $crud->columns('group_name', 'description'); $crud->edit_fields('group_name', 'description', 'users', 'navigations', 'privileges'); $crud->add_fields('group_name', 'description', 'users', 'navigations', 'privileges'); $crud->display_as('group_name', 'Group')->display_as('description', 'Description')->display_as('users', 'Users')->display_as('navigations', 'Navigations')->display_as('privileges', 'Privileges'); $crud->set_relation_n_n('users', 'cms_group_user', 'cms_user', 'group_id', 'user_id', 'user_name'); $crud->set_relation_n_n('navigations', 'cms_group_navigation', 'cms_navigation', 'group_id', 'navigation_id', 'navigation_name'); $crud->set_relation_n_n('privileges', 'cms_group_privilege', 'cms_privilege', 'group_id', 'privilege_id', 'privilege_name'); $crud->callback_before_delete(array($this, 'before_delete_group')); $crud->unset_texteditor('description'); $crud->set_lang_string('delete_error_message', 'You cannot delete Admin group or group which is not empty, please empty the group first'); $output = $crud->render(); $this->view('main/group', $output, 'main_group_management'); }
function supervisor_management() { $id = $this->ion_auth->user()->row()->id; $this->load->library('grocery_CRUD'); try { $crud = new grocery_CRUD(); $this->load->library('user_agent'); if ($this->agent->is_mobile() && $this->agent->is_tablet() === FALSE) { $crud->set_theme('bootstrap'); $crud->unset_search(); } else { $crud->set_theme('datatables'); //datatables, flexigrid, bootstrap } $crud->set_table('users'); $crud->set_subject('Supervisor'); $crud->columns('username', 'password_visible', 'su_branch_id', 'su_can_uploadhotdeal'); $crud->required_fields('username', 'password_visible', 'su_branch_id'); $crud->fields('username', 'password_visible', 'su_branch_id', 'su_can_uploadhotdeal'); $crud->display_as('password_visible', 'Password'); $crud->display_as('su_branch_id', 'Branch'); $crud->display_as('su_can_uploadhotdeal', 'Able to upload food & beverage'); $crud->callback_add_field('su_branch_id', array($this, '_selected_branch_callback')); //For add page set pre-selected value if got pass in brach id $crud->field_type('su_branch_id', 'dropdown', $this->ion_auth->get_merchant_branch_list($id)); //For view show the branch list text $crud->callback_insert(array($this, 'supervisor_insert_callback')); $crud->callback_update(array($this, 'supervisor_update_callback')); $crud->set_rules('username', 'Username', 'trim|required|callback_supervisor_username_check'); $crud->field_type('su_can_uploadhotdeal', 'true_false'); $controller = 'merchant'; $function = 'profile'; $crud->set_lang_string('insert_success_message', 'Your data has been successfully stored into the database. <script type="text/javascript"> var originallocation = window.location.pathname; if(originallocation.indexOf("/supervisor/add") > -1) { window.location = "' . site_url($controller . '/' . $function) . '"; } </script> <div style="display:none"> '); $crud->set_lang_string('update_success_message', 'Your data has been successfully stored into the database. <script type="text/javascript"> var originallocation = window.location.pathname; if(originallocation.indexOf("/supervisor/edit") > -1) { window.location = "' . site_url($controller . '/' . $function) . '"; } </script> <div style="display:none"> '); $crud->set_lang_string('form_save_and_go_back', 'Save and View Supervisor'); $crud->set_lang_string('form_update_and_go_back', 'Update and View Supervisor'); $crud->unset_export(); $crud->unset_print(); $crud->unset_read(); $state = $crud->getState(); //filter that this is supervisor type user and it is under this merchant $crud->where('su_merchant_id', $id); $crud->where('main_group_id', $this->group_id_supervisor); $output = $crud->render(); return $output; } catch (Exception $e) { show_error($e->getMessage() . ' --- ' . $e->getTraceAsString()); } }