public function index() { $this->load->model('crud_auth'); $this->load->model('admin/admin_menu'); $this->load->model('user/user_menu'); $this->load->add_package_path(APPPATH . 'third_party/scrud/'); $crudAuth = $this->session->userdata('CRUD_AUTH'); $var = array(); $conf = array(); $var['main_menu'] = $this->admin_menu->fetch('account'); $hook = Hook::singleton(); $hook->addFunction('SCRUD_EDIT_FORM', 'removeElement'); $hook->addFunction('SCRUD_EDIT_CONFIRM', 'removeElement'); $hook->addFunction('SCRUD_BEFORE_VALIDATE', 'removeValidate'); $hook->addFunction('SCRUD_COMPLETE_UPDATE', 'completeUpdate'); $hook->addFunction('SCRUD_BEFORE_SAVE', 'removeElementData'); if (!isset($_GET['xtype'])) { $_GET['xtype'] = 'form'; } $_GET['table'] = 'crud_users'; $_GET['key']['crud_users.id'] = $crudAuth['id']; $_SERVER['QUERY_STRING'] = $_SERVER['QUERY_STRING'] . '&key[crud_users.id]=' . $crudAuth['id']; if (!file_exists(__DATABASE_CONFIG_PATH__ . '/' . $this->db->database . '/' . $this->input->get('table') . '.php')) { exit; } else { require __DATABASE_CONFIG_PATH__ . '/' . $this->db->database . '/' . $this->input->get('table') . '.php'; } $conf['theme_path'] = FCPATH . 'application/views/user/profile/crud'; $this->load->library('crud', array('table' => $this->input->get('table'), 'conf' => $conf)); $var['main_content'] = $this->load->view('user/profile/profile', array('content' => $this->crud->process(), 'user_menu' => $this->user_menu->fetch('profile')), true); $this->load->model('admin/admin_footer'); $var['main_footer'] = $this->admin_footer->fetch(); $this->load->view('layouts/user/default', $var); }
public function builder() { $this->load->model('admin/admin_menu'); $this->load->add_package_path(APPPATH . 'third_party/scrud/'); $var = array(); $_GET['crud_components'] = 'crud_components'; $var['main_menu'] = $this->admin_menu->fetch('tool'); $conf = array(); if (!file_exists(__DATABASE_CONFIG_PATH__ . '/' . $this->db->database . '/crud_components.php')) { exit; } else { require __DATABASE_CONFIG_PATH__ . '/' . $this->db->database . '/crud_components.php'; } $hook = Hook::singleton(); $hook->addFunction('SCRUD_ADD_FORM', 'addTableElement'); $hook->addFunction('SCRUD_EDIT_FORM', 'addTableElement'); $hook->addFunction('SCRUD_ADD_CONFIRM', 'addTableElement'); $hook->addFunction('SCRUD_EDIT_CONFIRM', 'addTableElement'); $hook->addFunction('SCRUD_VIEW_FORM', 'addTableElement'); $hook->addFunction('SCRUD_CONFRIM_DELETE_FORM', 'addTableElement'); $hook->addFunction('SCRUD_BEFORE_UPDATE', 'removeConfig'); $hook->addFunction('SCRUD_BEFORE_SAVE', 'checkGroup'); $hook->addFunction('SCRUD_COMPLETE_DELETE', 'completeDelete'); $conf['theme_path'] = FCPATH . 'application/views/admin/component/templates/builder'; $this->load->library('crud', array('table' => 'crud_components', 'conf' => $conf)); $var['main_content'] = $this->load->view('admin/component/builder', array('content' => $this->crud->process()), true); $this->load->model('admin/admin_footer'); $var['main_footer'] = $this->admin_footer->fetch(); $this->load->view('layouts/admin/scrud/browse', $var); }
public function index() { $userData = $this->session->userdata('CRUD_AUTH'); if ($userData['group']['group_name'] == "Administrators") { $this->load->model('admin/admin_menu'); } else { $this->load->model('admin/home_menu'); } $this->load->add_package_path(APPPATH . 'third_party/scrud/'); $_GET['table'] = 'crud_users'; $var = array(); if ($userData['group']['group_name'] == "Administrators") { $var['main_menu'] = $this->admin_menu->fetch('user'); } else { $var['main_menu'] = $this->home_menu->fetch('user'); } if (!file_exists(__DATABASE_CONFIG_PATH__ . '/' . $this->db->database . '/crud_users.php')) { exit; } $content = str_replace("<?php exit; ?>\n", "", file_get_contents(__DATABASE_CONFIG_PATH__ . '/' . $this->db->database . '/crud_users.php')); $conf = unserialize($content); $hook = Hook::singleton(); $hook->add_function('SCRUD_ADD_FORM', 'addPasswordConfirmElement'); $hook->add_function('SCRUD_EDIT_FORM', 'addPasswordConfirmElement'); $hook->add_function('SCRUD_BEFORE_VALIDATE', 'passwordConfirmValidate'); $hook->add_function('SCRUD_VALIDATE', 'comparePassAndConfirmPass'); $hook->add_function('SCRUD_VALIDATE', 'checkUser'); $hook->add_function('SCRUD_BEFORE_SAVE', 'encryptPassword'); $conf['theme_path'] = FCPATH . 'application/views/admin/user/templates'; $this->load->library('crud', array('table' => 'crud_users', 'conf' => $conf)); $var['main_content'] = $this->load->view('admin/user/user', array('content' => $this->crud->process()), true); $this->load->view('layouts/admin/user/default', $var); }
public function index() { $this->load->model('admin/admin_menu'); $this->load->add_package_path(APPPATH . 'third_party/scrud/'); $_GET['table'] = 'crud_languages'; $var = array(); $conf = array(); $var['main_menu'] = $this->admin_menu->fetch('tool'); if (!file_exists(__DATABASE_CONFIG_PATH__ . '/' . $this->db->database . '/' . $_GET['table'] . '.php')) { exit; } else { require __DATABASE_CONFIG_PATH__ . '/' . $this->db->database . '/' . $_GET['table'] . '.php'; } $hook = Hook::singleton(); $hook->addFunction('SCRUD_EDIT_FORM', 'edit_form'); $hook->addFunction('SCRUD_VALIDATE', 'validate_language_code'); $hook->addFunction('SCRUD_BEFORE_UPDATE', 'before_update'); $hook->addFunction('SCRUD_COMPLETE_SAVE', 'complete_save'); $hook->addFunction('SCRUD_COMPLETE_DELETE', 'complete_delete'); $conf['theme_path'] = FCPATH . 'application/views/admin/language/templates'; $this->load->library('crud', array('table' => $_GET['table'], 'conf' => $conf)); $var['main_content'] = $this->load->view('admin/language/index', array('content' => $this->crud->process()), true); $this->load->model('admin/admin_footer'); $var['main_footer'] = $this->admin_footer->fetch(); $this->load->view('layouts/admin/user/default', $var); }
public function index() { $this->load->model('admin/admin_menu'); $this->load->add_package_path(APPPATH . 'third_party/scrud/'); $_GET['table'] = 'crud_users'; $var = array(); $conf = array(); $var['main_menu'] = $this->admin_menu->fetch('user'); if (!file_exists(__DATABASE_CONFIG_PATH__ . '/' . $this->db->database . '/crud_users.php')) { exit; } else { require __DATABASE_CONFIG_PATH__ . '/' . $this->db->database . '/crud_users.php'; } $hook = Hook::singleton(); $hook->addFunction('SCRUD_ADD_FORM', 'addPasswordConfirmElement'); $hook->addFunction('SCRUD_EDIT_FORM', 'addPasswordConfirmElement'); $hook->addFunction('SCRUD_BEFORE_VALIDATE', 'passwordConfirmValidate'); $hook->addFunction('SCRUD_VALIDATE', 'comparePassAndConfirmPass'); $hook->addFunction('SCRUD_VALIDATE', 'checkUser'); $hook->addFunction('SCRUD_BEFORE_SAVE', 'encryptPassword'); $conf['theme_path'] = FCPATH . 'application/views/admin/user/templates'; $this->load->library('crud', array('table' => 'crud_users', 'conf' => $conf)); $var['main_content'] = $this->load->view('admin/user/user', array('content' => $this->crud->process()), true); $this->load->model('admin/admin_footer'); $var['main_footer'] = $this->admin_footer->fetch(); $this->load->view('layouts/admin/user/default', $var); }
public function browse() { $userData = $this->session->userdata('CRUD_AUTH'); if ($userData['group']['group_name'] == "Administrators") { $this->load->model('admin/admin_menu'); } else { $this->load->model('admin/home_menu'); } $this->load->add_package_path(APPPATH . 'third_party/scrud/'); $var = array(); if ($userData['group']['group_name'] == "Administrators") { $var['main_menu'] = $this->admin_menu->fetch('browse'); } else { $var['main_menu'] = $this->home_menu->fetch('browse'); } if (!file_exists(__DATABASE_CONFIG_PATH__ . '/' . $this->db->database . '/' . $this->input->get('table') . '.php')) { exit; } $content = str_replace("<?php exit; ?>\n", "", file_get_contents(__DATABASE_CONFIG_PATH__ . '/' . $this->db->database . '/' . $this->input->get('table') . '.php')); $conf = unserialize($content); $hook = Hook::singleton(); $hook->add_function('SCRUD_INIT', 'f_scrud_init'); $this->load->library('crud', array('table' => $this->input->get('table'), 'conf' => $conf)); $var['main_content'] = $this->load->view('admin/scrud/browse', array('content' => $this->crud->process(), 'conf' => $conf), true); $this->load->view('layouts/admin/scrud/browse', $var); }
public function __construct() { parent::__construct(); $this->authenticate(); $hook = Hook::singleton(); $hook->set('SCRUD_INIT'); $hook->set('SCRUD_BEFORE_VALIDATE'); $hook->set('SCRUD_VALIDATE'); $hook->set('SCRUD_ADD_FORM'); $hook->set('SCRUD_EDIT_FORM'); $hook->set('SCRUD_ADD_CONFIRM'); $hook->set('SCRUD_EDIT_CONFIRM'); $hook->set('SCRUD_BEFORE_SAVE'); $hook->set('SCRUD_BEFORE_INSERT'); $hook->set('SCRUD_BEFORE_UPDATE'); $hook->set('SCRUD_COMPLETE_INSERT'); $hook->set('SCRUD_COMPLETE_UPDATE'); $hook->set('SCRUD_COMPLETE_SAVE'); }
public function exportcsv() { $this->load->add_package_path(APPPATH . 'third_party/scrud/'); $hook = Hook::singleton(); $comId = $this->input->get('com_id'); $conf = array(); if (!empty($comId)) { $this->db->select('*'); $this->db->from('crud_components'); $this->db->where('id', $comId); $query = $this->db->get(); $com = $query->row_array(); $table = $com['component_table']; $_GET['table'] = $com['component_name']; if (!file_exists(__DATABASE_CONFIG_PATH__ . '/' . $this->db->database . '/' . sha1('com_' . $comId) . '/' . $com['component_table'] . '.php')) { exit; } $content = str_replace("<?php exit; ?>\n", "", file_get_contents(__DATABASE_CONFIG_PATH__ . '/' . $this->db->database . '/' . sha1('com_' . $comId) . '/' . $com['component_table'] . '.php')); $conf = unserialize($content); } else { $table = $this->input->get('table'); if (!file_exists(__DATABASE_CONFIG_PATH__ . '/' . $this->db->database . '/' . $table . '.php')) { exit; } switch ($table) { case 'crud_users': case 'crud_groups': require __DATABASE_CONFIG_PATH__ . '/' . $this->db->database . '/' . $table . '.php'; break; default: $content = str_replace("<?php exit; ?>\n", "", file_get_contents(__DATABASE_CONFIG_PATH__ . '/' . $this->db->database . '/' . $table . '.php')); $conf = unserialize($content); break; } } $hook->addFunction('SCRUD_INIT', 'f_global_access'); $this->load->library('crud', array('table' => $table, 'conf' => $conf)); echo $this->crud->process(); }
private function validate() { $hook = Hook::singleton(); foreach ($this->validate as $k => $v) { if (isset($v['rule'])) { $this->_validate($k, $v); } else { foreach ($v as $k1 => $v1) { $this->_validate($k, $v1); } } } if ($hook->isExisted('SCRUD_VALIDATE')) { $this->errors = $hook->filter('SCRUD_VALIDATE', $this->errors); } return count($this->errors) > 0 ? false : true; }