Files
AtomicOld/simpla/ServicesMenuAdmin.php

41 lines
1.4 KiB
PHP
Raw Normal View History

2026-02-14 19:34:54 +03:00
<?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');
}
}