|
|
|
@ -19,7 +19,8 @@ require_once api_get_path(SYS_CODE_PATH).'admin/statistics/statistics.lib.php'; |
|
|
|
|
* instantiate it |
|
|
|
|
* @package chamilo.dashboard |
|
|
|
|
*/ |
|
|
|
|
class BlockGlobalInfo extends Block { |
|
|
|
|
class BlockGlobalInfo extends Block |
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
private $user_id; |
|
|
|
|
private $courses; |
|
|
|
@ -29,7 +30,8 @@ class BlockGlobalInfo extends Block { |
|
|
|
|
/** |
|
|
|
|
* Constructor |
|
|
|
|
*/ |
|
|
|
|
public function __construct ($user_id) { |
|
|
|
|
public function __construct ($user_id) |
|
|
|
|
{ |
|
|
|
|
$this->user_id = $user_id; |
|
|
|
|
$this->path = 'block_global_info'; |
|
|
|
|
if ($this->is_block_visible_for_user($user_id)) { |
|
|
|
@ -42,7 +44,8 @@ class BlockGlobalInfo 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; |
|
|
|
@ -93,6 +96,7 @@ class BlockGlobalInfo extends Block { |
|
|
|
|
$global_data = $this->get_global_information_data(); |
|
|
|
|
$content = '<div style="margin:10px;">'; |
|
|
|
|
$content .= '<h3><font color="#000">'.get_lang('GlobalPlatformInformation').'</font></h3>'; |
|
|
|
|
$data_table = null; |
|
|
|
|
if (!empty($global_data)) { |
|
|
|
|
$data_table = '<table class="data_table" width:"95%">'; |
|
|
|
|
$i = 1; |
|
|
|
@ -123,22 +127,22 @@ class BlockGlobalInfo extends Block { |
|
|
|
|
* Get global information data |
|
|
|
|
* @return array |
|
|
|
|
*/ |
|
|
|
|
function get_global_information_data() { |
|
|
|
|
function get_global_information_data() |
|
|
|
|
{ |
|
|
|
|
// Two-dimensional array with data about the system |
|
|
|
|
$global_info = array(); |
|
|
|
|
$path = api_get_path(WEB_CODE_PATH); |
|
|
|
|
// Check total number of users |
|
|
|
|
$global_info[] = array(get_lang('CountUsers'), '<a href="'.$path.'admin/user_list.php">'.statistics::count_users().'</a>'); |
|
|
|
|
$global_info = array( |
|
|
|
|
array(get_lang('CountUsers'), '<a href="'.$path.'admin/user_list.php">'.Statistics::count_users().'</a>'), |
|
|
|
|
// Check only active users |
|
|
|
|
$global_info[] = array(get_lang('NumberOfUsersActive'), '<a href="'.$path.'admin/user_list.php?keyword_firstname=&keyword_lastname=&keyword_username=&keyword_email=&keyword_officialcode=&keyword_status=%25&keyword_active=1&submit=&_qf__advanced_search=">'.statistics::count_users(null,null,null,true).'</a>'); |
|
|
|
|
array(get_lang('NumberOfUsersActive'), '<a href="'.$path.'admin/user_list.php?keyword_firstname=&keyword_lastname=&keyword_username=&keyword_email=&keyword_officialcode=&keyword_status=%25&keyword_active=1&submit=&_qf__advanced_search=">'.Statistics::count_users(null,null,null,true).'</a>'), |
|
|
|
|
// Check number of courses |
|
|
|
|
$global_info[] = array(get_lang('NumberOfCoursesTotal'), '<a href="'.$path.'admin/course_list.php">'.statistics::count_courses().'</a>'); |
|
|
|
|
$global_info[] = array(get_lang('NumberOfCoursesPublic'), '<a href="'.$path.'admin/course_list.php?keyword_code=&keyword_title=&keyword_language=%25&keyword_category=&keyword_visibility='.COURSE_VISIBILITY_OPEN_WORLD.'&keyword_subscribe=%25&keyword_unsubscribe=%25&submit=&_qf__advanced_course_search=">'.statistics::count_courses_by_visibility(COURSE_VISIBILITY_OPEN_WORLD).'</a>'); |
|
|
|
|
$global_info[] = array(get_lang('NumberOfCoursesOpen'), '<a href="'.$path.'admin/course_list.php?keyword_code=&keyword_title=&keyword_language=%25&keyword_category=&keyword_visibility='.COURSE_VISIBILITY_OPEN_PLATFORM.'&keyword_subscribe=%25&keyword_unsubscribe=%25&submit=&_qf__advanced_course_search=">'.statistics::count_courses_by_visibility(COURSE_VISIBILITY_OPEN_PLATFORM).'</a>'); |
|
|
|
|
$global_info[] = array(get_lang('NumberOfCoursesPrivate'), '<a href="'.$path.'admin/course_list.php?keyword_code=&keyword_title=&keyword_language=%25&keyword_category=&keyword_visibility='.COURSE_VISIBILITY_REGISTERED.'&keyword_subscribe=%25&keyword_unsubscribe=%25&submit=&_qf__advanced_course_search=">'.statistics::count_courses_by_visibility(COURSE_VISIBILITY_REGISTERED).'</a>'); |
|
|
|
|
$global_info[] = array(get_lang('NumberOfCoursesClosed'), '<a href="'.$path.'admin/course_list.php?keyword_code=&keyword_title=&keyword_language=%25&keyword_category=&keyword_visibility='.COURSE_VISIBILITY_CLOSED.'&keyword_subscribe=%25&keyword_unsubscribe=%25&submit=&_qf__advanced_course_search=">'.statistics::count_courses_by_visibility(COURSE_VISIBILITY_CLOSED).'</a>'); |
|
|
|
|
array(get_lang('NumberOfCoursesTotal'), '<a href="'.$path.'admin/course_list.php">'.Statistics::count_courses().'</a>'), |
|
|
|
|
array(get_lang('NumberOfCoursesPublic'), '<a href="'.$path.'admin/course_list.php?keyword_code=&keyword_title=&keyword_language=%25&keyword_category=&keyword_visibility='.COURSE_VISIBILITY_OPEN_WORLD.'&keyword_subscribe=%25&keyword_unsubscribe=%25&submit=&_qf__advanced_course_search=">'.Statistics::count_courses_by_visibility(COURSE_VISIBILITY_OPEN_WORLD).'</a>'), |
|
|
|
|
array(get_lang('NumberOfCoursesOpen'), '<a href="'.$path.'admin/course_list.php?keyword_code=&keyword_title=&keyword_language=%25&keyword_category=&keyword_visibility='.COURSE_VISIBILITY_OPEN_PLATFORM.'&keyword_subscribe=%25&keyword_unsubscribe=%25&submit=&_qf__advanced_course_search=">'.Statistics::count_courses_by_visibility(COURSE_VISIBILITY_OPEN_PLATFORM).'</a>'), |
|
|
|
|
array(get_lang('NumberOfCoursesPrivate'), '<a href="'.$path.'admin/course_list.php?keyword_code=&keyword_title=&keyword_language=%25&keyword_category=&keyword_visibility='.COURSE_VISIBILITY_REGISTERED.'&keyword_subscribe=%25&keyword_unsubscribe=%25&submit=&_qf__advanced_course_search=">'.Statistics::count_courses_by_visibility(COURSE_VISIBILITY_REGISTERED).'</a>'), |
|
|
|
|
array(get_lang('NumberOfCoursesClosed'), '<a href="'.$path.'admin/course_list.php?keyword_code=&keyword_title=&keyword_language=%25&keyword_category=&keyword_visibility='.COURSE_VISIBILITY_CLOSED.'&keyword_subscribe=%25&keyword_unsubscribe=%25&submit=&_qf__advanced_course_search=">'.Statistics::count_courses_by_visibility(COURSE_VISIBILITY_CLOSED).'</a>') |
|
|
|
|
); |
|
|
|
|
return $global_info; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|