Merge branch '1.9.x' of github.com:chamilo/chamilo-lms into 1.9.x

1.9.x
Alex 12 years ago
commit e8f9394f04
  1. 4
      main/admin/access_url_edit.php
  2. 24
      main/dashboard/block.class.php
  3. 15
      main/dropbox/dropbox_download.php
  4. 48
      main/dropbox/dropbox_functions.inc.php
  5. 12
      main/inc/lib/main_api.lib.php
  6. 2
      main/inc/lib/urlmanager.lib.php
  7. 10
      plugin/add_cas_login_button/index.php
  8. 2
      plugin/add_cas_login_button/plugin.php
  9. 5
      plugin/add_cas_logout_button/index.php
  10. 11
      plugin/add_facebook_login_button/plugin.php
  11. 34
      plugin/add_shibboleth_login_button/plugin.php
  12. 2
      plugin/before_login/index.php
  13. 73
      plugin/dashboard/block_course/block_course.class.php
  14. 86
      plugin/dashboard/block_daily/block_daily.class.php
  15. 37
      plugin/dashboard/block_evaluation_graph/block_evaluation_graph.class.php
  16. 11
      plugin/dashboard/block_global_info/block_global_info.class.php
  17. 25
      plugin/dashboard/block_session/block_session.class.php
  18. 24
      plugin/dashboard/block_student/block_student.class.php
  19. 27
      plugin/dashboard/block_student_graph/block_student_graph.class.php
  20. 41
      plugin/dashboard/block_teacher/block_teacher.class.php
  21. 37
      plugin/dashboard/block_teacher_graph/block_teacher_graph.class.php
  22. 2
      plugin/date/plugin.php
  23. 5
      plugin/ext_auth_chamilo_logout_button_behaviour/index.php
  24. 1
      plugin/ext_auth_chamilo_logout_button_behaviour/plugin.php
  25. 2
      plugin/formLogin_hide_unhide/plugin.php
  26. 11
      plugin/jcapture/.settings/org.eclipse.jdt.core.prefs
  27. 28
      plugin/jcapture/action.php
  28. 1
      plugin/rss/plugin.php
  29. 1
      plugin/show_user_info/index.php
  30. 2
      plugin/static/index.php
  31. 1
      plugin/static/lib/static_plugin.class.php
  32. 2
      plugin/ticket/start.php
  33. 4
      tests/main/inc/lib/urlmanager.lib.test.php

@ -37,9 +37,9 @@ if ($form->validate()) {
} }
//checking url //checking url
if (substr($url, strlen($url)-1, strlen($url)) == '/') { if (substr($url, strlen($url)-1, strlen($url)) == '/') {
UrlManager::udpate($url_id, $url, $description, $active); UrlManager::update($url_id, $url, $description, $active);
} else { } else {
UrlManager::udpate($url_id, $url.'/', $description, $active); UrlManager::update($url_id, $url.'/', $description, $active);
} }
// URL Images // URL Images
$url_images_dir = api_get_path(SYS_PATH).'custompages/url-images/'; $url_images_dir = api_get_path(SYS_PATH).'custompages/url-images/';

@ -12,28 +12,38 @@
* @package chamilo.dashboard * @package chamilo.dashboard
*/ */
class Block { class Block
{
/** /**
* Contructor * Contructor
*/ */
public function __construct() {} public function __construct()
{
}
/** /**
* Display small blocks, @todo it will be implemented for next version * Display small blocks, @todo it will be implemented for next version
*/ */
public function display_small() {} public function display_small()
{
}
/** /**
* Display larges blocks, @todo it will be implemented for next version * Display larges blocks, @todo it will be implemented for next version
*/ */
public function display_large() {} public function display_large()
{
public function get_block_path(){ }
public function get_block_path()
{
$result = get_class($this); $result = get_class($this);
return $result; return $result;
} }
} }
?> ?>

