Project

General

Profile

1 238 stefan
<?php
2 1467 Luisehahne
/**
3
 *
4
 * @category        admin
5
 * @package         templates
6 1529 Luisehahne
 * @author          Ryan Djurovich, WebsiteBaker Project
7 1467 Luisehahne
 * @copyright       2009-2011, Website Baker Org. e.V.
8
 * @link			http://www.websitebaker2.org/
9
 * @license         http://www.gnu.org/licenses/gpl.html
10
 * @platform        WebsiteBaker 2.8.x
11
 * @requirements    PHP 5.2.2 and higher
12
 * @version         $Id$
13
 * @filesource		$HeadURL$
14
 * @lastmodified    $Date$
15
 *
16
 */
17 238 stefan
18
// Print admin header
19
require('../../config.php');
20
require_once(WB_PATH.'/framework/class.admin.php');
21
$admin = new admin('Addons', 'templates');
22
23 1529 Luisehahne
// Setup template object, parse vars to it, then parse it
24
// Create new template object
25 1625 Luisehahne
$template = new Template(dirname($admin->correct_theme_source('templates.htt')));
26 1529 Luisehahne
// $template->debug = true;
27 944 Ruebenwurz
$template->set_file('page', 'templates.htt');
28 238 stefan
$template->set_block('page', 'main_block', 'main');
29 1355 FrankH
$template->set_var('FTAN', $admin->getFTAN());
30 238 stefan
31
// Insert values into template list
32
$template->set_block('main_block', 'template_list_block', 'template_list');
33 384 Ruebenwurz
$result = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'template' order by name");
34 238 stefan
if($result->numRows() > 0) {
35
	while($addon = $result->fetchRow()) {
36
		$template->set_var('VALUE', $addon['directory']);
37
		$template->set_var('NAME', $addon['name']);
38
		$template->parse('template_list', 'template_list_block', true);
39
	}
40
}
41
42
// Insert permissions values
43
if($admin->get_permission('templates_install') != true) {
44
	$template->set_var('DISPLAY_INSTALL', 'hide');
45
}
46
if($admin->get_permission('templates_uninstall') != true) {
47
	$template->set_var('DISPLAY_UNINSTALL', 'hide');
48
}
49
if($admin->get_permission('templates_view') != true) {
50
	$template->set_var('DISPLAY_LIST', 'hide');
51
}
52
53
// Insert language headings
54
$template->set_var(array(
55 1457 Luisehahne
					'HEADING_INSTALL_TEMPLATE' => $HEADING['INSTALL_TEMPLATE'],
56
					'HEADING_UNINSTALL_TEMPLATE' => $HEADING['UNINSTALL_TEMPLATE'],
57
					'HEADING_TEMPLATE_DETAILS' => $HEADING['TEMPLATE_DETAILS']
58
				)
59
			);
60
// insert urls
61
$template->set_var(array(
62
					'ADMIN_URL' => ADMIN_URL,
63
					'WB_URL' => WB_URL,
64
					'THEME_URL' => THEME_URL,
65
					'FTAN' => $admin->getFTAN()
66
				)
67
			);
68 238 stefan
// Insert language text and messages
69
$template->set_var(array(
70 928 doc
	'URL_MODULES' => $admin->get_permission('modules') ?
71
		'<a href="' . ADMIN_URL . '/modules/index.php">' . $MENU['MODULES'] . '</a>' : '',
72 1457 Luisehahne
	'URL_LANGUAGES' => $admin->get_permission('languages') ?
73 928 doc
		'<a href="' . ADMIN_URL . '/languages/index.php">' . $MENU['LANGUAGES'] . '</a>' : '',
74 1529 Luisehahne
	'URL_ADVANCED' => '&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;',
75 928 doc
	'TEXT_INSTALL' => $TEXT['INSTALL'],
76
	'TEXT_UNINSTALL' => $TEXT['UNINSTALL'],
77
	'TEXT_VIEW_DETAILS' => $TEXT['VIEW_DETAILS'],
78
	'TEXT_PLEASE_SELECT' => $TEXT['PLEASE_SELECT'],
79 933 doc
	'CHANGE_TEMPLATE_NOTICE' => $MESSAGE['TEMPLATES']['CHANGE_TEMPLATE_NOTICE']
80 928 doc
	)
81
);
82 238 stefan
83
// Parse template object
84
$template->parse('main', 'main_block', false);
85
$template->pparse('output', 'page');
86
87
// Print admin footer
88
$admin->print_footer();