Recycler.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php namespace Manage\Lib;
  2. use Dever;
  3. class Recycler extends Auth
  4. {
  5. # 获取后台展示需要的数据
  6. public function getData($where)
  7. {
  8. if (empty($where['table'])) {
  9. Dever::error('参数错误');
  10. }
  11. $data['head'] = $data['body'] = array();
  12. $page = new Page('list', $where['table']);
  13. $data['title'] = $page->getTitle() . '【回收站】';
  14. $data['field'] = $page->setting('field', $data['head']);
  15. $set['num'] = Dever::input('pgnum', '', '', 10);
  16. list($db, $menu) = Dever::load('common', 'manage')->db($where['table']);
  17. $recycler = Dever::db('recycler', 'manage')->select(array('table' => $db->config['load']), $set);
  18. foreach ($recycler as $k => $v) {
  19. $content = Dever::json_decode($v['content']);
  20. foreach ($content as $key => $value) {
  21. $content[$key] = $page->getValue($key, $value, $content);
  22. }
  23. $content['id'] = $v['id'];
  24. $data['body'][] = $content;
  25. }
  26. if ($data['head']) {
  27. $head = array();
  28. foreach ($data['head'] as $k => $v) {
  29. if ($v['type'] == 'show') {
  30. $head[] = $v;
  31. }
  32. }
  33. $data['head'] = $head;
  34. }
  35. return $data;
  36. }
  37. }