PageRenderTime 50ms CodeModel.GetById 12ms RepoModel.GetById 1ms app.codeStats 0ms

/modules/main/controllers/main.php

https://github.com/coderkid/No-CMS
PHP | 1850 lines | 1567 code | 210 blank | 73 comment | 197 complexity | 3107f28a93d17d8a6ce3628fa0e24174 MD5 | raw file
Possible License(s): GPL-3.0, LGPL-2.1, MPL-2.0-no-copyleft-exception, GPL-2.0

Large files files are truncated, but you can click here to view the full file

  1. <?php if (!defined('BASEPATH')) exit('No direct script access allowed');
  2. /**
  3. * The Main Controller of No-CMS
  4. *
  5. * @author gofrendi
  6. */
  7. class Main extends CMS_Controller
  8. {
  9. private function unique_field_name($field_name)
  10. {
  11. return 's'.substr(md5($field_name),0,8); //This s is because is better for a string to begin with a letter and not with a number
  12. }
  13. private function __random_string($length=10)
  14. {
  15. $chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
  16. $size = strlen( $chars );
  17. $str = '';
  18. for( $i = 0; $i < $length; $i++ ){
  19. $str .= $chars[ rand( 0, $size - 1 ) ];
  20. }
  21. return $str;
  22. }
  23. protected function upload($upload_path, $input_file_name = 'userfile', $submit_name = 'upload')
  24. {
  25. $data = array(
  26. "uploading" => TRUE,
  27. "success" => FALSE,
  28. "message" => ""
  29. );
  30. if (isset($_POST[$submit_name])) {
  31. $config['upload_path'] = $upload_path;
  32. $config['allowed_types'] = 'zip';
  33. $config['max_size'] = 8 * 1024;
  34. $config['overwrite'] = TRUE;
  35. $this->load->library('upload', $config);
  36. if (!$this->upload->do_upload($input_file_name)) {
  37. $data['uploading'] = TRUE;
  38. $data['success'] = FALSE;
  39. $data['message'] = $this->upload->display_errors();
  40. } else {
  41. $this->load->library('unzip');
  42. $upload_data = $this->upload->data();
  43. $this->unzip->extract($upload_data['full_path']);
  44. unlink($upload_data['full_path']);
  45. $data['uploading'] = TRUE;
  46. $data['success'] = TRUE;
  47. $data['message'] = '';
  48. }
  49. } else {
  50. $data['uploading'] = FALSE;
  51. $data['success'] = FALSE;
  52. $data['message'] = '';
  53. }
  54. return $data;
  55. }
  56. protected function recurse_copy($src,$dst) {
  57. $dir = opendir($src);
  58. @mkdir($dst);
  59. while(false !== ( $file = readdir($dir)) ) {
  60. if (( $file != '.' ) && ( $file != '..' )) {
  61. if ( is_dir($src . '/' . $file) ) {
  62. $this->recurse_copy($src . '/' . $file,$dst . '/' . $file);
  63. }
  64. else {
  65. copy($src . '/' . $file,$dst . '/' . $file);
  66. }
  67. }
  68. }
  69. closedir($dir);
  70. }
  71. protected function rrmdir($dir) {
  72. foreach(glob($dir . '/*') as $file) {
  73. if(is_dir($file)){
  74. $this->rrmdir($file);
  75. } else {
  76. unlink($file);
  77. }
  78. }
  79. unlink($dir.'/.htaccess');
  80. rmdir($dir);
  81. }
  82. public function module_management()
  83. {
  84. $this->cms_guard_page('main_module_management');
  85. if(isset($_FILES['userfile'])){
  86. // upload new module
  87. $directory = basename($_FILES['userfile']['name'],'.zip');
  88. // subsite_auth
  89. $subsite_auth_file = FCPATH.'modules/'.$directory.'/subsite_auth.php';
  90. $backup_subsite_auth_file = FCPATH.'modules/'.$directory.'_subsite_auth.php';
  91. $subsite_backup = FALSE;
  92. if(file_exists($subsite_auth_file)){
  93. copy($subsite_auth_file, $backup_subsite_auth_file);
  94. $subsite_backup = TRUE;
  95. }
  96. // config
  97. $config_dir = FCPATH.'modules/'.$directory.'/config';
  98. $backup_config_dir = FCPATH.'modules/'.$directory.'_config';
  99. $config_backup = FALSE;
  100. if(file_exists($config_dir) && is_dir($config_dir)){
  101. $this->recurse_copy($config_dir, $backup_config_dir);
  102. $config_backup = TRUE;
  103. }
  104. }
  105. $data['upload'] = $this->upload(FCPATH.'modules/', 'userfile', 'upload');
  106. if($data['upload']['success']){
  107. if($subsite_backup){
  108. copy($backup_subsite_auth_file, $subsite_auth_file);
  109. unlink($backup_subsite_auth_file);
  110. }
  111. if($config_backup){
  112. $this->recurse_copy($backup_config_dir, $config_dir);
  113. $this->rrmdir($backup_config_dir);
  114. }
  115. }
  116. // show the view
  117. $modules = $this->cms_get_module_list();
  118. for($i=0; $i<count($modules); $i++){
  119. $module = $modules[$i];
  120. $module_path = $module['module_path'];
  121. }
  122. $data['modules'] = $modules;
  123. $data['upload_new_module_caption'] = $this->cms_lang('Upload New Module');
  124. $this->view('main/main_module_management', $data, 'main_module_management');
  125. }
  126. public function change_theme($theme = NULL)
  127. {
  128. $this->cms_guard_page('main_change_theme');
  129. if(isset($_FILES['userfile'])){
  130. // upload new module
  131. $directory = basename($_FILES['userfile']['name'],'.zip');
  132. // subsite_auth
  133. $subsite_auth_file = FCPATH.'themes'.$directory.'/subsite_auth.php';
  134. $backup_subsite_auth_file = FCPATH.'themes/'.$directory.'_subsite_auth.php';
  135. $subsite_backup = FALSE;
  136. if(file_exists($subsite_auth_file)){
  137. copy($subsite_auth_file, $backup_subsite_auth_file);
  138. $subsite_backup = TRUE;
  139. }
  140. }
  141. // upload new theme
  142. $data['upload'] = $this->upload('./themes/', 'userfile', 'upload');
  143. if($data['upload']['success']){
  144. if($subsite_backup){
  145. copy($backup_subsite_auth_file, $subsite_auth_file);
  146. unlink($backup_subsite_auth_file);
  147. }
  148. }
  149. // show the view
  150. if (isset($theme)) {
  151. $this->cms_set_config('site_theme', $theme);
  152. }
  153. $data['themes'] = $this->cms_get_theme_list();
  154. $data['upload_new_theme_caption'] = $this->cms_lang('Upload New Theme');
  155. $this->view('main/main_change_theme', $data, 'main_change_theme');
  156. }
  157. //this is used for the real static page which doesn't has any URL in navigation management
  158. public function static_page($navigation_name)
  159. {
  160. $this->view('CMS_View', NULL, $navigation_name);
  161. }
  162. public function login()
  163. {
  164. $this->cms_guard_page('main_login');
  165. // Is registration allowed
  166. $allow_register = $this->cms_allow_navigate('main_register');
  167. //retrieve old_url from userdata if exists
  168. $this->load->library('session');
  169. $old_url = $this->session->userdata('cms_old_url');
  170. //get user input
  171. $identity = $this->input->post('identity');
  172. $password = $this->input->post('password');
  173. //set validation rule
  174. $this->form_validation->set_rules('identity', 'Identity', 'required|xss_clean');
  175. $this->form_validation->set_rules('password', 'Password', 'required|xss_clean');
  176. if ($this->form_validation->run()) {
  177. if ($this->cms_do_login($identity, $password)) {
  178. //if old_url exist, redirect to old_url, else redirect to main/index
  179. if (isset($old_url)) {
  180. $this->session->set_userdata('cms_old_url', NULL);
  181. // seek for the closest url that exist in navigation table to avoid something like manage_x/index/edit/1/error to be appeared
  182. $old_url_part = explode('/', $old_url);
  183. while(count($old_url_part)>0){
  184. $query = $this->db->select('url')
  185. ->from(cms_table_name('main_navigation'))
  186. ->like('url', implode('/', $old_url_part))
  187. ->get();
  188. if($query->num_rows()>0){
  189. $row = $query->row();
  190. $old_url = $row->url;
  191. break;
  192. }else{
  193. $new_old_url_part = array();
  194. for($i=0; $i<count($old_url_part)-1; $i++){
  195. $new_old_url_part[] = $old_url_part[$i];
  196. }
  197. $old_url_part = $new_old_url_part;
  198. }
  199. }
  200. redirect($old_url,'refresh');
  201. } else {
  202. redirect('','refresh');
  203. }
  204. } else {
  205. //view login again
  206. $data = array(
  207. "identity" => $identity,
  208. "message" => '{{ language:Error }}: {{ language:Login Failed }}',
  209. "providers" => $this->cms_third_party_providers(),
  210. "login_caption" => $this->cms_lang("Login"),
  211. "register_caption" => $this->cms_lang("Register"),
  212. "allow_register"=> $allow_register,
  213. );
  214. $this->view('main/main_login', $data, 'main_login');
  215. }
  216. } else {
  217. //view login again
  218. $data = array(
  219. "identity" => $identity,
  220. "message" => '',
  221. "providers" => $this->cms_third_party_providers(),
  222. "login_caption" => $this->cms_lang("Login"),
  223. "register_caption" => $this->cms_lang("Register"),
  224. "allow_register" => $allow_register,
  225. );
  226. $this->view('main/main_login', $data, 'main_login');
  227. }
  228. }
  229. public function activate($activation_code)
  230. {
  231. $this->cms_activate_account($activation_code);
  232. redirect('','refresh');
  233. }
  234. public function forgot($activation_code = NULL)
  235. {
  236. $this->cms_guard_page('main_forgot');
  237. if (isset($activation_code)) {
  238. //get user input
  239. $password = $this->input->post('password');
  240. //set validation rule
  241. $this->form_validation->set_rules('password', 'Password', 'required|xss_clean|matches[confirm_password]');
  242. $this->form_validation->set_rules('confirm_password', 'Password Confirmation', 'required|xss_clean');
  243. if ($this->form_validation->run()) {
  244. if ($this->cms_valid_activation_code($activation_code)) {
  245. $this->cms_activate_account($activation_code, $password);
  246. redirect('','refresh');
  247. } else {
  248. redirect('main/forgot','refresh');
  249. }
  250. } else {
  251. $data = array(
  252. "activation_code" => $activation_code,
  253. "change_caption" => $this->cms_lang('Change'),
  254. );
  255. $this->view('main/main_forgot_change_password', $data, 'main_forgot');
  256. }
  257. } else {
  258. //get user input
  259. $identity = $this->input->post('identity');
  260. //set validation rule
  261. $this->form_validation->set_rules('identity', 'Identity', 'required|xss_clean');
  262. if ($this->form_validation->run()) {
  263. if ($this->cms_generate_activation_code($identity, TRUE, 'FORGOT')) {
  264. redirect('','refresh');
  265. } else {
  266. $data = array(
  267. "identity" => $identity,
  268. "send_activation_code_caption"=> $this->cms_lang('Send activation code to my email'),
  269. );
  270. $this->view('main/main_forgot_fill_identity', $data, 'main_forgot');
  271. }
  272. } else {
  273. $data = array(
  274. "identity" => $identity,
  275. "send_activation_code_caption"=> $this->cms_lang('Send activation code to my email'),
  276. );
  277. $this->view('main/main_forgot_fill_identity', $data, 'main_forgot');
  278. }
  279. }
  280. }
  281. public function register()
  282. {
  283. $this->cms_guard_page('main_register');
  284. // the honey_pot, every fake input should be empty
  285. $honey_pot_pass = (strlen($this->input->post('user_name', ''))==0) &&
  286. (strlen($this->input->post('email', ''))==0) &&
  287. (strlen($this->input->post('real_name', ''))==0) &&
  288. (strlen($this->input->post('password', ''))==0) &&
  289. (strlen($this->input->post('confirm_password'))==0);
  290. if(!$honey_pot_pass){
  291. show_404();
  292. die();
  293. }
  294. $previous_secret_code = $this->session->userdata('__main_registration_secret_code');
  295. if($previous_secret_code === NULL){
  296. $previous_secret_code = $this->__random_string();
  297. }
  298. //get user input
  299. $user_name = $this->input->post($previous_secret_code.'user_name');
  300. $email = $this->input->post($previous_secret_code.'email');
  301. $real_name = $this->input->post($previous_secret_code.'real_name');
  302. $password = $this->input->post($previous_secret_code.'password');
  303. $confirm_password = $this->input->post($previous_secret_code.'confirm_password');
  304. //set validation rule
  305. $this->form_validation->set_rules($previous_secret_code.'user_name', 'User Name', 'required|xss_clean');
  306. $this->form_validation->set_rules($previous_secret_code.'email', 'E mail', 'required|xss_clean|valid_email');
  307. $this->form_validation->set_rules($previous_secret_code.'real_name', 'Real Name', 'required|xss_clean');
  308. $this->form_validation->set_rules($previous_secret_code.'password', 'Password', 'required|xss_clean|matches['.$previous_secret_code.'confirm_password]');
  309. $this->form_validation->set_rules($previous_secret_code.'confirm_password', 'Password Confirmation', 'required|xss_clean');
  310. // generate new secret code
  311. $secret_code = $this->__random_string();
  312. $this->session->set_userdata('__main_registration_secret_code', $secret_code);
  313. if ($this->form_validation->run() && !$this->cms_is_user_exists($user_name)) {
  314. $this->cms_do_register($user_name, $email, $real_name, $password);
  315. redirect('','refresh');
  316. } else {
  317. $data = array(
  318. "user_name" => $user_name,
  319. "email" => $email,
  320. "real_name" => $real_name,
  321. "register_caption" => $this->cms_lang('Register'),
  322. "secret_code" => $secret_code,
  323. );
  324. $this->view('main/main_register', $data, 'main_register');
  325. }
  326. }
  327. public function check_registration()
  328. {
  329. if ($this->input->is_ajax_request()) {
  330. $user_name = $this->input->post('user_name');
  331. $email = $this->input->post('email');
  332. $user_name_exists = $this->cms_is_user_exists($user_name);
  333. $email_exists = $this->cms_is_user_exists($email);
  334. $valid_email = preg_match('/@.+\./', $email);
  335. $message = "";
  336. $error = FALSE;
  337. if ($user_name == "") {
  338. $message = $this->cms_lang("Username is empty");
  339. $error = TRUE;
  340. } else if ($user_name_exists) {
  341. $message = $this->cms_lang("Username already exists");
  342. $error = TRUE;
  343. } else if (!$valid_email){
  344. $message = $this->cms_lang("Invalid email address");
  345. $error = TRUE;
  346. } else if ($email_exists){
  347. $message = $this->cms_lang("Email already used");
  348. $error = TRUE;
  349. }
  350. $data = array(
  351. "exists" => $user_name_exists || $email_exists,
  352. "error" => $error,
  353. "message" => $message
  354. );
  355. $this->cms_show_json($data);
  356. }
  357. }
  358. public function get_layout($theme=''){
  359. if($this->input->is_ajax_request()){
  360. if($theme == ''){
  361. $theme = $this->cms_get_config('site_theme');
  362. }
  363. $layout_list = array('');
  364. $this->load->helper('directory');
  365. $files = directory_map('themes/'.$theme.'/views/layouts/', 1);
  366. sort($files);
  367. foreach($files as $file){
  368. if(is_dir('themes/'.$theme.'/views/layouts/'.$file)){
  369. continue;
  370. }
  371. $file = str_ireplace('.php', '', $file);
  372. $layout_list[] = $file;
  373. }
  374. $this->cms_show_json($layout_list);
  375. }
  376. }
  377. public function check_change_profile()
  378. {
  379. if ($this->input->is_ajax_request()) {
  380. $user_name = $this->input->post('user_name');
  381. $email = $this->input->post('email');
  382. $user_name_exists = $this->cms_is_user_exists($user_name) && $user_name != $this->cms_user_name();
  383. $email_exists = $this->cms_is_user_exists($email) && $email != $this->cms_user_email();
  384. $valid_email = preg_match('/@.+\./', $email);
  385. $message = "";
  386. $error = FALSE;
  387. if ($user_name == "") {
  388. $message = $this->cms_lang("Username is empty");
  389. $error = TRUE;
  390. } else if ($user_name_exists) {
  391. $message = $this->cms_lang("Username already exists");
  392. $error = TRUE;
  393. } else if (!$valid_email){
  394. $message = $this->cms_lang("Invalid email address");
  395. $error = TRUE;
  396. } else if ($email_exists){
  397. $message = $this->cms_lang("Email already used");
  398. $error = TRUE;
  399. }
  400. $data = array(
  401. "exists" => $user_name_exists || $email_exists,
  402. "error" => $error,
  403. "message" => $message
  404. );
  405. $this->cms_show_json($data);
  406. }
  407. }
  408. public function change_profile()
  409. {
  410. $this->cms_guard_page('main_change_profile');
  411. $SQL = "SELECT user_name, email, real_name FROM ".cms_table_name('main_user')." WHERE user_id = " . $this->cms_user_id();
  412. $query = $this->db->query($SQL);
  413. $row = $query->row();
  414. //get user input
  415. $user_name = $this->input->post('user_name');
  416. $email = $this->input->post('email');
  417. $real_name = $this->input->post('real_name');
  418. $change_password = $this->input->post('change_password');
  419. $password = $this->input->post('password');
  420. $confirm_password = $this->input->post('confirm_password');
  421. if (!$change_password) {
  422. $password = NULL;
  423. }
  424. if (!$user_name)
  425. $user_name = $row->user_name;
  426. if (!$email)
  427. $email = $row->email;
  428. if (!$real_name)
  429. $real_name = $row->real_name;
  430. //set validation rule
  431. $this->form_validation->set_rules('user_name', 'User Name', 'required|xss_clean');
  432. $this->form_validation->set_rules('email', 'E mail', 'required|xss_clean|valid_email');
  433. $this->form_validation->set_rules('real_name', 'Real Name', 'required|xss_clean');
  434. $this->form_validation->set_rules('password', 'Password', 'xss_clean|matches[confirm_password]');
  435. $this->form_validation->set_rules('confirm_password', 'Password Confirmation', 'xss_clean');
  436. if ($this->form_validation->run()) {
  437. $this->cms_do_change_profile($user_name, $email, $real_name, $password);
  438. redirect('','refresh');
  439. } else {
  440. $data = array(
  441. "user_name" => $user_name,
  442. "email" => $email,
  443. "real_name" => $real_name,
  444. "change_profile_caption" => $this->cms_lang('Change Profile'),
  445. );
  446. $this->view('main/main_change_profile', $data, 'main_change_profile');
  447. }
  448. }
  449. public function logout()
  450. {
  451. $this->cms_do_logout();
  452. redirect('','refresh');
  453. }
  454. public function index()
  455. {
  456. $this->cms_guard_page('main_index');
  457. $data = array(
  458. "submenu_screen" => $this->cms_submenu_screen(NULL)
  459. );
  460. $this->view('main/main_index', $data, 'main_index');
  461. }
  462. public function management()
  463. {
  464. $this->cms_guard_page('main_management');
  465. $data = array(
  466. "submenu_screen" => $this->cms_submenu_screen('main_management')
  467. );
  468. $this->view('main/main_management', $data, 'main_management');
  469. }
  470. public function language($language = NULL)
  471. {
  472. $this->cms_guard_page('main_language');
  473. if (isset($language)) {
  474. $this->cms_language($language);
  475. redirect('','refresh');
  476. } else {
  477. $data = array(
  478. "language_list" => $this->cms_language_list()
  479. );
  480. $this->view('main/main_language', $data, 'main_language');
  481. }
  482. }
  483. // AUTHORIZATION ===========================================================
  484. public function authorization()
  485. {
  486. $crud = $this->new_crud();
  487. $crud->unset_jquery();
  488. $crud->set_table(cms_table_name('main_authorization'));
  489. $crud->set_subject('Authorization');
  490. $crud->columns('authorization_id', 'authorization_name', 'description');
  491. $crud->display_as('authorization_id', 'Code')->display_as('authorization_name', 'Name')->display_as('description', 'Description');
  492. $crud->unset_texteditor('description');
  493. $crud->set_subject('Authorization List');
  494. $crud->unset_add();
  495. $crud->unset_delete();
  496. $crud->unset_edit();
  497. $crud->required_fields('authorization_name');
  498. $crud->unique_fields('authorization_name');
  499. $crud->unset_read();
  500. $crud->set_language($this->cms_language());
  501. $output = $crud->render();
  502. $this->view('grocery_CRUD', $output);
  503. }
  504. // USER ====================================================================
  505. public function user()
  506. {
  507. $this->cms_guard_page('main_user_management');
  508. $crud = $this->new_crud();
  509. $crud->unset_jquery();
  510. $crud->set_table(cms_table_name('main_user'));
  511. $crud->set_subject($this->cms_lang('User'));
  512. $crud->required_fields('user_name','password');
  513. $crud->unique_fields('user_name');
  514. $crud->unset_read();
  515. $crud->columns('user_name', 'email', 'real_name', 'active', 'groups');
  516. $crud->edit_fields('user_name', 'email', 'real_name', 'active', 'groups');
  517. $crud->add_fields('user_name', 'email', 'password', 'real_name', 'active', 'groups');
  518. $crud->field_type('active', 'true_false');
  519. $crud->display_as('user_name', $this->cms_lang('User Name'))
  520. ->display_as('email', $this->cms_lang('Email'))
  521. ->display_as('real_name', $this->cms_lang('Real Name'))
  522. ->display_as('active', $this->cms_lang('Active'))
  523. ->display_as('groups', $this->cms_lang('Groups'));
  524. $crud->set_relation_n_n('groups', cms_table_name('main_group_user'), cms_table_name('main_group'), 'user_id', 'group_id', 'group_name');
  525. $crud->callback_before_insert(array(
  526. $this,
  527. 'before_insert_user'
  528. ));
  529. $crud->callback_before_delete(array(
  530. $this,
  531. 'before_delete_user'
  532. ));
  533. if ($crud->getState() == 'edit') {
  534. $state_info = $crud->getStateInfo();
  535. $primary_key = $state_info->primary_key;
  536. if ($primary_key == $this->cms_user_id() || $primary_key == 1) {
  537. $crud->callback_edit_field('active', array(
  538. $this,
  539. 'read_only_user_active'
  540. ));
  541. }
  542. }
  543. $crud->set_lang_string('delete_error_message', 'You cannot delete super admin user or your own account');
  544. $crud->set_language($this->cms_language());
  545. $output = $crud->render();
  546. $this->view('main/main_user', $output, 'main_user_management');
  547. }
  548. public function read_only_user_active($value, $row)
  549. {
  550. $input = '<input name="active" value="' . $value . '" type="hidden" />';
  551. $caption = $value == 0 ? 'Inactive' : 'Active';
  552. return $input . $caption;
  553. }
  554. public function before_insert_user($post_array)
  555. {
  556. $post_array['password'] = md5($post_array['password']);
  557. return $post_array;
  558. }
  559. public function before_delete_user($primary_key, $post_array)
  560. {
  561. //The super admin user cannot be deleted, a user cannot delete his/her own account
  562. if (($primary_key == 1) || ($primary_key == $this->cms_user_id())) {
  563. return false;
  564. }
  565. return $post_array;
  566. }
  567. // GROUP ===================================================================
  568. public function group()
  569. {
  570. $this->cms_guard_page('main_group_management');
  571. $crud = $this->new_crud();
  572. $crud->unset_jquery();
  573. $crud->set_table(cms_table_name('main_group'));
  574. $crud->set_subject($this->cms_lang('User Group'));
  575. $crud->required_fields('group_name');
  576. $crud->unique_fields('group_name');
  577. $crud->unset_read();
  578. $crud->columns('group_name', 'description');
  579. $crud->edit_fields('group_name', 'description', 'users', 'navigations', 'privileges');
  580. $crud->add_fields('group_name', 'description', 'users', 'navigations', 'privileges');
  581. $crud->display_as('group_name', $this->cms_lang('Group'))
  582. ->display_as('description', $this->cms_lang('Description'))
  583. ->display_as('users', $this->cms_lang('Users '))
  584. ->display_as('navigations', $this->cms_lang('Navigations'))
  585. ->display_as('privileges', $this->cms_lang('Privileges'));
  586. $crud->set_relation_n_n('users', cms_table_name('main_group_user'), cms_table_name('main_user'), 'group_id', 'user_id', 'user_name');
  587. $crud->set_relation_n_n('navigations', cms_table_name('main_group_navigation'), cms_table_name('main_navigation'), 'group_id', 'navigation_id', 'navigation_name');
  588. $crud->set_relation_n_n('privileges', cms_table_name('main_group_privilege'), cms_table_name('main_privilege'), 'group_id', 'privilege_id', 'privilege_name');
  589. $crud->callback_before_delete(array(
  590. $this,
  591. 'before_delete_group'
  592. ));
  593. $crud->unset_texteditor('description');
  594. $crud->set_lang_string('delete_error_message', $this->cms_lang('You cannot delete admin group or group which is not empty, please empty the group first'));
  595. $crud->set_language($this->cms_language());
  596. $output = $crud->render();
  597. $this->view('main/main_group', $output, 'main_group_management');
  598. }
  599. public function before_delete_group($primary_key)
  600. {
  601. $SQL = "SELECT user_id FROM ".cms_table_name('main_group_user')." WHERE group_id =" . $primary_key . ";";
  602. $query = $this->db->query($SQL);
  603. $count = $query->num_rows();
  604. /* Can only delete group with no user. Admin group cannot be deleted */
  605. if ($primary_key == 1 || $count > 0) {
  606. return false;
  607. }
  608. return $post_array;
  609. }
  610. // NAVIGATION ==============================================================
  611. public function navigation($parent_id=NULL)
  612. {
  613. $this->cms_guard_page('main_navigation_management');
  614. $crud = $this->new_crud();
  615. $crud->unset_jquery();
  616. $crud->set_table(cms_table_name('main_navigation'));
  617. $crud->set_subject($this->cms_lang('Navigation (Page)'));
  618. $crud->required_fields('navigation_name', 'title');
  619. $crud->unique_fields('navigation_name', 'title', 'url');
  620. $crud->unset_read();
  621. $crud->columns('navigation_name', 'navigation_child', 'title', 'active');
  622. $crud->edit_fields('navigation_name', 'parent_id', 'title', 'bootstrap_glyph', 'page_title', 'page_keyword', 'description', 'active', 'only_content', 'is_static', 'static_content', 'url','notif_url', 'default_theme', 'default_layout', 'authorization_id', 'groups', 'index');
  623. $crud->add_fields('navigation_name', 'parent_id', 'title', 'bootstrap_glyph', 'page_title', 'page_keyword', 'description', 'active', 'only_content', 'is_static', 'static_content', 'url','notif_url', 'default_theme', 'default_layout', 'authorization_id', 'groups', 'index');
  624. $crud->field_type('active', 'true_false');
  625. $crud->field_type('is_static', 'true_false');
  626. // get themes to give options for default_theme field
  627. $themes = $this->cms_get_theme_list();
  628. $theme_path = array();
  629. foreach ($themes as $theme) {
  630. $theme_path[] = $theme['path'];
  631. }
  632. $crud->field_type('default_theme', 'enum', $theme_path);
  633. $crud->display_as('navigation_name', $this->cms_lang('Navigation Code'))
  634. ->display_as('is_root', $this->cms_lang('Is Root'))
  635. ->display_as('navigation_child', $this->cms_lang('Children'))
  636. ->display_as('parent_id', $this->cms_lang('Parent'))
  637. ->display_as('title', $this->cms_lang('Navigation Title (What visitor see)'))
  638. ->display_as('page_title', $this->cms_lang('Page Title'))
  639. ->display_as('page_keyword', $this->cms_lang('Page Keyword (Comma Separated)'))
  640. ->display_as('description', $this->cms_lang('Description'))
  641. ->display_as('url', $this->cms_lang('URL (Where is it point to)'))
  642. ->display_as('notif_url', $this->cms_lang('Notification URL'))
  643. ->display_as('active', $this->cms_lang('Active'))
  644. ->display_as('is_static', $this->cms_lang('Static'))
  645. ->display_as('static_content', $this->cms_lang('Static Content'))
  646. ->display_as('authorization_id', $this->cms_lang('Authorization'))
  647. ->display_as('groups', $this->cms_lang('Groups'))
  648. ->display_as('only_content', $this->cms_lang('Only show content'))
  649. ->display_as('default_theme', $this->cms_lang('Default Theme'))
  650. ->display_as('default_layout', $this->cms_lang('Default Layout'));
  651. $crud->order_by('parent_id, index', 'asc');
  652. $crud->unset_texteditor('description');
  653. $crud->field_type('only_content', 'true_false');
  654. $crud->field_type('bootstrap_glyph','enum',array('glyphicon-adjust', 'glyphicon-align-center', 'glyphicon-align-justify', 'glyphicon-align-left', 'glyphicon-align-right', 'glyphicon-arrow-down', 'glyphicon-arrow-left', 'glyphicon-arrow-right', 'glyphicon-arrow-up', 'glyphicon-asterisk', 'glyphicon-backward', 'glyphicon-ban-circle', 'glyphicon-barcode', 'glyphicon-bell', 'glyphicon-bold', 'glyphicon-book', 'glyphicon-bookmark', 'glyphicon-briefcase', 'glyphicon-bullhorn', 'glyphicon-calendar', 'glyphicon-camera', 'glyphicon-certificate', 'glyphicon-check', 'glyphicon-chevron-down', 'glyphicon-chevron-left', 'glyphicon-chevron-right', 'glyphicon-chevron-up', 'glyphicon-circle-arrow-down', 'glyphicon-circle-arrow-left', 'glyphicon-circle-arrow-right', 'glyphicon-circle-arrow-up', 'glyphicon-cloud', 'glyphicon-cloud-download', 'glyphicon-cloud-upload', 'glyphicon-cog', 'glyphicon-collapse-down', 'glyphicon-collapse-up', 'glyphicon-comment', 'glyphicon-compressed', 'glyphicon-copyright-mark', 'glyphicon-credit-card', 'glyphicon-cutlery', 'glyphicon-dashboard', 'glyphicon-download', 'glyphicon-download-alt', 'glyphicon-earphone', 'glyphicon-edit', 'glyphicon-eject', 'glyphicon-envelope', 'glyphicon-euro', 'glyphicon-exclamation-sign', 'glyphicon-expand', 'glyphicon-export', 'glyphicon-eye-close', 'glyphicon-eye-open', 'glyphicon-facetime-video', 'glyphicon-fast-backward', 'glyphicon-fast-forward', 'glyphicon-file', 'glyphicon-film', 'glyphicon-filter', 'glyphicon-fire', 'glyphicon-flag', 'glyphicon-flash', 'glyphicon-floppy-disk', 'glyphicon-floppy-open', 'glyphicon-floppy-remove', 'glyphicon-floppy-save', 'glyphicon-floppy-saved', 'glyphicon-folder-close', 'glyphicon-folder-open', 'glyphicon-font', 'glyphicon-forward', 'glyphicon-fullscreen', 'glyphicon-gbp', 'glyphicon-gift', 'glyphicon-glass', 'glyphicon-globe', 'glyphicon-hand-down', 'glyphicon-hand-left', 'glyphicon-hand-right', 'glyphicon-hand-up', 'glyphicon-hd-video', 'glyphicon-hdd', 'glyphicon-header', 'glyphicon-headphones', 'glyphicon-heart', 'glyphicon-heart-empty', 'glyphicon-home', 'glyphicon-import', 'glyphicon-inbox', 'glyphicon-indent-left', 'glyphicon-indent-right', 'glyphicon-info-sign', 'glyphicon-italic', 'glyphicon-leaf', 'glyphicon-link', 'glyphicon-list', 'glyphicon-list-alt', 'glyphicon-lock', 'glyphicon-log-in', 'glyphicon-log-out', 'glyphicon-magnet', 'glyphicon-map-marker', 'glyphicon-minus', 'glyphicon-minus-sign', 'glyphicon-move', 'glyphicon-music', 'glyphicon-new-window', 'glyphicon-off', 'glyphicon-ok', 'glyphicon-ok-circle', 'glyphicon-ok-sign', 'glyphicon-open', 'glyphicon-paperclip', 'glyphicon-pause', 'glyphicon-pencil', 'glyphicon-phone', 'glyphicon-phone-alt', 'glyphicon-picture', 'glyphicon-plane', 'glyphicon-play', 'glyphicon-play-circle', 'glyphicon-plus', 'glyphicon-plus-sign', 'glyphicon-print', 'glyphicon-pushpin', 'glyphicon-qrcode', 'glyphicon-question-sign', 'glyphicon-random', 'glyphicon-record', 'glyphicon-refresh', 'glyphicon-registration-mark', 'glyphicon-remove', 'glyphicon-remove-circle', 'glyphicon-remove-sign', 'glyphicon-repeat', 'glyphicon-resize-full', 'glyphicon-resize-horizontal', 'glyphicon-resize-small', 'glyphicon-resize-vertical', 'glyphicon-retweet', 'glyphicon-road', 'glyphicon-save', 'glyphicon-saved', 'glyphicon-screenshot', 'glyphicon-sd-video', 'glyphicon-search', 'glyphicon-send', 'glyphicon-share', 'glyphicon-share-alt', 'glyphicon-shopping-cart', 'glyphicon-signal', 'glyphicon-sort', 'glyphicon-sort-by-alphabet', 'glyphicon-sort-by-alphabet-alt', 'glyphicon-sort-by-attributes', 'glyphicon-sort-by-attributes-alt', 'glyphicon-sort-by-order', 'glyphicon-sort-by-order-alt', 'glyphicon-sound-5-1', 'glyphicon-sound-6-1', 'glyphicon-sound-7-1', 'glyphicon-sound-dolby', 'glyphicon-sound-stereo', 'glyphicon-star', 'glyphicon-star-empty', 'glyphicon-stats', 'glyphicon-step-backward', 'glyphicon-step-forward', 'glyphicon-stop', 'glyphicon-subtitles', 'glyphicon-tag', 'glyphicon-tags', 'glyphicon-tasks', 'glyphicon-text-height', 'glyphicon-text-width', 'glyphicon-th', 'glyphicon-th-large', 'glyphicon-th-list', 'glyphicon-thumbs-down', 'glyphicon-thumbs-up', 'glyphicon-time', 'glyphicon-tint', 'glyphicon-tower', 'glyphicon-transfer', 'glyphicon-trash', 'glyphicon-tree-conifer', 'glyphicon-tree-deciduous', 'glyphicon-unchecked', 'glyphicon-upload', 'glyphicon-usd', 'glyphicon-user', 'glyphicon-volume-down', 'glyphicon-volume-off', 'glyphicon-volume-up', 'glyphicon-warning-sign', 'glyphicon-wrench', 'glyphicon-zoom-in', 'glyphicon-zoom-out'));
  655. $crud->field_type('index','hidden');
  656. $crud->set_relation('parent_id', cms_table_name('main_navigation'), 'navigation_name');
  657. $crud->set_relation('authorization_id', cms_table_name('main_authorization'), 'authorization_name');
  658. $crud->set_relation_n_n('groups', cms_table_name('main_group_navigation'), cms_table_name('main_group'), 'navigation_id', 'group_id', 'group_name');
  659. if(isset($parent_id) && intval($parent_id)>0){
  660. $crud->where(cms_table_name('main_navigation').'.parent_id', $parent_id);
  661. $state = $crud->getState();
  662. if($state == 'add'){
  663. $crud->field_type('parent_id', 'hidden', $parent_id);
  664. }
  665. }else{
  666. $crud->where(array(cms_table_name('main_navigation').'.parent_id' => NULL));
  667. }
  668. $crud->add_action('Move Up', base_url('modules/'.$this->cms_module_path().'/assets/action_icon/up.png'),
  669. site_url($this->cms_module_path().'/action_navigation_move_up').'/');
  670. $crud->add_action('Move Down', base_url('modules/'.$this->cms_module_path().'/assets/action_icon/down.png'),
  671. site_url($this->cms_module_path().'/action_navigation_move_down').'/');
  672. $crud->callback_column('active', array(
  673. $this,
  674. 'column_navigation_active'
  675. ));
  676. $crud->callback_column('navigation_child', array(
  677. $this,
  678. 'column_navigation_child'
  679. ));
  680. $crud->callback_before_insert(array(
  681. $this,
  682. 'before_insert_navigation'
  683. ));
  684. $crud->callback_before_delete(array(
  685. $this,
  686. 'before_delete_navigation'
  687. ));
  688. $crud->set_language($this->cms_language());
  689. $output = $crud->render();
  690. $navigation_path = array();
  691. if(isset($parent_id) && intval($parent_id)>0){
  692. $this->db->select('navigation_name')
  693. ->from(cms_table_name('main_navigation'))
  694. ->where('navigation_id', $parent_id);
  695. $query = $this->db->get();
  696. if($query->num_rows()>0){
  697. $row = $query->row();
  698. $navigation_name = $row->navigation_name;
  699. $navigation_path = $this->cms_get_navigation_path($navigation_name);
  700. }
  701. }
  702. $output->navigation_path = $navigation_path;
  703. $this->view('main/main_navigation', $output, 'main_navigation_management');
  704. }
  705. public function action_navigation_move_up($primary_key){
  706. $query = $this->db->select('navigation_name, parent_id')
  707. ->from(cms_table_name('main_navigation'))
  708. ->where('navigation_id', $primary_key)
  709. ->get();
  710. $row = $query->row();
  711. $navigation_name = $row->navigation_name;
  712. $parent_id = $row->parent_id;
  713. // move up
  714. $this->cms_do_move_up_navigation($navigation_name);
  715. // redirect
  716. if(isset($parent_id)){
  717. redirect('main/navigation/'.$parent_id.'#record_'.$primary_key,'refresh');
  718. }else{
  719. redirect('main/navigation'.'#record_'.$primary_key,'refresh');
  720. }
  721. }
  722. public function action_navigation_move_down($primary_key){
  723. $query = $this->db->select('navigation_name, parent_id')
  724. ->from(cms_table_name('main_navigation'))
  725. ->where('navigation_id', $primary_key)
  726. ->get();
  727. $row = $query->row();
  728. $navigation_name = $row->navigation_name;
  729. $parent_id = $row->parent_id;
  730. // move down
  731. $this->cms_do_move_down_navigation($navigation_name);
  732. // redirect
  733. if(isset($parent_id)){
  734. redirect('main/navigation/'.$parent_id.'#record_'.$primary_key,'refresh');
  735. }else{
  736. redirect('main/navigation'.'#record_'.$primary_key,'refresh');
  737. }
  738. }
  739. public function before_insert_navigation($post_array)
  740. {
  741. //get parent's navigation_id
  742. $query = $this->db->select('navigation_id')
  743. ->from(cms_table_name('main_navigation'))
  744. ->where('navigation_id', is_int($post_array['parent_id'])? $post_array['parent_id']: NULL)
  745. ->get();
  746. $row = $query->row();
  747. $parent_id = isset($row->navigation_id) ? $row->navigation_id : NULL;
  748. //index = max index+1
  749. $query = $this->db->select_max('index')
  750. ->from(cms_table_name('main_navigation'))
  751. ->where('parent_id', $parent_id)
  752. ->get();
  753. $row = $query->row();
  754. $index = $row->index;
  755. if (!isset($index)){
  756. $index = 1;
  757. }else{
  758. $index = $index+1;
  759. }
  760. $post_array['index'] = $index;
  761. if (!isset($post_array['authorization_id']) || $post_array['authorization_id'] == '') {
  762. $post_array['authorization_id'] = 1;
  763. }
  764. return $post_array;
  765. }
  766. public function before_delete_navigation($primary_key)
  767. {
  768. $this->db->delete(cms_table_name('main_quicklink'), array(
  769. 'navigation_id' => $primary_key
  770. ));
  771. }
  772. public function column_navigation_active($value, $row)
  773. {
  774. $html = '<a name="record_'.$row->navigation_id.'">&nbsp;</a>';
  775. $target = site_url($this->cms_module_path() . '/toggle_navigation_active/' . $row->navigation_id);
  776. if ($value == 0) {
  777. $html .= '<span target="' . $target . '" class="navigation_active">Inactive</span>';
  778. } else {
  779. $html .= '<span target="' . $target . '" class="navigation_active">Active</span>';
  780. }
  781. return $html;
  782. }
  783. public function column_navigation_child($value, $row)
  784. {
  785. $html = '';
  786. $this->db->select('navigation_id')
  787. ->from(cms_table_name('main_navigation'))
  788. ->where('parent_id', $row->navigation_id);
  789. $query = $this->db->get();
  790. $child_count = $query->num_rows();
  791. if($child_count<=0){
  792. $html .= $this->cms_lang('No Child');
  793. }else{
  794. $html .= '<a href="'.site_url($this->cms_module_path().'/navigation/'.$row->navigation_id).'">'.
  795. $this->cms_lang('Manage Children')
  796. .'</a>';
  797. }
  798. $html .= '&nbsp;|&nbsp;<a href="'.site_url($this->cms_module_path().'/navigation/'.$row->navigation_id).'/add">'.
  799. $this->cms_lang('Add Child')
  800. .'</a>';
  801. return $html;
  802. }
  803. public function toggle_navigation_active($navigation_id)
  804. {
  805. if ($this->input->is_ajax_request()) {
  806. $this->db->select('active')->from(cms_table_name('main_navigation'))->where('navigation_id', $navigation_id);
  807. $query = $this->db->get();
  808. if ($query->num_rows() > 0) {
  809. $row = $query->row();
  810. $new_value = ($row->active == 0) ? 1 : 0;
  811. $this->db->update(cms_table_name('main_navigation'), array(
  812. 'active' => $new_value
  813. ), array(
  814. 'navigation_id' => $navigation_id
  815. ));
  816. $this->cms_show_json(array(
  817. 'success' => true
  818. ));
  819. } else {
  820. $this->cms_show_json(array(
  821. 'success' => false
  822. ));
  823. }
  824. }
  825. }
  826. // QUICKLINK ===============================================================
  827. public function quicklink()
  828. {
  829. $this->cms_guard_page('main_quicklink_management');
  830. $crud = $this->new_crud();
  831. $crud->unset_jquery();
  832. $crud->set_table(cms_table_name('main_quicklink'));
  833. $crud->set_subject($this->cms_lang('Quick Link'));
  834. $crud->required_fields('navigation_id');
  835. $crud->unique_fields('navigation_id');
  836. $crud->unset_read();
  837. $crud->columns('navigation_id');
  838. $crud->edit_fields('navigation_id', 'index');
  839. $crud->add_fields('navigation_id', 'index');
  840. $crud->display_as('navigation_id', $this->cms_lang('Navigation Code'));
  841. $crud->order_by('index', 'asc');
  842. $crud->set_relation('navigation_id', cms_table_name('main_navigation'), 'navigation_name');
  843. $crud->field_type('index','hidden');
  844. $crud->callback_before_insert(array(
  845. $this,
  846. 'before_insert_quicklink'
  847. ));
  848. $crud->add_action('Move Up', base_url('modules/'.$this->cms_module_path().'/assets/action_icon/up.png'),
  849. site_url($this->cms_module_path().'/action_quicklink_move_up').'/');
  850. $crud->add_action('Move Down', base_url('modules/'.$this->cms_module_path().'/assets/action_icon/down.png'),
  851. site_url($this->cms_module_path().'/action_quicklink_move_down').'/');
  852. $crud->callback_column($this->unique_field_name('navigation_id'), array(
  853. $this,
  854. 'column_quicklink_navigation_id'
  855. ));
  856. $crud->set_language($this->cms_language());
  857. $output = $crud->render();
  858. $this->view('grocery_CRUD', $output, 'main_quicklink_management');
  859. }
  860. public function before_insert_quicklink($post_array)
  861. {
  862. $query = $this->db->select_max('index')
  863. ->from(cms_table_name('main_quicklink'))
  864. ->get();
  865. $row = $query->row();
  866. $index = $row->index;
  867. if (!isset($index)){
  868. $index = 1;
  869. }else{
  870. $index = $index+1;
  871. }
  872. $post_array['index'] = $index;
  873. return $post_array;
  874. }
  875. public function column_quicklink_navigation_id($value, $row)
  876. {
  877. $html = '<a name="record_'.$row->quicklink_id.'">&nbsp;</a>';
  878. $html .= $value;
  879. return $html;
  880. }
  881. public function action_quicklink_move_up($primary_key){
  882. $query = $this->db->select('navigation_id')
  883. ->from(cms_table_name('main_quicklink'))
  884. ->where('quicklink_id', $primary_key)
  885. ->get();
  886. $row = $query->row();
  887. $navigation_id = $row->navigation_id;
  888. // move up
  889. $this->cms_do_move_up_quicklink($navigation_id);
  890. // redirect
  891. redirect('main/quicklink'.'#record_'.$primary_key,'refresh');
  892. }
  893. public function action_quicklink_move_down($primary_key){
  894. $query = $this->db->select('navigation_id')
  895. ->from(cms_table_name('main_quicklink'))
  896. ->where('quicklink_id', $primary_key)
  897. ->get();
  898. $row = $query->row();
  899. $navigation_id = $row->navigation_id;
  900. // move up
  901. $this->cms_do_move_down_quicklink($navigation_id);
  902. // redirect
  903. redirect('main/quicklink'.'#record_'.$primary_key,'refresh');
  904. }
  905. // PRIVILEGE ===============================================================
  906. public function privilege()
  907. {
  908. $this->cms_guard_page('main_privilege_management');
  909. $crud = $this->new_crud();
  910. $crud->unset_jquery();
  911. $crud->set_table(cms_table_name('main_privilege'));
  912. $crud->set_subject($this->cms_lang('Privilege'));
  913. $crud->required_fields('privilege_name');
  914. $crud->unique_fields('privilege_name');
  915. $crud->unset_read();
  916. $crud->columns('privilege_name','title','description');
  917. $crud->edit_fields('privilege_name','title','description','authorization_id','groups');
  918. $crud->add_fields('privilege_name','title','description','authorization_id','groups');
  919. $crud->set_relation('authorization_id', cms_table_name('main_authorization'), 'authorization_name'); //, 'groups');
  920. $crud->set_relation_n_n('groups', cms_table_name('main_group_privilege'), cms_table_name('main_group'), 'privilege_id', 'group_id', 'group_name');
  921. $crud->display_as('authorization_id', $this->cms_lang('Authorization'))
  922. ->display_as('groups', $this->cms_lang('Groups'))
  923. ->display_as('privilege_name', $this->cms_lang('Privilege Code'))
  924. ->display_as('title', $this->cms_lang('Title'))
  925. ->display_as('description', $this->cms_lang('Description'));
  926. $crud->unset_texteditor('description');
  927. $crud->set_language($this->cms_language());
  928. $output = $crud->render();
  929. $this->view('main/main_privilege', $output, 'main_privilege_management');
  930. }
  931. // WIDGET ==================================================================
  932. public function widget()
  933. {
  934. $this->cms_guard_page('main_widget_management');
  935. $crud = $this->new_crud();
  936. $crud->unset_jquery();
  937. $crud->set_table(cms_table_name('main_widget'));
  938. $crud->set_subject($this->cms_lang('Widget'));
  939. $crud->required_fields('widget_name');
  940. $crud->unique_fields('widget_name');
  941. $crud->unset_read();
  942. $crud->columns('widget_name', 'title', 'active', 'slug');
  943. $crud->edit_fields('widget_name', 'title', 'active', 'description', 'is_static', 'static_content', 'url', 'slug', 'authorization_id', 'groups', 'index');
  944. $crud->add_fields('widget_name', 'title', 'active', 'description', 'is_static', 'static_content', 'url', 'slug', 'authorization_id', 'groups', 'index');
  945. $crud->field_type('active', 'true_false');
  946. $crud->field_type('is_static', 'true_false');
  947. $crud->field_type('index', 'hidden');
  948. $crud->display_as('widget_name', $this->cms_lang('Widget Code'))
  949. ->display_as('title', $this->cms_lang('Title (What visitor see)'))
  950. ->display_as('active', $this->cms_lang('Active'))
  951. ->display_as('description', $this->cms_lang('Description'))
  952. ->display_as('url', $this->cms_lang('URL (Where is it point to)'))
  953. ->display_as('index', $this->cms_lang('Order'))
  954. ->display_as('is_static', $this->cms_lang('Static'))
  955. ->display_as('static_content', $this->cms_lang('Static Content'))
  956. ->display_as('slug', $this->cms_lang('Slug'))
  957. ->display_as('authorization_id', $this->cms_lang('Authorization'))
  958. ->display_as('groups', $this->cms_lang('Groups'));
  959. $crud->order_by('index, slug', 'asc');
  960. $crud->unset_texteditor('static_content');
  961. $crud->unset_texteditor('description');
  962. $crud->set_relation('authorization_id', cms_table_name('main_authorization'), 'authorization_name');
  963. $crud->set_relation_n_n('groups', cms_table_name('main_group_widget'), cms_table_name('main_group'), 'widget_id', 'group_id', 'group_name');
  964. $crud->callback_before_insert(array(
  965. $this,
  966. 'before_insert_widget'
  967. ));
  968. $crud->add_action('Move Up', base_url('modules/'.$this->cms_module_path().'/assets/action_icon/up.png'),
  969. site_url($this->cms_module_path().'/action_widget_move_up').'/');
  970. $crud->add_action('Move Down', base_url('modules/'.$this->cms_module_path().'/assets/action_icon/down.png'),
  971. site_url($this->cms_module_path().'/action_widget_move_down').'/');
  972. $crud->callback_column('active', array(
  973. $this,
  974. 'colum…

Large files files are truncated, but you can click here to view the full file