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. 52
      main/dropbox/dropbox_functions.inc.php
  5. 12
      main/inc/lib/main_api.lib.php
  6. 2
      main/inc/lib/urlmanager.lib.php
  7. 14
      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. 21
      plugin/add_facebook_login_button/plugin.php
  11. 44
      plugin/add_shibboleth_login_button/plugin.php
  12. 2
      plugin/before_login/index.php
  13. 323
      plugin/dashboard/block_course/block_course.class.php
  14. 354
      plugin/dashboard/block_daily/block_daily.class.php
  15. 103
      plugin/dashboard/block_evaluation_graph/block_evaluation_graph.class.php
  16. 13
      plugin/dashboard/block_global_info/block_global_info.class.php
  17. 27
      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. 65
      plugin/dashboard/block_teacher/block_teacher.class.php
  21. 61
      plugin/dashboard/block_teacher_graph/block_teacher_graph.class.php
  22. 2
      plugin/date/plugin.php
  23. 7
      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. 54
      plugin/jcapture/action.php
  28. 1
      plugin/rss/plugin.php
  29. 1
      plugin/show_user_info/index.php
  30. 10
      plugin/show_user_info/plugin.php
  31. 2
      plugin/static/index.php
  32. 1
      plugin/static/lib/static_plugin.class.php
  33. 2
      plugin/ticket/start.php
  34. 4
      tests/main/inc/lib/urlmanager.lib.test.php

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

@ -12,28 +12,38 @@
* @package chamilo.dashboard
*/
class Block {
class Block
{
/**
* Contructor
*/
public function __construct() {}
public function __construct()
{
}
/**
* 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
*/
public function display_large() {}
public function display_large()
{
public function get_block_path(){
}
public function get_block_path()
{
$result = get_class($this);
return $result;
}
}
?>

@ -26,10 +26,13 @@ require_once api_get_path(LIBRARY_PATH).'document.lib.php';
/* DOWNLOAD A FOLDER */
$course_id = api_get_course_int_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.
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.
@ -40,7 +43,8 @@ if (isset($_GET['cat_id']) AND is_numeric($_GET['cat_id']) AND $_GET['action'] =
if ($_GET['sent_received'] == 'sent') {
// 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
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)
WHERE
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') {
$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)
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)
@ -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.dest_user_id = $user_id" ;
}
$files_to_download = array();
$result = Database::query($sql);
while ($row = Database::fetch_array($result)) {
$files_to_download[] = $row['id'];

@ -1034,8 +1034,8 @@ function store_feedback()
}
/**
* This function downloads all the files of the inputarray into one zip
* @param $array an array containing all the ids of the files that have to be downloaded.
* This function downloads all the files of the input array into one zip
* @param array $fileList containing all the ids of the files that have to be downloaded.
* @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 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
* @version march 2006
*/
function zip_download($array) {
function zip_download($fileList)
{
$_course = api_get_course_info();
$dropbox_cnf = getDropboxConf();
$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.
$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)
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)
WHERE file.id IN (".implode(', ',$array).") AND
file.id = person.file_id AND
(person.user_id = '".api_get_user_id()."' OR post.dest_user_id = '".api_get_user_id()."' ) ";
WHERE
file.id IN (".implode(', ', $fileList).") AND
file.id = person.file_id AND
(
person.user_id = '".api_get_user_id()."' OR
post.dest_user_id = '".api_get_user_id()."'
) ";
$result = Database::query($sql);
$files = array();
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
$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) {
$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';
DocumentManager::file_send_for_download($temp_zip_file, true, $name);
@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)
* @param $p_event a variable of PCLZip
* @param $p_header a variable of PCLZip
* @param array $p_event a variable of PCLZip
* @param array $p_header a variable of PCLZip
*
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
* @version march 2006
*/
function my_pre_add_callback($p_event, &$p_header) {
global $files;
function my_pre_add_callback($p_event, &$p_header)
{
$files = Session::read('dropbox_files_to_download');
$p_header['stored_filename'] = $files[$p_header['stored_filename']]['title'];
return 1;
}
/**
* @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, ...)

@ -881,7 +881,7 @@ function api_valid_email($address) {
* @author Roan Embrechts
*/
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;
if (api_is_drh()) {
@ -966,7 +966,7 @@ function api_protect_admin_script($allow_sessions_admins = false, $allow_drh = f
* @author Roan Embrechts
*/
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)) {
api_not_allowed($print_headers);
return false;
@ -1403,7 +1403,6 @@ function api_get_course_info_by_id($id = null) {
}
return $_course;
}
//global $_course;
global $_course;
if ($_course == '-1') $_course = array();
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
*/
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();
$is_allowed_coach_to_edit = api_is_coach();
$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)) {
return true;
} else {

@ -44,7 +44,7 @@ class UrlManager
* @param int is active or not
* @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);
$table_access_url= Database :: get_main_table(TABLE_MAIN_ACCESS_URL);

