|
|
|
@ -1,4 +1,6 @@ |
|
|
|
|
<?php |
|
|
|
|
/* For licensing terms, see /license.txt */ |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* This file is part of teacher block plugin for dashboard, |
|
|
|
|
* it should be required inside dashboard controller for showing it into dashboard interface from plattform |
|
|
|
@ -6,10 +8,6 @@ |
|
|
|
|
* @author Christian Fasanando |
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* required files for getting data |
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* This class is used like controller for teacher block plugin, |
|
|
|
|
* the class name must be registered inside path.info file |
|
|
|
@ -18,7 +16,6 @@ |
|
|
|
|
*/ |
|
|
|
|
class BlockTeacher extends Block |
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
private $user_id; |
|
|
|
|
private $teachers; |
|
|
|
|
private $path; |
|
|
|
@ -53,13 +50,14 @@ class BlockTeacher extends Block |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* This method return content html containing information about teachers 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 |
|
|
|
|
* teachers 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 = 1; |
|
|
|
|
$data = array(); |
|
|
|
@ -83,17 +81,16 @@ class BlockTeacher extends Block |
|
|
|
|
$data['content_html'] = $html; |
|
|
|
|
|
|
|
|
|
return $data; |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 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 |
|
|
|
|
*/ |
|
|
|
|
public function get_teachers_content_html_for_platform_admin() |
|
|
|
|
{ |
|
|
|
|
$teachers = $this->teachers; |
|
|
|
|
//$content = '<div style="margin:10px;">'; |
|
|
|
|
$content = '<h4>'.get_lang('YourTeachers').'</h4>'; |
|
|
|
|
|
|
|
|
|
$teachers_table = null; |
|
|
|
@ -106,10 +103,8 @@ class BlockTeacher extends Block |
|
|
|
|
<th>'.get_lang('LastConnexion').'</th> |
|
|
|
|
</tr> |
|
|
|
|
'; |
|
|
|
|
|
|
|
|
|
$i = 1; |
|
|
|
|
foreach ($teachers as $teacher) { |
|
|
|
|
|
|
|
|
|
$teacher_id = $teacher['user_id']; |
|
|
|
|
$firstname = $teacher['firstname']; |
|
|
|
|
$lastname = $teacher['lastname']; |
|
|
|
@ -118,9 +113,11 @@ class BlockTeacher extends Block |
|
|
|
|
$time_on_platform = api_time_to_hms(Tracking::get_time_spent_on_the_platform($teacher_id)); |
|
|
|
|
$last_connection = Tracking::get_last_connection_date($teacher_id); |
|
|
|
|
|
|
|
|
|
if ($i%2 == 0) $class_tr = 'row_odd'; |
|
|
|
|
else $class_tr = 'row_even'; |
|
|
|
|
|
|
|
|
|
if ($i % 2 == 0) { |
|
|
|
|
$class_tr = 'row_odd'; |
|
|
|
|
} else { |
|
|
|
|
$class_tr = 'row_even'; |
|
|
|
|
} |
|
|
|
|
$teachers_table .= ' |
|
|
|
|
<tr class="'.$class_tr.'"> |
|
|
|
|
<td>'.api_get_person_name($firstname, $lastname).' ('.$username.')</td> |
|
|
|
@ -150,7 +147,6 @@ class BlockTeacher extends Block |
|
|
|
|
public function get_teachers_content_html_for_drh() |
|
|
|
|
{ |
|
|
|
|
$teachers = $this->teachers; |
|
|
|
|
//$content = '<div style="margin:10px;">'; |
|
|
|
|
$content = '<h4>'.get_lang('YourTeachers').'</h4>'; |
|
|
|
|
$teachers_table = null; |
|
|
|
|
if (count($teachers) > 0) { |
|
|
|
@ -167,15 +163,19 @@ class BlockTeacher extends Block |
|
|
|
|
|
|
|
|
|
$i = 1; |
|
|
|
|
foreach ($teachers as $teacher) { |
|
|
|
|
|
|
|
|
|
$teacher_id = $teacher['user_id']; |
|
|
|
|
$firstname = $teacher['firstname']; |
|
|
|
|
$lastname = $teacher['lastname']; |
|
|
|
|
$username = $teacher['username']; |
|
|
|
|
$time_on_platform = api_time_to_hms(Tracking::get_time_spent_on_the_platform($teacher_id,true)); |
|
|
|
|
$time_on_platform = api_time_to_hms( |
|
|
|
|
Tracking::get_time_spent_on_the_platform($teacher_id, true) |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
if ($i%2 == 0) $class_tr = 'row_odd'; |
|
|
|
|
else $class_tr = 'row_even'; |
|
|
|
|
if ($i % 2 == 0) { |
|
|
|
|
$class_tr = 'row_odd'; |
|
|
|
|
} else { |
|
|
|
|
$class_tr = 'row_even'; |
|
|
|
|
} |
|
|
|
|
$teachers_table .= '<tr class="'.$class_tr.'"> |
|
|
|
|
<td>'.api_get_person_name($firstname, $lastname).' ('.$username.')</td> |
|
|
|
|
<td align="right">'.$time_on_platform.'</td> |
|
|
|
@ -187,14 +187,10 @@ class BlockTeacher extends Block |
|
|
|
|
} else { |
|
|
|
|
$teachers_table .= get_lang('ThereIsNoInformationAboutYourTeachers'); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$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/teachers.php">'.get_lang('SeeMore').'</a></div>'; |
|
|
|
|
} |
|
|
|
|
//$content .= '</div>'; |
|
|
|
|
|
|
|
|
|
return $content; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -202,7 +198,7 @@ class BlockTeacher extends Block |
|
|
|
|
* Get number of teachers |
|
|
|
|
* @return int |
|
|
|
|
*/ |
|
|
|
|
function get_number_of_teachers() |
|
|
|
|
public function get_number_of_teachers() |
|
|
|
|
{ |
|
|
|
|
return count($this->teachers); |
|
|
|
|
} |
|
|
|
|