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

1.9.x
Yannick Warnier 11 years ago
commit d9ea11000c
  1. 43
      main/admin/course_edit.php
  2. 6
      main/calendar/agenda.inc.php
  3. 153
      main/calendar/agenda.lib.php
  4. 25
      main/calendar/agenda_js.php
  5. 29
      main/calendar/agenda_list.php
  6. 8
      main/cron/import_csv.php
  7. 73
      main/css/base.css
  8. 12
      main/exercice/exercice.php
  9. 6
      main/exercice/savescores.php
  10. 23
      main/inc/ajax/agenda.ajax.php
  11. 2
      main/inc/lib/career.lib.php
  12. 63
      main/inc/lib/course.lib.php
  13. 2
      main/inc/lib/database.constants.inc.php
  14. 386
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_delete_file.php
  15. 44
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajaxfilemanager.php
  16. 36
      main/inc/lib/javascript/jquery.lp_minipanel.js
  17. 8
      main/inc/lib/main_api.lib.php
  18. 47
      main/inc/lib/sessionmanager.lib.php
  19. 2
      main/inc/lib/template.lib.php
  20. 2
      main/inc/lib/usermanager.lib.php
  21. 2
      main/inc/local.inc.php
  22. 174
      main/mySpace/course.php
  23. 7
      main/mySpace/myStudents.php
  24. 138
      main/mySpace/student.php
  25. 183
      main/mySpace/teachers.php
  26. 20
      main/newscorm/scorm_api.php
  27. 41
      main/social/myfiles.php
  28. 33
      main/template/default/agenda/event_list.tpl
  29. 7
      main/template/default/agenda/month.tpl
  30. 27
      main/template/default/work/view.tpl
  31. 81
      main/tracking/courseLog.php
  32. 21
      main/work/view.php
  33. 129
      main/work/work.lib.php

@ -23,8 +23,6 @@ $tool_name = get_lang('ModifyCourseInfo');
$interbreadcrumb[] = array ("url" => 'index.php', "name" => get_lang('PlatformAdmin'));
$interbreadcrumb[] = array ("url" => "course_list.php", "name" => get_lang('CourseList'));
/* Libraries */
/* MAIN CODE */
// Get all course categories
$table_user = Database :: get_main_table(TABLE_MAIN_USER);
@ -32,8 +30,8 @@ $table_user = Database :: get_main_table(TABLE_MAIN_USER);
$sql = "SELECT * FROM $course_table WHERE code='".Database::escape_string($course_code)."'";
$result = Database::query($sql);
if (Database::num_rows($result) != 1) {
header('Location: course_list.php');
exit();
header('Location: course_list.php');
exit();
}
$course = Database::fetch_array($result,'ASSOC');
@ -63,14 +61,14 @@ $teachers = array();
$platform_teachers[0] = '-- '.get_lang('NoManager').' --';
while ($obj = Database::fetch_object($res)) {
if (!array_key_exists($obj->user_id,$course_teachers)) {
if (!array_key_exists($obj->user_id, $course_teachers)) {
$teachers[$obj->user_id] = api_get_person_name($obj->firstname, $obj->lastname);
}
if ($course['tutor_name'] == $course_teachers[$obj->user_id]) {
$course['tutor_name'] = $obj->user_id;
}
//We add in the array platform teachers
// We add in the array platform teachers
$platform_teachers[$obj->user_id] = api_get_person_name($obj->firstname, $obj->lastname);
}
@ -78,8 +76,8 @@ while ($obj = Database::fetch_object($res)) {
if (count($course_teachers) == 0) {
$sql='SELECT tutor_name FROM '.$course_table.' WHERE code="'.$course_code.'"';
$res = Database::query($sql);
$tutor_name=Database::result($res,0,0);
$course['tutor_name']=array_search($tutor_name,$platform_teachers);
$tutor_name = Database::result($res, 0, 0);
$course['tutor_name'] = array_search($tutor_name, $platform_teachers);
}
// Build the form
@ -126,17 +124,19 @@ $form->addGroup($group,'group',get_lang('CourseTeachers'),'</td><td width="80" a
'<input class="arrowr" style="width:30px;height:30px;padding-right:12px" type="button" onclick="moveItem(document.getElementById(\'platform_teachers\'), document.getElementById(\'course_teachers\'))" ><br><br>' .
'<input class="arrowl" style="width:30px;height:30px;padding-left:13px" type="button" onclick="moveItem(document.getElementById(\'course_teachers\'), document.getElementById(\'platform_teachers\'))" ></td><td>');
$form->addElement('checkbox', 'add_teachers_to_sessions', null, get_lang('TeachersWillBeAddedAsCoachInAllCourseSessions'));
if (array_key_exists('add_teachers_to_sessions_courses', $course)) {
$form->addElement('checkbox', 'add_teachers_to_sessions_courses', null, get_lang('TeachersWillBeAddedAsCoachInAllCourseSessions'));
}
$categories_select = $form->addElement('select', 'category_code', get_lang('CourseFaculty'), $categories , array('style'=>'width:350px','id'=>'category_code_id', 'class'=>'chzn-select'));
$categories_select->addOption('-', '');
CourseManager::select_and_sort_categories($categories_select);
$form->add_textfield('department_name', get_lang('CourseDepartment'), false,array ('size' => '60'));
$form->add_textfield('department_name', get_lang('CourseDepartment'), false, array('size' => '60'));
$form->applyFilter('department_name','html_filter');
$form->applyFilter('department_name','trim');
$form->add_textfield('department_url', get_lang('CourseDepartmentURL'),false, array ('size' => '60'));
$form->add_textfield('department_url', get_lang('CourseDepartmentURL'), false, array('size' => '60'));
$form->applyFilter('department_url','html_filter');
$form->applyFilter('department_url','trim');
@ -181,12 +181,11 @@ foreach ($list_course_extra_field as $extra_field) {
$form->addElement('style_submit_button', 'button', get_lang('ModifyCourseInfo'),'onclick="valide()"; class="save"');
// Set some default values
//$course['disk_quota'] = round($course['disk_quota']/1024/1024, 1);
$course['disk_quota'] = round(DocumentManager::get_course_quota($course_code) /1024/1024, 1);
$course['title'] = api_html_entity_decode($course['title'], ENT_QUOTES, $charset);
$course['real_code'] = $course['code'];
$course['add_teachers_to_sessions'] = empty($course_teachers) || count($course_teachers) == 1 ? null : '1';
$course['add_teachers_to_sessions_courses'] = isset($course['add_teachers_to_sessions_courses']) ? $course['add_teachers_to_sessions_courses'] : 0;
$form->setDefaults($course);
@ -258,14 +257,21 @@ if ($form->validate()) {
WHERE code='".Database::escape_string($course_code)."'";
Database::query($sql);
//update the extra fields
// update the extra fields
if (count($extras) > 0) {
foreach ($extras as $key => $value) {
CourseManager::update_course_extra_field_value($course_code, $key, $value);
}
}
CourseManager::updateTeachers($course_code, $teachers, $course['add_teachers_to_sessions']);
$addTeacherToSessionCourses = isset($course['add_teachers_to_sessions_courses']) && !empty($course['add_teachers_to_sessions_courses']) ? 1 : 0;
if ($addTeacherToSessionCourses) {
CourseManager::updateTeachers($course_code, $teachers, false, true, false);
} else {
// Normal behaviour
CourseManager::updateTeachers($course_code, $teachers, false, false);
}
$sql = "INSERT IGNORE INTO ".$course_user_table . " SET
course_code = '".Database::escape_string($course_code). "',
@ -278,6 +284,13 @@ if ($form->validate()) {
Database::query($sql);
$course_info = api_get_course_info($course_code);
if (array_key_exists('add_teachers_to_sessions_courses', $course_info)) {
$sql = "UPDATE $course_table SET add_teachers_to_sessions_courses = '$addTeacherToSessionCourses'
WHERE id = ".$course_info['real_id'];
Database::query($sql);
}
$course_id = $course_info['real_id'];
$forum_config_table = Database::get_course_table(TOOL_FORUM_CONFIG_TABLE);

@ -34,7 +34,7 @@ $(function() {
} else {
url = String(window.location)+temp;
window.location.replace(url);
}
}
});
});
</script>';
@ -1033,7 +1033,7 @@ function construct_to_select_form($group_list = null, $user_list = null, $filter
}
$result .= "</optgroup>";
}
// adding the individual users to the select form
if (!empty($user_list)) {
$result .= '<optgroup label="'.get_lang('FilterByUser').'">';
@ -1584,6 +1584,8 @@ function display_courseadmin_links($filter = 0)
$actions = "<a href='agenda_js.php?type=course&".api_get_cidreq()."'>".Display::return_icon('calendar.png', get_lang('Agenda'), '', ICON_SIZE_MEDIUM)."</a>";
}
// $actions .= "<a href='agenda_list.php?type=course&".api_get_cidreq()."'>".Display::return_icon('list.png', get_lang('Agenda'), '', ICON_SIZE_MEDIUM)."</a>";
$actions .= "<a href='agenda.php?".api_get_cidreq()."&amp;sort=asc&amp;toolgroup=".api_get_group_id()."&action=add'>".Display::return_icon('new_event.png', get_lang('AgendaAdd'), '', ICON_SIZE_MEDIUM)."</a>";
$actions .= "<a href='agenda.php?".api_get_cidreq()."&action=importical'>".Display::return_icon('import_calendar.png', get_lang('ICalFileImport'), '', ICON_SIZE_MEDIUM)."</a>";
$actions .= $form;

