Project

General

Profile

« Previous | Next » 

Revision 2098

Added by darkviper almost 11 years ago

! activate class Translate for all addons in admin/ (except pages/)
! class.admin >> add translation of the current theme to Translate

View differences:

index.php
17 17

  
18 18
// Print admin header
19 19
require('../../config.php');
20
require_once(WB_PATH.'/framework/class.admin.php');
20
$oDb = WbDatabase::getInstance();
21
$oTrans = Translate::getInstance();
22
$oTrans->enableAddon('admin\\addons');
21 23
$admin = new admin('Addons', 'templates');
22 24

  
23 25
// Setup template object, parse vars to it, then parse it
......
27 29
$template->set_file('page', 'templates.htt');
28 30
$template->set_block('page', 'main_block', 'main');
29 31
$template->set_var('FTAN', $admin->getFTAN());
32
/*-- insert all needed vars from language files ----------------------------------------*/
33
$template->set_var($oTrans->getLangArray());
30 34

  
31 35
// Insert values into template list
32 36
$template->set_block('main_block', 'template_list_block', 'template_list');
33
$sql = 'SELECT `directory`, `name`, `function` FROM `'.TABLE_PREFIX.'addons` '
37
$sql = 'SELECT `directory`, `name`, `function` FROM `'.$oDb->TablePrefix.'addons` '
34 38
     . 'WHERE `type`=\'template\' ORDER BY `name`';
35
if(($result = $database->query($sql))) {
36
	while($addon = $result->fetchRow(MYSQL_ASSOC))
37
	{
39
if (($result = $oDb->doQuery($sql))) {
40
	while ($addon = $result->fetchRow(MYSQL_ASSOC)) {
38 41
		if ($admin->get_permission($addon['directory'],'template')==false) { continue;}
39 42
		$template->set_var('VALUE', $addon['directory']);
40 43
		$template->set_var('NAME', (($addon['function'] == 'theme' ? '[Theme] ' : '').$addon['name']));
......
53 56
	$template->set_var('DISPLAY_LIST', 'hide');
54 57
}
55 58

  
56
//$mLang = ModLanguage::getInstance();
57
//$mLang->setLanguage(ADMIN_PATH.'/addons/languages/', LANGUAGE, DEFAULT_LANGUAGE);
58
$mLang = Translate::getInstance();
59
$mLang->enableAddon('admin\addons');
60

  
61
/*-- insert all needed vars from language files ----------------------------------------*/
62
$template->set_var($mLang->getLangArray());
63

  
64 59
// insert urls
65 60
$template->set_var(array(
66 61
					'ADMIN_URL' => ADMIN_URL,
......
72 67
// Insert language text and messages
73 68
$template->set_var(array(
74 69
	'URL_MODULES' => $admin->get_permission('modules') ?
75
		'<a href="' . ADMIN_URL . '/modules/index.php">' . $mLang->MENU_MODULES . '</a>' : '<b>'.$mLang->MENU_MODULES.'</b>',
70
		'<a href="' . ADMIN_URL . '/modules/index.php">' . $oTrans->MENU_MODULES . '</a>' : '<b>'.$oTrans->MENU_MODULES.'</b>',
76 71
	'URL_LANGUAGES' => $admin->get_permission('languages') ?
77
		'<a href="' . ADMIN_URL . '/languages/index.php">' . $mLang->MENU_LANGUAGES . '</a>' : '<b>'.$mLang->MENU_LANGUAGES.'</b>',
72
		'<a href="' . ADMIN_URL . '/languages/index.php">' . $oTrans->MENU_LANGUAGES . '</a>' : '<b>'.$oTrans->MENU_LANGUAGES.'</b>',
78 73
	'URL_ADVANCED' => $admin->get_permission('modules_advanced')
79
                ? '<a href="' . ADMIN_URL . '/addons/index.php?advanced">' . $mLang->TEXT_ADVANCED . '</a>' : '<b>'.$mLang->TEXT_ADVANCED.'</b>' ,
74
                ? '<a href="' . ADMIN_URL . '/addons/index.php?advanced">' . $oTrans->TEXT_ADVANCED . '</a>' : '<b>'.$oTrans->TEXT_ADVANCED.'</b>' ,
80 75
	)
81 76
);
82 77

  
......
84 79
$template->parse('main', 'main_block', false);
85 80
$template->pparse('output', 'page');
86 81

  
87
$mLang->disableAddon();
82
$oTrans->disableAddon();
88 83
// Print admin footer
89 84
$admin->print_footer();

Also available in: Unified diff