@ -26,10 +26,13 @@ require_once api_get_path(LIBRARY_PATH).'document.lib.php';
/* DOWNLOAD A FOLDER */ /* DOWNLOAD A FOLDER */
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
$user_id = api_get_user_id(); $user_id = api_get_user_id();
if (isset($_GET['cat_id']) AND is_numeric($_GET['cat_id']) AND $_GET['action'] == 'downloadcategory' AND isset($_GET['sent_received'])) { if (isset($_GET['cat_id']) AND
is_numeric($_GET['cat_id']) AND
$_GET['action'] == 'downloadcategory' AND
isset($_GET['sent_received'])
) {
/** step 1: constructing the sql statement. /** step 1: constructing the sql statement.
Due to the nature off the classes of the dropbox the categories for sent files are stored in the table Due to the nature off the classes of the dropbox the categories for sent files are stored in the table
dropbox_file while the categories for the received files are stored in dropbox_post. dropbox_file while the categories for the received files are stored in dropbox_post.
@ -40,7 +43,8 @@ if (isset($_GET['cat_id']) AND is_numeric($_GET['cat_id']) AND $_GET['action'] =
if ($_GET['sent_received'] == 'sent') { if ($_GET['sent_received'] == 'sent') {
// here we also incorporate the person table to make sure that deleted sent documents are not included. // here we also incorporate the person table to make sure that deleted sent documents are not included.
$sql = "SELECT DISTINCT file.id, file.filename, file.title $sql = "SELECT DISTINCT file.id, file.filename, file.title
FROM ".$dropbox_cnf['tbl_file']." file INNER JOIN ".$dropbox_cnf['tbl_person']." person FROM ".$dropbox_cnf['tbl_file']." file
INNER JOIN ".$dropbox_cnf['tbl_person']." person
ON (person.file_id=file.id AND file.c_id = $course_id AND person.c_id = $course_id) ON (person.file_id=file.id AND file.c_id = $course_id AND person.c_id = $course_id)
WHERE WHERE
file.uploader_id = $user_id AND file.uploader_id = $user_id AND
@ -50,7 +54,8 @@ if (isset($_GET['cat_id']) AND is_numeric($_GET['cat_id']) AND $_GET['action'] =
if ($_GET['sent_received'] == 'received') { if ($_GET['sent_received'] == 'received') {
$sql = "SELECT DISTINCT file.id, file.filename, file.title $sql = "SELECT DISTINCT file.id, file.filename, file.title
FROM ".$dropbox_cnf['tbl_file']." file INNER JOIN ".$dropbox_cnf['tbl_person']." person FROM ".$dropbox_cnf['tbl_file']." file
INNER JOIN ".$dropbox_cnf['tbl_person']." person
ON (person.file_id=file.id AND file.c_id = $course_id AND person.c_id = $course_id) ON (person.file_id=file.id AND file.c_id = $course_id AND person.c_id = $course_id)
INNER JOIN ".$dropbox_cnf['tbl_post']." post INNER JOIN ".$dropbox_cnf['tbl_post']." post
ON (post.file_id = file.id AND post.c_id = $course_id AND file.c_id = $course_id) ON (post.file_id = file.id AND post.c_id = $course_id AND file.c_id = $course_id)
@ -58,7 +63,7 @@ if (isset($_GET['cat_id']) AND is_numeric($_GET['cat_id']) AND $_GET['action'] =
post.cat_id = ".intval($_GET['cat_id'])." AND post.cat_id = ".intval($_GET['cat_id'])." AND
post.dest_user_id = $user_id" ; post.dest_user_id = $user_id" ;
} }
$files_to_download = array();
$result = Database::query($sql); $result = Database::query($sql);
while ($row = Database::fetch_array($result)) { while ($row = Database::fetch_array($result)) {
$files_to_download[] = $row['id']; $files_to_download[] = $row['id'];

@ -1035,7 +1035,7 @@ function store_feedback()
/** /**
* This function downloads all the files of the input array into one zip * This function downloads all the files of the input array into one zip
* @param $array an array containing all the ids of the files that have to be downloaded. * @param array $fileList containing all the ids of the files that have to be downloaded.
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
* @todo consider removing the check if the user has received or sent this file (zip download of a folder already sufficiently checks for this). * @todo consider removing the check if the user has received or sent this file (zip download of a folder already sufficiently checks for this).
* @todo integrate some cleanup function that removes zip files that are older than 2 days * @todo integrate some cleanup function that removes zip files that are older than 2 days
@ -1044,34 +1044,52 @@ function store_feedback()
* @author Julio Montoya Addin c_id support * @author Julio Montoya Addin c_id support
* @version march 2006 * @version march 2006
*/ */
function zip_download($array) { function zip_download($fileList)
{
$_course = api_get_course_info(); $_course = api_get_course_info();
$dropbox_cnf = getDropboxConf(); $dropbox_cnf = getDropboxConf();
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
$array = array_map('intval', $array); $fileList = array_map('intval', $fileList);
// note: we also have to add the check if the user has received or sent this file. // note: we also have to add the check if the user has received or sent this file.
$sql = "SELECT DISTINCT file.filename, file.title, file.author, file.description $sql = "SELECT DISTINCT file.filename, file.title, file.author, file.description
FROM ".$dropbox_cnf['tbl_file']." file INNER JOIN ".$dropbox_cnf['tbl_person']." person FROM ".$dropbox_cnf['tbl_file']." file
INNER JOIN ".$dropbox_cnf['tbl_person']." person
ON (person.file_id=file.id AND file.c_id = $course_id AND person.c_id = $course_id) ON (person.file_id=file.id AND file.c_id = $course_id AND person.c_id = $course_id)
INNER JOIN ".$dropbox_cnf['tbl_post']." post INNER JOIN ".$dropbox_cnf['tbl_post']." post
ON (post.file_id = file.id AND post.c_id = $course_id AND file.c_id = $course_id) ON (post.file_id = file.id AND post.c_id = $course_id AND file.c_id = $course_id)
WHERE file.id IN (".implode(', ',$array).") AND WHERE
file.id IN (".implode(', ', $fileList).") AND
file.id = person.file_id AND file.id = person.file_id AND
(person.user_id = '".api_get_user_id()."' OR post.dest_user_id = '".api_get_user_id()."' ) "; (
person.user_id = '".api_get_user_id()."' OR
post.dest_user_id = '".api_get_user_id()."'
) ";
$result = Database::query($sql); $result = Database::query($sql);
$files = array(); $files = array();
while ($row = Database::fetch_array($result)) { while ($row = Database::fetch_array($result)) {
$files[$row['filename']] = array('filename' => $row['filename'],'title' => $row['title'], 'author' => $row['author'], 'description' => $row['description']); $files[$row['filename']] = array(
'filename' => $row['filename'],
'title' => $row['title'],
'author' => $row['author'],
'description' => $row['description']
);
} }
// Step 3: create the zip file and add all the files to it // Step 3: create the zip file and add all the files to it
$temp_zip_file = api_get_path(SYS_ARCHIVE_PATH).api_get_unique_id().".zip"; $temp_zip_file = api_get_path(SYS_ARCHIVE_PATH).api_get_unique_id().".zip";
$zip_folder = new PclZip($temp_zip_file); Session::write('dropbox_files_to_download', $files);
$zip = new PclZip($temp_zip_file);
foreach ($files as $value) { foreach ($files as $value) {
$zip_folder->add(api_get_path(SYS_COURSE_PATH).$_course['path'].'/dropbox/'.$value['filename'], PCLZIP_OPT_REMOVE_ALL_PATH, PCLZIP_CB_PRE_ADD, 'my_pre_add_callback'); $zip->add(
api_get_path(SYS_COURSE_PATH).$_course['path'].'/dropbox/'.$value['filename'],
PCLZIP_OPT_REMOVE_ALL_PATH,
PCLZIP_CB_PRE_ADD,
'my_pre_add_callback'
);
} }
Session::erase('dropbox_files_to_download');
$name = 'dropbox-'.api_get_utc_datetime().'.zip'; $name = 'dropbox-'.api_get_utc_datetime().'.zip';
DocumentManager::file_send_for_download($temp_zip_file, true, $name); DocumentManager::file_send_for_download($temp_zip_file, true, $name);
@unlink($temp_zip_file); @unlink($temp_zip_file);
@ -1080,19 +1098,19 @@ function zip_download($array) {
/** /**
* This is a callback function to decrypt the files in the zip file to their normal filename (as stored in the database) * This is a callback function to decrypt the files in the zip file to their normal filename (as stored in the database)
* @param $p_event a variable of PCLZip * @param array $p_event a variable of PCLZip
* @param $p_header a variable of PCLZip * @param array $p_header a variable of PCLZip
* *
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
* @version march 2006 * @version march 2006
*/ */
function my_pre_add_callback($p_event, &$p_header) { function my_pre_add_callback($p_event, &$p_header)
global $files; {
$files = Session::read('dropbox_files_to_download');
$p_header['stored_filename'] = $files[$p_header['stored_filename']]['title']; $p_header['stored_filename'] = $files[$p_header['stored_filename']]['title'];
return 1; return 1;
} }
/** /**
* @desc Generates the contents of a html file that gives an overview of all the files in the zip file. * @desc Generates the contents of a html file that gives an overview of all the files in the zip file.
* This is to know the information of the files that are inside the zip file (who send it, the comment, ...) * This is to know the information of the files that are inside the zip file (who send it, the comment, ...)

@ -881,7 +881,7 @@ function api_valid_email($address) {
* @author Roan Embrechts * @author Roan Embrechts
*/ */
function api_protect_course_script($print_headers = false, $allow_session_admins = false, $allow_drh = false) { function api_protect_course_script($print_headers = false, $allow_session_admins = false, $allow_drh = false) {
global $is_allowed_in_course; $is_allowed_in_course = api_is_allowed_in_course();
$is_visible = false; $is_visible = false;
if (api_is_drh()) { if (api_is_drh()) {
@ -966,7 +966,7 @@ function api_protect_admin_script($allow_sessions_admins = false, $allow_drh = f
* @author Roan Embrechts * @author Roan Embrechts
*/ */
function api_block_anonymous_users($print_headers = true) { function api_block_anonymous_users($print_headers = true) {
global $_user; $_user = api_get_user_info();
if (!(isset($_user['user_id']) && $_user['user_id']) || api_is_anonymous($_user['user_id'], true)) { if (!(isset($_user['user_id']) && $_user['user_id']) || api_is_anonymous($_user['user_id'], true)) {
api_not_allowed($print_headers); api_not_allowed($print_headers);
return false; return false;
@ -1403,7 +1403,6 @@ function api_get_course_info_by_id($id = null) {
} }
return $_course; return $_course;
} }
//global $_course;
global $_course; global $_course;
if ($_course == '-1') $_course = array(); if ($_course == '-1') $_course = array();
return $_course; return $_course;
@ -2701,8 +2700,8 @@ function api_display_debug_info($debug_info) {
* @return boolean, true: the user has the rights to edit, false: he does not * @return boolean, true: the user has the rights to edit, false: he does not
*/ */
function api_is_allowed_to_edit($tutor = false, $coach = false, $session_coach = false, $check_student_view = true) { function api_is_allowed_to_edit($tutor = false, $coach = false, $session_coach = false, $check_student_view = true)
{
$my_session_id = api_get_session_id(); $my_session_id = api_get_session_id();
$is_allowed_coach_to_edit = api_is_coach(); $is_allowed_coach_to_edit = api_is_coach();
$session_visibility = api_get_session_visibility($my_session_id); $session_visibility = api_get_session_visibility($my_session_id);
@ -5663,7 +5662,8 @@ function api_global_admin_can_edit_admin($admin_id_to_check, $my_user_id = null,
} }
} }
function api_protect_super_admin($admin_id_to_check, $my_user_id = null, $allow_session_admin = false) { function api_protect_super_admin($admin_id_to_check, $my_user_id = null, $allow_session_admin = false)
{
if (api_global_admin_can_edit_admin($admin_id_to_check, $my_user_id, $allow_session_admin)) { if (api_global_admin_can_edit_admin($admin_id_to_check, $my_user_id, $allow_session_admin)) {
return true; return true;
} else { } else {

@ -44,7 +44,7 @@ class UrlManager
* @param int is active or not * @param int is active or not
* @return boolean if success * @return boolean if success
*/ */
public static function udpate($url_id, $url, $description, $active) public static function update($url_id, $url, $description, $active)
{ {
$url_id = intval($url_id); $url_id = intval($url_id);
$table_access_url= Database :: get_main_table(TABLE_MAIN_ACCESS_URL); $table_access_url= Database :: get_main_table(TABLE_MAIN_ACCESS_URL);

@ -1,6 +1,6 @@
<?php <?php
// Show the CAS button to login using CAS // Show the CAS button to login using CAS
require_once(api_get_path(SYS_PATH).'main/auth/cas/authcas.php'); require_once api_get_path(SYS_PATH).'main/auth/cas/authcas.php';
$_template['show_message'] = false; $_template['show_message'] = false;
@ -11,10 +11,14 @@ if (api_is_anonymous()) {
// the default title // the default title
$button_label = "Connexion via CAS"; $button_label = "Connexion via CAS";
if (!empty($plugin_info['settings']['add_cas_login_button_cas_button_label'])) { if (!empty($plugin_info['settings']['add_cas_login_button_cas_button_label'])) {
$button_label = api_htmlentities($plugin_info['settings']['add_cas_login_button_cas_button_label']); $button_label = api_htmlentities(
$plugin_info['settings']['add_cas_login_button_cas_button_label']
);
} }
// the comm // the comm
$comm_label = api_htmlentities($plugin_info['settings']['add_cas_login_button_cas_button_comment']);; $comm_label = api_htmlentities(
$plugin_info['settings']['add_cas_login_button_cas_button_comment']
);;
// URL of the image // URL of the image
$url_label = $plugin_info['settings']['add_cas_login_button_cas_image_url']; $url_label = $plugin_info['settings']['add_cas_login_button_cas_image_url'];

@ -9,8 +9,6 @@
* Plugin details (must be present) * Plugin details (must be present)
*/ */
//the plugin title //the plugin title
$plugin_info['title'] = 'Add a button to login using CAS'; $plugin_info['title'] = 'Add a button to login using CAS';

@ -3,7 +3,10 @@
global $_user; global $_user;
$_template['show_message'] = false; $_template['show_message'] = false;
if (!api_is_anonymous() && api_get_setting('cas_activate') == 'true' && $_user['auth_source'] == CAS_AUTH_SOURCE) { if (!api_is_anonymous() &&
api_get_setting('cas_activate') == 'true' &&
$_user['auth_source'] == CAS_AUTH_SOURCE
) {
$_template['show_message'] = true; $_template['show_message'] = true;
// the default title // the default title
$logout_label = "Deconnexion de CAS"; $logout_label = "Deconnexion de CAS";

@ -20,10 +20,17 @@ $plugin_info['version'] = '1.0';
$plugin_info['author'] = 'Hubert Borderiou'; $plugin_info['author'] = 'Hubert Borderiou';
//the plugin configuration //the plugin configuration
$form = new FormValidator('add_facebook_button_form'); $form = new FormValidator('add_facebook_button_form');
$form->addElement('text', 'facebook_button_url', 'Facebook connexion image URL', ''); $form->addElement(
'text',
'facebook_button_url',
'Facebook connexion image URL',
''
);
$form->addElement('style_submit_button', 'submit_button', get_lang('Save')); $form->addElement('style_submit_button', 'submit_button', get_lang('Save'));
//get default value for form //get default value for form
$tab_default_add_facebook_login_button_facebook_button_url = api_get_setting('add_facebook_login_button_facebook_button_url'); $tab_default_add_facebook_login_button_facebook_button_url = api_get_setting(
'add_facebook_login_button_facebook_button_url'
);
$defaults['facebook_button_url'] = $tab_default_add_facebook_login_button_facebook_button_url['add_facebook_login_button']; $defaults['facebook_button_url'] = $tab_default_add_facebook_login_button_facebook_button_url['add_facebook_login_button'];
$form->setDefaults($defaults); $form->setDefaults($defaults);
//display form //display form

@ -9,8 +9,6 @@
* Plugin details (must be present) * Plugin details (must be present)
*/ */
//the plugin title //the plugin title
$plugin_info['title'] = 'Add a button to login using Shibboleth'; $plugin_info['title'] = 'Add a button to login using Shibboleth';
@ -23,14 +21,34 @@ $plugin_info['author'] = 'Hubert Borderiou';
//the plugin configuration //the plugin configuration
$form = new FormValidator('add_shibboleth_button_form'); $form = new FormValidator('add_shibboleth_button_form');
$form->addElement('text', 'shibboleth_button_label', 'shibboleth connexion title', ''); $form->addElement(
$form->addElement('text', 'shibboleth_button_comment', 'shibboleth connexion description', ''); 'text',
$form->addElement('text', 'shibboleth_image_url', 'Logo URL if any (image, 50px height)'); 'shibboleth_button_label',
'shibboleth connexion title',
''
);
$form->addElement(
'text',
'shibboleth_button_comment',
'shibboleth connexion description',
''
);
$form->addElement(
'text',
'shibboleth_image_url',
'Logo URL if any (image, 50px height)'
);
$form->addElement('style_submit_button', 'submit_button', get_lang('Save')); $form->addElement('style_submit_button', 'submit_button', get_lang('Save'));
//get default value for form //get default value for form
$tab_default_add_shibboleth_login_button_shibboleth_button_label = api_get_setting('add_shibboleth_login_button_shibboleth_button_label'); $tab_default_add_shibboleth_login_button_shibboleth_button_label = api_get_setting(
$tab_default_add_shibboleth_login_button_shibboleth_button_comment = api_get_setting('add_shibboleth_login_button_shibboleth_button_comment'); 'add_shibboleth_login_button_shibboleth_button_label'
$tab_default_add_shibboleth_login_button_shibboleth_image_url = api_get_setting('add_shibboleth_login_button_shibboleth_image_url'); );
$tab_default_add_shibboleth_login_button_shibboleth_button_comment = api_get_setting(
'add_shibboleth_login_button_shibboleth_button_comment'
);
$tab_default_add_shibboleth_login_button_shibboleth_image_url = api_get_setting(
'add_shibboleth_login_button_shibboleth_image_url'
);
$defaults = array(); $defaults = array();
$defaults['shibboleth_button_label'] = $tab_default_add_shibboleth_login_button_shibboleth_button_label['add_shibboleth_login_button']; $defaults['shibboleth_button_label'] = $tab_default_add_shibboleth_login_button_shibboleth_button_label['add_shibboleth_login_button'];
$defaults['shibboleth_button_comment'] = $tab_default_add_shibboleth_login_button_shibboleth_button_comment['add_shibboleth_login_button']; $defaults['shibboleth_button_comment'] = $tab_default_add_shibboleth_login_button_shibboleth_button_comment['add_shibboleth_login_button'];

@ -73,8 +73,6 @@ if (api_is_anonymous()) {
} }
} }
//$_template['option1'] = api_get_plugin_setting('before_login', 'option1');
//$_template['option2'] = api_get_plugin_setting('before_login', 'option2');
$_template['form_option1'] = $formHtml; $_template['form_option1'] = $formHtml;
$_template['form_option2'] = $formHtml2; $_template['form_option2'] = $formHtml2;
} }

@ -16,7 +16,8 @@ require_once api_get_path(LIBRARY_PATH).'thematic.lib.php';
* the class name must be registered inside path.info file (e.g: controller = "BlockCourse"), so dashboard controller will be instantiate it * the class name must be registered inside path.info file (e.g: controller = "BlockCourse"), so dashboard controller will be instantiate it
* @package chamilo.dashboard * @package chamilo.dashboard
*/ */
class BlockCourse extends Block { class BlockCourse extends Block
{
private $user_id; private $user_id;
private $courses; private $courses;
@ -26,15 +27,12 @@ class BlockCourse extends Block {
/** /**
* Constructor * Constructor
*/ */
public function __construct ($user_id) { public function __construct($user_id)
{
$this->user_id = $user_id; $this->user_id = $user_id;
$this->path = 'block_course'; $this->path = 'block_course';
if ($this->is_block_visible_for_user($user_id)) { if ($this->is_block_visible_for_user($user_id)) {
/*if (api_is_platform_admin()) {
$this->courses = CourseManager::get_real_course_list();
} else {*/
$this->courses = CourseManager::get_courses_followed_by_drh($user_id); $this->courses = CourseManager::get_courses_followed_by_drh($user_id);
//}
} }
} }
@ -43,36 +41,46 @@ class BlockCourse extends Block {
* @param int User id * @param int User id
* @return bool Is block visible for user * @return bool Is block visible for user
*/ */
public function is_block_visible_for_user($user_id) { public function is_block_visible_for_user($user_id)
{
$user_info = api_get_user_info($user_id); $user_info = api_get_user_info($user_id);
$user_status = $user_info['status']; $user_status = $user_info['status'];
$is_block_visible_for_user = false; $is_block_visible_for_user = false;
if (UserManager::is_admin($user_id) || in_array($user_status, $this->permission)) { if (UserManager::is_admin($user_id) || in_array(
$user_status,
$this->permission
)
) {
$is_block_visible_for_user = true; $is_block_visible_for_user = true;
} }
return $is_block_visible_for_user; return $is_block_visible_for_user;
} }
/** /**
* This method return content html containing information about courses and its position for showing it inside dashboard interface * This method return content html containing information about courses and its position for showing it inside dashboard interface
* it's important to use the name 'get_block' for beeing used from dashboard controller * it's important to use the name 'get_block' for beeing used from dashboard controller
* @return array column and content html * @return array column and content html
*/ */
public function get_block() { public function get_block()
{
global $charset; global $charset;
$column = 2; $column = 2;
$data = array(); $data = array();
$content = '';
$data_table = '';
$content = $this->get_content_html(); $content = $this->get_content_html();
$html = ' $html = '
<li class="widget color-green" id="intro"> <li class="widget color-green" id="intro">
<div class="widget-head"> <div class="widget-head">
<h3>' . get_lang('CoursesInformation') . '</h3> <h3>' . get_lang('CoursesInformation') . '</h3>
<div class="widget-actions"><a onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang('ConfirmYourChoice'),ENT_QUOTES,$charset)).'\')) return false;" href="index.php?action=disable_block&path='.$this->path.'">'.Display::return_icon('close.gif',get_lang('Close')).'</a></div> <div class="widget-actions"><a onclick="javascript:if(!confirm(\'' . addslashes(
api_htmlentities(
get_lang('ConfirmYourChoice'),
ENT_QUOTES,
$charset
)
) . '\')) return false;" href="index.php?action=disable_block&path=' . $this->path . '">' . Display::return_icon(
'close.gif',
get_lang('Close')
) . '</a></div>
</div> </div>
<div class="widget-content"> <div class="widget-content">
' . $content . ' ' . $content . '
@ -89,11 +97,13 @@ class BlockCourse extends Block {
* This method return a content html, it's used inside get_block method for showing it inside dashboard interface * This method return a content html, it's used inside get_block method for showing it inside dashboard interface
* @return string content html * @return string content html
*/ */
public function get_content_html() { public function get_content_html()
{
$course_data = $this->get_course_information_data(); $course_data = $this->get_course_information_data();
$content = '<div style="margin:10px;">'; $content = '<div style="margin:10px;">';
$content .= '<h3><font color="#000">'.get_lang('YourCourseList').'</font></h3>'; $content .= '<h3><font color="#000">' . get_lang(
'YourCourseList'
) . '</font></h3>';
$data_table = null; $data_table = null;
if (!empty($course_data)) { if (!empty($course_data)) {
$data_table .= '<table class="data_table" width:"95%">'; $data_table .= '<table class="data_table" width:"95%">';
@ -137,7 +147,8 @@ class BlockCourse extends Block {
* Get number of courses * Get number of courses
* @return int * @return int
*/ */
function get_number_of_courses() { function get_number_of_courses()
{
return count($this->courses); return count($this->courses);
} }
@ -145,11 +156,9 @@ class BlockCourse extends Block {
* Get course information data * Get course information data
* @return array * @return array
*/ */
function get_course_information_data() { function get_course_information_data()
$tbl_course = Database::get_main_table(TABLE_MAIN_COURSE); {
$tbl_course_user = Database::get_main_table(TABLE_MAIN_COURSE_USER); $tbl_course_user = Database::get_main_table(TABLE_MAIN_COURSE_USER);
$a_course_students = array();
$course_data = array(); $course_data = array();
$courses = $this->courses; $courses = $this->courses;
@ -158,10 +167,11 @@ class BlockCourse extends Block {
foreach ($courses as $row_course) { foreach ($courses as $row_course) {
$course_code = $row_course['code']; $course_code = $row_course['code'];
$avg_assignments_in_course = $avg_messages_in_course = $nb_students_in_course = $avg_progress_in_course = $avg_score_in_course = $avg_time_spent_in_course = $avg_score_in_exercise = 0; $nb_students_in_course = $avg_progress_in_course = $avg_score_in_course = $avg_time_spent_in_course = $avg_score_in_exercise = 0;
// students directly subscribed to the course // students directly subscribed to the course
$sql = "SELECT user_id FROM $tbl_course_user as course_rel_user WHERE course_rel_user.status=".STUDENT." AND course_rel_user.course_code='$course_code'"; $sql = "SELECT user_id FROM $tbl_course_user as course_rel_user
WHERE course_rel_user.status=" . STUDENT . " AND course_rel_user.course_code='$course_code'";
$rs = Database::query($sql); $rs = Database::query($sql);
$users = array(); $users = array();
while ($row = Database::fetch_array($rs)) { while ($row = Database::fetch_array($rs)) {
@ -169,14 +179,15 @@ class BlockCourse extends Block {
} }
if (count($users) > 0) { if (count($users) > 0) {
$nb_students_in_course = count($users); $nb_students_in_course = count($users);
$avg_time_spent_in_course = api_time_to_hms(Tracking::get_time_spent_on_the_course($users, $course_code)/$nb_students_in_course); $avg_time_spent_in_course = api_time_to_hms(
Tracking::get_time_spent_on_the_course($users, $course_code ) / $nb_students_in_course);
} else { } else {
$avg_time_spent_in_course = null; $avg_time_spent_in_course = null;
} }
$tematic_advance = $thematic->get_total_average_of_thematic_advances(
$tematic_advance_progress = 0; $course_code,
0
$tematic_advance = $thematic->get_total_average_of_thematic_advances($course_code, 0); );
if (!empty($tematic_advance)) { if (!empty($tematic_advance)) {
$tematic_advance_progress = '<a title="' . get_lang('GoToThematicAdvance') . '" href="' . api_get_path(WEB_CODE_PATH) . 'course_progress/index.php?cidReq=' . $course_code . '&action=thematic_details">' . $tematic_advance . '%</a>'; $tematic_advance_progress = '<a title="' . get_lang('GoToThematicAdvance') . '" href="' . api_get_path(WEB_CODE_PATH) . 'course_progress/index.php?cidReq=' . $course_code . '&action=thematic_details">' . $tematic_advance . '%</a>';
@ -194,6 +205,4 @@ class BlockCourse extends Block {
return $course_data; return $course_data;
} }
} }
?>

@ -5,7 +5,6 @@
* @package chamilo.dashboard * @package chamilo.dashboard
* @author Marco Sousa original code * @author Marco Sousa original code
* @author Julio Montoya class named was changed of name, and some minor changes * @author Julio Montoya class named was changed of name, and some minor changes
*/ */
/** /**
@ -21,7 +20,8 @@ require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/be.inc.php';
* the class name must be registered inside path.info file (e.g: controller = "BlockDiario"), so dashboard controller will be instantiate it * the class name must be registered inside path.info file (e.g: controller = "BlockDiario"), so dashboard controller will be instantiate it
* @package chamilo.dashboard * @package chamilo.dashboard
*/ */
class BlockDaily extends Block { class BlockDaily extends Block
{
private $user_id; private $user_id;
private $courses; private $courses;
@ -31,15 +31,14 @@ class BlockDaily extends Block {
/** /**
* Constructor * Constructor
*/ */
public function __construct ($user_id) { public function __construct($user_id)
{
$this->user_id = $user_id; $this->user_id = $user_id;
$this->path = 'block_daily'; $this->path = 'block_daily';
if ($this->is_block_visible_for_user($user_id)) { if ($this->is_block_visible_for_user($user_id)) {
/*if (api_is_platform_admin()) { $this->courses = CourseManager::get_courses_followed_by_drh(
$this->courses = CourseManager::get_real_course_list(); $user_id
} else {*/ );
$this->courses = CourseManager::get_courses_followed_by_drh($user_id);
//}
} }
} }
@ -48,35 +47,46 @@ class BlockDaily extends Block {
* @param int User id * @param int User id
* @return bool Is block visible for user * @return bool Is block visible for user
*/ */
public function is_block_visible_for_user($user_id) { public function is_block_visible_for_user($user_id)
{
$user_info = api_get_user_info($user_id); $user_info = api_get_user_info($user_id);
$user_status = $user_info['status']; $user_status = $user_info['status'];
$is_block_visible_for_user = false; $is_block_visible_for_user = false;
if (UserManager::is_admin($user_id) || in_array($user_status, $this->permission)) { if (UserManager::is_admin($user_id) || in_array(
$user_status,
$this->permission
)
) {
$is_block_visible_for_user = true; $is_block_visible_for_user = true;
} }
return $is_block_visible_for_user; return $is_block_visible_for_user;
} }
/** /**
* This method return content html containing information about courses and its position for showing it inside dashboard interface * This method return content html containing information about courses and its position for showing it inside dashboard interface
* it's important to use the name 'get_block' for beeing used from dashboard controller * it's important to use the name 'get_block' for beeing used from dashboard controller
* @return array column and content html * @return array column and content html
*/ */
public function get_block() { public function get_block()
{
global $charset; global $charset;
$column = 2; $column = 2;
$data = array(); $data = array();
$content = '';
$data_table = '';
$content = $this->get_content_html(); $content = $this->get_content_html();
$html = '<li class="widget color-green" id="intro"> $html = '<li class="widget color-green" id="intro">
<div class="widget-head"> <div class="widget-head">
<h3>' . get_lang('GradebookAndAttendances') . '</h3> <h3>' . get_lang('GradebookAndAttendances') . '</h3>
<div class="widget-actions"><a onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang('ConfirmYourChoice'),ENT_QUOTES,$charset)).'\')) return false;" href="index.php?action=disable_block&path='.$this->path.'">'.Display::return_icon('close.gif',get_lang('Close')).'</a></div> <div class="widget-actions"><a onclick="javascript:if(!confirm(\'' . addslashes(
api_htmlentities(
get_lang('ConfirmYourChoice'),
ENT_QUOTES,
$charset
)
) . '\')) return false;" href="index.php?action=disable_block&path=' . $this->path . '">' . Display::return_icon(
'close.gif',
get_lang('Close')
) . '</a></div>
</div> </div>
<div class="widget-content"> <div class="widget-content">
' . $content . ' ' . $content . '
@ -93,11 +103,13 @@ class BlockDaily extends Block {
* This method return a content html, it's used inside get_block method for showing it inside dashboard interface * This method return a content html, it's used inside get_block method for showing it inside dashboard interface
* @return string content html * @return string content html
*/ */
public function get_content_html() { public function get_content_html()
{
$course_data = $this->get_course_information_data(); $course_data = $this->get_course_information_data();
$content = '<div style="margin:10px;">'; $content = '<div style="margin:10px;">';
$content .= '<h3><font color="#000">'.get_lang('YourCourseList').'</font></h3>'; $content .= '<h3><font color="#000">' . get_lang(
'YourCourseList'
) . '</font></h3>';
$data_table = null; $data_table = null;
if (!empty($course_data)) { if (!empty($course_data)) {
$data_table .= '<table class="data_table" width:"95%">'; $data_table .= '<table class="data_table" width:"95%">';
@ -130,7 +142,8 @@ class BlockDaily extends Block {
} }
$content .= $data_table; $content .= $data_table;
if (!empty($course_data)) { if (!empty($course_data)) {
$content .= '<div style="text-align:right;margin-top:10px;"><a href="'.api_get_path(WEB_CODE_PATH).'mySpace/course.php">'.get_lang('SeeMore').'</a></div>'; $content .= '<div style="text-align:right;margin-top:10px;">
<a href="' . api_get_path(WEB_CODE_PATH) . 'mySpace/course.php">' . get_lang('SeeMore') . '</a></div>';
} }
$content .= '</div>'; $content .= '</div>';
return $content; return $content;
@ -140,7 +153,8 @@ class BlockDaily extends Block {
* Get number of courses * Get number of courses
* @return int * @return int
*/ */
function get_number_of_courses() { function get_number_of_courses()
{
return count($this->courses); return count($this->courses);
} }
@ -148,11 +162,9 @@ class BlockDaily extends Block {
* Get course information data * Get course information data
* @return array * @return array
*/ */
function get_course_information_data() { function get_course_information_data()
$tbl_course = Database::get_main_table(TABLE_MAIN_COURSE); {
$tbl_course_user = Database::get_main_table(TABLE_MAIN_COURSE_USER); $tbl_course_user = Database::get_main_table(TABLE_MAIN_COURSE_USER);
$a_course_students = array();
$course_data = array(); $course_data = array();
$courses = $this->courses; $courses = $this->courses;
@ -167,7 +179,8 @@ class BlockDaily extends Block {
// Attendance table // Attendance table
$table_course = Database::get_course_table(TABLE_ATTENDANCE); $table_course = Database::get_course_table(TABLE_ATTENDANCE);
$sql = "SELECT id, name, attendance_qualify_max FROM $table_course WHERE c_id = ".$course_info['real_id']." AND active = 1 AND session_id = 0"; $sql = "SELECT id, name, attendance_qualify_max FROM $table_course
WHERE c_id = " . $course_info['real_id'] . " AND active = 1 AND session_id = 0";
$rs = Database::query($sql); $rs = Database::query($sql);
$attendance = array(); $attendance = array();
$attendances = array(); $attendances = array();
@ -183,15 +196,17 @@ class BlockDaily extends Block {
//$attendance['name'] = $row['name']; //$attendance['name'] = $row['name'];
$attendance['course_code'] = $course_code; $attendance['course_code'] = $course_code;
if ($attendance['done'] != '0') if ($attendance['done'] != '0') {
$attendances[] = '<a href="' . api_get_path(WEB_PATH).'main/attendance/index.php?cidReq=' . $attendance['course_code'] . '&action=attendance_sheet_print&attendance_id=' . $attendance['id'] . $param_gradebook . '">' . Display::return_icon('printmgr.gif', get_lang('Print')).'</a>'; $attendances[] = '<a href="' . api_get_path(WEB_PATH).'main/attendance/index.php?cidReq=' . $attendance['course_code'] . '&action=attendance_sheet_print&attendance_id=' . $attendance['id'] . $param_gradebook . '">' . Display::return_icon('printmgr.gif', get_lang('Print')).'</a>';
else } else {
$attendances[] = get_lang("NotAvailable"); $attendances[] = get_lang("NotAvailable");
} }
}
// quantidade de alunos // quantidade de alunos
$sql = "SELECT user_id FROM $tbl_course_user as course_rel_user WHERE course_rel_user.status=".STUDENT." AND course_rel_user.course_code='$course_code'"; $sql = "SELECT user_id FROM $tbl_course_user as course_rel_user
WHERE course_rel_user.status=" . STUDENT . " AND course_rel_user.course_code='$course_code'";
$rs = Database::query($sql); $rs = Database::query($sql);
$users = array(); $users = array();
while ($row = Database::fetch_array($rs)) { while ($row = Database::fetch_array($rs)) {
@ -202,14 +217,21 @@ class BlockDaily extends Block {
} }
if (!empty($tematic_advance)) { if (!empty($tematic_advance)) {
$tematic_advance_progress = '<a title="'.get_lang('GoToThematicAdvance').'" href="'.api_get_path(WEB_CODE_PATH).'attendance/index.php?cidReq='.$course_code.'&action=attendance_sheet_print&attendance_id=">'.$tematic_advance.'%</a>'; $tematic_advance_progress = '<a title="' . get_lang(
'GoToThematicAdvance'
) . '" href="' . api_get_path(
WEB_CODE_PATH
) . 'attendance/index.php?cidReq=' . $course_code . '&action=attendance_sheet_print&attendance_id=">' . $tematic_advance . '%</a>';
} else { } else {
$tematic_advance_progress = '0%'; $tematic_advance_progress = '0%';
} }
// Score // Score
$tbl_grade_categories = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_CATEGORY); $tbl_grade_categories = Database :: get_main_table(
$sql = "SELECT id from " . $tbl_grade_categories ." WHERE course_code ='".$course_code."'"; TABLE_MAIN_GRADEBOOK_CATEGORY
);
$sql = "SELECT id from " . $tbl_grade_categories . "
WHERE course_code ='" . $course_code . "'";
$rs = Database::query($sql); $rs = Database::query($sql);
$category = null; $category = null;
while ($row = Database::fetch_array($rs)) { while ($row = Database::fetch_array($rs)) {

@ -27,8 +27,8 @@ require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/be/category.class.php';
* the class name must be registered inside path.info file (e.g: controller = "BlockEvaluationGraph"), so dashboard controller will be instantiate it * the class name must be registered inside path.info file (e.g: controller = "BlockEvaluationGraph"), so dashboard controller will be instantiate it
* @package chamilo.dashboard * @package chamilo.dashboard
*/ */
class BlockEvaluationGraph extends Block { class BlockEvaluationGraph extends Block
{
private $user_id; private $user_id;
private $courses; private $courses;
private $sessions; private $sessions;
@ -38,25 +38,18 @@ class BlockEvaluationGraph extends Block {
/** /**
* Constructor * Constructor
*/ */
public function __construct ($user_id) { public function __construct($user_id)
{
$this->path = 'block_evaluation_graph'; $this->path = 'block_evaluation_graph';
$this->user_id = $user_id; $this->user_id = $user_id;
$this->bg_width = 450; $this->bg_width = 450;
$this->bg_height = 350; $this->bg_height = 350;
if ($this->is_block_visible_for_user($user_id)) { if ($this->is_block_visible_for_user($user_id)) {
//$this->courses = CourseManager::get_real_course_list();
/*if (api_is_platform_admin()) {
$this->courses = CourseManager::get_real_course_list();
$this->sessions = SessionManager::get_sessions_list();
} else {*/
if (!api_is_session_admin()) { if (!api_is_session_admin()) {
$this->courses = CourseManager::get_courses_followed_by_drh($user_id); $this->courses = CourseManager::get_courses_followed_by_drh($user_id);
} }
$this->sessions = SessionManager::get_sessions_followed_by_drh($user_id); $this->sessions = SessionManager::get_sessions_followed_by_drh($user_id);
//}
} }
} }
/** /**
@ -64,7 +57,8 @@ class BlockEvaluationGraph extends Block {
* @param int User id * @param int User id
* @return bool Is block visible for user * @return bool Is block visible for user
*/ */
public function is_block_visible_for_user($user_id) { public function is_block_visible_for_user($user_id)
{
$user_info = api_get_user_info($user_id); $user_info = api_get_user_info($user_id);
$user_status = $user_info['status']; $user_status = $user_info['status'];
$is_block_visible_for_user = false; $is_block_visible_for_user = false;
@ -79,15 +73,14 @@ class BlockEvaluationGraph extends Block {
* it's important to use the name 'get_block' for beeing used from dashboard controller * it's important to use the name 'get_block' for beeing used from dashboard controller
* @return array column and content html * @return array column and content html
*/ */
public function get_block() { public function get_block()
{
global $charset; global $charset;
$column = 1; $column = 1;
$data = array(); $data = array();
$evaluations_base_courses_graph = $this->get_evaluations_base_courses_graph(); $evaluations_base_courses_graph = $this->get_evaluations_base_courses_graph();
$evaluations_courses_in_sessions_graph = $this->get_evaluations_courses_in_sessions_graph(); $evaluations_courses_in_sessions_graph = $this->get_evaluations_courses_in_sessions_graph();
$html = '<li class="widget color-orange" id="intro"> $html = '<li class="widget color-orange" id="intro">
@ -127,10 +120,13 @@ class BlockEvaluationGraph extends Block {
} }
/** /**
* This method return a graph containing informations about evaluations inside base courses, it's used inside get_block method for showing it inside dashboard interface * This method return a graph containing informations about evaluations
* inside base courses, it's used inside get_block method for showing
* it inside dashboard interface
* @return string img html * @return string img html
*/ */
public function get_evaluations_base_courses_graph() { public function get_evaluations_base_courses_graph()
{
$graphs = array(); $graphs = array();
if (!empty($this->courses)) { if (!empty($this->courses)) {
$courses_code = array_keys($this->courses); $courses_code = array_keys($this->courses);
@ -214,10 +210,13 @@ class BlockEvaluationGraph extends Block {
} }
/** /**
* This method return a graph containing informations about evaluations inside courses in sessions, it's used inside get_block method for showing it inside dashboard interface * This method return a graph containing information about evaluations
* inside courses in sessions, it's used inside get_block method for
* showing it inside dashboard interface
* @return string img html * @return string img html
*/ */
public function get_evaluations_courses_in_sessions_graph() { public function get_evaluations_courses_in_sessions_graph()
{
$graphs = array(); $graphs = array();
if (!empty($this->sessions)) { if (!empty($this->sessions)) {
$session_ids = array_keys($this->sessions); $session_ids = array_keys($this->sessions);

@ -61,14 +61,11 @@ class BlockGlobalInfo extends Block
* it's important to use the name 'get_block' for beeing used from dashboard controller * it's important to use the name 'get_block' for beeing used from dashboard controller
* @return array column and content html * @return array column and content html
*/ */
public function get_block() { public function get_block()
{
global $charset; global $charset;
$column = 2; $column = 2;
$data = array(); $data = array();
$content = '';
$data_table = '';
$content = $this->get_content_html(); $content = $this->get_content_html();
$html = ' $html = '
<li class="widget color-red" id="intro"> <li class="widget color-red" id="intro">
@ -91,8 +88,8 @@ class BlockGlobalInfo extends Block
* This method return a content html, it's used inside get_block method for showing it inside dashboard interface * This method return a content html, it's used inside get_block method for showing it inside dashboard interface
* @return string content html * @return string content html
*/ */
public function get_content_html() { public function get_content_html()
{
$global_data = $this->get_global_information_data(); $global_data = $this->get_global_information_data();
$content = '<div style="margin:10px;">'; $content = '<div style="margin:10px;">';
$content .= '<h3><font color="#000">'.get_lang('GlobalPlatformInformation').'</font></h3>'; $content .= '<h3><font color="#000">'.get_lang('GlobalPlatformInformation').'</font></h3>';

@ -13,10 +13,12 @@ require_once api_get_path(LIBRARY_PATH).'course_description.lib.php';
/** /**
* This class is used like controller for this session block plugin, * This class is used like controller for this session block plugin,
* the class name must be registered inside path.info file (e.g: controller = "BlockSession"), so dashboard controller will be instantiate it * the class name must be registered inside path.info file
* (e.g: controller = "BlockSession"), so dashboard controller will be instantiate it
* @package chamilo.dashboard * @package chamilo.dashboard
*/ */
class BlockSession extends Block { class BlockSession extends Block
{
private $user_id; private $user_id;
private $sessions; private $sessions;
@ -26,15 +28,12 @@ class BlockSession extends Block {
/** /**
* Constructor * Constructor
*/ */
public function __construct ($user_id) { public function __construct ($user_id)
{
$this->user_id = $user_id; $this->user_id = $user_id;
$this->path = 'block_session'; $this->path = 'block_session';
if ($this->is_block_visible_for_user($user_id)) { if ($this->is_block_visible_for_user($user_id)) {
/*if (api_is_platform_admin()) {
$this->sessions = SessionManager::get_sessions_list();
} else {*/
$this->sessions = SessionManager::get_sessions_followed_by_drh($user_id); $this->sessions = SessionManager::get_sessions_followed_by_drh($user_id);
//}
} }
} }
@ -43,7 +42,8 @@ class BlockSession extends Block {
* @param int User id * @param int User id
* @return bool Is block visible for user * @return bool Is block visible for user
*/ */
public function is_block_visible_for_user($user_id) { public function is_block_visible_for_user($user_id)
{
$user_info = api_get_user_info($user_id); $user_info = api_get_user_info($user_id);
$user_status = $user_info['status']; $user_status = $user_info['status'];
$is_block_visible_for_user = false; $is_block_visible_for_user = false;
@ -58,7 +58,8 @@ class BlockSession extends Block {
* it's important to use the name 'get_block' for beeing used from dashboard controller * it's important to use the name 'get_block' for beeing used from dashboard controller
* @return array column and content html * @return array column and content html
*/ */
public function get_block() { public function get_block()
{
global $charset; global $charset;
@ -89,7 +90,8 @@ class BlockSession extends Block {
* This method return a content html, it's used inside get_block method for showing it inside dashboard interface * This method return a content html, it's used inside get_block method for showing it inside dashboard interface
* @return string content html * @return string content html
*/ */
public function get_content_html() { public function get_content_html()
{
$content = ''; $content = '';
$sessions = $this->sessions; $sessions = $this->sessions;
@ -147,7 +149,8 @@ class BlockSession extends Block {
* Get number of sessions * Get number of sessions
* @return int * @return int
*/ */
function get_number_of_sessions() { function get_number_of_sessions()
{
return count($this->sessions); return count($this->sessions);
} }

@ -21,7 +21,8 @@ require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/be/category.class.php';
* the class name must be registered inside path.info file (e.g: controller = "BlockStudent"), so dashboard controller will be instantiate it * the class name must be registered inside path.info file (e.g: controller = "BlockStudent"), so dashboard controller will be instantiate it
* @package chamilo.dashboard * @package chamilo.dashboard
*/ */
class BlockStudent extends Block { class BlockStudent extends Block
{
private $user_id; private $user_id;
private $students; private $students;
@ -31,16 +32,12 @@ class BlockStudent extends Block {
/** /**
* Constructor * Constructor
*/ */
public function __construct ($user_id) { public function __construct ($user_id)
{
$this->user_id = $user_id; $this->user_id = $user_id;
$this->path = 'block_student'; $this->path = 'block_student';
if ($this->is_block_visible_for_user($user_id)) { if ($this->is_block_visible_for_user($user_id)) {
/*if (api_is_platform_admin()) {
$this->students = UserManager::get_user_list(array('status' => STUDENT));
} else {*/
$this->students = UserManager::get_users_followed_by_drh($user_id, STUDENT); $this->students = UserManager::get_users_followed_by_drh($user_id, STUDENT);
//}
} }
} }
@ -49,7 +46,8 @@ class BlockStudent extends Block {
* @param int User id * @param int User id
* @return bool Is block visible for user * @return bool Is block visible for user
*/ */
public function is_block_visible_for_user($user_id) { public function is_block_visible_for_user($user_id)
{
$user_info = api_get_user_info($user_id); $user_info = api_get_user_info($user_id);
$user_status = $user_info['status']; $user_status = $user_info['status'];
$is_block_visible_for_user = false; $is_block_visible_for_user = false;
@ -64,7 +62,8 @@ class BlockStudent extends Block {
* it's important to use the name 'get_block' for beeing used from dashboard controller * it's important to use the name 'get_block' for beeing used from dashboard controller
* @return array column and content html * @return array column and content html
*/ */
public function get_block() { public function get_block()
{
global $charset; global $charset;
$column = 1; $column = 1;
$data = array(); $data = array();
@ -90,7 +89,8 @@ class BlockStudent extends Block {
* This method return a content html, it's used inside get_block method for showing it inside dashboard interface * This method return a content html, it's used inside get_block method for showing it inside dashboard interface
* @return string content html * @return string content html
*/ */
public function get_students_content_html_for_platform_admin() { public function get_students_content_html_for_platform_admin()
{
$students = $this->students; $students = $this->students;
$content = '<div style="margin:10px;">'; $content = '<div style="margin:10px;">';
$content .= '<h3><font color="#000">'.get_lang('YourStudents').'</font></h3>'; $content .= '<h3><font color="#000">'.get_lang('YourStudents').'</font></h3>';
@ -235,6 +235,7 @@ class BlockStudent extends Block {
</div>'; </div>';
} }
$content .= '</div>'; $content .= '</div>';
return $content; return $content;
} }
@ -242,7 +243,8 @@ class BlockStudent extends Block {
* Get number of students * Get number of students
* @return int * @return int
*/ */
function get_number_of_students() { function get_number_of_students()
{
return count($this->students); return count($this->students);
} }
} }

@ -29,7 +29,8 @@ require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/be/category.class.php';
* the class name must be registered inside path.info file (e.g: controller = "BlockStudentGraph"), so dashboard controller will be instantiate it * the class name must be registered inside path.info file (e.g: controller = "BlockStudentGraph"), so dashboard controller will be instantiate it
* @package chamilo.dashboard * @package chamilo.dashboard
*/ */
class BlockStudentGraph extends Block { class BlockStudentGraph extends Block
{
private $user_id; private $user_id;
private $students; private $students;
@ -39,7 +40,8 @@ class BlockStudentGraph extends Block {
/** /**
* Constructor * Constructor
*/ */
public function __construct ($user_id) { public function __construct ($user_id)
{
$this->user_id = $user_id; $this->user_id = $user_id;
$this->path = 'block_student_graph'; $this->path = 'block_student_graph';
if ($this->is_block_visible_for_user($user_id)) { if ($this->is_block_visible_for_user($user_id)) {
@ -56,7 +58,8 @@ class BlockStudentGraph extends Block {
* @param int User id * @param int User id
* @return bool Is block visible for user * @return bool Is block visible for user
*/ */
public function is_block_visible_for_user($user_id) { public function is_block_visible_for_user($user_id)
{
$user_info = api_get_user_info($user_id); $user_info = api_get_user_info($user_id);
$user_status = $user_info['status']; $user_status = $user_info['status'];
$is_block_visible_for_user = false; $is_block_visible_for_user = false;
@ -67,14 +70,15 @@ class BlockStudentGraph extends Block {
} }
/** /**
* This method return content html containing information about students and its position for showing it inside dashboard interface * This method return content html containing information about students
* it's important to use the name 'get_block' for beeing used from dashboard controller * and its position for showing it inside dashboard interface
* it's important to use the name 'get_block' for being used from dashboard controller
* @return array column and content html * @return array column and content html
*/ */
public function get_block() { public function get_block()
{
global $charset; global $charset;
$column = 1; $column = 1;
$data = array(); $data = array();
$students_attendance_graph = $this->get_students_attendance_graph(); $students_attendance_graph = $this->get_students_attendance_graph();
@ -95,10 +99,12 @@ class BlockStudentGraph extends Block {
} }
/** /**
* This method return a graph containing informations about students evaluation, it's used inside get_block method for showing it inside dashboard interface * This method return a graph containing information about students evaluation,
* it's used inside get_block method for showing it inside dashboard interface
* @return string img html * @return string img html
*/ */
public function get_students_attendance_graph() { public function get_students_attendance_graph()
{
$students = $this->students; $students = $this->students;
$attendance = new Attendance(); $attendance = new Attendance();
@ -203,7 +209,8 @@ class BlockStudentGraph extends Block {
* Get number of students * Get number of students
* @return int * @return int
*/ */
function get_number_of_students() { function get_number_of_students()
{
return count($this->students); return count($this->students);
} }
} }

@ -12,10 +12,12 @@
/** /**
* This class is used like controller for teacher block plugin, * This class is used like controller for teacher block plugin,
* the class name must be registered inside path.info file (e.g: controller = "BlockTeacher"), so dashboard controller will be instantiate it * the class name must be registered inside path.info file
* (e.g: controller = "BlockTeacher"), so dashboard controller will be instantiate it
* @package chamilo.dashboard * @package chamilo.dashboard
*/ */
class BlockTeacher extends Block { class BlockTeacher extends Block
{
private $user_id; private $user_id;
private $teachers; private $teachers;
@ -25,15 +27,12 @@ class BlockTeacher extends Block {
/** /**
* Controller * Controller
*/ */
public function __construct ($user_id) { public function __construct ($user_id)
{
$this->user_id = $user_id; $this->user_id = $user_id;
$this->path = 'block_teacher'; $this->path = 'block_teacher';
if ($this->is_block_visible_for_user($user_id)) { if ($this->is_block_visible_for_user($user_id)) {
/*if (api_is_platform_admin()) {
$this->teachers = UserManager::get_user_list(array('status' => COURSEMANAGER));
} else {*/
$this->teachers = UserManager::get_users_followed_by_drh($user_id, COURSEMANAGER); $this->teachers = UserManager::get_users_followed_by_drh($user_id, COURSEMANAGER);
//}
} }
} }
@ -42,7 +41,8 @@ class BlockTeacher extends Block {
* @param int User id * @param int User id
* @return bool Is block visible for user * @return bool Is block visible for user
*/ */
public function is_block_visible_for_user($user_id) { public function is_block_visible_for_user($user_id)
{
$user_info = api_get_user_info($user_id); $user_info = api_get_user_info($user_id);
$user_status = $user_info['status']; $user_status = $user_info['status'];
$is_block_visible_for_user = false; $is_block_visible_for_user = false;
@ -57,18 +57,13 @@ class BlockTeacher extends Block {
* it's important to use the name 'get_block' for beeing used from dashboard controller * it's important to use the name 'get_block' for beeing used from dashboard controller
* @return array column and content html * @return array column and content html
*/ */
public function get_block() { public function get_block()
{
global $charset; global $charset;
$column = 1; $column = 1;
$data = array(); $data = array();
/*if (api_is_platform_admin()) {
$teacher_content_html = $this->get_teachers_content_html_for_platform_admin();
} else if (api_is_drh()) {*/
$teacher_content_html = $this->get_teachers_content_html_for_drh(); $teacher_content_html = $this->get_teachers_content_html_for_drh();
//}
$html = ' $html = '
<li class="widget color-blue" id="intro"> <li class="widget color-blue" id="intro">
@ -93,8 +88,8 @@ class BlockTeacher extends Block {
* This method return a content html, it's used inside get_block method for showing it inside dashboard interface * This method return a content html, it's used inside get_block method for showing it inside dashboard interface
* @return string content html * @return string content html
*/ */
public function get_teachers_content_html_for_platform_admin() { public function get_teachers_content_html_for_platform_admin()
{
$teachers = $this->teachers; $teachers = $this->teachers;
$content = '<div style="margin:10px;">'; $content = '<div style="margin:10px;">';
$content .= '<h3><font color="#000">'.get_lang('YourTeachers').'</font></h3>'; $content .= '<h3><font color="#000">'.get_lang('YourTeachers').'</font></h3>';
@ -141,16 +136,17 @@ class BlockTeacher extends Block {
$content .= $teachers_table; $content .= $teachers_table;
if (count($teachers) > 0) { if (count($teachers) > 0) {
$content .= '<div style="text-align:right;margin-top:10px;"><a href="'.api_get_path(WEB_CODE_PATH).'mySpace/index.php?view=admin">'.get_lang('SeeMore').'</a></div>'; $content .= '<div style="text-align:right;margin-top:10px;">
<a href="'.api_get_path(WEB_CODE_PATH).'mySpace/index.php?view=admin">'.get_lang('SeeMore').'</a></div>';
} }
$content .= '</div>'; $content .= '</div>';
return $content; return $content;
} }
public function get_teachers_content_html_for_drh() { public function get_teachers_content_html_for_drh()
{
$teachers = $this->teachers; $teachers = $this->teachers;
$content = '<div style="margin:10px;">'; $content = '<div style="margin:10px;">';
$content .= '<h3><font color="#000">'.get_lang('YourTeachers').'</font></h3>'; $content .= '<h3><font color="#000">'.get_lang('YourTeachers').'</font></h3>';
@ -198,15 +194,14 @@ class BlockTeacher extends Block {
$content .= '</div>'; $content .= '</div>';
return $content; return $content;
} }
/** /**
* Get number of teachers * Get number of teachers
* @return int * @return int
*/ */
function get_number_of_teachers() { function get_number_of_teachers()
{
return count($this->teachers); return count($this->teachers);
} }
} }

@ -16,15 +16,13 @@ require_once api_get_path(LIBRARY_PATH).'pchart/pData.class.php';
require_once api_get_path(LIBRARY_PATH).'pchart/pChart.class.php'; require_once api_get_path(LIBRARY_PATH).'pchart/pChart.class.php';
require_once api_get_path(LIBRARY_PATH).'pchart/pCache.class.php'; require_once api_get_path(LIBRARY_PATH).'pchart/pCache.class.php';
/** /**
* This class is used like controller for teacher graph block plugin, * This class is used like controller for teacher graph block plugin,
* the class name must be registered inside path.info file (e.g: controller = "BlockTeacherGraph"), so dashboard controller will be instantiate it * the class name must be registered inside path.info file (e.g: controller = "BlockTeacherGraph"), so dashboard controller will be instantiate it
* @package chamilo.dashboard * @package chamilo.dashboard
*/ */
class BlockTeacherGraph extends Block { class BlockTeacherGraph extends Block
{
private $user_id; private $user_id;
private $teachers; private $teachers;
private $path; private $path;
@ -33,15 +31,12 @@ class BlockTeacherGraph extends Block {
/** /**
* Controller * Controller
*/ */
public function __construct ($user_id) { public function __construct ($user_id)
{
$this->user_id = $user_id; $this->user_id = $user_id;
$this->path = 'block_teacher_graph'; $this->path = 'block_teacher_graph';
if ($this->is_block_visible_for_user($user_id)) { if ($this->is_block_visible_for_user($user_id)) {
/*if (api_is_platform_admin()) {
$this->teachers = UserManager::get_user_list(array('status' => COURSEMANAGER));
} else {*/
$this->teachers = UserManager::get_users_followed_by_drh($user_id, COURSEMANAGER); $this->teachers = UserManager::get_users_followed_by_drh($user_id, COURSEMANAGER);
//}
} }
} }
@ -50,7 +45,8 @@ class BlockTeacherGraph extends Block {
* @param int User id * @param int User id
* @return bool Is block visible for user * @return bool Is block visible for user
*/ */
public function is_block_visible_for_user($user_id) { public function is_block_visible_for_user($user_id)
{
$user_info = api_get_user_info($user_id); $user_info = api_get_user_info($user_id);
$user_status = $user_info['status']; $user_status = $user_info['status'];
$is_block_visible_for_user = false; $is_block_visible_for_user = false;
@ -65,19 +61,12 @@ class BlockTeacherGraph extends Block {
* it's important to use the name 'get_block' for beeing used from dashboard controller * it's important to use the name 'get_block' for beeing used from dashboard controller
* @return array column and content html * @return array column and content html
*/ */
public function get_block() { public function get_block()
{
global $charset; global $charset;
$column = 1; $column = 1;
$data = array(); $data = array();
/*if (api_is_platform_admin()) {
$teacher_content_html = $this->get_teachers_content_html_for_platform_admin();
} else if (api_is_drh()) {*/
$teacher_information_graph = $this->get_teachers_information_graph(); $teacher_information_graph = $this->get_teachers_information_graph();
//}
$html = ' $html = '
<li class="widget color-blue" id="intro"> <li class="widget color-blue" id="intro">
<div class="widget-head"> <div class="widget-head">
@ -102,8 +91,8 @@ class BlockTeacherGraph extends Block {
* This method return a content html, it's used inside get_block method for showing it inside dashboard interface * This method return a content html, it's used inside get_block method for showing it inside dashboard interface
* @return string content html * @return string content html
*/ */
public function get_teachers_information_graph() { public function get_teachers_information_graph()
{
$teachers = $this->teachers; $teachers = $this->teachers;
$graph = ''; $graph = '';
@ -188,16 +177,16 @@ class BlockTeacherGraph extends Block {
} else { } else {
$graph = '<p>'.api_convert_encoding(get_lang('GraphicNotAvailable'),'UTF-8').'</p>'; $graph = '<p>'.api_convert_encoding(get_lang('GraphicNotAvailable'),'UTF-8').'</p>';
} }
return $graph;
return $graph;
} }
/** /**
* Get number of teachers * Get number of teachers
* @return int * @return int
*/ */
function get_number_of_teachers() { function get_number_of_teachers()
{
return count($this->teachers); return count($this->teachers);
} }

@ -1,4 +1,4 @@
<?php //$id: $ <?php
/** /**
* This script is a configuration file for the date plugin. You can use it as a master for other platform plugins (course plugins are slightly different). * This script is a configuration file for the date plugin. You can use it as a master for other platform plugins (course plugins are slightly different).
* These settings will be used in the administration interface for plugins (Chamilo configuration settings->Plugins) * These settings will be used in the administration interface for plugins (Chamilo configuration settings->Plugins)

@ -3,7 +3,10 @@
global $_user; global $_user;
$_template['show_message'] = false; $_template['show_message'] = false;
if (!api_is_anonymous() && api_get_setting('cas_activate') == 'true' && $_user['auth_source'] == CAS_AUTH_SOURCE) { if (!api_is_anonymous() &&
api_get_setting('cas_activate') == 'true' &&
$_user['auth_source'] == CAS_AUTH_SOURCE
) {
$_template['show_message'] = true; $_template['show_message'] = true;
// the link URL // the link URL
$link_url = "#"; $link_url = "#";

@ -9,7 +9,6 @@
* Plugin details (must be present) * Plugin details (must be present)
*/ */
//the plugin title //the plugin title
$plugin_info['title'] = 'Enable or disable logout button'; $plugin_info['title'] = 'Enable or disable logout button';

@ -9,8 +9,6 @@
* Plugin details (must be present) * Plugin details (must be present)
*/ */
//the plugin title //the plugin title
$plugin_info['title'] = 'Hide/Unhide the Login/Password default form'; $plugin_info['title'] = 'Hide/Unhide the Login/Password default form';

@ -1,11 +0,0 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.6

@ -5,16 +5,22 @@
* @author Pavel Vlasov * @author Pavel Vlasov
*/ */
if (!defined('DOKU_INC')) die(); if (!defined('DOKU_INC')) {
if (!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN', DOKU_INC . 'lib/plugins/'); die();
}
if (!defined('DOKU_PLUGIN')) {
define('DOKU_PLUGIN', DOKU_INC . 'lib/plugins/');
}
require_once(DOKU_PLUGIN . 'action.php'); require_once(DOKU_PLUGIN . 'action.php');
class action_plugin_jcapture extends DokuWiki_Action_Plugin { class action_plugin_jcapture extends DokuWiki_Action_Plugin
{
/** /**
* return some info * return some info
*/ */
function getInfo(){ function getInfo()
{
return array( return array(
'author' => 'Pavel Vlasov', 'author' => 'Pavel Vlasov',
'email' => 'Pavel.Vlasov@hammurapi.com', 'email' => 'Pavel.Vlasov@hammurapi.com',
@ -27,14 +33,22 @@ class action_plugin_jcapture extends DokuWiki_Action_Plugin {
/** /**
* Register the eventhandlers * Register the eventhandlers
*/ */
function register(&$controller) { function register(&$controller)
$controller->register_hook('TOOLBAR_DEFINE', 'AFTER', $this, 'insert_button', array ()); {
$controller->register_hook(
'TOOLBAR_DEFINE',
'AFTER',
$this,
'insert_button',
array()
);
} }
/** /**
* Inserts the toolbar button * Inserts the toolbar button
*/ */
function insert_button(& $event, $param) { function insert_button(& $event, $param)
{
$event->data[] = array( $event->data[] = array(
'type' => 'JCapture', 'type' => 'JCapture',
'title' => 'Screen capture', 'title' => 'Screen capture',

@ -9,7 +9,6 @@
* @author Laurent Opprecht * @author Laurent Opprecht
*/ */
require_once api_get_path(LIBRARY_PATH) . 'plugin.class.php'; require_once api_get_path(LIBRARY_PATH) . 'plugin.class.php';
require_once dirname(__FILE__) . '/lib/rss_plugin.class.php'; require_once dirname(__FILE__) . '/lib/rss_plugin.class.php';

@ -1,5 +1,4 @@
<?php <?php
// A user must be logged in. // A user must be logged in.
$_template['show_message'] = false; $_template['show_message'] = false;

@ -1,9 +1,7 @@
<?php <?php
$plugin = StaticPlugin::create(); $plugin = StaticPlugin::create();
$content = $plugin->get_content(); $content = $plugin->get_content();
$title = $plugin->get_block_title(); $title = $plugin->get_block_title();
$title = $title ? "<h4>$title</h4>" : ''; $title = $title ? "<h4>$title</h4>" : '';

@ -9,7 +9,6 @@
*/ */
class StaticPlugin extends Plugin class StaticPlugin extends Plugin
{ {
/** /**
* *
* @return StaticPlugin * @return StaticPlugin

@ -15,9 +15,7 @@ $bbb = new bbb();
if ($bbb->plugin_enabled) { if ($bbb->plugin_enabled) {
if ($bbb->is_server_running()) { if ($bbb->is_server_running()) {
if (isset($_GET['launch']) && $_GET['launch'] == 1) { if (isset($_GET['launch']) && $_GET['launch'] == 1) {
$meeting_params = array(); $meeting_params = array();
$meeting_params['meeting_name'] = api_get_course_id(); $meeting_params['meeting_name'] = api_get_course_id();

@ -143,12 +143,12 @@ class TestUrlManager extends UnitTestCase {
//var_dump($res); //var_dump($res);
} }
function testudpate() { function testupdate() {
$url_id=''; $url_id='';
$url=''; $url='';
$description=''; $description='';
$active=''; $active='';
$res=UrlManager::udpate($url_id, $url, $description, $active); $res=UrlManager::update($url_id, $url, $description, $active);
if(!is_null($res))$this->assertTrue(is_bool($res)); if(!is_null($res))$this->assertTrue(is_bool($res));
//var_dump($res); //var_dump($res);
} }

Loading…
Cancel
Save