Merge branch '1.10.x' into hook

Conflicts:
	main/install/db_main.sql
	vendor/autoload.php
	vendor/composer/autoload_real.php
1.10.x
Daniel Barreto 11 years ago
commit 787f8a6435
  1. 1
      composer.json
  2. 51
      composer.lock
  3. 89
      main/admin/dashboard_add_users_to_user.php
  4. 2
      main/admin/statistics/statistics.lib.php
  5. 126
      main/admin/teacher_time_report.php
  6. 1
      main/admin/user_add.php
  7. 1
      main/admin/user_edit.php
  8. 36
      main/admin/user_list.php
  9. 4
      main/auth/inscription.php
  10. 13
      main/auth/my_progress.php
  11. 105
      main/cron/fix_online_time.php
  12. 4
      main/exercice/exercise.class.php
  13. 6
      main/exercice/exercise.lib.php
  14. 2
      main/exercice/exercise_report.php
  15. 6
      main/exercice/exercise_show.php
  16. 202
      main/fonts/opensans/LICENSE.txt
  17. BIN
      main/fonts/opensans/OpenSans-Bold.ttf
  18. BIN
      main/fonts/opensans/OpenSans-BoldItalic.ttf
  19. BIN
      main/fonts/opensans/OpenSans-ExtraBold.ttf
  20. BIN
      main/fonts/opensans/OpenSans-ExtraBoldItalic.ttf
  21. BIN
      main/fonts/opensans/OpenSans-Italic.ttf
  22. BIN
      main/fonts/opensans/OpenSans-Light.ttf
  23. BIN
      main/fonts/opensans/OpenSans-LightItalic.ttf
  24. BIN
      main/fonts/opensans/OpenSans-Regular.ttf
  25. BIN
      main/fonts/opensans/OpenSans-Semibold.ttf
  26. BIN
      main/fonts/opensans/OpenSans-SemiboldItalic.ttf
  27. 2
      main/gradebook/gradebook_flatview.php
  28. 30
      main/gradebook/lib/be/category.class.php
  29. 16
      main/gradebook/lib/be/evallink.class.php
  30. 2
      main/gradebook/lib/be/exerciselink.class.php
  31. 486
      main/gradebook/lib/fe/flatviewtable.class.php
  32. 25
      main/gradebook/lib/flatview_data_generator.class.php
  33. 2
      main/gradebook/lib/scoredisplay.class.php
  34. 2
      main/inc/ajax/model.ajax.php
  35. 19
      main/inc/autoload.inc.php
  36. 4
      main/inc/lib/autoload.class.php
  37. 10
      main/inc/lib/banner.lib.php
  38. 5
      main/inc/lib/certificate.lib.php
  39. 50
      main/inc/lib/main_api.lib.php
  40. 450
      main/inc/lib/pchart/MyHorBar.class.php
  41. 6
      main/inc/lib/pchart/fonts/index.html
  42. BIN
      main/inc/lib/pchart/fonts/tahoma.ttf
  43. 6
      main/inc/lib/pchart/index.html
  44. 121
      main/inc/lib/pchart/pCache.class.php
  45. 3655
      main/inc/lib/pchart/pChart.class.php
  46. 262
      main/inc/lib/pchart/pData.class.php
  47. 17
      main/inc/lib/pchart/palette/blue_tones.txt
  48. 14
      main/inc/lib/pchart/palette/default.txt
  49. 8
      main/inc/lib/pchart/palette/hard_blue.txt
  50. 6
      main/inc/lib/pchart/palette/index.html
  51. 13
      main/inc/lib/pchart/palette/pastel.txt
  52. 7
      main/inc/lib/pchart/palette/reduced.txt
  53. 5
      main/inc/lib/pchart/palette/soft_tones.txt
  54. 44
      main/inc/lib/sessionmanager.lib.php
  55. 105
      main/inc/lib/skill.lib.php
  56. 6
      main/inc/lib/sortable_table.class.php
  57. 528
      main/inc/lib/tracking.lib.php
  58. 162
      main/inc/lib/usermanager.lib.php
  59. 6
      main/inc/lib/userportal.lib.php
  60. 11
      main/install/db_main.sql
  61. 5
      main/install/migrate-db-1.9.0-1.10.0-pre.sql
  62. 6
      main/lang/english/trad4all.inc.php
  63. 4
      main/lang/french/trad4all.inc.php
  64. 1
      main/lang/slovak/exercice.inc.php
  65. 18
      main/lang/slovak/help.inc.php
  66. 1
      main/lang/slovak/install.inc.php
  67. 1
      main/lang/slovak/tracking.inc.php
  68. 111
      main/lang/slovak/trad4all.inc.php
  69. 9
      main/lang/spanish/trad4all.inc.php
  70. 3
      main/mySpace/access_details.php
  71. 4
      main/mySpace/myStudents.php
  72. 200
      main/mySpace/myspace.lib.php
  73. 27
      main/mySpace/student.php
  74. 2
      main/mySpace/teachers.php
  75. 29
      main/newscorm/learnpathItem.class.php
  76. 9
      main/palettes/pchart/default.color
  77. 25
      main/social/home.php
  78. 176
      main/social/my_skills_report.php
  79. 2
      main/template/default/admin/teacher_time_report.tpl
  80. 134
      main/template/default/layout/footer.tpl
  81. 80
      main/template/default/skill/drh_report.tpl
  82. 45
      main/template/default/skill/student_boss_report.tpl
  83. 32
      main/template/default/skill/student_report.tpl
  84. 448
      plugin/dashboard/block_evaluation_graph/block_evaluation_graph.class.php
  85. 172
      plugin/dashboard/block_student_graph/block_student_graph.class.php
  86. 137
      plugin/dashboard/block_teacher_graph/block_teacher_graph.class.php
  87. 2
      vendor/autoload.php
  88. 18
      vendor/composer/autoload_classmap.php
  89. 1
      vendor/composer/autoload_files.php
  90. 1
      vendor/composer/autoload_psr4.php
  91. 10
      vendor/composer/autoload_real.php
  92. 51
      vendor/composer/installed.json
  93. 24
      vendor/szymach/c-pchart/.gitignore
  94. 16
      vendor/szymach/c-pchart/.travis.yml
  95. 675
      vendor/szymach/c-pchart/GPLv3.txt
  96. 21
      vendor/szymach/c-pchart/LICENSE
  97. 121
      vendor/szymach/c-pchart/README.md
  98. 0
      vendor/szymach/c-pchart/app/cache/cache.db
  99. 0
      vendor/szymach/c-pchart/app/cache/index.db
  100. 17
      vendor/szymach/c-pchart/composer.json
  101. Some files were not shown because too many files have changed in this diff Show More

