Init
This commit is contained in:
41
simpla/ServicesMenuAdmin.php
Normal file
41
simpla/ServicesMenuAdmin.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
require_once('api/Simpla.php');
|
||||
|
||||
class ServicesMenuAdmin extends Simpla
|
||||
{
|
||||
function fetch()
|
||||
{
|
||||
if ($this->request->method('post')) {
|
||||
|
||||
$ids = $this->request->post('check');
|
||||
if (is_array($ids)) {
|
||||
// Действия с выбранными
|
||||
switch ($this->request->post('action')) {
|
||||
case 'disable':
|
||||
foreach ($ids as $id)
|
||||
$this->services->set_visible($id, 0);
|
||||
break;
|
||||
case 'enable':
|
||||
foreach ($ids as $id)
|
||||
$this->services->set_visible($id,1);
|
||||
break;
|
||||
case 'delete':
|
||||
$this->services->delete($ids, true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Сортировка
|
||||
$positions = $this->request->post('positions');
|
||||
$ids = array_keys($positions);
|
||||
sort($positions);
|
||||
foreach ($positions as $i => $position)
|
||||
$this->services->update($ids[$i], array('position' => $position));
|
||||
}
|
||||
|
||||
$this->design->assign('services', $this->services->get_tree());
|
||||
$this->design->assign('root_url', $this->services->get_root_url());
|
||||
|
||||
return $this->design->fetch('services_menu.tpl');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user