@ -1,20 +1,24 @@
<?php
// 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;
if (api_is_anonymous()) {
$_template['cas_activated'] = api_is_cas_activated();
$_template['cas_configured'] = cas_configured();
$_template['show_message'] = true;
$_template['show_message'] = true;
// the default title
$button_label = "Connexion via CAS";
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
$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_label = $plugin_info['settings']['add_cas_login_button_cas_image_url'];

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

@ -3,7 +3,10 @@
global $_user;
$_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;
// the default title
$logout_label = "Deconnexion de CAS";

@ -10,24 +10,31 @@
*/
//the plugin title
$plugin_info['title'] = 'Add a button to login using FACEBOOK account';
$plugin_info['title'] = 'Add a button to login using FACEBOOK account';
//the comments that go with the plugin
$plugin_info['comment'] = "If Facebook authntification is activated, this plugin add a button Facebook Connexion on the login page. Configure plugin to add title, comment and logo. Should be place in login_top region";
$plugin_info['comment'] = "If Facebook authntification is activated, this plugin add a button Facebook Connexion on the login page. Configure plugin to add title, comment and logo. Should be place in login_top region";
//the plugin version
$plugin_info['version'] = '1.0';
$plugin_info['version'] = '1.0';
//the plugin author
$plugin_info['author'] = 'Hubert Borderiou';
$plugin_info['author'] = 'Hubert Borderiou';
//the plugin configuration
$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'));
//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'];
$form->setDefaults($defaults);
//display form
$plugin_info['settings_form'] = $form;
// Set the templates that are going to be used
$plugin_info['templates'] = array('template.tpl');
$plugin_info['templates'] = array('template.tpl');

@ -9,28 +9,46 @@
* Plugin details (must be present)
*/
//the plugin title
$plugin_info['title'] = 'Add a button to login using Shibboleth';
$plugin_info['title'] = 'Add a button to login using Shibboleth';
//the comments that go with the plugin
$plugin_info['comment'] = "If Shibboleth is configured, this plugin add a text and a button on the login page to login with Shibboleth. Configure plugin to add title, comment and logo.";
$plugin_info['comment'] = "If Shibboleth is configured, this plugin add a text and a button on the login page to login with Shibboleth. Configure plugin to add title, comment and logo.";
//the plugin version
$plugin_info['version'] = '1.0';
$plugin_info['version'] = '1.0';
//the plugin author
$plugin_info['author'] = 'Hubert Borderiou';
$plugin_info['author'] = 'Hubert Borderiou';
//the plugin configuration
$form = new FormValidator('add_shibboleth_button_form');
$form->addElement('text', '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(
'text',
'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'));
//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_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');
$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_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['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'];
@ -40,4 +58,4 @@ $form->setDefaults($defaults);
$plugin_info['settings_form'] = $form;
//set the templates that are going to be used
$plugin_info['templates'] = array('template.tpl');
$plugin_info['templates'] = array('template.tpl');

@ -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_option2'] = $formHtml2;
}

