Viewing file: module.php (4.57 KB) -rwxrwxrwx Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?
class Options
{
var $UserMode = false;
var $AdminMode = true;
var $AdminAsynchMode = true;
var $SearchMode = false;
var $PanelMode = true;
var $Table;
var $Directory;
var $ClassName = 'Options';
function Options()
{
$this->Directory = dirname(__FILE__);
}
function User()
{
}
function Menu()
{
global $ALANG;
if (isset($_GET['mod']) && ($_GET['mod'] == $this->ClassName))
{
return array(
array('title' => $ALANG['OptionsMenuModules'], 'link' => '?mod='.$this->ClassName.'&modules'),
array('title' => $ALANG['OptionsMenuGlobal'], 'link' => '?mod='.$this->ClassName.'&global'),
array('title' => $ALANG['OptionsMenuPanels'], 'link' => '?mod='.$this->ClassName.'&panels'),
);
} else
return "";
}
function AdminAsynch()
{
foreach($_POST as $key => $value)
{
$fields = explode('&', $_POST[$key]);
$order = 0;
$fields = array_reverse($fields);
$ids = array();
$order = 0;
foreach($fields as $field)
{
$order++;
$field_key_value = explode('=', $field);
$level = urldecode($field_key_value[0]);
$id = urldecode($field_key_value[1]);
$ids[] .= $id;
}
var_dump($ids);
$ids = array_reverse($ids);
SetParam("Panel-".$key, serialize($ids), "all");
}
die;
}
function Admin()
{
global $ALANG, $alang, $_LANG_ID, $Modules;
$smarty = GetAdminSmarty($this->ClassName);
$smarty->template_dir = "user/templates/options";
if (isset($_GET['global']))
{
if (isset($_POST['save']))
{
foreach($_POST['Params'] as $key => $value)
{
if (isset($value['all']))
{
if (!is_array($value['all']))
SetParam($key, $value['all'], 'all');
else
SetParam($key, serialize($value['all']), 'all');
}
foreach($_LANG_ID as $lang)
{
if (isset($value[$lang]))
{
if (!is_array($value['all']))
SetParam($key, $value[$lang], $lang);
else
SetParam($key, serialize($value[$lang]), $lang);
}
}
}
}
$smarty->assign("oper", "save");
$result['Title'] = $ALANG['OptionsGlobal'];
$result['Content'] = $smarty->fetch('global.tpl');
return $result;
}
if (isset($_GET['modules']))
{
if (isset($_POST['save']))
{
foreach($_POST['Params'] as $key => $value)
{
if (isset($value['all']))
{
if (!is_array($value['all']))
SetParam($key, $value['all'], 'all');
else
SetParam($key, serialize($value['all']), 'all');
}
foreach($_LANG_ID as $lang)
{
if (isset($value[$lang]))
{
if (!is_array($value['all']))
SetParam($key, $value[$lang], $lang);
else
SetParam($key, serialize($value[$lang]), $lang);
}
}
}
}
$smarty->assign("oper", "save");
$result['Title'] = $ALANG['OptionsModules'];
$result['Content'] = $smarty->fetch('modules.tpl');
return $result;
}
if (isset($_GET['panels']))
{
$panels = array();
$nouse = array();
$cl = unserialize(GetParam("Panel-left", "all"));
$cr = unserialize(GetParam("Panel-right", "all"));
$cc = unserialize(GetParam("Panel-center", "all"));
$cn = unserialize(GetParam("Panel-nouse", "all"));
foreach($Modules as $mod)
if ($mod->PanelMode)
{
$res = $mod->Panel();
if ($res)
foreach($res as $k => $pan)
{
$panels [$k]= $pan;
if (!in_array($k, $cl) && !in_array($k, $cr) && !in_array($k, $cc))
$nouse [$k]= $pan;
}
}
$smarty->assign('panels', $panels);
$smarty->assign('nouse', $nouse);
$result['Title'] = $ALANG['OptionsPanels'];
$result['Content'] = $smarty->fetch('panels.tpl');
return $result;
}
if (isset($_GET['GlobalParams']))
{
$smarty->assign('oper', 'OptionsEdit');
$result['Title'] = $ALANG['OptionsGlobalParams'];
$result['Content'] = $smarty->fetch('globalparams.tpl');
return $result;
}
}
function Panel()
{
global $ULANG, $ulang;
/* $result['address_rus'] = array('panelName' => "",
'panelHtml' => GetParam('address_'.$language));
if (GetParam('custom_panel1') == 'on')
$result['custom_panel1'] = array('panelName' => GetParam('custom_panel1_name_'.$language),
'panelHtml' => GetParam('custom_panel1_'.$language));*/
return $result;
}
}
$Modules [] = new Options();
?>
|