source: extensions/ContactForm/config.php @ 3748

Last change on this file since 3748 was 3748, checked in by Criss, 15 years ago

Add configuration option to define template variable or not

File size: 2.1 KB
Line 
1<?php
2/* $Id: config.php,v 1.2 2009/08/18 14:10:09 Criss Exp $ */
3if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
4check_status(ACCESS_ADMINISTRATOR);
5include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php');
6
7CF_Log::reset_messages();
8
9$config_tabs[]='config';
10$config_tabs[]='language';
11
12global $template, $page;
13// Include language advices
14load_language('plugin.lang', CF_PATH);
15
16$cf_plugin = get_plugin_data($plugin_id);
17$cf_config = $cf_plugin->get_config();
18
19// Tabs management
20if (!isset($_GET['tab'])) {
21    $page['tab'] = $config_tabs[0];
22} else {
23    $page['tab'] = $_GET['tab'];
24}
25
26if (!in_array($page['tab'], $config_tabs)) {
27    $page['tab'] = $config_tabs[0];
28}
29$base_admin_url = get_admin_plugin_menu_link(__FILE__);
30
31$tabsheet = new tabsheet();
32
33foreach ($config_tabs as $current_tab) {
34    $tab_name = 'cf_tab_'.$current_tab;
35    $tabsheet->add($current_tab,
36                   l10n($tab_name),
37                   $base_admin_url.'&amp;tab='.$current_tab);
38}
39$tabsheet->select($page['tab']);
40$tabsheet->assign();
41
42// Define template file
43$template->block_html_head( '',
44          '<link rel="stylesheet" type="text/css" '.
45          'href="' . CF_INCLUDE . 'contactform.css' . '">',
46          $smarty, $repeat);
47$template->block_html_head( '',
48          '<script type="text/javascript" '.
49          'src="' . CF_INCLUDE . 'contactform.js' . '">'.
50          '</script>',
51          $smarty, $repeat);
52$template->set_filenames(array(
53    'plugin_admin_content' => realpath(cf_get_template('cf_'.
54                                                       $page['tab'].
55                                                       '.tab.tpl',
56                                                       CF_AMDIN_TPL))
57  ));
58
59$cf = array(
60    'TITLE'     => $cf_plugin->get_title(),
61    'VERSION'   => $cf_plugin->get_version(),
62    'F_ACTION'  => '',
63  );
64$template->assign('CF', $cf);
65
66// Include specific tab
67include_once (CF_ADMIN . 'cf_' . $page['tab'] . '.tab.php');
68
69$template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
70CF_Log::show_messages();
71?>
Note: See TracBrowser for help on using the repository browser.