@ -9,191 +9,200 @@
/**
* required files for getting data
*/
require_once api_get_path(LIBRARY_PATH).'thematic.lib.php';
require_once api_get_path(LIBRARY_PATH) . 'thematic.lib.php';
/**
* This class is used like controller for this course block plugin,
* the class name must be registered inside path.info file (e.g: controller = "BlockCourse"), so dashboard controller will be instantiate it
* @package chamilo.dashboard
*/
class BlockCourse extends Block {
private $user_id;
private $courses;
private $path;
private $permission = array(DRH);
/**
* Constructor
*/
public function __construct ($user_id) {
$this->user_id = $user_id;
$this->path = 'block_course';
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);
//}
}
}
class BlockCourse extends Block
{
private $user_id;
private $courses;
private $path;
private $permission = array(DRH);
/**
* This method check if a user is allowed to see the block inside dashboard interface
* @param int User id
* @return bool Is block visible for user
*/
public function is_block_visible_for_user($user_id) {
$user_info = api_get_user_info($user_id);
$user_status = $user_info['status'];
$is_block_visible_for_user = false;
if (UserManager::is_admin($user_id) || in_array($user_status, $this->permission)) {
$is_block_visible_for_user = true;
}
return $is_block_visible_for_user;
/**
* Constructor
*/
public function __construct($user_id)
{
$this->user_id = $user_id;
$this->path = 'block_course';
if ($this->is_block_visible_for_user($user_id)) {
$this->courses = CourseManager::get_courses_followed_by_drh($user_id);
}
}
/**
* This method check if a user is allowed to see the block inside dashboard interface
* @param int User id
* @return bool Is block visible for user
*/
public function is_block_visible_for_user($user_id)
{
$user_info = api_get_user_info($user_id);
$user_status = $user_info['status'];
$is_block_visible_for_user = false;
if (UserManager::is_admin($user_id) || in_array(
$user_status,
$this->permission
)
) {
$is_block_visible_for_user = true;
}
return $is_block_visible_for_user;
}
/**
* 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
* @return array column and content html
*/
public function get_block() {
global $charset;
$column = 2;
$data = array();
$content = '';
$data_table = '';
$content = $this->get_content_html();
$html = '
public function get_block()
{
global $charset;
$column = 2;
$data = array();
$content = $this->get_content_html();
$html = '
<li class="widget color-green" id="intro">
<div class="widget-head">
<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>
<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>
<div class="widget-content">
'.$content.'
' . $content . '
</div>
</li>
';
$data['column'] = $column;
$data['content_html'] = $html;
$data['column'] = $column;
$data['content_html'] = $html;
return $data;
return $data;
}
/**
* This method return a content html, it's used inside get_block method for showing it inside dashboard interface
* @return string content html
*/
public function get_content_html() {
$course_data = $this->get_course_information_data();
$content = '<div style="margin:10px;">';
$content .= '<h3><font color="#000">'.get_lang('YourCourseList').'</font></h3>';
/**
* This method return a content html, it's used inside get_block method for showing it inside dashboard interface
* @return string content html
*/
public function get_content_html()
{
$course_data = $this->get_course_information_data();
$content = '<div style="margin:10px;">';
$content .= '<h3><font color="#000">' . get_lang(
'YourCourseList'
) . '</font></h3>';
$data_table = null;
if (!empty($course_data)) {
$data_table .= '<table class="data_table" width:"95%">';
$data_table .= '<tr>
<th>'.get_lang('CourseTitle').'</th>
<th width="20%">'.get_lang('NbStudents').'</th>
<th width="20%">'.get_lang('AvgTimeSpentInTheCourse').'</th>
<th width="20%">'.get_lang('ThematicAdvance').'</th>
if (!empty($course_data)) {
$data_table .= '<table class="data_table" width:"95%">';
$data_table .= '<tr>
<th>' . get_lang('CourseTitle') . '</th>
<th width="20%">' . get_lang('NbStudents') . '</th>
<th width="20%">' . get_lang('AvgTimeSpentInTheCourse') . '</th>
<th width="20%">' . get_lang('ThematicAdvance') . '</th>
</tr>';
$i = 1;
foreach ($course_data as $course) {
if ($i%2 == 0) {
$class_tr = 'row_odd';
} else {
$class_tr = 'row_even';
}
$data_table .= '<tr class="'.$class_tr.'">';
if (!isset($course[2])) {
$course[2] = '0:00:00';
}
foreach ($course as $cell) {
$data_table .= '<td align="right">'.$cell.'</td>';
}
$data_table .= '</tr>';
$i++;
}
$data_table .= '</table>';
} else {
$data_table .= get_lang('ThereIsNoInformationAboutYourCourses');
}
$content .= $data_table;
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>';
return $content;
}
$i = 1;
foreach ($course_data as $course) {
if ($i % 2 == 0) {
$class_tr = 'row_odd';
} else {
$class_tr = 'row_even';
}
$data_table .= '<tr class="' . $class_tr . '">';
if (!isset($course[2])) {
$course[2] = '0:00:00';
}
foreach ($course as $cell) {
$data_table .= '<td align="right">' . $cell . '</td>';
}
$data_table .= '</tr>';
$i++;
}
$data_table .= '</table>';
} else {
$data_table .= get_lang('ThereIsNoInformationAboutYourCourses');
}
$content .= $data_table;
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>';
return $content;
}
/**
* Get number of courses
* @return int
*/
function get_number_of_courses() {
return count($this->courses);
}
/**
* Get course information data
* @return array
*/
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);
$a_course_students = array();
$course_data = array();
$courses = $this->courses;
$thematic = new Thematic();
foreach ($courses as $row_course) {
$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;
// 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'";
$rs = Database::query($sql);
$users = array();
while ($row = Database::fetch_array($rs)) {
$users[] = $row['user_id'];
}
if (count($users) > 0) {
$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);
} else {
$avg_time_spent_in_course = null;
}
$tematic_advance_progress = 0;
$tematic_advance = $thematic->get_total_average_of_thematic_advances($course_code, 0);
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>';
} else {
$tematic_advance_progress = '0%';
}
$table_row = array();
$table_row[] = $row_course['title'];
$table_row[] = $nb_students_in_course;
$table_row[] = $avg_time_spent_in_course;
$table_row[] = $tematic_advance_progress;
$course_data[] = $table_row;
}
return $course_data;
}
* Get number of courses
* @return int
*/
function get_number_of_courses()
{
return count($this->courses);
}
/**
* Get course information data
* @return array
*/
function get_course_information_data()
{
$tbl_course_user = Database::get_main_table(TABLE_MAIN_COURSE_USER);
$course_data = array();
$courses = $this->courses;
$thematic = new Thematic();
foreach ($courses as $row_course) {
$course_code = $row_course['code'];
$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
$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);
$users = array();
while ($row = Database::fetch_array($rs)) {
$users[] = $row['user_id'];
}
if (count($users) > 0) {
$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);
} else {
$avg_time_spent_in_course = null;
}
$tematic_advance = $thematic->get_total_average_of_thematic_advances(
$course_code,
0
);
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>';
} else {
$tematic_advance_progress = '0%';
}
$table_row = array();
$table_row[] = $row_course['title'];
$table_row[] = $nb_students_in_course;
$table_row[] = $avg_time_spent_in_course;
$table_row[] = $tematic_advance_progress;
$course_data[] = $table_row;
}
return $course_data;
}
}
?>

