| Server IP : 162.214.74.102 / Your IP : 216.73.217.80 Web Server : Apache System : Linux dedi-4363141.lrsys.com.br 3.10.0-1160.119.1.el7.tuxcare.els25.x86_64 #1 SMP Wed Oct 1 17:37:27 UTC 2025 x86_64 User : lrsys ( 1015) PHP Version : 5.6.40 Disable Function : exec,passthru,shell_exec,system MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/lrsys/public_html/lrsys_apps/imobles/application/controllers/ |
Upload File : |
<?php
_auth();
$ui->assign('_application_menu', 'settings');
$ui->assign('_title', $_L['Horizontal Menus'] . ' - ' . $config['CompanyName']);
$ui->assign('_st', $_L['Horizontal Menus']);
$ui->assign('content_inner', inner_contents($config['c_cache']));
$action = $routes['1'];
$user = User::_info();
$ui->assign('user', $user);
switch ($action) {
case 'list':
$menus = ORM::for_table('sys_horizontal_menus')->order_by_asc('sorder')->find_many();
$ui->assign('menus', $menus);
$ui->assign('xfooter', Asset::js(array('horizontal_menus')));
//seta o idioma para o js
$ui->assign('jsvar', '
_L[\'are_you_sure\'] = \'' . $_L['are_you_sure'] . '\';
_L[\'Int Value\'] = \'' . $_L['Int Value'] . '\';
_L[\'Save\'] = \'' . $_L['Save'] . '\';
_L[\'Yes\'] = \'' . $_L['Yes'] . '\';
_L[\'No\'] = \'' . $_L['No'] . '\';
');
$ui->display('list-horizontal-menus.tpl');
break;
case 'add-post':
//recebe o nome do segmento para adicionar no banco de dados
$msg = "";
$title = _post('title');
$alias = _post('alias');
$url = _post('url');
$icon_class = _post('icon_class');
if (trim($title) == '') {
$msg = $_L['Title'] . $_L['is required'];
}
if (trim($alias) == '') {
$msg = 'Alias ' . $_L['is required'];
}
if ($msg == '') {
//check same group already exist
$c = ORM::for_table('sys_horizontal_menus')->where('alias', $alias)->find_one();
if ($c) {
ib_die($_L['Horizontal menu already exist']);
}
$d = ORM::for_table('sys_horizontal_menus')->create();
$d->title = $title;
$d->alias = $alias;
$d->icon_class = $icon_class;
$d->url = $url;
$d->sorder = 0;
$d->save();
if(isset($routes['2'])&& $routes['2']=='no-msg'){
//VALIDAÇÃO PARA EXIBIR OU NAO MENSAGEM AO SALVAR
}else{
_notify($_L['Add Successfull'],'s');
}
echo $d->id();
} else {
echo $msg;
}
break;
case 'edit-post':
$id = _post('id');
$title = _post('title');
$alias = _post('alias');
$url = _post('url');
$icon_class = _post('icon_class');
$msg = "";
if ($title == '') {
$msg = $_L['Title'] . $_L['is required'];
}
if ($alias == '') {
$msg = 'Alias ' . $_L['is required'];
}
if ($msg == '') {
$d = ORM::for_table('sys_horizontal_menus')->find_one($id);
if ($d) {
$d->title = $title;
$d->alias = $alias;
$d->url = $url;
$d->icon_class = $icon_class;
$d->save();
_notify($_L['Edited Successfull'],'s');
echo $d->id;
} else {
echo $_L['Not found'];
}
} else {
echo $msg;
}
break;
///listagem ajax
case 'ajax-list':
//recebe o parametro do estado
$segment = ORM::for_table('sys_items_unit')->order_by_asc('sorder')->find_many();
foreach ($segment as $s) {
$data[] = array(
'id' => $s->id,
'title' => $s->title,
'alias' => $s->alias,
'icon_class' => $s->icon_class
);
}
echo json_encode($data);
break;
case 'delete':
$id = intval($routes[2]);
$d = ORM::for_table('sys_horizontal_menus')->find_one($id);
if ($d) {
$d->delete();
r2(U . 'horizontal_menus/list/', 's', $_L['Unit Deleted Successfully']);
} else {
echo $_L['Not found'];
}
break;
case 'plugins':
$id = filter_var($routes['2'], FILTER_SANITIZE_NUMBER_INT);
$horizontal_menu = ORM::for_table('sys_horizontal_menus')->find_one($id);
if(!$horizontal_menu) {
r2(U.'horizontal_menus/list', 'e', $_L['Invalid Menu']);
}
$ui->assign('horizontal_menu', $horizontal_menu);
$plugins = ORM::for_table('sys_permissions')
->order_by_asc('pname')
->find_many();
$ui->assign('plugins', $plugins);
$ui->assign('_st', $_L['Relate Plugins']);
$ui->assign('xfooter', Asset::js(array('horizontal_menus')));
//seta o idioma para o js
$ui->assign('jsvar', '
_L[\'are_you_sure\'] = \'' . $_L['are_you_sure'] . '\';
_L[\'Int Value\'] = \'' . $_L['Int Value'] . '\';
_L[\'Save\'] = \'' . $_L['Save'] . '\';
_L[\'Yes\'] = \'' . $_L['Yes'] . '\';
_L[\'No\'] = \'' . $_L['No'] . '\';
');
$ui->display('horizontal-menus-plugins.tpl');
break;
case 'plugins-post':
$id_horizontal_menu = filter_var(_post('id_horizontal_menu'), FILTER_SANITIZE_NUMBER_INT);
$id_plugin= isset($_POST['id_plugin']) ? $_POST['id_plugin'] : [];
$horizontal_menu = ORM::for_table('sys_horizontal_menus')->find_one($id_horizontal_menu);
if(!$horizontal_menu) {
r2(U.'horizontal_menus/list', 'e', $_L['Invalid Menu']);
}
$data = array();
$data[0] = array_values($id_plugin);
$plugins = ORM::for_table('sys_permissions')
->select('shortname')
->where_in('id', $data[0])
->find_array();
if($plugins) {
$tmp = array();
foreach($plugins as $pl) {
$tmp[] = $pl['shortname'];
}
$data[1] = $tmp;
}
else {
$data[1] = [];
}
$horizontal_menu->related_plugins = json_encode($data, JSON_OBJECT_AS_ARRAY);
$horizontal_menu->save();
r2(U.'horizontal_menus/list', 's', $_L['added_successful']);
break;
default:
echo 'action not defined';
}