Adding the new toolbar option in the settings see #4162

skala
Julio Montoya 14 years ago
parent 53f130215b
commit c83f55b8a9
  1. 54
      main/inc/lib/template.lib.php
  2. 5
      main/inc/lib/userportal.lib.php
  3. 9
      main/install/db_main.sql
  4. 19
      main/install/migrate-db-1.8.8-1.9.0-pre.sql
  5. 23
      main/template/default/layout/header.tpl

@ -26,11 +26,14 @@ class Template extends Smarty {
$this->cache_lifetime = Smarty::CACHING_OFF; // no caching
//$this->cache_lifetime = 120;
//By default we show the header and footer
//header and footer are showed by default
$this->set_footer($show_footer);
$this->set_header($show_header);
$this->set_system_parameters();
//Setting system variables
$this->set_system_parameters();
//Setting user variables
$this->set_user_parameters();
//Creating a Smarty modifier - Now we can call the get_lang from a template!!! Just use {"MyString"|get_lang}
@ -38,16 +41,20 @@ class Template extends Smarty {
$this->registerPlugin("modifier","get_path", "api_get_path");
$this->registerPlugin("modifier","get_setting", "api_get_setting");
//To load a smarty plugin
//To load a smarty plugin
//$this->loadPlugin('smarty_function_get_lang');
//To the the smarty installation
//$this->testInstall();
$this->set_header_parameters();
$this->set_footer_parameters();
$this->set_footer_parameters();
$this->assign('style', $this->style);
}
/**
* Shortcut to display a 1 col layout
* Shortcut to display a 1 col layout (index.php)
* */
function display_one_col_template() {
$tpl = $this->get_template('layout/layout_1_col.tpl');
@ -55,7 +62,7 @@ class Template extends Smarty {
}
/**
* Shortcut to display a 2 col layout
* Shortcut to display a 2 col layout (userportal.php)
* */
function display_two_col_template() {
$tpl = $this->get_template('layout/layout_2_col.tpl');
@ -77,8 +84,6 @@ class Template extends Smarty {
$tpl = $this->get_template('layout/no_layout.tpl');
$this->display($tpl);
}
/**
* Sets the footer visibility
@ -90,11 +95,33 @@ class Template extends Smarty {
}
/**
* Sets the header visibility
*
* @param bool true if we show the header
*/
function set_header($status) {
$this->show_header = $status;
$this->assign('show_header', $status);
$this->assign('show_header', $status);
$show_admin_toolbar = api_get_setting('show_admin_toolbar');
$show_toolbar = 0;
switch($show_admin_toolbar) {
case 'do_not_show':
break;
case 'show_to_admin':
if (api_is_platform_admin()) {
$show_toolbar = 1;
}
break;
case 'show_to_admin_and_teachers':
if (api_is_platform_admin() || api_is_allowed_to_edit()) {
$show_toolbar = 1;
}
break;
case 'show_to_all':
$show_toolbar = 1;
break;
}
$this->assign('show_toolbar', $show_toolbar);
}
function get_template($name) {
@ -107,8 +134,15 @@ class Template extends Smarty {
if (api_get_user_id() && !api_is_anonymous()) {
$user_info = api_get_user_info();
$user_info['logged'] = 1;
$user_info['is_admin'] = 0;
if (api_is_platform_admin()) {
$user_info['is_admin'] = 1;
}
$user_info['messages_count'] = MessageManager::get_new_messages();
}
//Setting the $_u array that could be use in any template
$this->assign('_u', $user_info);
}

@ -444,10 +444,7 @@ class IndexManager {
}
}
return '<div id="login_fail">'.$message.'</div>';
}
}
/**
* Display list of courses in a category.

@ -855,7 +855,8 @@ VALUES
('allow_teacher_change_gradebook_grading_model', NULL, 'radio', 'Gradebook', 'false', 'AllowTeacherChangeGradebookGradingModelTitle', 'AllowTeacherChangeGradebookGradingModelComment', NULL, NULL, 1),
('grading_model', 'grading_model', 'custom', 'Gradebook', 'false', 'GradingModelTitle', 'GradingModelComment', NULL, NULL, 1),
('allow_users_to_change_email_with_no_password', NULL, 'radio', 'User', 'false', 'AllowUsersToChangeEmailWithNoPasswordTitle', 'AllowUsersToChangeEmailWithNoPasswordComment', NULL, NULL, 0),
('chamilo_database_version',NULL,'textfield',NULL, '1.9.0.16305','DokeosDatabaseVersion','', NULL, NULL, 0);
('show_admin_toolbar', NULL, 'radio', 'Platform', 'true', 'ShowAdminToolbarTitle', 'ShowAdminToolbarComment', NULL, NULL, 1)
('chamilo_database_version',NULL,'textfield',NULL, '1.9.0.16368','DokeosDatabaseVersion','', NULL, NULL, 0);
/*
('use_custom_pages',NULL,'radio','Platform','false','UseCustomPages','useCustomPagesComment','platform',NULL,0),
@ -1163,7 +1164,11 @@ VALUES
('grading_model', '1*X+1*X+1*X+1*X/4', 'Model 3'),
('grading_model', '1*X+2*X+1*X+2*X/6', 'Model 4'),
('allow_users_to_change_email_with_no_password', 'true', 'Yes'),
('allow_users_to_change_email_with_no_password', 'false', 'No');
('allow_users_to_change_email_with_no_password', 'false', 'No'),
('show_admin_toolbar', 'do_not_show', 'DoNotShow'),
('show_admin_toolbar', 'show_to_admin', 'ShowToAdminsOnly'),
('show_admin_toolbar', 'show_to_admin_and_teachers', 'ShowToAdminsAndTeachers'),
('show_admin_toolbar', 'show_to_all', 'ShowToAllUsers');
/*
('use_custom_pages','true','Yes'),

@ -123,10 +123,20 @@ INSERT INTO settings_options (variable, value, display_text) VALUES ('enable_hel
ALTER TABLE gradebook_category MODIFY COLUMN weight FLOAT NOT NULL;
ALTER TABLE gradebook_link MODIFY COLUMN weight FLOAT NOT NULL;
-- Do not move this query
UPDATE settings_current SET selected_value = '1.9.0.16305' WHERE variable = 'chamilo_database_version';
INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('allow_hr_skills_management', NULL, 'radio', 'Gradebook', 'true', 'AllowHRSkillsManagementTitle', 'AllowHRSkillsManagementComment', NULL, NULL, 1);
INSERT INTO settings_options (variable, value, display_text) VALUES ('allow_hr_skills_management', 'true', 'Yes');
INSERT INTO settings_options (variable, value, display_text) VALUES ('allow_hr_skills_management', 'false', 'No');
INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('show_admin_toolbar', NULL, 'radio', 'Platform', 'true', 'ShowAdminToolbarTitle', 'ShowAdminToolbarComment', NULL, NULL, 1);
INSERT INTO settings_options (variable, value, display_text) VALUES ('show_admin_toolbar', 'do_not_show', 'DoNotShow');
INSERT INTO settings_options (variable, value, display_text) VALUES ('show_admin_toolbar', 'show_to_admin', 'ShowToAdminsOnly');
INSERT INTO settings_options (variable, value, display_text) VALUES ('show_admin_toolbar', 'show_to_admin_and_teachers', 'ShowToAdminsAndTeachers');
INSERT INTO settings_options (variable, value, display_text) VALUES ('show_admin_toolbar', 'show_to_all', 'ShowToAllUsers');
-- Do not move this query
UPDATE settings_current SET selected_value = '1.9.0.16368' WHERE variable = 'chamilo_database_version';
-- xxSTATSxx
ALTER TABLE track_e_exercices ADD COLUMN questions_to_check TEXT NOT NULL DEFAULT '';
@ -140,11 +150,6 @@ CREATE TABLE stored_values_stack (user_id INT NOT NULL, sco_id INT NOT NULL, sta
ALTER TABLE stored_values_stack ADD KEY (user_id, sco_id, course_id, sv_key, stack_order);
ALTER TABLE stored_values_stack ADD UNIQUE (user_id, sco_id, course_id, sv_key, stack_order);
INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('allow_hr_skills_management', NULL, 'radio', 'Gradebook', 'true', 'AllowHRSkillsManagementTitle', 'AllowHRSkillsManagementComment', NULL, NULL, 1);
INSERT INTO settings_options (variable, value, display_text) VALUES ('allow_hr_skills_management', 'true', 'Yes');
INSERT INTO settings_options (variable, value, display_text) VALUES ('allow_hr_skills_management', 'false', 'No');
-- xxUSERxx
-- xxCOURSExx

@ -1,9 +1,11 @@
<!-- Topbar -->
{if $_u.status == 1}
{if $show_toolbar == 1}
<div class="topbar">
<div class="topbar-inner">
<div class="container-fluid">
<h3><a href="{'WEB_PATH'|get_path}">Chamilo</a></h3>
{if $_u.logged}
<ul class="nav">
<li class="active"><a href="{'WEB_PATH'|get_path}/user_portal.php">{"MyCourses"|get_lang}</a></li>
<li class="dropdown">
@ -23,6 +25,7 @@
<li><a href="{'WEB_CODE_PATH'|get_path}dashboard/">{"Dashboard"|get_lang}</a></li>
</ul>
</li>
{if $_u.is_admin == 1}
<li class="dropdown">
<a class="dropdown-toggle" href="#">{'Administration'|get_lang}</a>
<ul class="dropdown-menu">
@ -33,10 +36,17 @@
<li><a href="{'WEB_CODE_PATH'|get_path}admin/settings.php">{"Settings"|get_lang}</a></li>
</ul>
</li>
</ul>
<form action="{'WEB_CODE_PATH'|get_path}admin/user_list.php" method="get">
<input type="text" placeholder="{'SearchUsers'|get_lang}" name="keyword">
</form>
{/if}
</ul>
{/if}
{if $_u.is_admin == 1}
<form action="{'WEB_CODE_PATH'|get_path}admin/user_list.php" method="get">
<input type="text" placeholder="{'SearchUsers'|get_lang}" name="keyword">
</form>
{/if}
{if $_u.logged}
<ul class="nav secondary-nav">
<li><a href="{'WEB_CODE_PATH'|get_path}social/home.php"><img src="{$_u.avatar_small}"/></a></li>
<li class="dropdown">
@ -52,6 +62,7 @@
</li>
<li><a href="{'WEB_PATH'|get_path}index.php?logout=logout">Logout</a></li>
</ul>
{/if}
</div>
</div><!-- /topbar-inner -->
</div><!-- /topbar -->
@ -68,5 +79,3 @@
{* menu *}
{$header3}

Loading…
Cancel
Save