|
@@ -4,7 +4,6 @@ use Manage\Lib\Page;
|
|
|
|
|
|
class Data extends Page
|
|
|
{
|
|
|
- private $recycler = false;
|
|
|
private $expand = false;
|
|
|
public function __construct($load = '')
|
|
|
{
|
|
@@ -44,6 +43,14 @@ class Data extends Page
|
|
|
if ($ids) {
|
|
|
$where['id'] = array('in', $ids);
|
|
|
}
|
|
|
+ $set['num'] = Dever::input('pgnum', '', '', 10);
|
|
|
+ $order_col = Dever::input('order_col');
|
|
|
+ if ($order_col) {
|
|
|
+ $order_value = Dever::input('order_value');
|
|
|
+ if ($order_value) {
|
|
|
+ $set['order'] = $order_col . ' ' . $order_value . ', id desc';
|
|
|
+ }
|
|
|
+ }
|
|
|
if (isset($this->config['data'])) {
|
|
|
$result = Dever::call($this->config['data'], array($where, $set));
|
|
|
$data = array_merge($data, $result);
|
|
@@ -67,14 +74,6 @@ class Data extends Page
|
|
|
|
|
|
private function data($where, $set = array())
|
|
|
{
|
|
|
- $set['num'] = Dever::input('pgnum', '', '', 10);
|
|
|
- $order_col = Dever::input('order_col');
|
|
|
- if ($order_col) {
|
|
|
- $order_value = Dever::input('order_value');
|
|
|
- if ($order_value) {
|
|
|
- $set['order'] = $order_col . ' ' . $order_value . ', id desc';
|
|
|
- }
|
|
|
- }
|
|
|
if (isset($this->config['tree'])) {
|
|
|
return $this->db->tree($where, $this->config['tree'], array($this, 'handleData'));
|
|
|
}
|
|
@@ -221,134 +220,4 @@ class Data extends Page
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- private function button($key = 'button', $data = array())
|
|
|
- {
|
|
|
- $result = array();
|
|
|
- if (!isset($this->config[$key])) {
|
|
|
- $num = 0;
|
|
|
- if (isset($this->db->config['manage']['update']['field'])) {
|
|
|
- $num = count($this->db->config['manage']['update']['field']);
|
|
|
- } elseif (isset($this->db->config['struct']) && $this->db->config['struct']) {
|
|
|
- $num = count($this->db->config['struct']);
|
|
|
- }
|
|
|
- $fast = 'fast';
|
|
|
- if ($num > 8) {
|
|
|
- $fast = '';
|
|
|
- }
|
|
|
- if ($key == 'button') {
|
|
|
- $this->config[$key] = array('新增' => $fast . 'add');
|
|
|
- } else {
|
|
|
- $this->config[$key] = array('编辑' => $fast . 'edit', '删除' => 'recycle');
|
|
|
- }
|
|
|
- }
|
|
|
- $sort = 1;
|
|
|
- foreach ($this->config[$key] as $k => $v) {
|
|
|
- $d = '';
|
|
|
- $p = '';
|
|
|
- $i = '';
|
|
|
- if (is_array($v)) {
|
|
|
- if (isset($v[3]) && $data) {
|
|
|
- $d = $v[3];
|
|
|
- parse_str($d, $t);
|
|
|
- $state = true;
|
|
|
- foreach ($t as $k1 => $v1) {
|
|
|
- if (!isset($data[$k1]) || (isset($data[$k1]) && $data[$k1] != $v1)) {
|
|
|
- $state = false;
|
|
|
- }
|
|
|
- }
|
|
|
- if (!$state) {
|
|
|
- continue;
|
|
|
- }
|
|
|
- }
|
|
|
- if (isset($v[2])) {
|
|
|
- $i = $v[2];
|
|
|
- }
|
|
|
- if (isset($v[1])) {
|
|
|
- $p = $v[1];
|
|
|
- }
|
|
|
- $v = $v[0];
|
|
|
- }
|
|
|
- if (strstr($v, 'add')) {
|
|
|
- $icon = 'Plus';
|
|
|
- $button = 'primary';
|
|
|
- } elseif (strstr($v, 'edit')) {
|
|
|
- $icon = 'Edit';
|
|
|
- $button = 'primary';
|
|
|
- } elseif (strstr($v, 'view')) {
|
|
|
- $icon = 'View';
|
|
|
- $button = '';
|
|
|
- } elseif ($v == 'delete') {
|
|
|
- if ($key == 'button') {
|
|
|
- if (isset($this->config['layout'])) {
|
|
|
- continue;
|
|
|
- }
|
|
|
- $this->config['selection'] = true;
|
|
|
- }
|
|
|
- $icon = 'Delete';
|
|
|
- $button = 'danger';
|
|
|
- } elseif ($v == 'recycle') {
|
|
|
- if ($key == 'button') {
|
|
|
- if (isset($this->config['layout'])) {
|
|
|
- continue;
|
|
|
- }
|
|
|
- $this->config['selection'] = true;
|
|
|
- }
|
|
|
- $icon = 'Delete';
|
|
|
- $button = 'danger';
|
|
|
- } elseif ($v == 'oper') {
|
|
|
- if ($key == 'button') {
|
|
|
- if (isset($this->config['layout'])) {
|
|
|
- continue;
|
|
|
- }
|
|
|
- $this->config['selection'] = true;
|
|
|
- }
|
|
|
- $icon = 'Notification';
|
|
|
- $button = 'warning';
|
|
|
- } elseif ($v == 'api') {
|
|
|
- if ($key == 'button') {
|
|
|
- if (isset($this->config['layout'])) {
|
|
|
- continue;
|
|
|
- }
|
|
|
- $this->config['selection'] = true;
|
|
|
- }
|
|
|
- $p = Dever::url($p);
|
|
|
- $icon = 'Notification';
|
|
|
- $button = 'warning';
|
|
|
- } elseif ($v == 'link') {
|
|
|
- $icon = 'Link';
|
|
|
- $button = 'success';
|
|
|
- } elseif ($v == 'route') {
|
|
|
- $icon = 'Link';
|
|
|
- $button = 'success';
|
|
|
- } elseif ($v == 'recover') {
|
|
|
- $icon = 'CirclePlus';
|
|
|
- $button = 'info';
|
|
|
- } else {
|
|
|
- continue;
|
|
|
- }
|
|
|
-
|
|
|
- $sort++;
|
|
|
- $func = $this->getFunc($v, $k, $sort, $p);
|
|
|
- if ($this->menu && $this->menu['show'] == 1 && !$func) {
|
|
|
- continue;
|
|
|
- }
|
|
|
- if ($i) {
|
|
|
- $icon = $i;
|
|
|
- }
|
|
|
- $result[] = array
|
|
|
- (
|
|
|
- 'name' => $k,
|
|
|
- 'type' => $v,
|
|
|
- 'param' => $p,
|
|
|
- 'icon' => $icon,
|
|
|
- 'button' => $button,
|
|
|
- 'func' => $func,
|
|
|
- );
|
|
|
- if (!$this->recycler && $v == 'recycle') {
|
|
|
- $this->recycler = true;
|
|
|
- }
|
|
|
- }
|
|
|
- return $result;
|
|
|
- }
|
|
|
}
|