source: extensions/AdditionalPages/admin/config.inc.php @ 9272

Last change on this file since 9272 was 9272, checked in by patdenice, 10 years ago

New functionalities

File size: 2.1 KB
Line 
1<?php
2
3if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
4
5$mb_conf = @unserialize($conf['blk_menubar']);
6
7// Enregistrement de la configuration
8if (isset($_POST['submit']))
9{
10  $params = array('show_home', 'group_perm', 'user_perm');
11
12  foreach ($params as $param)
13  {
14    $conf['additional_pages'][$param] = isset($_POST[$param]);
15  }
16
17  $conf['additional_pages']['languages'] = array();
18        foreach($_POST['menu_lang'] as $language_code => $name)
19  {
20                if (!empty($name))
21      $conf['additional_pages']['languages'][$language_code] = $name;
22        }
23
24  conf_update_param('additional_pages', pwg_db_real_escape_string(serialize($conf['additional_pages'])));
25
26  if (isset($_POST['show_menu']) xor (!isset($mb_conf['mbAdditionalPages']) or $mb_conf['mbAdditionalPages'] == abs($mb_conf['mbAdditionalPages'])))
27  {
28    if (!isset($mb_conf['mbAdditionalPages']))
29    {
30      $last = @abs(end($mb_conf));
31      $mb_conf['mbAdditionalPages'] = $last + 50;
32    }
33    $mb_conf['mbAdditionalPages'] = (isset($_POST['show_menu']) ? +1 : -1) * abs($mb_conf['mbAdditionalPages']);
34    conf_update_param('blk_menubar', pwg_db_real_escape_string(serialize($mb_conf)));
35  }
36
37  array_push($page['infos'], l10n('ap_conf_saved'));
38}
39
40// Gestion des langues pour le bloc menu
41$template->assign('LANG_DEFAULT_VALUE', @$conf['additional_pages']['languages']['default']);
42foreach (get_languages() as $language_code => $language_name)
43{
44        $template->append('language', array(
45    'LANGUAGE_NAME' => $language_name,
46    'LANGUAGE_CODE' => $language_code,
47    'VALUE' => isset($conf['additional_pages']['languages'][$language_code]) ? $conf['additional_pages']['languages'][$language_code] : '',
48    )
49  );
50}
51
52// Parametrage du template
53$template->assign('ap_conf', $conf['additional_pages']);
54
55if (!isset($mb_conf['mbAdditionalPages']) or $mb_conf['mbAdditionalPages'] == abs($mb_conf['mbAdditionalPages']))
56{
57  $template->assign('SHOW_MENU', true);
58}
59
60$template->set_filenames(array('plugin_admin_content' => dirname(__FILE__) . '/template/config.tpl'));
61$template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
62
63?>
Note: See TracBrowser for help on using the repository browser.