* adjust js.

This commit is contained in:
wangyidong
2023-03-13 16:30:43 +08:00
parent 638332db13
commit c448943cd2
2 changed files with 35 additions and 34 deletions
+34 -34
View File
@@ -537,6 +537,40 @@ class group extends control
$this->display();
}
/**
* Sort priv packages.
*
* @param int $parentID
* @param string $type
* @access public
* @return void
*/
public function sortPrivPackages($parentID = 0, $type = '')
{
$orders = $_POST['orders'];
if(empty($orders)) return false;
if($type == 'view')
{
$orders = str_replace('View,', ',', $orders);
$orders = trim($orders, ',');
$this->loadModel('setting')->setItem("system.priv.views", $orders);
}
if($type == 'module')
{
$orders = trim($orders, ',');
$parentID = rtrim($parentID, 'View');
$this->loadModel('setting')->setItem("system.priv.{$parentID}Modules", $orders);
}
if($type == 'package')
{
$orders = explode(',', $orders);
foreach($orders as $index => $id)
{
if(!empty($id)) $this->dao->update(TABLE_PRIVPACKAGE)->set('order')->eq(($index + 1) * 5)->where('id')->eq($id)->exec();
}
}
}
/**
* Delete a priv package.
*
@@ -669,40 +703,6 @@ class group extends control
return print($tree);
}
/**
* Sort priv packages.
*
* @param int $parentID
* @param string $type
* @access public
* @return void
*/
public function sortPrivPackages($parentID = 0, $type = '')
{
$orders = $_POST['orders'];
if(empty($orders)) return false;
if($type == 'view')
{
$orders = str_replace('View,', ',', $orders);
$orders = trim($orders, ',');
$this->loadModel('setting')->setItem("system.priv.views", $orders);
}
if($type == 'module')
{
$orders = trim($orders, ',');
$parentID = rtrim($parentID, 'View');
$this->loadModel('setting')->setItem("system.priv.{$parentID}Modules", $orders);
}
if($type == 'package')
{
$orders = explode(',', $orders);
foreach($orders as $index => $id)
{
if(!empty($id)) $this->dao->update(TABLE_PRIVPACKAGE)->set('order')->eq(($index + 1) * 5)->where('id')->eq($id)->exec();
}
}
}
/**
* edit priv
*