@ -5,158 +5,170 @@
* @package chamilo.dashboard
* @author Marco Sousa original code
* @author Julio Montoya class named was changed of name, and some minor changes
*/
/**
* required files for getting data
*/
require_once api_get_path(LIBRARY_PATH).'thematic.lib.php';
require_once api_get_path(LIBRARY_PATH).'attendance.lib.php';
require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/be.inc.php';
require_once api_get_path(LIBRARY_PATH) . 'thematic.lib.php';
require_once api_get_path(LIBRARY_PATH) . 'attendance.lib.php';
require_once api_get_path(SYS_CODE_PATH) . 'gradebook/lib/be.inc.php';
/**
* This class is used like controller for this course block plugin,
* the class name must be registered inside path.info file (e.g: controller = "BlockDiario"), so dashboard controller will be instantiate it
* @package chamilo.dashboard
*/
class BlockDaily extends Block {
private $user_id;
private $courses;
private $path;
private $permission = array(DRH);
/**
* Constructor
*/
public function __construct ($user_id) {
$this->user_id = $user_id;
$this->path = 'block_daily';
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);
//}
}
}
class BlockDaily extends Block
{
private $user_id;
private $courses;
private $path;
private $permission = array(DRH);
/**
* This method check if a user is allowed to see the block inside dashboard interface
* @param int User id
* @return bool Is block visible for user
*/
public function is_block_visible_for_user($user_id) {
$user_info = api_get_user_info($user_id);
$user_status = $user_info['status'];
$is_block_visible_for_user = false;
if (UserManager::is_admin($user_id) || in_array($user_status, $this->permission)) {
$is_block_visible_for_user = true;
}
return $is_block_visible_for_user;
/**
* Constructor
*/
public function __construct($user_id)
{
$this->user_id = $user_id;
$this->path = 'block_daily';
if ($this->is_block_visible_for_user($user_id)) {
$this->courses = CourseManager::get_courses_followed_by_drh(
$user_id
);
}
}
/**
* This method check if a user is allowed to see the block inside dashboard interface
* @param int User id
* @return bool Is block visible for user
*/
public function is_block_visible_for_user($user_id)
{
$user_info = api_get_user_info($user_id);
$user_status = $user_info['status'];
$is_block_visible_for_user = false;
if (UserManager::is_admin($user_id) || in_array(
$user_status,
$this->permission
)
) {
$is_block_visible_for_user = true;
}
return $is_block_visible_for_user;
}
/**
* 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
* @return array column and content html
*/
public function get_block() {
global $charset;
public function get_block()
{
$column = 2;
$data = array();
$content = '';
$data_table = '';
$content = $this->get_content_html();
$html = '<li class="widget color-green" id="intro">
global $charset;
$column = 2;
$data = array();
$content = $this->get_content_html();
$html = '<li class="widget color-green" id="intro">
<div class="widget-head">
<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>
<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>
<div class="widget-content">
'.$content.'
' . $content . '
</div>
</li>
';
$data['column'] = $column;
$data['content_html'] = $html;
$data['column'] = $column;
$data['content_html'] = $html;
return $data;
return $data;
}
/**
* This method return a content html, it's used inside get_block method for showing it inside dashboard interface
* @return string content html
*/
public function get_content_html() {
$course_data = $this->get_course_information_data();
$content = '<div style="margin:10px;">';
$content .= '<h3><font color="#000">'.get_lang('YourCourseList').'</font></h3>';
/**
* This method return a content html, it's used inside get_block method for showing it inside dashboard interface
* @return string content html
*/
public function get_content_html()
{
$course_data = $this->get_course_information_data();
$content = '<div style="margin:10px;">';
$content .= '<h3><font color="#000">' . get_lang(
'YourCourseList'
) . '</font></h3>';
$data_table = null;
if (!empty($course_data)) {
$data_table .= '<table class="data_table" width:"95%">';
$data_table .= '<tr>
<th>'.get_lang('CourseTitle').'</th>
<th width="20%">'.get_lang('NbStudents').'</th>
<th width="20%">'.get_lang('Evaluation').'</th>
<th width="20%">'.get_lang('ToolAttendance').'</th>
if (!empty($course_data)) {
$data_table .= '<table class="data_table" width:"95%">';
$data_table .= '<tr>
<th>' . get_lang('CourseTitle') . '</th>
<th width="20%">' . get_lang('NbStudents') . '</th>
<th width="20%">' . get_lang('Evaluation') . '</th>
<th width="20%">' . get_lang('ToolAttendance') . '</th>
</tr>';
$i = 1;
foreach ($course_data as $course) {
if ($i%2 == 0) {
$class_tr = 'row_odd';
} else {
$class_tr = 'row_even';
}
$data_table .= '<tr class="'.$class_tr.'">';
if (!isset($course[3])) {
$course[3] = get_lang('NotAvailable');
}
foreach ($course as $cell) {
$data_table .= '<td align="right">'.$cell.'</td>';
}
$data_table .= '</tr>';
$i++;
}
$data_table .= '</table>';
} else {
$data_table .= get_lang('ThereIsNoInformationAboutYourCourses');
}
$content .= $data_table;
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>';
return $content;
}
$i = 1;
foreach ($course_data as $course) {
if ($i % 2 == 0) {
$class_tr = 'row_odd';
} else {
$class_tr = 'row_even';
}
$data_table .= '<tr class="' . $class_tr . '">';
if (!isset($course[3])) {
$course[3] = get_lang('NotAvailable');
}
foreach ($course as $cell) {
$data_table .= '<td align="right">' . $cell . '</td>';
}
$data_table .= '</tr>';
$i++;
}
$data_table .= '</table>';
} else {
$data_table .= get_lang('ThereIsNoInformationAboutYourCourses');
}
$content .= $data_table;
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>';
return $content;
}
/**
* Get number of courses
* @return int
*/
function get_number_of_courses() {
return count($this->courses);
}
/**
* Get course information data
* @return array
*/
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);
$a_course_students = array();
$course_data = array();
$courses = $this->courses;
foreach ($courses as $row_course) {
* Get number of courses
* @return int
*/
function get_number_of_courses()
{
return count($this->courses);
}
/**
* Get course information data
* @return array
*/
function get_course_information_data()
{
$tbl_course_user = Database::get_main_table(TABLE_MAIN_COURSE_USER);
$course_data = array();
$courses = $this->courses;
foreach ($courses as $row_course) {
$score = null;
$course_code = $row_course['code'];
$course_info = api_get_course_info($course_code);
@ -167,63 +179,73 @@ class BlockDaily extends Block {
// Attendance table
$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";
$rs = Database::query($sql);
$attendance = array();
$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);
$attendance = array();
$attendances = array();
$param_gradebook = '';
if (isset($_SESSION['gradebook'])) {
$param_gradebook = '&gradebook='.$_SESSION['gradebook'];
$param_gradebook = '&gradebook=' . $_SESSION['gradebook'];
}
while ($row = Database::fetch_array($rs,'ASSOC')) {
while ($row = Database::fetch_array($rs, 'ASSOC')) {
$attendance['done'] = $row['attendance_qualify_max'];
$attendance['id'] = $row['id'];
//$attendance['name'] = $row['name'];
$attendance['course_code'] = $course_code;
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>';
else
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>';
} else {
$attendances[] = get_lang("NotAvailable");
}
// 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'";
$rs = Database::query($sql);
$users = array();
while ($row = Database::fetch_array($rs)) {
$users[] = $row['user_id'];
}
if (count($users) > 0) {
$nb_students_in_course = count($users);
}
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>';
} else {
$tematic_advance_progress = '0%';
}
}
}
// 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'";
$rs = Database::query($sql);
$users = array();
while ($row = Database::fetch_array($rs)) {
$users[] = $row['user_id'];
}
if (count($users) > 0) {
$nb_students_in_course = count($users);
}
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>';
} else {
$tematic_advance_progress = '0%';
}
// Score
$tbl_grade_categories = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_CATEGORY);
$sql = "SELECT id from " . $tbl_grade_categories ." WHERE course_code ='".$course_code."'";
$rs = Database::query($sql);
$category = null;
while ($row = Database::fetch_array($rs)) {
$category = $row['id'];
}
if (!empty($category)) {
$tbl_grade_categories = Database :: get_main_table(
TABLE_MAIN_GRADEBOOK_CATEGORY
);
$sql = "SELECT id from " . $tbl_grade_categories . "
WHERE course_code ='" . $course_code . "'";
$rs = Database::query($sql);
$category = null;
while ($row = Database::fetch_array($rs)) {
$category = $row['id'];
}
if (!empty($category)) {
$cat = Category::load($category);
$eval = $cat[0]->get_evaluations();
if (count($eval) > 0){
if (count($eval) > 0) {
$i = 0;
foreach ($eval as $item) {
$score .= '<a href="'.api_get_path(WEB_PATH).'main/gradebook/gradebook_view_result.php?export=pdf&cat_code='.$cat[0]->get_id().'&official_code='.$cat[0]->get_course_code().'&selecteval='.$item->get_id().$param_gradebook.'">'.$item->get_name().'</a>';
if (count($eval)-1 != $i) {
$score .= '<a href="' . api_get_path(WEB_PATH).'main/gradebook/gradebook_view_result.php?export=pdf&cat_code=' . $cat[0]->get_id() . '&official_code=' . $cat[0]->get_course_code() . '&selecteval=' . $item->get_id().$param_gradebook . '">' . $item->get_name() . '</a>';
if (count($eval) - 1 != $i) {
$score .= ', ';
}
$i++;
@ -231,17 +253,17 @@ class BlockDaily extends Block {
} else {
$score = get_lang("NotAvailable");
}
} else {
} else {
$score = get_lang("NotAvailable");
}
$table_row = array();
$table_row[] = $row_course['title'];
$table_row[] = $nb_students_in_course;
$table_row[] = $score;
$table_row[] = $attendances[0];
$course_data[] = $table_row;
}
return $course_data;
}
$table_row = array();
$table_row[] = $row_course['title'];
$table_row[] = $nb_students_in_course;
$table_row[] = $score;
$table_row[] = $attendances[0];
$course_data[] = $table_row;
}
return $course_data;
}
}

@ -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
* @package chamilo.dashboard
*/
class BlockEvaluationGraph extends Block {
class BlockEvaluationGraph extends Block
{
private $user_id;
private $courses;
private $sessions;
@ -38,25 +38,18 @@ class BlockEvaluationGraph extends Block {
/**
* Constructor
*/
public function __construct ($user_id) {
public function __construct($user_id)
{
$this->path = 'block_evaluation_graph';
$this->user_id = $user_id;
$this->bg_width = 450;
$this->bg_height = 350;
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()) {
$this->courses = CourseManager::get_courses_followed_by_drh($user_id);
}
$this->sessions = SessionManager::get_sessions_followed_by_drh($user_id);
//}
if (!api_is_session_admin()) {
$this->courses = CourseManager::get_courses_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
* @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_status = $user_info['status'];
$is_block_visible_for_user = false;
@ -79,47 +73,46 @@ class BlockEvaluationGraph extends Block {
* it's important to use the name 'get_block' for beeing used from dashboard controller
* @return array column and content html
*/
public function get_block() {
public function get_block()
{
global $charset;
$column = 1;
$data = array();
$evaluations_base_courses_graph = $this->get_evaluations_base_courses_graph();
$evaluations_courses_in_sessions_graph = $this->get_evaluations_courses_in_sessions_graph();
$html = '<li class="widget color-orange" id="intro">
<div class="widget-head">
<h3>'.get_lang('EvaluationsGraph').'</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>
<div class="widget-content" align="center">';
if (empty($evaluations_base_courses_graph) && empty($evaluations_courses_in_sessions_graph)) {
$html .= '<p>'.api_convert_encoding(get_lang('GraphicNotAvailable'),'UTF-8').'</p>';
} else {
// display evaluations base courses graph
if (!empty($evaluations_base_courses_graph)) {
foreach ($evaluations_base_courses_graph as $course_code => $img_html) {
$html .= '<div><strong>'.$course_code.'</strong></div>';
$html .= $img_html;
}
}
// display evaluations base courses graph
if (!empty($evaluations_courses_in_sessions_graph)) {
foreach ($evaluations_courses_in_sessions_graph as $session_id => $courses) {
$session_name = api_get_session_name($session_id);
$html .= '<div><strong>'.$session_name.':'.get_lang('Evaluations').'</strong></div>';
foreach ($courses as $course_code => $img_html) {
$html .= '<div><strong>'.$course_code.'</strong></div>';
$html .= $img_html;
}
}
}
}
$html .= '</div>
</li>';
<div class="widget-head">
<h3>'.get_lang('EvaluationsGraph').'</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>
<div class="widget-content" align="center">';
if (empty($evaluations_base_courses_graph) && empty($evaluations_courses_in_sessions_graph)) {
$html .= '<p>'.api_convert_encoding(get_lang('GraphicNotAvailable'),'UTF-8').'</p>';
} else {
// display evaluations base courses graph
if (!empty($evaluations_base_courses_graph)) {
foreach ($evaluations_base_courses_graph as $course_code => $img_html) {
$html .= '<div><strong>'.$course_code.'</strong></div>';
$html .= $img_html;
}
}
// display evaluations base courses graph
if (!empty($evaluations_courses_in_sessions_graph)) {
foreach ($evaluations_courses_in_sessions_graph as $session_id => $courses) {
$session_name = api_get_session_name($session_id);
$html .= '<div><strong>'.$session_name.':'.get_lang('Evaluations').'</strong></div>';
foreach ($courses as $course_code => $img_html) {
$html .= '<div><strong>'.$course_code.'</strong></div>';
$html .= $img_html;
}
}
}
}
$html .= '</div>
</li>';
$data['column'] = $column;
$data['content_html'] = $html;
@ -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
*/
public function get_evaluations_base_courses_graph() {
public function get_evaluations_base_courses_graph()
{
$graphs = array();
if (!empty($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
*/
public function get_evaluations_courses_in_sessions_graph() {
public function get_evaluations_courses_in_sessions_graph()
{
$graphs = array();
if (!empty($this->sessions)) {
$session_ids = array_keys($this->sessions);

@ -61,15 +61,12 @@ class BlockGlobalInfo extends Block
* it's important to use the name 'get_block' for beeing used from dashboard controller
* @return array column and content html
*/
public function get_block() {
public function get_block()
{
global $charset;
$column = 2;
$data = array();
$content = '';
$data_table = '';
$content = $this->get_content_html();
$content = $this->get_content_html();
$html = '
<li class="widget color-red" id="intro">
<div class="widget-head">
@ -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
* @return string content html
*/
public function get_content_html() {
public function get_content_html()
{
$global_data = $this->get_global_information_data();
$content = '<div style="margin:10px;">';
$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,
* 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
*/
class BlockSession extends Block {
class BlockSession extends Block
{
private $user_id;
private $sessions;
@ -26,15 +28,12 @@ class BlockSession extends Block {
/**
* Constructor
*/
public function __construct ($user_id) {
public function __construct ($user_id)
{
$this->user_id = $user_id;
$this->path = 'block_session';
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
* @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_status = $user_info['status'];
$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
* @return array column and content html
*/
public function get_block() {
public function get_block()
{
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
* @return string content html
*/
public function get_content_html() {
public function get_content_html()
{
$content = '';
$sessions = $this->sessions;
@ -147,7 +149,8 @@ class BlockSession extends Block {
* Get number of sessions
* @return int
*/
function get_number_of_sessions() {
function get_number_of_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
* @package chamilo.dashboard
*/
class BlockStudent extends Block {
class BlockStudent extends Block
{
private $user_id;
private $students;
@ -31,16 +32,12 @@ class BlockStudent extends Block {
/**
* Constructor
*/
public function __construct ($user_id) {
public function __construct ($user_id)
{
$this->user_id = $user_id;
$this->path = 'block_student';
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);
//}
}
}
@ -49,7 +46,8 @@ class BlockStudent extends Block {
* @param int User id
* @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_status = $user_info['status'];
$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
* @return array column and content html
*/
public function get_block() {
public function get_block()
{
global $charset;
$column = 1;
$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
* @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;
$content = '<div style="margin:10px;">';
$content .= '<h3><font color="#000">'.get_lang('YourStudents').'</font></h3>';
@ -235,6 +235,7 @@ class BlockStudent extends Block {
</div>';
}
$content .= '</div>';
return $content;
}
@ -242,7 +243,8 @@ class BlockStudent extends Block {
* Get number of students
* @return int
*/
function get_number_of_students() {
function get_number_of_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
* @package chamilo.dashboard
*/
class BlockStudentGraph extends Block {
class BlockStudentGraph extends Block
{
private $user_id;
private $students;
@ -39,7 +40,8 @@ class BlockStudentGraph extends Block {
/**
* Constructor
*/
public function __construct ($user_id) {
public function __construct ($user_id)
{
$this->user_id = $user_id;
$this->path = 'block_student_graph';
if ($this->is_block_visible_for_user($user_id)) {
@ -56,7 +58,8 @@ class BlockStudentGraph extends Block {
* @param int User id
* @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_status = $user_info['status'];
$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
* it's important to use the name 'get_block' for beeing used from dashboard controller
* This method return content html containing information about students
* 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
*/
public function get_block() {
public function get_block()
{
global $charset;
$column = 1;
$data = array();
$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
*/
public function get_students_attendance_graph() {
public function get_students_attendance_graph()
{
$students = $this->students;
$attendance = new Attendance();
@ -203,7 +209,8 @@ class BlockStudentGraph extends Block {
* Get number of students
* @return int
*/
function get_number_of_students() {
function get_number_of_students()
{
return count($this->students);
}
}

@ -12,10 +12,12 @@
/**
* 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
*/
class BlockTeacher extends Block {
class BlockTeacher extends Block
{
private $user_id;
private $teachers;
@ -25,15 +27,12 @@ class BlockTeacher extends Block {
/**
* Controller
*/
public function __construct ($user_id) {
public function __construct ($user_id)
{
$this->user_id = $user_id;
$this->path = 'block_teacher';
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
* @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_status = $user_info['status'];
$is_block_visible_for_user = false;
@ -57,29 +57,24 @@ class BlockTeacher extends Block {
* it's important to use the name 'get_block' for beeing used from dashboard controller
* @return array column and content html
*/
public function get_block() {
public function get_block()
{
global $charset;
$column = 1;
$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();
//}
$data = array();
$teacher_content_html = $this->get_teachers_content_html_for_drh();
$html = '
<li class="widget color-blue" id="intro">
<div class="widget-head">
<h3>'.get_lang('TeachersInformationsList').'</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>
<div class="widget-content">
'.$teacher_content_html.'
</div>
</li>
<li class="widget color-blue" id="intro">
<div class="widget-head">
<h3>'.get_lang('TeachersInformationsList').'</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>
<div class="widget-content">
'.$teacher_content_html.'
</div>
</li>
';
$data['column'] = $column;
@ -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
* @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;
$content = '<div style="margin:10px;">';
$content .= '<h3><font color="#000">'.get_lang('YourTeachers').'</font></h3>';
@ -141,16 +136,17 @@ class BlockTeacher extends Block {
$content .= $teachers_table;
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>';
return $content;
}
public function get_teachers_content_html_for_drh() {
public function get_teachers_content_html_for_drh()
{
$teachers = $this->teachers;
$content = '<div style="margin:10px;">';
$content .= '<h3><font color="#000">'.get_lang('YourTeachers').'</font></h3>';
@ -198,15 +194,14 @@ class BlockTeacher extends Block {
$content .= '</div>';
return $content;
}
/**
* Get number of teachers
* @return int
*/
function get_number_of_teachers() {
function get_number_of_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/pCache.class.php';
/**
* 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
* @package chamilo.dashboard
*/
class BlockTeacherGraph extends Block {
class BlockTeacherGraph extends Block
{
private $user_id;
private $teachers;
private $path;
@ -33,15 +31,12 @@ class BlockTeacherGraph extends Block {
/**
* Controller
*/
public function __construct ($user_id) {
public function __construct ($user_id)
{
$this->user_id = $user_id;
$this->path = 'block_teacher_graph';
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
* @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_status = $user_info['status'];
$is_block_visible_for_user = false;
@ -65,30 +61,23 @@ class BlockTeacherGraph extends Block {
* it's important to use the name 'get_block' for beeing used from dashboard controller
* @return array column and content html
*/
public function get_block() {
public function get_block()
{
global $charset;
$column = 1;
$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 = '
<li class="widget color-blue" id="intro">
<div class="widget-head">
<h3>'.get_lang('TeachersInformationsGraph').'</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>
<div class="widget-content" align="center">
<div style="padding:10px;"><strong>'.get_lang('TimeSpentOnThePlatformLastWeekByDay').'</strong></div>
'.$teacher_information_graph.'
</div>
</li>
<li class="widget color-blue" id="intro">
<div class="widget-head">
<h3>'.get_lang('TeachersInformationsGraph').'</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>
<div class="widget-content" align="center">
<div style="padding:10px;"><strong>'.get_lang('TimeSpentOnThePlatformLastWeekByDay').'</strong></div>
'.$teacher_information_graph.'
</div>
</li>
';
$data['column'] = $column;
@ -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
* @return string content html
*/
public function get_teachers_information_graph() {
public function get_teachers_information_graph()
{
$teachers = $this->teachers;
$graph = '';
@ -188,16 +177,16 @@ class BlockTeacherGraph extends Block {
} else {
$graph = '<p>'.api_convert_encoding(get_lang('GraphicNotAvailable'),'UTF-8').'</p>';
}
return $graph;
return $graph;
}
/**
* Get number of teachers
* @return int
*/
function get_number_of_teachers() {
function get_number_of_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).
* These settings will be used in the administration interface for plugins (Chamilo configuration settings->Plugins)

@ -1,9 +1,12 @@
<?php
// personalize the logout button behaviour
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;
// the link URL
$link_url = "#";

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

@ -9,8 +9,6 @@
* Plugin details (must be present)
*/
//the plugin title
$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,37 +5,51 @@
* @author Pavel Vlasov
*/
if (!defined('DOKU_INC')) die();
if (!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN', DOKU_INC . 'lib/plugins/');
require_once (DOKU_PLUGIN . 'action.php');
if (!defined('DOKU_INC')) {
die();
}
if (!defined('DOKU_PLUGIN')) {
define('DOKU_PLUGIN', DOKU_INC . 'lib/plugins/');
}
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
*/
function getInfo(){
return array(
'author' => 'Pavel Vlasov',
'email' => 'Pavel.Vlasov@hammurapi.com',
'name' => 'JCapture',
'desc' => 'Plugin for making screen captures.',
'url' => 'http://www.hammurapi.com/dokuwiki/doku.php/products:jcapture:start',
);
}
/**
* return some info
*/
function getInfo()
{
return array(
'author' => 'Pavel Vlasov',
'email' => 'Pavel.Vlasov@hammurapi.com',
'name' => 'JCapture',
'desc' => 'Plugin for making screen captures.',
'url' => 'http://www.hammurapi.com/dokuwiki/doku.php/products:jcapture:start',
);
}
/**
* Register the eventhandlers
*/
function register(&$controller) {
$controller->register_hook('TOOLBAR_DEFINE', 'AFTER', $this, 'insert_button', array ());
function register(&$controller)
{
$controller->register_hook(
'TOOLBAR_DEFINE',
'AFTER',
$this,
'insert_button',
array()
);
}
/**
* Inserts the toolbar button
*/
function insert_button(& $event, $param) {
$event->data[] = array (
function insert_button(& $event, $param)
{
$event->data[] = array(
'type' => 'JCapture',
'title' => 'Screen capture',
'icon' => '../../plugins/jcapture/camera.png',

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

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

@ -10,12 +10,12 @@
*/
// The plugin title
$plugin_info['title'] = 'Show user information';
$plugin_info['title'] = 'Show user information';
// The comments that go with the plugin
$plugin_info['comment'] = "Shows a welcome message, (this is an example to uses the template system: Twig)";
$plugin_info['comment'] = "Shows a welcome message, (this is an example to uses the template system: Twig)";
// The plugin version
$plugin_info['version'] = '1.0';
$plugin_info['version'] = '1.0';
// The plugin author
$plugin_info['author'] = 'Julio Montoya';
$plugin_info['author'] = 'Julio Montoya';
// Set the templates that are going to be used
$plugin_info['templates'] = array('template.tpl');
$plugin_info['templates'] = array('template.tpl');

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

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

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

@ -143,12 +143,12 @@ class TestUrlManager extends UnitTestCase {
//var_dump($res);
}
function testudpate() {
function testupdate() {
$url_id='';
$url='';
$description='';
$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));
//var_dump($res);
}

Loading…
Cancel
Save