Adding title in anchor see #3941

skala
Julio Montoya 14 years ago
parent 61ec6145a1
commit 59b560a599
  1. 3
      main/exercice/question_list_admin.inc.php
  2. 90
      main/inc/lib/document.lib.php
  3. 243
      main/mySpace/current_courses.php
  4. 7
      main/mySpace/index.php
  5. 6
      main/mySpace/myspace.lib.php

@ -177,7 +177,8 @@ if ($nbrQuestions) {
if (!empty($objQuestionTmp->level)) {
$level = '('.get_lang('Difficulty').' '.$objQuestionTmp->level.')';
}
echo Display::tag('span','<a href="#">'.$move.' '.cut($objQuestionTmp->selectTitle(), 80).' '. Display::tag('span',$level.' ['.get_lang('QualificationNumeric').': '.$objQuestionTmp->selectWeighting().']', array('style'=>"right:110px; position: absolute;padding-top: 0.3em;")).'</a>', array('style'=>''));
$title = Security::remove_XSS($objQuestionTmp->selectTitle());
echo Display::tag('span', '<a href="#" title = "'.$title.'">'.$move.' '.cut($title, 80).' '.Display::tag('span', $level.' ['.get_lang('QualificationNumeric').': '.$objQuestionTmp->selectWeighting().']', array('style'=>"right:110px; position: absolute;padding-top: 0.3em;")).'</a>', array('style'=>''));
echo $actions;
echo '</div>';

@ -1890,15 +1890,18 @@ return 'application/octet-stream';
if (!is_string($content_html)) {
return false;
}
$table = Database :: get_course_table(TABLE_DOCUMENT);
$orig_source_html = DocumentManager::get_resources_from_source_html($content_html);
$orig_course_info = api_get_course_info($origin_course_code);
$orig_course_path = api_get_path(SYS_PATH).'courses/'.$orig_course_info['path'].'/';
$destination_course_code = CourseManager::get_course_id_from_path ($destination_course_directory);
$dest_course_path = api_get_path(SYS_COURSE_PATH).$destination_course_directory.'/';
$destination_course_info = api_get_course_info($destination_course_code);
foreach ($orig_source_html as $source) {
// get information about source url
$real_orig_url = $source[0]; // url
@ -1923,20 +1926,89 @@ return 'application/octet-stream';
if ($scope_url == 'local') {
if ( $type_url == 'abs' || $type_url == 'rel') {
$document_file = strstr($real_orig_path, 'document');
if (strpos($real_orig_path,$document_file) !== false) {
//var_dump($real_orig_path.' - '.$document_file);
if (strpos($real_orig_path, $document_file) !== false) {
$origin_filepath = $orig_course_path.$document_file;
$destination_filepath = $dest_course_path.$document_file;
// copy origin file inside destination course
// copy origin file inside destination course
$pos = strpos($document_file, '&amp;');
if ($pos !== false ) {
$document_file_fixed = substr($document_file,0, $pos);
} else {
$document_file_fixed = $document_file;
}
$pos = strpos($origin_filepath, '&amp;');
if ($pos !== false ) {
$origin_filepath = substr($origin_filepath, 0, $pos);
}
$pos = strpos($destination_filepath, '&amp;');
if ($pos !== false ) {
$destination_filepath = substr($destination_filepath, 0, $pos);
}
if (file_exists($origin_filepath)) {
$filepath_dir = dirname($destination_filepath);
$filepath_dir = dirname($destination_filepath);
if (!is_dir($filepath_dir)) {
$perm = api_get_permissions_for_new_directories();
@mkdir($filepath_dir, $perm, true);
}
$result = @mkdir($filepath_dir, $perm, true);
$pos = strpos($filepath_dir, 'document');
if ($pos !== false ) {
$filepath_dir = substr($filepath_dir, $pos+8);
$parts = explode('/', $filepath_dir );
}
if ($result) {
$my_path = '/';
foreach($parts as $part) {
if (empty($part)) {
continue;
}
$my_path .= $part;
$file_info = pathinfo($filepath_dir);
$sql = "INSERT INTO ".$table." SET
c_id = ".$destination_course_info['real_id'].",
path = '".Database::escape_string($my_path)."',
comment = '',
title = '".Database::escape_string(basename($my_path))."' ,
filetype = 'folder',
size = '0',
session_id = '0'";
Database::query($sql);
$document_id = Database::insert_id();
api_item_property_update($destination_course_info, TOOL_DOCUMENT, $document_id, 'ForderAdded', api_get_user_id(), 0,0, null, null, 0);
$my_path = $my_path.'/';
}
}
}
//var_dump($destination_filepath);
if (!file_exists($destination_filepath)) {
@copy($origin_filepath, $destination_filepath);
$result = @copy($origin_filepath, $destination_filepath);
if ($result) {
$file_info = pathinfo($destination_filepath);
$size = filesize($destination_filepath);
$sql = "INSERT INTO ".$table." SET
c_id = ".$destination_course_info['real_id'].",
path = '".Database::escape_string(substr($document_file_fixed,8))."',
comment = '',
title = '".Database::escape_string($file_info['basename'])."' ,
filetype = 'file',
size = '".$size."',
session_id = '0'";
Database::query($sql);
$document_id = Database::insert_id();
api_item_property_update($destination_course_info, TOOL_DOCUMENT, $document_id, 'DocumentAdded', api_get_user_id(), 0,0, null, null, 0);
}
}
}

@ -11,6 +11,7 @@ require_once api_get_path(LIBRARY_PATH).'tracking.lib.php';
require_once api_get_path(LIBRARY_PATH).'course.lib.php';
require_once api_get_path(LIBRARY_PATH).'usermanager.lib.php';
require_once api_get_path(LIBRARY_PATH).'pear/Spreadsheet_Excel_Writer/Writer.php';
require_once api_get_path(SYS_CODE_PATH).'newscorm/learnpath.class.php';
$filename = 'reporting.xls';
@ -23,125 +24,172 @@ $my_courses = CourseManager::get_course_list_of_user_as_course_admin($user_id);
$array = array();
$i = 0;
$session_id = 0;
if (!empty($my_courses)) {
foreach ($my_courses as $course) {
//Only show open courses
$course_info = api_get_course_info($course['course_code']);
//Only show open courses
if ($course_info['visibility'] == 0) {
continue;
}
}
//$array[$i]['course'] = $course;
$course_code = $course['course_code'];
$course_info = api_get_course_info($course_code);
$t_lp = Database :: get_course_table(TABLE_LP_MAIN, $course_info['dbName']);
$sql_lp = "SELECT lp.name, lp.id FROM $t_lp lp WHERE lp.session_id = 0 LIMIT 1";
$rs_lp = Database::query($sql_lp);
$array[$i]['lp'] = '';
if (Database :: num_rows($rs_lp) > 0) {
$learnpath = Database :: fetch_row($rs_lp);
$array[$i]['lp'] = $learnpath[0];
}
//$teachers = CourseManager::get_teacher_list_from_course_code($course_code);
$teacher_list = array($course_info['titular']);
$teachers = CourseManager::get_teacher_list_from_course_code($course_code);
$teacher_list = array();
$array[$i]['teachers'] = '';
/*
if (!empty($teachers)) {
foreach($teachers as $teacher) {
$teacher_list[]= $teacher['firstname'].' '.$teacher['lastname'];
}
$array[$i]['teachers'] = implode(', ', $teacher_list);
}
}
$array[$i]['course_name'] = $course['title'];
*/
$tmp_students = CourseManager :: get_student_list_from_course_code($course['course_code'], false);
//Cleaning students only REAL students
$students = array();
foreach ($tmp_students as $student) {
$user_info = api_get_user_info($student['user_id']);
if ($user_info['status'] != STUDENT) {
continue;
}
$students[] = $student['user_id'];
}
$students = CourseManager :: get_student_list_from_course_code($course['course_code'], false);
$count_students = 0;
$tools = 0;
$session_id = 0;
$count_students_accessing = 0;
$count_students_complete_all_activities = 0;
$count_students_complete_all_activities_at_50 = 0;
$total_time_spent = 0;
$total_tools = 0;
$total_average_progress = 0;
$t_lp = Database :: get_course_table(TABLE_LP_MAIN, $course_info['dbName']);
$sql_lp = "SELECT lp.name, lp.id FROM $t_lp lp WHERE lp.session_id = 0";
$rs_lp = Database::query($sql_lp);
$t_lpi = Database :: get_course_table(TABLE_LP_ITEM, $course_info['dbName']);
$t_news = Database :: get_course_table(TABLE_ANNOUNCEMENT, $course_info['dbName']);
/*
$total_tools_list = Tracking::get_tools_most_used_by_course($course_code, $session_id);
$total_tools = 0;
foreach($total_tools_list as $tool) {
$total_tools += $tool['count_access_tool'];
}*/
if (!empty($students)) {
foreach ($students as $student) {
$student_id = $student['user_id'];
$avg_student_progress += Tracking :: get_avg_student_progress($student_id, $course_code);
$myavg_temp = Tracking :: get_avg_student_score($student_id, $course_code);
if (Database :: num_rows($rs_lp) > 0) {
while ($learnpath = Database :: fetch_array($rs_lp)) {
$lp_id = $learnpath['id'];
$avg_progress_in_course = Tracking::get_avg_student_progress($student_id, $course_code, array(), $session_id);
if (intval($avg_progress_in_course) == 100) {
$count_students_complete_all_activities++;
$lp_items =
$array[$i]['lp'] = '<a href="'.api_get_path(WEB_CODE_PATH).'newscorm/lp_controller.php?cidReq='.$course_code.'&amp;action=view&amp;lp_id='.$lp_id.'" target="_blank">'.$learnpath['name'].'</a>';
$array[$i]['teachers'] = '';
if (!empty($teacher_list)) {
$array[$i]['teachers'] = implode(', ', $teacher_list);
}
if (intval($avg_progress_in_course) > 0 && intval($avg_progress_in_course) <= 50) {
$count_students_complete_all_activities_at_50 ++;
}
$total_average_progress +=$avg_progress_in_course;
$time_spent = Tracking::get_time_spent_on_the_course($student_id, $course_code, $session_id);
$total_time_spent += $time_spent;
if (!empty($time_spent)) {
$count_students_accessing++;
}
}
$student_list = array();
foreach($students as $student) {
$student_list []=$student['user_id'];
$array[$i]['course_name'] = $course['title'];
$count_students_accessing = 0;
$count_students_complete_all_activities = 0;
$count_students_complete_all_activities_at_50 = 0;
$total_time_spent = 0;
$total_average_progress = 0;
if (!empty($students)) {
foreach ($students as $student_id) {
$avg_student_progress = Tracking::get_avg_student_progress($student_id, $course_code, array($lp_id), $session_id);
$myavg_temp = Tracking::get_avg_student_score($student_id, $course_code, array($lp_id), $session_id);
$avg_progress_in_course = Tracking::get_avg_student_progress($student_id, $course_code, array($lp_id), $session_id);
if (intval($avg_progress_in_course) == 100) {
$count_students_complete_all_activities++;
}
if (intval($avg_progress_in_course) > 0 && intval($avg_progress_in_course) <= 50) {
$count_students_complete_all_activities_at_50 ++;
}
$total_average_progress +=$avg_progress_in_course;
$time_spent = Tracking::get_time_spent_on_the_course($student_id, $course_code, $session_id);
$total_time_spent += $time_spent;
if (!empty($time_spent)) {
$count_students_accessing++;
}
}
}
$student_count = count($students);
$array[$i]['count_students'] = $student_count;
$array[$i]['count_students_accessing'] = 0;
$array[$i]['count_students_accessing_percentage'] = 0;
$array[$i]['count_students_complete_all_activities_at_50'] = 0;
$array[$i]['count_students_complete_all_activities'] = 0;
$array[$i]['average_percentage_activities_completed_per_student'] = 0;
$array[$i]['total_time_spent'] = 0;
$array[$i]['average_time_spent_per_student'] = 0;
$array[$i]['total_time_spent'] = 0;
$array[$i]['average_time_spent_per_student'] = 0;
//$array[$i]['tools_used'] = 0;
$array[$i]['learnpath_docs'] = 0;
$array[$i]['learnpath_exercises'] = 0;
$array[$i]['learnpath_links'] = 0;
$array[$i]['learnpath_forums'] = 0;
$array[$i]['learnpath_assignments'] = 0;
//registering the number of each category of
//items in learning path
$sql_lpi = "SELECT lpi.item_type FROM $t_lpi lpi WHERE lpi.lp_id = $lp_id ORDER BY item_type";
$res_lpi = Database::query($sql_lpi);
while ($row_lpi = Database::fetch_array($res_lpi)) {
switch($row_lpi['item_type']) {
case 'document':
$array[$i]['learnpath_docs']++;
break;
case 'quiz':
$array[$i]['learnpath_exercises']++;
break;
case 'link':
$array[$i]['learnpath_links']++;
break;
case 'forum':
case 'thread':
$array[$i]['learnpath_forums']++;
break;
case 'student_publication':
$array[$i]['learnpath_assignments']++;
break;
}
}
// Count announcements
$array[$i]['total_announcements'] = 0;
$sql_news = "SELECT count(id) FROM $t_news";
$res_news = Database::query($sql_news);
while ($row_news = Database::fetch_array($res_news)) {
$array[$i]['total_announcements'] = $row_news[0];
}
//@todo don't know what means this value
$count_students_complete_all_activities_at_50 = 0;
if (!empty($student_count)) {
$array[$i]['count_students_accessing'] = $count_students_accessing;
$array[$i]['count_students_accessing_percentage'] = round($count_students_accessing / $student_count *100 , 0);
$array[$i]['count_students_complete_all_activities_at_50'] = $count_students_complete_all_activities;
$array[$i]['count_students_complete_all_activities'] = round($count_students_complete_all_activities / $student_count *100 , 0);;
$array[$i]['average_percentage_activities_completed_per_student'] = round($count_students_complete_all_activities/$student_count*100,2);
$array[$i]['total_time_spent'] = 0;
$array[$i]['average_time_spent_per_student'] = 0;
if (!empty($total_time_spent)) {
$array[$i]['total_time_spent'] = api_time_to_hms($total_time_spent);
$array[$i]['average_time_spent_per_student'] = api_time_to_hms($total_time_spent / $student_count);
}
}
$i++;
}
$nb_assignments = Tracking::count_student_assignments($student_list, $course_code, $session_id);
$messages = Tracking::count_student_messages($student_list, $course_code, $session_id);
$links = Tracking::count_student_visited_links($student_list, $course_code, $session_id);
$chat_last_connection = Tracking::chat_last_connection($student_list, $course_code, $session_id);
$documents = Tracking::count_student_downloaded_documents($student_list, $course_code, $session_id);
$total_tools += $nb_assignments + $messages + $links + $chat_last_connection + $documents;
}
$student_count = count($students);
$array[$i]['count_students'] = $student_count;
$array[$i]['count_students_accessing'] = 0;
$array[$i]['count_students_accessing_percentage'] = 0;
$array[$i]['count_students_complete_all_activities_at_50'] = 0;
$array[$i]['count_students_complete_all_activities'] = 0;
$array[$i]['average_percentage_activities_completed_per_student'] = 0;
$array[$i]['total_time_spent'] = 0;
$array[$i]['average_time_spent_per_student'] = 0;
$array[$i]['total_time_spent'] = 0;
$array[$i]['average_time_spent_per_student'] = 0;
$array[$i]['tools_used'] = 0;
//@todo don't know what means this value
$count_students_complete_all_activities_at_50 = 0;
if (!empty($student_count)) {
$array[$i]['count_students_accessing'] = $count_students_accessing;
$array[$i]['count_students_accessing_percentage'] = round($count_students_accessing / $student_count *100 , 0);
$array[$i]['count_students_complete_all_activities_at_50'] = $count_students_complete_all_activities;
$array[$i]['count_students_complete_all_activities'] = round($count_students_complete_all_activities / $student_count *100 , 0);;
$array[$i]['average_percentage_activities_completed_per_student'] = round($count_students_complete_all_activities/$student_count*100,2);
$array[$i]['total_time_spent'] = 0;
$array[$i]['average_time_spent_per_student'] = 0;
if (!empty($total_time_spent)) {
$array[$i]['total_time_spent'] = api_time_to_hms($total_time_spent);
$array[$i]['average_time_spent_per_student'] = api_time_to_hms($total_time_spent / $student_count);
}
$array[$i]['tools_used'] = $total_tools;
}
$i++;
}
}
@ -158,7 +206,12 @@ $headers = array(
get_lang('AverageOfActivitiesCompletedPerStudent'),
get_lang('TotalTimeSpentInTheCourse'),
get_lang('AverageTimePerStudentInCourse'),
get_lang('NumberOfToolsAddedOrUsedByTeachers')
get_lang('NumberOfDocumentsInLearnpath'),
get_lang('NumberOfExercisesInLearnpath'),
get_lang('NumberOfLinksInLearnpath'),
get_lang('NumberOfForumsInLearnpath'),
get_lang('NumberOfAssignmentsInLearnpath'),
get_lang('NumberOfAnnouncementsInCourse'),
);

@ -123,10 +123,17 @@ if ($is_platform_admin) {
$menu_items[] = Display::url(Display::return_icon('teacher.png', get_lang('TeacherInterface'), array(), 32), api_get_self().'?view=teacher');
$menu_items[] = Display::url(Display::return_icon('star_na.png', get_lang('AdminInterface'), array(), 32), api_get_self().'?view=admin');
$menu_items[] = Display::url(Display::return_icon('quiz.png', get_lang('ExamTracking'), array(), 32), api_get_path(WEB_CODE_PATH).'tracking/exams.php');
//$menu_items[] = Display::url(Display::return_icon('quiz.png', get_lang('CurrentCoursesReport'), array(), 32), api_get_path(WEB_CODE_PATH).'mySpace/current_courses.php');
} else {
$menu_items[] = Display::return_icon('teacher_na.png', get_lang('TeacherInterface'), array(), 32);
$menu_items[] = Display::url(Display::return_icon('star.png', get_lang('AdminInterface'), array(), 32), api_get_self().'?view=admin');
$menu_items[] = Display::url(Display::return_icon('quiz.png', get_lang('ExamTracking'), array(), 32), api_get_path(WEB_CODE_PATH).'tracking/exams.php');
//$menu_items[] = Display::url(Display::return_icon('quiz.png', get_lang('CurrentCoursesReport'), array(), 32), api_get_path(WEB_CODE_PATH).'mySpace/current_courses.php');
}
}

@ -210,7 +210,7 @@ class MySpace {
MySpace::display_user_overview_export_options();
$t_head .= ' <table style="width: 100%;border:0;padding:0;border-collapse:collapse;table-layout: fixed">';
$t_head .= ' <caption>'.get_lang('CourseInformation').'</caption>';
//$t_head .= ' <caption>'.get_lang('CourseInformation').'</caption>';
$t_head .= '<tr>';
$t_head .= ' <th width="155px" style="border-left:0;border-bottom:0"><span>'.get_lang('Course').'</span></th>';
$t_head .= ' <th style="padding:0;border-bottom:0"><span>'.cut(get_lang('AvgTimeSpentInTheCourse'), 6, true).'</span></th>';
@ -337,7 +337,7 @@ class MySpace {
//MySpace::display_user_overview_export_options();
$t_head .= ' <table style="width: 100%;border:0;padding:0;border-collapse:collapse;table-layout: fixed">';
$t_head .= ' <caption>'.get_lang('CourseInformation').'</caption>';
//$t_head .= ' <caption>'.get_lang('CourseInformation').'</caption>';
$t_head .= '<tr>';
$t_head .= ' <th style="padding:0;border-bottom:0"><span>'.cut(get_lang('AvgTimeSpentInTheCourse'), 6, true).'</span></th>';
$t_head .= ' <th style="padding:0;border-bottom:0"><span>'.cut(get_lang('AvgStudentsProgress'), 6, true).'</span></th>';
@ -684,7 +684,7 @@ class MySpace {
//MySpace::display_user_overview_export_options();
$t_head .= ' <table style="width: 100%;border:0;padding:0;border-collapse:collapse;table-layout: fixed">';
$t_head .= ' <caption>'.get_lang('CourseInformation').'</caption>';
//$t_head .= ' <caption>'.get_lang('CourseInformation').'</caption>';
$t_head .= '<tr>';
$t_head .= ' <th width="155px" style="border-left:0;border-bottom:0"><span>'.get_lang('Course').'</span></th>';
$t_head .= ' <th style="padding:0;border-bottom:0"><span>'.cut(get_lang('AvgTimeSpentInTheCourse'), 6, true).'</span></th>';

Loading…
Cancel
Save