@ -35,6 +35,7 @@
"emojione/emojione": "1.3.0",
"zendframework/zend-config": "2.3.3",
"ezyang/htmlpurifier": "4.6.0",
"szymach/c-pchart": "1.*",
"aferrandini/phpqrcode": "1.0.1"
},
"extra": {

51
composer.lock generated

@ -4,7 +4,7 @@
"Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"hash": "a422c2e4eb5cfff2fa4784fd9036ed9c",
"hash": "14f25295cfdba7534deecf11519b2d22",
"packages": [
{
"name": "aferrandini/phpqrcode",
@ -782,8 +782,11 @@
"email": "fabien@symfony.com"
}
],
"description": "Symfony Process Component",
"homepage": "http://symfony.com",
"description": "Standards compliant HTML filter written in PHP",
"homepage": "http://htmlpurifier.org/",
"keywords": [
"html"
],
"time": "2015-01-25 04:39:26"
},
{
@ -833,6 +836,48 @@
"homepage": "http://symfony.com",
"time": "2015-01-25 04:39:26"
},
{
"name": "szymach/c-pchart",
"version": "1.1.5",
"source": {
"type": "git",
"url": "https://github.com/szymach/c-pchart.git",
"reference": "1d54c14f8b7295abc87039ba806fed45d29d67d9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/szymach/c-pchart/zipball/1d54c14f8b7295abc87039ba806fed45d29d67d9",
"reference": "1d54c14f8b7295abc87039ba806fed45d29d67d9",
"shasum": ""
},
"require": {
"ext-gd": "*",
"php": ">=5.3.3"
},
"type": "project",
"autoload": {
"psr-4": {
"CpChart\\": "src/"
},
"files": [
"src/Resources/data/constants.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "Port of \"pChart\" library into PHP 5.3.",
"homepage": "https://github.com/szymach/c-pchart",
"keywords": [
"c-pChart",
"charts",
"composer",
"pchart",
"statistics"
],
"time": "2015-01-28 19:54:53"
},
{
"name": "toin0u/digitalocean",
"version": "1.4.2",

@ -40,6 +40,8 @@ $user_info = api_get_user_info($user_id);
$user_anonymous = api_get_anonymous_id();
$current_user_id = api_get_user_id();
$userStatus = api_get_user_status($user_id);
$firstLetterUser = isset($_POST['firstLetterUser']) ? $_POST['firstLetterUser'] : null;
// setting the name of the tool
@ -47,6 +49,8 @@ if (UserManager::is_admin($user_id)) {
$tool_name= get_lang('AssignUsersToPlatformAdministrator');
} else if ($user_info['status'] == SESSIONADMIN) {
$tool_name= get_lang('AssignUsersToSessionsAdministrator');
} else if ($user_info['status'] == STUDENT_BOSS) {
$tool_name= get_lang('AssignUsersToBoss');
} else {
$tool_name= get_lang('AssignUsersToHumanResourcesManager');
}
@ -62,7 +66,7 @@ if (!api_is_platform_admin()) {
function search_users($needle,$type)
{
global $tbl_access_url_rel_user, $tbl_user, $user_anonymous, $current_user_id, $user_id;
global $tbl_access_url_rel_user, $tbl_user, $user_anonymous, $current_user_id, $user_id, $userStatus;
$xajax_response = new XajaxResponse();
$return = '';
@ -70,8 +74,17 @@ function search_users($needle,$type)
// xajax send utf8 datas... datas in db can be non-utf8 datas
$charset = api_get_system_encoding();
$needle = api_convert_encoding($needle, $charset, 'utf-8');
$assigned_users_to_hrm = array();
switch ($userStatus) {
case DRH:
$assigned_users_to_hrm = UserManager::get_users_followed_by_drh($user_id);
break;
case STUDENT_BOSS:
$assigned_users_to_hrm = UserManager::getUsersFollowedByStudentBoss($user_id);
break;
}
$assigned_users_to_hrm = UserManager::get_users_followed_by_drh($user_id);
$assigned_users_id = array_keys($assigned_users_to_hrm);
$without_assigned_users = '';
@ -92,7 +105,7 @@ function search_users($needle,$type)
LEFT JOIN $tbl_access_url_rel_user au ON (au.user_id = user.user_id)
WHERE
".(api_sort_by_first_name() ? 'firstname' : 'lastname')." LIKE '$needle%' AND
status NOT IN(".DRH.", ".SESSIONADMIN.") AND
status NOT IN(".DRH.", ".SESSIONADMIN.", " . STUDENT_BOSS . ") AND
user.user_id NOT IN ($user_anonymous, $current_user_id, $user_id)
$without_assigned_users AND
access_url_id = ".api_get_current_access_url_id()."
@ -104,7 +117,7 @@ function search_users($needle,$type)
FROM $tbl_user user
WHERE
".(api_sort_by_first_name() ? 'firstname' : 'lastname')." LIKE '$needle%' AND
status NOT IN(".DRH.", ".SESSIONADMIN.") AND
status NOT IN(".DRH.", ".SESSIONADMIN.", " . STUDENT_BOSS . ") AND
user_id NOT IN ($user_anonymous, $current_user_id, $user_id)
$without_assigned_users
$order_clause
@ -127,10 +140,19 @@ function search_users($needle,$type)
username LIKE "'.$needle.'%" OR
firstname LIKE "'.$needle.'%" OR
lastname LIKE "'.$needle.'%"
) AND
user.status<>6 AND user.status<>'.DRH.' '.
$order_clause.
' LIMIT 11';
) AND ';
switch ($userStatus) {
case DRH:
$sql .= " user.status <> 6 AND user.status <> " . DRH;
break;
case STUDENT_BOSS:
$sql .= " user.status <> 6 AND user.status <> " . STUDENT_BOSS;
break;
}
$sql .= " $order_clause LIMIT 11";
$rs = Database::query($sql);
$i = 0;
while ($user = Database :: fetch_array($rs)) {
@ -267,7 +289,18 @@ if (!empty($filters) && !empty($filterData)) {
$msg = '';
if (isset($_POST['formSent']) && intval($_POST['formSent']) == 1) {
$user_list = $_POST['UsersList'];
$affected_rows = UserManager::suscribe_users_to_hr_manager($user_id, $user_list);
switch ($userStatus) {
case DRH:
$affected_rows = UserManager::suscribe_users_to_hr_manager($user_id, $user_list);
break;
case STUDENT_BOSS;
$affected_rows = UserManager::subscribeUsersToBoss($user_id, $user_list);
break;
default:
$affected_rows = 0;
}
if ($affected_rows) {
$msg = get_lang('AssignedUsersHaveBeenUpdatedSuccessfully');
}
@ -278,11 +311,27 @@ Display::display_header($tool_name);
// actions
echo '<div class="actions">';
echo '<span style="float: right;margin:0px;padding:0px;">
<a href="dashboard_add_courses_to_user.php?user='.$user_id.'">'.
Display::return_icon('course_add.gif', get_lang('AssignCourses'), array('style'=>'vertical-align:middle')).' '.get_lang('AssignCourses').'</a>
<a href="dashboard_add_sessions_to_user.php?user='.$user_id.'">'.
Display::return_icon('view_more_stats.gif', get_lang('AssignSessions'), array('style'=>'vertical-align:middle')).' '.get_lang('AssignSessions').'</a></span>';
if ($userStatus != STUDENT_BOSS) {
$actions = Display::url(
Display::return_icon('course_add.gif', get_lang('AssignCourses'),
array(
'style' => 'vertical-align:middle'
)) . get_lang('AssignCourses'), "dashboard_add_courses_to_user.php?user=$user_id"
);
$actions .= Display::url(
Display::return_icon('view_more_stats.gif', get_lang('AssignSessions'),
array(
'style' => 'vertical-align:middle'
)) . get_lang('AssignSessions'), "dashboard_add_sessions_to_user.php?user=$user_id"
);
echo Display::span($actions, array(
'style' => 'float: right; margin: 0; paddingg: 0;'
));
}
echo Display::url(get_lang('AdvancedSearch'), '#', array('class' => 'advanced_options', 'id' => 'advanced_search'));
echo '</div>';
@ -294,7 +343,15 @@ echo Display::page_header(
sprintf(get_lang('AssignUsersToX'), api_get_person_name($user_info['firstname'], $user_info['lastname']))
);
$assigned_users_to_hrm = UserManager::get_users_followed_by_drh($user_id);
switch ($userStatus) {
case DRH:
$assigned_users_to_hrm = UserManager::get_users_followed_by_drh($user_id);
break;
case STUDENT_BOSS;
$assigned_users_to_hrm = UserManager::getUsersFollowedByStudentBoss($user_id);
break;
}
$assigned_users_id = array_keys($assigned_users_to_hrm);
$without_assigned_users = '';
if (count($assigned_users_id) > 0) {
@ -368,6 +425,8 @@ if(!empty($msg)) {
echo get_lang('AssignedUsersListToPlatformAdministrator');
} else if ($user_info['status'] == SESSIONADMIN) {
echo get_lang('AssignedUsersListToSessionsAdministrator');
} else if ($user_info['status'] == STUDENT_BOSS) {
echo get_lang('AssignedUsersListToStudentBoss');
} else {
echo get_lang('AssignedUsersListToHumanResourcesManager');
}

@ -252,7 +252,7 @@ class Statistics
// User id.
$row[3] = Display::url(
$row[3],
api_get_path(WEB_CODE_PATH).'admin/user_information?user_id='.$row[4], array('title' => get_lang('UserInfo'))
api_get_path(WEB_CODE_PATH).'admin/user_information.php?user_id='.$row[4], array('title' => get_lang('UserInfo'))
);
$row[4] = TrackingUserLog::get_ip_from_user_event($row[4], $row[5], true);

@ -70,6 +70,35 @@ if (!empty($selectedCourse)) {
$course = api_get_course_info($selectedCourse);
$reportTitle = sprintf(get_lang('TimeReportForCourseX'), $course['title']);
$teachers = CourseManager::get_teacher_list_from_course_code($selectedCourse);
foreach ($teachers as $teacher) {
$totalTime = UserManager::getExpendedTimeInCourses(
$teacher['user_id'],
$selectedCourse,
0,
$selectedFrom,
$selectedUntil
);
$formatedTime = api_format_time($totalTime);
$timeReport->data[] = array(
'session' => null,
'course' => array(
'id' => $course['real_id'],
'name' => $course['title']
),
'coach' => array(
'userId' => $teacher['user_id'],
'lastname' => $teacher['lastname'],
'firstname' => $teacher['firstname'],
'username' => $teacher['username'],
'completeName' => api_get_person_name($teacher['firstname'], $teacher['lastname'])
),
'totalTime' => $formatedTime
);
}
$sessionsByCourse = SessionManager::get_session_by_course($selectedCourse);
@ -78,13 +107,14 @@ if (!empty($selectedCourse)) {
if ($coaches) {
foreach ($coaches as $coach) {
$totalTime = SessionManager::getUserTimeInCourse(
$totalTime = UserManager::getExpendedTimeInCourses(
$coach['user_id'],
$selectedCourse,
$session['id'],
$selectedFrom,
$selectedUntil
);
$formatedTime = api_format_time($totalTime);
$timeReport->data[] = array(
'session' => array(
@ -102,7 +132,7 @@ if (!empty($selectedCourse)) {
'username' => $coach['username'],
'completeName' => api_get_person_name($coach['firstname'], $coach['lastname'])
),
'totalTime' => $totalTime
'totalTime' => $formatedTime
);
}
}
@ -113,33 +143,37 @@ if (!empty($selectedSession)) {
$withFilter = true;
$session = api_get_session_info($selectedSession);
$sessionData = array(
'id' => $session['id'],
'name' => $session['name']
);
$reportTitle = sprintf(get_lang('TimeReportForSessionX'), $session['name']);
$courses = SessionManager::get_course_list_by_session_id($selectedSession);
foreach ($courses as $course) {
$courseData = array(
'id' => $course['id'],
'name' => $course['title']
);
$coaches = CourseManager::get_coachs_from_course($selectedSession, $course['code']);
if ($coaches) {
foreach ($coaches as $coach) {
$totalTime = SessionManager::getUserTimeInCourse(
$totalTime = UserManager::getExpendedTimeInCourses(
$coach['user_id'],
$course['code'],
$selectedSession,
$selectedFrom,
$selectedUntil
);
$formatedTime = api_format_time($totalTime);
$timeReport->data[] = array(
'session' => array(
'id' => $session['id'],
'name' => $session['name']
),
'course' => array(
'id' => $course['id'],
'name' => $course['title']
),
'session' => $sessionData,
'course' => $courseData,
'coach' => array(
'userId' => $coach['user_id'],
'lastname' => $coach['lastname'],
@ -147,7 +181,7 @@ if (!empty($selectedSession)) {
'username' => $coach['username'],
'completeName' => api_get_person_name($coach['firstname'], $coach['lastname'])
),
'totalTime' => $totalTime
'totalTime' => $formatedTime
);
}
}
@ -157,42 +191,73 @@ if (!empty($selectedSession)) {
if (!empty($selectedTeacher)) {
$withFilter = true;
$coach = api_get_user_info($selectedTeacher);
$reportTitle = sprintf(get_lang('TimeReportForTeacherX'), $coach['complete_name']);
$teacher = api_get_user_info();
$teacherData = array(
'userId' => $teacher['user_id'],
'lastname' => $teacher['lastname'],
'firstname' => $teacher['firstname'],
'username' => $teacher['username'],
'completeName' => $teacher['complete_name']
);
$reportTitle = sprintf(get_lang('TimeReportForTeacherX'), $teacher['complete_name']);
$courses = CourseManager::get_courses_list_by_user_id($selectedTeacher, false);
if (!empty($courses)) {
foreach ($courses as $course) {
$courseInfo = api_get_course_info($course['code']);
$totalTime = UserManager::getExpendedTimeInCourses(
$selectedTeacher,
$course['code'],
0,
$selectedFrom,
$selectedUntil
);
$formatedTime = api_format_time($totalTime);
$timeReport->data[] = array(
'session' => null,
'course' => array(
'id' => $courseInfo['real_id'],
'name' => $courseInfo['title']
),
'coach' => $teacherData,
'totalTime' => $formatedTime
);
}
}
$courses = SessionManager::getCoursesListByCourseCoach($selectedTeacher);
$coursesInSession = SessionManager::getCoursesListByCourseCoach($selectedTeacher);
foreach ($courses as $course) {
foreach ($coursesInSession as $course) {
$session = api_get_session_info($course['id_session']);
$sessionData = array(
'id' => $session['id'],
'name' => $session['name']
);
$courseInfo = api_get_course_info($course['course_code']);
$totalTime = SessionManager::getUserTimeInCourse(
$totalTime = UserManager::getExpendedTimeInCourses(
$selectedTeacher,
$course['course_code'],
$session['id'],
$selectedFrom,
$selectedUntil
);
$formatedTime = api_format_time($totalTime);
$timeReport->data[] = array(
'session' => array(
'id' => $session['id'],
'name' => $session['name']
),
'session' => $sessionData,
'course' => array(
'id' => $courseInfo['real_id'],
'name' => $courseInfo['title']
),
'coach' => array(
'userId' => $coach['user_id'],
'lastname' => $coach['lastname'],
'firstname' => $coach['firstname'],
'username' => $coach['username'],
'completeName' => $coach['complete_name']
),
'totalTime' => $totalTime
'coach' => $teacherData,
'totalTime' => $formatedTime
);
}
}
@ -234,7 +299,6 @@ if (isset($_GET['export'])) {
Export::export_html_to_pdf($pdfContent, $params);
break;
case 'xls':
array_unshift($dataToExport, array(
$reportTitle
), array(

@ -198,6 +198,7 @@ $status[COURSEMANAGER] = get_lang('Teacher');
$status[STUDENT] = get_lang('Learner');
$status[DRH] = get_lang('Drh');
$status[SESSIONADMIN] = get_lang('SessionsAdmin');
$status[STUDENT_BOSS] = get_lang('RoleStudentBoss');
$form->addElement('select', 'status', get_lang('Profile'), $status, array('id' => 'status_select', 'class'=>'chzn-select', 'onchange' => 'javascript: display_drh_list();'));

@ -211,6 +211,7 @@ $status[COURSEMANAGER] = get_lang('Teacher');
$status[STUDENT] = get_lang('Learner');
$status[DRH] = get_lang('Drh');
$status[SESSIONADMIN] = get_lang('SessionsAdmin');
$status[STUDENT_BOSS] = get_lang('RoleStudentBoss');
$form->addElement('select', 'status', get_lang('Profile'), $status, array('id' => 'status_select', 'onchange' => 'javascript: display_drh_list();','class'=>'chzn-select'));

@ -579,13 +579,35 @@ function modify_filter($user_id, $url_params, $row) {
$result .= '<a href="dashboard_add_sessions_to_user.php?user='.$user_id.'">'.Display::return_icon('view_more_stats.gif', get_lang('AssignSessions')).'</a>&nbsp;&nbsp;';
}*/
} else {
if ($current_user_status_label == $statusname[DRH] || UserManager::is_admin($user_id)) {
$result .= '<a href="dashboard_add_users_to_user.php?user='.$user_id.'">'.Display::return_icon('user_subscribe_course.png', get_lang('AssignUsers'),'',ICON_SIZE_SMALL).'</a>';
$result .= '<a href="dashboard_add_courses_to_user.php?user='.$user_id.'">'.Display::return_icon('course_add.gif', get_lang('AssignCourses')).'</a>&nbsp;&nbsp;';
$result .= '<a href="dashboard_add_sessions_to_user.php?user='.$user_id.'">'.Display::return_icon('view_more_stats.gif', get_lang('AssignSessions')).'</a>&nbsp;&nbsp;';
} else if ($current_user_status_label == $statusname[SESSIONADMIN]) {
$result .= '<a href="dashboard_add_sessions_to_user.php?user='.$user_id.'">'.Display::return_icon('view_more_stats.gif', get_lang('AssignSessions')).'</a>&nbsp;&nbsp;';
}
if ($current_user_status_label == $statusname[SESSIONADMIN]) {
$result .= Display::url(
Display::return_icon('view_more_stats.gif', get_lang('AssignSessions')),
"dashboard_add_sessions_to_user.php?user={$user_id}"
);
} else {
if (
$current_user_status_label == $statusname[DRH] ||
UserManager::is_admin($user_id) ||
$current_user_status_label == $statusname[STUDENT_BOSS]
) {
$result .= Display::url(
Display::return_icon('user_subscribe_course.png', get_lang('AssignUsers'), '', ICON_SIZE_SMALL),
"dashboard_add_users_to_user.php?user={$user_id}"
);
}
if ($current_user_status_label == $statusname[DRH] || UserManager::is_admin($user_id)) {
$result .= Display::url(
Display::return_icon('course_add.gif', get_lang('AssignCourses')),
"dashboard_add_courses_to_user.php?user={$user_id}"
);
$result .= Display::url(
Display::return_icon('view_more_stats.gif', get_lang('AssignSessions')),
"dashboard_add_sessions_to_user.php?user={$user_id}"
);
}
}
}
if (api_is_platform_admin()) {

@ -165,8 +165,8 @@ if ($user_already_registered_show_terms == false) {
'sessionVar' => basename(__FILE__, '.php'),
'imageOptions' => array(
'font_size' => 20,
'font_path' => api_get_path(LIBRARY_PATH).'pchart/fonts/',
'font_file' => 'tahoma.ttf',
'font_path' => api_get_path(SYS_FONTS_PATH) . 'opensans/',
'font_file' => 'OpenSans-Regular.ttf',
//'output' => 'gif'
)
);

@ -50,6 +50,9 @@ $user_id = api_get_user_id();
$course_user_list = CourseManager::get_courses_list_by_user_id($user_id);
$dates = $issues = '';
$sessionId = isset($_GET['session_id']) ? intval($_GET['session_id']) : 0;
$courseCode = isset($_GET['course']) ? Security::remove_XSS($_GET['course']) : null;
if (!empty($course_user_list)) {
$items = MySpace::get_connections_from_course_list($user_id, $course_user_list);
@ -82,8 +85,10 @@ if (!empty($course_user_list)) {
}
}
$content .= Tracking::show_user_progress(api_get_user_id(), $_GET['session_id']);
$content .= Tracking::show_course_detail(api_get_user_id(), $_GET['course'], $_GET['session_id']);
$content = '';
$content .= Tracking::show_user_progress(api_get_user_id(), $sessionId);
$content .= Tracking::show_course_detail(api_get_user_id(), $courseCode, $sessionId);
if (!empty($dates)) {
if (!empty($content)) {
@ -104,11 +109,13 @@ if (!empty($dates)) {
</div></div>';
}
$message = null;
if (empty($content)) {
$message = Display::return_message(get_lang('NoDataAvailable'), 'warning');
}
$tpl = new Template($tool_name);
$tpl = new Template($nameTools);
$tpl->assign('message', $message);
$tpl->assign('content', $content);

@ -0,0 +1,105 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Automatic fix online time procedure. If a COURSEMANAGER has been idle for $timeLimit
* or more then the procedure adds $extraTime to his logout_course_date.
* @package chamilo.cron
* @author Imanol Losada <imanol.losada@beeznest.com>
*/
require_once __DIR__ . '/../inc/global.inc.php';
/**
* Get ids of COURSEMANAGERs that are inside a course right now
* @return array COURSEMANAGER's ids
*/
function getTeachersInCourseIds()
{
$table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ONLINE);
$joinStatement = ' JOIN ' . Database::get_main_table(TABLE_MAIN_USER) . ' ON login_user_id = user_id';
return Database::select(
'login_user_id', $table . $joinStatement,
array(
'where' => array(
'course IS NOT NULL AND status = ?' => array(
COURSEMANAGER
)
)
)
);
}
/**
* If a COURSEMANAGER has been idle for $timeLimit or more then
* the procedure adds $extraTime to his logout_course_date.
* @param array COURSEMANAGER's ids
* @return void
*/
function updateTeachersInCourseIdleForTimeLimit($teachersInCourseIds)
{
$timeLimit = '- 30 minute';
$extraTime = '+ 5 minute';
$utcResult = Database::fetch_array(
Database::query('SELECT UTC_TIMESTAMP')
);
$dataBaseCurrentHour = array_shift($utcResult);
$maximumIdleTimeInCourse = date(
'Y-m-d H:i:s',
strtotime($dataBaseCurrentHour . ' ' . $timeLimit)
);
$table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS);
$onLineTrackTable = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ONLINE);
foreach ($teachersInCourseIds as $key => $value) {
$value = array_shift($value);
$logResult = Database::select(
'course_access_id,logout_course_date',
$table,
array(
'where' => array(
'user_id = ?' => array(
$value,
)
),
'order' => 'course_access_id DESC',
'limit' => '1'
)
);
$currentTeacherData = array_shift($logResult);
Database::update(
$table,
array(
'logout_course_date' => date(
'Y-m-d H:i:s',
strtotime($currentTeacherData['logout_course_date'] . ' ' . $extraTime)
)
),
array(
'user_id = ? AND logout_course_date < ? AND course_access_id = ?' => array(
$value,
$maximumIdleTimeInCourse,
$currentTeacherData['course_access_id']
)
)
);
/*
* (Avoid multiple updates)
* When the user enters a course, this field is updated with the course code.
* And when the user goes to another tool, returns to NULL
*/
$userId = intval($value);
$updateOnLineSql = "UPDATE $onLineTrackTable SET "
. "COURSE = NULL "
. "WHERE login_user_id = $userId";
Database::query($updateOnLineSql);
}
}
/**
* Initialization
*/
if (php_sapi_name() != 'cli') {
exit; //do not run from browser
}
$teachersInCourseIds = getTeachersInCourseIds();
if (!empty($teachersInCourseIds)) {
updateTeachersInCourseIdleForTimeLimit($teachersInCourseIds);
}

@ -2341,14 +2341,14 @@ class Exercise
$choice[$ind] = 1;
}
$studentChoice = $choice[$numAnswer];
$studentChoice = isset($choice[$numAnswer]) ? $choice[$numAnswer] : null;
$real_answers[$answerId] = (bool)$studentChoice;
if ($studentChoice) {
$questionScore +=$answerWeighting;
}
} else {
$studentChoice = $choice[$numAnswer];
$studentChoice = isset($choice[$numAnswer]) ? $choice[$numAnswer] : null;
$real_answers[$answerId] = (bool)$studentChoice;
if (isset($studentChoice)) {

@ -1198,7 +1198,7 @@ function get_exam_results_data(
$course_code = api_get_course_id();
$sessionId = api_get_session_id();
$is_allowedToEdit = api_is_allowed_to_edit(null,true) || api_is_allowed_to_edit(true) || api_is_drh();
$is_allowedToEdit = api_is_allowed_to_edit(null,true) || api_is_allowed_to_edit(true) || api_is_drh() || api_is_student_boss();
$TBL_USER = Database :: get_main_table(TABLE_MAIN_USER);
$TBL_EXERCICES = Database :: get_course_table(TABLE_QUIZ_TEST);
@ -1506,8 +1506,8 @@ function get_exam_results_data(
Display :: return_icon('history.gif', get_lang('ViewHistoryChange')).'</a>';
}
// Admin can always delete the attempt
if ($locked == false || api_is_platform_admin()) {
//Admin can always delete the attempt
if (($locked == false || api_is_platform_admin()) && !api_is_student_boss()) {
$ip = TrackingUserLog::get_ip_from_user_event($results[$i]['exe_user_id'], date('Y-m-d h:i:s'), false);
$actions .= '<a href="http://www.whatsmyip.org/ip-geo-location/?ip='.$ip.'" target="_blank"><img src="'.api_get_path(WEB_CODE_PATH).'img/icons/22/info.png" title="'.$ip.'" /></a>';

@ -46,7 +46,7 @@ $gradebook = isset($gradebook) ? $gradebook : null;
$path = isset($_GET['path']) ? Security::remove_XSS($_GET['path']) : null;
/* Constants and variables */
$is_allowedToEdit = api_is_allowed_to_edit(null, true) || api_is_drh();
$is_allowedToEdit = api_is_allowed_to_edit(null, true) || api_is_drh() || api_is_student_boss();
$is_tutor = api_is_allowed_to_edit(true);
$TBL_QUESTIONS = Database :: get_course_table(TABLE_QUIZ_QUESTION);

@ -73,7 +73,7 @@ if (api_is_course_session_coach(
}
$maxEditors = isset($_configuration['exercise_max_fckeditors_in_page']) ? $_configuration['exercise_max_fckeditors_in_page'] : 0;
$is_allowedToEdit = api_is_allowed_to_edit(null, true) || $is_courseTutor || api_is_session_admin() || api_is_drh();
$is_allowedToEdit = api_is_allowed_to_edit(null, true) || $is_courseTutor || api_is_session_admin() || api_is_drh() || api_is_student_boss();
//Getting results from the exe_id. This variable also contain all the information about the exercise
$track_exercise_info = get_exercise_track_exercise_info($id);
@ -512,7 +512,7 @@ foreach ($questionList as $questionId) {
$comnt = null;
if ($show_results) {
if ($is_allowedToEdit && $locked == false && !api_is_drh()) {
if ($is_allowedToEdit && $locked == false && !api_is_drh() && !api_is_student_boss()) {
$name = "fckdiv".$questionId;
$marksname = "marksName".$questionId;
if (in_array($answerType, array(FREE_ANSWER, ORAL_EXPRESSION))) {
@ -712,7 +712,7 @@ if (is_array($arrid) && is_array($arrmarks)) {
$marksid = implode(",",$arrmarks);
}
if ($is_allowedToEdit && $locked == false && !api_is_drh()) {
if ($is_allowedToEdit && $locked == false && !api_is_drh() && !api_is_student_boss()) {
if (in_array($origin, array('tracking_course','user_course','correct_exercise_in_lp'))) {
echo ' <form name="myform" id="myform" action="exercise_report.php?exerciseId='.$exercise_id.'&filter=2&comments=update&exeid='.$id.'&origin='.$origin.'&details=true&course='.Security::remove_XSS($_GET['cidReq']).$fromlink.'" method="post">';
echo '<input type = "hidden" name="lp_item_id" value="'.$learnpath_id.'">';

@ -0,0 +1,202 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

@ -282,8 +282,6 @@ if (isset($_GET['isStudentView']) && $_GET['isStudentView'] == 'false') {
// main graph
$flatviewtable->display();
// @todo this needs a fix
//$image_file = $flatviewtable->display_graph();
//@todo load images with jquery
echo '<div id="contentArea" style="text-align: center;" >';
if (!empty($image_file)) {

@ -292,7 +292,6 @@ class Category implements GradebookItem
// otherwise a special parameter is given to ask explicitely
$sql .= " AND (session_id IS NULL OR session_id = 0) ";
} else {*/
if (empty($session_id)) {
$sql .= ' AND (session_id IS NULL OR session_id = 0) ';
} else {
@ -326,14 +325,15 @@ class Category implements GradebookItem
$sql .= ' '.$order_by;
}
}
$result = Database::query($sql);
$allcat = array();
$categories = array();
if (Database::num_rows($result) > 0) {
$allcat = Category::create_category_objects_from_sql_result($result);
$categories = Category::create_category_objects_from_sql_result($result);
}
return $allcat;
return $categories;
}
/**
@ -731,7 +731,7 @@ class Category implements GradebookItem
*/
public function calc_score($stud_id = null, $course_code = '', $session_id = null)
{
// get appropriate subcategories, evaluations and links
// Get appropriate subcategories, evaluations and links
if (!empty($course_code)) {
$cats = $this->get_subcategories($stud_id, $course_code, $session_id);
$evals = $this->get_evaluations($stud_id, false, $course_code);
@ -782,10 +782,9 @@ class Category implements GradebookItem
}
if (!empty($links)) {
/** @var EvalLink $link */
/** @var EvalLink|ExerciseLink $link */
foreach ($links as $link) {
$linkres = $link->calc_score($stud_id);
if (!empty($linkres) && $link->get_weight() != 0) {
$linkweight = $link->get_weight();
$link_res_denom = $linkres[1] == 0 ? 1 : $linkres[1];
@ -1296,14 +1295,23 @@ class Category implements GradebookItem
// 1 student
if (isset($stud_id)) {
// special case: this is the root
// Special case: this is the root
if ($this->id == 0) {
return Category::get_root_categories_for_student($stud_id, $course_code, $session_id);
} else {
return Category::load(null,null, $course_code, $this->id, api_is_allowed_to_edit() ? null : 1, $session_id, $order);
return Category::load(
null,
null,
$course_code,
$this->id,
api_is_allowed_to_edit() ? null : 1,
$session_id,
$order
);
}
} else {// all students
// course admin
} else {
// All students
// Course admin
if (api_is_allowed_to_edit() && !api_is_platform_admin()) {
// root
if ($this->id == 0) {

@ -19,18 +19,26 @@ abstract class EvalLink extends AbstractLink
parent::__construct();
}
// Functions implementing AbstractLink
/**
* @return bool
*/
public function has_results()
{
$eval = $this->get_evaluation();
return $eval->has_results();
}
public function calc_score($stud_id = null)
/**
* @param int $userId
*
* @return array
*/
public function calc_score($userId = null)
{
$eval = $this->get_evaluation();
return $eval->calc_score($stud_id);
return $eval->calc_score($userId);
}
public function get_link()

@ -221,7 +221,7 @@ class ExerciseLink extends AbstractLink
if ($student_count == 0) {
return null;
} else {
return array ($sum , $student_count);
return array($sum, $student_count);
}
}
}

@ -5,6 +5,10 @@ require_once dirname(__FILE__) . '/../../../inc/global.inc.php';
require_once dirname(__FILE__) . '/../be.inc.php';
set_time_limit(0);
use CpChart\Classes\pData as pData;
use CpChart\Classes\pImage as pImage;
use CpChart\Classes\pCache as pCache;
/**
* Class FlatViewTable
* Table to display flat view (all evaluations and links for all students)
@ -43,6 +47,7 @@ class FlatViewTable extends SortableTable
$mainCourseCategory = null
) {
parent :: __construct('flatviewlist', null, null, (api_is_western_name_order() xor api_sort_by_first_name()) ? 1 : 0);
$this->selectcat = $selectcat;
$this->datagen = new FlatViewDataGenerator(
@ -80,159 +85,29 @@ class FlatViewTable extends SortableTable
return $this->mainCourseCategory;
}
/**
* Display the graph of the total results of all students
* */
public function display_graph()
{
include_once api_get_path(LIBRARY_PATH) . 'pchart/pData.class.php';
include_once api_get_path(LIBRARY_PATH) . 'pchart/pChart.class.php';
include_once api_get_path(LIBRARY_PATH) . 'pchart/pCache.class.php';
$header_name = $this->datagen->get_header_names();
$total_users = $this->datagen->get_total_users_count();
$img_file = '';
if ($this->datagen->get_total_items_count() > 0 && $total_users > 0) {
// Removing user names and total
array_shift($header_name);
array_shift($header_name);
array_pop($header_name);
$user_results = $this->datagen->get_data_to_graph();
$pre_result = $new_result = array();
$DataSet = new pData();
//$pre_result total score of students
//filling the Dataset
foreach ($user_results as $result) {
for ($i = 0; $i < count($header_name); $i++) {
$pre_result[$i + 3]+= $result[$i + 1];
}
}
$i = 1;
$show_draw = false;
if ($total_users > 0) {
foreach ($pre_result as $res) {
$total = $res / ($total_users);
if ($total != 0) {
$show_draw = true;
}
$DataSet->AddPoint($total, "Serie" . $i);
$DataSet->SetSerieName(strip_tags($header_name[$i - 1]), "Serie" . $i);
// Dataset definition
$DataSet->AddAllSeries();
$DataSet->SetAbsciseLabelSerie();
$i++;
}
}
// Cache definition
$Cache = new pCache();
// the graph id
$gradebook_id = intval($_GET['selectcat']);
$graph_id = api_get_user_id() . 'AverageResultsVsResource' . $gradebook_id . api_get_course_id();
$data = $DataSet->GetData();
if ($show_draw) {
if ($Cache->IsInCache($graph_id, $DataSet->GetData())) {
//if (0) {
//if we already created the img
//echo 'in cache';
$img_file = $Cache->GetHash($graph_id, $DataSet->GetData());
} else {
// if the image does not exist in the archive/ folder
// Initialise the graph
$angle = -30;
$Test = new pChart(760, 360);
// set font of the axes
$Test->setFontProperties(api_get_path(LIBRARY_PATH) . "pchart/fonts/tahoma.ttf", 8);
$Test = $Test->fixHeightByRotation($DataSet->GetData(), $DataSet->GetDataDescription(), $angle);
//which schema of color will be used
$quant_resources = count($data[0]) - 1;
// Adding the color schemma
if ($quant_resources < 8) {
$Test->loadColorPalette(api_get_path(LIBRARY_PATH) . "pchart/palette/reduced.txt");
} else {
$Test->loadColorPalette(api_get_path(LIBRARY_PATH) . "pchart/palette/default.txt");
}
$Test->setGraphArea(50, 30, 610, 300);
$Test->drawFilledRoundedRectangle(7, 7, $Test->XSize + 20, $Test->YSize - 30, 5, 240, 240, 240);
//$Test->drawRoundedRectangle(5,5,790,330,5,230,230,230);
//background color area & stripe or not
$Test->drawGraphArea(255, 255, 255, TRUE);
$Test->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_START0, 150, 150, 150, TRUE, 0, 1, FALSE);
//background grid
$Test->drawGrid(4, TRUE, 230, 230, 230, 50);
// Draw the 0 line
//$Test->setFontProperties(api_get_path(LIBRARY_PATH)."pchart/fonts/tahoma.ttf",6);
//$Test->drawTreshold(0,143,55,72,TRUE,TRUE);
// Draw the bar graph
$Test->drawBarGraph($DataSet->GetData(), $DataSet->GetDataDescription(), TRUE);
//Set legend properties: width, height and text color and font
$Test->setFontProperties(api_get_path(LIBRARY_PATH) . "pchart/fonts/tahoma.ttf", 9);
$Test->drawLegend(620, 70, $DataSet->GetDataDescription(), 255, 255, 255);
//Set title properties
$Test->setFontProperties(api_get_path(LIBRARY_PATH) . "pchart/fonts/tahoma.ttf", 10);
$Test->drawTitle(50, 22, get_lang('AverageResultsVsResource'), 50, 50, 80, 620);
//------------------
//echo 'not in cache';
$Cache->WriteToCache($graph_id, $DataSet->GetData(), $Test);
ob_start();
$Test->Stroke();
ob_end_clean();
$img_file = $Cache->GetHash($graph_id, $DataSet->GetData());
}
}
}
return api_get_path(WEB_ARCHIVE_PATH) . $img_file;
}
/**
*
*/
public function display_graph_by_resource()
{
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';
$header_name = $this->datagen->get_header_names();
$headerName = $this->datagen->get_header_names();
$total_users = $this->datagen->get_total_users_count();
$img_file = '';
if ($this->datagen->get_total_items_count() > 0 && $total_users > 0) {
//Removing first name
array_shift($header_name);
array_shift($headerName);
//Removing last name
array_shift($header_name);
array_shift($headerName);
$displayscore = ScoreDisplay :: instance();
$displayscore = ScoreDisplay::instance();
$customdisplays = $displayscore->get_custom_score_display_settings();
if (is_array($customdisplays) && count(($customdisplays))) {
$user_results = $this->datagen->get_data_to_graph2(false);
$pre_result = $new_result = array();
$DataSet = new pData();
//filling the Dataset
foreach ($user_results as $result) {
//print_r($result);
for ($i = 0; $i < count($header_name); $i++) {
for ($i = 0; $i < count($headerName); $i++) {
$pre_result[$i + 3][] = $result[$i + 1];
}
}
@ -284,197 +159,150 @@ class FlatViewTable extends SortableTable
$resource_list = $new_list;
$i = 1;
$j = 0;
foreach ($resource_list as $key => $resource) {
$new_resource_list = $new_resource_list_name = array();
$DataSet = new pData();
// Reverse array, otherwise we get highest values first
$resource = array_reverse($resource, true);
foreach ($resource as $name => $cant) {
$DataSet->AddPoint($cant, "Serie" . $j);
$DataSet->SetSerieName(strip_tags($name), "Serie" . $j);
$j++;
}
//print_r($pre_result); print_r($header_name);
// Dataset definition
$DataSet->AddAllSeries();
$DataSet->SetAbsciseLabelSerie('');
$DataSet->SetXAxisName(get_lang('GradebookSkillsRanking'));
$DataSet->SetYAxisName(get_lang('Students'));
$show_draw = true;
$dataSet = new pData();
$dataSet->addPoints($resource, 'Serie');
$dataSet->addPoints(array_keys($resource), 'Labels');
$dataSet->setSerieDescription('Labels', strip_tags($headerName[$i - 1]));
$dataSet->setAbscissa('Labels');
$dataSet->setAbscissaName(get_lang('GradebookSkillsRanking'));
$dataSet->setAxisName(0, get_lang('Students'));
$palette = array(
'0' => array('R' => 186, 'G' => 206, 'B' => 151, 'Alpha' => 100),
'1' => array('R' => 210, 'G' => 148, 'B' => 147, 'Alpha' => 100),
'2' => array('R' => 148, 'G' => 170, 'B' => 208, 'Alpha' => 100),
'3' => array('R' => 221, 'G' => 133, 'B' => 61, 'Alpha' => 100),
'4' => array('R' => 65, 'G' => 153, 'B' => 176, 'Alpha' => 100),
'5' => array('R' => 114, 'G' => 88, 'B' => 144, 'Alpha' => 100),
'6' => array('R' => 138, 'G' => 166, 'B' => 78, 'Alpha' => 100),
'7' => array('R' => 171, 'G' => 70, 'B' => 67, 'Alpha' => 100),
'8' => array('R' => 69, 'G' => 115, 'B' => 168, 'Alpha' => 100),
);
// Cache definition
$Cache = new pCache();
// the graph id
$gradebook_id = intval($_GET['selectcat']);
$graph_id = api_get_user_id() . 'ByResource' . $gradebook_id . api_get_course_id() . api_get_session_id();
if ($show_draw) {
//if ($Cache->IsInCache($graph_id, $DataSet->GetData())) {
if (0) {
//if we already created the img we get the img file id
//echo 'in cache';
$img_file = $Cache->GetHash($graph_id, $DataSet->GetData());
} else {
// if the image does not exist in the archive/ folder
// Initialise the graph
$chart_size_w = 480;
$chart_size_h = 250;
$angle = -30;
$Test = new pChart($chart_size_w, $chart_size_h);
// set font of the axes
$Test->setFontProperties(api_get_path(LIBRARY_PATH) . "pchart/fonts/tahoma.ttf", 8);
$Test = $Test->fixHeightByRotation(
$DataSet->GetData(),
$DataSet->GetDataDescription(),
$angle
);
// Adding the color schemma
$Test->loadColorPalette(api_get_path(LIBRARY_PATH) . "pchart/palette/pastel.txt");
$area_graph_w = $chart_size_w - 130;
$Test->setGraphArea(50, 30, $area_graph_w, $chart_size_h - 50);
$Test->drawFilledRoundedRectangle(
5,
5,
$chart_size_w - 1,
$Test->YSize - 20,
5,
240,
240,
240
);
//$Test->drawRoundedRectangle(5,5,790,330,5,230,230,230);
//background color area & stripe or not
$Test->drawGraphArea(255, 255, 255, TRUE);
//Setting max height by default see #3296
if (!empty($max)) {
if (is_int($max)) {
$Test->setFixedScale(0, $max + 1, $max + 1);
} else {
$Test->setFixedScale(0, $max);
}
}
$Test->drawScale(
$DataSet->GetData(),
$DataSet->GetDataDescription(),
SCALE_ADDALLSTART0,
150,
150,
150,
TRUE,
0,
1,
FALSE
);
//background grid
$Test->drawGrid(4, TRUE, 230, 230, 230, 50);
// Draw the 0 line
//$Test->setFontProperties(api_get_path(LIBRARY_PATH)."pchart/fonts/tahoma.ttf",6);
//$Test->drawTreshold(0,143,55,72,TRUE,TRUE);
// Draw the bar graph
$Test->setFontProperties(api_get_path(LIBRARY_PATH) . "pchart/fonts/tahoma.ttf", 11);
$Test->drawBarGraph($DataSet->GetData(), $DataSet->GetDataDescription(), TRUE);
//Set legend properties: width, height and text color and font
$Test->setFontProperties(api_get_path(LIBRARY_PATH) . "pchart/fonts/tahoma.ttf", 9);
$Test->drawLegend($area_graph_w + 10, 50, $DataSet->GetDataDescription(), 255, 255, 255);
//Set title properties
$Test->setFontProperties(api_get_path(LIBRARY_PATH) . "pchart/fonts/tahoma.ttf", 10);
$Test->drawTitle(50, 22, strip_tags($header_name[$i - 1]), 50, 50, 80, $chart_size_w - 50);
//------------------
//echo 'not in cache';
$Cache->WriteToCache($graph_id, $DataSet->GetData(), $Test);
//ob_start();
//$Test->Stroke();
//ob_end_clean();
$img_file = $Cache->GetHash($graph_id, $DataSet->GetData());
}
echo '<img src="' . api_get_path(WEB_ARCHIVE_PATH) . $img_file . '" >';
if ($i % 2 == 0 && $i != 0) {
echo '<br />';
}
$i++;
$cachePath = api_get_path(SYS_ARCHIVE_PATH);
$myCache = new pCache(array('CacheFolder' => substr($cachePath, 0, strlen($cachePath) - 1)));
$chartHash = $myCache->getHash($dataSet);
if ($myCache->isInCache($chartHash)) {
$imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash;
$myCache->saveFromCache($chartHash, $imgPath);
$imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash;
} else {
/* Create the pChart object */
$widthSize = 480;
$heightSize = 250;
$myPicture = new pImage($widthSize, $heightSize, $dataSet);
/* Turn of Antialiasing */
$myPicture->Antialias = false;
/* Add a border to the picture */
$myPicture->drawRectangle(
0,
0,
$widthSize - 1,
$heightSize - 1,
array(
'R' => 0,
'G' => 0,
'B' => 0
)
);
/* Set the default font */
$myPicture->setFontProperties(
array(
'FontName' => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf',
'FontSize' => 10
)
);
/* Write the chart title */
$myPicture->drawText(
250,
30,
strip_tags($headerName[$i - 1]),
array(
'FontSize' => 12,
'Align' => TEXT_ALIGN_BOTTOMMIDDLE
)
);
/* Define the chart area */
$myPicture->setGraphArea(50, 40, $widthSize - 20, $heightSize - 50);
/* Draw the scale */
$scaleSettings = array(
'GridR' => 200,
'GridG' => 200,
'GridB' => 200,
'DrawSubTicks' => true,
'CycleBackground' => true,
'Mode' => SCALE_MODE_START0
);
$myPicture->drawScale($scaleSettings);
/* Turn on shadow computing */
$myPicture->setShadow(
true,
array(
'X' => 1,
'Y' => 1,
'R' => 0,
'G' => 0,
'B' => 0,
'Alpha' => 10
)
);
/* Draw the chart */
$myPicture->setShadow(
true,
array(
'X' => 1,
'Y' => 1,
'R' => 0,
'G' => 0,
'B' => 0,
'Alpha' => 10
)
);
$settings = array(
'OverrideColors' => $palette,
'Gradient' => false,
'GradientMode' => GRADIENT_SIMPLE,
'DisplayPos' => LABEL_POS_TOP,
'DisplayValues' => true,
'DisplayR' => 0,
'DisplayG' => 0,
'DisplayB' => 0,
'DisplayShadow' => true,
'Surrounding' => 10,
);
$myPicture->drawBarChart($settings);
/* Render the picture (choose the best way) */
$myCache->writeToCache($chartHash, $myPicture);
$imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash;
$myCache->saveFromCache($chartHash, $imgPath);
$imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash;
}
} //end foreach
} else {
echo get_lang('ToViewGraphScoreRuleMustBeEnabled');
}
// Pie charts
/*
$show_draw = false;
$resource_list = array();
//print_r($pre_result_pie);
if ($total_users>0) {
foreach($pre_result_pie as $key=>$res_array) {
//$resource_list
foreach($res_array as $user_result) {
$total+= $user_result / ($total_users*100);
}
echo $total;
//echo $total = $res / ($total_users*100);
echo '<br>';
//$DataSet->AddPoint($total,"Serie".$i);
//$DataSet->SetSerieName($header_name[$i-1],"Serie".$i);
}
}
//here--------------
foreach($resource_list as $key=>$resource) {
$new_resource_list = $new_resource_list_name = array();
foreach($resource as $name=>$cant) {
$new_resource_list[]=$cant;
$new_resource_list_name[]=$name;
}
//Pie chart
$DataSet = new pData;
$DataSet->AddPoint($new_resource_list,"Serie1");
$DataSet->AddPoint($new_resource_list_name,"Serie2");
$DataSet->AddAllSeries();
$DataSet->SetAbsciseLabelSerie("Serie2");
$Test = new pChart(400,300);
$Test->loadColorPalette(api_get_path(LIBRARY_PATH)."pchart/palette/soft_tones.txt");
// background
//$Test->drawFilledRoundedRectangle(7,7,293,193,5,240,240,240);
// border color
$Test->drawRoundedRectangle(5,5,295,195,5,230,230,230);
// This will draw a shadow under the pie chart
//$Test->drawFilledCircle(122,102,70,200,200,200);
//Draw the pie chart
$Test->setFontProperties(api_get_path(LIBRARY_PATH)."pchart/fonts/tahoma.ttf",8);
$Test->drawBarGraph($DataSet->GetData(),$DataSet->GetDataDescription(),TRUE);
$tmp_path = api_get_path(SYS_ARCHIVE_PATH);
$Test->drawBasicPieGraph($DataSet->GetData(),$DataSet->GetDataDescription(),120,100,70,PIE_PERCENTAGE,255,255,218);
$Test->drawPieLegend(230,15,$DataSet->GetData(),$DataSet->GetDataDescription(),250,250,250);
$user_id = api_get_user_id();
$img_file_generated_name = $key.uniqid('').'gradebook.png';
$Test->Render($tmp_path.$img_file_generated_name);
chmod($tmp_path.$img_file_generated_name, api_get_permissions_for_new_files());
if ($i % 2 == 0 && $i!= 0) {
echo '<br>';
}
echo '<img src="'.api_get_path(WEB_ARCHIVE_PATH).$img_file_generated_name.'">';
}
*/
echo '<img src="' . $imgPath . '" >';
if ($i % 2 == 0 && $i != 0) {
echo '<br /><br />';
} else {
echo '&nbsp;&nbsp;&nbsp;';
}
$i++;
}
} //end foreach
} else {
echo get_lang('ToViewGraphScoreRuleMustBeEnabled');
}
}
@ -541,10 +369,13 @@ class FlatViewTable extends SortableTable
}
// retrieve sorting type
if ($is_western_name_order) {
$users_sorting = ($this->column == 0 ? FlatViewDataGenerator :: FVDG_SORT_FIRSTNAME : FlatViewDataGenerator :: FVDG_SORT_LASTNAME);
//$users_sorting = ($this->column == 0 ? FlatViewDataGenerator :: FVDG_SORT_FIRSTNAME : FlatViewDataGenerator :: FVDG_SORT_LASTNAME);
$users_sorting = FlatViewDataGenerator :: FVDG_SORT_FIRSTNAME;
} else {
$users_sorting = ($this->column == 0 ? FlatViewDataGenerator :: FVDG_SORT_LASTNAME : FlatViewDataGenerator :: FVDG_SORT_FIRSTNAME);
//$users_sorting = ($this->column == 0 ? FlatViewDataGenerator :: FVDG_SORT_LASTNAME : FlatViewDataGenerator :: FVDG_SORT_FIRSTNAME);
$users_sorting = FlatViewDataGenerator :: FVDG_SORT_LASTNAME;
}
if ($this->direction == 'DESC') {
$users_sorting |= FlatViewDataGenerator :: FVDG_SORT_DESC;
@ -555,16 +386,15 @@ class FlatViewTable extends SortableTable
$header_names = $this->datagen->get_header_names($this->offset, $selectlimit);
$column = 0;
if ($is_western_name_order) {
$this->set_header($column++, $header_names[1]);
$this->set_header($column++, $header_names[0]);
$this->set_header(0, $header_names[1]);
$this->set_header(1, $header_names[0]);
} else {
$this->set_header($column++, $header_names[0]);
$this->set_header($column++, $header_names[1]);
$this->set_header(0, $header_names[0]);
$this->set_header(1, $header_names[1]);
}
$column = 2;
while ($column < count($header_names)) {
$this->set_header($column, $header_names[$column], false);
$column++;

@ -157,9 +157,11 @@ class FlatViewDataGenerator
$session_id,
'ORDER BY id'
);
$evaluationsAdded = array();
if ($parent_id == 0 && !empty($allcat)) {
// Means there are any subcategory
foreach ($allcat as $sub_cat) {
$sub_cat_weight = round(100 * $sub_cat->get_weight() / $main_weight, 1);
$add_weight = " $sub_cat_weight %";
@ -216,7 +218,8 @@ class FlatViewDataGenerator
$max = $score[0];
}
}
return $max ;
return $max;
}
/**
@ -389,7 +392,12 @@ class FlatViewDataGenerator
$course_code = api_get_course_id();
$session_id = api_get_session_id();
$allcat = $this->category->get_subcategories(null, $course_code, $session_id, 'ORDER BY id');
$allcat = $this->category->get_subcategories(
null,
$course_code,
$session_id,
'ORDER BY id'
);
$evaluationsAdded = array();
@ -400,7 +408,7 @@ class FlatViewDataGenerator
$real_score = $score;
$divide = ( ($score[1])==0 ) ? 1 : $score[1];
$divide = $score[1] == 0 ? 1 : $score[1];
$sub_cat_percentage = $sum_categories_weight_array[$sub_cat->get_id()];
$item_value = $score[0]/$divide*$main_weight;
@ -410,10 +418,10 @@ class FlatViewDataGenerator
$item_value = $percentage*$item_value;
$item_total += $sub_cat->get_weight();
/*
if ($convert_using_the_global_weight) {
$score[0] = $score[0]/$main_weight*$sub_cat->get_weight();
$score[1] = $main_weight ;
}
if ($convert_using_the_global_weight) {
$score[0] = $score[0]/$main_weight*$sub_cat->get_weight();
$score[1] = $main_weight ;
}
*/
if (api_get_setting('gradebook_show_percentage_in_reports') == 'false') {
//if (true)
@ -427,8 +435,7 @@ class FlatViewDataGenerator
}
if (!isset($this->params['only_total_category']) ||
(isset($this->params['only_total_category']) &&
$this->params['only_total_category'] == false)
(isset($this->params['only_total_category']) && $this->params['only_total_category'] == false)
) {
if (!$show_all) {
$row[] = $temp_score.' ';

@ -364,9 +364,11 @@ class ScoreDisplay
return $this->display_as_div($score).' (' . $this->display_as_percent($score) . ')'.$custom;
case SCORE_DIV_SIMPLE_WITH_CUSTOM : // X - Good!
$custom = $this->display_custom($score);
if (!empty($custom)) {
$custom = ' - '.$custom;
}
return $this->display_simple_score($score).$custom;
break;
case SCORE_DIV_SIMPLE_WITH_CUSTOM_LETTERS:

@ -658,7 +658,7 @@ switch ($action) {
$course = api_get_course_info();
// Used inside get_exam_results_data()
$documentPath = api_get_path(SYS_COURSE_PATH) . $course['path'] . "/document";
if ($is_allowedToEdit) {
if ($is_allowedToEdit || api_is_student_boss()) {
$columns = array(
'firstname', 'lastname', 'username', 'group_name', 'exe_duration', 'start_date', 'exe_date', 'score', 'status', 'lp', 'actions'
);

@ -0,0 +1,19 @@
<?php
/**
* Set up the Chamilo autoload stack. Can be called several time if needed also
* better to avoid it.
*/
require_once dirname(__FILE__) . '/lib/autoload.class.php';
require_once __DIR__ . '/../../vendor/autoload.php';
Autoload::register();
/**
use Symfony\Component\ClassLoader\UniversalClassLoader;
$loader = new UniversalClassLoader();
$loader->registerNamespaces(array(
'Symfony\\Component\\HttpFoundation', __DIR__.'/vendor/symfony/http-foundation',
));
$loader->register();
*/

@ -751,7 +751,6 @@ class Autoload
$result['MultipleAnswerCombination'] = '/main/exercice/multiple_answer_combination.class.php';
$result['MultipleAnswerCombinationTrueFalse'] = '/main/exercice/multiple_answer_combination_true_false.class.php';
$result['MultipleAnswerTrueFalse'] = '/main/exercice/multiple_answer_true_false.class.php';
$result['MyHorBar'] = '/main/inc/lib/pchart/MyHorBar.class.php';
$result['MySpace'] = '/main/mySpace/myspace.lib.php';
$result['Nanogong'] = '/main/inc/lib/nanogong.lib.php';
$result['NotebookManager'] = '/main/inc/lib/notebook.lib.php';
@ -975,9 +974,6 @@ class Autoload
$result['learnpath_processor'] = '/main/inc/lib/search/tool_processors/learnpath_processor.class.php';
$result['link_processor'] = '/main/inc/lib/search/tool_processors/link_processor.class.php';
$result['net\HttpChannel'] = '/main/inc/lib/system/net/http_channel.class.php';
$result['pCache'] = '/main/inc/lib/pchart/pCache.class.php';
$result['pChart'] = '/main/inc/lib/pchart/pChart.class.php';
$result['pData'] = '/main/inc/lib/pchart/pData.class.php';
$result['quiz_processor'] = '/main/inc/lib/search/tool_processors/quiz_processor.class.php';
$result['scorm'] = '/main/newscorm/scorm.class.php';
$result['scormItem'] = '/main/newscorm/scormItem.class.php';

@ -59,7 +59,11 @@ function get_tabs() {
$navigation['session_my_space']['url'] = api_get_path(WEB_CODE_PATH).'mySpace/'.(api_is_drh()?'session.php':'');
$navigation['session_my_space']['title'] = get_lang('MySpace');
$navigation['session_my_space']['key'] = 'my-space';
} else {
} else if (api_is_student_boss()) {
$navigation['session_my_space']['url'] = api_get_path(WEB_CODE_PATH) . 'mySpace/student.php';
$navigation['session_my_space']['title'] = get_lang('MySpace');
$navigation['session_my_space']['key'] = 'my-space';
} else {
// Link to my progress
$navigation['session_my_progress']['url'] = api_get_path(WEB_CODE_PATH).'auth/my_progress.php';
$navigation['session_my_progress']['title'] = get_lang('MyProgress');
@ -303,13 +307,13 @@ function return_navigation_array() {
// Reporting
if (api_get_setting('show_tabs', 'reporting') == 'true') {
if (api_is_allowed_to_create_course() || api_is_drh() || api_is_session_admin()) {
if (api_is_allowed_to_create_course() || api_is_drh() || api_is_session_admin() || api_is_student_boss()) {
$navigation['session_my_space'] = $possible_tabs['session_my_space'];
} else {
$navigation['session_my_space'] = $possible_tabs['session_my_progress'];
}
} else {
if (api_is_allowed_to_create_course() || api_is_drh() || api_is_session_admin()) {
if (api_is_allowed_to_create_course() || api_is_drh() || api_is_session_admin() || api_is_student_boss()) {
$menu_navigation['session_my_space'] = $possible_tabs['session_my_space'];
} else {
$menu_navigation['session_my_space'] = $possible_tabs['session_my_progress'];

@ -167,8 +167,11 @@ class Certificate extends Model
//If the gradebook is related to skills we added the skills to the user
$courseId = api_get_real_course_id();
$sessionId = api_get_session_id();
$skill = new Skill();
$skill->add_skill_to_user($this->user_id, $this->certificate_data['cat_id']);
$skill->add_skill_to_user($this->user_id, $this->certificate_data['cat_id'], $courseId, $sessionId);
if (is_dir($this->certification_user_path)) {
if (!empty($this->certificate_data)) {

@ -43,6 +43,7 @@ define('SESSION_GENERAL_COACH', 13);
define('COURSE_STUDENT', 14); //student subscribed in a course
define('SESSION_STUDENT', 15); //student subscribed in a session course
define('COURSE_TUTOR', 16); // student is tutor of a course (NOT in session)
define('STUDENT_BOSS', 17); // student is boss
// Table of status
$_status_list[COURSEMANAGER] = 'teacher'; // 1
@ -284,6 +285,8 @@ define('WEB_AJAX_PATH', 'WEB_AJAX_PATH');
define('SYS_TEST_PATH', 'SYS_TEST_PATH');
define('WEB_TEMPLATE_PATH', 'WEB_TEMPLATE_PATH');
define('SYS_TEMPLATE_PATH', 'SYS_TEMPLATE_PATH');
define('WEB_FONTS_PATH', 'WEB_FONTS_PATH');
define('SYS_FONTS_PATH', 'SYS_FONTS_PATH');
// Constants for requesting path conversion.
define('TO_WEB', 'TO_WEB');
@ -323,6 +326,7 @@ define('USER_RELATION_TYPE_GOODFRIEND', 4); // should be deprecated is useless
define('USER_RELATION_TYPE_ENEMY', 5); // should be deprecated is useless
define('USER_RELATION_TYPE_DELETED', 6);
define('USER_RELATION_TYPE_RRHH', 7);
define('USER_RELATION_TYPE_BOSS', 8);
//Gradebook link constants
//Please do not change existing values, they are used in the database !
@ -480,7 +484,9 @@ function api_get_path($path_type, $path = null)
WEB_AJAX_PATH => 'inc/ajax/',
SYS_TEST_PATH => 'tests/',
WEB_TEMPLATE_PATH => 'template/',
SYS_TEMPLATE_PATH => 'template/'
SYS_TEMPLATE_PATH => 'template/',
WEB_FONTS_PATH => 'fonts/',
SYS_FONTS_PATH => 'fonts/',
);
static $resource_paths = array(
@ -585,11 +591,13 @@ function api_get_path($path_type, $path = null)
$paths[SYS_TEST_PATH] = $paths[SYS_PATH].$paths[SYS_TEST_PATH];
$paths[SYS_TEMPLATE_PATH] = $paths[SYS_CODE_PATH].$paths[SYS_TEMPLATE_PATH];
$paths[SYS_CSS_PATH] = $paths[SYS_CODE_PATH].$paths[SYS_CSS_PATH];
$paths[SYS_FONTS_PATH] = $paths[SYS_CODE_PATH].$paths[SYS_FONTS_PATH];
$paths[WEB_CSS_PATH] = $paths[WEB_CODE_PATH].$paths[WEB_CSS_PATH];
$paths[WEB_IMG_PATH] = $paths[WEB_CODE_PATH].$paths[WEB_IMG_PATH];
$paths[WEB_LIBRARY_PATH] = $paths[WEB_CODE_PATH].$paths[WEB_LIBRARY_PATH];
$paths[WEB_AJAX_PATH] = $paths[WEB_CODE_PATH].$paths[WEB_AJAX_PATH];
$paths[WEB_FONTS_PATH] = $paths[WEB_CODE_PATH].$paths[WEB_FONTS_PATH];
$paths[WEB_PLUGIN_PATH] = $paths[WEB_PATH].$paths[WEB_PLUGIN_PATH];
$paths[WEB_ARCHIVE_PATH] = $paths[WEB_PATH].$paths[WEB_ARCHIVE_PATH];
@ -635,6 +643,7 @@ function api_get_path($path_type, $path = null)
$paths[WEB_ARCHIVE_PATH] = $paths[WEB_PATH].$web_paths[WEB_ARCHIVE_PATH];
$paths[WEB_LIBRARY_PATH] = $paths[WEB_CODE_PATH].$web_paths[WEB_LIBRARY_PATH];
$paths[WEB_AJAX_PATH] = $paths[WEB_CODE_PATH].$web_paths[WEB_AJAX_PATH];
$paths[WEB_FONTS_PATH] = $paths[WEB_CODE_PATH].$paths[WEB_FONTS_PATH];
}
}
@ -1310,6 +1319,8 @@ function api_get_user_info_from_username($username = '')
if (empty($username)) {
return false;
}
$username = trim($username);
$sql = "SELECT * FROM ".Database :: get_main_table(TABLE_MAIN_USER)."
WHERE username='".Database::escape_string($username)."'";
$result = Database::query($sql);
@ -4667,7 +4678,8 @@ function api_get_status_langvars() {
SESSIONADMIN => get_lang('SessionsAdmin', ''),
DRH => get_lang('Drh', ''),
STUDENT => get_lang('Student', ''),
ANONYMOUS => get_lang('Anonymous', '')
ANONYMOUS => get_lang('Anonymous', ''),
STUDENT_BOSS => get_lang('RoleStudentBoss', '')
);
}
@ -7502,6 +7514,18 @@ function api_register_campus($listCampus = true) {
// Reload the settings.
}
/**
* Checks whether current user is a student boss
* @global array $_user
* @return boolean
*/
function api_is_student_boss ()
{
global $_user;
return isset($_user['status']) && $_user['status'] == STUDENT_BOSS;
}
/**
* Set the Site Use Cookie Warning for 1 year
*/
@ -7518,3 +7542,25 @@ function api_site_use_cookie_warning_cookie_exist()
{
return isset($_COOKIE['ChamiloUsesCookies']);
}
/**
* Given a number of seconds, format the time to show hours, minutes and seconds
* @param int $time The time in seconds
* @param string $originFormat Optional. PHP o JS
* @return string (00h00'00")
*/
function api_format_time($time, $originFormat = 'php')
{
$h = get_lang('h');
$hours = $time / 3600;
$mins = ($time % 3600) / 60;
$secs = ($time % 60);
if ($originFormat == 'js') {
$scormTime = trim(sprintf("%02d : %02d : %02d", $hours, $mins, $secs));
} else {
$scormTime = trim(sprintf("%02d$h%02d'%02d\"", $hours, $mins, $secs));
}
return $scormTime;
}

@ -1,450 +0,0 @@
<?php
/*
pChart - a PHP class to build charts!
Copyright (C) 2008 Jean-Damien POGOLOTTI
Version 1.27d last updated on 09/30/08
Extension by Gabriele FERRI
http://www.gabrieleferri.it
MyHorBar.class is writen to extend pChart.class to write a horizontal bar charts
Copyright (C) 2009 Gabriele FERRI
version 1.0beta 08/05/2009
Contact me with bug reports and comments: info@gabrieleferri.it
http://pchart.sourceforge.net
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 1,2,3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Draw methods :
drawHorBarGraph($Data,$DataDescription,$Shadow=TRUE,$Alpha=100)
drawHorScale($Data,$DataDescription,$ScaleMode,$R,$G,$B,$DrawTicks=TRUE,$Angle=0,$Decimals=1,$WithMargin=FALSE,$SkipLabels=1,$RightScale=FALSE)
drawHorGrid($LineWidth,$Mosaic,$R=220,$G=220,$B=220,$Alpha=100)
drawTreshold($Value,$R,$G,$B,$ShowLabel=FALSE,$ShowOnBottom=FALSE,$TickWidth=4,$FreeText=NULL,$Angle=0)
*/
class MyHorBar extends pChart
{
/* This function draw a bar graph */
function drawHorBarGraph($Data,$DataDescription,$Shadow=TRUE,$Alpha=100)
{
/* Validate the Data and DataDescription array */
$this->validateDataDescription("drawBarGraph",$DataDescription);
$this->validateData("drawBarGraph",$Data);
$GraphID = 0;
$Series = count($DataDescription["Values"]);
$SeriesWidth = $this->DivisionWidth / ($Series+1);
$SerieYOffset = $this->DivisionWidth / 2 - $SeriesWidth * $Series / 2;
$XZero = $this->GArea_X1 + ((0-$this->VMin) * $this->DivisionRatio);
if ( $XZero < $this->GArea_X1 ) { $XZero = $this->GArea_X1; }
$SerieID = 0;
foreach ( $DataDescription["Values"] as $Key2 => $ColName )
{
$ID = 0;
foreach ( $DataDescription["Description"] as $keyI => $ValueI )
{ if ( $keyI == $ColName ) { $ColorID = $ID; }; $ID++; }
$YPos = $this->GArea_Y1 + $this->GAreaXOffset + $SerieYOffset + $SeriesWidth * $SerieID;
$XLast = -1;
foreach ( $Data as $Key => $Values )
{
if ( isset($Data[$Key][$ColName]))
{
if ( is_numeric($Data[$Key][$ColName]) )
{
$Value = $Data[$Key][$ColName];
$XPos = $this->GArea_X1 + (($Value-$this->VMin) * $this->DivisionRatio);
/* Save point into the image map if option activated */
if ( $this->BuildMap )
{
$this->addToImageMap(min($XZero,$XPos),$YPos+1,max($XZero,$XPos), $YPos+$SeriesWidth-1,$DataDescription["Description"][$ColName],$Data[$Key][$ColName].$DataDescription["Unit"]["Y"],"Bar");
}
if ( $Shadow && $Alpha == 100 )
$this->drawRectangle($XZero,$YPos+1,$XPos,$YPos+$SeriesWidth-1,25,25,25,TRUE,$Alpha);
$this->drawFilledRectangle($XZero,$YPos+1,$XPos,$YPos+$SeriesWidth-1,$this->Palette[$ColorID]["R"],$this->Palette[$ColorID]["G"],$this->Palette[$ColorID]["B"],TRUE,$Alpha);
}
}
$YPos = $YPos + $this->DivisionWidth;
}
$SerieID++;
}
}
/* Compute and draw the scale */
function drawHorScale($Data,$DataDescription,$ScaleMode,$R,$G,$B,$DrawTicks=TRUE,$Angle=0,$Decimals=1,$WithMargin=FALSE,$SkipLabels=1,$RightScale=FALSE)
{
/* Validate the Data and DataDescription array */
$this->validateData("drawScale",$Data);
$C_TextColor =$this->AllocateColor($this->Picture,$R,$G,$B);
$this->drawLine($this->GArea_X1,$this->GArea_Y1,$this->GArea_X2,$this->GArea_Y1,$R,$G,$B);
$this->drawLine($this->GArea_X1,$this->GArea_Y1,$this->GArea_X1,$this->GArea_Y2,$R,$G,$B);
if ( $this->VMin == NULL && $this->VMax == NULL)
{
if (isset($DataDescription["Values"][0]))
{
$this->VMin = $Data[0][$DataDescription["Values"][0]];
$this->VMax = $Data[0][$DataDescription["Values"][0]];
}
else { $this->VMin = 2147483647; $this->VMax = -2147483647; }
/* Compute Min and Max values */
if ( $ScaleMode == SCALE_NORMAL || $ScaleMode == SCALE_START0 )
{
if ( $ScaleMode == SCALE_START0 ) { $this->VMin = 0; }
foreach ( $Data as $Key => $Values )
{
foreach ( $DataDescription["Values"] as $Key2 => $ColName )
{
if (isset($Data[$Key][$ColName]))
{
$Value = $Data[$Key][$ColName];
if ( is_numeric($Value) )
{
if ( $this->VMax < $Value) { $this->VMax = $Value; }
if ( $this->VMin > $Value) { $this->VMin = $Value; }
}
}
}
}
}
elseif ( $ScaleMode == SCALE_ADDALL || $ScaleMode == SCALE_ADDALLSTART0 ) /* Experimental */
{
if ( $ScaleMode == SCALE_ADDALLSTART0 ) { $this->VMin = 0; }
foreach ( $Data as $Key => $Values )
{
$Sum = 0;
foreach ( $DataDescription["Values"] as $Key2 => $ColName )
{
if (isset($Data[$Key][$ColName]))
{
$Value = $Data[$Key][$ColName];
if ( is_numeric($Value) )
$Sum += $Value;
}
}
if ( $this->VMax < $Sum) { $this->VMax = $Sum; }
if ( $this->VMin > $Sum) { $this->VMin = $Sum; }
}
}
if ( $this->VMax > preg_replace('/\.[0-9]+/','',$this->VMax) )
$this->VMax = preg_replace('/\.[0-9]+/','',$this->VMax)+1;
/* If all values are the same */
if ( $this->VMax == $this->VMin )
{
if ( $this->VMax >= 0 ) { $this->VMax++; }
else { $this->VMin--; }
}
$DataRange = $this->VMax - $this->VMin;
if ( $DataRange == 0 ) { $DataRange = .1; }
/* Compute automatic scaling */
$ScaleOk = FALSE; $Factor = 1;
$MinDivHeight = 25;
$MaxDivs = ($this->GArea_X2 - $this->GArea_X1) / $MinDivHeight;
if ( $this->VMin == 0 && $this->VMax == 0 )
{ $this->VMin = 0; $this->VMax = 2; $Scale = 1; $Divisions = 2;}
elseif ($MaxDivs > 1)
{
while(!$ScaleOk)
{
$Scale1 = ( $this->VMax - $this->VMin ) / $Factor;
$Scale2 = ( $this->VMax - $this->VMin ) / $Factor / 2;
$Scale4 = ( $this->VMax - $this->VMin ) / $Factor / 4;
if ( $Scale1 > 1 && $Scale1 <= $MaxDivs && !$ScaleOk) { $ScaleOk = TRUE; $Divisions = floor($Scale1); $Scale = 1;}
if ( $Scale2 > 1 && $Scale2 <= $MaxDivs && !$ScaleOk) { $ScaleOk = TRUE; $Divisions = floor($Scale2); $Scale = 2;}
if (!$ScaleOk)
{
if ( $Scale2 > 1 ) { $Factor = $Factor * 10; }
if ( $Scale2 < 1 ) { $Factor = $Factor / 10; }
}
}
if ( floor($this->VMax / $Scale / $Factor) != $this->VMax / $Scale / $Factor)
{
$GridID = floor ( $this->VMax / $Scale / $Factor) + 1;
$this->VMax = $GridID * $Scale * $Factor;
$Divisions++;
}
if ( floor($this->VMin / $Scale / $Factor) != $this->VMin / $Scale / $Factor)
{
$GridID = floor( $this->VMin / $Scale / $Factor);
$this->VMin = $GridID * $Scale * $Factor;
$Divisions++;
}
}
else /* Can occurs for small graphs */
$Scale = 1;
if ( !isset($Divisions) )
$Divisions = 2;
if ($Scale == 1 && $Divisions%2 == 1)
$Divisions--;
}
else
$Divisions = $this->Divisions;
$this->DivisionCount = $Divisions;
$DataRange = $this->VMax - $this->VMin;
if ( $DataRange == 0 ) { $DataRange = .1; }
$this->DivisionHeight = ( $this->GArea_X2 - $this->GArea_X1 ) / $Divisions;
$this->DivisionRatio = ( $this->GArea_X2 - $this->GArea_X1 ) / $DataRange;
$this->GAreaYOffset = 0;
if ( count($Data) > 1 )
{
if ( $WithMargin == FALSE )
$this->DivisionWidth = ( $this->GArea_Y2 - $this->GArea_Y1 ) / (count($Data)-1);
else
{
$this->DivisionWidth = ( $this->GArea_Y2 - $this->GArea_Y1 ) / (count($Data));
$this->GAreaYOffset = $this->DivisionWidth / 2;
}
}
else
{
$this->DivisionWidth = $this->GArea_Y2 - $this->GArea_Y1;
$this->GAreaYOffset = $this->DivisionWidth / 2;
}
$this->DataCount = count($Data);
if ( $DrawTicks == FALSE )
return(0);
$XPos = $this->GArea_X1;
$YMin = NULL;
for($i=1;$i<=$Divisions+1;$i++)
{
$this->drawLine($XPos,$this->GArea_Y1,$XPos,$this->GArea_Y1-5,$R,$G,$B);
$Value = $this->VMin + ($i-1) * (( $this->VMax - $this->VMin ) / $Divisions);
$Value = round($Value * pow(10,$Decimals)) / pow(10,$Decimals);
if ( $DataDescription["Format"]["Y"] == "number" )
$Value = $Value.$DataDescription["Unit"]["Y"];
if ( $DataDescription["Format"]["Y"] == "time" )
$Value = $this->ToTime($Value);
if ( $DataDescription["Format"]["Y"] == "date" )
$Value = $this->ToDate($Value);
if ( $DataDescription["Format"]["Y"] == "metric" )
$Value = $this->ToMetric($Value);
if ( $DataDescription["Format"]["Y"] == "currency" )
$Value = $this->ToCurrency($Value);
$Position = imageftbbox($this->FontSize,0,$this->FontName,$Value);
$TextWidth = $Position[2]-$Position[0];
imagettftext($this->Picture,$this->FontSize,0,$XPos-($this->FontSize/2),$this->GArea_Y1-10,$C_TextColor,$this->FontName,$Value);
if ( $YMin > $this->GArea_Y1-10-$TextWidth || $YMin == NULL ) { $YMin = $this->GArea_Y1-10-$TextWidth; }
$XPos = $XPos + $this->DivisionHeight;
}
/* Write the Y Axis caption if set */
if ( isset($DataDescription["Axis"]["Y"]) )
{
$Position = imageftbbox($this->FontSize,90,$this->FontName,$DataDescription["Axis"]["Y"]);
$TextHeight = abs($Position[1])+abs($Position[3]);
$TextTop = (($this->GArea_X2 - $this->GArea_X1) / 2) + $this->GArea_X1 + ($TextHeight/2);
imagettftext($this->Picture,$this->FontSize,90,$YMin-$this->FontSize,$TextTop,$C_TextColor,$this->FontName,$DataDescription["Axis"]["Y"]);
}
/* Horizontal Axis */
$YPos = $this->GArea_Y1 + $this->GAreaYOffset;
$ID = 1;
$XMax = NULL;
foreach ( $Data as $Key => $Values )
{
if ( $ID % $SkipLabels == 0 )
{
$this->drawLine($this->GArea_X1,floor($YPos),$this->GArea_X1-5,floor($YPos),$R,$G,$B);
$Value = $Data[$Key][$DataDescription["Position"]];
if ( $DataDescription["Format"]["X"] == "number" )
$Value = $Value.$DataDescription["Unit"]["X"];
if ( $DataDescription["Format"]["X"] == "time" )
$Value = $this->ToTime($Value);
if ( $DataDescription["Format"]["X"] == "date" )
$Value = $this->ToDate($Value);
if ( $DataDescription["Format"]["X"] == "metric" )
$Value = $this->ToMetric($Value);
if ( $DataDescription["Format"]["X"] == "currency" )
$Value = $this->ToCurrency($Value);
$Position = imageftbbox($this->FontSize,$Angle,$this->FontName,$Value);
$TextWidth = abs($Position[2])+abs($Position[0]);
$TextHeight = abs($Position[1])+abs($Position[3]);
if ( $Angle == 0 )
{
$XPos = $this->GArea_Y2+18; imagettftext($this->Picture,$this->FontSize,$Angle,$this->GArea_X1-10-floor($TextWidth),floor($YPos)+5-floor($TextHeight/2),$C_TextColor,$this->FontName,$Value);
}
else
{
$XPos = $this->GArea_Y2+10+$TextHeight;
if ( $Angle <= 90 )
imagettftext($this->Picture,$this->FontSize,$Angle,$XPos,floor($YPos)-$TextWidth+5,$C_TextColor,$this->FontName,$Value);
else
imagettftext($this->Picture,$this->FontSize,$Angle,$XPos,floor($YPos)+$TextWidth+5,$C_TextColor,$this->FontName,$Value);
}
if ( $XMax < $XPos || $XMax == NULL ) { $XMax = $XPos; }
}
$YPos = $YPos + $this->DivisionWidth;
$ID++;
}
/* Write the X Axis caption if set */
if ( isset($DataDescription["Axis"]["Y"]) )
{
$Position = imageftbbox($this->FontSize,90,$this->FontName,$DataDescription["Axis"]["Y"]);
$TextWidth = abs($Position[2])+abs($Position[0]);
$TextLeft = (($this->GArea_Y2 - $this->GArea_Y1) / 2) + $this->GArea_Y1 + ($TextWidth/2);
imagettftext($this->Picture,$this->FontSize,0,$TextLeft,$XMax+$this->FontSize+5,$C_TextColor,$this->FontName,$DataDescription["Axis"]["Y"]);
}
}
/* Compute and draw the scale */
function drawHorGrid($LineWidth,$Mosaic=TRUE,$R=220,$G=220,$B=220,$Alpha=100)
{
/* Draw mosaic */
if ( $Mosaic )
{
$LayerWidth = $this->GArea_Y2-$this->GArea_Y1;
$LayerHeight = $this->GArea_X2-$this->GArea_X1;
$this->Layers[0] = imagecreatetruecolor($LayerWidth,$LayerHeight);
$C_White =$this->AllocateColor($this->Layers[0],255,255,255);
imagefilledrectangle($this->Layers[0],0,0,$LayerWidth,$LayerHeight,$C_White);
imagecolortransparent($this->Layers[0],$C_White);
$C_Rectangle =$this->AllocateColor($this->Layers[0],250,250,250);
$XPos = $LayerHeight;
$LastX = $XPos;
for($i=0;$i<=$this->DivisionCount;$i++)
{
$LastX = $XPos;
$XPos = $XPos - $this->DivisionHeight;
if ( $XPos <= 0 ) { $XPos = 1; }
if ( $i % 2 == 0 )
{
imagefilledrectangle($this->Layers[0],$XPos,1,$LastX,$LayerWidth-1,$C_Rectangle);
}
}
imagecopymerge($this->Picture,$this->Layers[0],$this->GArea_X1,$this->GArea_Y1,0,0,$LayerWidth,$LayerHeight,$Alpha);
imagedestroy($this->Layers[0]);
}
/* Vertical lines */
$XPos = $this->GArea_X2 - $this->DivisionHeight;
for($i=1;$i<=$this->DivisionCount;$i++)
{
if ( $XPos > $this->GArea_X1 && $XPos < $this->GArea_X2 )
$this->drawDottedLine($XPos,$this->GArea_Y1,$XPos,$this->GArea_Y2,$LineWidth,$R,$G,$B);
$XPos = $XPos - $this->DivisionHeight;
}
/* Horizontal lines */
if ( $this->GAreaYOffset == 0 )
{ $YPos = $this->GArea_Y1 + $this->DivisionWidth + $this->GAreaYOffset;
$ColCount = $this->DataCount-2; }
else
{ $YPos = $this->GArea_Y1 + $this->GAreaYOffset;
//$ColCount = floor( ($this->GArea_X2 - $this->GArea_X1) / $this->DivisionWidth );
$ColCount = $this->DataCount;
}
for($i=1;$i<=$ColCount;$i++)
{
if ( $YPos > $this->GArea_Y1 && $YPos < $this->GArea_Y2 )
$this->drawDottedLine($this->GArea_X1,floor($YPos),$this->GArea_X2,floor($YPos),$LineWidth,$R,$G,$B);
$YPos = $YPos + $this->DivisionWidth;
}
}
/* Compute and draw the scale */
function drawTreshold($Value,$R,$G,$B,$ShowLabel=FALSE,$ShowOnBottom=FALSE,$TickWidth=4,$FreeText=NULL,$Angle=0)
{
if ( $R < 0 ) { $R = 0; } if ( $R > 255 ) { $R = 255; }
if ( $G < 0 ) { $G = 0; } if ( $G > 255 ) { $G = 255; }
if ( $B < 0 ) { $B = 0; } if ( $B > 255 ) { $B = 255; }
$C_TextColor =$this->AllocateColor($this->Picture,$R,$G,$B);
$X = $this->GArea_X1 + ($Value - $this->VMin) * $this->DivisionRatio;
if ( $X <= $this->GArea_X1 || $X >= $this->GArea_X2 )
return(-1);
if ( $TickWidth == 0 )
$this->drawLine($X,$this->GArea_Y1,$X,$this->GArea_Y2,$R,$G,$B);
else
$this->drawDottedLine($X,$this->GArea_Y1,$X,$this->GArea_Y2,$TickWidth,$R,$G,$B);
if ( $ShowLabel )
{
if ( $FreeText == NULL )
{ $Label = $Value; } else { $Label = $FreeText; }
$Position = imageftbbox($this->FontSize,$Angle,$this->FontName,$Label);
$TextWidth = abs($Position[2])-abs($Position[0]);
$TextLeft = abs($Position[3])-abs($Position[1]);
if ( $ShowOnBottom )
imagettftext($this->Picture,$this->FontSize,$Angle,$X+9,$this->GArea_Y2,$C_TextColor,$this->FontName,$Label);
else
imagettftext($this->Picture,$this->FontSize,$Angle,$X+9,$this->GArea_Y1+$TextLeft,$C_TextColor,$this->FontName,$Label);
}
}
}
?>

@ -1,6 +0,0 @@
<html>
<head>
</head>
<body>
</body>
</html>

@ -1,6 +0,0 @@
<html>
<head>
</head>
<body>
</body>
</html>

@ -1,121 +0,0 @@
<?php
/*
pCache - Faster renderding using data cache
Copyright (C) 2008 Jean-Damien POGOLOTTI
Version 1.1.2 last updated on 06/17/08
http://pchart.sourceforge.net
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 1,2,3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Class initialisation :
pCache($CacheFolder="Cache/")
Cache management :
IsInCache($Data)
GetFromCache($ID,$Data)
WriteToCache($ID,$Data,$Picture)
DeleteFromCache($ID,$Data)
ClearCache()
Inner functions :
GetHash($ID,$Data)
*/
/* pCache class definition */
require_once dirname(__FILE__) . '/../../global.inc.php';
//the cache default folder was changed
class pCache
{
var $HashKey = "";
var $CacheFolder = "";
/* Create the pCache object */
function pCache($CacheFolder="Cache/")
{
$this->CacheFolder = api_get_path(SYS_ARCHIVE_PATH);
}
/* This function is clearing the cache folder */
function ClearCache()
{
if ($handle = opendir($this->CacheFolder))
{
while (false !== ($file = readdir($handle)))
{
if ( $file != "." && $file != ".." )
unlink($this->CacheFolder.$file);
}
closedir($handle);
}
}
/* This function is checking if we have an offline version of this chart */
function IsInCache($ID,$Data,$Hash="")
{
if ( $Hash == "" )
$Hash = $this->GetHash($ID,$Data);
if ( file_exists($this->CacheFolder.$Hash) )
return(TRUE);
else
return(FALSE);
}
/* This function is making a copy of drawn chart in the cache folder */
function WriteToCache($ID,$Data,$Picture)
{
$Hash = $this->GetHash($ID,$Data);
$FileName = $this->CacheFolder.$Hash;
imagepng($Picture->Picture,$FileName);
}
/* This function is removing any cached copy of this chart */
function DeleteFromCache($ID,$Data)
{
$Hash = $this->GetHash($ID,$Data);
$FileName = $this->CacheFolder.$Hash;
if ( file_exists($FileName ) )
unlink($FileName);
}
/* This function is retrieving the cached picture if applicable */
function GetFromCache($ID,$Data)
{
$Hash = $this->GetHash($ID,$Data);
if ( $this->IsInCache("","",$Hash ) )
{
$FileName = $this->CacheFolder.$Hash;
header('Content-type: image/png');
@readfile($FileName);
exit();
}
}
/* This function is building the graph unique hash key */
function GetHash($ID,$Data)
{
$mKey = "$ID";
foreach($Data as $key => $Values)
{
$tKey = "";
foreach($Values as $Serie => $Value)
$tKey = $tKey.$Serie.$Value;
$mKey = $mKey.md5($tKey);
}
return(md5($mKey));
}
}
?>

File diff suppressed because it is too large Load Diff

@ -1,262 +0,0 @@
<?php
/*
pData - Simplifying data population for pChart
Copyright (C) 2008 Jean-Damien POGOLOTTI
Version 1.13 last updated on 08/17/08
http://pchart.sourceforge.net
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 1,2,3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Class initialisation :
pData()
Data populating methods :
ImportFromCSV($FileName,$Delimiter=",",$DataColumns=-1,$HasHeader=FALSE,$DataName=-1)
AddPoint($Value,$Serie="Serie1",$Description="")
Series manipulation methods :
AddSerie($SerieName="Serie1")
AddAllSeries()
RemoveSerie($SerieName="Serie1")
SetAbsciseLabelSerie($SerieName = "Name")
SetSerieName($Name,$SerieName="Serie1")
+ SetSerieSymbol($Name,$Symbol)
SetXAxisName($Name="X Axis")
SetYAxisName($Name="Y Axis")
SetXAxisFormat($Format="number")
SetYAxisFormat($Format="number")
SetXAxisUnit($Unit="")
SetYAxisUnit($Unit="")
removeSerieName($SerieName)
removeAllSeries()
Data retrieval methods :
GetData()
GetDataDescription()
*/
/* pData class definition */
class pData
{
var $Data;
var $DataDescription;
function pData()
{
$this->Data = "";
$this->DataDescription = "";
$this->DataDescription["Position"] = "Name";
$this->DataDescription["Format"]["X"] = "number";
$this->DataDescription["Format"]["Y"] = "number";
$this->DataDescription["Unit"]["X"] = NULL;
$this->DataDescription["Unit"]["Y"] = NULL;
}
function ImportFromCSV($FileName,$Delimiter=",",$DataColumns=-1,$HasHeader=FALSE,$DataName=-1)
{
$handle = @fopen($FileName,"r");
if ($handle)
{
$HeaderParsed = FALSE;
while (!feof($handle))
{
$buffer = fgets($handle, 4096);
$buffer = str_replace(chr(10),"",$buffer);
$buffer = str_replace(chr(13),"",$buffer);
$Values = split($Delimiter,$buffer);
if ( $buffer != "" )
{
if ( $HasHeader == TRUE && $HeaderParsed == FALSE )
{
if ( $DataColumns == -1 )
{
$ID = 1;
foreach($Values as $key => $Value)
{ $this->SetSerieName($Value,"Serie".$ID); $ID++; }
}
else
{
$SerieName = "";
foreach($DataColumns as $key => $Value)
$this->SetSerieName($Values[$Value],"Serie".$Value);
}
$HeaderParsed = TRUE;
}
else
{
if ( $DataColumns == -1 )
{
$ID = 1;
foreach($Values as $key => $Value)
{ $this->AddPoint(intval($Value),"Serie".$ID); $ID++; }
}
else
{
$SerieName = "";
if ( $DataName != -1 )
$SerieName = $Values[$DataName];
foreach($DataColumns as $key => $Value)
$this->AddPoint($Values[$Value],"Serie".$Value,$SerieName);
}
}
}
}
fclose($handle);
}
}
function AddPoint($Value,$Serie="Serie1",$Description="") {
if (is_array($Value) && count($Value) == 1)
$Value = $Value[0];
$ID = 0;
for ($i=0;$i<=count($this->Data);$i++) {
if(isset($this->Data[$i][$Serie])) { $ID = $i+1; }
}
if ( count($Value) == 1 ) {
$this->Data[$ID][$Serie] = $Value;
if ( $Description != "" ) $this->Data[$ID]["Name"] = $Description;
elseif (!isset($this->Data[$ID]["Name"])) $this->Data[$ID]["Name"] = $ID;
} else {
foreach ($Value as $key => $Val) {
$this->Data[$ID][$Serie] = $Val;
if (!isset($this->Data[$ID]["Name"]))
$this->Data[$ID]["Name"] = $ID;
$ID++;
}
}
}
function AddSerie($SerieName="Serie1")
{
if ( !isset($this->DataDescription["Values"]) )
{
$this->DataDescription["Values"][] = $SerieName;
}
else
{
$Found = FALSE;
foreach($this->DataDescription["Values"] as $key => $Value )
if ( $Value == $SerieName ) { $Found = TRUE; }
if ( !$Found )
$this->DataDescription["Values"][] = $SerieName;
}
}
function AddAllSeries()
{
unset($this->DataDescription["Values"]);
if ( isset($this->Data[0]) )
{
foreach($this->Data[0] as $Key => $Value)
{
if ( $Key != "Name" )
$this->DataDescription["Values"][] = $Key;
}
}
}
function RemoveSerie($SerieName="Serie1")
{
if ( !isset($this->DataDescription["Values"]) )
return(0);
$Found = FALSE;
foreach($this->DataDescription["Values"] as $key => $Value )
{
if ( $Value == $SerieName )
unset($this->DataDescription["Values"][$key]);
}
}
function SetAbsciseLabelSerie($SerieName = "Name")
{
$this->DataDescription["Position"] = $SerieName;
}
function SetSerieName($Name,$SerieName="Serie1")
{
$this->DataDescription["Description"][$SerieName] = $Name;
}
function SetXAxisName($Name="X Axis")
{
$this->DataDescription["Axis"]["X"] = $Name;
}
function SetYAxisName($Name="Y Axis")
{
$this->DataDescription["Axis"]["Y"] = $Name;
}
function SetXAxisFormat($Format="number")
{
$this->DataDescription["Format"]["X"] = $Format;
}
function SetYAxisFormat($Format="number")
{
$this->DataDescription["Format"]["Y"] = $Format;
}
function SetXAxisUnit($Unit="")
{
$this->DataDescription["Unit"]["X"] = $Unit;
}
function SetYAxisUnit($Unit="")
{
$this->DataDescription["Unit"]["Y"] = $Unit;
}
function SetSerieSymbol($Name,$Symbol)
{
$this->DataDescription["Symbol"][$Name] = $Symbol;
}
function removeSerieName($SerieName)
{
if ( isset($this->DataDescription["Description"][$SerieName]) )
unset($this->DataDescription["Description"][$SerieName]);
}
function removeAllSeries()
{
foreach($this->DataDescription["Values"] as $Key => $Value)
unset($this->DataDescription["Values"][$Key]);
}
function GetData()
{
return($this->Data);
}
function GetDataDescription()
{
return($this->DataDescription);
}
}
?>

@ -1,17 +0,0 @@
65, 105, 225
72, 118 , 255
67, 110 , 238
58 , 95 , 205
39 , 64 , 139
100 , 149, 237
176 , 196, 222
202 , 225, 255
188 , 210, 238
162 , 181, 205
110 , 123, 139
119 , 136 , 153
112 , 128 , 144
198 , 226 , 255
185 , 211 , 238
159 , 182 , 205
108, 123 , 139

@ -1,14 +0,0 @@
50,124,148
82,124,148
97,152,183
115,173,207
144,196,226
174,216,240
105,210,231
167,219,216
224,228,204
168,188,56
188,208,76
208,228,96
228,245,116
248,255,136

@ -1,8 +0,0 @@
39,10,43
20,67,93
0,124,143
114,176,180
227,227,216

@ -1,6 +0,0 @@
<html>
<head>
</head>
<body>
</body>
</html>

@ -1,13 +0,0 @@
188,224,46
224,100,46
224,214,46
46,151,224
250,91,73
250,203,50
126,183,18
255,153,0
254,204,128
254,230,128
128,200,254
191,254,191
189,183,107

@ -1,7 +0,0 @@
189,250,75
204,203,81
220,155,87
235,108,92
250,60,98
176,46,224
46,151,224

@ -1,5 +0,0 @@
168,188,56
188,208,76
208,228,96
228,245,116
248,255,136

@ -4763,7 +4763,7 @@ class SessionManager
null,
$active,
$lastConnectionDate,
COURSEMANAGER,
api_is_student_boss() ? STUDENT_BOSS : COURSEMANAGER,
$keyword
);
}
@ -5477,48 +5477,6 @@ class SessionManager
return '00:00:00';
}
/**
* Calc the expended time (hh::mm:ss) by a user in a course
* @param int $userId The user id
* @param string $courseCode The course id
* @param int $sessionId Optional. The session id
* @param string $from Optional. From date
* @param string $until Optional. Until date
* @return string The time
*/
public static function getUserTimeInCourse($userId, $courseCode, $sessionId = 0, $from = '', $until = '')
{
$userId = intval($userId);
$sessionId = intval($sessionId);
$trackCourseAccessTable = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS);
$whereConditions = array(
'user_id = ? ' => $userId,
"AND course_code = '?' " => $courseCode,
'AND session_id = ? ' => $sessionId
);
if (!empty($from) && !empty($until)) {
$whereConditions["AND (login_course_date >= '?' "] = $from;
$whereConditions["AND logout_course_date <= DATE_ADD('?', INTERVAL 1 DAY)) "] = $until;
}
$trackResult = Database::select(
'SEC_TO_TIME(SUM(UNIX_TIMESTAMP(logout_course_date) - UNIX_TIMESTAMP(login_course_date))) as total_time',
$trackCourseAccessTable,
array(
'where' => $whereConditions
), 'first'
);
if ($trackResult != false) {
return $trackResult['total_time'] ? $trackResult['total_time'] : '00:00:00';
}
return '00:00:00';
}
/**
* Get the courses list by a course coach
* @param int $coachId The coach id

@ -335,7 +335,7 @@ class SkillRelGradebook extends Model
*/
class SkillRelUser extends Model
{
public $columns = array('id', 'user_id', 'skill_id', 'acquired_skill_at', 'assigned_by');
public $columns = array('id', 'user_id', 'skill_id', 'acquired_skill_at', 'assigned_by', 'course_id', 'session_id');
public function __construct()
{
@ -602,21 +602,27 @@ class Skill extends Model
return null;
}
public function add_skill_to_user($user_id, $gradebook_id)
public function add_skill_to_user($user_id, $gradebook_id, $courseId = 0, $sessionId = 0)
{
$courseId = intval($courseId);
$sessionId = intval($sessionId);
$skill_gradebook = new SkillRelGradebook();
$skill_rel_user = new SkillRelUser();
$skill_gradebooks = $skill_gradebook->get_all(array('where' => array('gradebook_id = ?' => $gradebook_id)));
if (!empty($skill_gradebooks)) {
foreach ($skill_gradebooks as $skill_gradebook) {
$user_has_skill = $this->user_has_skill($user_id, $skill_gradebook['skill_id']);
$user_has_skill = $this->user_has_skill($user_id, $skill_gradebook['skill_id'], $courseId, $sessionId);
if (!$user_has_skill) {
$params = array(
'user_id' => $user_id,
'skill_id' => $skill_gradebook['skill_id'],
'acquired_skill_at' => api_get_utc_datetime(),
'course_id' => $courseId,
'session_id' => $sessionId
);
$skill_rel_user->save($params);
}
}
@ -978,11 +984,24 @@ class Skill extends Model
*
* @return bool
*/
public function user_has_skill($user_id, $skill_id)
{
$skills = $this->get_user_skills($user_id);
foreach ($skills as $my_skill_id) {
if ($my_skill_id == $skill_id) {
public function user_has_skill($user_id, $skill_id, $courseId = 0, $sessionId = 0)
{
$courseId = intval($courseId);
$sessionId = intval($sessionId);
$whereConditions = array(
'user_id = ? ' => $user_id,
'AND skill_id = ? ' => $skill_id,
'AND course_id = ? ' => $courseId,
'AND session_id = ? ' => $sessionId
);
$result = Database::select('COUNT(1) AS qty', $this->table_skill_rel_user, array(
'where' => $whereConditions
), 'first');
if ($result != false) {
if ($result['qty'] > 0) {
return true;
}
}
@ -1026,4 +1045,74 @@ class Skill extends Model
return false;
}
/**
* Get the achieved skills by course
* @param int $courseId The course id
* @return array The skills list
*/
public function listAchievedByCourse($courseId)
{
$courseId = intval($courseId);
if ($courseId == 0) {
return array();
}
$list = array();
$sql = "SELECT course.id c_id, course.title c_name, course.directory c_directory, user.user_id, user.lastname, "
. "user.firstname, user.username, skill.id skill_id, skill.name skill_name, sru.acquired_skill_at "
. "FROM {$this->table_skill_rel_user} AS sru "
. "INNER JOIN {$this->table_course} "
. "ON sru.course_id = course.id "
. "INNER JOIN {$this->table_user} "
. "ON sru.user_id = user.user_id "
. "INNER JOIN {$this->table} "
. "ON sru.skill_id = skill.id "
. "WHERE course.id = $courseId";
$result = Database::query($sql);
while ($row = Database::fetch_assoc($result)) {
$list[] = $row;
}
return $list;
}
/**
* Get the users list who achieved a skill
* @param int $skillId The skill id
* @return array The users list
*/
public function listUsersWhoAchieved($skillId)
{
$skillId = intval($skillId);
if ($skillId == 0) {
return array();
}
$list = array();
$sql = "SELECT course.id c_id, course.title c_name, course.directory c_directory, user.user_id, user.lastname, "
. "user.firstname, user.username, skill.id skill_id, skill.name skill_name, sru.acquired_skill_at "
. "FROM {$this->table_skill_rel_user} AS sru "
. "INNER JOIN {$this->table_course} "
. "ON sru.course_id = course.id "
. "INNER JOIN {$this->table_user} "
. "ON sru.user_id = user.user_id "
. "INNER JOIN {$this->table} "
. "ON sru.skill_id = skill.id "
. "WHERE skill.id = $skillId ";
$result = Database::query($sql);
while ($row = Database::fetch_assoc($result)) {
$list[] = $row;
}
return $list;
}
}

@ -244,7 +244,7 @@ class SortableTable extends HTML_Table
public function return_table()
{
$empty_table = false;
$this->processHeaders();
$content = $this->get_table_html();
if ($this->get_total_number_of_items() == 0) {
@ -574,6 +574,8 @@ class SortableTable extends HTML_Table
$table_data = $this->get_table_data($from);
$this->processHeaders();
if (is_array($table_data)) {
$count = 1;
foreach ($table_data as & $row) {
@ -697,6 +699,7 @@ class SortableTable extends HTML_Table
public function processHeaders()
{
$counter = 0;
foreach ($this->headers as $column => $columnInfo) {
$label = $columnInfo['label'];
$sortable = $columnInfo['sortable'];
@ -743,7 +746,6 @@ class SortableTable extends HTML_Table
$counter++;
}
}
/**

@ -4,6 +4,10 @@
require_once api_get_path(SYS_CODE_PATH).'exercice/exercise.lib.php';
require_once api_get_path(SYS_CODE_PATH).'newscorm/learnpathList.class.php';
use CpChart\Classes\pData as pData;
use CpChart\Classes\pImage as pImage;
use CpChart\Classes\pCache as pCache;
/**
* Class Tracking
*
@ -4572,86 +4576,163 @@ class Tracking
/**
* Generates an histogram
*
* @param array list of exercise names
* @param array my results 0 to 100
* @param array average scores 0-100
* @param array list of exercise names
* @param array my results 0 to 100
* @param array average scores 0-100
* @return string
*/
static function generate_session_exercise_graph($names, $my_results, $average)
{
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';
/* Create and populate the pData object */
$myData = new pData();
$myData->addPoints($names, 'Labels');
$myData->addPoints($my_results, 'Serie1');
$myData->addPoints($average, 'Serie2');
$myData->setSerieWeight('Serie1', 1);
$myData->setSerieTicks('Serie2', 4);
$myData->setSerieDescription('Labels', 'Months');
$myData->setAbscissa('Labels');
$myData->setSerieDescription('Serie1', get_lang('MyResults'));
$myData->setSerieDescription('Serie2', get_lang('AverageScore'));
$myData->setAxisUnit(0, '%');
$myData->loadPalette(api_get_path(SYS_CODE_PATH) . 'palettes/pchart/default.color', true);
// Cache definition
$cachePath = api_get_path(SYS_ARCHIVE_PATH);
$myCache = new pCache(array('CacheFolder' => substr($cachePath, 0, strlen($cachePath) - 1)));
$chartHash = $myCache->getHash($myData);
if ($myCache->isInCache($chartHash)) {
//if we already created the img
$imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash;
$myCache->saveFromCache($chartHash, $imgPath);
$imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash;
} else {
/* Define width, height and angle */
$mainWidth = 860;
$mainHeight = 500;
$angle = 50;
/* Create the pChart object */
$myPicture = new pImage($mainWidth, $mainHeight, $myData);
/* Turn of Antialiasing */
$myPicture->Antialias = false;
/* Draw the background */
$settings = array('R' => 255, 'G' => 255, 'B' => 255);
$myPicture->drawFilledRectangle(0, 0, $mainWidth, $mainHeight, $settings);
/* Add a border to the picture */
$myPicture->drawRectangle(
0,
0,
$mainWidth - 1,
$mainHeight - 1,
array('R' => 0, 'G' => 0, 'B' => 0)
);
$cache = new pCache();
/* Set the default font */
$myPicture->setFontProperties(
array(
'FontName' => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf',
'FontSize' => 10)
);
/* Write the chart title */
$myPicture->drawText(
$mainWidth / 2,
30,
get_lang('ExercisesInTimeProgressChart'),
array(
'FontSize' => 12,
'Align' => TEXT_ALIGN_BOTTOMMIDDLE
)
);
// Dataset definition
$data_set = new pData();
/* Set the default font */
$myPicture->setFontProperties(
array(
'FontName' => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf',
'FontSize' => 6
)
);
// Dataset definition
$data_set->AddPoint($average, "Serie1");
$data_set->AddPoint($my_results, "Serie2");
$data_set->AddPoint($names, "Serie3");
$data_set->AddAllSeries();
$data_set->SetAbsciseLabelSerie('Serie3');
$data_set->SetSerieName(get_lang('AverageScore'),"Serie1");
$data_set->SetSerieName(get_lang('MyResults'), "Serie2");
//$data_set->SetYAxisName(get_lang("Percentage"));
$data_set->SetYAxisUnit("%");
// Initialise the graph
$main_width = 860;
$main_height = 500;
$y_label_angle = 50;
$data_set->RemoveSerie("Serie3");
$graph = new pChart($main_width, $main_height);
//See 3.2 BT#2797
$graph->setFixedScale(0,100);
$graph->setFontProperties(api_get_path(LIBRARY_PATH).'pchart/fonts/tahoma.ttf',8);
$graph->setGraphArea(65,50,$main_width-20, $main_height-140);
$graph->drawFilledRoundedRectangle(7,7,$main_width-7,$main_height-7,5,240,240,240);
$graph->drawRoundedRectangle(5,5,$main_width-5,$main_height -5,5,230,230,230);
$graph->drawGraphArea(255,255,255,TRUE);
//SCALE_NORMAL, SCALE_START0, SCALE_ADDALLSTART0, SCALE_ADDALL
$graph->drawScale($data_set->GetData(),$data_set->GetDataDescription(),SCALE_NORMAL ,150,150,150,TRUE,$y_label_angle,1, TRUE);
$graph->drawGrid(4,TRUE,230,230,230,70);
// Draw the 0 line
$graph->setFontProperties(api_get_path(LIBRARY_PATH).'pchart/fonts/tahoma.ttf',6);
$graph->drawTreshold(0,143,55,72,TRUE,TRUE);
// Draw the cubic curve graph
$graph->drawLineGraph($data_set->GetData(),$data_set->GetDataDescription());
$graph->drawPlotGraph($data_set->GetData(),$data_set->GetDataDescription(),1,1,230,255,255);
// Finish the graph
$graph->setFontProperties(api_get_path(LIBRARY_PATH).'pchart/fonts/tahoma.ttf',10);
$graph->drawLegend($main_width - 150,70,$data_set->GetDataDescription(),255,255,255);
$graph->setFontProperties(api_get_path(LIBRARY_PATH).'pchart/fonts/tahoma.ttf',11);
$graph->drawTitle(50, 30, get_lang('ExercisesInTimeProgressChart'), 50,50,50,$main_width-110, true);
// $main_graph = new pChart($main_width,$main_height);
$courseCode = isset($_GET['course']) ? Security::remove_XSS($_GET['course']) : null;
$graph_id = 'generate_session_exercise_graph'.$courseCode.'-'.intval($_GET['session_id']).'-'.api_get_user_id();
if ($cache->IsInCache($graph_id, $data_set->GetData())) {
//if (0) {
//if we already created the img
//echo 'in cache';
$img_file = $cache->GetHash($graph_id,$data_set->GetData());
} else {
$cache->WriteToCache($graph_id, $data_set->GetData(), $graph);
ob_start();
$graph->Stroke();
ob_end_clean();
$img_file = $cache->GetHash($graph_id, $data_set->GetData());
/* Define the chart area */
$myPicture->setGraphArea(60, 60, $mainWidth - 60, $mainHeight - 150);
/* Draw the scale */
$scaleSettings = array(
'XMargin' => 10,
'YMargin' => 10,
'Floating' => true,
'GridR' => 200,
'GridG' => 200,
'GridB' => 200,
'DrawSubTicks' => true,
'CycleBackground' => true,
'LabelRotation' => $angle,
'Mode' => SCALE_MODE_ADDALL_START0,
);
$myPicture->drawScale($scaleSettings);
/* Turn on Antialiasing */
$myPicture->Antialias = true;
/* Enable shadow computing */
$myPicture->setShadow(
true,
array(
'X' => 1,
'Y' => 1,
'R' => 0,
'G' => 0,
'B' => 0,
'Alpha' => 10
)
);
/* Draw the line chart */
$myPicture->setFontProperties(
array(
'FontName' => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf',
'FontSize' => 10
)
);
$myPicture->drawSplineChart();
$myPicture->drawPlotChart(
array(
'DisplayValues' => true,
'PlotBorder' => true,
'BorderSize' => 1,
'Surrounding' => -60,
'BorderAlpha' => 80
)
);
/* Write the chart legend */
$myPicture->drawLegend(
$mainWidth / 2 + 50,
50,
array(
'Style' => LEGEND_BOX,
'Mode' => LEGEND_HORIZONTAL,
'FontR' => 0,
'FontG' => 0,
'FontB' => 0,
'R' => 220,
'G' => 220,
'B' => 220,
'Alpha' => 100
)
);
$myCache->writeToCache($chartHash, $myPicture);
$imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash;
$myCache->saveFromCache($chartHash, $imgPath);
$imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash;
}
$html = '<img src="'.api_get_path(WEB_ARCHIVE_PATH).$img_file.'">';
$html = '<img src="' . $imgPath . '">';
return $html;
}
@ -4662,10 +4743,6 @@ class Tracking
*/
static function generate_exercise_result_thumbnail_graph($attempts)
{
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';
$exercise_title = $attempts['title'];
$attempts = $attempts['data'];
$my_exercise_result_array = $exercise_result = array();
@ -4734,49 +4811,106 @@ class Tracking
}
}
$cache = new pCache();
// Dataset definition
$data_set = new pData();
$data_set->AddPoint($final_array,"Serie1");
$data_set->AddPoint($my_final_array,"Serie2");
//$data_set->AddPoint($x_axis,"Serie3");
$data_set->AddAllSeries();
// Initialise the graph
$main_width = 80;
$main_height = 35;
$thumbnail_graph = new pChart($main_width, $main_height);
$thumbnail_graph->setFontProperties(api_get_path(LIBRARY_PATH).'pchart/fonts/tahoma.ttf',8);
//$thumbnail_graph->setGraphArea(50,30,680,200);
$thumbnail_graph->drawFilledRoundedRectangle(2,2,$main_width-2,$main_height-2,2,230,230,230);
$thumbnail_graph->setGraphArea(5,5,$main_width-5,$main_height-5);
$thumbnail_graph->drawGraphArea(255,255,255);
//SCALE_NORMAL, SCALE_START0, SCALE_ADDALLSTART0
$thumbnail_graph->drawScale($data_set->GetData(),$data_set->GetDataDescription(),SCALE_ADDALLSTART0, 150,150,150,FALSE,0,1,TRUE);
$thumbnail_graph->drawOverlayBarGraph($data_set->GetData(),$data_set->GetDataDescription(), 100);
$dataSet = new pData();
$dataSet->addPoints($final_array, 'Serie1');
$dataSet->addPoints($my_final_array, 'Serie2');
$dataSet->normalize(100, "%");
$dataSet->loadPalette(api_get_path(SYS_CODE_PATH) . 'palettes/pchart/default.color', true);
// Cache definition
$cachePath = api_get_path(SYS_ARCHIVE_PATH);
$myCache = new pCache(array('CacheFolder' => substr($cachePath, 0, strlen($cachePath) - 1)));
$chartHash = $myCache->getHash($dataSet);
if ($myCache->isInCache($chartHash)) {
$imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash;
$myCache->saveFromCache($chartHash, $imgPath);
$imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash;
} else {
/* Create the pChart object */
$widthSize = 80;
$heightSize = 35;
$fontSize = 2;
$myPicture = new pImage($widthSize, $heightSize, $dataSet);
/* Turn of Antialiasing */
$myPicture->Antialias = false;
/* Add a border to the picture */
$myPicture->drawRectangle(0, 0, $widthSize - 1, $heightSize - 1, array('R' => 0, 'G' => 0, 'B' => 0));
/* Set the default font */
$myPicture->setFontProperties(array('FontName' => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf', 'FontSize' => $fontSize));
/* Do not write the chart title */
/* Define the chart area */
$myPicture->setGraphArea(5, 5, $widthSize - 5, $heightSize - 5);
/* Draw the scale */
$scaleSettings = array(
'GridR' => 200,
'GridG' => 200,
'GridB' => 200,
'DrawSubTicks' => true,
'CycleBackground' => true,
'Mode' => SCALE_MODE_MANUAL,
'ManualScale' => array(
'0' => array(
'Min' => 0,
'Max' => 100
)
)
);
$myPicture->drawScale($scaleSettings);
/* Turn on shadow computing */
$myPicture->setShadow(
true,
array(
'X' => 1,
'Y' => 1,
'R' => 0,
'G' => 0,
'B' => 0,
'Alpha' => 10
)
);
// Finish the graph
$graph_id = 'thumbnail_exercise_result_graph_'.Security::remove_XSS($_GET['course']).'-'.intval($_GET['session_id']).'-'.api_get_user_id();
/* Draw the chart */
$myPicture->setShadow(
true,
array(
'X' => 1,
'Y' => 1,
'R' => 0,
'G' => 0,
'B' => 0,
'Alpha' => 10
)
);
$settings = array(
'DisplayValues' => true,
'DisplaySize' => $fontSize,
'DisplayR' => 0,
'DisplayG' => 0,
'DisplayB' => 0,
'DisplayOrientation' => ORIENTATION_HORIZONTAL,
'Gradient' => false,
'Surrounding' => 5,
'InnerSurrounding' => 5
);
$myPicture->drawStackedBarChart($settings);
if ($cache->IsInCache($graph_id, $data_set->GetData())) {
//if (0) {
//if we already created the img
//echo 'in cache';
$img_file = $cache->GetHash($graph_id,$data_set->GetData());
} else {
$cache->WriteToCache($graph_id, $data_set->GetData(), $thumbnail_graph);
ob_start();
$thumbnail_graph->Stroke();
ob_end_clean();
$img_file = $cache->GetHash($graph_id, $data_set->GetData());
/* Save and write in cache */
$myCache->writeToCache($chartHash, $myPicture);
$imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash;
$myCache->saveFromCache($chartHash, $imgPath);
$imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash;
}
$html = '<img src="'.api_get_path(WEB_ARCHIVE_PATH).$img_file.'">';
$html = '<img src="' . $imgPath . '" >';
return $html;
}
@ -4786,10 +4920,6 @@ class Tracking
*/
static function generate_exercise_result_graph($attempts)
{
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';
$exercise_title = strip_tags($attempts['title']);
$attempts = $attempts['data'];
$my_exercise_result_array = $exercise_result = array();
@ -4858,71 +4988,109 @@ class Tracking
}
}
$cache = new pCache();
// Dataset definition
$data_set = new pData();
$data_set->AddPoint($final_array,"Serie1");
$data_set->AddPoint($my_final_array,"Serie2");
$data_set->AddPoint($x_axis,"Serie3");
$data_set->AddAllSeries();
$data_set->SetAbsciseLabelSerie('Serie3');
$data_set->SetSerieName(get_lang('Score'),"Serie1");
$data_set->SetSerieName(get_lang('MyResults'),"Serie2");
$data_set->SetXAxisName(get_lang("Score"));
// Initialise the graph
$main_width = 500;
$main_height = 250;
$main_graph = new pChart($main_width,$main_height);
$main_graph->setFontProperties(api_get_path(LIBRARY_PATH).'pchart/fonts/tahoma.ttf',8);
$main_graph->setGraphArea(50,30, $main_width -20,$main_height -50);
$main_graph->drawFilledRoundedRectangle(10,10, $main_width- 10,$main_height -10,5,240,240,240);
$main_graph->drawRoundedRectangle(7,7,$main_width - 7,$main_height - 7,5,230,230,230);
$main_graph->drawGraphArea(255,255,255,TRUE);
//SCALE_NORMAL, SCALE_START0, SCALE_ADDALLSTART0
$main_graph->drawScale($data_set->GetData(),$data_set->GetDataDescription(),SCALE_ADDALLSTART0, 150,150,150,TRUE,0,1,TRUE);
$main_graph->drawGrid(4,TRUE,230,230,230,50);
// Draw the 0 line
$main_graph->setFontProperties(api_get_path(LIBRARY_PATH).'pchart/fonts/tahoma.ttf',6);
// $main_graph->drawTreshold(0,143,55,72,TRUE,TRUE);
// Draw the bar graph
$data_set->RemoveSerie("Serie3");
$dataSet = new pData();
$dataSet->addPoints($final_array, 'Serie1');
$dataSet->addPoints($my_final_array, 'Serie2');
$dataSet->addPoints($x_axis, 'Serie3');
$dataSet->setSerieDescription('Serie1', get_lang('Score'));
$dataSet->setSerieDescription('Serie2', get_lang('MyResults'));
$dataSet->setAbscissa('Serie3');
$dataSet->setXAxisName(get_lang('Score'));
$dataSet->normalize(100, "%");
$dataSet->loadPalette(api_get_path(SYS_CODE_PATH) . 'palettes/pchart/default.color', true);
// Cache definition
$cachePath = api_get_path(SYS_ARCHIVE_PATH);
$myCache = new pCache(array('CacheFolder' => substr($cachePath, 0, strlen($cachePath) - 1)));
$chartHash = $myCache->getHash($dataSet);
if ($myCache->isInCache($chartHash)) {
$imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash;
$myCache->saveFromCache($chartHash, $imgPath);
$imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash;
} else {
/* Create the pChart object */
$widthSize = 480;
$heightSize = 250;
$fontSize = 8;
$myPicture = new pImage($widthSize, $heightSize, $dataSet);
/* Turn of Antialiasing */
$myPicture->Antialias = false;
/* Add a border to the picture */
$myPicture->drawRectangle(0, 0, $widthSize - 1, $heightSize - 1, array('R' => 0, 'G' => 0, 'B' => 0));
/* Set the default font */
$myPicture->setFontProperties(array('FontName' => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf', 'FontSize' => 10));
/* Write the chart title */
$myPicture->drawText(
250,
20,
$exercise_title,
array(
'FontSize' => 12,
'Align' => TEXT_ALIGN_BOTTOMMIDDLE
)
);
//$main_graph->drawBarGraph($data_set->GetData(),$data_set->GetDataDescription(),TRUE);
/* Define the chart area */
$myPicture->setGraphArea(50, 50, $widthSize - 20, $heightSize - 30);
/* Draw the scale */
$scaleSettings = array(
'GridR' => 200,
'GridG' => 200,
'GridB' => 200,
'DrawSubTicks' => true,
'CycleBackground' => true,
'Mode' => SCALE_MODE_MANUAL,
'ManualScale' => array(
'0' => array(
'Min' => 0,
'Max' => 100
)
)
);
$myPicture->drawScale($scaleSettings);
/* Turn on shadow computing */
$myPicture->setShadow(true, array('X' => 1, 'Y' => 1, 'R' => 0, 'G' => 0, 'B' => 0, 'Alpha' => 10));
/* Draw the chart */
$myPicture->setShadow(true, array('X' => 1, 'Y' => 1, 'R' => 0, 'G' => 0, 'B' => 0, 'Alpha' => 10));
$settings = array(
'DisplayValues' => true,
'DisplaySize' => $fontSize,
'DisplayR' => 0,
'DisplayG' => 0,
'DisplayB' => 0,
'DisplayOrientation' => ORIENTATION_HORIZONTAL,
'Gradient' => false,
'Surrounding' => 30,
'InnerSurrounding' => 25
);
$myPicture->drawStackedBarChart($settings);
//$main_graph->drawStackedBarGraph($data_set->GetData(),$data_set->GetDataDescription(),TRUE);
$main_graph->drawOverlayBarGraph($data_set->GetData(),$data_set->GetDataDescription(), 100);
$legendSettings = array(
'Mode' => LEGEND_HORIZONTAL,
'Style' => LEGEND_NOBORDER,
);
$myPicture->drawLegend($widthSize / 2, 30, $legendSettings);
// Finish the graph
$main_graph->setFontProperties(api_get_path(LIBRARY_PATH).'pchart/fonts/tahoma.ttf',8);
$main_graph->drawLegend($main_width - 120,$main_height -100,$data_set->GetDataDescription(),255,255,255);
$main_graph->setFontProperties(api_get_path(LIBRARY_PATH).'pchart/fonts/tahoma.ttf',8);
$main_graph->drawTitle(180,22,$exercise_title,50,50,50);
$graph_id = 'exercise_result_graph'.Security::remove_XSS($_GET['course']).'-'.intval($_GET['session_id']).'-'.api_get_user_id();
if ($cache->IsInCache($graph_id, $data_set->GetData())) {
//if (0) {
//if we already created the img
//echo 'in cache';
$img_file = $cache->GetHash($graph_id,$data_set->GetData());
} else {
$cache->WriteToCache($graph_id, $data_set->GetData(), $main_graph);
ob_start();
$main_graph->Stroke();
ob_end_clean();
$img_file = $cache->GetHash($graph_id, $data_set->GetData());
/* Write and save into cache */
$myCache->writeToCache($chartHash, $myPicture);
$imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash;
$myCache->saveFromCache($chartHash, $imgPath);
$imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash;
}
$html = '<img src="'.api_get_path(WEB_ARCHIVE_PATH).$img_file.'">';
$html = '<img src="' . $imgPath . '" >';
return $html;
}

@ -4231,6 +4231,10 @@ class UserManager
)"
;
break;
case STUDENT_BOSS :
$drhConditions = " AND friend_user_id = $userId AND "
. "relation_type = " . USER_RELATION_TYPE_BOSS;
break;
}
$join = null;
@ -4297,51 +4301,65 @@ class UserManager
* */
public static function suscribe_users_to_hr_manager($hr_dept_id, $users_id)
{
// Database Table Definitions
$tbl_user_rel_user = Database::get_main_table(TABLE_MAIN_USER_REL_USER);
$tbl_user_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
return self::subscribeUsersToUser($hr_dept_id, $users_id, USER_RELATION_TYPE_RRHH);
}
$hr_dept_id = intval($hr_dept_id);
$affected_rows = 0;
/**
* Add subscribed users to a user by relation type
* @param int $userId The user id
* @param array $subscribedUsersId The id of suscribed users
* @param action $relationType The relation type
*/
public static function subscribeUsersToUser($userId, $subscribedUsersId, $relationType)
{
$userRelUserTable = Database::get_main_table(TABLE_MAIN_USER_REL_USER);
$userRelAccessUrlTable = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
$userId = intval($userId);
$relationType = intval($relationType);
$affectedRows = 0;
if (api_get_multiple_access_url()) {
//Deleting assigned users to hrm_id
$sql = "SELECT s.user_id FROM $tbl_user_rel_user s
INNER JOIN $tbl_user_rel_access_url a
ON (a.user_id = s.user_id)
WHERE
friend_user_id = $hr_dept_id AND
relation_type = '".USER_RELATION_TYPE_RRHH."' AND
access_url_id = ".api_get_current_access_url_id()."";
$sql = "SELECT s.user_id FROM $userRelUserTable s "
. "INNER JOIN $userRelAccessUrlTable a ON (a.user_id = s.user_id) "
. "WHERE friend_user_id = $userId "
. "AND relation_type = $relationType "
. "AND access_url_id = " . api_get_current_access_url_id() . "";
} else {
$sql = "SELECT user_id FROM $tbl_user_rel_user
WHERE
friend_user_id = $hr_dept_id AND
relation_type = '".USER_RELATION_TYPE_RRHH."' ";
$sql = "SELECT user_id FROM $userRelUserTable "
. "WHERE friend_user_id = $userId "
. "AND relation_type = $relationType";
}
$result = Database::query($sql);
if (Database::num_rows($result) > 0) {
while ($row = Database::fetch_array($result)) {
$sql = "DELETE FROM $tbl_user_rel_user
WHERE
user_id = '{$row['user_id']}' AND
friend_user_id = $hr_dept_id AND
relation_type = '".USER_RELATION_TYPE_RRHH."' ";
$sql = "DELETE FROM $userRelUserTable "
. "WHERE user_id = {$row['user_id']} "
. "AND friend_user_id = $userId "
. "AND relation_type = $relationType";
Database::query($sql);
}
}
// Inserting new user list
if (is_array($users_id)) {
foreach ($users_id as $user_id) {
$user_id = intval($user_id);
$sql = "INSERT IGNORE INTO $tbl_user_rel_user(user_id, friend_user_id, relation_type)
VALUES ('$user_id', $hr_dept_id, '".USER_RELATION_TYPE_RRHH."')";
if (is_array($subscribedUsersId)) {
foreach ($subscribedUsersId as $subscribedUserId) {
$subscribedUserId = intval($subscribedUserId);
$sql = "INSERT IGNORE INTO $userRelUserTable(user_id, friend_user_id, relation_type) "
. "VALUES ($subscribedUserId, $userId, $relationType)";
Database::query($sql);
$affected_rows = Database::affected_rows();
$affectedRows = Database::affected_rows();
}
}
return $affected_rows;
return $affectedRows;
}
/**
@ -4958,6 +4976,51 @@ EOF;
}
}
/**
* Subscribe users to student boss
* @param int $bossId The boss id
* @param array $usersId The users array
* @return int Affected rows
*/
public static function subscribeUsersToBoss($bossId, $usersId)
{
return self::subscribeUsersToUser($bossId, $usersId, USER_RELATION_TYPE_BOSS);
}
/**
* Get users followed by student boss
* @param int $userId
* @param int $userStatus (STUDENT, COURSEMANAGER, etc)
* @param bool $getOnlyUserId
* @param bool $getSql
* @param bool $getCount
* @param int $from
* @param int $numberItems
* @param int $column
* @param string $direction
* @param int $active
* @param string $lastConnectionDate
* @return array users
*/
public static function getUsersFollowedByStudentBoss(
$userId,
$userStatus = 0,
$getOnlyUserId = false,
$getSql = false,
$getCount = false,
$from = null,
$numberItems = null,
$column = null,
$direction = null,
$active = null,
$lastConnectionDate = null
){
return self::getUsersFollowedByUser(
$userId, $userStatus, $getOnlyUserId, $getSql, $getCount, $from, $numberItems, $column, $direction,
$active, $lastConnectionDate, STUDENT_BOSS
);
}
/**
* Get the teacher (users with COURSEMANGER status) list
* @return array The list
@ -5020,4 +5083,47 @@ EOF;
}
return $users;
}
/**
* Calc the expended time (in seconds) by a user in a course
* @param int $userId The user id
* @param string $courseCode The course id
* @param int $sessionId Optional. The session id
* @param string $from Optional. From date
* @param string $until Optional. Until date
* @return int The time
*/
public static function getExpendedTimeInCourses($userId, $courseCode, $sessionId = 0, $from = '', $until = '')
{
$userId = intval($userId);
$sessionId = intval($sessionId);
$trackCourseAccessTable = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS);
$whereConditions = array(
'user_id = ? ' => $userId,
"AND course_code = '?' " => $courseCode,
'AND session_id = ? ' => $sessionId
);
if (!empty($from) && !empty($until)) {
$whereConditions["AND (login_course_date >= '?' "] = $from;
$whereConditions["AND logout_course_date <= DATE_ADD('?', INTERVAL 1 DAY)) "] = $until;
}
$trackResult = Database::select(
'SUM(UNIX_TIMESTAMP(logout_course_date) - UNIX_TIMESTAMP(login_course_date)) as total_time',
$trackCourseAccessTable,
array(
'where' => $whereConditions
), 'first'
);
if ($trackResult != false) {
return $trackResult['total_time'] ? $trackResult['total_time'] : 0;
}
return 0;
}
}

@ -324,7 +324,7 @@ class IndexManager
if (api_get_setting('allow_skills_tool') == 'true') {
$content = '<ul class="nav nav-list">';
$content .= Display::tag('li', Display::url(get_lang('MySkills'), api_get_path(WEB_CODE_PATH).'social/skills_wheel.php'));
$content .= Display::tag('li', Display::url(get_lang('MySkills'), api_get_path(WEB_CODE_PATH).'social/my_skills_report.php'));
$allowSkillsManagement = api_get_setting('allow_hr_skills_management') == 'true';
@ -719,8 +719,8 @@ class IndexManager
'sessionVar' => basename(__FILE__, '.php'),
'imageOptions' => array(
'font_size' => 20,
'font_path' => api_get_path(LIBRARY_PATH).'pchart/fonts/',
'font_file' => 'tahoma.ttf',
'font_path' => api_get_path(SYS_FONTS_PATH) . 'opensans/',
'font_file' => 'OpenSans-Regular.ttf',
//'output' => 'gif'
)
);

@ -877,7 +877,7 @@ VALUES
('tool_visible_by_default_at_creation','forums','checkbox','Tools','true','ToolVisibleByDefaultAtCreationTitle','ToolVisibleByDefaultAtCreationComment',NULL,'Forums', 1),
('tool_visible_by_default_at_creation','quiz','checkbox','Tools','true','ToolVisibleByDefaultAtCreationTitle','ToolVisibleByDefaultAtCreationComment',NULL,'Quiz', 1),
('tool_visible_by_default_at_creation','gradebook','checkbox','Tools','true','ToolVisibleByDefaultAtCreationTitle','ToolVisibleByDefaultAtCreationComment',NULL,'Gradebook', 1),
('chamilo_database_version', NULL, 'textfield',NULL, '1.9.0.18715','DatabaseVersion','', NULL, NULL, 0);
('chamilo_database_version', NULL, 'textfield',NULL, '1.10.0.1','DatabaseVersion','', NULL, NULL, 0);
UNLOCK TABLES;
/*!40000 ALTER TABLE settings_current ENABLE KEYS */;
@ -2878,8 +2878,11 @@ CREATE TABLE IF NOT EXISTS skill_rel_user (
skill_id int NOT NULL,
acquired_skill_at datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
assigned_by int NOT NULL,
course_id INT NOT NULL DEFAULT 0,
session_id INT NOT NULL DEFAULT 0,
PRIMARY KEY (id)
);
ALTER TABLE skill_rel_user ADD INDEX idx_select_cs (course_id, session_id);
DROP TABLE IF EXISTS skill_profile;
CREATE TABLE IF NOT EXISTS skill_profile (
@ -3026,7 +3029,6 @@ CREATE TABLE usergroup_rel_question (
coefficient float(6,2)
);
-- 1.10.x-specific, non-course-related, database changes
-- Hook tables
CREATE TABLE IF NOT EXISTS hook_observer(
id int UNSIGNED NOT NULL AUTO_INCREMENT,
@ -3049,4 +3051,7 @@ CREATE TABLE IF NOT EXISTS hook_call(
hook_order int UNSIGNED NOT NULL,
enabled tinyint NOT NULL,
PRIMARY KEY PK_hook_management_hook_call(id)
);
);
-- 1.10.x-specific, non-course-related, database changes
-- some changes to previous structure might have been applied to the tables
-- creation statements above to increase efficiency

@ -13,11 +13,14 @@
-- This first part is for the main database
-- xxMAINxx
ALTER TABLE skill_rel_user ADD COLUMN course_id INT NOT NULL DEFAULT 0 AFTER id;
ALTER TABLE skill_rel_user ADD COLUMN session_id INT NOT NULL DEFAULT 0 AFTER course_id;
ALTER TABLE skill_rel_user ADD INDEX idx_select_cs (course_id, session_id);
-- Do not move this query
UPDATE settings_current SET selected_value = '1.9.0.18716' WHERE variable = 'chamilo_database_version';
UPDATE settings_current SET selected_value = '1.10.0.1' WHERE variable = 'chamilo_database_version';
-- xxCOURSExx

@ -2,6 +2,12 @@
/*
for more information: see languages.txt in the lang folder.
*/
$StudentsWhoAchievedTheSkillX = "Students who acquired skill %s";
$AchievedSkillInCourseX = "Skills acquired in course %s";
$SkillsReport = "Skills report";
$AssignedUsersListToStudentBoss = "Users assigned to their superior";
$AssignUsersToBoss = "Assign users to superior";
$RoleStudentBoss = "Student's superior";
$CosecantCsc = "Cosecant:\t\t\t\tcsc(x)";
$HyperbolicCosecantCsch = "Hyperbolic cosecant:\t\tcsch(x)";
$ArccosecantArccsc = "Arccosecant:\t\t\tarccsc(x)";

@ -2,6 +2,7 @@
/*
for more information: see languages.txt in the lang folder.
*/
$RoleStudentBoss = "Chef d'apprenant(s)";
$CosecantCsc = "Cosécante:\t\t\t\tcsc(x)";
$HyperbolicCosecantCsch = "Cosécante hyperbolique:\t\tcsch(x)";
$ArccosecantArccsc = "Arccosécante:\t\t\tarccsc(x)";
@ -53,11 +54,14 @@ $BuyCourses = "Achat de cours";
$MySessions = "Mes sessions";
$ActivateAudioRecorder = "Activer l'enregistreur audio";
$StartSpeaking = "Parlez maintenant";
$SessionDurationDescription = "La durée de la session vous permet d'établir une durée en nombre de jours d'accès depuis le premier accès de l'étudiant à cette session. Tant que l'étudiant n'y entre pas, la durée n'est pas entamée. De cette manière, il vous est possible de définir une session qui durera '15 jours' au lieu de démarrer ou de terminer à une date spécifique.";
$HyperbolicArctangentArctanh = "Arctangente hyperbolique:\t\tarctanh(x)";
$SessionDurationTitle = "Durée de session";
$ArctangentArctan = "Arctangente:\t\t\tarctan(x)";
$HyperbolicTangentTanh = "Tangente hyperbolique:\t\ttanh(x)";
$TangentTan = "Tangente:\t\t\ttan(x)";
$CoachAndStudent = "Coach et apprenant";
$Serie = "Série";
$HyperbolicArccosineArccosh = "Arcosinus hyperbolique:\t\tarccosh(x)";
$ArccosineArccos = "Arccosinus:\t\t\tarccos(x)";
$HyperbolicCosineCosh = "Cosinus hyperbolique:\t\tcosh(x)";

@ -2,6 +2,7 @@
/*
for more information: see languages.txt in the lang folder.
*/
$QuestionEditionNotAvailableBecauseItIsAlreadyAnsweredHoweverYouCanCopyItAndModifyTheCopy = "Úprava otázky nie je k dispozícii, pretože otázka bola už zodpovedaná. Avšak, môžete ju skopírovať a upraviť.";
$SelectADateOnTheCalendar = "Vybrať dátum z kalendára";
$AreYouSureDeleteTestResultBeforeDateD = "Ste si istí, že chcete vyčistiť výsledky v tomto teste pred zvoleným dátumom?";
$CleanStudentsResultsBeforeDate = "Vyčistiť všetky výsledky pred vybraným dátumom";

@ -3,6 +3,24 @@
for more information: see languages.txt in the lang folder.
*/
$langHGlossary = "Slovník pomoc";
$langGlossaryContent = "Tento nástroj vám umožní vytvoriť slovník termínov pre tento kurz, ktoré potom môžu byť použité z nástroja dokumentov";
$langForumContent = "Fórum je diskusný nástroj pre asynchrónne písomné práce. Na rozdiel od e-mailu, fórum je pre verejnosť, alebo polo-verejné, skupinové diskusie. </br> </br>
Ak chcete použiť Chamilo fórum, jednoducho môžu členovia použiť svoj prehliadač - nevyžaduje sa samostatný klientsky softvér. </br> </br>
Ak chcete organizovať fóra, kliknite na nástroj Fóra. Diskusie sú organizované hierarchicky podľa nasledujúcej štruktúry: </br> </br>
<b> Kategória> Fórum> Téma> Príspevok. Členovia sa môžu účinne podieľať na úpravách vo fóre, v prvom rade je nevyhnutné vytvárať kategórie a fóra; potom je na účastníkoch vytvárať témy a príspevky. V predvolenom nastavení fórum obsahuje jednu (verejnú) kategóriu, vzorovú tému a vzorový príspevok.
Môžete pridať kategórie do fóra, zmeniť ich názov alebo vytvoriť iné kategórie, v ktorých by ste potom mohli vytvoriť nové fóra. (Nepleťte kategórie a fóra, a pamätajte, že kategória, ktorá neobsahuje žiadne fórum je k ničomu a nie je zobrazená.)</br> </br>
\n </br>
Popis fóra môže obsahovať zoznam všetkých svojich členov, definíciu svojho účelu, cieľ úlohy, tému atď.</br> </br>
Fórum Skupiny by nemalo byť vytvorené pomocou nástroja Fórum, ale namiesto toho pomocou nástroja Skupín, kde si môžete určiť, či vaše fórum Skupiny by malo byť súkromné alebo verejné, súčasne poskytuje miesto pre zdieľanie skupiny dokumentov. </br> </br>
Výukové tipy</ br>
Vzdelávacie fórum nie je úplne rovnaké ako fórum, na ktoré ste zvyknutí a vidíte ho na internete. Pre jednu vec, nie je možné, aby študenti zmenili svoje príspevky potom, čo boli zverejnené v kurze, je logicky archivované, umožňuje sledovanie toho, čo bolo povedané v minulosti. Okrem toho, Chamilo fóra umožňujú špecifické použitie zodpovedajúce výučbe. Napríklad, niektorí učitelia/lektori publikujú opravy priamo vo fóre nasledujúcim spôsobom:</br> </br>
- Študent je požiadaný, aby napísal správu priamo do fóra, učiteľ ju opraví kliknutím na tlačidlo Upraviť (žltá ceruzka) a označí ju pomocou grafického editora (farba, podčiarknutie, atď.) </br>
A konečne, ďalší študenti ťažia z prezerania opravy, ktorá bola vykonaná u jedného z nich, Všimnite si, že rovnaký princíp môže byť aplikovaný medzi študentmi, ale bude vyžadovať jeho kopírovanie/vkladanie posolstva spolužiakom, z nasledujúcich dôvodov študentom/stážistom sa nedajú editovať jeden druhému príspevky používateľa. </b>";
$langHForum = "Fórum pomoc";
$langHFor = "Fórum - pomoc";
$langForContent = "Fórum je písaný a asynchrónny diskusný nástroj. Tam kde email umožní rozhovor jeden na jedného, fóra umožnia verejné alebo skoro verejné (skupinové) rozhovory.</p><p>Technicky povedané, používatelia potrebujú na využívanie Chamilo fór len internetový prehliadač.</P><p>Na zorganizovanie fór kliknite na 'Administrácia fóra'. Diskusie sú usporiadané v skupinách a podskupinách nasledovne:</p><p><b>Kategória > Fórum > Téma > Odpovede</b></p>Pre usporiadanie diskusií Vašich používateľov je nevyhnutné vopred usporiadať kategórie a fóra a na nich ponechať vytvorenie tém a odpovedí. Štandardne obsahuje Chamilo fórum len kategóriu 'Verejné', príklad fóra a príklad témy.</p><p>Prvá vec, ktorú by ste mali spraviť je zmazať príklad témy a zmeniť názov prvého fóra. Následne môžete v kategórii 'verejné' vytvoriť iné fóra, o témach, ktoré budú vyhovovať scenáru Vášho vyučovania.</p><p>Nemiešajte kategórie a fóra a nezabudnite, že prázdna kategória (bez fór) sa neobjaví študentskom pohľade.</p><p>Popisom fóra môže byť zoznam jeho členov, definícia cieľa, úlohy, témy...</p> <p>Skupinové fóra by nemali byť vytvorené prostredníctvom nástroja 'Fórum' ale cez nástroj 'Skupiny'. Tak budete môcť rozhodnúť, či budú skupinové fóra súkromné alebo verejné.</p> <b>Pedagogické tipy</b> <p>Niektorí lektori/inštruktori používajú fóra na posielanie opráv (korektúr). Študent uverejní prácu. Lektor ju opraví stlačením tlačidla upraviť (žltá ceruzka) a pomocou WYSYWIG editora (používa napríklad farby a podčiarknutia). Takto môžu aj iní študenti zistiť, čo je nesprávne a treba to opraviť.";

@ -2,6 +2,7 @@
/*
for more information: see languages.txt in the lang folder.
*/
$YourLanguageNotThereContactUs = "Nemôžete nájsť svoj jazyk v zozname? Kontaktujte nás na info@chamilo.org a pomôžte ako prekladateľ.";
$DateTimezoneSettingNotSet = "Zistili sme, že vaša inštalácia PHP nedefinuje nastavenie date.timezone. Toto je požiadavka Chamilo. Prosím uistite sa, že je nastavená konfigurácia php.ini podľa kontroly, inak sa dostanete do problémov. Varovali sme vás!";
$langStatDB = "Štatistická databáza";
$langEnableTracking = "Aktivovať štatistiku";

@ -2,6 +2,7 @@
/*
for more information: see languages.txt in the lang folder.
*/
$AssignedCourses = "Pridelené kurzy";
$SleepingStudents = "Spiaci študenti";
$SleepingTeachers = "Spiaci učitelia";
$InactiveUsers = "Neaktívni používatelia";

@ -2,6 +2,112 @@
/*
for more information: see languages.txt in the lang folder.
*/
$StudentsWhoAchievedTheSkillX = "Študenti, ktorí získali zručnosti %s";
$AchievedSkillInCourseX = "Zručnosti získané v kurze %s";
$SkillsReport = "Zručnosti hlásenie";
$AssignedUsersListToStudentBoss = "Používatelia pridelení zoznamu šéfov";
$AssignUsersToBoss = "Pridanie používateľov medzi šéfov";
$RoleStudentBoss = "Študent šéf";
$CosecantCsc = "Cosecant:\t\t\t\tcsc(x)";
$HyperbolicCosecantCsch = "Hyperbolický cosecant:\t\tcsch(x)";
$ArccosecantArccsc = "Arccosecant:\t\t\tarccsc(x)";
$HyperbolicArccosecantArccsch = "Hyperbolický arccosecant:\t\tarccsch(x)";
$SecantSec = "Secant:\t\t\t\tsec(x)";
$HyperbolicSecantSech = "Hyperbolický secant:\t\tsech(x)";
$ArcsecantArcsec = "Arcsecant:\t\t\tarcsec(x)";
$HyperbolicArcsecantArcsech = "Hyperbolický arcsecant:\t\tarcsech(x)";
$CotangentCot = "Kotangens:\t\t\tcot(x)";
$HyperbolicCotangentCoth = "Hyperbolický kotangens:\t\tcoth(x)";
$ArccotangentArccot = "Arkus kotangens:\t\t\tarccot(x)";
$HyperbolicArccotangentArccoth = "Hyperbolický arkus kotangens:\t\tarccoth(x)";
$HelpCookieUsageValidation = "Aby táto stránka pracovala a bola schopná merať použitie obsahu, táto platforma používa cookies.<br /><br />
V prípade potreby, časť Pomoc vo vašom prehliadači ukazuje ako konfigurovať súbory cookie.<br /><br />
Pre viac informácií o cookies, môžete navštíviť <a href=\"http://www.aboutcookies.org/\">O Cookies</a> stránku.";
$YouAcceptCookies = "Tým, že používate túto stránku vyhlasujete, že súhlasíte s použitím cookies.";
$TemplateCertificateComment = "Príklad formátu osvedčenia";
$TemplateCertificateTitle = "Certifikát";
$ResultsVisibility = "Viditeľnosť výsledkov";
$DownloadCertificate = "Stiahnúť certifikát";
$PortalActiveCoursesLimitReached = "Je nám ľúto, táto inštalácia má limit aktívnych kurzov, čo bolo už dosiahnuté. Stále môžete vytvárať nové kurzy, ale iba ak skryjete/vypnete aspoň jednen existujúcu aktívny kurz. Ak to chcete vykonať, upravte kurz zo zoznamu správy kurzov, a zmeňte viditeľnosť na 'skrytý', potom skúste znova vytvoriť tento kurz. Ak chcete zvýšiť maximálny počet aktívnych kurzov povolených v tejto inštalácií Chamilo , obráťte sa na svojho poskytovateľa hostingu, alebo, ak je k dispozícii, upgradujte na vyšší program hostingu.";
$WelcomeToInstitution = "Vitajte v areáli %s";
$WelcomeToSiteName = "Vitajte na %s";
$RequestAccess = "Žiadosť o prístup";
$Formula = "Vzorec";
$MultipleConnectionsAreNotAllow = "Tento používateľ je už prihlásený";
$Listen = "Počúvať";
$AudioFileForItemX = "Zvukový súbor pre položku %s";
$ThereIsANewWorkFeedbackInWorkXHere = "K dispozícii je nová spätná väzba v práci: %s <a href=\"%s\">Kliknite tu</a> pre pozretie.";
$ThereIsANewWorkFeedback = "K dispozícii je nová spätná väzba v práci: %s";
$LastUpload = "Posledné nahraté";
$EditUserListCSV = "Upraviť zoznam používateľov";
$NumberOfCoursesHidden = "Počet skrytých kurzov";
$Post = "Odoslať";
$Write = "Písať";
$YouHaveNotYetAchievedSkills = "Ešte ste nedosiahli zručnosti";
$Corn = "Kukurica";
$Gray = "Šedá";
$LightBlue = "Svetlo modrá";
$Black = "Čierna";
$White = "Biela";
$DisplayOptions = "Možnosti zobrazenia";
$EnterTheSkillNameToSearch = "Zadajte názov zručnosti na vyhľadávanie";
$SkillsSearch = "Vyhľadávanie zručností";
$ChooseABackgroundColor = "Vybrať farbu pozadia";
$SocialWriteNewComment = "Napísať nový komentár";
$SocialWallWhatAreYouThinkingAbout = "Čo si o tom myslíte?";
$SocialMessageDelete = "Zmazať komentár";
$SocialWall = "Sociálny múr";
$BuyCourses = "Kúpiť kurzy";
$MySessions = "Moje stretnutia";
$ActivateAudioRecorder = "Aktivovať záznam zvuku";
$StartSpeaking = "Začnite hovoriť";
$SessionDurationDescription = "Trvanie stretnutia umožňuje nastaviť počet dní prístupu počnúc prvým dňom prístupu pužívateľa na stretnutie. Týmto spôsobom môžete nastaviť stretnutie na 'dobu posledných 15 dní', namiesto spustenia k určitému dátumu pre všetkých študentov.";
$HyperbolicArctangentArctanh = "Hyperbolický arkus tangens:\t\tarctanh(x)";
$SessionDurationTitle = "Trvanie stretnutia";
$ArctangentArctan = "Akrus tangens:\t\t\tarctan(x)";
$HyperbolicTangentTanh = "Hyperbolický tangens:\t\ttanh(x)";
$TangentTan = "Tangens:\t\t\ttan(x)";
$CoachAndStudent = "Tréner a študent";
$Serie = "Séria";
$HyperbolicArccosineArccosh = "Hyperbolický akrus kosínus:\t\tarccosh(x)";
$ArccosineArccos = "Akrus kosínus:\t\t\tarccos(x)";
$HyperbolicCosineCosh = "Hyperbolický kosínus:\t\tcosh(x)";
$CosineCos = "Kosínus:\t\t\t\tcos(x)";
$TeacherTimeReport = "Časová správa učiteľov";
$HyperbolicArcsineArcsinh = "Hyperbolický arkus sínus:\t\tarcsinh(x)";
$ArcsineArcsin = "Akrus sínus:\t\t\tarcsin(x)";
$HyperbolicSineSinh = "Hyperbolický sínus:\t\tsinh(x)";
$SineSin = "Sínus:\t\t\t\tsin(x)";
$PiNumberPi = "Číslo Pí:\t\t\tpi";
$ENumberE = "E číslo:\t\t\te";
$LogarithmLog = "Logaritmus:\t\t\tlog(x)";
$NaturalLogarithmLn = "Prirodzený logaritmus:\t\tln(x)";
$AbsoluteValueAbs = "Absolútna hodnota:\t\t\tabs(x";
$SquareRootSqrt = "Druhá odmocnina:\t\t\tsqrt(x)";
$ExponentiationCircumflex = "Umocnenie:\t\t\t^";
$DivisionSlash = "Delenie:\t\t\t/";
$MultiplicationStar = "Súčin:\t\t\t*";
$SubstractionMinus = "Rozdiel:\t\t\t-";
$SummationPlus = "Súčet:\t\t\t+";
$NotationList = "Zápis vzorca";
$SubscribeToSessionRequest = "Žiadosť o prihlásenie do stretnutia";
$PleaseSubscribeMeToSession = "Prosím, zvážte prihlásenie do stretnutia";
$SearchActiveSessions = "Hľadať aktívne spojenia";
$UserNameHasDash = "Používateľské meno nesmie obsahovať '-' znak";
$IfYouWantOnlyIntegerValuesWriteBothLimitsWithoutDecimals = "Ak chcete iba celočíselné hodnoty, napíšte oba limity bez desatinných miest";
$GiveAnswerVariations = "Prosím, napíšte koľko variant otázky chcete";
$AnswerVariations = "Varianty otázky";
$GiveFormula = "Prosím, napíšte vzorec";
$SignatureFormula = "Úprimne";
$FormulaExample = "Príklad vzorca: sqrt( [x] / [y] ) * ( e ^ ( ln(pi) ) )";
$VariableRanges = "Rozsahy premennej";
$ExampleValue = "Rozsah hodnôt";
$CalculatedAnswer = "Výpočtová otázka";
$UserIsCurrentlySubscribed = "Používateľ je v súčasnej dobe pripojený";
$OnlyBestAttempts = "Iba najlepšie pokusy";
$IncludeAllUsers = "Zahrnúť všetkých používateľov";
$HostingWarningReached = "Varovanie hostingu dosiahlo";
$SessionName = "Názov stretnutia";
$MobilePhoneNumberWrong = "Číslo mobilného telefónu je neúplné alebo obsahuje neplatné znaky";
@ -242,6 +348,7 @@ $DelImage = "Odstrániť obrázok";
$Code = "Kód kurzu";
$Up = "Hore";
$Down = "Dole";
$TimeReportForCourseX = "Čas správy kurzu %s";
$Theme = "Téma";
$TheListIsEmpty = "Prázdny zoznam";
$UniqueSelect = "Výber z viacerých možností (jediná správna odpoveď)";
@ -253,6 +360,7 @@ $TooShort = "Príliš krátke";
$CourseCreate = "Vytvoriť kurz";
$Todo = "Urobiť";
$UserName = "Prihlasovacie meno";
$TimeReportIncludingAllCoursesAndSessionsByTeacher = "Čas správy vrátane všetkých kurzov a stretnutí, podľa učiteľa";
$CategoryMod = "Zmeniť kategóriu";
$Hide = "Skryť";
$Dear = "Vážená(ý)";
@ -350,6 +458,8 @@ $CourseManagerview = "Náhľad lektora";
$StudentView = "Náhľad študenta";
$AddResource = "Pridať zdroj";
$AddedResources = "Pridané zdroje";
$TimeReportForTeacherX = "Čas správy učiteľa %s";
$TotalTime = "Celkový čas";
$langNameOfLang['arabic'] = "arabsky";
$langNameOfLang['brazilian'] = "brazílsky";
$langNameOfLang['bulgarian'] = "bulharsky";
@ -561,6 +671,7 @@ $CourseAdminRoleDescription = "Administrátor kurzu";
$MoveTo = "Presunúť do";
$Delete = "Zmazať";
$MoveFileTo = "Presunúť súbor do";
$TimeReportForSessionX = "Čas správy stretnutia %s";
$Error = "Chyba";
$Anonymous = "Anonymný";
$h = "h";

@ -2,6 +2,12 @@
/*
for more information: see languages.txt in the lang folder.
*/
$StudentsWhoAchievedTheSkillX = "Estudiantes que adquirieron la competencia %s";
$AchievedSkillInCourseX = "Competencias adquiridas en curso %s";
$SkillsReport = "Reporte de competencias";
$AssignedUsersListToStudentBoss = "Lista de usuarios asignados al superior";
$AssignUsersToBoss = "Asignar usuarios a superior";
$RoleStudentBoss = "Superior de estudiante(s)";
$CosecantCsc = "Cosecante:\t\t\t\tcsc(x)";
$HyperbolicCosecantCsch = "Cosecante hiperbólico:\t\tcsch(x)";
$ArccosecantArccsc = "Arccosecante:\t\t\tarccsc(x)";
@ -55,11 +61,14 @@ $BuyCourses = "Comprar cursos";
$MySessions = "Mis sesiones";
$ActivateAudioRecorder = "Activar la grabación de voz";
$StartSpeaking = "Hable ahora";
$SessionDurationDescription = "La duración de sesiones le permite configurar un número de días de acceso a una sesión que inician desde el primer acceso del estudiante a la misma sesión. Mientras no entre, no inicia el conteo de estos días. De esta manera, puede poner una sesión con acceso 'por 15 días' en lugar de una fecha específica de inicio y de fin, y así tener estudiantes que puedan iniciar con mayor flexibilidad.";
$HyperbolicArctangentArctanh = "Arcotangente hiperbólica:\tarctanh(x)";
$SessionDurationTitle = "Duración de sesión";
$ArctangentArctan = "Arcotangente:\t\t\tarctan(x)";
$HyperbolicTangentTanh = "Tangente hiperbólica:\t\ttanh(x)";
$TangentTan = "Tangente:\t\t\ttan(x)";
$CoachAndStudent = "Tutor y estudiante";
$Serie = "Serie";
$HyperbolicArccosineArccosh = "Arcocoseno hiperbólico:\t\tarccosh(x)";
$ArccosineArccos = "Arcocoseno:\t\t\tarccos(x)";
$HyperbolicCosineCosh = "Coseno hiperbólico:\t\tcosh(x)";

@ -21,9 +21,6 @@ $language_file = array ('registration', 'index', 'tracking');
require_once '../inc/global.inc.php';
// including additional libraries
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';
require_once 'myspace.lib.php';
api_block_anonymous_users();

@ -33,7 +33,7 @@ require_once api_get_path(SYS_CODE_PATH).'survey/survey.lib.php';
api_block_anonymous_users();
if (!api_is_allowed_to_create_course() && !api_is_session_admin() && !api_is_drh()) {
if (!api_is_allowed_to_create_course() && !api_is_session_admin() && !api_is_drh() && !api_is_student_boss()) {
// Check if the user is tutor of the course
$user_course_status = CourseManager::get_tutor_in_course_status(
api_get_user_id(),
@ -230,7 +230,7 @@ $courses_in_session = array();
//See #4676
$drh_can_access_all_courses = false;
if (api_is_drh() || api_is_platform_admin()) {
if (api_is_drh() || api_is_platform_admin() || api_is_student_boss()) {
$drh_can_access_all_courses = true;
}

@ -4,6 +4,10 @@
require_once api_get_path(LIBRARY_PATH).'export.lib.inc.php';
require_once api_get_path(LIBRARY_PATH).'tracking.lib.php';
use CpChart\Classes\pData as pData;
use CpChart\Classes\pImage as pImage;
use CpChart\Classes\pCache as pCache;
/**
* Class MySpace
* @package chamilo.reporting
@ -2781,11 +2785,8 @@ function convert_to_string($sql_result){
* @version OCT-22- 2010
* @return string
*/
function grapher($sql_result, $start_date, $end_date, $type = "") {
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';
function grapher($sql_result, $start_date, $end_date, $type = "")
{
if (empty($start_date)) { $start_date =""; }
if (empty($end_date)) { $end_date =""; }
if ($type == ""){ $type = 'day'; }
@ -2811,7 +2812,6 @@ function grapher($sql_result, $start_date, $end_date, $type = "") {
}
$i++;
}
switch ($type) {
case 'day':
$main_date = $main_day;
@ -2831,76 +2831,146 @@ function grapher($sql_result, $start_date, $end_date, $type = "") {
$main_date = $main_date[$labels];
}
$data_set = new pData();
$data_set->AddPoint($main_date, 'Q');
/* Create and populate the pData object */
$myData = new pData();
$myData->addPoints($main_date, 'Serie1');
if (count($main_date)!= 1) {
$data_set->AddPoint($labels, 'Date');
$myData->addPoints($labels, 'Labels');
$myData->setSerieDescription('Labels', 'Months');
$myData->setAbscissa('Labels');
}
$data_set->AddAllSeries();
$data_set->RemoveSerie('Date');
$data_set->SetAbsciseLabelSerie('Date');
$data_set->SetYAxisName(get_lang('Minutes', ''));
$graph_id = api_get_user_id().'AccessDetails'.api_get_course_id().$start_date.$end_date.$type;
$data_set->AddAllSeries();
$myData->setSerieWeight('Serie1', 1);
$myData->setSerieDescription('Serie1', get_lang('MyResults'));
$myData->setAxisName(0, get_lang('Minutes'));
$myData->loadPalette(api_get_path(SYS_CODE_PATH) . 'palettes/pchart/default.color', true);
$cache = new pCache();
// the graph id
$data = $data_set->GetData();
// Cache definition
$cachePath = api_get_path(SYS_ARCHIVE_PATH);
$myCache = new pCache(array('CacheFolder' => substr($cachePath, 0, strlen($cachePath) - 1)));
$chartHash = $myCache->getHash($myData);
if ($cache->IsInCache($graph_id, $data_set->GetData())) {
//if (0) {
if ($myCache->isInCache($chartHash)) {
//if we already created the img
// echo 'in cache';
$img_file = $cache->GetHash($graph_id, $data_set->GetData());
$imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash;
$myCache->saveFromCache($chartHash, $imgPath);
$imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash;
} else {
// if the image does not exist in the archive/ folder
// Initialise the graph
$test = new pChart(760, 230);
//which schema of color will be used
$quant_resources = count($data[0]) - 1;
// Adding the color schemma
$test->loadColorPalette(api_get_path(LIBRARY_PATH).'pchart/palette/default.txt');
$test->setFontProperties(api_get_path(LIBRARY_PATH).'pchart/fonts/tahoma.ttf', 8);
$test->setGraphArea(70, 30, 680, 200);
$test->drawFilledRoundedRectangle(7, 7, 693, 223, 5, 240, 240, 240);
$test->drawRoundedRectangle(5, 5, 695, 225, 5, 230, 230, 230);
$test->drawGraphArea(255, 255, 255, TRUE);
$test->drawScale($data_set->GetData(), $data_set->GetDataDescription(), SCALE_START0, 150, 150, 150, TRUE, 0, 0);
$test->drawGrid(4, TRUE, 230, 230, 230, 50);
$test->setLineStyle(2);
// Draw the 0 line
$test->setFontProperties(api_get_path(LIBRARY_PATH).'pchart/fonts/tahoma.ttf', 6);
$test->drawTreshold(0, 143, 55, 72, TRUE, TRUE);
if (count($main_date) == 1) {
//Draw a graph
echo '<strong>'.$labels.'</strong><br/>';
$test->drawBarGraph($data_set->GetData(), $data_set->GetDataDescription(), TRUE);
} else {
//Draw the line graph
$test->drawLineGraph($data_set->GetData(), $data_set->GetDataDescription());
$test->drawPlotGraph($data_set->GetData(), $data_set->GetDataDescription(), 3, 2, 255, 255, 255);
}
/* Define width, height and angle */
$mainWidth = 760;
$mainHeight = 230;
$angle = 50;
/* Create the pChart object */
$myPicture = new pImage($mainWidth, $mainHeight, $myData);
/* Turn of Antialiasing */
$myPicture->Antialias = false;
/* Draw the background */
$settings = array("R" => 255, "G" => 255, "B" => 255);
$myPicture->drawFilledRectangle(0, 0, $mainWidth, $mainHeight, $settings);
/* Add a border to the picture */
$myPicture->drawRectangle(
0,
0,
$mainWidth - 1,
$mainHeight - 1,
array("R" => 0, "G" => 0, "B" => 0)
);
/* Set the default font */
$myPicture->setFontProperties(
array(
"FontName" => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf',
"FontSize" => 10)
);
/* Write the chart title */
$myPicture->drawText(
$mainWidth / 2,
30,
get_lang('ExercisesInTimeProgressChart'),
array(
"FontSize" => 12,
"Align" => TEXT_ALIGN_BOTTOMMIDDLE
)
);
// Finish the graph
$test->setFontProperties(api_get_path(LIBRARY_PATH).'pchart/fonts/tahoma.ttf', 8);
$test->setFontProperties(api_get_path(LIBRARY_PATH).'pchart/fonts/tahoma.ttf', 10);
$test->drawTitle(60, 22, get_lang('AccessDetails'), 50, 50, 50, 585);
/* Set the default font */
$myPicture->setFontProperties(
array(
"FontName" => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf',
"FontSize" => 8
)
);
/* Define the chart area */
$myPicture->setGraphArea(50, 40, $mainWidth - 40, $mainHeight - 80);
/* Draw the scale */
$scaleSettings = array(
'XMargin' => 10,
'YMargin' => 10,
'Floating' => true,
'GridR' => 200,
'GridG' => 200,
'GridB' => 200,
'DrawSubTicks' => true,
'CycleBackground' => true,
'LabelRotation' => $angle,
'Mode' => SCALE_MODE_ADDALL_START0,
);
$myPicture->drawScale($scaleSettings);
/* Turn on Antialiasing */
$myPicture->Antialias = true;
/* Enable shadow computing */
$myPicture->setShadow(
true,
array(
"X" => 1,
"Y" => 1,
"R" => 0,
"G" => 0,
"B" => 0,
"Alpha" => 10
)
);
//------------------
//echo 'not in cache';
$cache->WriteToCache($graph_id, $data_set->GetData(), $test);
ob_start();
$test->Stroke();
ob_end_clean();
$img_file = $cache->GetHash($graph_id, $data_set->GetData());
/* Draw the line chart */
$myPicture->setFontProperties(
array(
"FontName" => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf',
"FontSize" => 10
)
);
$myPicture->drawSplineChart();
$myPicture->drawPlotChart(
array(
"DisplayValues" => true,
"PlotBorder" => true,
"BorderSize" => 1,
"Surrounding" => -60,
"BorderAlpha" => 80
)
);
/* Do NOT Write the chart legend */
/* Write and save into cache */
$myCache->writeToCache($chartHash, $myPicture);
$imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash;
$myCache->saveFromCache($chartHash, $imgPath);
$imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash;
}
$foo_img = '<img src="'.api_get_path(WEB_ARCHIVE_PATH).$img_file.'">';
return $foo_img;
$html = '<img src="' . $imgPath . '">';
return $html;
} else {
$foo_img = api_convert_encoding('<div id="messages" class="warning-message">'.get_lang('GraphicNotAvailable').'</div>','UTF-8');
return $foo_img;
}

@ -14,6 +14,8 @@ $cidReset = true;
require_once '../inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH).'export.lib.inc.php';
$nameTools = get_lang('Students');
$export_csv = isset($_GET['export']) && $_GET['export'] == 'csv' ? true : false;
$keyword = isset($_GET['keyword']) ? Security::remove_XSS($_GET['keyword']) : null;
$active = isset($_GET['active']) ? intval($_GET['active']) : 1;
@ -49,7 +51,7 @@ function get_count_users()
$lastConnectionDate,
null,
null,
STUDENT
api_is_student_boss() ? null : STUDENT
);
return $count;
}
@ -85,7 +87,7 @@ function get_users($from, $limit, $column, $direction)
$lastConnectionDate,
null,
null,
STUDENT
api_is_student_boss() ? null : STUDENT
);
$drhLoaded = true;
}
@ -94,7 +96,7 @@ function get_users($from, $limit, $column, $direction)
if ($drhLoaded == false) {
$students = UserManager::getUsersFollowedByUser(
api_get_user_id(),
STUDENT,
api_is_student_boss() ? null : STUDENT,
false,
false,
false,
@ -104,7 +106,7 @@ function get_users($from, $limit, $column, $direction)
$direction,
$active,
$lastConnectionDate,
COURSEMANAGER,
api_is_student_boss() ? STUDENT_BOSS : COURSEMANAGER,
$keyword
);
}
@ -178,7 +180,7 @@ if ($export_csv) {
}
$sort_by_first_name = api_sort_by_first_name();
$actions .= '<div class="actions">';
$actions = '<div class="actions">';
if (api_is_drh()) {
$menu_items = array(
@ -186,7 +188,11 @@ if (api_is_drh()) {
Display::url(Display::return_icon('user_na.png', get_lang('Students'), array(), ICON_SIZE_MEDIUM), '#'),
Display::url(Display::return_icon('teacher.png', get_lang('Trainers'), array(), ICON_SIZE_MEDIUM), 'teachers.php'),
Display::url(Display::return_icon('course.png', get_lang('Courses'), array(), ICON_SIZE_MEDIUM), 'course.php'),
Display::url(Display::return_icon('session.png', get_lang('Sessions'), array(), ICON_SIZE_MEDIUM), 'session.php')
Display::url(Display::return_icon('session.png', get_lang('Sessions'), array(), ICON_SIZE_MEDIUM), 'session.php'),
Display::url(
Display::return_icon('skills.png', get_lang('Skills'), array(), ICON_SIZE_MEDIUM),
'skills.php'
)
);
$nb_menu_items = count($menu_items);
@ -195,6 +201,15 @@ if (api_is_drh()) {
$actions .= $item;
}
}
} else if (api_is_student_boss()) {
$actions .= Display::url(
Display::return_icon('stats.png', get_lang('MyStats'), '', ICON_SIZE_MEDIUM),
api_get_path(WEB_CODE_PATH)."auth/my_progress.php"
);
$actions .= Display::url(
Display::return_icon('user_na.png', get_lang('Students'), array(), ICON_SIZE_MEDIUM),
'#'
);
}
$actions .= '<span style="float:right">';

@ -186,7 +186,7 @@ if (api_is_drh()) {
Display::url(Display::return_icon('user.png', get_lang('Students'), array(), ICON_SIZE_MEDIUM), 'student.php'),
Display::url(Display::return_icon('teacher_na.png', get_lang('Trainers'), array(), ICON_SIZE_MEDIUM), 'teachers.php'),
Display::url(Display::return_icon('course.png', get_lang('Courses'), array(), ICON_SIZE_MEDIUM), 'course.php'),
Display::url(Display::return_icon('session.png', get_lang('Sessions'), array(), ICON_SIZE_MEDIUM), 'session.php')
Display::url(Display::return_icon('session.png', get_lang('Sessions'), array(), ICON_SIZE_MEDIUM), 'session.php'),
);
$nb_menu_items = count($menu_items);

@ -1798,7 +1798,7 @@ class learnpathItem
return '00 ' . $h . ' 00 \' 00"';
}
} else {
return self::calculateScormTime($origin, $time);
return api_format_time($time, $origin);
}
}
@ -1856,36 +1856,11 @@ class learnpathItem
0
);
}
$time = self::calculateScormTime($origin, $time);
$time = api_format_time($time, $origin);
return $time;
}
/**
* @param string $origin
* @param string $time
* @return string
*/
public static function calculateScormTime($origin, $time)
{
$h = get_lang('h');
$hours = $time / 3600;
$mins = ($time % 3600) / 60;
$secs = ($time % 60);
if ($origin == 'js') {
$scormTime = trim(sprintf("%02d : %02d : %02d", $hours, $mins, $secs));
} else {
$scormTime = trim(sprintf("%02d$h%02d'%02d\"", $hours, $mins, $secs));
}
if (self::debug > 2) {
error_log('learnpathItem::get_scorm_time(' . $scormTime . ')', 0);
}
return $scormTime;
}
/**
* Get the extra terms (tags) that identify this item
* @return mixed

@ -0,0 +1,9 @@
186, 206, 151
210, 148, 147
148, 170, 208
221, 133, 61
65, 153, 176
114, 88, 144
138, 166, 78
171, 70, 67
69, 115, 168

@ -133,12 +133,6 @@ if (api_get_setting('allow_skills_tool') == 'true') {
$socialRightInformation .= '<div class="well_border">';
$skill = new Skill();
$ranking = $skill->get_user_skill_ranking(api_get_user_id());
$url = api_get_path(WEB_CODE_PATH) . 'social/skills_ranking.php';
$ranking_url = Display::url(
sprintf(get_lang('YourSkillRankingX'), $ranking),
$url,
array('class' => 'btn')
);
$skills = $skill->get_user_skills(api_get_user_id(), true);
@ -156,13 +150,24 @@ if (api_get_setting('allow_skills_tool') == 'true') {
}
$socialRightInformation .= Display::tag('ul', $lis);
}
$url = api_get_path(WEB_CODE_PATH) . 'social/skills_wheel.php';
$skill_wheel_url = Display::url(
$socialRightInformation .= "<div class=\"btn-group\">";
if (api_is_student() || api_is_student_boss() || api_is_drh()) {
$socialRightInformation .= Display::url(
get_lang('SkillsReport'),
api_get_path(WEB_CODE_PATH) . 'social/my_skills_report.php',
array('class' => 'btn')
);
}
$socialRightInformation .= Display::url(
get_lang('ViewSkillsWheel'),
$url,
api_get_path(WEB_CODE_PATH) . 'social/skills_wheel.php',
array('class' => 'btn')
);
$socialRightInformation .= Display::url(
sprintf(get_lang('YourSkillRankingX'), $ranking),
api_get_path(WEB_CODE_PATH) . 'social/skills_ranking.php',
array('class' => 'btn')
);
$socialRightInformation .= '<div class="btn-group">' . $skill_wheel_url . $ranking_url . '</div>';
$socialRightInformation .= '</div>';
}

@ -0,0 +1,176 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Show the skills report
* @author Angel Fernando Quiroz Campos <angel.quiroz@beeznest.com>
* @package chamilo.social.skill
*/
require_once '../inc/global.inc.php';
$isStudent = api_is_student();
$isStudentBosss = api_is_student_boss();
$isDRH = api_is_drh();
if (!$isStudent && !$isStudentBosss && !$isDRH) {
header('Location: ' . api_get_path(WEB_CODE_PATH) . 'social/skills_wheel.php');
die;
}
$userId = api_get_user_id();
$skillTable = Database::get_main_table(TABLE_MAIN_SKILL);
$skillRelUserTable = Database::get_main_table(TABLE_MAIN_SKILL_REL_USER);
$courseTable = Database::get_main_table(TABLE_MAIN_COURSE);
$tableRows = array();
$tpl = new Template(get_lang('Skills'));
$tplPath = null;
$tpl->assign('allowSkillsTool', api_get_setting('allow_skills_tool') == 'true');
$tpl->assign('allowDrhSkillsManagement', api_get_setting('allow_hr_skills_management') == 'true');
if ($isStudent) {
$sql = "SELECT s.name, sru.acquired_skill_at, c.title, c.directory "
. "FROM $skillTable s "
. "INNER JOIN $skillRelUserTable sru ON s.id = sru.skill_id "
. "INNER JOIN $courseTable c ON sru.course_id = c.id "
. "WHERE sru.user_id = $userId";
$result = Database::query($sql);
while ($resultData = Database::fetch_assoc($result)) {
$tableRow = array(
'skillName' => $resultData['name'],
'achievedAt' => api_format_date($resultData['acquired_skill_at'], DATE_FORMAT_NUMBER),
'courseImage' => Display::return_icon('course.png', null, null, ICON_SIZE_BIG, null, true),
'courseName' => $resultData['title']
);
if (file_exists(api_get_path(SYS_COURSE_PATH) . "{$resultData['directory']}/course-pic85x85.png")) {
$tableRow['courseImage'] = api_get_path(WEB_COURSE_PATH) . "{$resultData['directory']}/course-pic85x85.png";
}
$tableRows[] = $tableRow;
}
$tplPath = 'skill/student_report.tpl';
} else if ($isStudentBosss) {
$selectedStudent = isset($_REQUEST['student']) ? intval($_REQUEST['student']) : 0;
$tableRows = array();
$followedStudents = UserManager::getUsersFollowedByStudentBoss($userId);
foreach ($followedStudents as &$student) {
$student['completeName'] = api_get_person_name($student['firstname'], $student['lastname']);
}
if ($selectedStudent > 0) {
$sql = "SELECT s.name, sru.acquired_skill_at, c.title, c.directory "
. "FROM $skillTable s "
. "INNER JOIN $skillRelUserTable sru ON s.id = sru.skill_id "
. "INNER JOIN $courseTable c ON sru.course_id = c.id "
. "WHERE sru.user_id = $selectedStudent";
$result = Database::query($sql);
while ($resultData = Database::fetch_assoc($result)) {
$tableRow = array(
'completeName' => $followedStudents[$selectedStudent]['completeName'],
'skillName' => $resultData['name'],
'achievedAt' => api_format_date($resultData['acquired_skill_at'], DATE_FORMAT_NUMBER),
'courseImage' => Display::return_icon('course.png', null, null, ICON_SIZE_BIG, null, true),
'courseName' => $resultData['title']
);
if (file_exists(api_get_path(SYS_COURSE_PATH) . "{$resultData['directory']}/course-pic85x85.png")) {
$tableRow['courseImage'] = api_get_path(WEB_COURSE_PATH) . "{$resultData['directory']}/course-pic85x85.png";
}
$tableRows[] = $tableRow;
}
}
$tplPath = 'skill/student_boss_report.tpl';
$tpl->assign('followedStudents', $followedStudents);
$tpl->assign('selectedStudent', $selectedStudent);
} else if ($isDRH) {
$selectedCourse = isset($_REQUEST['course']) ? intval($_REQUEST['course']) : null;
$selectedSkill = isset($_REQUEST['skill']) ? intval($_REQUEST['skill']) : 0;
$action = null;
if (!empty($selectedCourse)) {
$action = 'filterByCourse';
} else if (!empty($selectedSkill)) {
$action = 'filterBySkill';
}
$courses = CourseManager::get_courses_list();
$tableRows = array();
$reportTitle = null;
$objSkill = new Skill();
$skills = $objSkill->get_all();
switch ($action) {
case 'filterByCourse':
$course = api_get_course_info_by_id($selectedCourse);
$reportTitle = sprintf(get_lang('AchievedSkillInCourseX'), $course['name']);
$tableRows = $objSkill->listAchievedByCourse($selectedCourse);
break;
case 'filterBySkill':
$skill = $objSkill->get($selectedSkill);
$reportTitle = sprintf(get_lang('StudentsWhoAchievedTheSkillX'), $skill['name']);
$students = UserManager::getUsersFollowedByUser(
$userId, STUDENT, false, false, false, null, null, null, null, null, null, DRH
);
$coursesFilter = array();
foreach ($courses as $course) {
$coursesFilter[] = $course['id'];
}
$tableRows = $objSkill->listUsersWhoAchieved($selectedSkill, $coursesFilter);
break;
}
foreach ($tableRows as &$row) {
$row['completeName'] = api_get_person_name($row['firstname'], $row['lastname']);
$row['achievedAt'] = api_format_date($row['acquired_skill_at'], DATE_FORMAT_NUMBER);
if (file_exists(api_get_path(SYS_COURSE_PATH) . $row['c_directory'] . '/course-pic85x85.png')) {
$row['courseImage'] = api_get_path(WEB_COURSE_PATH) . $row['c_directory'] . '/course-pic85x85.png';
} else {
$row['courseImage'] = Display::return_icon('course.png', null, null, ICON_SIZE_BIG, null, true);
}
}
$tplPath = 'skill/drh_report.tpl';
$tpl->assign('action', $action);
$tpl->assign('courses', $courses);
$tpl->assign('skills', $skills);
$tpl->assign('selectedCourse', $selectedCourse);
$tpl->assign('selectedSkill', $selectedSkill);
$tpl->assign('reportTitle', $reportTitle);
}
$tpl->assign('rows', $tableRows);
$contentTemplate = $tpl->fetch("default/" . $tplPath);
$tpl->assign('content', $contentTemplate);
$tpl->display_one_col_template();

@ -116,7 +116,7 @@
{% for row in rows %}
<tr>
{% if withFilter %}
<td>{{ row.session.name }}</td>
<td>{{ row.session ? row.session.name : '&nbsp' }}</td>
<td>{{ row.course.name }}</td>
{% endif %}
<td>{{ row.coach.completeName }} ({{ row.coach.username}})</td>

@ -20,7 +20,7 @@
{{ plugin_footer_left }}
</div>
{% endif %}
&nbsp;
&nbsp;
</div>
<div id="footer_center" class="span4">
@ -30,7 +30,7 @@
{{ plugin_footer_center }}
</div>
{% endif %}
&nbsp;
&nbsp;
</div>
<div id="footer_right" class="span4">
@ -62,27 +62,7 @@
{% raw %}
<script>
$("form").on("click", ' .advanced_parameters', function() {
var id = $(this).attr('id') + '_options';
var button = $(this);
$("#"+id).toggle(function() {
button.toggleClass('active');
});
});
/* Makes row highlighting possible */
$(document).ready( function() {
/**
* Advanced options
* Usage
* <a id="link" href="url">Advanced</a>
* <div id="link_options">
* hidden content :)
* </div>
* */
$(".advanced_options").on("click", function(event) {
event.preventDefault();
$("form").on("click", ' .advanced_parameters', function() {
var id = $(this).attr('id') + '_options';
var button = $(this);
$("#"+id).toggle(function() {
@ -90,58 +70,78 @@ $(document).ready( function() {
});
});
/**
* <a class="advanced_options_open" href="http://" rel="div_id">Open</a>
* <a class="advanced_options_close" href="http://" rel="div_id">Close</a>
* <div id="div_id">Div content</div>
* */
$(".advanced_options_open").on("click", function(event) {
event.preventDefault();
var id = $(this).attr('rel');
$("#"+id).show();
});
$(".advanced_options_close").on("click", function(event) {
event.preventDefault();
var id = $(this).attr('rel');
$("#"+id).hide();
});
/* Makes row highlighting possible */
$(document).ready( function() {
/**
* Advanced options
* Usage
* <a id="link" href="url">Advanced</a>
* <div id="link_options">
* hidden content :)
* </div>
* */
$(".advanced_options").on("click", function(event) {
event.preventDefault();
var id = $(this).attr('id') + '_options';
var button = $(this);
$("#"+id).toggle(function() {
button.toggleClass('active');
});
});
// Chosen select
$(".chzn-select").chosen({
disable_search_threshold: 10
});
/**
* <a class="advanced_options_open" href="http://" rel="div_id">Open</a>
* <a class="advanced_options_close" href="http://" rel="div_id">Close</a>
* <div id="div_id">Div content</div>
* */
$(".advanced_options_open").on("click", function(event) {
event.preventDefault();
var id = $(this).attr('rel');
$("#"+id).show();
});
$(".jp-jplayer audio").addClass('skip');
$(".advanced_options_close").on("click", function(event) {
event.preventDefault();
var id = $(this).attr('rel');
$("#"+id).hide();
});
// Mediaelement
jQuery('video:not(.skip), audio:not(.skip)').mediaelementplayer(/* Options */);
// Chosen select
$(".chzn-select").chosen({
disable_search_threshold: 10
});
$(".jp-jplayer audio").addClass('skip');
// Mediaelement
jQuery('video:not(.skip), audio:not(.skip)').mediaelementplayer(/* Options */);
// Table highlight.
$("form .data_table input:checkbox").click(function() {
if ($(this).is(":checked")) {
$(this).parentsUntil("tr").parent().addClass("row_selected");
// Table highlight.
$("form .data_table input:checkbox").click(function() {
if ($(this).is(":checked")) {
$(this).parentsUntil("tr").parent().addClass("row_selected");
} else {
$(this).parentsUntil("tr").parent().removeClass("row_selected");
}
});
} else {
$(this).parentsUntil("tr").parent().removeClass("row_selected");
/* For non HTML5 browsers */
if ($("#formLogin".length > 1)) {
$("input[name=login]").focus();
}
});
/* For non HTML5 browsers */
if ($("#formLogin".length > 1)) {
$("input[name=login]").focus();
}
/* For IOS users */
$('.autocapitalize_off').attr('autocapitalize', 'off');
//Tool tip (in exercises)
var tip_options = {
placement : 'right'
}
$('.boot-tooltip').tooltip(tip_options);
});
{% endraw %}
/* For IOS users */
$('.autocapitalize_off').attr('autocapitalize', 'off');
//Tool tip (in exercises)
var tip_options = {
placement : 'right'
};
$('.boot-tooltip').tooltip(tip_options);
});
{% endraw %}
</script>

@ -0,0 +1,80 @@
{% if allowSkillsTool %}
<div class="btn-group">
<a class="btn btn-default" href="{{ _p.web_main }}social/skills_wheel.php">{{ 'SkillsWheel' | get_lang }}</a>
{% if allowDrhSkillsManagement %}
<a class="btn btn-default" href="{{ _p.web_main }}admin/skills_wheel.php">{{ 'ManageSkills' | get_lang }}</a>
{% endif %}
</div>
{% endif %}
<h1 class="page-header">{{ 'Skills' | get_lang }}</h1>
<div class="row">
<div class="span6">
<form class="form-inline" method="post" action="{{ _p.web_self }}">
<label for="course">{{ 'Courses' | get_lang }}</label>
<select name="course" id="course">
<option value="0">{{ 'Select' | get_lang }}</option>
{% for course in courses %}
<option value="{{ course.id }}" {{ (course.id == selectedCourse) ? 'selected' : '' }}>{{ course.title }}</option>
{% endfor %}
</select>
<button type="submit" class="btn">{{ 'Filter' | get_lang }}</button>
</form>
</div>
<div class="span6">
<form class="form-inline" method="post" action="{{ _p.web_self }}">
<label for="skill">{{ 'Skills' | get_lang }}</label>
<select name="skill" id="skill">
<option value="0">{{ 'Select' | get_lang }}</option>
{% for skill in skills %}
<option value="{{ skill.id }}" {{ (skill.id == selectedSkill) ? 'selected' : '' }}>{{ skill.name }}</option>
{% endfor %}
</select>
<button type="submit" class="btn">{{ 'Filter' | get_lang }}</button>
</form>
</div>
</div>
<h2 class="page-header">{{ reportTitle }} <small>{{ reportSubTitle }}</small></h2>
{% if rows %}
<table class="table">
<thead>
<tr>
{% if action == 'filterByCourse' %}
<th>{{ 'Course' | get_lang }}</th>
<th>{{ 'Skill' | get_lang }}</th>
<th>{{ 'Student' | get_lang }}</th>
<th>{{ 'Date' | get_lang }}</th>
{% elseif action == 'filterBySkill' %}
<th>{{ 'Skill' | get_lang }}</th>
<th>{{ 'Student' | get_lang }}</th>
<th>{{ 'Date' | get_lang }}</th>
<th>{{ 'Course' | get_lang }}</th>
{% endif %}
</tr>
</thead>
<tbody>
{% for row in rows %}
<tr>
{% if action == 'filterByCourse' %}
<td><img src="{{ row.courseImage }}" alt="{{ row.c_name }}" width="64"> {{ row.c_name }}</td>
<td>{{ row.skill_name }}</td>
<td>{{ row.completeName }}</td>
<td>{{ row.achievedAt }}</td>
{% elseif action == 'filterBySkill' %}
<td>{{ row.skill_name }}</td>
<td>{{ row.completeName }}</td>
<td>{{ row.achievedAt }}</td>
<td><img src="{{ row.courseImage }}" alt="{{ row.c_name }}" width="64"> {{ row.c_name }}</td>
{% endif %}
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<div class="alert alert-info">
{{ 'NoResults' | get_lang }}
</div>
{% endif %}

@ -0,0 +1,45 @@
{% if allowSkillsTool %}
<div class="btn-group">
<a class="btn btn-default" href="{{ _p.web_main }}social/skills_wheel.php">{{ 'SkillsWheel' | get_lang }}</a>
</div>
{% endif %}
<h1 class="page-header">{{ 'SkillsAcquired' | get_lang }}</h1>
<form class="form-inline" method="post" action="{{ _p.web_self }}">
<label>{{ 'Students' | get_lang }}</label>
<select name="student" id="student">
<option value="0">{{ 'Select' | get_lang }}</option>
{% for student in followedStudents %}
<option value="{{ student.user_id }}" {{ (student.user_id == selectedStudent) ? 'selected' : '' }}>{{ student.completeName }}</option>
{% endfor %}
</select>
<button type="submit" class="btn btn-primary">{{ 'Search' | get_lang }}</button>
</form>
{% if rows %}
<table class="table">
<thead>
<tr>
<th>{{ 'Student' | get_lang }}</th>
<th>{{ 'SkillsAcquired' | get_lang }}</th>
<th>{{ 'Date' | get_lang }}</th>
<th>{{ 'Course' | get_lang }}</th>
</tr>
</thead>
<tbody>
{% for row in rows %}
<tr>
<td>{{ row.completeName }}</td>
<td>{{ row.skillName }}</td>
<td>{{ row.achievedAt }}</td>
<td><img src="{{ row.courseImage }}" alt="{{ row.courseName }}" width="64"> {{ row.courseName }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<div class="alert alert-info">
{{ 'NoResults' | get_lang }}
</div>
{% endif %}

@ -0,0 +1,32 @@
{% if allowSkillsTool %}
<div class="btn-group">
<a class="btn btn-default" href="{{ _p.web_main }}social/skills_wheel.php">{{ 'SkillsWheel' | get_lang }}</a>
</div>
{% endif %}
<h1 class="page-header">{{ 'SkillsAcquired' | get_lang }}</h1>
{% if rows %}
<table class="table">
<thead>
<tr>
<th>{{ 'Skill' | get_lang }}</th>
<th>{{ 'Date' | get_lang }}</th>
<th>{{ 'Course' | get_lang }}</th>
</tr>
</thead>
<tbody>
{% for row in rows %}
<tr>
<td>{{ row.skillName }}</td>
<td>{{ row.achievedAt }}</td>
<td><img src="{{ row.courseImage }}" alt="{{ row.courseName }}" width="64"> {{ row.courseName }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<div class="alert alert-info">
{{ 'NoResults' | get_lang }}
</div>
{% endif %}

@ -1,9 +1,5 @@
<?php
/* For licensing terms, see /license.txt */
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';
require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/be/gradebookitem.class.php';
require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/be/evaluation.class.php';
require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/be/result.class.php';
@ -12,6 +8,11 @@ require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/flatview_data_generator.
require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/gradebook_functions.inc.php';
require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/be/category.class.php';
use CpChart\Classes\pData as pData;
use CpChart\Classes\pImage as pImage;
use CpChart\Classes\pCache as pCache;
/**
* Class BlockEvaluationGraph
* This class is used like controller for this evaluations graph block plugin,
@ -146,96 +147,147 @@ class BlockEvaluationGraph extends Block
$min[] = !empty($evaluation['min']) ? $evaluation['min'] : 0;
$avg[] = $evaluation['avg'];
}
// Dataset definition
$data_set = new pData;
$data_set->AddPoint($max, "Max");
$data_set->AddPoint($avg, "Avg");
$data_set->AddPoint($min, "Min");
$data_set->AddPoint($items, "Items");
$data_set->SetXAxisName(get_lang('EvaluationName'));
$data_set->SetYAxisName(get_lang('Percentage'));
$data_set->AddAllSeries();
$data_set->RemoveSerie("Items");
$data_set->SetAbsciseLabelSerie("Items");
$graph_id = $this->user_id.'StudentEvaluationGraph';
$cache = new pCache();
// the graph id
$data = $data_set->GetData();
if ($cache->IsInCache($graph_id, $data)) {
//if we already created the img
$img_file = $cache->GetHash($graph_id, $data);
} else {
// Initialise the graph
$angle = -30;
$test = new pChart($this->bg_width,$this->bg_height);
$test->setFontProperties(api_get_path(LIBRARY_PATH).'pchart/fonts/tahoma.ttf',8);
$test = $test->fixHeightByRotation(
$data_set->GetData(),
$data_set->GetDataDescription(),
$angle
// Dataset definition
$dataSet = new pData();
$dataSet->addPoints($min, 'Serie3');
$dataSet->addPoints($avg, 'Serie2');
$dataSet->addPoints($max, 'Serie1');
$dataSet->addPoints($items, 'Labels');
$dataSet->setSerieDescription('Serie1', get_lang('Max'));
$dataSet->setSerieDescription('Serie2', get_lang('Avg'));
$dataSet->setSerieDescription('Serie3', get_lang('Min'));
$dataSet->setAbscissa('Labels');
$dataSet->setAbscissaName(get_lang('EvaluationName'));
$dataSet->normalize(100, '%');
$dataSet->loadPalette(api_get_path(SYS_CODE_PATH) . 'palettes/pchart/default.color', true);
// Cache definition
$cachePath = api_get_path(SYS_ARCHIVE_PATH);
$myCache = new pCache(array('CacheFolder' => substr($cachePath, 0, strlen($cachePath) - 1)));
$chartHash = $myCache->getHash($dataSet);
if ($myCache->isInCache($chartHash)) {
$imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash;
$myCache->saveFromCache($chartHash, $imgPath);
$imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash;
} else {
/* Create the pChart object */
$widthSize = $this->bg_width;
$heightSize = $this->bg_height;
$fontSize = 8;
$angle = 50;
$myPicture = new pImage($widthSize, $heightSize, $dataSet);
/* Turn of Antialiasing */
$myPicture->Antialias = false;
/* Add a border to the picture */
$myPicture->drawRectangle(
0,
0,
$widthSize - 1,
$heightSize - 1,
array(
'R' => 0,
'G' => 0,
'B' => 0
)
);
/* Set the default font */
$myPicture->setFontProperties(
array(
'FontName' => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf',
'FontSize' => 10
)
);
$test->setGraphArea(50, 30, $this->bg_width-75, $this->bg_height - 75);
$test->drawFilledRoundedRectangle(
7,
7,
$this->bg_width-20,
$test->YSize - 20,
5,
240,
240,
240
/* Do NOT Write the chart title */
/* Define the chart area */
$myPicture->setGraphArea(
50,
30,
$widthSize - 20,
$heightSize - 100
);
$test->drawRoundedRectangle(
5,
5,
$this->bg_width-18,
$test->YSize - 18,
5,
230,
230,
230
/* Draw the scale */
$scaleSettings = array(
'GridR' => 200,
'GridG' => 200,
'GridB' => 200,
'DrawSubTicks' => true,
'CycleBackground' => true,
'Mode' => SCALE_MODE_MANUAL,
'ManualScale' => array(
'0' => array(
'Min' => 0,
'Max' => 100,
)
),
'LabelRotation' => $angle,
);
$test->drawGraphArea(255,255,255,TRUE);
$test->setFixedScale(0,100,5);
$test->drawScale(
$data_set->GetData(),
$data_set->GetDataDescription(),
SCALE_ADDALL,
150,
150,
150,
TRUE,
$angle,
2,
TRUE
$myPicture->drawScale($scaleSettings);
/* Turn on shadow computing */
$myPicture->setShadow(
true,
array(
'X' => 1,
'Y' => 1,
'R' => 0,
'G' => 0,
'B' => 0,
'Alpha' => 10
)
);
$test->setColorPalette(0,105,221,34);
$test->setColorPalette(1,255,135,30);
$test->setColorPalette(2,255,0,0);
$test->drawGrid(4,TRUE,230,230,230,50);
// Draw the 0 line
$test->setFontProperties(api_get_path(LIBRARY_PATH).'pchart/fonts/tahoma.ttf',6);
$test->drawTreshold(0,143,55,72,TRUE,TRUE);
// Draw the bar graph
$test->drawOverlayBarGraph($data_set->GetData(),$data_set->GetDataDescription(), 90);
// Finish the graph
$test->setFontProperties(api_get_path(LIBRARY_PATH).'pchart/fonts/tahoma.ttf',8);
$test->drawLegend($this->bg_width-80,20,$data_set->GetDataDescription(),255,255,255);
$test->setFontProperties(api_get_path(LIBRARY_PATH).'pchart/fonts/tahoma.ttf',10);
//$test->drawTitle(50,22,$course_code,50,50,50,185);
$test->setColorPalette(0,50,50,50);
$test->setColorPalette(1,50,50,50);
$test->setColorPalette(2,50,50,50);
$test->writeValues($data_set->GetData(),$data_set->GetDataDescription(),array("Min", "Max", "Avg"));
$cache->WriteToCache($graph_id, $data_set->GetData(), $test);
ob_start();
$test->Stroke();
ob_end_clean();
$img_file = $cache->GetHash($graph_id, $data_set->GetData());
}
if (!empty($img_file)) {
$graphs[$course_code] = '<img src="'.api_get_path(WEB_ARCHIVE_PATH).$img_file.'">';
}
/* Draw the chart */
$myPicture->setShadow(
true,
array(
'X' => 1,
'Y' => 1,
'R' => 0,
'G' => 0,
'B' => 0,
'Alpha' => 10
)
);
$settings = array(
'DisplayValues' => true,
'DisplaySize' => $fontSize,
'DisplayR' => 0,
'DisplayG' => 0,
'DisplayB' => 0,
'DisplayOrientation' => ORIENTATION_HORIZONTAL,
'Gradient' => false,
'Surrounding' => 30,
'InnerSurrounding' => 25
);
$myPicture->drawStackedBarChart($settings);
$legendSettings = array(
'Mode' => LEGEND_HORIZONTAL,
'Style' => LEGEND_NOBORDER,
);
$myPicture->drawLegend($widthSize / 2, 15, $legendSettings);
/* Write and save into cache */
$myCache->writeToCache($chartHash, $myPicture);
$imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash;
$myCache->saveFromCache($chartHash, $imgPath);
$imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash;
}
if (!empty($imgPath)) {
$courses_graph[$course_code] = '<img src="' . $imgPath . '">';
}
}
}
} // end for
@ -273,95 +325,141 @@ class BlockEvaluationGraph extends Block
$min[] = $evaluation['min'];
$avg[] = $evaluation['avg'];
}
// Dataset definition
$data_set = new pData;
$data_set->AddPoint($max, "Max");
$data_set->AddPoint($avg, "Avg");
$data_set->AddPoint($min, "Min");
$data_set->AddPoint($items, "Items");
$data_set->SetXAxisName(get_lang('EvaluationName'));
$data_set->SetYAxisName(get_lang('Percentage'));
$data_set->AddAllSeries();
$data_set->RemoveSerie("Items");
$data_set->SetAbsciseLabelSerie("Items");
$graph_id = $this->user_id.'StudentEvaluationGraph';
$cache = new pCache();
// the graph id
$data = $data_set->GetData();
if ($cache->IsInCache($graph_id, $data)) {
//if we already created the img
$img_file = $cache->GetHash($graph_id, $data);
} else {
// Initialise the graph
$angle = -30;
$test = new pChart($this->bg_width, $this->bg_height);
$test->setFontProperties(api_get_path(LIBRARY_PATH) . 'pchart/fonts/tahoma.ttf', 8);
$test->fixHeightByRotation(
$data_set->GetData(),
$data_set->GetDataDescription(),
$angle
// Dataset definition
$dataSet = new pData();
$dataSet->addPoints($min, 'Serie3');
$dataSet->addPoints($avg, 'Serie2');
$dataSet->addPoints($max, 'Serie1');
$dataSet->addPoints($items, 'Labels');
$dataSet->setSerieDescription('Serie1', get_lang('Max'));
$dataSet->setSerieDescription('Serie2', get_lang('Avg'));
$dataSet->setSerieDescription('Serie3', get_lang('Min'));
$dataSet->setAbscissa('Labels');
$dataSet->setAbscissaName(get_lang('EvaluationName'));
$dataSet->normalize(100, '%');
$dataSet->loadPalette(api_get_path(SYS_CODE_PATH) . 'palettes/pchart/default.color', true);
// Cache definition
$cachePath = api_get_path(SYS_ARCHIVE_PATH);
$myCache = new pCache(array('CacheFolder' => substr($cachePath, 0, strlen($cachePath) - 1)));
$chartHash = $myCache->getHash($dataSet);
if ($myCache->isInCache($chartHash)) {
$imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash;
$myCache->saveFromCache($chartHash, $imgPath);
$imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash;
} else {
/* Create the pChart object */
$widthSize = $this->bg_width;
$heightSize = $this->bg_height;
$fontSize = 8;
$angle = 50;
$myPicture = new pImage($widthSize, $heightSize, $dataSet);
/* Turn of Antialiasing */
$myPicture->Antialias = false;
/* Add a border to the picture */
$myPicture->drawRectangle(
0,
0,
$widthSize - 1,
$heightSize - 1,
array(
'R' => 0,
'G' => 0,
'B' => 0
)
);
/* Set the default font */
$myPicture->setFontProperties(
array(
'FontName' => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf',
'FontSize' => 10
)
);
$test->setGraphArea(50, 30, $this->bg_width - 75, $this->bg_height - 75);
$test->drawFilledRoundedRectangle(
7,
7,
$this->bg_width - 20,
$test->YSize - 20,
5,
240,
240,
240
/* Do NOT Write the chart title */
/* Define the chart area */
$myPicture->setGraphArea(50, 30, $widthSize - 20, $heightSize - 100);
/* Draw the scale */
$scaleSettings = array(
'GridR' => 200,
'GridG' => 200,
'GridB' => 200,
'DrawSubTicks' => true,
'CycleBackground' => true,
'Mode' => SCALE_MODE_MANUAL,
'ManualScale' => array(
'0' => array(
'Min' => 0,
'Max' => 100,
)
),
'LabelRotation' => $angle,
);
$test->drawRoundedRectangle(
5,
5,
$this->bg_width - 18,
$test->YSize - 18,
5,
230,
230,
230
$myPicture->drawScale($scaleSettings);
/* Turn on shadow computing */
$myPicture->setShadow(
true,
array(
'X' => 1,
'Y' => 1,
'R' => 0,
'G' => 0,
'B' => 0,
'Alpha' => 10
)
);
$test->drawGraphArea(255,255,255,TRUE);
$test->setFixedScale(0,100,5);
$test->drawScale(
$data_set->GetData(),
$data_set->GetDataDescription(),
SCALE_ADDALL,
150,
150,
150,
TRUE,
$angle,
2,
TRUE
/* Draw the chart */
$myPicture->setShadow(
true,
array(
'X' => 1,
'Y' => 1,
'R' => 0,
'G' => 0,
'B' => 0,
'Alpha' => 10
)
);
$test->setColorPalette(0,105,221,34);
$test->setColorPalette(1,255,135,30);
$test->setColorPalette(2,255,0,0);
$test->drawGrid(4,TRUE,230,230,230,50);
// Draw the 0 line
$test->setFontProperties(api_get_path(LIBRARY_PATH).'pchart/fonts/tahoma.ttf',6);
$test->drawTreshold(0,143,55,72,TRUE,TRUE);
// Draw the bar graph
$test->drawOverlayBarGraph($data_set->GetData(),$data_set->GetDataDescription(), 100);
// Finish the graph
$test->setFontProperties(api_get_path(LIBRARY_PATH).'pchart/fonts/tahoma.ttf',8);
$test->drawLegend($this->bg_width-80,20,$data_set->GetDataDescription(),255,255,255);
$test->setFontProperties(api_get_path(LIBRARY_PATH).'pchart/fonts/tahoma.ttf',10);
$test->setColorPalette(0,50,50,50);
$test->setColorPalette(1,50,50,50);
$test->setColorPalette(2,50,50,50);
$test->writeValues($data_set->GetData(),$data_set->GetDataDescription(),array("Min", "Max", "Avg"));
$cache->WriteToCache($graph_id, $data_set->GetData(), $test);
ob_start();
$test->Stroke();
ob_end_clean();
$img_file = $cache->GetHash($graph_id, $data_set->GetData());
}
if (!empty($img_file)) {
$courses_graph[$course_code] = '<img src="'.api_get_path(WEB_ARCHIVE_PATH).$img_file.'">';
}
$settings = array(
'DisplayValues' => true,
'DisplaySize' => $fontSize,
'DisplayR' => 0,
'DisplayG' => 0,
'DisplayB' => 0,
'DisplayOrientation' => ORIENTATION_HORIZONTAL,
'Gradient' => false,
'Surrounding' => 30,
'InnerSurrounding' => 25
);
$myPicture->drawStackedBarChart($settings);
$legendSettings = array(
'Mode' => LEGEND_HORIZONTAL,
'Style' => LEGEND_NOBORDER,
);
$myPicture->drawLegend($widthSize / 2, 15, $legendSettings);
/* Write and save into cache */
$myCache->writeToCache($chartHash, $myPicture);
$imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash;
$myCache->saveFromCache($chartHash, $imgPath);
$imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash;
}
if (!empty($imgPath)) {
$courses_graph[$course_code] = '<img src="' . $imgPath . '">';
}
}
}
}

@ -14,16 +14,16 @@
*/
require_once api_get_path(LIBRARY_PATH).'attendance.lib.php';
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';
require_once api_get_path(LIBRARY_PATH).'pchart/MyHorBar.class.php';
require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/be/gradebookitem.class.php';
require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/be/evaluation.class.php';
require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/be/result.class.php';
require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/be/linkfactory.class.php';
require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/be/category.class.php';
use CpChart\Classes\pData as pData;
use CpChart\Classes\pImage as pImage;
use CpChart\Classes\pCache as pCache;
/**
* This class is used like controller for student graph block plugin,
* the class name must be registered inside path.info file (e.g: controller = "BlockStudentGraph"), so dashboard controller will be instantiate it
@ -139,69 +139,113 @@ class BlockStudentGraph extends Block
if (is_array($usernames) && count($usernames) > 0) {
// Defining data
$data_set = new pData;
$data_set->AddPoint($faults,"Promedio");
$data_set->AddPoint($usernames,"Usuario");
$data_set->AddAllSeries();
$data_set->SetAbsciseLabelSerie("Usuario");
// prepare cache for saving image
$graph_id = $this->user_id.'StudentEvaluationGraph'; // the graph id
$cache = new pCache();
$data = $data_set->GetData(); // return $this->DataDescription
if ($cache->IsInCache($graph_id, $data_set->GetData())) {
//if (0) {
//if we already created the img
$img_file = $cache->GetHash($graph_id, $data_set->GetData()); // image file with hash
} else {
if (count($usernames) < 5) {
$height = 200;
} else {
$height = (count($usernames)*40);
}
// Initialise the graph
$test = new MyHorBar(400,($height+30));
$test->setFontProperties(api_get_path(LIBRARY_PATH).'pchart/fonts/tahoma.ttf', 8);
$test->setGraphArea(100,30,370,$height);
$test->drawFilledRoundedRectangle(7,7,393,$height,5,240,240,240);
$test->drawRoundedRectangle(5,5,395,$height,5,230,230,230);
$test->drawGraphArea(255,255,255,TRUE);
//X axis
$test->setFixedScale(0,100,10);
//var_dump($data_set->GetDataDescription());
$test->drawHorScale($data_set->GetData(),$data_set->GetDataDescription(),SCALE_ADDALL,150,150,150,TRUE,0,0,TRUE);
$test->setColorPalette(0,255,0,0);
$test->drawHorGrid(10,TRUE,230,230,230,50);
// Draw the 0 line
$test->setFontProperties(api_get_path(LIBRARY_PATH).'pchart/fonts/tahoma.ttf', 6);
$test->drawTreshold(0,143,55,72,TRUE,TRUE);
// Draw the bar graph
$test->drawHorBarGraph($data_set->GetData(),$data_set->GetDataDescription(),TRUE,50);
$cache->WriteToCache($graph_id, $data_set->GetData(), $test);
ob_start();
$test->Stroke();
ob_end_clean();
$img_file = $cache->GetHash($graph_id, $data_set->GetData());
}
if (!empty($img_file)) {
$graph = '<img src="'.api_get_path(WEB_ARCHIVE_PATH).$img_file.'">';
}
// Defining data
$dataSet = new pData();
$dataSet->addPoints($faults, 'Serie1');
$dataSet->addPoints($usernames, 'Labels');
$dataSet->setSerieDescription('Series1', get_lang('Average'));
$dataSet->setSerieDescription('Labels', get_lang('User'));
$dataSet->setAbscissa('Labels');
$dataSet->setAbscissaName(get_lang('User'));
$dataSet->setAxisName(0, get_lang('Attendance'));
$palette = array(
'0' => array('R' => 186, 'G' => 206, 'B' => 151, 'Alpha' => 100),
'1' => array('R' => 210, 'G' => 148, 'B' => 147, 'Alpha' => 100),
'2' => array('R' => 148, 'G' => 170, 'B' => 208, 'Alpha' => 100),
'3' => array('R' => 221, 'G' => 133, 'B' => 61, 'Alpha' => 100),
'4' => array('R' => 65, 'G' => 153, 'B' => 176, 'Alpha' => 100),
'5' => array('R' => 114, 'G' => 88, 'B' => 144, 'Alpha' => 100),
'6' => array('R' => 138, 'G' => 166, 'B' => 78, 'Alpha' => 100),
'7' => array('R' => 171, 'G' => 70, 'B' => 67, 'Alpha' => 100),
'8' => array('R' => 69, 'G' => 115, 'B' => 168, 'Alpha' => 100),
);
// Cache definition
$cachePath = api_get_path(SYS_ARCHIVE_PATH);
$myCache = new pCache(array('CacheFolder' => substr($cachePath, 0, strlen($cachePath) - 1)));
$chartHash = $myCache->getHash($dataSet);
if ($myCache->isInCache($chartHash)) {
$imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash;
$myCache->saveFromCache($chartHash, $imgPath);
$imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash;
} else {
$maxCounts = max(count($usernames), count($faults));
if ($maxCounts < 5) {
$heightSize = 200;
} else {
$heightSize = $maxCounts * 40;
}
/* Create the pChart object */
$widthSize = 480;
$angle = 40;
$myPicture = new pImage($widthSize, $heightSize, $dataSet);
/* Turn of Antialiasing */
$myPicture->Antialias = false;
/* Add a border to the picture */
$myPicture->drawRectangle(0, 0, $widthSize - 1, $heightSize - 1, array('R' => 0, 'G' => 0, 'B' => 0));
/* Set the default font */
$myPicture->setFontProperties(
array(
'FontName' => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf',
'FontSize' => 10
)
);
/* Do NOT Write the chart title */
/* Define the chart area */
$myPicture->setGraphArea(80, 40, $widthSize - 20, $heightSize - 40);
/* Draw the scale */
$scaleSettings = array(
'GridR' => 200,
'GridG' => 200,
'GridB' => 200,
'DrawSubTicks' => true,
'CycleBackground' => true,
'Mode' => SCALE_MODE_ADDALL_START0,
'Pos' => SCALE_POS_TOPBOTTOM,
'DrawXLines' => false,
'LabelRotation' => $angle,
);
$myPicture->drawScale($scaleSettings);
/* Turn on shadow computing */
$myPicture->setShadow(true, array('X' => 1, 'Y' => 1, 'R' => 0, 'G' => 0, 'B' => 0, 'Alpha' => 10));
/* Draw the chart */
$myPicture->setShadow(true, array('X' => 1, 'Y' => 1, 'R' => 0, 'G' => 0, 'B' => 0, 'Alpha' => 10));
$settings = array(
'OverrideColors' => $palette,
'Gradient' => false,
'GradientMode' => GRADIENT_SIMPLE,
'DisplayPos' => LABEL_POS_TOP,
'DisplayValues' => true,
'DisplayR' => 0,
'DisplayG' => 0,
'DisplayB' => 0,
'DisplayShadow' => true,
'Surrounding' => 10,
);
$myPicture->drawBarChart($settings);
/* Write and save into cache */
$myCache->writeToCache($chartHash, $myPicture);
$imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash;
$myCache->saveFromCache($chartHash, $imgPath);
$imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash;
}
$graph = '<img src="' . $imgPath . '" >';
} else {
$graph = '<p>'.api_convert_encoding(get_lang('GraphicNotAvailable'),'UTF-8').'</p>';
}
return $graph;
}

@ -12,9 +12,10 @@
require_once api_get_path(LIBRARY_PATH).'usermanager.lib.php';
require_once api_get_path(LIBRARY_PATH).'course.lib.php';
require_once api_get_path(LIBRARY_PATH).'tracking.lib.php';
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';
use CpChart\Classes\pData as pData;
use CpChart\Classes\pImage as pImage;
use CpChart\Classes\pCache as pCache;
/**
* This class is used like controller for teacher graph block plugin,
@ -100,7 +101,7 @@ class BlockTeacherGraph extends Block
$a_last_week = get_last_week();
if (is_array($user_ids) && count($user_ids) > 0) {
$data_set = new pData;
$dataSet = new pData;
foreach ($user_ids as $user_id) {
$teacher_info = api_get_user_info($user_id);
$username = $teacher_info['username'];
@ -115,8 +116,7 @@ class BlockTeacherGraph extends Block
$min = floor(($time_on_platform_by_day - ($hours * 3600)) / 60);
$time_by_days[] = $min;
}
$data_set->AddPoint($time_by_days,$username);
$data_set->AddSerie($username);
$dataSet->addPoints($time_by_days, $username);
}
$last_week = date('Y-m-d',$a_last_week[0]).' '.get_lang('To').' '.date('Y-m-d', $a_last_week[6]);
@ -125,68 +125,77 @@ class BlockTeacherGraph extends Block
$days_on_week[] = date('d/m',$weekday);
}
$data_set->AddPoint($days_on_week,"Days");
$data_set->SetXAxisName($last_week);
$data_set->SetYAxisName(get_lang('Minutes'));
$data_set->SetAbsciseLabelSerie("Days");
$graph_id = $this->user_id.'TeacherConnectionsGraph';
$cache = new pCache();
// the graph id
$data = $data_set->GetData();
if ($cache->IsInCache($graph_id, $data_set->GetData())) {
//if we already created the img
$img_file = $cache->GetHash($graph_id, $data_set->GetData());
} else {
// Initializing the graph
$bg_width = 440;
$bg_height = 350;
$angle = -30;
$test = new pChart($bg_width+10,$bg_height+20);
$test->setFontProperties(api_get_path(LIBRARY_PATH).'pchart/fonts/tahoma.ttf',8);
$test = $test->fixHeightByRotation($data_set->GetData(), $data_set->GetDataDescription(), $angle);
$test->setGraphArea(65,30,$bg_width-70,$bg_height-50);
$test->drawFilledRoundedRectangle(7,7,$bg_width,$bg_height,5,240,240,240);
$test->drawRoundedRectangle(5,5,$bg_width+2,$bg_height+2,5,230,230,230);
$test->drawGraphArea(255,255,255,TRUE);
$test->drawScale(
$data_set->GetData(),
$data_set->GetDataDescription(),
SCALE_NORMAL,
150,
150,
150,
TRUE,
$angle,
2,
TRUE
$dataSet->addPoints($days_on_week, 'Days');
$dataSet->setAbscissaName($last_week);
$dataSet->setAxisName(0, get_lang('Minutes'));
$dataSet->setAbscissa('Days');
$dataSet->loadPalette(api_get_path(SYS_CODE_PATH) . 'palettes/pchart/default.color', true);
// Cache definition
$cachePath = api_get_path(SYS_ARCHIVE_PATH);
$myCache = new pCache(array('CacheFolder' => substr($cachePath, 0, strlen($cachePath) - 1)));
$chartHash = $myCache->getHash($dataSet);
if ($myCache->isInCache($chartHash)) {
$imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash;
$myCache->saveFromCache($chartHash, $imgPath);
$imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash;
} else {
/* Create the pChart object */
$widthSize = 440;
$heightSize = 350;
$angle = 50;
$myPicture = new pImage($widthSize, $heightSize, $dataSet);
/* Turn of Antialiasing */
$myPicture->Antialias = false;
/* Add a border to the picture */
$myPicture->drawRectangle(0, 0, $widthSize - 1, $heightSize - 1, array('R' => 0, 'G' => 0, 'B' => 0));
/* Set the default font */
$myPicture->setFontProperties(array('FontName' => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf', 'FontSize' => 10));
/* Do NOT Write the chart title */
/* Define the chart area */
$myPicture->setGraphArea(40, 40, $widthSize - 20, $heightSize - 80);
/* Draw the scale */
$scaleSettings = array(
'GridR' => 200,
'GridG' => 200,
'GridB' => 200,
'DrawSubTicks' => true,
'CycleBackground' => true,
'Mode' => SCALE_MODE_ADDALL_START0,
'LabelRotation' => $angle,
);
$test->drawGrid(4,TRUE,230,230,230,50);
// Drawing lines
//$test->drawLineGraph($data_set->GetData(),$data_set->GetDataDescription());
$test->drawFilledCubicCurve($data_set->GetData(),$data_set->GetDataDescription(),.1,30);
//$test->drawPlotGraph($data_set->GetData(),$data_set->GetDataDescription(),3,2,255,255,255);
// Drawing Legend
$test->setFontProperties(api_get_path(LIBRARY_PATH).'pchart/fonts/tahoma.ttf',8);
$test->drawLegend($bg_width-80,20,$data_set->GetDataDescription(),204,204,255);
$test->writeValues($data_set->GetData(),$data_set->GetDataDescription(),array("Days"));
$myPicture->drawScale($scaleSettings);
$cache->WriteToCache($graph_id, $data_set->GetData(), $test);
ob_start();
$test->Stroke();
ob_end_clean();
$img_file = $cache->GetHash($graph_id, $data_set->GetData());
/* Turn on shadow computing */
$myPicture->setShadow(true, array('X' => 1, 'Y' => 1, 'R' => 0, 'G' => 0, 'B' => 0, 'Alpha' => 10));
}
if (!empty($img_file)) {
$graph = '<img src="'.api_get_path(WEB_ARCHIVE_PATH).$img_file.'">';
}
/* Draw the chart */
$myPicture->setShadow(true, array('X' => 1, 'Y' => 1, 'R' => 0, 'G' => 0, 'B' => 0, 'Alpha' => 10));
$settings = array(
'DisplayValues' => true,
'DisplayR' => 0,
'DisplayG' => 0,
'DisplayB' => 0,
);
$myPicture->drawFilledSplineChart($settings);
$myPicture->drawLegend(40, 20, array('Mode' => LEGEND_HORIZONTAL));
/* Write and save into cache */
$myCache->writeToCache($chartHash, $myPicture);
$imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash;
$myCache->saveFromCache($chartHash, $imgPath);
$imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash;
}
$graph = '<img src="' . $imgPath . '" >';
} else {
$graph = '<p>'.api_convert_encoding(get_lang('GraphicNotAvailable'),'UTF-8').'</p>';
}

@ -4,4 +4,4 @@
require_once __DIR__ . '/composer' . '/autoload_real.php';
return ComposerAutoloaderInitcd167861425a1cc16be445ac44fb93df::getLoader();
return ComposerAutoloaderInit3808a3514c8326bd28d699bd3a4a493e::getLoader();

@ -52,7 +52,7 @@ return array(
'Attendance' => $baseDir . '/main/inc/lib/attendance.lib.php',
'AttendanceLink' => $baseDir . '/main/gradebook/lib/be/attendancelink.class.php',
'Attribute_Translator' => $baseDir . '/main/inc/lib/phpdocx/pdf/include/attribute_translator.cls.php',
'Auth' => $baseDir . '/main/inc/lib/auth.lib.php',
'Auth' => $baseDir . '/main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/inc/class.auth.php',
'AutoLoader' => $baseDir . '/main/inc/lib/phpdocx/classes/AutoLoader.inc',
'Autoload' => $baseDir . '/main/inc/lib/autoload.class.php',
'AutoloadClassFinder' => $baseDir . '/main/inc/lib/autoload.class.php',
@ -853,16 +853,16 @@ return array(
'ImagickWrapper' => $baseDir . '/main/inc/lib/image.lib.php',
'Import' => $baseDir . '/main/inc/lib/import.lib.php',
'Ims2Question' => $baseDir . '/main/exercice/export/qti2/qti2_classes.php',
'ImsAnswerFillInBlanks' => $baseDir . '/main/exercice/export/qti2/qti2_classes.php',
'ImsAnswerFillInBlanks' => $baseDir . '/main/exercice/export/qti/qti_classes.php',
'ImsAnswerFree' => $baseDir . '/main/exercice/export/qti2/qti2_classes.php',
'ImsAnswerHotspot' => $baseDir . '/main/exercice/export/qti2/qti2_classes.php',
'ImsAnswerMatching' => $baseDir . '/main/exercice/export/qti2/qti2_classes.php',
'ImsAnswerMultipleChoice' => $baseDir . '/main/exercice/export/qti2/qti2_classes.php',
'ImsAnswerMatching' => $baseDir . '/main/exercice/export/qti/qti_classes.php',
'ImsAnswerMultipleChoice' => $baseDir . '/main/exercice/export/qti/qti_classes.php',
'ImsAnswerTrueFalse' => $baseDir . '/main/exercice/export/qti/qti_classes.php',
'ImsAssessmentItem' => $baseDir . '/main/exercice/export/qti2/qti2_export.php',
'ImsItem' => $baseDir . '/main/exercice/export/qti2/qti2_export.php',
'ImsItem' => $baseDir . '/main/exercice/export/qti/qti_export.php',
'ImsQuestion' => $baseDir . '/main/exercice/export/qti/qti_classes.php',
'ImsSection' => $baseDir . '/main/exercice/export/qti2/qti2_export.php',
'ImsSection' => $baseDir . '/main/exercice/export/qti/qti_export.php',
'IndexManager' => $baseDir . '/main/inc/lib/userportal.lib.php',
'IndexableChunk' => $baseDir . '/main/inc/lib/search/IndexableChunk.class.php',
'Inline_Frame_Decorator' => $baseDir . '/main/inc/lib/phpdocx/pdf/include/inline_frame_decorator.cls.php',
@ -873,6 +873,7 @@ return array(
'Javascript' => $baseDir . '/main/inc/lib/javascript.class.php',
'Javascript_Embedder' => $baseDir . '/main/inc/lib/phpdocx/pdf/include/javascript_embedder.cls.php',
'KeyAuth' => $baseDir . '/main/auth/key/key_auth.class.php',
'LMSProvasPlugin' => $baseDir . '/plugin/lmsprovas/lib/lms_provas_plugin.class.php',
'LearnpathLink' => $baseDir . '/main/gradebook/lib/be/learnpathlink.class.php',
'LegalManager' => $baseDir . '/main/inc/lib/legal.lib.php',
'Link' => $baseDir . '/main/inc/lib/link.lib.php',
@ -992,7 +993,6 @@ return array(
'MultipleAnswerCombination' => $baseDir . '/main/exercice/multiple_answer_combination.class.php',
'MultipleAnswerCombinationTrueFalse' => $baseDir . '/main/exercice/multiple_answer_combination_true_false.class.php',
'MultipleAnswerTrueFalse' => $baseDir . '/main/exercice/multiple_answer_true_false.class.php',
'MyHorBar' => $baseDir . '/main/inc/lib/pchart/MyHorBar.class.php',
'MySQLIDatabase' => $baseDir . '/main/inc/lib/database.mysqli.lib.php',
'Nanogong' => $baseDir . '/main/inc/lib/nanogong.lib.php',
'Net_SCP' => $baseDir . '/main/inc/lib/phpseclib/Net/SCP.php',
@ -1057,6 +1057,7 @@ return array(
'Portfolio\\User' => $baseDir . '/main/inc/lib/system/portfolio/user.class.php',
'Positioner' => $baseDir . '/main/inc/lib/phpdocx/pdf/include/positioner.cls.php',
'Promotion' => $baseDir . '/main/inc/lib/promotion.lib.php',
'Prova' => $baseDir . '/plugin/lmsprovas/lib/c_quiz_print.php',
'Question' => $baseDir . '/main/exercice/question.class.php',
'QuickformElement' => $baseDir . '/main/inc/lib/pear/HTML/QuickForm/Renderer/Object.php',
'QuickformFlexyElement' => $baseDir . '/main/inc/lib/pear/HTML/QuickForm/Renderer/ObjectFlexy.php',
@ -1355,9 +1356,6 @@ return array(
'nusoap_wsdlcache' => $baseDir . '/main/inc/lib/nusoap/class.wsdlcache.php',
'nusoap_xmlschema' => $baseDir . '/main/inc/lib/nusoap/class.xmlschema.php',
'nusoapservermime' => $baseDir . '/main/inc/lib/nusoap/nusoapmime.php',
'pCache' => $baseDir . '/main/inc/lib/pchart/pCache.class.php',
'pChart' => $baseDir . '/main/inc/lib/pchart/pChart.class.php',
'pData' => $baseDir . '/main/inc/lib/pchart/pData.class.php',
'pagination' => $baseDir . '/main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/inc/class.pagination.php',
'pdf_context' => $baseDir . '/main/inc/lib/mpdf/mpdfi/pdf_context.php',
'pdf_parser' => $baseDir . '/main/inc/lib/mpdf/mpdfi/pdf_parser.php',

@ -7,4 +7,5 @@ $baseDir = dirname($vendorDir);
return array(
$vendorDir . '/ezyang/htmlpurifier/library/HTMLPurifier.composer.php',
$vendorDir . '/szymach/c-pchart/src/Resources/data/constants.php',
);

@ -9,4 +9,5 @@ return array(
'Sabre\\VObject\\' => array($vendorDir . '/sabre/vobject/lib'),
'Monolog\\' => array($vendorDir . '/monolog/monolog/src/Monolog'),
'Emojione\\' => array($vendorDir . '/emojione/emojione/lib/php/src'),
'CpChart\\' => array($vendorDir . '/szymach/c-pchart/src'),
);

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer
class ComposerAutoloaderInitcd167861425a1cc16be445ac44fb93df
class ComposerAutoloaderInit3808a3514c8326bd28d699bd3a4a493e
{
private static $loader;
@ -19,9 +19,9 @@ class ComposerAutoloaderInitcd167861425a1cc16be445ac44fb93df
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInitcd167861425a1cc16be445ac44fb93df', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInit3808a3514c8326bd28d699bd3a4a493e', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
spl_autoload_unregister(array('ComposerAutoloaderInitcd167861425a1cc16be445ac44fb93df', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInit3808a3514c8326bd28d699bd3a4a493e', 'loadClassLoader'));
$map = require __DIR__ . '/autoload_namespaces.php';
foreach ($map as $namespace => $path) {
@ -42,14 +42,14 @@ class ComposerAutoloaderInitcd167861425a1cc16be445ac44fb93df
$includeFiles = require __DIR__ . '/autoload_files.php';
foreach ($includeFiles as $file) {
composerRequirecd167861425a1cc16be445ac44fb93df($file);
composerRequire3808a3514c8326bd28d699bd3a4a493e($file);
}
return $loader;
}
}
function composerRequirecd167861425a1cc16be445ac44fb93df($file)
function composerRequire3808a3514c8326bd28d699bd3a4a493e($file)
{
require $file;
}

@ -1148,7 +1148,54 @@
"email": "fabien@symfony.com"
}
],
"description": "Symfony Process Component",
"homepage": "http://symfony.com"
"description": "Standards compliant HTML filter written in PHP",
"homepage": "http://htmlpurifier.org/",
"keywords": [
"html"
]
},
{
"name": "szymach/c-pchart",
"version": "1.1.5",
"version_normalized": "1.1.5.0",
"source": {
"type": "git",
"url": "https://github.com/szymach/c-pchart.git",
"reference": "1d54c14f8b7295abc87039ba806fed45d29d67d9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/szymach/c-pchart/zipball/1d54c14f8b7295abc87039ba806fed45d29d67d9",
"reference": "1d54c14f8b7295abc87039ba806fed45d29d67d9",
"shasum": ""
},
"require": {
"ext-gd": "*",
"php": ">=5.3.3"
},
"time": "2015-01-28 19:54:53",
"type": "project",
"installation-source": "dist",
"autoload": {
"psr-4": {
"CpChart\\": "src/"
},
"files": [
"src/Resources/data/constants.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "Port of \"pChart\" library into PHP 5.3.",
"homepage": "https://github.com/szymach/c-pchart",
"keywords": [
"c-pChart",
"charts",
"composer",
"pchart",
"statistics"
]
}
]

@ -0,0 +1,24 @@
# Created by http://www.gitignore.io
### NetBeans ###
nbproject
nbproject/*
nbproject/private/
nbproject/project.properties
nbproject/project.xml
nbproject/private/private.xml
nbproject/private/private.properties
build/
nbbuild/
dist/
nbdist/
nbactions.xml
nb-configuration.xml
### vendor / web ###
vendor/*
web
web/*
### Composer ###
composer.phar

@ -0,0 +1,16 @@
language: php
cache:
directories:
- vendor
php:
- 5.4
before_script:
- composer self-update -n
- composer install -n --prefer-dist -v
after_failure:
- cat app/logs/dev.log
- cat app/logs/test.log

@ -0,0 +1,675 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2014 szymach
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

@ -0,0 +1,121 @@
What is CpChart?
===============
A project bringing Composer support and some basic PHP 5 standards to pChart 2.0 library.
The aim is to allow pChart integration into modern frameworks like Symfony2.
What was done:
- Made a full port of the library's functionality.
- Defined and added namespaces to all classes.
- Replaced all 'exit()' / 'die()' commands with 'throw' statements to allow a degree of error control.
- Reorganized files a bit and refactored code for better readability. Also, basic annotations were added
to functions.
- Added a factory service for loading the classes.
- Moved all constants to a single file 'src/Resources/data/constants.php'. This file is *required*
for the library to function. It is now loaded via Composer.
Installation:
================
[GitHub](https://github.com/szymach/c-pchart)
[Packagist](https://packagist.org/packages/szymach/c-pchart)
For composer installation, add:
>"require": {
> "szymach/c-pchart": "1.*"
> },
to your composer.json file and update your dependencies. After that, all
classes are available under "CpChart\Classes" namespace or "CpChart\Services"
for the factory.
Usage:
==============
The main difference is that you can either load the class via the 'use' statement
or use the provided factory. An example below.
```php
require __DIR__.'/../vendor/autoload.php';
use CpChart\Services\pChartFactory;
try {
// create a factory class - it will load necessary files automatically,
// otherwise you will need to add them on your own
$factory = new pChartFactory();
// create and populate the pData class
$myData = $factory->newData(array(VOID, 3, 4, 3, 5), "Serie1");
// create the image and set the data
$myPicture = $factory->newImage(700, 230, $myData);
$myPicture->setGraphArea(60, 40, 670, 190);
$myPicture->setFontProperties(
array(
"FontName" => "Forgotte.ttf",
"FontSize" => 11
)
);
// creating a pie chart - notice that you specify the type of chart, not class name.
// not all charts need to be created through this method (ex. the bar chart),
// some are created via the pImage class (check the documentation before drawing).
$pieChart = $factory->newChart("pie", $myPicture, $myData);
// do the drawing
$myPicture->drawScale();
$myPicture->drawSplineChart();
$myPicture->Stroke();
} catch (\Exception $ex) {
echo 'There was an error: '.$ex->getMessage();
}
```
Basically, it should work as defined in the pChart 2.0 documentation with added
support for try/catch functionality. The factory class has methods to load all types of
classes present in the pChart library.
IMPORTANT! If you want to use any of the fonts or palletes files, provide only
the name of the actual file, do not add the 'fonts' or 'palettes' folder to the
string given into the function. If you want to load them from a different directory
than the default, you need to add the full path to the file (ex. __DIR__.'/folder/to/my/palletes).
Changelog
=========
1.0 Stable version with basic functionality.
1.1 Added factory service.
1.1.1 Changed chart loading via factory a bit (see class annotations).
1.1.2 Updated service class with Exception handling regarding missing / wrong class name.
1.1.3 The file with classes' constants is now loaded via Composer (thanks to ThaDafinser).
References
==========
[The original pChart website](http://www.pchart.net/)
[Composer](https://getcomposer.org/)
PHP Framework Interoperability Group at GitHub on PHP coding standards:
[PSR-0](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md)
[PSR-1](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-1-basic-coding-standard.md)
[PSR-2](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)
[PSR-4](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-4-autoloader.md)

@ -0,0 +1,17 @@
{
"name": "szymach/c-pchart",
"license": "MIT",
"type": "project",
"description": "Port of \"pChart\" library into PHP 5.3.",
"keywords": ["pchart", "pChart","composer","statistics","charts", "c-pChart", "c-pchart"],
"homepage": "https://github.com/szymach/c-pchart",
"autoload": {
"psr-4": { "CpChart\\": "src/" },
"files": ["src/Resources/data/constants.php"]
},
"require": {
"php": ">=5.3.3",
"ext-gd": "*"
},
"version": "1.1.5"
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save