@ -6,10 +6,10 @@
*/
class Agenda
{
var $events = array();
var $type = 'personal'; // personal, admin or course
public $events = array();
public $type = 'personal'; // personal, admin or course
function __construct()
public function __construct()
{
//Table definitions
$this->tbl_global_agenda = Database::get_main_table(TABLE_MAIN_SYSTEM_CALENDAR);
@ -33,7 +33,10 @@ class Agenda
$this->event_personal_color = 'steel blue'; //steel blue
}
function set_course($course_info)
/**
* @param array $course_info
*/
public function set_course($course_info)
{
$this->course = $course_info;
}
@ -52,7 +55,7 @@ class Agenda
* @param bool add event as a *course* announcement
*
*/
function add_event($start, $end, $all_day, $view, $title, $content, $users_to_send = array(), $add_as_announcement = false)
public function add_event($start, $end, $all_day, $view, $title, $content, $users_to_send = array(), $add_as_announcement = false)
{
$start = api_get_utc_datetime($start);
$end = api_get_utc_datetime($end);
@ -127,10 +130,11 @@ class Agenda
}
/**
* @param agenda_id
* @sent agenda event to
* */
function store_agenda_item_as_announcement($item_id, $sent_to = array())
* @param int $item_id
* @param array $sent_to
* @return int
*/
public function store_agenda_item_as_announcement($item_id, $sent_to = array())
{
$table_agenda = Database::get_course_table(TABLE_AGENDA);
$course_id = api_get_course_int_id();
@ -169,7 +173,7 @@ class Agenda
* @param string event title
* @param string event content
*/
function edit_event($id, $start, $end, $all_day, $view, $title, $content)
public function edit_event($id, $start, $end, $all_day, $view, $title, $content)
{
$start = api_get_utc_datetime($start);
@ -215,7 +219,10 @@ class Agenda
}
}
function delete_event($id)
/**
* @param $id
*/
public function delete_event($id)
{
switch ($this->type) {
case 'personal':
@ -239,17 +246,17 @@ class Agenda
}
/**
*
* Get agenda events
* @param int start tms
* @param int end tms
* @param int course id *integer* not the course code
* @param int user id
*
* @param int $start
* @param int $end
* @param int $course_id
* @param int $group_id
* @param int $user_id
* @param string $format
* @return array|string
*/
function get_events($start, $end, $course_id = null, $group_id = null, $user_id = 0)
public function get_events($start, $end, $course_id = null, $group_id = null, $user_id = 0, $format = 'json')
{
switch ($this->type) {
case 'admin':
$this->get_platform_events($start, $end);
@ -261,13 +268,13 @@ class Agenda
break;
case 'personal':
default:
//Getting personal events
// Getting personal events
$this->get_personal_events($start, $end);
//Getting platform/admin events
// Getting platform/admin events
$this->get_platform_events($start, $end);
//Getting course events
// Getting course events
$my_course_list = array();
if (!api_is_anonymous()) {
@ -301,13 +308,28 @@ class Agenda
}
break;
}
if (!empty($this->events)) {
return json_encode($this->events);
switch ($format) {
case 'json':
return json_encode($this->events);
break;
case 'array':
return $this->events;
break;
}
}
return '';
}
function resize_event($id, $day_delta, $minute_delta)
/**
* @param int $id
* @param int $day_delta
* @param int $minute_delta
* @return int
*/
public function resize_event($id, $day_delta, $minute_delta)
{
// we convert the hour delta into minutes and add the minute delta
$delta = ($day_delta * 60 * 24) + $minute_delta;
@ -319,24 +341,30 @@ class Agenda
case 'personal':
$sql = "UPDATE $this->tbl_personal_agenda SET all_day = 0, enddate = DATE_ADD(enddate, INTERVAL $delta MINUTE)
WHERE id=".intval($id);
$result = Database::query($sql);
Database::query($sql);
break;
case 'course':
$sql = "UPDATE $this->tbl_course_agenda SET all_day = 0, end_date = DATE_ADD(end_date, INTERVAL $delta MINUTE)
WHERE c_id = ".$this->course['real_id']." AND id=".intval($id);
$result = Database::query($sql);
Database::query($sql);
break;
case 'admin':
$sql = "UPDATE $this->tbl_global_agenda SET all_day = 0, end_date = DATE_ADD(end_date, INTERVAL $delta MINUTE)
WHERE id=".intval($id);
$result = Database::query($sql);
Database::query($sql);
break;
}
}
return 1;
}
function move_event($id, $day_delta, $minute_delta)
/**
* @param $id
* @param $day_delta
* @param $minute_delta
* @return int
*/
public function move_event($id, $day_delta, $minute_delta)
{
// we convert the hour delta into minutes and add the minute delta
$delta = ($day_delta * 60 * 24) + $minute_delta;
@ -377,7 +405,7 @@ class Agenda
* @param int event id
* @return array
*/
function get_event($id)
public function get_event($id)
{
// make sure events of the personal agenda can only be seen by the user himself
$id = intval($id);
@ -417,21 +445,19 @@ class Agenda
}
/**
*
* Gets personal events
* @param int start date tms
* @param int end date tms
* @param int $start
* @param int $end
* @return array
*/
function get_personal_events($start, $end)
public function get_personal_events($start, $end)
{
$start = intval($start);
$end = intval($end);
$start = api_get_utc_datetime($start);
$end = api_get_utc_datetime($end);
$start = api_get_utc_datetime(intval($start));
$end = api_get_utc_datetime(intval($end));
$user_id = api_get_user_id();
$sql = "SELECT * FROM ".$this->tbl_personal_agenda."
WHERE date >= '".$start."' AND (enddate <='".$end."' OR enddate IS NULL) AND user = $user_id";
WHERE date >= '".$start."' AND (enddate <='".$end."' OR enddate IS NULL) AND user = $user_id";
$result = Database::query($sql);
$my_events = array();
@ -443,7 +469,6 @@ class Agenda
$event['className'] = 'personal';
$event['borderColor'] = $event['backgroundColor'] = $this->event_personal_color;
$event['editable'] = true;
$event['sent_to'] = get_lang('Me');
$event['type'] = 'personal';
@ -463,8 +488,20 @@ class Agenda
return $my_events;
}
function get_course_events($start, $end, $course_info, $group_id = 0, $session_id = 0, $user_id = 0)
/**
* @param int $start
* @param int $end
* @param $course_info
* @param int $group_id
* @param int $session_id
* @param int $user_id
* @return array
*/
public function get_course_events($start, $end, $course_info, $group_id = 0, $session_id = 0, $user_id = 0)
{
$start = isset($start) && !empty($start) ? api_get_utc_datetime(intval($start)): null;
$end = isset($end) && !empty($end) ? api_get_utc_datetime(intval($end)): null;
$course_id = $course_info['real_id'];
$user_id = intval($user_id);
@ -492,11 +529,11 @@ class Agenda
}
$session_id = intval($session_id);
if (is_array($group_memberships) && count($group_memberships) > 0) {
if (api_is_allowed_to_edit()) {
if (!empty($group_id)){
$where_condition = "( ip.to_group_id IN (0, ".implode(", ", $group_memberships).") ) ";
if (!empty($group_id)) {
$where_condition = "( ip.to_group_id IN (0, ".implode(", ", $group_memberships).") ) ";
} else {
if (!empty($user_id)) {
$where_condition = "( ip.to_user_id = $user_id OR ip.to_group_id IN (0, ".implode(", ", $group_memberships).") ) ";
@ -542,12 +579,15 @@ class Agenda
";
}
if (!empty($start) && !empty($end)) {
$sql .= " AND (start_date >= '".$start."' AND (end_date <= '".$end."' OR end_date IS NULL) )";
}
$result = Database::query($sql);
$events = array();
if (Database::num_rows($result)) {
$events_added = array();
while ($row = Database::fetch_array($result, 'ASSOC')) {
//to gather sent_tos
// to gather sent_tos
$sql = "SELECT to_user_id, to_group_id
FROM ".$tbl_property." ip
WHERE ip.tool = '".TOOL_CALENDAR_EVENT."' AND
@ -566,18 +606,11 @@ class Agenda
}
}
//Only show events from the session
/* if (api_get_course_int_id()) {
if ($row['session_id'] != api_get_session_id()) {
continue;
}
} */
$event = array();
$event['id'] = 'course_'.$row['id'];
//To avoid doubles
// To avoid doubles
if (in_array($row['id'], $events_added)) {
continue;
}
@ -676,7 +709,12 @@ class Agenda
return $this->events;
}
function get_platform_events($start, $end)
/**
* @param int $start tms
* @param int $end tms
* @return array
*/
public function get_platform_events($start, $end)
{
$start = intval($start);
$end = intval($end);
@ -738,7 +776,7 @@ class Agenda
* @author: Patrick Cool <patrick.cool@UGent.be>, Ghent University
* @return html code
*/
static function construct_not_selected_select_form($group_list = null, $user_list = null, $to_already_selected = array())
public static function construct_not_selected_select_form($group_list = null, $user_list = null, $to_already_selected = array())
{
$html = '<select id="users_to_send_id" data-placeholder="'.get_lang('Select').'" name="users_to_send[]" multiple="multiple" style="width:250px" class="chzn-select">';
@ -782,9 +820,8 @@ class Agenda
return $html;
}
static function construct_not_selected_select_form_validator($form, $group_list = null, $user_list = null, $to_already_selected = array())
public static function construct_not_selected_select_form_validator($form, $group_list = null, $user_list = null, $to_already_selected = array())
{
$params = array(
'id' => 'users_to_send_id',
'data-placeholder' => get_lang('Select'),
@ -942,4 +979,4 @@ class Agenda
self::construct_not_selected_select_form_validator($form, $group_list, $user_list, $to_already_selected);
}
}
}

@ -107,12 +107,14 @@ $tpl->assign('month_names', json_encode($months));
$tpl->assign('month_names_short', json_encode($months_short));
$tpl->assign('day_names', json_encode($days));
$tpl->assign('day_names_short', json_encode($day_short));
$tpl->assign('button_text', json_encode(array(
'today' => get_lang('Today'),
'month' => get_lang('Month'),
'week' => get_lang('Week'),
'day' => get_lang('Day')
)));
$tpl->assign('button_text',
json_encode(array(
'today' => get_lang('Today'),
'month' => get_lang('Month'),
'week' => get_lang('Week'),
'day' => get_lang('Day')
))
);
//see http://docs.jquery.com/UI/Datepicker/$.datepicker.formatDate
@ -132,7 +134,10 @@ $tpl->assign('export_ical_confidential_icon', Display::return_icon($export_icon_
$actions = null;
if (api_is_allowed_to_edit(false, true) OR (api_get_course_setting('allow_user_edit_agenda') && !api_is_anonymous()) && api_is_allowed_to_session_edit(false, true) OR $is_group_tutor) {
if (api_is_allowed_to_edit(false, true) OR
(api_get_course_setting('allow_user_edit_agenda') && !api_is_anonymous()) && api_is_allowed_to_session_edit(false, true) OR
$is_group_tutor
) {
if ($type == 'course') {
if (isset($_GET['user_id'])) {
$filter = $_GET['user_id'];
@ -203,10 +208,10 @@ if ((api_is_allowed_to_edit() || $is_group_tutor) && $course_code != '-1' && $ty
$tpl->assign('visible_to', $select);
}
//Loading Agenda template
// Loading Agenda template
$content = $tpl->fetch('default/agenda/month.tpl');
$tpl->assign('content', $content);
//Loading main Chamilo 1 col template
$tpl->display_one_col_template();
// Loading main Chamilo 1 col template
$tpl->display_one_col_template();

@ -0,0 +1,29 @@
<?php
/* For licensing terms, see /license.txt */
/**
* @package chamilo.calendar
*/
/**
* INIT SECTION
*/
// name of the language file that needs to be included
$language_file = array('agenda', 'group', 'announcements');
require_once '../inc/global.inc.php';
require_once 'agenda.lib.php';
require_once 'agenda.inc.php';
$tpl = new Template(get_lang('Agenda'));
$agenda = new Agenda();
$agenda->type = 'course'; //course,admin or personal
$events = $agenda->get_events(null, null, api_get_course_int_id(), api_get_group_id(), null, 'array');
$tpl->assign('agenda_events', $events);
// Loading Agenda template
$content = $tpl->fetch('default/agenda/event_list.tpl');
$tpl->assign('content', $content);
// Loading main Chamilo 1 col template
$tpl->display_one_col_template();

@ -550,9 +550,15 @@ class ImportCsv
$params = array(
'title' => $row['title'],
);
$result = CourseManager::update_attributes($courseInfo['real_id'], $params);
CourseManager::updateTeachers($courseInfo['id'], $row['teachers'], true);
$addTeacherToSession = isset($courseInfo['add_teachers_to_sessions_courses']) && !empty($courseInfo['add_teachers_to_sessions_courses']) ? true : false;
if ($addTeacherToSession) {
CourseManager::updateTeachers($courseInfo['id'], $row['teachers'], false, true, false);
} else {
CourseManager::updateTeachers($courseInfo['id'], $row['teachers'], false, false);
}
if ($result) {
$this->logger->addInfo("Courses - Course updated ".$courseInfo['code']);

@ -27,8 +27,6 @@ legend {
#header_right {
text-align: right;
float: right;
}
#header_right #notifications {
@ -38,7 +36,6 @@ legend {
#header_right #notifications li {
width:60px;
text-align: right;
}
header #logo {
@ -175,7 +172,6 @@ header #logo {
#main .nav .dropdown {
width:150px;
text-align: right;
}
#main .nav .dropdown:nth-child(n) {
@ -904,17 +900,14 @@ a.personal_agenda:hover, a.personal_agenda:hover {
.rounded_div_agenda {
background: none repeat scroll 0 0 #FFFFFF;
-webkit-border-radius: 6px;
-opera-border-radius: 6px;
-moz-border-radius: 6px;
border-radius: 6px;
-webkit-box-shadow: 0 2px 5px #C8C8C8;
-opera-box-shadow: 0 2px 5px #C8C8C8;
-moz-box-shadow: 0 2px 5px #C8C8C8;
box-shadow: 0 2px 5px #C8C8C8;
float: left;
height: auto;
margin: 2px 4px 15px;
@ -950,9 +943,7 @@ a.personal_agenda:hover, a.personal_agenda:hover {
height: 100px;
}
/* -------------- DOCUMENT --------------*/
#document_quota {
margin:15px;
font-weight:bold;
@ -960,8 +951,6 @@ a.personal_agenda:hover, a.personal_agenda:hover {
text-align:center;
}
/* Message and Social */
.online_grid_item {
@ -1054,12 +1043,10 @@ a.personal_agenda:hover, a.personal_agenda:hover {
width:600px;
background-color: #fff;
background-repeat: repeat-x;
margin: 8px;
padding:5px;
}
.group_discussions_replies {
background-color: #E9F4FA;
background-repeat: repeat-x;
@ -1337,8 +1324,6 @@ div.attendance-calendar-add div.row div.formw,div.attendance-calendar-edit div.r
height:66px;
}
/**********************************************
* MESSAGE TOOL *
**********************************************/
@ -2916,13 +2901,7 @@ div.admin_section h4 {
font-size:11px;
}
/* Forms */
/*****************************************************
* FORM STYLES *
*****************************************************/
div.row div.form_header {
white-space: nowrap;
padding: 2px;
@ -2932,16 +2911,6 @@ div.row div.form_header {
font-size:20px;
}
/*
[dir=ltr] div.row div.label, [dir=ltl] div.row div.formw {
float: left;
text-align: right;
}
[dir=rtl] div.row div.label, [dir=rtr] div.row div.formw {
float: right;
text-align: left;
}*/
span.form_required {
color: #f00;
}
@ -2958,10 +2927,8 @@ form .row {
form .formw .freeze {
display: block;
padding-top: 8px;
}
.course_activity_home {
width:100%;
}
@ -3220,12 +3187,10 @@ form .formw .freeze {
position:relative;
}
.done_window {
background-color: #73982C;
}
.first_window {
border: 1px solid red;
cursor:pointer;
@ -3239,7 +3204,6 @@ form .formw .freeze {
.third_window {
border: 1px solid blue;
cursor:pointer;
}
._jsPlumb_endpoint {
@ -3382,9 +3346,6 @@ div#no-data-view div.controls {
padding-top: 1px;
}
/* styles for the star rater */
.star-rating{
list-style:none;
@ -3479,7 +3440,6 @@ a:active{
border: 0px;
}
.offline_user {
display: block;
height: 20px;
@ -3533,7 +3493,6 @@ a:active{
margin-right: 4px;
}
#online_grid_container .thumbnail .caption {
text-align:center;
}
@ -3701,28 +3660,9 @@ a:active{
}
.td_actions {
/*
background:#F9F9F9;
border:1px solid #eee;
margin-bottom: 5px;
padding:2px;
vertical-align:middle;
*/
width: 250px;
}
/*
This is set in the template
.td_actions a {
float:left;
width:100%;
}
*/
/*****************************************************
* THE NEW FORUM *
*****************************************************/
/* **** FORUM CATEGORY **** */
.forum_category {
background-color: #0066CC;
@ -3812,8 +3752,6 @@ a.forum_group_link {
background-color: #F7F7F7;
}
.forum_message_left_2_be_approved {
width: 150px;
vertical-align: top;
@ -4058,8 +3996,6 @@ footer {
background-image: linear-gradient(top, #F5F5F5 0%, #EEEEEE 100%); /* W3C */
}
/* Default LP left column values */
#learning_path_breadcrumb_zone {
@ -4468,7 +4404,6 @@ i.icon-expand{
background-image: url('../img/div_hide.gif');
}
.announcement {
/* background: none repeat scroll 0 0 #F2F2F2;*/
border: 1px solid #D3D3D3;
@ -4707,10 +4642,7 @@ i.size-32.icon-new-note{
position: absolute
}
/*
data table
*/
/* Data table */
.dataTables_wrapper{
clear: both;
@ -4774,7 +4706,6 @@ data table
background-position: right center;
}
#course_category_well {
padding: 9px 0;
}
@ -4895,8 +4826,6 @@ i.size-32.icon-new-work{
width: 220px;
}
.jqgrid_whitespace {
white-space: normal !important;
}

@ -712,7 +712,17 @@ if (!empty($exercise_list)) {
//Quiz not ready due to time limits 700 $attempt_text = get_lang('NotAttempted');
//@todo use the is_visible function
if ($row['start_time'] != '0000-00-00 00:00:00' && $row['end_time'] != '0000-00-00 00:00:00') {
$attempt_text = sprintf(get_lang('ExerciseWillBeActivatedFromXToY'), api_convert_and_format_date($row['start_time']), api_convert_and_format_date($row['end_time']));
$today = time();
$start_time = api_strtotime($row['start_time'], 'UTC');
$end_time = api_strtotime($row['end_time'], 'UTC');
if ($today < $start_time) {
$attempt_text = sprintf(get_lang('ExerciseWillBeActivatedFromXToY'), api_convert_and_format_date($row['start_time']), api_convert_and_format_date($row['end_time']));
} else {
if ($today > $end_time) {
$attempt_text = sprintf(get_lang('ExerciseWasActivatedFromXToY'), api_convert_and_format_date($row['start_time']), api_convert_and_format_date($row['end_time']));
}
}
} else {
//$attempt_text = get_lang('ExamNotAvailableAtThisTime');
if ($row['start_time'] != '0000-00-00 00:00:00') {

@ -40,6 +40,9 @@ $_cid = api_get_course_id();
$test = $_REQUEST['test'];
$score = $_REQUEST['score'];
$origin = $_REQUEST['origin'];
$learnpath_item_id = intval($_REQUEST['learnpath_item_id']);
$course_info = api_get_course_info();
$course_id = $course_info['real_id'];
$jscript2run = '';
/**
@ -102,6 +105,9 @@ if ($origin != 'learnpath') {
} else {
$htmlHeadXtra[] = $jscript2run;
Display::display_reduced_header();
$update_sql = "UPDATE $TABLE_LP_ITEM_VIEW SET status = 'completed'
WHERE c_id = $course_id AND lp_item_id= $learnpath_item_id";
Database::query($update_sql);
Display::display_confirmation_message(get_lang('HotPotatoesFinished'));
Display::display_footer();
}

@ -75,11 +75,14 @@ switch ($action) {
break;
case 'get_events':
$user_id = $_REQUEST['user_id'];
if (substr($user_id,0,1) == 'G') {
if (substr($user_id, 0, 1) == 'G') {
$length = strlen($user_id);
$group_id = substr($user_id,2,$length-1);
$group_id = substr($user_id, 2, $length-1);
}
$events = $agenda->get_events($_REQUEST['start'], $_REQUEST['end'], api_get_course_int_id(), $group_id , $user_id);
$start = isset($_REQUEST['start']) ? $_REQUEST['start'] : null;
$end = isset($_REQUEST['end']) ? $_REQUEST['end'] : null;
$events = $agenda->get_events($start, $end, api_get_course_int_id(), $group_id, $user_id);
echo $events;
break;
case 'get_user_agenda':
@ -98,16 +101,16 @@ switch ($action) {
$my_course_list = array();
}
$today = getdate();
$year = (!empty($_GET['year']) ? (int) $_GET['year'] : NULL);
if ($year == NULL) {
$year = (!empty($_GET['year']) ? (int) $_GET['year'] : null);
if ($year == null) {
$year = $today['year'];
}
$month = (!empty($_GET['month']) ? (int) $_GET['month'] : NULL);
if ($month == NULL) {
$month = (!empty($_GET['month']) ? (int) $_GET['month'] : null);
if ($month == null) {
$month = $today['mon'];
}
$day = (!empty($_GET['day']) ? (int) $_GET['day'] : NULL);
if ($day == NULL) {
$day = (!empty($_GET['day']) ? (int) $_GET['day'] : null);
if ($day == null) {
$day = $today['mday'];
}
$monthName = $MonthsLong[$month - 1];
@ -124,4 +127,4 @@ switch ($action) {
default:
echo '';
}
exit;
exit;

@ -164,7 +164,7 @@ class Career extends Model {
$promo_list = $promotion->get_all_promotions_by_career_id($id);
if (!empty($promo_list)) {
foreach($promo_list as $item) {
$pid = $promotion->copy($item['id'], $cid);
$pid = $promotion->copy($item['id'], $cid, true);
}
}
}

@ -1448,7 +1448,8 @@ class CourseManager {
* @param string $course_code
* @return array with user id
*/
public static function get_teacher_list_from_course_code($course_code) {
public static function get_teacher_list_from_course_code($course_code)
{
$course_code = Database::escape_string($course_code);
$teachers = array();
$sql = "SELECT DISTINCT u.user_id, u.lastname, u.firstname, u.email, u.username, u.status
@ -3999,9 +4000,14 @@ class CourseManager {
* @param bool $editTeacherInSessions
* @return bool
*/
public static function updateTeachers($course_code, $teachers, $editTeacherInSessions = false)
public static function updateTeachers(
$course_code,
$teachers,
$deleteTeachersNotInList = true,
$editTeacherInSessions = false,
$deleteSessionTeacherNotInList = false
)
{
if (empty($teachers)) {
return false;
}
@ -4009,20 +4015,23 @@ class CourseManager {
$teachers = array($teachers);
}
$course_user_table = Database::get_main_table(TABLE_MAIN_COURSE_USER);
$alreadyAddedTeachers = CourseManager::get_teacher_list_from_course_code($course_code);
$course_user_table = Database::get_main_table(TABLE_MAIN_COURSE_USER);
if ($deleteTeachersNotInList) {
// Delete only teacher relations that doesn't match the selected teachers
$cond = null;
if (count($teachers)>0) {
foreach($teachers as $key) {
$cond.= " AND user_id <> '".$key."'";
// Delete only teacher relations that doesn't match the selected teachers
$cond = null;
if (count($teachers)>0) {
foreach($teachers as $key) {
$cond.= " AND user_id <> '".$key."'";
}
}
}
$sql = 'DELETE FROM '.$course_user_table.' WHERE course_code="'.Database::escape_string($course_code).'" AND status="1"'.$cond;
Database::query($sql);
$sql = 'DELETE FROM '.$course_user_table.' WHERE course_code="'.Database::escape_string($course_code).'" AND status="1"'.$cond;
Database::query($sql);
}
if (count($teachers) > 0) {
foreach ($teachers as $key) {
@ -4048,19 +4057,29 @@ class CourseManager {
if ($editTeacherInSessions) {
$sessions = SessionManager::get_session_by_course($course_code);
if (!empty($sessions)) {
foreach ($sessions as $session) {
foreach ($teachers as $userId) {
SessionManager::set_coach_to_course_session($userId, $session['id'], $course_code);
}
$teachersToDelete = array();
if (!empty($alreadyAddedTeachers)) {
$teachersToDelete = array_diff(array_keys($alreadyAddedTeachers), $teachers);
}
// Remove old and add new
if ($deleteSessionTeacherNotInList) {
foreach ($teachers as $userId) {
SessionManager::set_coach_to_course_session($userId, $session['id'], $course_code);
}
if (!empty($teachersToDelete)) {
foreach ($teachersToDelete as $userId) {
SessionManager::set_coach_to_course_session($userId, $session['id'], $course_code, true);
$teachersToDelete = array();
if (!empty($alreadyAddedTeachers)) {
$teachersToDelete = array_diff(array_keys($alreadyAddedTeachers), $teachers);
}
if (!empty($teachersToDelete)) {
foreach ($teachersToDelete as $userId) {
SessionManager::set_coach_to_course_session($userId, $session['id'], $course_code, true);
}
}
} else {
// Add new teachers only
foreach ($teachers as $userId) {
SessionManager::set_coach_to_course_session($userId, $session['id'], $course_code);
}
}
}

@ -168,6 +168,8 @@ define('TABLE_STUDENT_PUBLICATION_ASSIGNMENT', 'student_publication_assignment'
define('TABLE_STUDENT_PUBLICATION_REL_DOCUMENT', 'student_publication_rel_document');
define('TABLE_STUDENT_PUBLICATION_REL_USER', 'student_publication_rel_user');
define('TABLE_STUDENT_PUBLICATION_ASSIGNMENT_COMMENT', 'student_publication_comment');
// Course forum tables
define('TABLE_FORUM_CATEGORY', 'forum_category');
define('TABLE_FORUM', 'forum_forum');

@ -1,208 +1,200 @@
<?php
/**
* delete selected files
* @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
* @link www.phpletter.com
* @since 22/April/2007
*
* Modify for Chamilo
* @author Juan Carlos Ra<EFBFBD>a
* @since 19/March/2009
/**
* delete selected files
* @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
* @link www.phpletter.com
* @since 22/April/2007
*
* Modify for Chamilo
* @author Juan Carlos Ra<EFBFBD>a
* @since 19/March/2009
*/
require_once dirname(__FILE__).DIRECTORY_SEPARATOR."inc".DIRECTORY_SEPARATOR."config.php";
$error = "";
if (CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_DELETE) {
$error = SYS_DISABLED;
} elseif (!empty($_GET['delete'])) { //delete the selected file from context menu
if (!file_exists($_GET['delete'])) {
$error = ERR_FILE_NOT_AVAILABLE;
} elseif (!isUnderRoot($_GET['delete'])) {
$error = ERR_FOLDER_PATH_NOT_ALLOWED;
} else {
include_once CLASS_FILE;
$file = new file();
if (is_dir($_GET['delete'])
&& isValidPattern(CONFIG_SYS_INC_DIR_PATTERN, getBaseName($_GET['delete']))
&& !isInvalidPattern(CONFIG_SYS_EXC_DIR_PATTERN, getBaseName($_GET['delete']))
) {
/////////////bridge to Chamilo by Juan Carlos Ra<EFBFBD>a Trabado
if (!empty($_course['path'])) {
//find path
$mainPath = '../../../../../../../courses/'.$_course['path'].'/document/'; //get Chamilo
$fullPath = $_GET['delete']; //get Ajaxfilemanager
$chamiloPath = substr($fullPath, strlen($mainPath) - strlen($fullPath) - 1, -1);
//find base_work_dir
$course_dir = $_course['path']."/document"; //get Chamilo
$sys_course_path = api_get_path(SYS_COURSE_PATH); //get Chamilo
$base_work_dir = $sys_course_path.$course_dir; // sample c:/xampp/htdocs/chamilo2009beta/courses/JUAN2009/document
//delete directory
*/
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
$error = "";
if(CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_DELETE)
{
$error = SYS_DISABLED;
}
elseif(!empty($_GET['delete']))
{//delete the selected file from context menu
if(!file_exists($_GET['delete']))
{
$error = ERR_FILE_NOT_AVAILABLE;
}
elseif(!isUnderRoot($_GET['delete']))
{
$error = ERR_FOLDER_PATH_NOT_ALLOWED;
}else
{
include_once(CLASS_FILE);
$file = new file();
if(is_dir($_GET['delete'])
&& isValidPattern(CONFIG_SYS_INC_DIR_PATTERN, getBaseName($_GET['delete']))
&& !isInvalidPattern(CONFIG_SYS_EXC_DIR_PATTERN, getBaseName($_GET['delete'])))
{
/////////////bridge to Chamilo by Juan Carlos Ra<EFBFBD>a Trabado
if(!empty($_course['path']))
{
//find path
$mainPath='../../../../../../../courses/'.$_course['path'].'/document/';//get Chamilo
$fullPath = $_GET['delete']; //get Ajaxfilemanager
$chamiloPath = substr($fullPath, strlen($mainPath)-strlen($fullPath)-1,-1);
//find base_work_dir
$course_dir = $_course['path']."/document";//get Chamilo
$sys_course_path = api_get_path(SYS_COURSE_PATH);//get Chamilo
$base_work_dir = $sys_course_path.$course_dir; // sample c:/xampp/htdocs/chamilo2009beta/courses/JUAN2009/document
//delete directory
//check protect directories
if ($chamiloPath != '/audio' && $chamiloPath != '/flash' && $chamiloPath != '/images' && $chamiloPath != '/shared_folder' && $chamiloPath != '/video') {
if (!$is_allowed_to_edit && DocumentManager::check_readonly(
$_course,
api_get_user_id(),
$chamiloPath
)
) {
$error = get_lang('CantDeleteReadonlyFiles'); //From Chamilo to Ajaxfilemanager
} else {
$deleted = DocumentManager::delete_document(
$_course,
$chamiloPath,
$base_work_dir
); //deleted by Chamilo
//$file->delete(addTrailingSlash(backslashToSlash($_GET['delete'])));//deleted by ajaxfilemanager
}
} else {
$error = get_lang('ProtectFolder'); //From Chamilo to Ajaxfilemanager
}
} else {
$file->delete(addTrailingSlash(backslashToSlash($_GET['delete']))); //deleted by ajaxfilemanager
event_system(LOG_USER_PERSONAL_DOC_DELETED, 'document_path', addTrailingSlash(backslashToSlash($_GET['delete'])));
}
//////end bridge to Chamilo
$file->delete(addTrailingSlash(backslashToSlash($_GET['delete'])));
} elseif (is_file($_GET['delete'])
&& isValidPattern(CONFIG_SYS_INC_FILE_PATTERN, getBaseName($_GET['delete']))
&& !isInvalidPattern(CONFIG_SYS_EXC_FILE_PATTERN, getBaseName($_GET['delete']))
) {
/////////////bridge to Chamilo by Juan Carlos Ra<EFBFBD>a Trabado
if (!empty($_course['path'])) {
//find path
$mainPath = '../../../../../../../courses/'.$_course['path'].'/document/'; //get Chamilo
$fullPath = $_GET['delete']; //get Ajaxfilemanager
$chamiloPath = substr($fullPath, strlen($mainPath) - strlen($fullPath) - 1);
//find base_work_dir
$course_dir = $_course['path']."/document"; //get Chamilo
$sys_course_path = api_get_path(SYS_COURSE_PATH); //get Chamilo
$base_work_dir = $sys_course_path.$course_dir; // sample c:/xampp/htdocs/chamilo2009beta/courses/JUAN2009/document
//delete file
//check protect directories
if ($chamiloPath!='/audio' && $chamiloPath!='/flash' && $chamiloPath!='/images' && $chamiloPath!='/shared_folder' && $chamiloPath!='/video')
{
if(! $is_allowed_to_edit && DocumentManager::check_readonly($_course,api_get_user_id(),$chamiloPath))
{
$error=get_lang('CantDeleteReadonlyFiles'); //From Chamilo to Ajaxfilemanager
}
else
{
$deleted= DocumentManager::delete_document($_course,$chamiloPath,$base_work_dir); //deleted by Chamilo
//$file->delete(addTrailingSlash(backslashToSlash($_GET['delete'])));//deleted by ajaxfilemanager
}
}
else
{
$error=get_lang('ProtectFolder'); //From Chamilo to Ajaxfilemanager
}
}
else
{
$file->delete(addTrailingSlash(backslashToSlash($_GET['delete'])));//deleted by ajaxfilemanager
}
//////end bridge to Chamilo
$file->delete(addTrailingSlash(backslashToSlash($_GET['delete'])));
}elseif(is_file($_GET['delete'])
&& isValidPattern(CONFIG_SYS_INC_FILE_PATTERN, getBaseName($_GET['delete']))
&& !isInvalidPattern(CONFIG_SYS_EXC_FILE_PATTERN, getBaseName($_GET['delete']))
)
{
/////////////bridge to Chamilo by Juan Carlos Ra<EFBFBD>a Trabado
if(!empty($_course['path']))
{
//find path
$mainPath='../../../../../../../courses/'.$_course['path'].'/document/';//get Chamilo
$fullPath = $_GET['delete']; //get Ajaxfilemanager
$chamiloPath = substr($fullPath, strlen($mainPath)-strlen($fullPath)-1);
//find base_work_dir
$course_dir = $_course['path']."/document";//get Chamilo
$sys_course_path = api_get_path(SYS_COURSE_PATH);//get Chamilo
$base_work_dir = $sys_course_path.$course_dir; // sample c:/xampp/htdocs/chamilo2009beta/courses/JUAN2009/document
//delete file
if (!$is_allowed_to_edit && DocumentManager::check_readonly(
$_course,
api_get_user_id(),
$chamiloPath
)
) {
$error = get_lang('CantDeleteReadonlyFiles'); //From Chamilo to Ajaxfilemanager
} else {
if(! $is_allowed_to_edit && DocumentManager::check_readonly($_course,api_get_user_id(),$chamiloPath))
{
$error=get_lang('CantDeleteReadonlyFiles'); //From Chamilo to Ajaxfilemanager
}
else
{
$deleted = DocumentManager::delete_document(
$_course,
$chamiloPath,
$base_work_dir
); //deleted by Chamilo
//$file->delete(($_GET['delete'])); // disabled deleted by ajaxfilemanager
}
} else {
$file->delete($_GET['delete']); //deleted by ajaxfilemanager
event_system(LOG_USER_PERSONAL_DOC_DELETED, 'document_path', $_GET['delete']);
}
//////end bridge to Chamilo
}
}
} else {
if (!isset($_POST['selectedDoc']) || !is_array($_POST['selectedDoc']) || sizeof($_POST['selectedDoc']) < 1) {
$error = ERR_NOT_FILE_SELECTED;
} else {
$deleted= DocumentManager::delete_document($_course,$chamiloPath,$base_work_dir); //deleted by Chamilo
//$file->delete(($_GET['delete'])); // disabled deleted by ajaxfilemanager
include_once CLASS_FILE;
$file = new file();
}
}
else
{
$file->delete(($_GET['delete']));//deleted by ajaxfilemanager
}
//////end bridge to Chamilo
}
}
}else
{
if(!isset($_POST['selectedDoc']) || !is_array($_POST['selectedDoc']) || sizeof($_POST['selectedDoc']) < 1)
{
$error = ERR_NOT_FILE_SELECTED;
}
else
{
foreach ($_POST['selectedDoc'] as $doc) {
if (file_exists($doc) && isUnderRoot($doc)) {
if (is_dir($doc)
&& isValidPattern(CONFIG_SYS_INC_DIR_PATTERN, $doc)
&& !isInvalidPattern(CONFIG_SYS_EXC_DIR_PATTERN, $doc)
) {
/////////////bridge to Chamilo by Juan Carlos Ra<EFBFBD>a Trabado
if (!empty($_course['path'])) {
//find path
$mainPath = '../../../../../../../courses/'.$_course['path'].'/document/'; //get Chamilo
$fullPath = $doc; //get Ajaxfilemanager
$chamiloPath = substr($fullPath, strlen($mainPath) - strlen($fullPath) - 1, -1);
//find base_work_dir
$course_dir = $_course['path']."/document"; //get Chamilo
$sys_course_path = api_get_path(SYS_COURSE_PATH); //get Chamilo
$base_work_dir = $sys_course_path.$course_dir; // sample c:/xampp/htdocs/chamilo2009beta/courses/JUAN2009/document
//delete directory
include_once(CLASS_FILE);
$file = new file();
foreach($_POST['selectedDoc'] as $doc)
{
if(file_exists($doc) && isUnderRoot($doc))
{
if(is_dir($doc)
&& isValidPattern(CONFIG_SYS_INC_DIR_PATTERN, $doc)
&& !isInvalidPattern(CONFIG_SYS_EXC_DIR_PATTERN, $doc))
{
/////////////bridge to Chamilo by Juan Carlos Ra<EFBFBD>a Trabado
if(!empty($_course['path']))
{
//find path
$mainPath='../../../../../../../courses/'.$_course['path'].'/document/';//get Chamilo
$fullPath = $doc; //get Ajaxfilemanager
$chamiloPath = substr($fullPath, strlen($mainPath)-strlen($fullPath)-1,-1);
//find base_work_dir
$course_dir = $_course['path']."/document";//get Chamilo
$sys_course_path = api_get_path(SYS_COURSE_PATH);//get Chamilo
$base_work_dir = $sys_course_path.$course_dir; // sample c:/xampp/htdocs/chamilo2009beta/courses/JUAN2009/document
//delete directory
//check protect directories
if ($chamiloPath != '/audio' && $chamiloPath != '/flash' && $chamiloPath != '/images' && $chamiloPath != '/shared_folder' && $chamiloPath != '/video') {
if (!$is_allowed_to_edit && DocumentManager::check_readonly(
$_course,
api_get_user_id(),
$chamiloPath
)
) {
$error = get_lang('CantDeleteReadonlyFiles'); //From Chamilo to Ajaxfilemanager
} else {
$deleted = DocumentManager::delete_document(
$_course,
$chamiloPath,
$base_work_dir
); //deleted by Chamilo
//$file->delete(addTrailingSlash(backslashToSlash($doc))); // disabled deleted by ajaxfilemanager
}
} else {
$error = get_lang('ProtectFolder'); //From Chamilo to Ajaxfilemanager
}
} else {
$file->delete(addTrailingSlash(backslashToSlash($doc))); //deleted by ajaxfilemanager
event_system(LOG_USER_PERSONAL_DOC_DELETED, 'document_path', addTrailingSlash(backslashToSlash($doc)));
}
//////end bridge to Chamilo
} elseif (is_file($doc)
&& isValidPattern(CONFIG_SYS_INC_FILE_PATTERN, $doc)
&& !isInvalidPattern(CONFIG_SYS_EXC_FILE_PATTERN, $doc)
) {
/////////////bridge to Chamilo by Juan Carlos Ra<EFBFBD>a Trabado
if (!empty($_course['path'])) {
//find path
$mainPath = '../../../../../../../courses/'.$_course['path'].'/document/'; //get Chamilo
$fullPath = $doc; //get Ajaxfilemanager
$chamiloPath = substr($fullPath, strlen($mainPath) - strlen($fullPath) - 1);
//find base_work_dir
$course_dir = $_course['path']."/document"; //get Chamilo
$sys_course_path = api_get_path(SYS_COURSE_PATH); //get Chamilo
$base_work_dir = $sys_course_path.$course_dir; // sample c:/xampp/htdocs/chamilo2009beta/courses/JUAN2009/document
//delete file
//check protect directories
if ($chamiloPath!='/audio' && $chamiloPath!='/flash' && $chamiloPath!='/images' && $chamiloPath!='/shared_folder' && $chamiloPath!='/video')
{
if(! $is_allowed_to_edit && DocumentManager::check_readonly($_course,api_get_user_id(),$chamiloPath))
{
$error=get_lang('CantDeleteReadonlyFiles'); //From Chamilo to Ajaxfilemanager
}
else
{
$deleted= DocumentManager::delete_document($_course,$chamiloPath,$base_work_dir); //deleted by Chamilo
//$file->delete(addTrailingSlash(backslashToSlash($doc))); // disabled deleted by ajaxfilemanager
}
}
else
{
$error=get_lang('ProtectFolder'); //From Chamilo to Ajaxfilemanager
}
}
else
{
$file->delete(addTrailingSlash(backslashToSlash($doc)));//deleted by ajaxfilemanager
}
//////end bridge to Chamilo
}elseif(is_file($doc)
&& isValidPattern(CONFIG_SYS_INC_FILE_PATTERN, $doc)
&& !isInvalidPattern(CONFIG_SYS_EXC_FILE_PATTERN, $doc)
)
{
/////////////bridge to Chamilo by Juan Carlos Ra<EFBFBD>a Trabado
if(!empty($_course['path']))
{
//find path
$mainPath='../../../../../../../courses/'.$_course['path'].'/document/';//get Chamilo
$fullPath = $doc; //get Ajaxfilemanager
$chamiloPath = substr($fullPath, strlen($mainPath)-strlen($fullPath)-1);
//find base_work_dir
$course_dir = $_course['path']."/document";//get Chamilo
$sys_course_path = api_get_path(SYS_COURSE_PATH);//get Chamilo
$base_work_dir = $sys_course_path.$course_dir; // sample c:/xampp/htdocs/chamilo2009beta/courses/JUAN2009/document
//delete file
if (!$is_allowed_to_edit && DocumentManager::check_readonly(
$_course,
api_get_user_id(),
$chamiloPath
)
) {
$error = get_lang('CantDeleteReadonlyFiles'); //From Chamilo to Ajaxfilemanager
} else {
if(! $is_allowed_to_edit && DocumentManager::check_readonly($_course,api_get_user_id(),$chamiloPath))
{
$error=get_lang('CantDeleteReadonlyFiles'); //From Chamilo to Ajaxfilemanager
}
else
{
$deleted = DocumentManager::delete_document(
$_course,
$chamiloPath,
$base_work_dir
); //deleted by Chamilo
//$file->delete($doc); // disabled deleted by ajaxfilemanager
$deleted= DocumentManager::delete_document($_course,$chamiloPath,$base_work_dir); //deleted by Chamilo
//$file->delete($doc); // disabled deleted by ajaxfilemanager
}
} else {
$file->delete($doc); //deleted by ajaxfilemanager
event_system(LOG_USER_PERSONAL_DOC_DELETED, 'document_path', $doc);
}
//////end bridge to Chamilo
}
}
}
}
}
}
}
else
{
$file->delete($doc); //deleted by ajaxfilemanager
}
//////end bridge to Chamilo
}
}
}
}
}
echo "{error:'" . $error . "'}";
?>
echo "{error:'".$error."'}";

@ -109,22 +109,22 @@ if(!empty($_GET['view'])) {
var parentFolder = {};
var urls = {
'upload':'<?php echo CONFIG_URL_UPLOAD; ?>',
'preview':'<?php echo CONFIG_URL_PREVIEW; ?>',
'cut':'<?php echo CONFIG_URL_CUT; ?>',
'copy':'<?php echo CONFIG_URL_COPY; ?>',
'paste':'<?php echo CONFIG_URL_FILE_PASTE; ?>',
'delete':'<?php echo CONFIG_URL_DELETE; ?>',
'rename':'<?php echo CONFIG_URL_SAVE_NAME; ?>',
'thumbnail':'<?php echo CONFIG_URL_IMG_THUMBNAIL; ?>',
'create_folder':'<?php echo CONFIG_URL_CREATE_FOLDER; ?>',
'text_editor':'<?php echo CONFIG_URL_TEXT_EDITOR; ?>',
'image_editor':'<?php echo CONFIG_URL_IMAGE_EDITOR; ?>',
'download':'<?php echo CONFIG_URL_DOWNLOAD; ?>',
'present':'<?php echo getCurrentUrl(); ?>',
'home':'<?php echo CONFIG_URL_HOME; ?>',
'view':'<?php echo CONFIG_URL_LIST_LISTING; ?>'
};
'upload':'<?php echo CONFIG_URL_UPLOAD; ?>',
'preview':'<?php echo CONFIG_URL_PREVIEW; ?>',
'cut':'<?php echo CONFIG_URL_CUT; ?>',
'copy':'<?php echo CONFIG_URL_COPY; ?>',
'paste':'<?php echo CONFIG_URL_FILE_PASTE; ?>',
'delete':'<?php echo CONFIG_URL_DELETE; ?>',
'rename':'<?php echo CONFIG_URL_SAVE_NAME; ?>',
'thumbnail':'<?php echo CONFIG_URL_IMG_THUMBNAIL; ?>',
'create_folder':'<?php echo CONFIG_URL_CREATE_FOLDER; ?>',
'text_editor':'<?php echo CONFIG_URL_TEXT_EDITOR; ?>',
'image_editor':'<?php echo CONFIG_URL_IMAGE_EDITOR; ?>',
'download':'<?php echo CONFIG_URL_DOWNLOAD; ?>',
'present':'<?php echo getCurrentUrl(); ?>',
'home':'<?php echo CONFIG_URL_HOME; ?>',
'view':'<?php echo CONFIG_URL_LIST_LISTING; ?>'
};
var permits = { 'del':<?php echo (CONFIG_OPTIONS_DELETE?1:0); ?>,
'cut':<?php echo (CONFIG_OPTIONS_CUT?'1':'0'); ?>,
'copy':<?php echo (CONFIG_OPTIONS_COPY?1:0); ?>,
@ -137,12 +137,12 @@ if(!empty($_GET['view'])) {
var warningDelete = '<?php echo WARNING_DELETE; ?>';
var newFile = {'num':1, 'label':'<?php echo FILE_LABEL_SELECT; ?>', 'upload':'<?php echo FILE_LBL_UPLOAD; ?>'};
var counts = {'new_file':1};
var thickbox = {'width':'<?php echo CONFIG_THICKBOX_MAX_WIDTH; ?>',
'height':'<?php echo CONFIG_THICKBOX_MAX_HEIGHT; ?>',
'next':'<img src="theme/default/images/next.png" title="<?php echo THICKBOX_NEXT; ?>" style="float:right;">',
'previous':'<img src="theme/default/images/prev.png" title="<?php echo THICKBOX_PREVIOUS; ?>" style="float:left">',
'close':'<img src="theme/default/images/flagno.png"title="<?php echo THICKBOX_CLOSE; ?>"><?php echo THICKBOX_CLOSE; ?>'
var thickbox = {
'width':'<?php echo CONFIG_THICKBOX_MAX_WIDTH; ?>',
'height':'<?php echo CONFIG_THICKBOX_MAX_HEIGHT; ?>',
'next':'<img src="theme/default/images/next.png" title="<?php echo THICKBOX_NEXT; ?>" style="float:right;">',
'previous':'<img src="theme/default/images/prev.png" title="<?php echo THICKBOX_PREVIOUS; ?>" style="float:left">',
'close':'<img src="theme/default/images/flagno.png"title="<?php echo THICKBOX_CLOSE; ?>"><?php echo THICKBOX_CLOSE; ?>'
};
var tb_pathToImage = "theme/<?php echo CONFIG_THEME_NAME; ?>/images/loadingAnimation.gif";

@ -37,14 +37,14 @@ function toogle_minipanel() {
$('#learning_path_left_zone').hide(50);
$('#learning_path_right_zone').css('margin-left','10px');
$('#hide_bar table').css('backgroundImage','url(../img/hide2.png)').css('backgroundColor','#EEEEEE');
}
var left_width = 292; // (relative) hide_bar position
var left_width_mini = 20; // (relative) hide_bar position
$(document).ready(function() {
var left_width = $('learning_path_left_zone').width();
//Adding div to hide panel
$('#learning_path_right_zone').before('<div id="hide_bar" style="float: left; width: 10px; height: 1000px;">' +
'<table style="border: 0 none; width: 100%; height: 100%; cursor: pointer; background-color: #EEEEEE">' +
@ -67,23 +67,21 @@ $(document).ready(function() {
var original = $('#content_id').height();
// Adding funcionality
$('#hide_bar table').toggle(function(){
if ($('#hide_bar').position().left >= left_width) {
toogle_minipanel();
}
},
function(){
// Show navigation left zone
$('#learning_path_left_zone').show(50);
$('#learning_path_right_zone').css('marginLeft', left_width + 10 + 'px');
$('#hide_bar table').css('backgroundImage','url(../img/hide0.png)').css('backgroundColor','#EEEEEE');
$('#learning_path_main #control').remove();
$('#content_id').css({ height: original});
}
);
// Adding functionality
$('#hide_bar table').toggle(function(){
if ($('#hide_bar').position().left >= left_width) {
toogle_minipanel();
}
},
function() {
// Show navigation left zone
$('#learning_path_left_zone').show(50);
$('#learning_path_right_zone').css('marginLeft', left_width + 10 + 'px');
$('#hide_bar table').css('backgroundImage','url(../img/hide0.png)').css('backgroundColor','#EEEEEE');
$('#learning_path_main #control').remove();
$('#content_id').css({ height: original});
});
});

@ -175,6 +175,8 @@ define('LOG_PROMOTION_DELETE', 'promotion_deleted');
define('LOG_CAREER_CREATE', 'career_created');
define('LOG_CAREER_DELETE', 'career_deleted');
define('LOG_USER_PERSONAL_DOC_DELETED', 'user_doc_deleted');
// event logs data types
define('LOG_COURSE_CODE', 'course_code');
define('LOG_USER_ID', 'user_id');
@ -1424,11 +1426,13 @@ function api_format_course_array($course_data) {
//Course password
$_course['registration_code'] = !empty($course_data['registration_code']) ? sha1($course_data['registration_code']) : null;
$_course['disk_quota'] = $course_data['disk_quota'];
$_course['course_public_url'] = api_get_path(WEB_COURSE_PATH).$course_data['directory'].'/index.php';
if (array_key_exists('add_teachers_to_sessions_courses', $course_data)) {
$_course['add_teachers_to_sessions_courses'] = $course_data['add_teachers_to_sessions_courses'];
}
if (file_exists(api_get_path(SYS_COURSE_PATH).$course_data['directory'].'/course-pic85x85.png')) {
$url_image = api_get_path(WEB_COURSE_PATH).$course_data['directory'].'/course-pic85x85.png';
} else {

@ -1784,7 +1784,7 @@ class SessionManager
$consider_end = false;
}
$sid = self::create_session($s['name'].' '.get_lang('Copy'),
$sid = self::create_session($s['name'].' '.get_lang('CopyLabelSuffix'),
$s['year_start'], $s['month_start'], $s['day_start'],
$s['year_end'],$s['month_end'],$s['day_end'],
$s['nb_days_acess_before_beginning'],$s['nb_days_acess_after_end'],
@ -1820,7 +1820,7 @@ class SessionManager
$params['skip_lp_dates'] = true;
foreach ($short_courses as $course_data) {
$course_info = CourseManager::copy_course_simple($course_data['title'].' '.get_lang('Copy'), $course_data['course_code'], $id, $sid, $params);
$course_info = CourseManager::copy_course_simple($course_data['title'].' '.get_lang('CopyLabelSuffix'), $course_data['course_code'], $id, $sid, $params);
if ($course_info) {
//By default new elements are invisible
if ($set_exercises_lp_invisible) {
@ -2345,11 +2345,52 @@ class SessionManager
$result = Database::query($sql);
$coaches = array();
if (Database::num_rows($result) > 0){
if (Database::num_rows($result) > 0) {
while ($row = Database::fetch_row($result)) {
$coaches[] = $row[0];
}
}
return $coaches;
}
/**
* @param int $userId
* @return array
*/
public static function getAllCoursesFromAllSessionFromDrh($userId)
{
$sessions = SessionManager::get_sessions_followed_by_drh($userId);
$coursesFromSession = array();
if (!empty($sessions)) {
foreach ($sessions as $session) {
$courseList = SessionManager::get_course_list_by_session_id($session['id']);
foreach ($courseList as $course) {
$coursesFromSession[] = $course['code'];
}
}
}
return $coursesFromSession;
}
/**
* @param int $userId
* @return array
*/
public static function getAllUsersFromCoursesFromAllSessionFromDrh($userId)
{
$sessions = SessionManager::get_sessions_followed_by_drh($userId);
$userList = array();
if (!empty($sessions)) {
foreach ($sessions as $session) {
$courseList = SessionManager::get_course_list_by_session_id($session['id']);
foreach ($courseList as $course) {
$users = CourseManager::get_user_list_from_course_code($course['code'], $session['id']);
foreach ($users as $user) {
$userList[] = $user['user_id'];
}
}
}
}
return $userList;
}
}

@ -98,7 +98,7 @@ class Template
);
$this->twig->addFilter('icon', new Twig_Filter_Function('Template::get_icon_path'));
$this->twig->addFilter('format_date', new Twig_Filter_Function('Template::format_date'));
$this->twig->addFilter('api_get_local_time', new Twig_Filter_Function('api_get_local_time'));
/*
$lexer = new Twig_Lexer($this->twig, array(

@ -3364,6 +3364,7 @@ class UserManager
if (!empty($user_status)) {
$condition_status = ' AND u.status = '.$user_status;
}
if (api_get_multiple_access_url()) {
$sql = "SELECT u.user_id, u.username, u.lastname, u.firstname, u.email FROM $tbl_user u
INNER JOIN $tbl_user_rel_user uru ON (uru.user_id = u.user_id) LEFT JOIN $tbl_user_rel_access_url a
@ -3944,4 +3945,5 @@ EOF;
}
}
}

@ -933,7 +933,7 @@ if ((isset($uidReset) && $uidReset) || (isset($cidReset) && $cidReset))
}
//Checking if the user filled the course legal agreement
if ($_course['activate_legal'] == 1 && !api_is_platform_admin()) {
if ($_course['activate_legal'] == 1 && !api_is_platform_admin() && !api_is_anonymous()) {
$user_is_subscribed = CourseManager::is_user_accepted_legal($user_id, $_course['id'], $session_id) || $user_pass_open_course;
if (!$user_is_subscribed) {
$url = api_get_path(WEB_CODE_PATH).'course_info/legal.php?course_code='.$_course['code'].'&session_id='.$session_id;

@ -24,19 +24,19 @@ api_block_anonymous_users();
$interbreadcrumb[] = array ("url" => "index.php", "name" => get_lang('MySpace'));
if (isset($_GET["id_session"]) && $_GET["id_session"] != "") {
$interbreadcrumb[] = array ("url" => "session.php", "name" => get_lang('Sessions'));
$interbreadcrumb[] = array("url" => "session.php", "name" => get_lang('Sessions'));
}
if (isset($_GET["user_id"]) && $_GET["user_id"] != "" && isset($_GET["type"]) && $_GET["type"] == "coach") {
$interbreadcrumb[] = array ("url" => "coaches.php", "name" => get_lang('Tutors'));
$interbreadcrumb[] = array("url" => "coaches.php", "name" => get_lang('Tutors'));
}
if (isset($_GET["user_id"]) && $_GET["user_id"] != "" && isset($_GET["type"]) && $_GET["type"] == "student") {
$interbreadcrumb[] = array ("url" => "student.php", "name" => get_lang('Students'));
$interbreadcrumb[] = array("url" => "student.php", "name" => get_lang('Students'));
}
if (isset($_GET["user_id"]) && $_GET["user_id"] != "" && !isset($_GET["type"])) {
$interbreadcrumb[] = array ("url" => "teachers.php", "name" => get_lang('Teachers'));
$interbreadcrumb[] = array("url" => "teachers.php", "name" => get_lang('Teachers'));
}
function count_courses() {
@ -48,54 +48,60 @@ function count_courses() {
$show_import_icon = false;
if (api_get_setting('add_users_by_coach') == 'true') {
if (!api_is_platform_admin()) {
$sql = 'SELECT id_coach FROM '.Database :: get_main_table(TABLE_MAIN_SESSION).' WHERE id='.$id_session;
$rs = Database::query($sql);
if (Database::result($rs, 0, 0) != $_user['user_id']) {
api_not_allowed(true);
} else {
$show_import_icon=true;
}
}
if (!api_is_platform_admin()) {
$sql = 'SELECT id_coach FROM '.Database :: get_main_table(TABLE_MAIN_SESSION).' WHERE id='.$id_session;
$rs = Database::query($sql);
if (Database::result($rs, 0, 0) != $_user['user_id']) {
api_not_allowed(true);
} else {
$show_import_icon=true;
}
}
}
Display :: display_header($nameTools);
$a_courses = array();
if (api_is_drh() || api_is_session_admin() || api_is_platform_admin()) {
$title = '';
if (empty($id_session)) {
if (isset($_GET['user_id'])) {
$user_id = intval($_GET['user_id']);
$user_info = api_get_user_info($user_id);
$title = get_lang('AssignedCoursesTo').' '.api_get_person_name($user_info['firstname'], $user_info['lastname']);
$courses = CourseManager::get_course_list_of_user_as_course_admin($user_id);
} else {
$title = get_lang('YourCourseList');
$courses = CourseManager::get_courses_followed_by_drh($_user['user_id']);
}
} else {
$session_name = api_get_session_name($id_session);
$title = api_htmlentities($session_name,ENT_QUOTES,$charset).' : '.get_lang('CourseListInSession');
$courses = Tracking::get_courses_list_from_session($id_session);
}
$coursesFromSession = array();
if (api_is_drh()) {
if (api_drh_can_access_all_session_content()) {
$coursesFromSession = SessionManager::getAllCoursesFromAllSessionFromDrh(api_get_user_id());
}
}
$title = '';
if (empty($id_session)) {
if (isset($_GET['user_id'])) {
$user_id = intval($_GET['user_id']);
$user_info = api_get_user_info($user_id);
$title = get_lang('AssignedCoursesTo').' '.api_get_person_name($user_info['firstname'], $user_info['lastname']);
$courses = CourseManager::get_course_list_of_user_as_course_admin($user_id);
} else {
$title = get_lang('YourCourseList');
$courses = CourseManager::get_courses_followed_by_drh($_user['user_id']);
}
} else {
$session_name = api_get_session_name($id_session);
$title = api_htmlentities($session_name, ENT_QUOTES, $charset).' : '.get_lang('CourseListInSession');
$courses = Tracking::get_courses_list_from_session($id_session);
}
$a_courses = array_keys($courses);
if (!api_is_session_admin()) {
$menu_items[] = Display::url(Display::return_icon('stats.png', get_lang('MyStats'),'',ICON_SIZE_MEDIUM),api_get_path(WEB_CODE_PATH)."auth/my_progress.php" );
$menu_items[] = Display::url(Display::return_icon('user.png', get_lang('Students'), array(), 32), "index.php?view=drh_students&amp;display=yourstudents");
$menu_items[] = Display::url(Display::return_icon('teacher.png', get_lang('Trainers'), array(), 32), 'teachers.php');
$menu_items[] = Display::return_icon('course_na.png', get_lang('Courses'), array(), 32);
$menu_items[] = Display::url(Display::return_icon('session.png', get_lang('Sessions'), array(), 32), 'session.php');
}
if (!api_is_session_admin()) {
$menu_items[] = Display::url(Display::return_icon('stats.png', get_lang('MyStats'),'',ICON_SIZE_MEDIUM),api_get_path(WEB_CODE_PATH)."auth/my_progress.php" );
$menu_items[] = Display::url(Display::return_icon('user.png', get_lang('Students'), array(), 32), "index.php?view=drh_students&amp;display=yourstudents");
$menu_items[] = Display::url(Display::return_icon('teacher.png', get_lang('Trainers'), array(), 32), 'teachers.php');
$menu_items[] = Display::return_icon('course_na.png', get_lang('Courses'), array(), 32);
$menu_items[] = Display::url(Display::return_icon('session.png', get_lang('Sessions'), array(), 32), 'session.php');
}
echo '<div class="actions">';
$nb_menu_items = count($menu_items);
if ($nb_menu_items > 1) {
foreach ($menu_items as $key => $item) {
echo $item;
echo $item;
}
}
if (count($a_courses) > 0) {
@ -112,39 +118,46 @@ $tbl_session_course_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_U
$tbl_user_course = Database::get_main_table(TABLE_MAIN_COURSE_USER);
if (isset($_GET['action'])) {
if ($_GET['action'] == 'show_message') {
Display :: display_normal_message(stripslashes($_GET['message']), false);
}
if ($_GET['action'] == 'show_message') {
Display :: display_normal_message(stripslashes($_GET['message']), false);
}
if ($_GET['action'] == 'error_message') {
if ($_GET['action'] == 'error_message') {
Display :: display_error_message(stripslashes($_GET['message']), false);
}
}
if ($show_import_icon) {
echo "<div align=\"right\">";
echo '<a href="user_import.php?id_session='.$id_session.'&action=export&amp;type=xml">'.Display::return_icon('excel.gif', get_lang('ImportUserListXMLCSV')).'&nbsp;'.get_lang('ImportUserListXMLCSV').'</a>';
echo '<a href="user_import.php?id_session='.$id_session.'&action=export&amp;type=xml">'.
Display::return_icon('excel.gif', get_lang('ImportUserListXMLCSV')).'&nbsp;'.get_lang('ImportUserListXMLCSV').'</a>';
echo "</div><br />";
}
if (!api_is_drh() && !api_is_session_admin() && !api_is_platform_admin()) {
$courses = Tracking::get_courses_followed_by_coach($_user['user_id'], $id_session);
$a_courses = array_keys($courses);
$a_courses = array_keys($courses);
}
if (api_drh_can_access_all_session_content()) {
if (!isset($_GET['user_id'])) {
$a_courses = $coursesFromSession;
}
}
$nb_courses = count($a_courses);
$table = new SortableTable('tracking_list_course', 'count_courses');
$table -> set_header(0, get_lang('CourseTitle'), false);
$table -> set_header(1, get_lang('NbStudents'), false);
$table -> set_header(2, get_lang('TimeSpentInTheCourse').Display :: return_icon('info3.gif', get_lang('TimeOfActiveByTraining'), array('align' => 'absmiddle', 'hspace' => '3px')), false);
$table -> set_header(3, get_lang('ThematicAdvance'), false);
$table -> set_header(4, get_lang('AvgStudentsProgress').Display :: return_icon('info3.gif', get_lang('AvgAllUsersInAllCourses'), array('align' => 'absmiddle', 'hspace' => '3px')), false);
$table -> set_header(5, get_lang('AvgCourseScore').Display :: return_icon('info3.gif', get_lang('AvgAllUsersInAllCourses'), array('align' => 'absmiddle', 'hspace' => '3px')), false);
//$table -> set_header(5, get_lang('AvgExercisesScore'), false);// no code for this?
$table -> set_header(6, get_lang('AvgMessages'), false);
$table -> set_header(7, get_lang('AvgAssignments'), false);
$table -> set_header(8, get_lang('Details'), false);
$table = new SortableTable('tracking_list_course', 'count_courses', null, 1, 50);
$table->set_header(0, get_lang('CourseTitle'), false);
$table->set_header(1, get_lang('NbStudents'), false);
$table->set_header(2, get_lang('TimeSpentInTheCourse').Display :: return_icon('info3.gif', get_lang('TimeOfActiveByTraining'), array('align' => 'absmiddle', 'hspace' => '3px')), false);
$table->set_header(3, get_lang('ThematicAdvance'), false);
$table->set_header(4, get_lang('AvgStudentsProgress').Display :: return_icon('info3.gif', get_lang('AvgAllUsersInAllCourses'), array('align' => 'absmiddle', 'hspace' => '3px')), false);
$table->set_header(5, get_lang('AvgCourseScore').Display :: return_icon('info3.gif', get_lang('AvgAllUsersInAllCourses'), array('align' => 'absmiddle', 'hspace' => '3px')), false);
$table->set_header(6, get_lang('AvgMessages'), false);
$table->set_header(7, get_lang('AvgAssignments'), false);
$table->set_header(8, get_lang('Details'), false);
$csv_header[] = array(
get_lang('CourseTitle', ''),
@ -153,7 +166,6 @@ $csv_header[] = array(
get_lang('ThematicAdvance', ''),
get_lang('AvgStudentsProgress', ''),
get_lang('AvgCourseScore', ''),
//get_lang('AvgExercisesScore', ''),
get_lang('AvgMessages', ''),
get_lang('AvgAssignments', '')
);
@ -173,20 +185,21 @@ if (is_array($a_courses)) {
$rs = Database::query($sql);
$users = array();
while ($row = Database::fetch_array($rs)) { $users[] = $row['user_id']; }
while ($row = Database::fetch_array($rs)) {
$users[] = $row['user_id'];
}
if (count($users) > 0) {
$nb_students_in_course = count($users);
// tracking datas
// tracking data
$avg_progress_in_course = Tracking :: get_avg_student_progress ($users, $course_code, array(), $id_session);
$avg_score_in_course = Tracking :: get_avg_student_score ($users, $course_code, array(), $id_session);
$avg_time_spent_in_course = Tracking :: get_time_spent_on_the_course ($users, $course_code, $id_session);
$messages_in_course = Tracking :: count_student_messages ($users, $course_code, $id_session);
$assignments_in_course = Tracking :: count_student_assignments ($users, $course_code, $id_session);
$avg_time_spent_in_course = api_time_to_hms($avg_time_spent_in_course / $nb_students_in_course);
$avg_progress_in_course = round($avg_progress_in_course / $nb_students_in_course, 2);
if (is_numeric($avg_score_in_course)) {
$avg_score_in_course = round($avg_score_in_course / $nb_students_in_course, 2).'%';
}
@ -201,7 +214,7 @@ if (is_array($a_courses)) {
$tematic_advance_progress = 0;
$thematic = new Thematic();
$tematic_advance = $thematic->get_total_average_of_thematic_advances($course_code, $id_session);
$tematic_advance = $thematic->get_total_average_of_thematic_advances($course_code, $id_session);
if (!empty($tematic_advance)) {
$tematic_advance_csv = $tematic_advance_progress.'%';
@ -210,16 +223,27 @@ if (is_array($a_courses)) {
$tematic_advance_progress = '-';
}
$table_row = array();
$table_row[] = $course['title'];
$table_row[] = $nb_students_in_course;
$table_row[] = is_null($avg_time_spent_in_course)?'-':$avg_time_spent_in_course;
$table_row[] = $tematic_advance_progress;
$table_row[] = is_null($avg_progress_in_course) ? '-' : $avg_progress_in_course.'%';
$table_row[] = is_null($avg_score_in_course) ? '-' : $avg_score_in_course;
$table_row[] = is_null($messages_in_course)?'-':$messages_in_course;
$table_row[] = is_null($assignments_in_course)?'-':$assignments_in_course;
$table_row[] = '<a href="../tracking/courseLog.php?cidReq='.$course_code.'&id_session='.$id_session.'"><img src="'.api_get_path(WEB_IMG_PATH).'2rightarrow.gif" border="0" /></a>';
$courseIcon = '<a href="../tracking/courseLog.php?cidReq='.$course_code.'&id_session='.$id_session.'">
<img src="'.api_get_path(WEB_IMG_PATH).'2rightarrow.gif" border="0" />
</a>';
if (!empty($coursesFromSession)) {
if (!in_array($course_code, $coursesFromSession)) {
$courseIcon = Display::return_icon('2rightarrow_na.gif', get_lang('Course'), array());
}
}
$table_row = array(
$course['title'],
$nb_students_in_course,
is_null($avg_time_spent_in_course)?'-':$avg_time_spent_in_course,
$tematic_advance_progress,
is_null($avg_progress_in_course) ? '-' : $avg_progress_in_course.'%',
is_null($avg_score_in_course) ? '-' : $avg_score_in_course,
is_null($messages_in_course)?'-':$messages_in_course,
is_null($assignments_in_course)?'-':$assignments_in_course,
$courseIcon
);
$csv_content[] = array (
$course['title'],
@ -232,13 +256,9 @@ if (is_array($a_courses)) {
$assignments_in_course,
);
$table -> addRow($table_row, 'align="right"');
$table->addRow($table_row, 'align="right"');
}
// $csv_content = array_merge($csv_header, $csv_content); // Before this statement you are allowed to sort (in different way) the array $csv_content.
}
//$table -> setColAttributes(0);
//$table -> setColAttributes(7);
$table -> display();
$table->display();
Display :: display_footer();

@ -257,7 +257,7 @@ while ($row = Database :: fetch_array($rs)) {
}
// Get the list of sessions where the user is subscribed as student
$sql = 'SELECT id_session, course_code FROM ' . Database :: get_main_table(TABLE_MAIN_SESSION_COURSE_USER) . '
$sql = 'SELECT id_session, course_code FROM '.Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER).'
WHERE id_user=' . intval($user_info['user_id']);
$rs = Database::query($sql);
$tmp_sessions = array();
@ -278,9 +278,8 @@ while ($row = Database :: fetch_array($rs)) {
if (!empty($student_id)) {
if (api_drh_can_access_all_session_content()) {
$sessions = SessionManager::get_sessions_followed_by_drh($user_id);
$sessionList = array_keys($sessions);
if (!in_array($session_id, $sessionList)) {
$users = SessionManager::getAllUsersFromCoursesFromAllSessionFromDrh(api_get_user_id());
if (!in_array($student_id, $users)) {
api_not_allowed();
}
} else {

@ -23,14 +23,14 @@ if ($export_csv) {
$csv_content = array();
if (isset($_GET['id_coach']) && intval($_GET['id_coach']) != 0) {
$nameTools = get_lang("CoachStudents");
$sql = 'SELECT lastname, firstname FROM '.Database::get_main_table(TABLE_MAIN_USER).' WHERE user_id='.intval($_GET['id_coach']);
$rs = Database::query($sql);
$coach_name = api_get_person_name(Database::result($rs, 0, 1), Database::result($rs, 0, 0));
$page_title = get_lang('Students').' - '.$coach_name;
$nameTools = get_lang("CoachStudents");
$sql = 'SELECT lastname, firstname FROM '.Database::get_main_table(TABLE_MAIN_USER).' WHERE user_id='.intval($_GET['id_coach']);
$rs = Database::query($sql);
$coach_name = api_get_person_name(Database::result($rs, 0, 1), Database::result($rs, 0, 0));
$page_title = get_lang('Students').' - '.$coach_name;
} else {
$nameTools = get_lang("Students");
$page_title = get_lang('Students');
$nameTools = get_lang("Students");
$page_title = get_lang('Students');
}
$this_section = SECTION_TRACKING;
@ -46,9 +46,6 @@ if (isset($_GET["user_id"]) && $_GET["user_id"]!="" && isset($_GET["type"]) && $
}
Display :: display_header($nameTools);
/*
FUNCTION
*/
function count_student_coached() {
global $students;
@ -73,10 +70,7 @@ function rsort_users($a, $b) {
}
}
/* MAIN CODE */
//if ($isCoach || api_is_platform_admin() || api_is_drh()) {
if (api_is_allowed_to_create_course() || api_is_drh()) {
if (api_is_allowed_to_create_course() || api_is_drh()) {
if ($export_csv) {
$is_western_name_order = api_is_western_name_order(PERSON_NAME_DATA_EXPORT);
} else {
@ -91,29 +85,29 @@ if (api_is_allowed_to_create_course() || api_is_drh()) {
$menu_items[] = Display::url(Display::return_icon('teacher.png', get_lang('Trainers'), array(), 32), 'teachers.php');
$menu_items[] = Display::url(Display::return_icon('course.png', get_lang('Courses'), array(), 32), 'course.php');
$menu_items[] = Display::url(Display::return_icon('session.png', get_lang('Sessions'), array(), 32), 'session.php');
echo '<div class="actions">';
$nb_menu_items = count($menu_items);
if ($nb_menu_items > 1) {
foreach ($menu_items as $key => $item) {
echo $item;
echo $item;
}
}
//if (count($students) > 0) { //
echo '<span style="float:right">';
echo Display::url(Display::return_icon('printer.png', get_lang('Print'), array(), 32), 'javascript: void(0);', array('onclick'=>'javascript: window.print();'));
echo Display::url(Display::return_icon('export_csv.png', get_lang('ExportAsCSV'), array(), 32), api_get_self().'?export=csv');
echo '</span>';
echo '</span>';
//}
echo '</div>';
} else {
echo '</div>';
} else {
echo '<div class="actions"><div style="float:right;">
<a href="javascript: void(0);" onclick="javascript: window.print();"><img align="absbottom" src="../img/printmgr.gif">&nbsp;'.get_lang('Print').'</a>
<a href="'.api_get_self().'?export=csv"><img align="absbottom" src="../img/excel.gif">&nbsp;'.get_lang('ExportAsCSV').'</a>
</div></div>';
</div></div>';
}
echo Display::page_subheader($page_title);
if (isset($_GET['id_coach'])) {
@ -121,10 +115,17 @@ if (api_is_allowed_to_create_course() || api_is_drh()) {
} else {
$coach_id = api_get_user_id();
}
if (api_is_drh()) {
if (api_drh_can_access_all_session_content()) {
$studentsAllowed = SessionManager::getAllUsersFromCoursesFromAllSessionFromDrh(api_get_user_id());
} else {
$studentsAllowed = array_keys(UserManager::get_users_followed_by_drh(api_get_user_id() , STUDENT));
}
$page_title = get_lang('YourStudents');
if (!isset($_GET['id_session'])) {
if (isset($_GET['user_id'])) {
$user_id = intval($_GET['user_id']);
$user_info = api_get_user_info($user_id);
@ -147,22 +148,22 @@ if (api_is_allowed_to_create_course() || api_is_drh()) {
} else {
$students = array_keys(UserManager::get_users_followed_by_drh(api_get_user_id() , STUDENT));
}
$courses_of_the_platform = CourseManager :: get_real_course_list();
foreach ($courses_of_the_platform as $course) {
$courses[$course['code']] = $course['code'];
}
}
} else {
if (!isset($_GET['id_session'])) {
//Getting courses
if (!isset($_GET['id_session'])) {
// Getting courses
$courses = CourseManager::get_course_list_as_coach($coach_id, false);
if (isset($courses[0])) {
$courses = $courses[0];
}
//Getting students
}
// Getting students
$students = CourseManager::get_user_list_from_courses_as_coach($coach_id);
} else {
$students = Tracking :: get_student_followed_by_coach_in_a_session($_GET['id_session'], $coach_id);
}
@ -170,35 +171,26 @@ if (api_is_allowed_to_create_course() || api_is_drh()) {
$tracking_column = isset($_GET['tracking_column']) ? $_GET['tracking_column'] : ($is_western_name_order xor $sort_by_first_name) ? 1 : 0;
$tracking_direction = isset($_GET['tracking_direction']) ? $_GET['tracking_direction'] : DESC;
if (count($students) > 0) {
$table = new SortableTable('tracking_student', 'count_student_coached', null, ($is_western_name_order xor $sort_by_first_name) ? 1 : 0);
if ($is_western_name_order) {
$table -> set_header(0, get_lang('FirstName'), false);
$table -> set_header(1, get_lang('LastName'), false);
$table->set_header(0, get_lang('FirstName'), false);
$table->set_header(1, get_lang('LastName'), false);
} else {
$table -> set_header(0, get_lang('LastName'), false);
$table -> set_header(1, get_lang('FirstName'), false);
$table->set_header(0, get_lang('LastName'), false);
$table->set_header(1, get_lang('FirstName'), false);
}
/* $table -> set_header(2, get_lang('Time'), false);
$table -> set_header(3, get_lang('Progress'), false);
$table -> set_header(4, get_lang('Score'), false);
$table -> set_header(5, get_lang('Student_publication'), false);
$table -> set_header(6, get_lang('Messages'), false);*/
$table -> set_header(2, get_lang('FirstLogin'), false);
$table -> set_header(3, get_lang('LatestLogin'), false);
$table -> set_header(4, get_lang('Details'), false);
$table->set_header(2, get_lang('FirstLogin'), false);
$table->set_header(3, get_lang('LatestLogin'), false);
$table->set_header(4, get_lang('Details'), false);
if ($export_csv) {
if ($is_western_name_order) {
$csv_header[] = array (
get_lang('FirstName', ''),
get_lang('LastName', ''),
//get_lang('Time', ''),
//get_lang('Progress', ''),
//get_lang('Score', ''),
//get_lang('Student_publication', ''),
//get_lang('Messages', ''),
get_lang('FirstLogin', ''),
get_lang('LatestLogin', '')
);
@ -206,30 +198,26 @@ if (api_is_allowed_to_create_course() || api_is_drh()) {
$csv_header[] = array (
get_lang('LastName', ''),
get_lang('FirstName', ''),
//get_lang('Time', ''),
//get_lang('Progress', ''),
//get_lang('Score', ''),
//get_lang('Student_publication', ''),
//get_lang('Messages', ''),
get_lang('FirstLogin', ''),
get_lang('LatestLogin', '')
);
}
}
$all_datas = array();
$all_datas = array();
foreach ($students as $student_id) {
$student_data = UserManager :: get_user_info_by_id($student_id);
if (isset($_GET['id_session'])) {
$courses = Tracking :: get_course_list_in_session_from_student($student_id, $_GET['id_session']);
}
$courses = Tracking :: get_course_list_in_session_from_student($student_id, $_GET['id_session']);
}
$avg_time_spent = $avg_student_score = $avg_student_progress = $total_assignments = $total_messages = 0;
$nb_courses_student = 0;
foreach ($courses as $course_code) {
if (CourseManager :: is_user_subscribed_in_course($student_id, $course_code, true)) {
$avg_time_spent += Tracking :: get_time_spent_on_the_course($student_id, $course_code, $_GET['id_session']);
$avg_time_spent += Tracking :: get_time_spent_on_the_course($student_id, $course_code, $_GET['id_session']);
$my_average = Tracking :: get_avg_student_score($student_id, $course_code);
if (is_numeric($my_average)) {
$avg_student_score += $my_average;
@ -259,33 +247,36 @@ if (api_is_allowed_to_create_course() || api_is_drh()) {
$row[] = $student_data['lastname'];
$row[] = $student_data['firstname'];
}
/*
$row[] = api_time_to_hms($avg_time_spent);
$row[] = is_null($avg_student_progress) ? null : round($avg_student_progress, 2).'%';
$row[] = is_null($avg_student_score) ? null : round($avg_student_score, 2).'%';
$row[] = $total_assignments;
$row[] = $total_messages;
*/
$string_date = Tracking :: get_last_connection_date($student_id, true);
$first_date = Tracking :: get_first_connection_date($student_id);
$row[] = $first_date;
$row[] = $string_date;
if ($export_csv) {
if ($export_csv) {
$row[count($row) - 1] = strip_tags($row[count($row) - 1]);
$row[count($row) - 2] = strip_tags($row[count($row) - 2]);
$csv_content[] = $row;
}
if (isset($_GET['id_coach']) && intval($_GET['id_coach']) != 0) {
$row[] = '<a href="myStudents.php?student='.$student_id.'&id_coach='.$coach_id.'&id_session='.$_GET['id_session'].'"><img src="'.api_get_path(WEB_IMG_PATH).'2rightarrow.gif" border="0" /></a>';
} else {
$row[] = '<a href="myStudents.php?student='.$student_id.'"><img src="'.api_get_path(WEB_IMG_PATH).'2rightarrow.gif" border="0" /></a>';
}
$all_datas[] = $row;
if (isset($_GET['id_coach']) && intval($_GET['id_coach']) != 0) {
$detailsLink = '<a href="myStudents.php?student='.$student_id.'&id_coach='.$coach_id.'&id_session='.$_GET['id_session'].'">
<img src="'.api_get_path(WEB_IMG_PATH).'2rightarrow.gif" border="0" /></a>';
} else {
$detailsLink = '<a href="myStudents.php?student='.$student_id.'">
<img src="'.api_get_path(WEB_IMG_PATH).'2rightarrow.gif" border="0" /></a>';
}
if (api_is_drh()) {
if (!in_array($student_id, $studentsAllowed)) {
$detailsLink = Display::return_icon('2rightarrow_na.gif', get_lang('Details'));
}
}
$row[] = $detailsLink;
$all_datas[] = $row;
}
if ($tracking_direction == 'ASC') {
@ -315,5 +306,4 @@ if (api_is_allowed_to_create_course() || api_is_drh()) {
}
}
/* FOOTER */
Display :: display_footer();

@ -25,35 +25,56 @@ Display :: display_header($nameTools);
$formateurs = array();
if (api_is_drh() || api_is_platform_admin()) {
// followed teachers by drh
$formateurs = UserManager::get_users_followed_by_drh($_user['user_id'], COURSEMANAGER);
$menu_items = array();
$menu_items[] = Display::url(Display::return_icon('stats.png', get_lang('MyStats'),'',ICON_SIZE_MEDIUM),api_get_path(WEB_CODE_PATH)."auth/my_progress.php" );
$menu_items[] = Display::url(Display::return_icon('user.png', get_lang('Students'), array(), 32), "index.php?view=drh_students&amp;display=yourstudents");
$menu_items[] = Display::return_icon('teacher_na.png', get_lang('Trainers'), array(), 32);
$menu_items[] = Display::url(Display::return_icon('course.png', get_lang('Courses'), array(), 32), 'course.php');
$menu_items[] = Display::url(Display::return_icon('session.png', get_lang('Sessions'), array(), 32), 'session.php');
echo '<div class="actions">';
$nb_menu_items = count($menu_items);
if ($nb_menu_items > 1) {
foreach ($menu_items as $key => $item) {
echo $item;
}
}
if (count($formateurs) > 0) {
echo '<span style="float:right">';
echo Display::url(Display::return_icon('printer.png', get_lang('Print'), array(), 32), 'javascript: void(0);', array('onclick'=>'javascript: window.print();'));
echo Display::url(Display::return_icon('export_csv.png', get_lang('ExportAsCSV'), array(), 32), api_get_self().'?export=xls');
echo '</span>';
}
echo '</div>';
echo Display::page_subheader(get_lang('YourTeachers'));
// Followed teachers by drh
if (api_drh_can_access_all_session_content()) {
$sessions = SessionManager::get_sessions_followed_by_drh(api_get_user_id());
if (!empty($sessions)) {
$formateurs = array();
foreach ($sessions as $session) {
$coursesFromSession = SessionManager::get_course_list_by_session_id($session['id']);
foreach ($coursesFromSession as $course) {
$teachers = CourseManager::get_teacher_list_from_course_code($course['code']);
foreach ($teachers as $teacher) {
if (isset($formateurs[$teacher['user_id']])) {
continue;
}
$formateurs[$teacher['user_id']] = $teacher;
}
}
}
}
} else {
$formateurs = UserManager::get_users_followed_by_drh($_user['user_id'], COURSEMANAGER);
}
$menu_items = array(
Display::url(Display::return_icon('stats.png', get_lang('MyStats'), '', ICON_SIZE_MEDIUM), api_get_path(WEB_CODE_PATH)."auth/my_progress.php" ),
Display::url(Display::return_icon('user.png', get_lang('Students'), array(), 32), "index.php?view=drh_students&amp;display=yourstudents"),
Display::return_icon('teacher_na.png', get_lang('Trainers'), array(), 32),
Display::url(Display::return_icon('course.png', get_lang('Courses'), array(), 32), 'course.php'),
Display::url(Display::return_icon('session.png', get_lang('Sessions'), array(), 32), 'session.php')
);
echo '<div class="actions">';
$nb_menu_items = count($menu_items);
if ($nb_menu_items > 1) {
foreach ($menu_items as $key => $item) {
echo $item;
}
}
if (count($formateurs) > 0) {
echo '<span style="float:right">';
echo Display::url(Display::return_icon('printer.png', get_lang('Print'), array(), 32), 'javascript: void(0);', array('onclick'=>'javascript: window.print();'));
echo Display::url(Display::return_icon('export_csv.png', get_lang('ExportAsCSV'), array(), 32), api_get_self().'?export=xls');
echo '</span>';
}
echo '</div>';
echo Display::page_subheader(get_lang('YourTeachers'));
}
if (!api_is_drh()) {
api_display_tool_title($nameTools);
api_display_tool_title($nameTools);
}
/**
@ -61,31 +82,31 @@ if (!api_is_drh()) {
*/
if (isset($_POST['export'])) {
$is_western_name_order = api_is_western_name_order(PERSON_NAME_DATA_EXPORT);
$is_western_name_order = api_is_western_name_order(PERSON_NAME_DATA_EXPORT);
} else {
$is_western_name_order = api_is_western_name_order();
$is_western_name_order = api_is_western_name_order();
}
$sort_by_first_name = api_sort_by_first_name();
if (!api_is_drh() && !api_is_platform_admin()) {
$order_clause = $sort_by_first_name ? ' ORDER BY firstname, lastname' : ' ORDER BY lastname, firstname';
if (isset($_GET["teacher_id"]) && $_GET["teacher_id"] != 0) {
$teacher_id = intval($_GET["teacher_id"]);
$sql_formateurs = "SELECT user_id,lastname,firstname,email
FROM $tbl_user
WHERE user_id='$teacher_id'".$order_clause;
} else {
$sql_formateurs = "SELECT user_id,lastname,firstname,email
FROM $tbl_user
WHERE status = 1".$order_clause;
}
$result_formateurs = Database::query($sql_formateurs);
if (Database::num_rows($result_formateurs) > 0) {
while ($row_formateurs = Database::fetch_array($result_formateurs)) {
$formateurs[] = $row_formateurs;
}
}
$order_clause = $sort_by_first_name ? ' ORDER BY firstname, lastname' : ' ORDER BY lastname, firstname';
if (isset($_GET["teacher_id"]) && $_GET["teacher_id"] != 0) {
$teacher_id = intval($_GET["teacher_id"]);
$sql_formateurs = "SELECT user_id,lastname,firstname,email
FROM $tbl_user
WHERE user_id='$teacher_id'".$order_clause;
} else {
$sql_formateurs = "SELECT user_id,lastname,firstname,email
FROM $tbl_user
WHERE status = 1".$order_clause;
}
$result_formateurs = Database::query($sql_formateurs);
if (Database::num_rows($result_formateurs) > 0) {
while ($row_formateurs = Database::fetch_array($result_formateurs)) {
$formateurs[] = $row_formateurs;
}
}
}
$time_filter = 'last_7_days';
@ -99,7 +120,7 @@ $form->addRule(array ('start_date', 'end_date'), get_lang('StartDateShouldBeBefo
$defaults = array();
$defaults['start_date'] = date('Y-m-d 12:00:00', strtotime("-7 days"));
$defaults['end_date'] = date('Y-m-d 12:00:00',time());
$defaults['end_date'] = date('Y-m-d 12:00:00', time());
$start_date = $end_date = null;
if ($form->validate()) {
@ -107,7 +128,7 @@ if ($form->validate()) {
$start_date = $defaults['start_date'] = $values['start_date'];
$end_date = $defaults['end_date'] = $values['end_date'];
$time_filter = 'custom';
$time_label = sprintf(get_lang('TimeSpentBetweenXAndY'), $start_date, $end_date);
$time_label = sprintf(get_lang('TimeSpentBetweenXAndY'), $start_date, $end_date);
}
$form->setDefaults($defaults);
$form->addelement('style_submit_button', 'submit', get_lang('Filter'));
@ -120,11 +141,11 @@ if ($is_western_name_order) {
}
if ($is_western_name_order) {
$header[] = get_lang('FirstName');
$header[] = get_lang('LastName');
$header[] = get_lang('FirstName');
$header[] = get_lang('LastName');
} else {
$header[] = get_lang('LastName');
$header[] = get_lang('FirstName');
$header[] = get_lang('LastName');
$header[] = get_lang('FirstName');
}
$header[] = $time_label;
@ -134,37 +155,49 @@ $data = array();
if (count($formateurs) > 0) {
$i = 1;
$i = 1;
foreach ($formateurs as $formateur) {
$user_id = $formateur["user_id"];
$lastname = $formateur["lastname"];
$firstname = $formateur["firstname"];
$email = $formateur["email"];
$user_id = $formateur["user_id"];
$lastname = $formateur["lastname"];
$firstname = $formateur["firstname"];
$email = $formateur["email"];
if ($i % 2 == 0) {
$css_class = "row_odd";
if ($i % 20 == 0 && $i != 0) {
if ($is_western_name_order) {
echo '<tr><th>'.get_lang('FirstName').'</th><th>'.get_lang('LastName').'</th><th>'.get_lang('Email').'</th><th>'.get_lang('AdminCourses').'</th><th>'.get_lang('Students').'</th></tr>';
} else {
echo '<tr><th>'.get_lang('LastName').'</th><th>'.get_lang('FirstName').'</th><th>'.get_lang('Email').'</th><th>'.get_lang('AdminCourses').'</th><th>'.get_lang('Students').'</th></tr>';
}
}
} else {
$css_class = "row_even";
}
if ($i % 20 == 0 && $i != 0) {
if ($is_western_name_order) {
echo '<tr>
<th>'.get_lang('FirstName').'</th>
<th>'.get_lang('LastName').'</th>
<th>'.get_lang('Email').'</th>
<th>'.get_lang('AdminCourses').'</th>
<th>'.get_lang('Students').'</th>
</tr>';
} else {
echo '<tr>
<th>'.get_lang('LastName').'</th>
<th>'.get_lang('FirstName').'</th>
<th>'.get_lang('Email').'</th>
<th>'.get_lang('AdminCourses').'</th>
<th>'.get_lang('Students').'</th>
</tr>';
}
}
} else {
$css_class = "row_even";
}
$i++;
if ($is_western_name_order) {
$data[$user_id]["firstname"] = $firstname;
$data[$user_id]["lastname"] = $lastname;
} else {
$data[$user_id]["lastname"] = $lastname;
$data[$user_id]["firstname"] = $firstname;
}
if ($is_western_name_order) {
$data[$user_id]["firstname"] = $firstname;
$data[$user_id]["lastname"] = $lastname;
} else {
$data[$user_id]["lastname"] = $lastname;
$data[$user_id]["firstname"] = $firstname;
}
$time_on_platform = api_time_to_hms(Tracking :: get_time_spent_on_the_platform($user_id, $time_filter, $start_date, $end_date));
$data[$user_id]["timespentlastweek"] = $time_on_platform;
$data[$user_id]["email"] = $email;

@ -47,7 +47,7 @@ $user = api_get_user_info();
header('Content-type: text/javascript');
?>var scorm_logs=<?php echo ((empty($oLP->scorm_debug) or (!api_is_course_admin() && !api_is_platform_admin()) )?'0':'3');?>; //debug log level for SCORM. 0 = none, 1=light, 2=a lot, 3=all - displays logs in log frame
var lms_logs=0; //debug log level for LMS actions. 0=none, 1=light, 2=a lot, 3=all
var lms_logs = 0; //debug log level for LMS actions. 0=none, 1=light, 2=a lot, 3=all
// API Object initialization (eases access later on)
function APIobject() {
@ -1109,10 +1109,20 @@ function log_in_log(message, priority) {
if (ua.mozilla || ua.webkit) {
// Colorize a little
var color = "color: black";
if (priority == 3) { color = "color:blue"; }
elseif (priority == 2) { color = "color:green"; }
elseif (priority == 1) { color = "color:orange"; }
elseif (priority == 0) { color = "color:red;font-weight:bold"; }
switch (priority) {
case 0:
color = "color:red;font-weight:bold";
break;
case 1:
color = "color:orange";
break;
case 2:
color = "color:green";
break;
case 3:
color = "color:blue";
break;
}
// Log in console with syntax colouring
console.log("%c"+message, color);
} else {

@ -8,7 +8,7 @@
* Initialization
*/
$language_file = array('messages','userInfo');
$cidReset=true;
$cidReset = true;
require_once '../inc/global.inc.php';
api_block_anonymous_users();
@ -72,24 +72,24 @@ $show_message = null;
// easy links
if (is_array($_GET) && count($_GET)>0) {
foreach($_GET as $key => $value) {
switch ($key) {
case 'accept':
$user_role = GroupPortalManager::get_user_group_role(api_get_user_id(), $value);
if (in_array($user_role , array(GROUP_USER_PERMISSION_PENDING_INVITATION_SENT_BY_USER,GROUP_USER_PERMISSION_PENDING_INVITATION))) {
GroupPortalManager::update_user_role(api_get_user_id(), $value, GROUP_USER_PERMISSION_READER);
$show_message = get_lang('UserIsSubscribedToThisGroup');
} elseif (in_array($user_role , array(GROUP_USER_PERMISSION_READER, GROUP_USER_PERMISSION_ADMIN, GROUP_USER_PERMISSION_MODERATOR))) {
$show_message = get_lang('UserIsAlreadySubscribedToThisGroup');
} else {
$show_message = get_lang('UserIsNotSubscribedToThisGroup');
}
break 2;
case 'deny':
// delete invitation
GroupPortalManager::delete_user_rel_group(api_get_user_id(), $value);
$show_message = get_lang('GroupInvitationWasDeny');
break 2;
foreach ($_GET as $key => $value) {
switch ($key) {
case 'accept':
$user_role = GroupPortalManager::get_user_group_role(api_get_user_id(), $value);
if (in_array($user_role , array(GROUP_USER_PERMISSION_PENDING_INVITATION_SENT_BY_USER, GROUP_USER_PERMISSION_PENDING_INVITATION))) {
GroupPortalManager::update_user_role(api_get_user_id(), $value, GROUP_USER_PERMISSION_READER);
$show_message = get_lang('UserIsSubscribedToThisGroup');
} elseif (in_array($user_role , array(GROUP_USER_PERMISSION_READER, GROUP_USER_PERMISSION_ADMIN, GROUP_USER_PERMISSION_MODERATOR))) {
$show_message = get_lang('UserIsAlreadySubscribedToThisGroup');
} else {
$show_message = get_lang('UserIsNotSubscribedToThisGroup');
}
break 2;
case 'deny':
// delete invitation
GroupPortalManager::delete_user_rel_group(api_get_user_id(), $value);
$show_message = get_lang('GroupInvitationWasDeny');
break 2;
}
}
}
@ -97,14 +97,13 @@ if (is_array($_GET) && count($_GET)>0) {
$social_left_content = SocialManager::show_social_menu('myfiles');
$actions = null;
if (isset($_GET['cidReq'])){
if (isset($_GET['cidReq'])) {
$actions = '<a href="'.api_get_path(WEB_CODE_PATH).'document/document.php?cidReq='.Security::remove_XSS($_GET['cidReq']).'&amp;id_session='.Security::remove_XSS($_GET['id_session']).'&amp;gidReq='.Security::remove_XSS($_GET['gidReq']).'&amp;id='.Security::remove_XSS($_GET['parent_id']).'">'.Display::return_icon('back.png',get_lang('BackTo').' '.get_lang('Documents').' ('.get_lang('Course').')').'</a>';
}
$social_right_content = '<div class="span9">';
$social_right_content .= '<iframe name="fileManager" id="fileManager" src="'.api_get_path(WEB_PATH).'main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajaxfilemanager.php?editor=stand_alone" scrolling="no" noresize="noresize" frameborder="no" style="height:480px; width:100%; float:left"></iframe>';
$social_right_content .= '</div>';
$tpl = new Template();
$tpl->assign('social_left_content', $social_left_content);
$tpl->assign('social_right_content', $social_right_content);

@ -0,0 +1,33 @@
<table class="data_table">
<tr>
<th>
{{ 'StartDate'| get_lang }}
</th>
<th>
{{ 'EndDate'| get_lang }}
</th>
<th>
{{ 'Title' | get_lang }}
</th>
</tr>
{% for event in agenda_events %}
<tr>
<td>
{{ event.start }}
</td>
<td>
{% if event.allDay %}
{{ 'AllDay' | get_lang }}
{% else %}
{{ event.start }} - {{ event.end }}
{% endif %}
</td>
<td>
{{ event.title }}
<p>{{ event.description}}</p>
{{ event.className }}
</td>
</tr>
{% endfor %}
</table>

@ -92,13 +92,14 @@ $(document).ready(function() {
header: {
left: 'today prev,next',
center: 'title',
right: 'month,agendaWeek,agendaDay'
right: 'month,agendaWeek,agendaDay, test'
},
{% if use_google_calendar == 1 %}
eventSources: [
'{{ google_calendar_url }}', //if you want to add more just add URL in this array
// if you want to add more just add URL in this array
'{{ google_calendar_url }}',
{
className: 'gcal-event' // an option!
className: 'gcal-event' // an option!
}
],
{% endif %}

@ -1,7 +1,30 @@
<div class="page-header">
<h2>{{ work.title }}</h2>
</div>
<p>
{{ work.description }}
{{ work.description }}
</p>
{# "UpdatedBy"|get_lang|format(comment.username) #}
{% if work_comment_enabled %}
<h4>
{{ 'Comments' | get_lang }}
</h4>
<hr>
<ul>
{% for comment in comments %}
<li>
<div class="page-header">
<a href="{{ _p.web_code }}"><img height="24" src="{{ comment.picture }}"/> {{ comment.username }} </a>- {{ comment.sent_at | api_get_local_time }}
</div>
<p>
{{ comment.comment }}
</p>
</li>
{% endfor %}
</ul>
<br />
<hr>
{{ form }}
{% endif %}

@ -46,12 +46,15 @@ if (!$is_allowedToTrack) {
if (api_is_drh()) {
// Blocking course for drh
if (api_drh_can_access_all_session_content()) {
$sessions = SessionManager::get_sessions_followed_by_drh($user_id);
$sessionList = array_keys($sessions);
if (!in_array($session_id, $sessionList)) {
api_not_allowed();
$coursesFromSession = SessionManager::getAllCoursesFromAllSessionFromDrh(api_get_user_id());
$coursesFollowedList = CourseManager::get_courses_followed_by_drh(api_get_user_id());
$coursesFollowedList = array_keys($coursesFollowedList);
if (!in_array(api_get_course_id(), $coursesFollowedList)) {
if (!in_array(api_get_course_id(), $coursesFromSession)) {
api_not_allowed();
}
}
} else {
$coursesFollowedList = CourseManager::get_courses_followed_by_drh(api_get_user_id());
@ -83,7 +86,7 @@ if ($export_csv) {
ob_start();
}
$csv_content = array();
// Scripts for reporting array hide / unhide columns
// Scripts for reporting array hide/show columns
$js = "<script>
// hide column and display the button to unhide it
function foldup(in_id) {
@ -116,26 +119,21 @@ $js = "<script>
</script>";
$htmlHeadXtra[] = "<style type='text/css'>
/*<![CDATA[*/
.secLine {background-color : #E6E6E6;}
.content {padding-left : 15px;padding-right : 15px; }
.specialLink{color : #0000FF;}
/*]]>*/
/* Style for reporting array hide / unhide columns */
.unhide_button {
cursor : pointer;
border:1px solid black;
background-color: #FAFAFA;
padding: 5px;
border-radius : 3px;
margin-right:3px;
}
div#reporting_table table th {
vertical-align:top;
}
</style>
<style media='print' type='text/css'>
.secLine {background-color : #E6E6E6;}
.content {padding-left : 15px;padding-right : 15px; }
.specialLink{color : #0000FF;}
/* Style for reporting array hide/show columns */
.unhide_button {
cursor : pointer;
border:1px solid black;
background-color: #FAFAFA;
padding: 5px;
border-radius : 3px;
margin-right:3px;
}
div#reporting_table table th {
vertical-align:top;
}
</style>";
$htmlHeadXtra[] .= $js;
@ -166,19 +164,19 @@ Display::display_header($nameTools, 'Tracking');
// getting all the students of the course
if (empty($session_id)) {
// Registered students in a course outside session.
$a_students = CourseManager :: get_student_list_from_course_code(api_get_course_id());
// Registered students in a course outside session.
$a_students = CourseManager :: get_student_list_from_course_code(api_get_course_id());
} else {
// Registered students in session.
$a_students = CourseManager :: get_student_list_from_course_code(api_get_course_id(), true, api_get_session_id());
// Registered students in session.
$a_students = CourseManager :: get_student_list_from_course_code(api_get_course_id(), true, api_get_session_id());
}
$nbStudents = count($a_students);
// Gettting all the additional information of an additional profile field.
// Getting all the additional information of an additional profile field.
if (isset($_GET['additional_profile_field']) && is_numeric($_GET['additional_profile_field'])) {
$user_array = array();
foreach ($a_students as $key=>$item) {
foreach ($a_students as $key => $item) {
$user_array[] = $key;
}
// Fetching only the user that are loaded NOT ALL user in the portal.
@ -186,7 +184,6 @@ if (isset($_GET['additional_profile_field']) && is_numeric($_GET['additional_pro
$extra_info = UserManager::get_extra_field_information($_GET['additional_profile_field']);
}
/* MAIN CODE */
echo '<div class="actions">';
@ -211,7 +208,6 @@ echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&export=csv&'.$addional_pa
'.Display::return_icon('export_csv.png', get_lang('ExportAsCSV'),'',ICON_SIZE_MEDIUM).'</a>';
echo '</span>';
echo '</div>';
@ -227,8 +223,7 @@ $form_search->addElement('style_submit_button', 'submit', get_lang('SearchUsers'
$form_search->display();
echo '</div>';
// BEGIN : form to remind inactives susers
// BEGIN : form to remind inactive users
if (count($a_students) > 0) {
$form = new FormValidator('reminder_form', 'get', api_get_path(REL_CODE_PATH).'announcements/announcements.php');
@ -249,8 +244,8 @@ if (count($a_students) > 0) {
$el = $form -> addElement('select', 'since', '<img width="ICON_SIZE_SMALL" align="middle" src="'.api_get_path(WEB_IMG_PATH).'messagebox_warning.gif" border="0" />'.get_lang('RemindInactivesLearnersSince'), $options);
$el -> setSelected(7);
$form -> addElement('hidden', 'action', 'add');
$form -> addElement('hidden', 'remindallinactives', 'true');
$form->addElement('hidden', 'action', 'add');
$form->addElement('hidden', 'remindallinactives', 'true');
$course_name = get_lang('Course').' '.$course_info['name'];
@ -295,10 +290,10 @@ if (count($a_students) > 0) {
if ($is_western_name_order) {
$table->set_header(1, get_lang('FirstName'), true);
$tab_table_header[] = get_lang('FirstName');
$table->set_header(2, get_lang('LastName'), true);
$table->set_header(2, get_lang('LastName'), true);
$tab_table_header[] = get_lang('LastName');
} else {
$table->set_header(1, get_lang('LastName'), true);
$table->set_header(1, get_lang('LastName'), true);
$tab_table_header[] = get_lang('LastName');
$table->set_header(2, get_lang('FirstName'), true);
$tab_table_header[] = get_lang('FirstName');
@ -355,7 +350,7 @@ if (count($a_students) > 0) {
$tab_table_header[] = get_lang('Details');
}
}
// display buttons to unhide hidden columns
// display buttons to un hide hidden columns
echo "<br/><br/><div id='unhideButtons'>";
for ($i=0; $i < count($tab_table_header); $i++) {
$index = $i + 1;
@ -386,8 +381,8 @@ if ($export_csv) {
$csv_headers[] = get_lang('Login', ''); //
$csv_headers[] = get_lang('TrainingTime', '');
$csv_headers[] = get_lang('CourseProgress', '');
$csv_headers[] = get_lang('ExerciseProgress','');
$csv_headers[] = get_lang('ExerciseAverage','');
$csv_headers[] = get_lang('ExerciseProgress', '');
$csv_headers[] = get_lang('ExerciseAverage', '');
$csv_headers[] = get_lang('Score', '');
$csv_headers[] = get_lang('Student_publication', '');
$csv_headers[] = get_lang('Messages', '');

@ -1,5 +1,4 @@
<?php
/* For licensing terms, see /license.txt */
$language_file = array('exercice', 'work', 'document', 'admin');
@ -32,13 +31,29 @@ if (user_is_author($id) || $course_info['show_score'] == 0 && $work['active'] ==
$interbreadcrumb[] = array('url' => '#','name' => $work['title']);
if (
($course_info['show_score'] == 0 && $work['active'] == 1 && $work['accepted'] == 1) ||
api_is_allowed_to_edit() ||
(user_is_author($id))) {
api_is_allowed_to_edit() || user_is_author($id)
) {
if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'send_comment') {
addWorkComment(api_get_user_id(), $work, $_POST);
$url = api_get_path(WEB_CODE_PATH).'work/view.php?id='.$work['id'].'&'.api_get_cidreq();
header('Location: '.$url);
exit;
}
$tpl = new Template();
$tpl->assign('work', $work);
$tpl->assign('work_comment_enabled', ALLOW_USER_COMMENTS);
$comments = getWorkComments($work);
$commentForm = getWorkCommentForm($work);
$tpl->assign('comments', $comments);
$tpl->assign('form', $commentForm);
$template = $tpl->get_template('work/view.tpl');
$content = $tpl->fetch($template);
$tpl->assign('content', $content);
$tpl->display_one_col_template();
} else {
api_not_allowed(true);

@ -23,6 +23,13 @@ if (isset($_configuration['add_document_to_work'])) {
define('ADD_DOCUMENT_TO_WORK', false);
}
$_configuration['work_user_comments'] = true;
if (isset($_configuration['work_user_comments'])) {
define('ALLOW_USER_COMMENTS', $_configuration['work_user_comments']);
} else {
define('ALLOW_USER_COMMENTS', false);
}
/**
* Displays action links (for admins, authorized groups members and authorized students)
* @param string Current dir
@ -625,10 +632,10 @@ function display_student_publications_list($id, $my_folder_data, $work_parents,
$there_is_a_expire_date = true;
$defaults['enableExpiryDate'] = true;
$form_folder -> addElement('checkbox', 'enableExpiryDate',null,get_lang('EnableExpiryDate'), 'onclick="javascript: if(this.checked){document.getElementById(\'option1\').style.display = \'block\';}else{document.getElementById(\'option1\').style.display = \'none\';}"');
$form_folder -> addElement('html', '<div id=\'option1\' style="display:block">');
$form_folder -> addGroup(create_group_date_select(), 'expires', get_lang('ExpiresAt'));
$form_folder -> addElement('html', '</div>');
$form_folder->addElement('checkbox', 'enableExpiryDate',null,get_lang('EnableExpiryDate'), 'onclick="javascript: if(this.checked){document.getElementById(\'option1\').style.display = \'block\';}else{document.getElementById(\'option1\').style.display = \'none\';}"');
$form_folder->addElement('html', '<div id=\'option1\' style="display:block">');
$form_folder->addGroup(create_group_date_select(), 'expires', get_lang('ExpiresAt'));
$form_folder->addElement('html', '</div>');
} else {
$homework['expires_on'] = api_get_local_time();
@ -637,10 +644,10 @@ function display_student_publications_list($id, $my_folder_data, $work_parents,
$there_is_a_expire_date = false;
$form_folder -> addElement('checkbox', 'enableExpiryDate',null,get_lang('EnableExpiryDate'), 'onclick="javascript: if(this.checked){document.getElementById(\'option1\').style.display = \'block\';}else{document.getElementById(\'option1\').style.display = \'none\';}"');
$form_folder -> addElement('html', '<div id=\'option1\' style="display:none">');
$form_folder -> addGroup(create_group_date_select(), 'expires', get_lang('ExpiresAt'));
$form_folder -> addElement('html', '</div>');
$form_folder->addElement('checkbox', 'enableExpiryDate',null,get_lang('EnableExpiryDate'), 'onclick="javascript: if(this.checked){document.getElementById(\'option1\').style.display = \'block\';}else{document.getElementById(\'option1\').style.display = \'none\';}"');
$form_folder->addElement('html', '<div id=\'option1\' style="display:none">');
$form_folder->addGroup(create_group_date_select(), 'expires', get_lang('ExpiresAt'));
$form_folder->addElement('html', '</div>');
}
if ($homework['ends_on'] != '0000-00-00 00:00:00') {
@ -649,11 +656,11 @@ function display_student_publications_list($id, $my_folder_data, $work_parents,
$defaults['enableEndDate'] = true;
$form_folder -> addElement('checkbox', 'enableEndDate', null, get_lang('EnableEndDate'), 'onclick="javascript: if(this.checked){document.getElementById(\'option2\').style.display = \'block\';}else{document.getElementById(\'option2\').style.display = \'none\';}"');
$form_folder -> addElement('html', '<div id=\'option2\' style="display:block">');
$form_folder -> addGroup(create_group_date_select(), 'ends', get_lang('EndsAt'));
$form_folder -> addElement('html', '</div>');
$form_folder -> addRule(array('expires', 'ends'), get_lang('DateExpiredNotBeLessDeadLine'), 'comparedate');
$form_folder->addElement('checkbox', 'enableEndDate', null, get_lang('EnableEndDate'), 'onclick="javascript: if(this.checked){document.getElementById(\'option2\').style.display = \'block\';}else{document.getElementById(\'option2\').style.display = \'none\';}"');
$form_folder->addElement('html', '<div id=\'option2\' style="display:block">');
$form_folder->addGroup(create_group_date_select(), 'ends', get_lang('EndsAt'));
$form_folder->addElement('html', '</div>');
$form_folder->addRule(array('expires', 'ends'), get_lang('DateExpiredNotBeLessDeadLine'), 'comparedate');
} else {
$homework['ends_on'] = api_get_local_time();
@ -663,20 +670,20 @@ function display_student_publications_list($id, $my_folder_data, $work_parents,
$there_is_a_end_date = false;
$form_folder -> addElement('checkbox', 'enableEndDate', null, get_lang('EnableEndDate'), 'onclick="javascript: if(this.checked){document.getElementById(\'option2\').style.display = \'block\';}else{document.getElementById(\'option2\').style.display = \'none\';}"');
$form_folder -> addElement('html', '<div id=\'option2\' style="display:none">');
$form_folder -> addGroup(create_group_date_select(), 'ends', get_lang('EndsAt'));
$form_folder -> addElement('html', '</div>');
$form_folder -> addRule(array('expires', 'ends'), get_lang('DateExpiredNotBeLessDeadLine'), 'comparedate');
$form_folder->addElement('checkbox', 'enableEndDate', null, get_lang('EnableEndDate'), 'onclick="javascript: if(this.checked){document.getElementById(\'option2\').style.display = \'block\';}else{document.getElementById(\'option2\').style.display = \'none\';}"');
$form_folder->addElement('html', '<div id=\'option2\' style="display:none">');
$form_folder->addGroup(create_group_date_select(), 'ends', get_lang('EndsAt'));
$form_folder->addElement('html', '</div>');
$form_folder->addRule(array('expires', 'ends'), get_lang('DateExpiredNotBeLessDeadLine'), 'comparedate');
}
if ($there_is_a_expire_date && $there_is_a_end_date) {
$form_folder -> addRule(array('expires', 'ends'), get_lang('DateExpiredNotBeLessDeadLine'), 'comparedate');
}
$form_folder -> addElement('checkbox', 'allow_text_assignment', null, get_lang('AllowTextAssignments'));
$form_folder -> addElement('html', '</div>');
$form_folder -> addElement('style_submit_button', 'submit', get_lang('ModifyDirectory'), 'class="save"');
$form_folder->addElement('checkbox', 'allow_text_assignment', null, get_lang('AllowTextAssignments'));
$form_folder->addElement('html', '</div>');
$form_folder->addElement('style_submit_button', 'submit', get_lang('ModifyDirectory'), 'class="save"');
if ($there_is_a_end_date) {
$end_date_array = convert_date_to_array($homework['ends_on'], 'ends');
@ -2390,3 +2397,83 @@ function getWorkDescriptionToolbar()
{
return array('ToolbarSet' => 'Work', 'Width' => '100%', 'Height' => '400');
}
/**
* @param array $work
* @return string
*/
function getWorkComments($work) {
if (ADD_DOCUMENT_TO_WORK == false) {
return array();
}
$commentTable = Database::get_course_table(TABLE_STUDENT_PUBLICATION_ASSIGNMENT_COMMENT);
$userTable= Database::get_main_table(TABLE_MAIN_USER);
$courseId = $work['c_id'];
$workId = $work['id'];
$sql = "SELECT c.*, u.firstname, u.lastname, u.username, u.picture_uri
FROM $commentTable c INNER JOIN $userTable u ON(u.user_id = c.user_id)
WHERE c_id = $courseId AND work_id = $workId
ORDER BY sent_at
";
$result = Database::query($sql);
$comments = Database::store_result($result, 'ASSOC');
foreach ($comments as &$comment) {
$pictureInfo = UserManager::get_picture_user($comment['user_id'], $comment['picture_uri'], 24, USER_IMAGE_SIZE_SMALL);
$comment['picture'] = $pictureInfo['file'];
}
return $comments;
}
/**
* @param int $userId
* @param array $work
* @param array $data
* @return int
*/
function addWorkComment($userId, $work, $data)
{
if (ADD_DOCUMENT_TO_WORK == false) {
return null;
}
$commentTable = Database::get_course_table(TABLE_STUDENT_PUBLICATION_ASSIGNMENT_COMMENT);
if (empty($data['comment'])) {
return null;
}
$params = array(
'work_id' => $work['id'],
'c_id' => $work['c_id'],
'user_id' => $userId,
'comment' => $data['comment'],
'sent_at' => api_get_utc_datetime()
);
return Database::insert($commentTable, $params);
}
/**
* @param array $work
* @return string
*/
function getWorkCommentForm($work)
{
if (ADD_DOCUMENT_TO_WORK == false) {
return null;
}
$form = new FormValidator(
'work_comment',
'post',
api_get_path(WEB_CODE_PATH).'work/view.php?id='.$work['id'].'&action=send_comment&'.api_get_cidreq()
);
$form->addElement('textarea', 'comment', get_lang('Comment'), array('class' => 'span5', 'rows' => '8'));
$form->addRule('comment', get_lang('ThisFieldIsRequired'), 'required');
$form->addElement('hidden', 'id', $work['id']);
$form->addElement('button', 'button', get_lang('Send'));
return $form->return_form();
}

Loading…
Cancel
Save