Improving plugin usability

skala
Julio Montoya 13 years ago
parent 67f7c60f27
commit b34d500b82
  1. 12
      index.php
  2. 187
      main/admin/settings.lib.php
  3. 1
      main/admin/settings.php
  4. 17
      main/css/base.css
  5. 7
      main/css/base_chamilo.css
  6. 55
      main/inc/lib/course.lib.php
  7. 19
      main/inc/lib/display.lib.php
  8. 3
      main/inc/lib/main_api.lib.php
  9. 91
      main/inc/lib/plugin.lib.php
  10. 52
      main/inc/lib/template.lib.php
  11. 71
      main/inc/lib/userportal.lib.php
  12. 82
      main/template/default/layout/footer.tpl
  13. 17
      main/template/default/layout/layout_1_col.tpl
  14. 34
      main/template/default/layout/layout_2_col.tpl
  15. 9
      main/template/default/layout/login_form.tpl
  16. 58
      main/template/default/layout/main_header.tpl
  17. 8
      main/template/default/layout/page_body.tpl
  18. 5
      plugin/date/plugin.php
  19. 2
      user_portal.php

@ -122,17 +122,6 @@ if (!empty($_POST['submitAuth'])) {
event_open();
}
//@todo add this in the template
// Plugins for loginpage_main AND campushomepage_main.
if (!api_get_user_id()) {
api_plugin('loginpage_main');
} else {
api_plugin('campushomepage_main');
}
//@todo add this in the template
if (api_get_setting('display_categories_on_homepage') == 'true') {
echo '<div class="home_cats">';
@ -157,7 +146,6 @@ $controller->tpl->assign('hot_courses', $controller->return_hot_cour
$controller->tpl->assign('announcements_block', $controller->return_announcements());
$controller->tpl->assign('home_page_block', $controller->return_home_page());
$controller->tpl->assign('notice_block', $controller->return_notice());
$controller->tpl->assign('plugin_campushomepage', $controller->return_plugin_campushomepage());
if (api_is_platform_admin() || api_is_drh()) {
$controller->tpl->assign('skills_block', $controller->return_skills_links());

@ -31,101 +31,80 @@ function handle_plugins() {
event_system(LOG_CONFIGURATION_SETTINGS_CHANGE, LOG_CONFIGURATION_SETTINGS_CATEGORY, $category, api_get_utc_datetime(), $user_id);
Display :: display_confirmation_message(get_lang('SettingsStored'));
}
$plugin_obj = new AppPlugin();
$possible_plugins = $plugin_obj->read_plugins_from_path();
//echo get_lang('AvailablePlugins').'<br />';
echo '<br />';
/* We scan the plugin directory. Each folder is a potential plugin. */
$pluginpath = api_get_path(SYS_PLUGIN_PATH);
$handle = @opendir($pluginpath);
while (false !== ($file = readdir($handle))) {
if ($file != '.' && $file != '..' && is_dir(api_get_path(SYS_PLUGIN_PATH).$file)) {
$possibleplugins[] = $file;
}
}
@closedir($handle);
/* For each of the possible plugin directories we check whether a file named "plugin.php" exists
(it contains all the needed information about this plugin).
This "plugin.php" file looks like:
$plugin_info['title'] = 'The title of the plugin';
$plugin_info['comment'] = 'Some comment about the plugin';
$plugin_info['location'] = array('loginpage_menu', 'campushomepage_menu', 'banner'); // The possible locations where the plugins can be used.
$plugin_info['version'] = '0.1 alpha'; // The version number of the plugin.
$plugin_info['author'] = 'Patrick Cool'; // The author of the plugin.
*/
echo '<form name="plugins" method="post" action="'.api_get_self().'?category='.$_GET['category'].'">';
echo '<form name="plugins" method="post" action="'.api_get_self().'?category='.Security::remove_XSS($_GET['category']).'">';
echo '<table class="data_table">';
echo '<tr>';
echo '<th>';
echo '<th width="300px">';
echo get_lang('Plugin');
echo '</th><th>';
echo get_lang('LoginPageMainArea');
echo '</th><th>';
echo get_lang('LoginPageMenu');
echo get_lang('PluginArea').'';
echo '</th>';
/*
echo get_lang('LoginPageMenu').'<br />(loginpage_menu)';
echo '</th><th>';
echo get_lang('CampusHomepageMainArea');
echo get_lang('CampusHomepageMainArea').'<br />(campushomepage_main)';
echo '</th><th>';
echo get_lang('CampusHomepageMenu');
echo get_lang('CampusHomepageMenu').'<br />(campushomepage_menu)';
echo '</th><th>';
echo get_lang('MyCoursesMainArea');
echo get_lang('MyCoursesMainArea').'<br />(mycourses_main)';
echo '</th><th>';
echo get_lang('MyCoursesMenu');
echo get_lang('MyCoursesMenu').'<br />(mycourses_menu)';
echo '</th><th>';
echo get_lang('Header');
echo get_lang('Header').'<br />(header)';
echo '</th><th>';
echo get_lang('Footer');
echo get_lang('Footer').'<br />(footer)';
echo '</th><th>';
echo get_lang('CourseTool');
echo get_lang('CourseTool').'';*/
echo '</th>';
echo '</tr>';
//$usedplugins = $plugin_obj->get_installed_plugins();
$usedplugins = $plugin_obj->get_installed_plugins();
/* We retrieve all the active plugins. */
//$sql = "SELECT * FROM $table_settings_current WHERE category='Plugins'";
//$result = Database::query($sql);
$result = api_get_settings('Plugins');
//while ($row = Database::fetch_array($result))
foreach ($result as $row) {
$usedplugins[$row['variable']][] = $row['selected_value'];
/* We display all the possible plugins and the checkboxes */
$plugin_list = array();
$my_plugin_list = $plugin_obj->get_plugin_list();
foreach($my_plugin_list as $plugin_item) {
$plugin_list[$plugin_item] = $plugin_item;
}
/* We display all the possible plugins and the checkboxes */
foreach ($possibleplugins as $testplugin) {
$plugin_info_file = api_get_path(SYS_PLUGIN_PATH).$testplugin.'/plugin.php';
foreach ($possible_plugins as $plugin) {
$plugin_info_file = api_get_path(SYS_PLUGIN_PATH).$plugin.'/plugin.php';
if (file_exists($plugin_info_file)) {
$plugin_info = array();
include ($plugin_info_file);
require $plugin_info_file;
echo '<tr>';
echo '<td>';
foreach ($plugin_info as $key => $value) {
if ($key != 'location') {
if ($key == 'title') {
$value = '<strong>'.$value.'</strong>';
}
echo get_lang(ucwords($key)).': '.$value.'<br />';
}
}
if (file_exists(api_get_path(SYS_PLUGIN_PATH).$testplugin.'/readme.txt')) {
echo "<a href='".api_get_path(WEB_PLUGIN_PATH).$testplugin."/readme.txt'>readme.txt</a>";
}
echo '</td>';
// column: LoginPageMainArea
if (empty($usedplugins)) {
$usedplugins = array();
echo '<td>';
echo '<h3>'.$plugin_info['title'].' <small>v '.$plugin_info['version'].'</small></h3>';
echo '<p>'.$plugin_info['comment'].'</p>';
echo '<p>'.get_lang('Author').': '.$plugin_info['author'].'</p>';
if (file_exists(api_get_path(SYS_PLUGIN_PATH).$plugin.'/readme.txt')) {
echo "<a href='".api_get_path(WEB_PLUGIN_PATH).$plugin."/readme.txt'>readme.txt</a>";
}
display_plugin_cell('loginpage_main', $plugin_info, $testplugin, $usedplugins);
display_plugin_cell('loginpage_menu', $plugin_info, $testplugin, $usedplugins);
display_plugin_cell('campushomepage_main', $plugin_info, $testplugin, $usedplugins);
display_plugin_cell('campushomepage_menu', $plugin_info, $testplugin, $usedplugins);
display_plugin_cell('mycourses_main', $plugin_info, $testplugin, $usedplugins);
display_plugin_cell('mycourses_menu', $plugin_info, $testplugin, $usedplugins);
display_plugin_cell('header', $plugin_info, $testplugin, $usedplugins);
display_plugin_cell('footer', $plugin_info, $testplugin, $usedplugins);
display_plugin_cell('course_tool_plugin', $plugin_info, $testplugin, $usedplugins);
echo '</tr>';
echo '</td><td>';
$selected_plugins = $plugin_obj->get_areas_by_plugin($plugin);
echo Display::select('plugin_'.$plugin.'[]', $plugin_list, $selected_plugins, array('multiple' => 'multiple', 'style' => 'width:500px'));
/* display_plugin_cell('loginpage_main', $plugin_info, $plugin, $usedplugins);
display_plugin_cell('loginpage_menu', $plugin_info, $plugin, $usedplugins);
display_plugin_cell('campushomepage_main', $plugin_info, $plugin, $usedplugins);
display_plugin_cell('campushomepage_menu', $plugin_info, $plugin, $usedplugins);
display_plugin_cell('mycourses_main', $plugin_info, $plugin, $usedplugins);
display_plugin_cell('mycourses_menu', $plugin_info, $plugin, $usedplugins);
display_plugin_cell('header', $plugin_info, $plugin, $usedplugins);
display_plugin_cell('footer', $plugin_info, $plugin, $usedplugins);
display_plugin_cell('course_tool_plugin', $plugin_info, $plugin, $usedplugins);*/
echo '</td></tr>';
}
}
echo '</table>';
@ -388,38 +367,37 @@ function upload_stylesheet($values, $picture) {
* @todo: A similar function needs to be written to activate or inactivate additional tools.
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
*/
function store_plugins() {
$table_settings_current = Database :: get_main_table(TABLE_MAIN_SETTINGS_CURRENT);
function store_plugins() {
global $_configuration;
$plugin_obj = new AppPlugin();
// Get a list of all current 'Plugins' settings
$installed_plugins = api_get_settings('Plugins','list',$_configuration['access_url']);
$installed_plugins = api_get_settings('Plugins','list', $_configuration['access_url']);
$shortlist_installed = array();
foreach ($installed_plugins as $plugin) {
$shortlist_installed[] = $plugin['subkey'];
}
$shortlist_installed = array_flip(array_flip($shortlist_installed));
// Step 1 : We remove all the plugins.
//$sql = "DELETE FROM $table_settings_current WHERE category='Plugins'";
//Database::query($sql);
$r = api_delete_category_settings('Plugins', $_configuration['access_url']);
$shortlist_required = array();
// Step 2: Looping through all the post values we only store these which are really a valid plugin location.
foreach ($_POST as $form_name => $formvalue) {
$form_name_elements = explode('-', $form_name);
if (is_valid_plugin_location($form_name_elements[1])) {
$shortlist_required[] = $form_name_elements[0];
//$sql = "INSERT into $table_settings_current (variable,category,selected_value) VALUES ('".$form_name_elements['1']."','Plugins','".$form_name_elements['0']."')";
//Database::query($sql);
api_add_setting($form_name_elements['0'], $form_name_elements['1'], $form_name_elements['0'], null, 'Plugins', $form_name_elements['0'], null, null, null, $_configuration['access_url'], 1);
// check if there is an install procedure
$pluginpath = api_get_path(SYS_PLUGIN_PATH).$form_name_elements[0].'/install.php';
if (is_file($pluginpath) && is_readable($pluginpath)) {
//execute the install procedure
include $pluginpath;
$plugin_list = $plugin_obj->read_plugins_from_path();
foreach ($plugin_list as $plugin) {
if (isset($_POST['plugin_'.$plugin])) {
$areas_to_installed = $_POST['plugin_'.$plugin];
foreach ($areas_to_installed as $area) {
api_add_setting($plugin, $area, $plugin, null, 'Plugins', $plugin, null, null, null, $_configuration['access_url'], 1);
$pluginpath = api_get_path(SYS_PLUGIN_PATH).$plugin.'/install.php';
if (is_file($pluginpath) && is_readable($pluginpath)) {
//execute the install procedure
require $pluginpath;
}
}
}
}
}
}
foreach ($shortlist_installed as $plugin) {
// if one plugin was really deleted, execute the uninstall script
if (!in_array($plugin,$shortlist_required)) {
@ -427,21 +405,12 @@ function store_plugins() {
$pluginpath = api_get_path(SYS_PLUGIN_PATH).$plugin.'/uninstall.php';
if (is_file($pluginpath) && is_readable($pluginpath)) {
//execute the install procedure
include $pluginpath;
}
require $pluginpath;
}
}
}
}
/**
* Check if the post information is really a valid plugin location.
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
*/
function is_valid_plugin_location($location) {
static $valid_locations = array('loginpage_main', 'loginpage_menu', 'campushomepage_main', 'campushomepage_menu', 'mycourses_main', 'mycourses_menu', 'header', 'footer', 'course_tool_plugin');
return in_array($location, $valid_locations);
}
/**
* This function allows the platform admin to choose which should be the default stylesheet
@ -496,9 +465,7 @@ function handle_search() {
//$renderer->setHeaderTemplate('<div class="sectiontitle">{header}</div>'."\n");
//$renderer->setElementTemplate('<div class="sectioncomment">{label}</div>'."\n".'<div class="sectionvalue">{element}</div>'."\n");
$renderer->setElementTemplate('<div class="row"><div class="label">{label}</div><div class="formw">{element}<!-- BEGIN label_2 --><span class="help-block">{label_2}</span><!-- END label_2 --></div></div>');
$values = api_get_settings_options('search_enabled');
$form->addElement('header', null, get_lang('SearchEnabledTitle'));

@ -30,6 +30,7 @@ require_once api_get_path(LIBRARY_PATH).'fileManage.lib.php';
require_once api_get_path(LIBRARY_PATH).'fileUpload.lib.php';
require_once api_get_path(LIBRARY_PATH).'dashboard.lib.php';
require_once api_get_path(LIBRARY_PATH).'pdf.lib.php';
require_once api_get_path(LIBRARY_PATH).'plugin.lib.php';
require_once 'settings.lib.php';
// Setting the section (for the tabs).

@ -37,16 +37,16 @@ legend {
margin-bottom: 10px;
}
#header1 {
height: 50px;
}
#header_right {
text-align: right;
}
#header2 .nav{
margin-bottom:0px;
}
#header2 {
width:100%;
height: 35px;
}
#header2 .nav {
@ -142,6 +142,13 @@ footer {
padding-top: 17px;
border-top: 1px solid #eee;
}
#footer .container .row{
padding-top: 60px;
}
#footer_right #admin_name, #footer_right #software_name{
text-align:right;
}
.page-header {
margin-bottom: 17px;
border-bottom: 1px solid #ddd;

@ -279,12 +279,7 @@ input.link_alike:hover {
/********************************************************
* HEADER 1: Title, portal, organisation, course title *
********************************************************/
#header1 {
padding:0px;
font-size:12px;
color:#666666;
background-repeat:repeat-x;
}
#header1 a {
font-size:12px;
font-weight:normal;

@ -2706,11 +2706,11 @@ class CourseManager {
public function course_item_html($params, $is_sub_content = false) {
$html = '';
$class = "well";
$class = "well2";
if ($is_sub_content) {
$class = "";
}
$html .= '<div class="row-fluid">';
}
$html .= '<div class="row-fluid '.$class.'">';
$html .= '<div class="span10">';
$html .= '<div class="well3">';
$html .= '<div class="span1">'.$params['icon'].'</div>';
@ -2824,7 +2824,7 @@ class CourseManager {
$params['image'] = $course_title;
$params['notifications'] = $show_notification;
$html .= self::course_item_html($params);
$html .= self::course_item_html($params, false);
$key++;
}
}
@ -2858,7 +2858,7 @@ class CourseManager {
// We simply display the title of the category.
$params['icon'] = Display::return_icon('folder_yellow.png', null, array(), ICON_SIZE_LARGE);
$params['title'] = $row['title'];
$html .= self::course_item_parent(self::course_item_html($params), self :: display_courses_in_category($row['id'], $load_dirs));
$html .= self::course_item_parent(self::course_item_html($params, true), self :: display_courses_in_category($row['id'], $load_dirs));
}
return $html;
}
@ -2938,36 +2938,6 @@ class CourseManager {
$params['right_actions'] .= Display::div('', array('id' => 'document_result_'.$course_info['real_id'].'_0', 'class'=>'document_preview_container'));
}
}
// Function logic - act on the data (check if the course is virtual, if yes change the link).
/*
* no virtual courses
$is_virtual_course = CourseManager :: is_virtual_course_from_system_code($course['code']);
if ($is_virtual_course) {
// If the current user is also subscribed in the real course to which this
// virtual course is linked, we don't need to display the virtual course entry in
// the course list - it is combined with the real course entry.
$target_course_code = CourseManager :: get_target_of_linked_course($course['code']);
$is_subscribed_in_target_course = CourseManager :: is_user_subscribed_in_course(api_get_user_id(), $target_course_code);
if ($is_subscribed_in_target_course) {
return; // Do not display this course entry.
}
}*/
// Check if the course has virtual courses attached. If yes change the course title and display code.
/*
$has_virtual_courses = CourseManager :: has_virtual_courses_from_code($course['code'], api_get_user_id());
if ($has_virtual_courses) {
$course_info = api_get_course_info($course['code']);
$return_result = CourseManager :: determine_course_title_from_course_info(api_get_user_id(), $course_info);
$course_title = $return_result['title'];
$course_display_code = $return_result['code'];
} else {
$course_title = $course['title'];
$course_display_code = $course['visual_code'];
}*/
$course_title = $course_info['title'];
$course_title_url = '';
@ -2993,7 +2963,12 @@ class CourseManager {
$params['title'] = $course_title;
$params['teachers'] = $teachers;
$params['notifications'] = $show_notification;
$html .= self::course_item_html($params);
$is_subcontent = true;
if (empty($user_category_id)) {
$is_subcontent = false;
}
$html .= self::course_item_html($params, $is_subcontent);
$key++;
}
return $html;
@ -3142,11 +3117,9 @@ class CourseManager {
$params['title'] = $session_title;
$params['right_actions'] = '';
if ($load_dirs) {
$params['right_actions'] .= '<div style="float:right;">';
if ($load_dirs) {
$params['right_actions'] .= '<a id="document_preview_'.$course_info['real_id'].'_'.$course_info['id_session'].'" class="document_preview" href="javascript:void(0);">'.Display::return_icon('folder.png', get_lang('Documents'), array('align' => 'absmiddle'),ICON_SIZE_SMALL).'</a>';
$params['right_actions'] .= Display::div('', array('id' => 'document_result_'.$course_info['real_id'].'_'.$course_info['id_session'], 'class'=>'document_preview_container'));
$params['right_actions'] .= '</div>';
$params['right_actions'] .= Display::div('', array('id' => 'document_result_'.$course_info['real_id'].'_'.$course_info['id_session'], 'class'=>'document_preview_container'));
}
if (api_get_setting('display_coursecode_in_courselist') == 'true') {
@ -3187,7 +3160,7 @@ class CourseManager {
$params['title'] = $session_title;
$params['extra'] = '';
$html = self::course_item_html($params);
$html = self::course_item_html($params, true);
$session_category_id = null;
if (api_get_setting('use_session_mode') == 'true' && !$nosession) {

@ -714,15 +714,26 @@ class Display {
if ($show_blank_item) {
$html .= self::tag('option', '-- '.get_lang('Select').' --', array('value'=>'-1'));
}
if($values) {
foreach($values as $key => $value) {
if ($values) {
foreach ($values as $key => $value) {
if(is_array($value) && isset($value['name'])) {
$value = $value['name'];
}
$html .= '<option value="'.$key.'"';
if($default == $key) {
$html .= 'selected="selected"';
if (is_array($default)) {
foreach($default as $item) {
if ($item == $key) {
$html .= 'selected="selected"';
break;
}
}
} else {
if ($default == $key) {
$html .= 'selected="selected"';
}
}
$html .= '>'.$value.'</option>';
}
}

@ -3386,6 +3386,7 @@ function api_plugin($location) {
include api_get_path(SYS_PLUGIN_PATH)."$this_plugin/index.php";
}
}
return false;
}
/**
@ -3393,7 +3394,7 @@ function api_plugin($location) {
* @return boolean true if the plugin is installed, false otherwise.
*/
function api_is_plugin_installed($plugin_list, $plugin_name) {
if(is_array($plugin_list)) {
if (is_array($plugin_list)) {
foreach ($plugin_list as $plugin_location) {
if (array_search($plugin_name, $plugin_location) !== false) { return true; }
}

@ -0,0 +1,91 @@
<?php
/* See license terms in /license.txt */
class AppPlugin {
var $plugin_list = array (
// 'loginpage_main',
'login',
'menu',
/* 'campushomepage_main',
'campushomepage_menu',
'mycourses_main',
'mycourses_menu',*/
'content_top',
'content_bottom',
'header_main',
'header_center',
'header_left',
'header_right',
//'footer',
'footer_left',
'footer_center',
'footer_right',
'course_tool_plugin'
);
function __construct() {
}
/* For each of the possible plugin directories we check whether a file named "plugin.php" exists
(it contains all the needed information about this plugin).
This "plugin.php" file looks like:
$plugin_info['title'] = 'The title of the plugin';
$plugin_info['comment'] = 'Some comment about the plugin';
$plugin_info['location'] = array('loginpage_menu', 'campushomepage_menu', 'banner'); // The possible locations where the plugins can be used.
$plugin_info['version'] = '0.1 alpha'; // The version number of the plugin.
$plugin_info['author'] = 'Patrick Cool'; // The author of the plugin.
*/
function read_plugins_from_path() {
/* We scan the plugin directory. Each folder is a potential plugin. */
$pluginpath = api_get_path(SYS_PLUGIN_PATH);
$possible_plugins = array();
$handle = @opendir($pluginpath);
while (false !== ($file = readdir($handle))) {
if ($file != '.' && $file != '..' && is_dir(api_get_path(SYS_PLUGIN_PATH).$file)) {
$possible_plugins[] = $file;
}
}
@closedir($handle);
sort($possible_plugins);
return $possible_plugins;
}
function get_installed_plugins() {
$usedplugins = array();
/* We retrieve all the active plugins. */
$result = api_get_settings('Plugins');
foreach ($result as $row) {
$usedplugins[$row['variable']][] = $row['selected_value'];
}
return $usedplugins;
}
function get_areas_by_plugin($plugin_name) {
$result = api_get_settings('Plugins');
$areas = array();
foreach ($result as $row) {
if ($plugin_name == $row['selected_value']) {
$areas[] = $row['variable'];
}
}
return $areas;
}
function is_valid_plugin_location($location) {
return in_array($location, $this->plugin_list);
}
function is_valid_plugin($plugin_name) {
if (is_dir(api_get_path(SYS_PLUGIN_PATH).$plugin_name)) {
if (is_file(api_get_path(SYS_PLUGIN_PATH).$plugin_name.'/index.php')) {
return true;
}
}
return false;
}
function get_plugin_list() {
sort($this->plugin_list);
return $this->plugin_list;
}
}

@ -10,6 +10,7 @@
// Load Smarty library
require_once api_get_path(LIBRARY_PATH).'smarty/Smarty.class.php';
require_once api_get_path(LIBRARY_PATH).'banner.lib.php';
require_once api_get_path(LIBRARY_PATH).'plugin.lib.php';
class Template extends Smarty {
@ -28,6 +29,7 @@ class Template extends Smarty {
$this->title = $title;
//$this->assign('header', $title);
$this->show_learnpath = $show_learnpath;
//Smarty 3 configuration
$this->setTemplateDir(api_get_path(SYS_CODE_PATH).'template/');
$this->setCompileDir(api_get_path(SYS_ARCHIVE_PATH));
@ -68,6 +70,12 @@ class Template extends Smarty {
$this->set_footer_parameters();
$this->assign('style', $this->style);
//Chamilo plugins
$plugin = new AppPlugin();
foreach($plugin->plugin_list as $plugin) {
$this->set_plugin($plugin);
}
}
function set_help($help_input = null) {
@ -259,22 +267,13 @@ class Template extends Smarty {
$header1 = show_header_1($language_file, $nameTools, $this->theme);
$this->assign('header1', $header1);
ob_start();
echo '<div id="plugin-header">';
api_plugin('header');
echo '</div>';
ob_clean();
$plugin_header = ob_get_contents();
$this->assign('plugin_header', $plugin_header);
}
private function set_header_parameters() {
$help = $this->help;
$nameTools = $this->title;
global $_plugins, $lp_theme_css, $mycoursetheme, $user_theme;
global $httpHeadXtra, $htmlHeadXtra, $_course, $_user, $text_dir, $plugins, $_user,
global $lp_theme_css, $mycoursetheme, $user_theme;
global $httpHeadXtra, $htmlHeadXtra, $_course, $_user, $text_dir, $_user,
$_cid, $interbreadcrumb, $charset, $language_file, $noPHP_SELF;
$navigation = return_navigation_array();
@ -465,16 +464,7 @@ class Template extends Smarty {
}
private function set_footer_parameters() {
//Footer plugin
global $_plugins, $_configuration;
ob_start();
api_plugin('footer');
$plugin_footer = ob_get_contents();
ob_clean();
//Plugin footer
$this->assign('plugin_footer', $plugin_footer);
global $_configuration;
//Show admin data
//$this->assign('show_administrator_data', api_get_setting('show_administrator_data'));
@ -544,8 +534,7 @@ class Template extends Smarty {
}
}
}
}
$teacher_data .= '</div>';
}
$this->assign('teachers', $teacher_data);
}
}
@ -563,4 +552,19 @@ class Template extends Smarty {
$tpl = $this->get_template('layout/show_footer.tpl');
$this->display($tpl);
}
}
/* Sets the plugin content in a Smarty variable */
function set_plugin($plugin_name) {
if (!empty($plugin_name)) {
if (api_number_of_plugins($plugin_name) > 0) {
ob_start();
api_plugin($plugin_name);
$plugin_content = ob_get_contents();
ob_end_clean();
}
$this->assign('plugin_'.$plugin_name, $plugin_content);
//return $plugin_content;
}
return null;
}
}

@ -5,7 +5,6 @@ require_once api_get_path(LIBRARY_PATH).'system_announcements.lib.php';
require_once api_get_path(LIBRARY_PATH).'groupmanager.lib.php';
require_once api_get_path(SYS_CODE_PATH).'survey/survey.lib.php';
class IndexManager {
var $tpl = false; //An instance of the template engine
var $name = '';
@ -25,8 +24,7 @@ class IndexManager {
if (api_get_setting('show_documents_preview') == 'true') {
$this->load_directories_preview = true;
}
}
}
function set_login_form() {
global $loginFailed;
@ -54,16 +52,6 @@ class IndexManager {
$login_form .= '</ul>';
}
$this->tpl->assign('login_options', $login_form);
if (api_number_of_plugins('loginpage_menu') > 0) {
$login_form = '<div class="note" style="background: none">';
ob_start();
api_plugin('loginpage_menu');
$plugin_login = ob_get_contents();
$login_form .= $plugin_login;
$login_form .= '</div>';
$this->tpl->assign('login_plugin_menu', $login_form);
}
}
}
@ -215,23 +203,16 @@ class IndexManager {
* @todo does $_plugins need to be global?
*/
function display_anonymous_right_menu() {
global $loginFailed, $_plugins, $_user;
global $loginFailed, $_user;
$platformLanguage = api_get_setting('platformLanguage');
$display_add_course_link = api_is_allowed_to_create_course() && ($_SESSION['studentview'] != 'studentenview');
$current_user_id = api_get_user_id();
echo self::set_login_form(false);
echo self::return_teacher_link();
echo self::return_notice();
//Plugin
echo self::return_plugin_campushomepage();
}
echo self::set_login_form(false);
echo self::return_teacher_link();
echo self::return_notice();
}
function return_teacher_link() {
$html = '';
@ -380,7 +361,7 @@ class IndexManager {
return $html;
}
function return_plugin_campushomepage() {
/*function return_plugin_campushomepage() {
$html = '';
if (api_get_user_id() && api_number_of_plugins('campushomepage_menu') > 0) {
ob_start();
@ -390,7 +371,7 @@ class IndexManager {
$html = self::show_right_block('', $plugin_content);
}
return $html;
}
}*/
function return_skills_links() {
$content = '<ul class="menulist">';
@ -753,15 +734,13 @@ class IndexManager {
}
function return_search_block() {
$html = '';
$html = '';
if (api_get_setting('search_enabled') == 'true') {
$html .= '<div class="searchbox">';
$search_btn = get_lang('Search');
$search_text_default = get_lang('YourTextHere');
$search_btn = get_lang('Search');
$search_content = '<br />
<form action="main/search/" method="post">
<input type="text" id="query" size="15" name="query" value="" />
<input type="text" id="query" class="span2" name="query" value="" />
<button class="save" type="submit" name="submit" value="'.$search_btn.'" />'.$search_btn.' </button>
</form></div>';
$html .= self::show_right_block(get_lang('Search'), $search_content);
@ -805,18 +784,6 @@ class IndexManager {
return $html;
}
function return_plugin_courses_block() {
global $_plugins;
// Plugins for the my courses menu.
if (isset($_plugins['mycourses_menu']) && is_array($_plugins['mycourses_menu'])) {
ob_start();
api_plugin('mycourses_menu');
$plugin_content = ob_get_contents();
ob_end_clean();
echo self::show_right_block('', $plugin_content);
}
}
function return_profile_block() {
$html = '';
$user_id = api_get_user_id();
@ -977,16 +944,6 @@ class IndexManager {
return $html;
}
function return_courses_main_plugin() {
ob_start();
echo '<div id="plugin-mycourses_main">';
api_plugin('mycourses_main');
echo '</div>';
$plugin_content = ob_get_contents();
ob_end_clean();
return $plugin_content;
}
/**
* The most important function here, prints the session and course list
*
@ -1097,7 +1054,7 @@ class IndexManager {
if (api_get_setting('hide_courses_in_sessions') == 'false') {
// $params['extra'] .= $html_courses_session;
}
$html .= CourseManager::course_item_parent(CourseManager::course_item_html($params), $html_courses_session);
$html .= CourseManager::course_item_parent(CourseManager::course_item_html($params, true), $html_courses_session);
}
}
} else {
@ -1145,7 +1102,7 @@ class IndexManager {
if (api_is_platform_admin()) {
$params['right_actions'] .= '<a href="'.api_get_path(WEB_CODE_PATH).'admin/resume_session.php?id_session='.$session['details']['id'].'">'.Display::return_icon('edit.png', get_lang('Edit'), array('align' => 'absmiddle'),22).'</a>';
}
$html_sessions .= CourseManager::course_item_html($params).$html_courses_session;
$html_sessions .= CourseManager::course_item_html($params, true).$html_courses_session;
}
}
@ -1162,7 +1119,7 @@ class IndexManager {
if ($category['details']['date_end'] != '0000-00-00') {
$params['title'] .= sprintf(get_lang('FromDateXToDateY'),$category['details']['date_start'], $category['details']['date_end']);
}
$html .= CourseManager::course_item_parent(CourseManager::course_item_html($params), $html_sessions);
$html .= CourseManager::course_item_parent(CourseManager::course_item_html($params, true), $html_sessions);
}
}
}

@ -1,39 +1,63 @@
<div id="footer"> <!-- start of #footer section -->
<div class="container">
<div class="copyright">
{if $administrator_name }
<div class="admin_name">
{$administrator_name}
</div>
{/if}
<div class="software_name">
{"Platform"|get_lang} <a href="{$_p.web}" target="_blank">{$_s.software_name} {$_s.system_version}</a>
&copy; {$smarty.now|date_format:"%Y"}
</div>
</div>
<div class="container">
<div class="row">
<div id="footer_left" class="span4">
{if $session_teachers}
<div id="session_teachers">
{$session_teachers}
</div>
{/if}
{if $teachers }
<div id="teachers">
{$teachers}
</div>
{/if}
{* Plugins for footer section *}
{if !empty($plugin_footer_left)}
<div id="plugin_footer_left">
{$plugin_footer_left}
</div>
{/if}
&nbsp;
</div>
<div class="footer_emails">
{if $session_teachers}
<div class="session_teachers">
{$session_teachers}
</div>
{/if}
<div id="footer_center" class="span4">
{* Plugins for footer section *}
{if !empty($plugin_footer_center)}
<div id="plugin_footer_center">
{$plugin_footer_center}
</div>
{else}
&nbsp;
{/if}
</div>
{if $teachers }
<div class="teachers">
{$teachers}
<div id="footer_right" class="span4">
{if $administrator_name }
<div id="admin_name">
{$administrator_name}
</div>
{/if}
<div id="software_name">
{"Platform"|get_lang} <a href="{$_p.web}" target="_blank">{$_s.software_name} {$_s.system_version}</a>
&copy; {$smarty.now|date_format:"%Y"}
</div>
{/if}
{* Plugins for footer section *}
<div id="plugin-footer">
{$plugin_footer}
</div>
<div style="clear:both"></div>
</div>
{* Plugins for footer section *}
{if !empty($plugin_footer_right)}
<div id="plugin_footer_right">
{$plugin_footer_right}
</div>
{/if}
&nbsp;
</div><!-- end of #footer_right -->
</div><!-- end of #row -->
</div><!-- end of #container -->
</div><!-- end of #footer -->
{$footer_extra_content}
{literal}
<script type="text/javascript">
$(document).ready( function() {

@ -5,16 +5,25 @@
{include file="default/layout/main_header.tpl"}
{/if}
{/block}
{* 1 column *}
{block name=body}
<div class="span12">
{include file="default/layout/page_body.tpl"}
{if !empty($plugin_content_top)}
<div id="plugin_content_top">
{$plugin_content_top}
</div>
{/if}
{include file="default/layout/page_body.tpl"}
<section id="main_content">
{* Main content *}
{$content}
{$content}
</section>
{if !empty($plugin_content_bottom)}
<div class="clear"></div>
<div id="plugin_content_bottom">
{$plugin_content_bottom}
</div>
{/if}
</div>
{/block}

@ -15,10 +15,13 @@
{/if}
<div class="span9">
{* Course plugin block*}
<section id="courses_plugin">
{$plugin_courses_block}
</section>
{* Content top*}
{if !empty($plugin_content_top)}
<div id="plugin_content_top">
{$plugin_content_top}
</div>
{/if}
{* ?? *}
<section id="home_page">
@ -28,10 +31,7 @@
{* ?? *}
{$sniff_notification}
{* Show messages*}
<section id="messages">
{$message}
</section>
{include file="default/layout/page_body.tpl"}
{* Main content*}
<section id="main_content">
@ -50,6 +50,11 @@
&nbsp;
</section>
{if !empty($plugin_content_bottom)}
<div id="plugin_content_bottom">
{$plugin_content_bottom}
</div>
{/if}
</div>
{* Right column *}
@ -71,9 +76,6 @@
{* Links that are not added in the tabs*}
{$navigation_course_links}
{* Plugin courses sidebar *}
{$plugin_courses_right_block}
{* Reservation block *}
{$reservation_block}
@ -84,7 +86,15 @@
{$classes_block}
{* Skills*}
{$skills_block}
{$skills_block}
{* Plugin courses sidebar *}
{* Plugins for footer section *}
{if !empty($plugin_menu)}
<div id="plugin_menu">
{$plugin_menu}
</div>
{/if}
</div>
{/block}

@ -7,6 +7,11 @@
{$login_language_form}
{$login_form}
{$login_failed}
{$login_options}
{$login_plugin_menu}
{$login_options}
{if !empty($plugin_login)}
<div id="plugin_login">
{$plugin_login}
</div>
{/if}
</div>

@ -9,7 +9,6 @@
</head>
<body dir="{$text_direction}" class="{$section_name}">
<noscript>{"NoJavascript"|get_lang}</noscript>
{if $show_header}
<div class="skip">
<ul>
@ -29,18 +28,51 @@
{include file="default/layout/topbar.tpl"}
<div id="main" class="container">
<header>
{* header1 - logo *}
<div id="header1">
{$header1}
</div>
{$plugin_header}
{* header 2 - right menu (notifications) *}
<div id="header2">
<ul class="nav nav-pills">
{$header2}
</ul>
<header>
<div class="row">
{* header1 - logo *}
<div id="header_left" class="span4">
{$header1}
{* plugin_header *}
{if !empty($plugin_header_left)}
<div id="plugin_header_left">
{$plugin_header_left}
</div>
{/if}
</div>
<div id="header_center" class="span4">
{* plugin_header *}
{if !empty($plugin_header_center)}
<div id="plugin_header_center">
{$plugin_header_center}
</div>
{/if}
&nbsp;
</div>
{* header right (notifications) *}
<div id="header_right" class="span4">
<ul class="nav nav-pills pull-right">
{$header2}
</ul>
{* plugin_header *}
{if !empty($plugin_header_right)}
<div id="plugin_header_right">
{$plugin_header_right}
</div>
{/if}
&nbsp;
</div>
{if !empty($plugin_header_main)}
<div id="plugin_header_main">
{$plugin_header_main}
</div>
{/if}
</div>
</header>

@ -9,8 +9,10 @@
{if !empty($header) }
<div class="page-header">
<h1>{$header}</h1>
</div>
</div>
{/if}
{* Notifications*}
{$message}
{* Show messages*}
<section id="messages">
{$message}
</section>

@ -12,10 +12,7 @@
$plugin_info['title']='Date';
//the comments that go with the plugin
$plugin_info['comment']="Multinational date display";
//the locations where this plugin can be shown
$plugin_info['location']=array('loginpage_main', 'loginpage_menu', 'campushomepage_main', 'campushomepage_menu', 'mycourses_main', 'mycourses_menu', 'header', 'footer');
//the plugin version
$plugin_info['version']='1.0';
//the plugin author
$plugin_info['author']='Yannick Warnier';
?>
$plugin_info['author']='Yannick Warnier';

@ -178,11 +178,9 @@ if(!empty($some_activex) || !empty($some_plugins)){
}
}
$controller->tpl->assign('plugin_courses_block', $controller->return_courses_main_plugin());
$controller->tpl->assign('profile_block', $controller->return_profile_block());
$controller->tpl->assign('account_block', $controller->return_account_block());
$controller->tpl->assign('navigation_course_links', $controller->return_navigation_course_links());
$controller->tpl->assign('plugin_courses_right_block', $controller->return_plugin_courses_block());
$controller->tpl->assign('reservation_block', $controller->return_reservation_block());
$controller->tpl->assign('search_block', $controller->return_search_block());
$controller->tpl->assign('classes_block', $controller->return_classes_block());

Loading…
Cancel
Save