ConfigController.class.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <?php
  2. /**
  3. * 播播资源
  4. *
  5. * ==========================================================================
  6. * @link https://www.ttbobo.com/
  7. * @copyright Copyright (c) 2015 liofis.com.
  8. * @license https://www.ttbobo.com/license.html License
  9. * ==========================================================================
  10. *
  11. * @author fish
  12. *
  13. */
  14. namespace Admin\Controller;
  15. use Admin\Model\ConfigModel;
  16. class ConfigController extends CommonController{
  17. protected function _initialize(){
  18. parent::_initialize();
  19. $this->breadcrumb1='系统';
  20. $this->breadcrumb2='配置管理';
  21. }
  22. public function index(){
  23. $model=new ConfigModel();
  24. $filter=I('get.');
  25. $search=array();
  26. if(isset($filter['name'])){
  27. $search['name']=$filter['name'];
  28. }
  29. if(isset($filter['config_group'])){
  30. $search['config_group']=$filter['config_group'];
  31. $this->get_group=$filter['config_group'];
  32. }
  33. $data=$model->show_config_page($search);
  34. $this->assign('empty',$data['empty']);// 赋值数据集
  35. $this->assign('list',$data['list']);// 赋值数据集
  36. $this->assign('page',$data['page']);// 赋值分页输出
  37. $this->display();
  38. }
  39. function add(){
  40. if(IS_POST){
  41. $model=new ConfigModel();
  42. $data=I('post.');
  43. $return=$model->add_config($data);
  44. $this->osc_alert($return);
  45. }
  46. $this->crumbs='新增';
  47. $this->action=U('Config/add');
  48. $this->display('edit');
  49. }
  50. function edit(){
  51. if(IS_POST){
  52. $model=new ConfigModel();
  53. $data=I('post.');
  54. $return=$model->edit_config($data);
  55. $this->osc_alert($return);
  56. }
  57. $this->crumbs='编辑';
  58. $this->action=U('Config/edit');
  59. $this->c=M('Config')->where(array('id'=>I('id')))->find();
  60. $this->display();
  61. }
  62. public function del(){
  63. $r=M('Config')->delete(I('id'));
  64. if($r){
  65. $this->redirect('Config/index');
  66. }
  67. }
  68. }
  69. ?>