Format code.

1.9.x
Julio Montoya 11 years ago
parent 25d05224dc
commit 6a10a2b111
  1. 7
      main/announcements/announcement_email.class.php
  2. 16
      main/announcements/announcements.inc.php
  3. 1057
      main/announcements/announcements.php
  4. 44
      main/announcements/download.php
  5. 17
      main/gradebook/exercise_jump.php
  6. 840
      main/gradebook/gradebook.php
  7. 75
      main/gradebook/gradebook_add_cat.php
  8. 22
      main/gradebook/gradebook_add_eval.php
  9. 6
      main/gradebook/gradebook_add_link.php
  10. 23
      main/gradebook/gradebook_add_link_select_course.php
  11. 47
      main/gradebook/gradebook_add_result.php
  12. 5
      main/gradebook/gradebook_add_user.php
  13. 39
      main/gradebook/gradebook_display_certificate.php
  14. 88
      main/gradebook/gradebook_edit_all.php
  15. 55
      main/gradebook/gradebook_edit_cat.php
  16. 90
      main/gradebook/gradebook_edit_eval.php
  17. 56
      main/gradebook/gradebook_edit_link.php
  18. 44
      main/gradebook/gradebook_edit_result.php
  19. 65
      main/gradebook/gradebook_flatview.php
  20. 474
      main/gradebook/gradebook_result.class.php
  21. 5
      main/gradebook/gradebook_scoring_system.php
  22. 28
      main/gradebook/gradebook_showlog_eval.php
  23. 14
      main/gradebook/gradebook_showlog_link.php
  24. 114
      main/gradebook/gradebook_statistics.php
  25. 11
      main/gradebook/gradebook_view_result.php
  26. 869
      main/gradebook/index.php
  27. 36
      main/gradebook/user_info.php
  28. 68
      main/gradebook/user_stats.php

@ -1,5 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Announcement Email
*
@ -245,9 +246,9 @@ class AnnouncementEmail
if (!empty($attachment)) {
$result .= '<br />';
$result .= Display::url(
$attachment['filename'],
api_get_path(WEB_CODE_PATH).'announcements/download.php?file='.basename($attachment['path']).'&'.$course_param
).'<br />';
$attachment['filename'],
api_get_path(WEB_CODE_PATH).'announcements/download.php?file='.basename($attachment['path']).'&'.$course_param
).'<br />';
}
$result .= '<hr />';

@ -224,12 +224,12 @@ class AnnouncementManager
global $stok;
$modify_icons .= "<a href=\"" . api_get_self() . "?" . api_get_cidreq() . "&origin=" . (!empty($_GET['origin']) ? Security::remove_XSS($_GET['origin']) : '') . "&action=showhide&id=" . $announcement_id . "&sec_token=" . $stok . "\">" .
Display::return_icon($image_visibility . '.png', $alt_visibility, '', ICON_SIZE_SMALL) . "</a>";
Display::return_icon($image_visibility . '.png', $alt_visibility, '', ICON_SIZE_SMALL) . "</a>";
if (api_is_allowed_to_edit(false, true)) {
$modify_icons .= "<a href=\"" . api_get_self() . "?" . api_get_cidreq() . "&action=delete&id=" . $announcement_id . "&sec_token=" . $stok . "\" onclick=\"javascript:if(!confirm('" . addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES, $charset)) . "')) return false;\">" .
Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL) .
"</a>";
Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL) .
"</a>";
}
echo "<tr><th style='text-align:right'>$modify_icons</th></tr>";
}
@ -522,8 +522,8 @@ class AnnouncementManager
}
/**
* @param int $announcementId
*/
* @param int $announcementId
*/
public static function addAnnouncementToAllUsersInSessions($announcementId)
{
$courseCode = api_get_course_id();
@ -720,7 +720,7 @@ class AnnouncementManager
$user_disabled = ($this_group['userNb'] > 0) ? "" : "disabled=disabled" ;
echo "<option $user_disabled value=\"GROUP:" . $this_group['id'] . "\">",
"G: ", $this_group['name'], " - " . $this_group['userNb'] . " " . $user_label .
"</option>";
"</option>";
}
}
}
@ -786,7 +786,7 @@ class AnnouncementManager
if (!is_array($to_already_selected) || !in_array("GROUP:" . $this_group['id'], $to_already_selected)) { // $to_already_selected is the array containing the groups (and users) that are already selected
echo "<option value=\"GROUP:" . $this_group['id'] . "\">",
"G: ", $this_group['name'], " &ndash; " . $this_group['userNb'] . " " . get_lang('Users') .
"</option>";
"</option>";
}
}
}
@ -1138,7 +1138,7 @@ class AnnouncementManager
$safe_new_file_name = Database::escape_string($new_file_name);
// Storing the attachments if any
$sql = 'INSERT INTO ' . $tbl_announcement_attachment . ' (c_id, filename, comment, path, announcement_id, size) ' .
"VALUES ($course_id, '$safe_file_name', '$file_comment', '$safe_new_file_name' , '$announcement_id', '" . intval($file['size']) . "' )";
"VALUES ($course_id, '$safe_file_name', '$file_comment', '$safe_new_file_name' , '$announcement_id', '" . intval($file['size']) . "' )";
$result = Database::query($sql);
$return = 1;
}

File diff suppressed because it is too large Load Diff

@ -1,17 +1,13 @@
<?php
/* For licensing terms, see /license.txt */
/**
* This file is responsible for passing requested documents to the browser.
* Html files are parsed to fix a few problems with URLs,
* but this code will hopefully be replaced soon by an Apache URL
* rewrite mechanism.
*
* @package chamilo.announcements
*/
/*
MAIN CODE
*/
* This file is responsible for passing requested documents to the browser.
* Html files are parsed to fix a few problems with URLs,
* but this code will hopefully be replaced soon by an Apache URL
* rewrite mechanism.
*
* @package chamilo.announcements
*/
session_cache_limiter('nocache');
@ -34,25 +30,25 @@ $doc_url = str_replace(' ', '+', $doc_url);
$doc_url = str_replace('/..', '', $doc_url); //echo $doc_url;
if (strpos($doc_url,'../') OR strpos($doc_url,'/..')) {
$doc_url = '';
$doc_url = '';
}
if (!isset($_course)) {
api_not_allowed(true);
api_not_allowed(true);
}
$full_file_name = api_get_path(SYS_COURSE_PATH).api_get_course_path().'/upload/announcements/'.$doc_url;
//if the rewrite rule asks for a directory, we redirect to the document explorer
if (is_dir($full_file_name)) {
//remove last slash if present
//$doc_url = ($doc_url{strlen($doc_url)-1}=='/')?substr($doc_url,0,strlen($doc_url)-1):$doc_url;
//mod_rewrite can change /some/path/ to /some/path// in some cases, so clean them all off (René)
while ($doc_url{$dul = strlen($doc_url)-1}=='/') $doc_url = substr($doc_url,0,$dul);
//create the path
$document_explorer = api_get_path(WEB_COURSE_PATH).api_get_course_path(); // home course path
//redirect
header('Location: '.$document_explorer);
//remove last slash if present
//$doc_url = ($doc_url{strlen($doc_url)-1}=='/')?substr($doc_url,0,strlen($doc_url)-1):$doc_url;
//mod_rewrite can change /some/path/ to /some/path// in some cases, so clean them all off (René)
while ($doc_url{$dul = strlen($doc_url)-1}=='/') $doc_url = substr($doc_url,0,$dul);
//create the path
$document_explorer = api_get_path(WEB_COURSE_PATH).api_get_course_path(); // home course path
//redirect
header('Location: '.$document_explorer);
}
$tbl_announcement_attachment = Database::get_course_table(TABLE_ANNOUNCEMENT_ATTACHMENT);
@ -71,8 +67,10 @@ $result= Database::query($sql);
if (Database::num_rows($result) > 0) {
$row= Database::fetch_array($result);
$title = str_replace(' ','_', $row['filename']);
if (Security::check_abs_path($full_file_name, api_get_path(SYS_COURSE_PATH).api_get_course_path().'/upload/announcements/')) {
if (Security::check_abs_path($full_file_name,
api_get_path(SYS_COURSE_PATH) . api_get_course_path() . '/upload/announcements/')
) {
DocumentManager::file_send_for_download($full_file_name,TRUE, $title);
}
}
exit;
exit;

@ -9,9 +9,6 @@
* @author Bert Steppé
* @package chamilo.gradebook
*/
/**
* Init
*/
require_once '../inc/global.inc.php';
api_block_anonymous_users();
@ -39,12 +36,12 @@ $_course['name'] = $course_title;
$_course['official_code'] = $course_code;
if (isset($_GET['doexercise'])) {
header('Location: '.$doExerciseUrl);
exit;
header('Location: '.$doExerciseUrl);
exit;
} else {
if (isset($_GET['gradebook'])) {
$add_url = '&gradebook=view&exerciseId='.intval($_GET['exerciseId']);
}
header('Location: '.api_get_path(WEB_CODE_PATH).'exercice/overview.php?session_id='.$session_id.'&cidReq='.Security::remove_XSS($cidReq).'&'.$add_url);
exit;
if (isset($_GET['gradebook'])) {
$add_url = '&gradebook=view&exerciseId='.intval($_GET['exerciseId']);
}
header('Location: '.api_get_path(WEB_CODE_PATH).'exercice/overview.php?session_id='.$session_id.'&cidReq='.Security::remove_XSS($cidReq).'&'.$add_url);
exit;
}

@ -4,9 +4,7 @@
* Script
* @package chamilo.gradebook
*/
/**
* Init
*/
$language_file= 'gradebook';
// $cidReset : This is the main difference with gradebook.php, here we say,
// basically, that we are inside a course, and many things depend from that
@ -15,12 +13,12 @@ $_in_course = false;
//make sure the destination for scripts is index.php instead of gradebook.php
require_once '../inc/global.inc.php';
if (!empty($_GET['course'])) {
$_SESSION['gradebook_dest'] = 'index.php';
$this_section = SECTION_COURSES;
$_SESSION['gradebook_dest'] = 'index.php';
$this_section = SECTION_COURSES;
} else {
$_SESSION['gradebook_dest'] = 'gradebook.php';
$this_section = SECTION_MYGRADEBOOK;
unset($_GET['course']);
$_SESSION['gradebook_dest'] = 'gradebook.php';
$this_section = SECTION_MYGRADEBOOK;
unset($_GET['course']);
}
require_once 'lib/be.inc.php';
require_once 'lib/scoredisplay.class.php';
@ -60,541 +58,541 @@ $filter_warning_msg = true;
//this is called when there is no data for the course admin
if (isset ($_GET['createallcategories'])) {
block_students();
$coursecat= Category :: get_not_created_course_categories(api_get_user_id());
if (!count($coursecat) == 0) {
foreach ($coursecat as $row) {
$cat= new Category();
$cat->set_name($row[1]);
$cat->set_course_code($row[0]);
$cat->set_description(null);
$cat->set_user_id(api_get_user_id());
$cat->set_parent_id(0);
$cat->set_weight(0);
$cat->set_visible(0);
$cat->add();
unset ($cat);
}
}
header('Location: '.$_SESSION['gradebook_dest'].'?addallcat=&selectcat=0');
exit;
block_students();
$coursecat= Category :: get_not_created_course_categories(api_get_user_id());
if (!count($coursecat) == 0) {
foreach ($coursecat as $row) {
$cat= new Category();
$cat->set_name($row[1]);
$cat->set_course_code($row[0]);
$cat->set_description(null);
$cat->set_user_id(api_get_user_id());
$cat->set_parent_id(0);
$cat->set_weight(0);
$cat->set_visible(0);
$cat->add();
unset ($cat);
}
}
header('Location: '.$_SESSION['gradebook_dest'].'?addallcat=&selectcat=0');
exit;
}
//move a category
$selectcat=isset($_GET['selectcat']) ? Security::remove_XSS($_GET['selectcat']) : '';
if (isset ($_GET['movecat'])) {
$move_cat=Security::remove_XSS($_GET['movecat']);
block_students();
$cats= Category :: load($move_cat);
if (!isset ($_GET['targetcat'])) {
$move_form= new CatForm(CatForm :: TYPE_MOVE,
$cats[0],
'move_cat_form',
null,
api_get_self() . '?movecat=' . $move_cat
. '&selectcat=' . Security::remove_XSS($_GET['selectcat']));
if ($move_form->validate()) {
header('Location: ' . api_get_self() . '?selectcat=' . Security::remove_XSS($_GET['selectcat'])
. '&movecat=' . $move_cat
. '&targetcat=' . $move_form->exportValue('move_cat'));
exit;
}
} else {
$get_target_cat=Security::remove_XSS($_GET['targetcat']);
$targetcat= Category :: load($get_target_cat);
$course_to_crsind = ($cats[0]->get_course_code() != null && $targetcat[0]->get_course_code() == null);
$move_cat=Security::remove_XSS($_GET['movecat']);
block_students();
$cats= Category :: load($move_cat);
if (!isset ($_GET['targetcat'])) {
$move_form= new CatForm(CatForm :: TYPE_MOVE,
$cats[0],
'move_cat_form',
null,
api_get_self() . '?movecat=' . $move_cat
. '&selectcat=' . Security::remove_XSS($_GET['selectcat']));
if ($move_form->validate()) {
header('Location: ' . api_get_self() . '?selectcat=' . Security::remove_XSS($_GET['selectcat'])
. '&movecat=' . $move_cat
. '&targetcat=' . $move_form->exportValue('move_cat'));
exit;
}
} else {
$get_target_cat=Security::remove_XSS($_GET['targetcat']);
$targetcat= Category :: load($get_target_cat);
$course_to_crsind = ($cats[0]->get_course_code() != null && $targetcat[0]->get_course_code() == null);
if (!($course_to_crsind && !isset($_GET['confirm']))) {
$cats[0]->move_to_cat($targetcat[0]);
header('Location: ' . api_get_self() . '?categorymoved=&selectcat=' . Security::remove_XSS($_GET['selectcat']));
exit;
}
unset ($targetcat);
}
unset ($cats);
if (!($course_to_crsind && !isset($_GET['confirm']))) {
$cats[0]->move_to_cat($targetcat[0]);
header('Location: ' . api_get_self() . '?categorymoved=&selectcat=' . Security::remove_XSS($_GET['selectcat']));
exit;
}
unset ($targetcat);
}
unset ($cats);
}
//move an evaluation
if (isset ($_GET['moveeval'])) {
block_students();
$get_move_eval=Security::remove_XSS($_GET['moveeval']);
$evals= Evaluation :: load($get_move_eval);
if (!isset ($_GET['targetcat'])) {
block_students();
$get_move_eval=Security::remove_XSS($_GET['moveeval']);
$evals= Evaluation :: load($get_move_eval);
if (!isset ($_GET['targetcat'])) {
$move_form= new EvalForm(EvalForm :: TYPE_MOVE,
$evals[0],
null,
'move_eval_form',
null,
api_get_self() . '?moveeval=' . $get_move_eval
. '&selectcat=' . Security::remove_XSS($_GET['selectcat']));
$move_form= new EvalForm(EvalForm :: TYPE_MOVE,
$evals[0],
null,
'move_eval_form',
null,
api_get_self() . '?moveeval=' . $get_move_eval
. '&selectcat=' . Security::remove_XSS($_GET['selectcat']));
if ($move_form->validate()) {
header('Location: ' .api_get_self() . '?selectcat=' . Security::remove_XSS($_GET['selectcat'])
. '&moveeval=' . $get_move_eval
. '&targetcat=' . $move_form->exportValue('move_cat'));
exit;
}
} else {
$get_target_cat=Security::remove_XSS($_GET['targetcat']);
$targetcat= Category :: load($get_target_cat);
$course_to_crsind = ($evals[0]->get_course_code() != null && $targetcat[0]->get_course_code() == null);
if ($move_form->validate()) {
header('Location: ' .api_get_self() . '?selectcat=' . Security::remove_XSS($_GET['selectcat'])
. '&moveeval=' . $get_move_eval
. '&targetcat=' . $move_form->exportValue('move_cat'));
exit;
}
} else {
$get_target_cat=Security::remove_XSS($_GET['targetcat']);
$targetcat= Category :: load($get_target_cat);
$course_to_crsind = ($evals[0]->get_course_code() != null && $targetcat[0]->get_course_code() == null);
if (!($course_to_crsind && !isset($_GET['confirm']))) {
$evals[0]->move_to_cat($targetcat[0]);
header('Location: ' . api_get_self() . '?evaluationmoved=&selectcat=' . Security::remove_XSS($_GET['selectcat']));
exit;
}
unset ($targetcat);
}
unset ($evals);
if (!($course_to_crsind && !isset($_GET['confirm']))) {
$evals[0]->move_to_cat($targetcat[0]);
header('Location: ' . api_get_self() . '?evaluationmoved=&selectcat=' . Security::remove_XSS($_GET['selectcat']));
exit;
}
unset ($targetcat);
}
unset ($evals);
}
//move a link
if (isset ($_GET['movelink'])) {
block_students();
$get_move_link=Security::remove_XSS($_GET['movelink']);
$link= LinkFactory :: load($get_move_link);
$move_form= new LinkForm(LinkForm :: TYPE_MOVE, null, $link[0], 'move_link_form', null, api_get_self() . '?movelink=' . $get_move_link . '&selectcat=' . Security::remove_XSS($_GET['selectcat']));
if ($move_form->validate()) {
$targetcat= Category :: load($move_form->exportValue('move_cat'));
$link[0]->move_to_cat($targetcat[0]);
unset ($link);
header('Location: ' . api_get_self(). '?linkmoved=&selectcat=' . Security::remove_XSS($_GET['selectcat']));
exit;
}
block_students();
$get_move_link=Security::remove_XSS($_GET['movelink']);
$link= LinkFactory :: load($get_move_link);
$move_form= new LinkForm(LinkForm :: TYPE_MOVE, null, $link[0], 'move_link_form', null, api_get_self() . '?movelink=' . $get_move_link . '&selectcat=' . Security::remove_XSS($_GET['selectcat']));
if ($move_form->validate()) {
$targetcat= Category :: load($move_form->exportValue('move_cat'));
$link[0]->move_to_cat($targetcat[0]);
unset ($link);
header('Location: ' . api_get_self(). '?linkmoved=&selectcat=' . Security::remove_XSS($_GET['selectcat']));
exit;
}
}
//parameters for categories
if (isset ($_GET['visiblecat'])) {
block_students();
if (isset ($_GET['set_visible'])) {
$visibility_command= 1;
} else {
$visibility_command= 0;
}
$cats= Category :: load($_GET['visiblecat']);
$cats[0]->set_visible($visibility_command);
$cats[0]->save();
$cats[0]->apply_visibility_to_children();
unset ($cats);
if ($visibility_command) {
$confirmation_message = get_lang('ViMod');
$filter_confirm_msg = false;
} else {
$confirmation_message = get_lang('InViMod');
$filter_confirm_msg = false;
}
block_students();
if (isset ($_GET['set_visible'])) {
$visibility_command= 1;
} else {
$visibility_command= 0;
}
$cats= Category :: load($_GET['visiblecat']);
$cats[0]->set_visible($visibility_command);
$cats[0]->save();
$cats[0]->apply_visibility_to_children();
unset ($cats);
if ($visibility_command) {
$confirmation_message = get_lang('ViMod');
$filter_confirm_msg = false;
} else {
$confirmation_message = get_lang('InViMod');
$filter_confirm_msg = false;
}
}
if (isset ($_GET['deletecat'])) {
block_students();
$cats= Category :: load($_GET['deletecat']);
//delete all categories,subcategories and results
if ($cats[0] != null) {
if ($cats[0]->get_id() != 0) {
// better don't try to delete the root...
$cats[0]->delete_all();
}
}
$confirmation_message = get_lang('CategoryDeleted');
$filter_confirm_msg = false;
block_students();
$cats= Category :: load($_GET['deletecat']);
//delete all categories,subcategories and results
if ($cats[0] != null) {
if ($cats[0]->get_id() != 0) {
// better don't try to delete the root...
$cats[0]->delete_all();
}
}
$confirmation_message = get_lang('CategoryDeleted');
$filter_confirm_msg = false;
}
//parameters for evaluations
if (isset ($_GET['visibleeval'])) {
block_students();
if (isset ($_GET['set_visible'])) {
$visibility_command= 1;
} else {
$visibility_command= 0;
}
block_students();
if (isset ($_GET['set_visible'])) {
$visibility_command= 1;
} else {
$visibility_command= 0;
}
$eval= Evaluation :: load($_GET['visibleeval']);
$eval[0]->set_visible($visibility_command);
$eval[0]->save();
unset ($eval);
if ($visibility_command) {
$confirmation_message = get_lang('ViMod');
$filter_confirm_msg = false;
} else {
$confirmation_message = get_lang('InViMod');
$filter_confirm_msg = false;
}
$eval= Evaluation :: load($_GET['visibleeval']);
$eval[0]->set_visible($visibility_command);
$eval[0]->save();
unset ($eval);
if ($visibility_command) {
$confirmation_message = get_lang('ViMod');
$filter_confirm_msg = false;
} else {
$confirmation_message = get_lang('InViMod');
$filter_confirm_msg = false;
}
}
if (isset ($_GET['deleteeval'])) {
block_students();
$eval= Evaluation :: load($_GET['deleteeval']);
if ($eval[0] != null) {
$eval[0]->delete_with_results();
}
$confirmation_message = get_lang('GradebookEvaluationDeleted');
$filter_confirm_msg = false;
block_students();
$eval= Evaluation :: load($_GET['deleteeval']);
if ($eval[0] != null) {
$eval[0]->delete_with_results();
}
$confirmation_message = get_lang('GradebookEvaluationDeleted');
$filter_confirm_msg = false;
}
//parameters for links
if (isset ($_GET['visiblelink'])) {
block_students();
if (isset ($_GET['set_visible'])) {
$visibility_command= 1;
}else {
$visibility_command= 0;
}
$link= LinkFactory :: load($_GET['visiblelink']);
$link[0]->set_visible($visibility_command);
$link[0]->save();
unset ($link);
if ($visibility_command) {
$confirmation_message = get_lang('ViMod');
$filter_confirm_msg = false;
} else {
$confirmation_message = get_lang('InViMod');
$filter_confirm_msg = false;
}
block_students();
if (isset ($_GET['set_visible'])) {
$visibility_command= 1;
}else {
$visibility_command= 0;
}
$link= LinkFactory :: load($_GET['visiblelink']);
$link[0]->set_visible($visibility_command);
$link[0]->save();
unset ($link);
if ($visibility_command) {
$confirmation_message = get_lang('ViMod');
$filter_confirm_msg = false;
} else {
$confirmation_message = get_lang('InViMod');
$filter_confirm_msg = false;
}
}
if (isset ($_GET['deletelink'])) {
block_students();
//fixing #5229
if (!empty($_GET['deletelink'])) {
$link= LinkFactory :: load($_GET['deletelink']);
if ($link[0] != null) {
$link[0]->delete();
}
unset ($link);
$confirmation_message = get_lang('LinkDeleted');
$filter_confirm_msg = false;
}
block_students();
//fixing #5229
if (!empty($_GET['deletelink'])) {
$link= LinkFactory :: load($_GET['deletelink']);
if ($link[0] != null) {
$link[0]->delete();
}
unset ($link);
$confirmation_message = get_lang('LinkDeleted');
$filter_confirm_msg = false;
}
}
$course_to_crsind = isset ($course_to_crsind) ? $course_to_crsind : '';
if ($course_to_crsind && !isset($_GET['confirm'])) {
block_students();
if (!isset($_GET['movecat']) && !isset($_GET['moveeval'])) {
die ('Error: movecat or moveeval not defined');
}
$button = '<form name="confirm"
block_students();
if (!isset($_GET['movecat']) && !isset($_GET['moveeval'])) {
die ('Error: movecat or moveeval not defined');
}
$button = '<form name="confirm"
method="post"
action="'.api_get_self() .'?confirm='
.(isset($_GET['movecat']) ? '&movecat=' . Security::remove_XSS($_GET['movecat'])
: '&moveeval=' . Security::remove_XSS($_GET['moveeval']) )
.'&selectcat=' . Security::remove_XSS($_GET['selectcat'])
.'&targetcat=' . Security::remove_XSS($_GET['targetcat']).'">
.(isset($_GET['movecat']) ? '&movecat=' . Security::remove_XSS($_GET['movecat'])
: '&moveeval=' . Security::remove_XSS($_GET['moveeval']) )
.'&selectcat=' . Security::remove_XSS($_GET['selectcat'])
.'&targetcat=' . Security::remove_XSS($_GET['targetcat']).'">
<input type="submit" value="'.' '.get_lang('Ok').' '.'">
</form>';
$warning_message = get_lang('MoveWarning').'<br><br>'.$button;
$filter_warning_msg = false;
$warning_message = get_lang('MoveWarning').'<br><br>'.$button;
$filter_warning_msg = false;
}
//actions on the sortabletable
if (isset ($_POST['action'])) {
block_students();
$number_of_selected_items= count($_POST['id']);
if ($number_of_selected_items == '0') {
$warning_message = get_lang('NoItemsSelected');
$filter_warning_msg = false;
}
else {
switch ($_POST['action']) {
case 'deleted' :
$number_of_deleted_categories= 0;
$number_of_deleted_evaluations= 0;
$number_of_deleted_links= 0;
foreach ($_POST['id'] as $indexstr) {
if (api_substr($indexstr, 0, 4) == 'CATE') {
$cats= Category :: load(api_substr($indexstr, 4));
if ($cats[0] != null) {
$cats[0]->delete_all();
}
$number_of_deleted_categories++;
}
if (api_substr($indexstr, 0, 4) == 'EVAL') {
$eval= Evaluation :: load(api_substr($indexstr, 4));
if ($eval[0] != null) {
$eval[0]->delete_with_results();
}
$number_of_deleted_evaluations++;
}
if (api_substr($indexstr, 0, 4) == 'LINK') {
$id = api_substr($indexstr, 4);
if (!empty($id)) {
$link= LinkFactory :: load();
if ($link[0] != null) {
$link[0]->delete();
}
$number_of_deleted_links++;
}
}
}
$confirmation_message = get_lang('DeletedCategories') . ' : <b>' . $number_of_deleted_categories . '</b><br />' . get_lang('DeletedEvaluations') . ' : <b>' . $number_of_deleted_evaluations . '</b><br />' . get_lang('DeletedLinks') . ' : <b>' . $number_of_deleted_links . '</b><br /><br />' . get_lang('TotalItems') . ' : <b>' . $number_of_selected_items . '</b>';
$filter_confirm_msg = false;
break;
case 'setvisible' :
foreach ($_POST['id'] as $indexstr)
{
if (api_substr($indexstr, 0, 4) == 'CATE')
{
$cats= Category :: load(api_substr($indexstr, 4));
$cats[0]->set_visible(1);
$cats[0]->save();
$cats[0]->apply_visibility_to_children();
}
if (api_substr($indexstr, 0, 4) == 'EVAL')
{
$eval= Evaluation :: load(api_substr($indexstr, 4));
$eval[0]->set_visible(1);
$eval[0]->save();
}
if (api_substr($indexstr, 0, 4) == 'LINK')
{
$link= LinkFactory :: load(api_substr($indexstr, 4));
$link[0]->set_visible(1);
$link[0]->save();
}
}
$confirmation_message = get_lang('ItemsVisible');
$filter_confirm_msg = false;
break;
case 'setinvisible' :
foreach ($_POST['id'] as $indexstr)
{
if (api_substr($indexstr, 0, 4) == 'CATE')
{
$cats= Category :: load(api_substr($indexstr, 4));
$cats[0]->set_visible(0);
$cats[0]->save();
$cats[0]->apply_visibility_to_children();
}
if (api_substr($indexstr, 0, 4) == 'EVAL')
{
$eval= Evaluation :: load(api_substr($indexstr, 4));
$eval[0]->set_visible(0);
$eval[0]->save();
}
if (api_substr($indexstr, 0, 4) == 'LINK')
{
$link= LinkFactory :: load(api_substr($indexstr, 4));
$link[0]->set_visible(0);
$link[0]->save();
}
}
$confirmation_message = get_lang('ItemsInVisible');
$filter_confirm_msg = false;
break;
}
}
block_students();
$number_of_selected_items= count($_POST['id']);
if ($number_of_selected_items == '0') {
$warning_message = get_lang('NoItemsSelected');
$filter_warning_msg = false;
}
else {
switch ($_POST['action']) {
case 'deleted' :
$number_of_deleted_categories= 0;
$number_of_deleted_evaluations= 0;
$number_of_deleted_links= 0;
foreach ($_POST['id'] as $indexstr) {
if (api_substr($indexstr, 0, 4) == 'CATE') {
$cats= Category :: load(api_substr($indexstr, 4));
if ($cats[0] != null) {
$cats[0]->delete_all();
}
$number_of_deleted_categories++;
}
if (api_substr($indexstr, 0, 4) == 'EVAL') {
$eval= Evaluation :: load(api_substr($indexstr, 4));
if ($eval[0] != null) {
$eval[0]->delete_with_results();
}
$number_of_deleted_evaluations++;
}
if (api_substr($indexstr, 0, 4) == 'LINK') {
$id = api_substr($indexstr, 4);
if (!empty($id)) {
$link= LinkFactory :: load();
if ($link[0] != null) {
$link[0]->delete();
}
$number_of_deleted_links++;
}
}
}
$confirmation_message = get_lang('DeletedCategories') . ' : <b>' . $number_of_deleted_categories . '</b><br />' . get_lang('DeletedEvaluations') . ' : <b>' . $number_of_deleted_evaluations . '</b><br />' . get_lang('DeletedLinks') . ' : <b>' . $number_of_deleted_links . '</b><br /><br />' . get_lang('TotalItems') . ' : <b>' . $number_of_selected_items . '</b>';
$filter_confirm_msg = false;
break;
case 'setvisible' :
foreach ($_POST['id'] as $indexstr)
{
if (api_substr($indexstr, 0, 4) == 'CATE')
{
$cats= Category :: load(api_substr($indexstr, 4));
$cats[0]->set_visible(1);
$cats[0]->save();
$cats[0]->apply_visibility_to_children();
}
if (api_substr($indexstr, 0, 4) == 'EVAL')
{
$eval= Evaluation :: load(api_substr($indexstr, 4));
$eval[0]->set_visible(1);
$eval[0]->save();
}
if (api_substr($indexstr, 0, 4) == 'LINK')
{
$link= LinkFactory :: load(api_substr($indexstr, 4));
$link[0]->set_visible(1);
$link[0]->save();
}
}
$confirmation_message = get_lang('ItemsVisible');
$filter_confirm_msg = false;
break;
case 'setinvisible' :
foreach ($_POST['id'] as $indexstr)
{
if (api_substr($indexstr, 0, 4) == 'CATE')
{
$cats= Category :: load(api_substr($indexstr, 4));
$cats[0]->set_visible(0);
$cats[0]->save();
$cats[0]->apply_visibility_to_children();
}
if (api_substr($indexstr, 0, 4) == 'EVAL')
{
$eval= Evaluation :: load(api_substr($indexstr, 4));
$eval[0]->set_visible(0);
$eval[0]->save();
}
if (api_substr($indexstr, 0, 4) == 'LINK')
{
$link= LinkFactory :: load(api_substr($indexstr, 4));
$link[0]->set_visible(0);
$link[0]->save();
}
}
$confirmation_message = get_lang('ItemsInVisible');
$filter_confirm_msg = false;
break;
}
}
}
if (isset ($_POST['submit']) && isset ($_POST['keyword'])) {
header('Location: ' . api_get_self() . '?selectcat=' . Security::remove_XSS($_GET['selectcat'])
. '&search='.Security::remove_XSS($_POST['keyword']));
exit;
header('Location: ' . api_get_self() . '?selectcat=' . Security::remove_XSS($_GET['selectcat'])
. '&search='.Security::remove_XSS($_POST['keyword']));
exit;
}
// DISPLAY HEADERS AND MESSAGES -
if (!isset($_GET['exportpdf']) and !isset($_GET['export_certificate'])) {
if (isset ($_GET['studentoverview'])) {
$interbreadcrumb[]= array (
'url' => $_SESSION['gradebook_dest'].'?selectcat=' . Security::remove_XSS($_GET['selectcat']),
'name' => get_lang('ToolGradebook')
);
Display :: display_header(get_lang('FlatView'));
} elseif (isset ($_GET['search'])) {
if ($_SESSION['gradebook_dest'] == 'index.php') {
$gradebook_dest = Security::remove_XSS($_SESSION['gradebook_dest']).'?cidReq='.Security::remove_XSS($_GET['course']).'&amp;';
} else {
$gradebook_dest = Security::remove_XSS($_SESSION['gradebook_dest']);
}
$interbreadcrumb[]= array ('url' => $gradebook_dest,'name' => get_lang('Gradebook'));
if (isset ($_GET['studentoverview'])) {
$interbreadcrumb[]= array (
'url' => $_SESSION['gradebook_dest'].'?selectcat=' . Security::remove_XSS($_GET['selectcat']),
'name' => get_lang('ToolGradebook')
);
Display :: display_header(get_lang('FlatView'));
} elseif (isset ($_GET['search'])) {
if ($_SESSION['gradebook_dest'] == 'index.php') {
$gradebook_dest = Security::remove_XSS($_SESSION['gradebook_dest']).'?cidReq='.Security::remove_XSS($_GET['course']).'&amp;';
} else {
$gradebook_dest = Security::remove_XSS($_SESSION['gradebook_dest']);
}
if ((isset($_GET['selectcat']) && $_GET['selectcat']>0)) {
if (!empty($_GET['course'])) {
$interbreadcrumb[]= array ('url' => $gradebook_dest.'selectcat='.Security::remove_XSS($_GET['selectcat']),'name' => get_lang('Details'));
} else {
$interbreadcrumb[]= array ('url' => $_SESSION['gradebook_dest'].'?selectcat=0','name' => get_lang('Details'));
}
}
Display :: display_header('');
} else {
Display :: display_header('');
}
$interbreadcrumb[]= array ('url' => $gradebook_dest,'name' => get_lang('Gradebook'));
if ((isset($_GET['selectcat']) && $_GET['selectcat']>0)) {
if (!empty($_GET['course'])) {
$interbreadcrumb[]= array ('url' => $gradebook_dest.'selectcat='.Security::remove_XSS($_GET['selectcat']),'name' => get_lang('Details'));
} else {
$interbreadcrumb[]= array ('url' => $_SESSION['gradebook_dest'].'?selectcat=0','name' => get_lang('Details'));
}
}
Display :: display_header('');
} else {
Display :: display_header('');
}
}
if (isset ($_GET['categorymoved'])) {
Display :: display_confirmation_message(get_lang('CategoryMoved'),false);
Display :: display_confirmation_message(get_lang('CategoryMoved'),false);
}
if (isset ($_GET['evaluationmoved'])) {
Display :: display_confirmation_message(get_lang('EvaluationMoved'),false);
Display :: display_confirmation_message(get_lang('EvaluationMoved'),false);
}
if (isset ($_GET['linkmoved'])) {
Display :: display_confirmation_message(get_lang('LinkMoved'),false);
Display :: display_confirmation_message(get_lang('LinkMoved'),false);
}
if (isset ($_GET['addcat'])) {
Display :: display_confirmation_message(get_lang('CategoryAdded'),false);
Display :: display_confirmation_message(get_lang('CategoryAdded'),false);
}
if (isset ($_GET['linkadded'])) {
Display :: display_confirmation_message(get_lang('LinkAdded'),false);
Display :: display_confirmation_message(get_lang('LinkAdded'),false);
}
if (isset ($_GET['addresult'])) {
Display :: display_confirmation_message(get_lang('ResultAdded'),false);
Display :: display_confirmation_message(get_lang('ResultAdded'),false);
}
if (isset ($_GET['editcat'])) {
Display :: display_confirmation_message(get_lang('CategoryEdited'),false);
Display :: display_confirmation_message(get_lang('CategoryEdited'),false);
}
if (isset ($_GET['editeval'])) {
Display :: display_confirmation_message(get_lang('EvaluationEdited'),false);
Display :: display_confirmation_message(get_lang('EvaluationEdited'),false);
}
if (isset ($_GET['linkedited'])) {
Display :: display_confirmation_message(get_lang('LinkEdited'),false);
Display :: display_confirmation_message(get_lang('LinkEdited'),false);
}
if (isset ($_GET['nolinkitems'])) {
Display :: display_warning_message(get_lang('NoLinkItems'),false);
Display :: display_warning_message(get_lang('NoLinkItems'),false);
}
if (isset ($_GET['addallcat'])) {
Display :: display_normal_message(get_lang('AddAllCat'),false);
Display :: display_normal_message(get_lang('AddAllCat'),false);
}
if (isset ($confirmation_message)) {
Display :: display_confirmation_message($confirmation_message,$filter_confirm_msg);
Display :: display_confirmation_message($confirmation_message,$filter_confirm_msg);
}
if (isset ($warning_message)) {
Display :: display_warning_message($warning_message,$filter_warning_msg);
Display :: display_warning_message($warning_message,$filter_warning_msg);
}
if (isset ($move_form)) {
Display :: display_normal_message($move_form->toHtml(),false);
Display :: display_normal_message($move_form->toHtml(),false);
}
// LOAD DATA & DISPLAY TABLE -
$is_platform_admin= api_is_platform_admin();
$is_course_admin= api_is_allowed_to_edit();
//load data for category, evaluation and links
if (!isset ($_GET['selectcat']) || empty ($_GET['selectcat'])) {
$category= 0;
} else {
$category= Security::remove_XSS($_GET['selectcat']);
}
$category= 0;
} else {
$category= Security::remove_XSS($_GET['selectcat']);
}
// search form
$simple_search_form= new UserForm(UserForm :: TYPE_SIMPLE_SEARCH, null, 'simple_search_form', null, api_get_self() . '?selectcat=' . $selectcat);
$values= $simple_search_form->exportValues();
$keyword = '';
if (isset($_GET['search']) && !empty($_GET['search'])) {
$keyword = Security::remove_XSS($_GET['search']);
$keyword = Security::remove_XSS($_GET['search']);
}
if ($simple_search_form->validate() && (empty($keyword))) {
$keyword = $values['keyword'];
$keyword = $values['keyword'];
}
if (!empty($keyword)) {
$cats= Category :: load($category);
$allcat= array ();
if ((isset($_GET['selectcat']) && $_GET['selectcat']==0) && isset($_GET['search'])) {
$allcat= $cats[0]->get_subcategories(null);
$allcat_info = Category :: find_category($keyword,$allcat);
$alleval=array();
$alllink=array();
} else {
$alleval = Evaluation :: find_evaluations($keyword, $cats[0]->get_id());
$alllink = LinkFactory :: find_links($keyword, $cats[0]->get_id());
}
$cats= Category :: load($category);
$allcat= array ();
if ((isset($_GET['selectcat']) && $_GET['selectcat']==0) && isset($_GET['search'])) {
$allcat= $cats[0]->get_subcategories(null);
$allcat_info = Category :: find_category($keyword,$allcat);
$alleval=array();
$alllink=array();
} else {
$alleval = Evaluation :: find_evaluations($keyword, $cats[0]->get_id());
$alllink = LinkFactory :: find_links($keyword, $cats[0]->get_id());
}
} elseif (isset ($_GET['studentoverview'])) {
//@todo this code seems to be deprecated because the gradebook tab is off
$cats= Category :: load($category);
$stud_id= (api_is_allowed_to_edit() ? null : api_get_user_id());
$allcat= array ();
$alleval= $cats[0]->get_evaluations($stud_id, true);
$alllink= $cats[0]->get_links($stud_id, true);
if (isset ($_GET['exportpdf'])) {
$datagen = new GradebookDataGenerator ($allcat,$alleval, $alllink);
$header_names = array(get_lang('Name'),get_lang('Description'),get_lang('Weight'),get_lang('Date'),get_lang('Results'));
$data_array = $datagen->get_data(GradebookDataGenerator :: GDG_SORT_NAME,0,null,true);
$newarray = array();
foreach ($data_array as $data) {
$newarray[] = array_slice($data, 1);
}
$pdf= new Cezpdf();
$pdf->selectFont(api_get_path(LIBRARY_PATH).'ezpdf/fonts/Courier.afm');
$pdf->ezSetMargins(30, 30, 50, 30);
$pdf->ezSetY(810);
$pdf->ezText(get_lang('FlatView').' ('. api_convert_and_format_date(null, DATE_FORMAT_SHORT) . ' ' . api_convert_and_format_date(null, TIME_NO_SEC_FORMAT) .')',12,array('justification'=>'center'));
$pdf->line(50,790,550,790);
$pdf->line(50,40,550,40);
$pdf->ezSetY(750);
$pdf->ezTable($newarray,$header_names,'',array('showHeadings'=>1,'shaded'=>1,'showLines'=>1,'rowGap'=>3,'width'=> 500));
$pdf->ezStream();
exit;
}
//@todo this code seems to be deprecated because the gradebook tab is off
$cats= Category :: load($category);
$stud_id= (api_is_allowed_to_edit() ? null : api_get_user_id());
$allcat= array ();
$alleval= $cats[0]->get_evaluations($stud_id, true);
$alllink= $cats[0]->get_links($stud_id, true);
if (isset ($_GET['exportpdf'])) {
$datagen = new GradebookDataGenerator ($allcat,$alleval, $alllink);
$header_names = array(get_lang('Name'),get_lang('Description'),get_lang('Weight'),get_lang('Date'),get_lang('Results'));
$data_array = $datagen->get_data(GradebookDataGenerator :: GDG_SORT_NAME,0,null,true);
$newarray = array();
foreach ($data_array as $data) {
$newarray[] = array_slice($data, 1);
}
$pdf= new Cezpdf();
$pdf->selectFont(api_get_path(LIBRARY_PATH).'ezpdf/fonts/Courier.afm');
$pdf->ezSetMargins(30, 30, 50, 30);
$pdf->ezSetY(810);
$pdf->ezText(get_lang('FlatView').' ('. api_convert_and_format_date(null, DATE_FORMAT_SHORT) . ' ' . api_convert_and_format_date(null, TIME_NO_SEC_FORMAT) .')',12,array('justification'=>'center'));
$pdf->line(50,790,550,790);
$pdf->line(50,40,550,40);
$pdf->ezSetY(750);
$pdf->ezTable($newarray,$header_names,'',array('showHeadings'=>1,'shaded'=>1,'showLines'=>1,'rowGap'=>3,'width'=> 500));
$pdf->ezStream();
exit;
}
} elseif (!empty($_GET['export_certificate'])){
//@todo this code seems not to be used
$user_id = strval(intval($_GET['user']));
if (!api_is_allowed_to_edit(true,true)) {
$user_id = api_get_user_id();
}
$category = Category :: load ($_GET['cat_id']);
if ($category[0]->is_certificate_available($user_id)) {
$user= get_user_info_from_id($user_id);
$scoredisplay = ScoreDisplay :: instance();
$scorecourse = $category[0]->calc_score($user_id);
$scorecourse_display = (isset($scorecourse) ? $scoredisplay->display_score($scorecourse,SCORE_AVERAGE) : get_lang('NoResultsAvailable'));
$user_id = strval(intval($_GET['user']));
if (!api_is_allowed_to_edit(true,true)) {
$user_id = api_get_user_id();
}
$category = Category :: load ($_GET['cat_id']);
if ($category[0]->is_certificate_available($user_id)) {
$user= get_user_info_from_id($user_id);
$scoredisplay = ScoreDisplay :: instance();
$scorecourse = $category[0]->calc_score($user_id);
$scorecourse_display = (isset($scorecourse) ? $scoredisplay->display_score($scorecourse,SCORE_AVERAGE) : get_lang('NoResultsAvailable'));
$cattotal = Category :: load(0);
$scoretotal= $cattotal[0]->calc_score($user_id);
$scoretotal_display = (isset($scoretotal) ? $scoredisplay->display_score($scoretotal,SCORE_PERCENT) : get_lang('NoResultsAvailable'));
$cattotal = Category :: load(0);
$scoretotal= $cattotal[0]->calc_score($user_id);
$scoretotal_display = (isset($scoretotal) ? $scoredisplay->display_score($scoretotal,SCORE_PERCENT) : get_lang('NoResultsAvailable'));
//prepare all necessary variables:
$organization_name = api_get_setting('Institution');
$portal_name = api_get_setting('siteName');
$stud_fn = $user['firstname'];
$stud_ln = $user['lastname'];
$certif_text = sprintf(get_lang('CertificateWCertifiesStudentXFinishedCourseYWithGradeZ'),$organization_name,$stud_fn.' '.$stud_ln,$category[0]->get_name(),$scorecourse_display);
$certif_text = str_replace("\\n","\n",$certif_text);
$date = api_convert_and_format_date(null, DATE_FORMAT_SHORT);
//prepare all necessary variables:
$organization_name = api_get_setting('Institution');
$portal_name = api_get_setting('siteName');
$stud_fn = $user['firstname'];
$stud_ln = $user['lastname'];
$certif_text = sprintf(get_lang('CertificateWCertifiesStudentXFinishedCourseYWithGradeZ'),$organization_name,$stud_fn.' '.$stud_ln,$category[0]->get_name(),$scorecourse_display);
$certif_text = str_replace("\\n","\n",$certif_text);
$date = api_convert_and_format_date(null, DATE_FORMAT_SHORT);
$pdf= new Cezpdf('a4','landscape');
$pdf->selectFont(api_get_path(LIBRARY_PATH).'ezpdf/fonts/Courier.afm');
$pdf->ezSetMargins(30, 30, 50, 50);
//line Y coordinates in landscape mode are upside down (500 is on top, 10 is on the bottom)
$pdf->line(50,50,790,50);
$pdf->line(50,550,790,550);
$pdf->ezSetY(450);
$pdf= new Cezpdf('a4','landscape');
$pdf->selectFont(api_get_path(LIBRARY_PATH).'ezpdf/fonts/Courier.afm');
$pdf->ezSetMargins(30, 30, 50, 50);
//line Y coordinates in landscape mode are upside down (500 is on top, 10 is on the bottom)
$pdf->line(50,50,790,50);
$pdf->line(50,550,790,550);
$pdf->ezSetY(450);
//@todo replace image
//$pdf->ezImage(api_get_path(SYS_CODE_PATH).'img/dokeos_logo_certif.png',1,400,'','center','');
$pdf->ezSetY(480);
$pdf->ezText($certif_text,28,array('justification'=>'center'));
//$pdf->ezSetY(750);
$pdf->ezSetY(50);
$pdf->ezText($date,18,array('justification'=>'center'));
$pdf->ezSetY(580);
$pdf->ezText($organization_name,22,array('justification'=>'left'));
$pdf->ezSetY(580);
$pdf->ezText($portal_name,22,array('justification'=>'right'));
$pdf->ezStream();
}
exit;
//$pdf->ezImage(api_get_path(SYS_CODE_PATH).'img/dokeos_logo_certif.png',1,400,'','center','');
$pdf->ezSetY(480);
$pdf->ezText($certif_text,28,array('justification'=>'center'));
//$pdf->ezSetY(750);
$pdf->ezSetY(50);
$pdf->ezText($date,18,array('justification'=>'center'));
$pdf->ezSetY(580);
$pdf->ezText($organization_name,22,array('justification'=>'left'));
$pdf->ezSetY(580);
$pdf->ezText($portal_name,22,array('justification'=>'right'));
$pdf->ezStream();
}
exit;
} else {
$cats= Category :: load($category);
$stud_id= (api_is_allowed_to_edit() ? null : api_get_user_id());
$allcat= $cats[0]->get_subcategories($stud_id);
$alleval= $cats[0]->get_evaluations($stud_id);
$alllink= $cats[0]->get_links($stud_id);
$cats= Category :: load($category);
$stud_id= (api_is_allowed_to_edit() ? null : api_get_user_id());
$allcat= $cats[0]->get_subcategories($stud_id);
$alleval= $cats[0]->get_evaluations($stud_id);
$alllink= $cats[0]->get_links($stud_id);
}
$addparams = array ('selectcat' => $cats[0]->get_id());
if (isset($_GET['search'])) {
$addparams['search'] = $keyword;
$addparams['search'] = $keyword;
}
if (isset ($_GET['studentoverview'])) {
$addparams['studentoverview'] = '';
$addparams['studentoverview'] = '';
}
if (count($allcat_info)>=0 && (isset($_GET['selectcat']) && $_GET['selectcat']==0) && isset($_GET['search']) && strlen(trim($_GET['search']))>0 ) {
$allcat=$allcat_info;
$allcat=$allcat_info;
} else {
$allcat=$allcat;
$allcat=$allcat;
}
$gradebooktable= new GradebookTable($cats[0], $allcat, $alleval, $alllink, $addparams);
if (((empty ($allcat)) && (empty ($alleval)) && (empty ($alllink)) && (!$is_platform_admin) && ($is_course_admin) && (!isset ($_GET['selectcat']))) && api_is_course_tutor()) {
Display :: display_normal_message(get_lang('GradebookWelcomeMessage') . '<br /><br /><form name="createcat" method="post" action="' . api_get_self() . '?createallcategories=1"><input type="submit" value="' . get_lang('CreateAllCat') . '"></form>',false);
Display :: display_normal_message(get_lang('GradebookWelcomeMessage') . '<br /><br /><form name="createcat" method="post" action="' . api_get_self() . '?createallcategories=1"><input type="submit" value="' . get_lang('CreateAllCat') . '"></form>',false);
}
//here we are in a sub category
if ($category != '0') {
DisplayGradebook :: display_header_gradebook($cats[0], 1, $_GET['selectcat'], $is_course_admin, $is_platform_admin, $simple_search_form);
DisplayGradebook :: display_header_gradebook($cats[0], 1, $_GET['selectcat'], $is_course_admin, $is_platform_admin, $simple_search_form);
} else {
//this is the root category
DisplayGradebook :: display_header_gradebook($cats[0], (((count($allcat) == '0') && (!isset ($_GET['search']))) ? 0 : 1), 0, $is_course_admin, $is_platform_admin, $simple_search_form);
//this is the root category
DisplayGradebook :: display_header_gradebook($cats[0], (((count($allcat) == '0') && (!isset ($_GET['search']))) ? 0 : 1), 0, $is_course_admin, $is_platform_admin, $simple_search_form);
}
$gradebooktable->display();
Display :: display_footer();

@ -1,18 +1,17 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Script
* @package chamilo.gradebook
*/
/**
* Init
*/
$language_file = 'gradebook';
require_once '../inc/global.inc.php';
$_in_course = true;
$course_code = api_get_course_id();
if ( empty ($course_code ) ) {
$_in_course = false;
$_in_course = false;
}
require_once 'lib/be.inc.php';
@ -93,9 +92,9 @@ $catadd->set_parent_id($get_select_cat);
$catcourse = Category :: load ($get_select_cat);
if ($_in_course) {
$catadd->set_course_code($course_code);
$catadd->set_course_code($course_code);
} else {
$catadd->set_course_code($catcourse[0]->get_course_code());
$catadd->set_course_code($catcourse[0]->get_course_code());
}
$catadd->set_course_code(api_get_course_id());
@ -109,44 +108,44 @@ $form = new CatForm(
);
if ($form->validate()) {
$values = $form->exportValues();
$select_course=isset($values['select_course']) ? $values['select_course'] : array();
$cat = new Category();
if ($values['hid_parent_id'] == '0') {
if ($select_course == 'COURSEINDEPENDENT') {
$cat->set_name($values['name']);
$cat->set_course_code(null);
} else {
$cat->set_course_code($select_course);
$cat->set_name($values['name']);
}
} else {
$cat->set_name($values['name']);
$cat->set_course_code($values['course_code']);
}
$values = $form->exportValues();
$select_course=isset($values['select_course']) ? $values['select_course'] : array();
$cat = new Category();
if ($values['hid_parent_id'] == '0') {
if ($select_course == 'COURSEINDEPENDENT') {
$cat->set_name($values['name']);
$cat->set_course_code(null);
} else {
$cat->set_course_code($select_course);
$cat->set_name($values['name']);
}
} else {
$cat->set_name($values['name']);
$cat->set_course_code($values['course_code']);
}
$cat->set_session_id(api_get_session_id());
//Always add the gradebook to the course
$cat->set_course_code(api_get_course_id());
//Always add the gradebook to the course
$cat->set_course_code(api_get_course_id());
$cat->set_skills($values['skills']);
$cat->set_description($values['description']);
$cat->set_user_id($values['hid_user_id']);
$cat->set_parent_id($values['hid_parent_id']);
$cat->set_weight($values['weight']);
if (empty ($values['visible'])) {
$visible = 0;
} else {
$visible = 1;
}
$cat->set_visible($visible);
$result = $cat->add();
header('Location: '.Security::remove_XSS($_SESSION['gradebook_dest']).'?addcat=&selectcat=' . $cat->get_parent_id());
exit;
$cat->set_description($values['description']);
$cat->set_user_id($values['hid_user_id']);
$cat->set_parent_id($values['hid_parent_id']);
$cat->set_weight($values['weight']);
if (empty ($values['visible'])) {
$visible = 0;
} else {
$visible = 1;
}
$cat->set_visible($visible);
$result = $cat->add();
header('Location: '.Security::remove_XSS($_SESSION['gradebook_dest']).'?addcat=&selectcat=' . $cat->get_parent_id());
exit;
}
if ( !$_in_course ) {
$interbreadcrumb[] = array ('url' => Security::remove_XSS($_SESSION['gradebook_dest']).'?selectcat='.$get_select_cat,'name' => get_lang('Gradebook'));
$interbreadcrumb[] = array ('url' => Security::remove_XSS($_SESSION['gradebook_dest']).'?selectcat='.$get_select_cat,'name' => get_lang('Gradebook'));
}
$interbreadcrumb[]= array ( 'url' =>'index.php','name' => get_lang('ToolGradebook'));
Display :: display_header(get_lang('NewCategory'));

@ -5,9 +5,7 @@
* Script
* @package chamilo.gradebook
*/
/**
* Init
*/
$language_file = 'gradebook';
require_once '../inc/global.inc.php';
require_once 'lib/be.inc.php';
@ -50,7 +48,7 @@ if ($form->validate()) {
$parent_cat = Category :: load($values['hid_category_id']);
$global_weight = $cat[0]->get_weight();
//$values['weight'] = $values['weight_mask']/$global_weight*$parent_cat[0]->get_weight();
//$values['weight'] = $values['weight_mask']/$global_weight*$parent_cat[0]->get_weight();
$values['weight'] = $values['weight_mask'];
@ -88,25 +86,25 @@ if ($form->validate()) {
$interbreadcrumb[] = array(
'url' => Security::remove_XSS($_SESSION['gradebook_dest']) . '?selectcat=' . $select_cat,
'name' => get_lang('Gradebook'
));
));
$this_section = SECTION_COURSES;
$htmlHeadXtra[] = '<script type="text/javascript">
$(document).ready( function() {
$("#hid_category_id").change(function(){
$("#hid_category_id option:selected").each(function () {
var cat_id = $(this).val();
$.ajax({
url: "' . api_get_path(WEB_AJAX_PATH) . 'gradebook.ajax.php?a=get_gradebook_weight",
$.ajax({
url: "' . api_get_path(WEB_AJAX_PATH) . 'gradebook.ajax.php?a=get_gradebook_weight",
data: "cat_id="+cat_id,
success: function(return_value) {
if (return_value != 0 ) {
$("#max_weight").html(return_value);
}
},
});
$("#max_weight").html(return_value);
}
},
});
});
});
});

@ -4,11 +4,9 @@
* Script
* @package chamilo.gradebook
*/
/**
* Init
*/
$language_file = array('gradebook', 'exercice');
//$cidReset = true;
require_once '../inc/global.inc.php';
require_once 'lib/be.inc.php';
require_once 'lib/gradebook_functions.inc.php';

@ -1,12 +1,9 @@
<?php // $Id: $
<?php
/* For licensing terms, see /license.txt */
/**
* Script
* @package chamilo.gradebook
*/
/**
* Init
*/
$language_file = 'gradebook';
//$cidReset = true;
@ -28,18 +25,18 @@ $catcourse = Category :: load ($_GET['selectcat']);
$form = new CatForm(CatForm :: TYPE_SELECT_COURSE, $catadd, 'add_cat_form', null, api_get_self().'?selectcat=' . Security::remove_XSS($_GET['selectcat']));
if ($form->validate()) {
$values = $form->exportValues();
$cat = new Category();
$cat->set_course_code($values['select_course']);
$cat->set_name($values['name']);
header('location: gradebook_add_link.php?selectcat=' .Security::remove_XSS($_GET['selectcat']).'&course_code='.Security::remove_XSS($values['select_course']));
exit;
$values = $form->exportValues();
$cat = new Category();
$cat->set_course_code($values['select_course']);
$cat->set_name($values['name']);
header('location: gradebook_add_link.php?selectcat=' .Security::remove_XSS($_GET['selectcat']).'&course_code='.Security::remove_XSS($values['select_course']));
exit;
}
$interbreadcrumb[] = array (
'url' => Security::remove_XSS($_SESSION['gradebook_dest']).'?selectcat='.Security::remove_XSS($_GET['selectcat']),
'name' => get_lang('Gradebook'
));
'url' => Security::remove_XSS($_SESSION['gradebook_dest']).'?selectcat='.Security::remove_XSS($_GET['selectcat']),
'name' => get_lang('Gradebook'
));
Display :: display_header(get_lang('NewCategory'));
$form->display();
Display :: display_footer();

@ -1,12 +1,11 @@
<?php // $Id: $
<?php
/* For licensing terms, see /license.txt */
/**
* Script
* @package chamilo.gradebook
*/
/**
* Init
*/
$language_file = 'gradebook';
//$cidReset = true;
require_once '../inc/global.inc.php';
@ -28,27 +27,27 @@ $category = !empty($_GET['selectcat']) ? $_GET['selectcat'] : "";
$add_result_form = new EvalForm(EvalForm :: TYPE_RESULT_ADD, $evaluation[0], $resultadd, 'add_result_form', null, api_get_self() . '?selectcat=' . Security::remove_XSS($category) . '&selecteval=' . Security::remove_XSS($_GET['selecteval']));
$table = $add_result_form->toHtml();
if ($add_result_form->validate()) {
$values = $add_result_form->exportValues();
$nr_users = $values['nr_users'];
if ($nr_users == '0') {
header('Location: gradebook_view_result.php?addresultnostudents=&selecteval=' . Security::remove_XSS($_GET['selecteval']));
exit;
}
$scores = ($values['score']);
foreach ($scores as $row) {
$res = new Result();
$res->set_evaluation_id($values['evaluation_id']);
$res->set_user_id(key($scores));
//if no scores are given, don't set the score
if ((!empty ($row)) || ($row == '0')) $res->set_score($row);
$res->add();
next($scores);
}
header('Location: gradebook_view_result.php?addresult=&selecteval=' . Security::remove_XSS($_GET['selecteval']));
exit;
$values = $add_result_form->exportValues();
$nr_users = $values['nr_users'];
if ($nr_users == '0') {
header('Location: gradebook_view_result.php?addresultnostudents=&selecteval=' . Security::remove_XSS($_GET['selecteval']));
exit;
}
$scores = ($values['score']);
foreach ($scores as $row) {
$res = new Result();
$res->set_evaluation_id($values['evaluation_id']);
$res->set_user_id(key($scores));
//if no scores are given, don't set the score
if ((!empty ($row)) || ($row == '0')) $res->set_score($row);
$res->add();
next($scores);
}
header('Location: gradebook_view_result.php?addresult=&selecteval=' . Security::remove_XSS($_GET['selecteval']));
exit;
}
$interbreadcrumb[] = array ('url' => Security::remove_XSS($_SESSION['gradebook_dest']),'name' => get_lang('Gradebook'));
Display :: display_header(get_lang('AddResult'));
DisplayGradebook :: display_header_result ($evaluation[0], null, 0,0);
DisplayGradebook :: display_header_result ($evaluation[0], null, 0,0);
echo $table;
Display :: display_footer();
Display :: display_footer();

@ -1,13 +1,10 @@
<?php //$Id: gradebook_add_user.php 21153 2009-06-01 01:51:43Z yannoo $
<?php
/* For licensing terms, see /license.txt */
/**
* Script
* @package chamilo.gradebook
*/
/**
* Init
*/
//Disabling code when course code is null (gradebook as a tab) see issue #2705
exit;

@ -4,9 +4,6 @@
* Script
* @package chamilo.gradebook
*/
/**
* Init
*/
$language_file = 'gradebook';
@ -20,19 +17,19 @@ require_once 'lib/be.inc.php';
require_once 'lib/gradebook_data_generator.class.php';
//extra javascript functions for in html head:
$htmlHeadXtra[] =
"<script>
$htmlHeadXtra[] ="<script>
function confirmation() {
if (confirm(\" ".trim(get_lang('AreYouSureToDelete'))." ?\"))
{return true;}
else
{return false;}
if (confirm(\" " . trim(get_lang('AreYouSureToDelete')) . " ?\")) {
return true;
} else {
return false;
}
}
</script>";
api_block_anonymous_users();
if (!api_is_allowed_to_edit()) {
api_not_allowed(true);
api_not_allowed(true);
}
$cat_id = isset($_GET['cat_id']) ? (int)$_GET['cat_id'] : null;
@ -182,25 +179,25 @@ if (count($certificate_list)==0) {
foreach ($certificate_list as $index=>$value) {
echo '<tr>
<td width="100%" class="actions">'.get_lang('Student').' : '.api_get_person_name($value['firstname'], $value['lastname']).' ('.$value['username'].')</td>';
echo '</tr>';
echo '</tr>';
echo '<tr><td>
<table class="data_table">';
$list_certificate = get_list_gradebook_certificates_by_user_id($value['user_id'], $cat_id);
foreach ($list_certificate as $value_certificate) {
echo '<tr>';
echo '<td width="50%">'.get_lang('Score').' : '.$value_certificate['score_certificate'].'</td>';
echo '<td width="30%">'.get_lang('Date').' : '.api_convert_and_format_date($value_certificate['created_at']).'</td>';
echo '<td width="20%">';
$list_certificate = get_list_gradebook_certificates_by_user_id($value['user_id'], $cat_id);
foreach ($list_certificate as $value_certificate) {
echo '<tr>';
echo '<td width="50%">'.get_lang('Score').' : '.$value_certificate['score_certificate'].'</td>';
echo '<td width="30%">'.get_lang('Date').' : '.api_convert_and_format_date($value_certificate['created_at']).'</td>';
echo '<td width="20%">';
$url = api_get_path(WEB_PATH).'certificates/index.php?id='.$value_certificate['id'];
$certificates = Display::url(get_lang('Certificate'), $url, array('target'=>'_blank', 'class' => 'btn'));
echo $certificates;
echo '<a onclick="return confirmation();" href="gradebook_display_certificate.php?sec_token='.$token.'&cidReq='.$course_code.'&action=delete&cat_id='.$cat_id.'&certificate_id='.$value_certificate['id'].'">
echo '<a onclick="return confirmation();" href="gradebook_display_certificate.php?sec_token='.$token.'&cidReq='.$course_code.'&action=delete&cat_id='.$cat_id.'&certificate_id='.$value_certificate['id'].'">
'.Display::return_icon('delete.png',get_lang('Delete')).'
</a>';
echo '</td></tr>';
}
echo '</table>';
echo '</td></tr>';
}
echo '</table>';
echo '</td></tr>';
}
echo '</table>';

@ -1,13 +1,11 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Script
* @package chamilo.gradebook
* @author Julio Montoya - fixes in order to use gradebook models + some code cleaning
*/
/**
* Init
*/
$language_file= 'gradebook';
$cidReset= true;
@ -30,29 +28,29 @@ require_once 'lib/fe/displaygradebook.php';
api_block_anonymous_users();
if (!api_is_allowed_to_edit()) {
header('Location: /index.php');
exit;
header('Location: /index.php');
exit;
}
$my_selectcat = isset($_GET['selectcat']) ? intval($_GET['selectcat']) : '';
if (empty($my_selectcat)) {
api_not_allowed();
api_not_allowed();
}
// DISPLAY HEADERS AND MESSAGES
if (!isset($_GET['exportpdf']) and !isset($_GET['export_certificate'])) {
if (isset ($_GET['studentoverview'])) {
$interbreadcrumb[]= array ('url' => Security::remove_XSS($_SESSION['gradebook_dest']).'?selectcat=' . $my_selectcat,'name' => get_lang('Gradebook'));
Display :: display_header(get_lang('FlatView'));
} elseif (isset ($_GET['search'])) {
$interbreadcrumb[]= array ('url' => Security::remove_XSS($_SESSION['gradebook_dest']).'?selectcat=' . $my_selectcat,'name' => get_lang('Gradebook'));
Display :: display_header(get_lang('SearchResults'));
} else {
$interbreadcrumb[] = array ('url' => Security::remove_XSS($_SESSION['gradebook_dest']).'?selectcat=1', 'name' => get_lang('Gradebook'));
$interbreadcrumb[] = array ('url' => '#','name' => get_lang('EditAllWeights'));
Display :: display_header('');
}
if (isset ($_GET['studentoverview'])) {
$interbreadcrumb[]= array ('url' => Security::remove_XSS($_SESSION['gradebook_dest']).'?selectcat=' . $my_selectcat,'name' => get_lang('Gradebook'));
Display :: display_header(get_lang('FlatView'));
} elseif (isset ($_GET['search'])) {
$interbreadcrumb[]= array ('url' => Security::remove_XSS($_SESSION['gradebook_dest']).'?selectcat=' . $my_selectcat,'name' => get_lang('Gradebook'));
Display :: display_header(get_lang('SearchResults'));
} else {
$interbreadcrumb[] = array ('url' => Security::remove_XSS($_SESSION['gradebook_dest']).'?selectcat=1', 'name' => get_lang('Gradebook'));
$interbreadcrumb[] = array ('url' => '#','name' => get_lang('EditAllWeights'));
Display :: display_header('');
}
}
$course_id = get_course_id_by_link_id($my_selectcat);
@ -74,15 +72,15 @@ $table_evaluated[LINK_SURVEY] = array(TABLE_SURVEY, 'code', 'survey_
$submitted = isset($_POST['submitted'])?$_POST['submitted']:'';
if ($submitted==1) {
Display :: display_confirmation_message(get_lang('GradebookWeightUpdated')) . '<br /><br />';
if (isset($_POST['evaluation'])) {
require_once 'lib/be/evaluation.class.php';
$eval_log = new Evaluation();
}
if(isset($_POST['link'])){
require_once 'lib/be/abstractlink.class.php';
//$eval_link_log = new AbstractLink();
}
Display :: display_confirmation_message(get_lang('GradebookWeightUpdated')) . '<br /><br />';
if (isset($_POST['evaluation'])) {
require_once 'lib/be/evaluation.class.php';
$eval_log = new Evaluation();
}
if(isset($_POST['link'])){
require_once 'lib/be/abstractlink.class.php';
//$eval_link_log = new AbstractLink();
}
}
$output='';
@ -168,30 +166,30 @@ while ($row = Database ::fetch_array($sql)) {
//by iflorespaz
$my_api_cidreq = api_get_cidreq();
if ($my_api_cidreq=='') {
$my_api_cidreq='cidReq='.$my_category['course_code'];
$my_api_cidreq='cidReq='.$my_category['course_code'];
}
?>
<div class="actions">
<a href="<?php echo Security::remove_XSS($_SESSION['gradebook_dest']).'?id_session='.api_get_session_id().'&amp;'.$my_api_cidreq ?>&selectcat=<?php echo $my_selectcat ?>">
<?php echo Display::return_icon('back.png',get_lang('FolderView'),'',ICON_SIZE_MEDIUM); ?>
</a>
</div>
<div class="actions">
<a href="<?php echo Security::remove_XSS($_SESSION['gradebook_dest']).'?id_session='.api_get_session_id().'&amp;'.$my_api_cidreq ?>&selectcat=<?php echo $my_selectcat ?>">
<?php echo Display::return_icon('back.png',get_lang('FolderView'),'',ICON_SIZE_MEDIUM); ?>
</a>
</div>
<?php
$warning_message = sprintf(get_lang('TotalWeightMustBeX'), $masked_total);
Display::display_normal_message($warning_message, false);
?>
<form method="post" action="gradebook_edit_all.php?id_session=<?php echo $_SESSION['id_session'].'&amp;'.$my_api_cidreq ?>&selectcat=<?php echo $my_selectcat?>">
<table class="data_table">
<tr class="row_odd">
<th style="width: 35px;"><?php echo get_lang('Type'); ?></th>
<th><?php echo get_lang('Resource'); ?></th>
<th><?php echo get_lang('Weight'); ?></th>
</tr>
<?php echo $output; ?>
</table>
<input type="hidden" name="submitted" value="1" />
<br />
<button class="save" type="submit" name="name" value="<?php echo get_lang('Save') ?>"><?php echo get_lang('SaveScoringRules') ?></button>
</form>
<form method="post" action="gradebook_edit_all.php?id_session=<?php echo $_SESSION['id_session'].'&amp;'.$my_api_cidreq ?>&selectcat=<?php echo $my_selectcat?>">
<table class="data_table">
<tr class="row_odd">
<th style="width: 35px;"><?php echo get_lang('Type'); ?></th>
<th><?php echo get_lang('Resource'); ?></th>
<th><?php echo get_lang('Weight'); ?></th>
</tr>
<?php echo $output; ?>
</table>
<input type="hidden" name="submitted" value="1" />
<br />
<button class="save" type="submit" name="name" value="<?php echo get_lang('Save') ?>"><?php echo get_lang('SaveScoringRules') ?></button>
</form>
<?php
Display :: display_footer();

@ -1,12 +1,11 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Script
* @package chamilo.gradebook
*/
/**
* Init
*/
$language_file = 'gradebook';
require_once '../inc/global.inc.php';
@ -80,13 +79,11 @@ function check_skills() {
}
</script>';
$catedit = Category::load($edit_cat);
$form = new CatForm(CatForm::TYPE_EDIT, $catedit[0], 'edit_cat_form');
if ($form->validate()) {
$values = $form->getSubmitValues();
$values = $form->getSubmitValues();
$cat = new Category();
@ -97,36 +94,36 @@ if ($form->validate()) {
}
}
$cat->set_id($values['hid_id']);
$cat->set_name($values['name']);
$cat->set_id($values['hid_id']);
$cat->set_name($values['name']);
if (empty ($values['course_code'])) {
$cat->set_course_code(null);
}else {
$cat->set_course_code($values['course_code']);
}
if (empty ($values['course_code'])) {
$cat->set_course_code(null);
}else {
$cat->set_course_code($values['course_code']);
}
$cat->set_grade_model_id($values['grade_model_id']);
$cat->set_description($values['description']);
$cat->set_skills($values['skills']);
$cat->set_user_id($values['hid_user_id']);
$cat->set_parent_id($values['hid_parent_id']);
$cat->set_weight($values['weight']);
if ($values['hid_parent_id'] == 0 ) {
$cat->set_certificate_min_score($values['certif_min_score']);
}
$cat->set_description($values['description']);
$cat->set_skills($values['skills']);
$cat->set_user_id($values['hid_user_id']);
$cat->set_parent_id($values['hid_parent_id']);
$cat->set_weight($values['weight']);
if ($values['hid_parent_id'] == 0 ) {
$cat->set_certificate_min_score($values['certif_min_score']);
}
if (empty ($values['visible'])) {
$visible = 0;
} else {
$visible = 1;
}
$visible = 0;
} else {
$visible = 1;
}
$cat->set_visible($visible);
$cat->save();
header('Location: '.Security::remove_XSS($_SESSION['gradebook_dest']).'?editcat=&selectcat=' . $cat->get_parent_id());
exit;
$cat->save();
header('Location: '.Security::remove_XSS($_SESSION['gradebook_dest']).'?editcat=&selectcat=' . $cat->get_parent_id());
exit;
}
$selectcat = isset($_GET['selectcat']) ? Security::remove_XSS($_GET['selectcat']) : '';
$interbreadcrumb[] = array ('url' => Security::remove_XSS($_SESSION['gradebook_dest']).'?selectcat='.$selectcat,'name' => get_lang('Gradebook'));

@ -1,12 +1,11 @@
<?php // $Id: $
<?php
/* For licensing terms, see /license.txt */
/**
* Script
* @package chamilo.gradebook
*/
/**
* Init
*/
$language_file = 'gradebook';
//$cidReset = true;
require_once '../inc/global.inc.php';
@ -20,64 +19,69 @@ $evaledit = Evaluation :: load($_GET['editeval']);
if ($evaledit[0]->is_locked() && !api_is_platform_admin()) {
api_not_allowed();
}
$form = new EvalForm(EvalForm :: TYPE_EDIT, $evaledit[0], null, 'edit_eval_form',null,api_get_self() . '?editeval=' . Security::remove_XSS($_GET['editeval']));
$form = new EvalForm(
EvalForm :: TYPE_EDIT,
$evaledit[0],
null,
'edit_eval_form',
null,
api_get_self() . '?editeval=' . Security::remove_XSS($_GET['editeval'])
);
if ($form->validate()) {
$values = $form->exportValues();
$eval = new Evaluation();
$eval->set_id($values['hid_id']);
$eval->set_name($values['name']);
$eval->set_description($values['description']);
$eval->set_user_id($values['hid_user_id']);
$eval->set_course_code($values['hid_course_code']);
$eval->set_category_id($values['hid_category_id']);
$parent_cat = Category :: load($values['hid_category_id']);
$values = $form->exportValues();
$eval = new Evaluation();
$eval->set_id($values['hid_id']);
$eval->set_name($values['name']);
$eval->set_description($values['description']);
$eval->set_user_id($values['hid_user_id']);
$eval->set_course_code($values['hid_course_code']);
$eval->set_category_id($values['hid_category_id']);
$parent_cat = Category :: load($values['hid_category_id']);
/*$final_weight = null;
if ($parent_cat[0]->get_parent_id() == 0) {
$final_weight = $values['weight_mask'];
$final_weight = $values['weight_mask'];
} else {
$cat = Category :: load($parent_cat[0]->get_parent_id());
$global_weight = $cat[0]->get_weight();
$final_weight = $values['weight_mask']/$global_weight*$parent_cat[0]->get_weight();
}*/
$final_weight = $values['weight_mask']/$global_weight*$parent_cat[0]->get_weight();
}*/
$final_weight = $values['weight_mask'];
$eval->set_weight($final_weight);
$eval->set_max($values['max']);
if (empty ($values['visible'])) {
$visible = 0;
} else {
$visible = 1;
}
$eval->set_visible($visible);
$eval->save();
header('Location: '.$_SESSION['gradebook_dest'].'?editeval=&selectcat=' . $eval->get_category_id());
exit;
$eval->set_max($values['max']);
if (empty ($values['visible'])) {
$visible = 0;
} else {
$visible = 1;
}
$eval->set_visible($visible);
$eval->save();
header('Location: '.$_SESSION['gradebook_dest'].'?editeval=&selectcat=' . $eval->get_category_id());
exit;
}
$selectcat_inter=isset($_GET['selectcat'])?Security::remove_XSS($_GET['selectcat']):'';
$interbreadcrumb[] = array (
'url' => $_SESSION['gradebook_dest'].'?selectcat='.$selectcat_inter,
'name' => get_lang('Gradebook'
));
'url' => $_SESSION['gradebook_dest'].'?selectcat='.$selectcat_inter,
'name' => get_lang('Gradebook'
));
$htmlHeadXtra[] = '<script type="text/javascript">
$(document).ready( function() {
$("#hid_category_id").change(function(){
$("#hid_category_id").change(function() {
$("#hid_category_id option:selected").each(function () {
var cat_id = $(this).val();
$.ajax({
url: "'.api_get_path(WEB_AJAX_PATH).'gradebook.ajax.php?a=get_gradebook_weight",
$.ajax({
url: "'.api_get_path(WEB_AJAX_PATH).'gradebook.ajax.php?a=get_gradebook_weight",
data: "cat_id="+cat_id,
success: function(return_value) {
if (return_value != 0 ) {
$("#max_weight").html(return_value);
}
},
});
$("#max_weight").html(return_value);
}
}
});
});
});
});

@ -1,12 +1,11 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Script
* @package chamilo.gradebook
*/
/**
* Init
*/
$language_file = array('gradebook', 'exercice', 'link');
//$cidReset = true;
require_once '../inc/global.inc.php';
@ -42,7 +41,7 @@ if ($session_id == 0) {
$form = new LinkAddEditForm(LinkAddEditForm :: TYPE_EDIT, $cats, null, $link, 'edit_link_form', api_get_self() . '?selectcat=' . $linkcat. '&editlink=' . $linkedit);
if ($form->validate()) {
$values = $form->exportValues();
$values = $form->exportValues();
$parent_cat = Category :: load($values['select_gradebook']);
$final_weight = null;
@ -57,44 +56,43 @@ if ($form->validate()) {
$final_weight = $values['weight_mask'];
$link->set_weight($final_weight);
$link->set_weight($final_weight);
if (!empty($values['select_gradebook'])) {
$link->set_category_id($values['select_gradebook']);
}
$link->set_visible(empty ($values['visible']) ? 0 : 1);
$link->save();
//Update weight for attendance
$sql = 'SELECT ref_id FROM '.$tbl_grade_links.' WHERE id = '.intval($_GET['editlink']).' AND type='.LINK_ATTENDANCE;
$rs_attendance = Database::query($sql);
if (Database::num_rows($rs_attendance) > 0) {
$row_attendance = Database::fetch_array($rs_attendance);
$attendance_id = $row_attendance['ref_id'];
$upd_attendance = 'UPDATE '.$tbl_attendance.' SET attendance_weight ='.floatval($final_weight).' WHERE c_id = '.$course_id.' AND id = '.intval($attendance_id);
Database::query($upd_attendance);
}
//Update weight into forum thread
$sql_t = 'UPDATE '.$tbl_forum_thread.' SET thread_weight='.$final_weight.'
$link->set_visible(empty ($values['visible']) ? 0 : 1);
$link->save();
//Update weight for attendance
$sql = 'SELECT ref_id FROM '.$tbl_grade_links.' WHERE id = '.intval($_GET['editlink']).' AND type='.LINK_ATTENDANCE;
$rs_attendance = Database::query($sql);
if (Database::num_rows($rs_attendance) > 0) {
$row_attendance = Database::fetch_array($rs_attendance);
$attendance_id = $row_attendance['ref_id'];
$upd_attendance = 'UPDATE '.$tbl_attendance.' SET attendance_weight ='.floatval($final_weight).' WHERE c_id = '.$course_id.' AND id = '.intval($attendance_id);
Database::query($upd_attendance);
}
//Update weight into forum thread
$sql_t = 'UPDATE '.$tbl_forum_thread.' SET thread_weight='.$final_weight.'
WHERE c_id = '.$course_id.' AND thread_id=(SELECT ref_id FROM '.$tbl_grade_links.' WHERE id='.intval($_GET['editlink']).' and type=5) ';
Database::query($sql_t);
Database::query($sql_t);
//Update weight into student publication(work)
$sql_t = 'UPDATE '.$tbl_work.' SET weight='.$final_weight.'
//Update weight into student publication(work)
$sql_t = 'UPDATE '.$tbl_work.' SET weight='.$final_weight.'
WHERE c_id = '.$course_id.' AND id = (SELECT ref_id FROM '.$tbl_grade_links.' WHERE id='.intval($_GET['editlink'] ).' AND type=3 )';
Database::query($sql_t);
header('Location: '.$_SESSION['gradebook_dest'].'?linkedited=&selectcat=' . $link->get_category_id());
exit;
Database::query($sql_t);
header('Location: '.$_SESSION['gradebook_dest'].'?linkedited=&selectcat=' . $link->get_category_id());
exit;
}
$interbreadcrumb[] = array ('url' => Security::remove_XSS($_SESSION['gradebook_dest']).'?selectcat='.$linkcat,'name' => get_lang('Gradebook'));
$htmlHeadXtra[] = '<script type="text/javascript">
$(document).ready( function() {
$("#hide_category_id").change(function(){
$("#hide_category_id").change(function() {
$("#hide_category_id option:selected").each(function () {
var cat_id = $(this).val();
$.ajax({
@ -104,7 +102,7 @@ $(document).ready( function() {
if (return_value != 0 ) {
$("#max_weight").html(return_value);
}
},
}
});
});
});

@ -1,12 +1,10 @@
<?php // $Id: $
<?php
/* For licensing terms, see /license.txt */
/**
* Script
* @package chamilo.gradebook
*/
/**
* Init
*/
$language_file = 'gradebook';
//$cidReset = true;
require_once '../inc/global.inc.php';
@ -19,7 +17,7 @@ api_block_anonymous_users();
block_students();
$select_eval=Security::remove_XSS($_GET['selecteval']);
if (empty($select_eval)) {
api_not_allowed();
api_not_allowed();
}
$resultedit = Result :: load (null,null,$select_eval);
$evaluation = Evaluation :: load ($select_eval);
@ -29,29 +27,29 @@ $evaluation[0]->check_lock_permissions();
$edit_result_form = new EvalForm(EvalForm :: TYPE_ALL_RESULTS_EDIT, $evaluation[0], $resultedit, 'edit_result_form', null, api_get_self() . '?&selecteval='.$select_eval);
$table = $edit_result_form->toHtml();
if ($edit_result_form->validate()) {
$values = $edit_result_form->exportValues();
$scores = ($values['score']);
foreach ($scores as $row) {
$resultedit = Result :: load (key($scores));
$row_value = $row;
if ($row_value != '' ) {
$resultedit[0]->set_score(floatval(number_format($row_value, api_get_setting('gradebook_number_decimals'))));
$values = $edit_result_form->exportValues();
$scores = ($values['score']);
foreach ($scores as $row) {
$resultedit = Result :: load (key($scores));
$row_value = $row;
if ($row_value != '' ) {
$resultedit[0]->set_score(floatval(number_format($row_value, api_get_setting('gradebook_number_decimals'))));
$resultedit[0]->save();
}
next($scores);
}
header('Location: gradebook_view_result.php?selecteval='.$select_eval.'&editallresults=');
exit;
}
next($scores);
}
header('Location: gradebook_view_result.php?selecteval='.$select_eval.'&editallresults=');
exit;
}
$interbreadcrumb[] = array (
'url' => $_SESSION['gradebook_dest'],
'name' => get_lang('Gradebook'
));
'url' => $_SESSION['gradebook_dest'],
'name' => get_lang('Gradebook'
));
$interbreadcrumb[]= array (
'url' => 'gradebook_view_result.php?selecteval='.$select_eval,
'name' => get_lang('ViewResult'
));
'url' => 'gradebook_view_result.php?selecteval='.$select_eval,
'name' => get_lang('ViewResult'
));
Display :: display_header(get_lang('EditResult'));
DisplayGradebook :: display_header_result ($evaluation[0],null,0,0);
echo $table;

@ -1,5 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Script
* @package chamilo.gradebook
@ -26,8 +27,8 @@ api_block_anonymous_users();
block_students();
if (isset ($_POST['submit']) && isset ($_POST['keyword'])) {
header('Location: '.api_get_self().'?selectcat='.Security::remove_XSS($_GET['selectcat']).'&search='.Security::remove_XSS($_POST['keyword']));
exit;
header('Location: '.api_get_self().'?selectcat='.Security::remove_XSS($_GET['selectcat']).'&search='.Security::remove_XSS($_POST['keyword']));
exit;
}
$interbreadcrumb[] = array ('url' => $_SESSION['gradebook_dest'].'?selectcat=1', 'name' => get_lang('ToolGradebook'));
@ -35,38 +36,38 @@ $interbreadcrumb[] = array ('url' => $_SESSION['gradebook_dest'].'?selectcat=1',
$showeval = isset($_POST['showeval']) ? '1' : '0';
$showlink = isset($_POST['showlink']) ? '1' : '0';
if (($showlink == '0') && ($showeval == '0')) {
$showlink = '1';
$showeval = '1';
$showlink = '1';
$showeval = '1';
}
$cat = Category::load($_REQUEST['selectcat']);
if (isset($_GET['userid'])) {
$userid = Security::remove_XSS($_GET['userid']);
$userid = Security::remove_XSS($_GET['userid']);
} else {
$userid = '';
$userid = '';
}
if ($showeval) {
$alleval = $cat[0]->get_evaluations($userid, true);
$alleval = $cat[0]->get_evaluations($userid, true);
} else {
$alleval = null;
$alleval = null;
}
if ($showlink) {
$alllinks = $cat[0]->get_links($userid, true);
$alllinks = $cat[0]->get_links($userid, true);
} else {
$alllinks = null;
$alllinks = null;
}
if (isset($export_flatview_form) && (!$file_type == 'pdf')) {
Display :: display_normal_message($export_flatview_form->toHtml(), false);
Display :: display_normal_message($export_flatview_form->toHtml(), false);
}
if (isset($_GET['selectcat'])) {
$category_id = Security::remove_XSS($_GET['selectcat']);
$category_id = Security::remove_XSS($_GET['selectcat']);
} else {
$category_id = '';
$category_id = '';
}
$simple_search_form = new UserForm(
@ -80,21 +81,21 @@ $values = $simple_search_form->exportValues();
$keyword = '';
if (isset($_GET['search']) && !empty($_GET['search'])) {
$keyword = Security::remove_XSS($_GET['search']);
$keyword = Security::remove_XSS($_GET['search']);
}
if ($simple_search_form->validate() && (empty($keyword))) {
$keyword = $values['keyword'];
$keyword = $values['keyword'];
}
if (!empty($keyword)) {
$users = find_students($keyword);
$users = find_students($keyword);
} else {
if (isset($alleval) && isset($alllinks)) {
$users = get_all_users($alleval, $alllinks);
} else {
$users = null;
}
if (isset($alleval) && isset($alllinks)) {
$users = get_all_users($alleval, $alllinks);
} else {
$users = null;
}
}
$offset = isset($_GET['offset']) ? $_GET['offset'] : '0';
@ -129,10 +130,10 @@ if (isset($_GET['export_pdf']) && $_GET['export_pdf'] == 'category') {
}
if (isset($_GET['exportpdf'])) {
$interbreadcrumb[] = array (
'url' => api_get_self().'?selectcat=' . Security::remove_XSS($_GET['selectcat']),
'name' => get_lang('FlatView')
);
$interbreadcrumb[] = array (
'url' => api_get_self().'?selectcat=' . Security::remove_XSS($_GET['selectcat']),
'name' => get_lang('FlatView')
);
$export_pdf_form = new DataForm(
DataForm::TYPE_EXPORT_PDF,
@ -143,18 +144,18 @@ if (isset($_GET['exportpdf'])) {
''
);
if ($export_pdf_form->validate()) {
if ($export_pdf_form->validate()) {
$params = $export_pdf_form->exportValues();
Display :: set_header(null, false, false);
$params['join_firstname_lastname'] = true;
$params['show_official_code'] = true;
$params['export_pdf'] = true;
$params['only_total_category'] = false;
export_pdf_flatview($flatviewtable, $cat, $users, $alleval, $alllinks, $params, $mainCourseCategory[0]);
export_pdf_flatview($flatviewtable, $cat, $users, $alleval, $alllinks, $params, $mainCourseCategory[0]);
} else {
Display :: display_header(get_lang('ExportPDF'));
}
} else {
Display :: display_header(get_lang('ExportPDF'));
}
}
if (isset($_GET['print'])) {
@ -166,13 +167,13 @@ if (isset($_GET['print'])) {
$params,
$mainCourseCategory[0]
);
echo print_table(
echo print_table(
$printable_data[1],
$printable_data[0],
get_lang('FlatView'),
$cat[0]->get_name()
);
exit;
exit;
}
if (!empty($_GET['export_report']) && $_GET['export_report'] == 'export_report') {

@ -1,284 +1,283 @@
<?php
/* For licensing terms, see /license.txt */
/**
* ExerciseResult class: This class allows to instantiate an object of type ExerciseResult
* which allows you to export exercises results in multiple presentation forms
* @package chamilo.gradebook
* @author Yannick Warnier
*/
if(!class_exists('GradeBookResult')):
/**
* Gradebook results class
* @author Yannick Warnier
* @package chamilo.gradebook
*/
class GradeBookResult
{
private $gradebook_list = array(); //stores the list of exercises
private $results = array(); //stores the results
private $gradebook_list = array(); //stores the list of exercises
private $results = array(); //stores the results
/**
* constructor of the class
*/
public function GradeBookResult($get_questions=false,$get_answers=false) {
//nothing to do
/*
$this->exercise_list = array();
$this->readExercisesList();
if($get_questions)
{
foreach($this->exercises_list as $exe)
{
$this->exercises_list['questions'] = $this->getExerciseQuestionList($exe['id']);
}
}
*/
}
/**
* constructor of the class
*/
public function GradeBookResult($get_questions=false,$get_answers=false)
{
//nothing to do
/*
$this->exercise_list = array();
$this->readExercisesList();
if($get_questions)
{
foreach($this->exercises_list as $exe)
{
$this->exercises_list['questions'] = $this->getExerciseQuestionList($exe['id']);
}
}
*/
}
/**
* Reads exercises information (minimal) from the data base
* @param boolean Whether to get only visible exercises (true) or all of them (false). Defaults to false.
* @return array A list of exercises available
*/
private function _readGradebookList($only_visible = false) {
$return = array();
$TBL_EXERCISES = Database::get_course_table(TABLE_QUIZ_TEST);
/**
* Reads exercises information (minimal) from the data base
* @param boolean Whether to get only visible exercises (true) or all of them (false). Defaults to false.
* @return array A list of exercises available
*/
private function _readGradebookList($only_visible = false) {
$return = array();
$TBL_EXERCISES = Database::get_course_table(TABLE_QUIZ_TEST);
$sql="SELECT id,title,type,random,active FROM $TBL_EXERCISES";
if($only_visible) {
$sql.= ' WHERE active=1';
}
$sql .= ' ORDER BY title';
$result=Database::query($sql);
$sql="SELECT id,title,type,random,active FROM $TBL_EXERCISES";
if($only_visible) {
$sql.= ' WHERE active=1';
}
$sql .= ' ORDER BY title';
$result=Database::query($sql);
// if the exercise has been found
while($row=Database::fetch_array($result,'ASSOC')) {
$return[] = $row;
}
// exercise not found
return $return;
}
// if the exercise has been found
while($row=Database::fetch_array($result,'ASSOC')) {
$return[] = $row;
}
// exercise not found
return $return;
}
/**
* Gets the questions related to one exercise
* @param integer Exercise ID
*/
private function _readGradeBookQuestionsList($e_id) {
$return = array();
$TBL_EXERCISE_QUESTION = Database::get_course_table(TABLE_QUIZ_TEST_QUESTION);
$TBL_QUESTIONS = Database::get_course_table(TABLE_QUIZ_QUESTION);
$course_id = api_get_course_int_id();
$sql="SELECT q.id, q.question, q.ponderation, q.position, q.type, q.picture " .
" FROM $TBL_EXERCISE_QUESTION eq, $TBL_QUESTIONS q " .
" WHERE eq.c_di = $course_id AND
q.c_di = $course_id AND
eq.question_id=q.id AND
/**
* Gets the questions related to one exercise
* @param integer Exercise ID
*/
private function _readGradeBookQuestionsList($e_id) {
$return = array();
$TBL_EXERCISE_QUESTION = Database::get_course_table(TABLE_QUIZ_TEST_QUESTION);
$TBL_QUESTIONS = Database::get_course_table(TABLE_QUIZ_QUESTION);
$course_id = api_get_course_int_id();
$sql="SELECT q.id, q.question, q.ponderation, q.position, q.type, q.picture " .
" FROM $TBL_EXERCISE_QUESTION eq, $TBL_QUESTIONS q " .
" WHERE eq.c_di = $course_id AND
q.c_di = $course_id AND
eq.question_id=q.id AND
eq.exercice_id='$e_id' " .
" ORDER BY q.position";
$result = Database::query($sql);
" ORDER BY q.position";
$result = Database::query($sql);
// fills the array with the question ID for this exercise
// the key of the array is the question position
while($row=Database::fetch_array($result,'ASSOC')) {
$return[] = $row;
}
return true;
}
/**
* Gets the results of all students (or just one student if access is limited)
* @param string The document path (for HotPotatoes retrieval)
* @param integer User ID. Optional. If no user ID is provided, we take all the results. Defauts to null
*/
function _getGradeBookReporting($document_path,$user_id=null) {
$return = array();
$TBL_EXERCISES = Database::get_course_table(TABLE_QUIZ_TEST);
$TBL_USER = Database::get_main_table(TABLE_MAIN_USER);
$TBL_TRACK_EXERCISES = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
$TBL_TRACK_HOTPOTATOES = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_HOTPOTATOES);
// fills the array with the question ID for this exercise
// the key of the array is the question position
while($row=Database::fetch_array($result,'ASSOC')) {
$return[] = $row;
}
return true;
}
/**
* Gets the results of all students (or just one student if access is limited)
* @param string The document path (for HotPotatoes retrieval)
* @param integer User ID. Optional. If no user ID is provided, we take all the results. Defauts to null
*/
function _getGradeBookReporting($document_path,$user_id=null) {
$return = array();
$TBL_EXERCISES = Database::get_course_table(TABLE_QUIZ_TEST);
$TBL_USER = Database::get_main_table(TABLE_MAIN_USER);
$TBL_TRACK_EXERCISES = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
$TBL_TRACK_HOTPOTATOES = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_HOTPOTATOES);
$cid = api_get_course_id();
$course_id = api_get_course_int_id();
if (empty($user_id)) {
//get all results (ourself and the others) as an admin should see them
//AND exe_user_id <> $_user['user_id'] clause has been removed
$sql="SELECT ".(api_is_western_name_order() ? "CONCAT(firstname,' ',lastname)" : "CONCAT(lastname,' ',firstname)").", ce.title, te.exe_result ,
$cid = api_get_course_id();
$course_id = api_get_course_int_id();
if (empty($user_id)) {
//get all results (ourself and the others) as an admin should see them
//AND exe_user_id <> $_user['user_id'] clause has been removed
$sql="SELECT ".(api_is_western_name_order() ? "CONCAT(firstname,' ',lastname)" : "CONCAT(lastname,' ',firstname)").", ce.title, te.exe_result ,
te.exe_weighting, te.exe_date,te.exe_id, user.email, user.user_id
FROM $TBL_EXERCISES ce , $TBL_TRACK_EXERCISES te, $TBL_USER user
WHERE ce.c_id = $course_id AND
te.exe_exo_id = ce.id AND
te.exe_exo_id = ce.id AND
user_id=te.exe_user_id AND te.exe_cours_id='$cid'
ORDER BY te.exe_cours_id ASC, ce.title ASC, te.exe_date ASC";
$hpsql="SELECT ".(api_is_western_name_order() ? "CONCAT(tu.firstname,' ',tu.lastname)" : "CONCAT(tu.lastname,' ',tu.firstname)").", tth.exe_name,
$hpsql="SELECT ".(api_is_western_name_order() ? "CONCAT(tu.firstname,' ',tu.lastname)" : "CONCAT(tu.lastname,' ',tu.firstname)").", tth.exe_name,
tth.exe_result , tth.exe_weighting, tth.exe_date, tu.email, tu.user_id
FROM $TBL_TRACK_HOTPOTATOES tth, $TBL_USER tu
WHERE tu.user_id=tth.exe_user_id AND tth.exe_cours_id = '".$cid."'
ORDER BY tth.exe_cours_id ASC, tth.exe_date ASC";
} else { // get only this user's results
$sql = "SELECT '',ce.title, te.exe_result , te.exe_weighting, te.exe_date,te.exe_id
} else { // get only this user's results
$sql = "SELECT '',ce.title, te.exe_result , te.exe_weighting, te.exe_date,te.exe_id
FROM $TBL_EXERCISES ce , $TBL_TRACK_EXERCISES te
WHERE ce.c_id = $course_id AND
te.exe_exo_id = ce.id AND
te.exe_user_id = '".$user_id."' AND
te.exe_exo_id = ce.id AND
te.exe_user_id = '".$user_id."' AND
te.exe_cours_id = '$cid'
ORDER BY te.exe_cours_id ASC, ce.title ASC, te.exe_date ASC";
$hpsql="SELECT '',exe_name, exe_result , exe_weighting, exe_date
$hpsql="SELECT '',exe_name, exe_result , exe_weighting, exe_date
FROM $TBL_TRACK_HOTPOTATOES
WHERE exe_user_id = '".$user_id."' AND exe_cours_id = '".$cid."'
ORDER BY exe_cours_id ASC, exe_date ASC";
}
}
$results=getManyResultsXCol($sql,8);
$hpresults=getManyResultsXCol($hpsql,7);
$results=getManyResultsXCol($sql,8);
$hpresults=getManyResultsXCol($hpsql,7);
$NoTestRes = 0;
$NoHPTestRes = 0;
$j=0;
//Print the results of tests
if (is_array($results)) {
for ($i = 0; $i < sizeof($results); $i++) {
$return[$i] = array();
$id = $results[$i][5];
$mailid = $results[$i][6];
$user = $results[$i][0];
$test = $results[$i][1];
$res = $results[$i][2];
if(empty($user_id)) {
$user = $results[$i][0];
$return[$i]['user'] = $user;
$return[$i]['user_id'] = $results[$i][7];
}
$return[$i]['title'] = $test;
$return[$i]['time'] = api_convert_and_format_date($results[$i][4], null, date_default_timezone_get());
$return[$i]['result'] = $res;
$return[$i]['max'] = $results[$i][3];
$j=$i;
}
}
$j++;
// Print the Result of Hotpotatoes Tests
if (is_array($hpresults)) {
for ($i = 0; $i < sizeof($hpresults); $i++) {
$return[$j+$i] = array();
$title = GetQuizName($hpresults[$i][1],$document_path);
if ($title =='') {
$title = basename($hpresults[$i][1]);
}
if (empty($user_id)) {
$return[$j+$i]['user'] = $hpresults[$i][0];
$return[$j+$i]['user_id'] = $results[$i][6];
}
$return[$j+$i]['title'] = $title;
$return[$j+$i]['time'] = api_convert_and_format_date($hpresults[$i][4], null, date_default_timezone_get());
$return[$j+$i]['result'] = $hpresults[$i][2];
$return[$j+$i]['max'] = $hpresults[$i][3];
}
}
$this->results = $return;
return true;
}
$NoTestRes = 0;
$NoHPTestRes = 0;
$j=0;
//Print the results of tests
if (is_array($results)) {
for ($i = 0; $i < sizeof($results); $i++) {
$return[$i] = array();
$id = $results[$i][5];
$mailid = $results[$i][6];
$user = $results[$i][0];
$test = $results[$i][1];
$res = $results[$i][2];
if(empty($user_id)) {
$user = $results[$i][0];
$return[$i]['user'] = $user;
$return[$i]['user_id'] = $results[$i][7];
}
$return[$i]['title'] = $test;
$return[$i]['time'] = api_convert_and_format_date($results[$i][4], null, date_default_timezone_get());
$return[$i]['result'] = $res;
$return[$i]['max'] = $results[$i][3];
$j=$i;
}
}
$j++;
// Print the Result of Hotpotatoes Tests
if (is_array($hpresults)) {
for ($i = 0; $i < sizeof($hpresults); $i++) {
$return[$j+$i] = array();
$title = GetQuizName($hpresults[$i][1],$document_path);
if ($title =='') {
$title = basename($hpresults[$i][1]);
}
if (empty($user_id)) {
$return[$j+$i]['user'] = $hpresults[$i][0];
$return[$j+$i]['user_id'] = $results[$i][6];
/**
* Exports the complete report as a CSV file
* @param string Document path inside the document tool
* @param integer Optional user ID
* @param boolean Whether to include user fields or not
* @return boolean False on error
*/
public function exportCompleteReportCSV($dato)
{
//$this->_getGradeBookReporting($document_path,$user_id);
$filename = 'gradebook_results_'.gmdate('YmdGis').'.csv';
if (!empty($user_id)) {
$filename = 'gradebook_results_user_'.$user_id.'_'.gmdate('YmdGis').'.csv';
}
$data = '';
//build the results
//titles
}
$return[$j+$i]['title'] = $title;
$return[$j+$i]['time'] = api_convert_and_format_date($hpresults[$i][4], null, date_default_timezone_get());
$return[$j+$i]['result'] = $hpresults[$i][2];
$return[$j+$i]['max'] = $hpresults[$i][3];
}
}
$this->results = $return;
return true;
}
/**
* Exports the complete report as a CSV file
* @param string Document path inside the document tool
* @param integer Optional user ID
* @param boolean Whether to include user fields or not
* @return boolean False on error
*/
public function exportCompleteReportCSV($dato) {
//$this->_getGradeBookReporting($document_path,$user_id);
$filename = 'gradebook_results_'.gmdate('YmdGis').'.csv';
if (!empty($user_id)) {
$filename = 'gradebook_results_user_'.$user_id.'_'.gmdate('YmdGis').'.csv';
}
$data = '';
//build the results
//titles
foreach ($dato[0] as $header_col) {
if(!empty($header_col)) {
$data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($header_col))).';';
}
}
foreach ($dato[0] as $header_col) {
if(!empty($header_col)) {
$data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($header_col))).';';
}
}
$data .="\r\n";
$cant_students = count($dato[1]);
//print_r($data); exit();
$data .="\r\n";
$cant_students = count($dato[1]);
//print_r($data); exit();
for($i=0;$i<$cant_students;$i++) {
$column = 0;
foreach($dato[1][$i] as $col_name) {
$data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($col_name))).';';
}
$data .="\r\n";
}
for($i=0;$i<$cant_students;$i++) {
$column = 0;
foreach($dato[1][$i] as $col_name) {
$data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($col_name))).';';
}
$data .="\r\n";
}
//output the results
$len = strlen($data);
header('Content-type: application/octet-stream');
header('Content-Type: application/force-download');
header('Content-length: '.$len);
if (preg_match("/MSIE 5.5/", $_SERVER['HTTP_USER_AGENT'])) {
header('Content-Disposition: filename= '.$filename);
} else {
header('Content-Disposition: attachment; filename= '.$filename);
} if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE')) {
header('Pragma: ');
header('Cache-Control: ');
header('Cache-Control: public'); // IE cannot download from sessions without a cache
}
header('Content-Description: '.$filename);
header('Content-transfer-encoding: binary');
echo $data;
return true;
}
//output the results
$len = strlen($data);
header('Content-type: application/octet-stream');
header('Content-Type: application/force-download');
header('Content-length: '.$len);
if (preg_match("/MSIE 5.5/", $_SERVER['HTTP_USER_AGENT'])) {
header('Content-Disposition: filename= '.$filename);
} else {
header('Content-Disposition: attachment; filename= '.$filename);
} if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE')) {
header('Pragma: ');
header('Cache-Control: ');
header('Cache-Control: public'); // IE cannot download from sessions without a cache
}
header('Content-Description: '.$filename);
header('Content-transfer-encoding: binary');
echo $data;
return true;
}
/**
* Exports the complete report as an XLS file
* @return boolean False on error
*/
public function exportCompleteReportXLS($data) {
$filename = 'gradebook-results-'.date('Y-m-d-h:i:s').'.xls';
include api_get_path(LIBRARY_PATH).'pear/Spreadsheet_Excel_Writer/Writer.php';
$workbook = new Spreadsheet_Excel_Writer();
/**
* Exports the complete report as an XLS file
* @return boolean False on error
*/
public function exportCompleteReportXLS($data)
{
$filename = 'gradebook-results-'.date('Y-m-d-h:i:s').'.xls';
include api_get_path(LIBRARY_PATH).'pear/Spreadsheet_Excel_Writer/Writer.php';
$workbook = new Spreadsheet_Excel_Writer();
$workbook->setVersion(8); // BIFF8
$workbook->setTempDir(api_get_path(SYS_ARCHIVE_PATH));
$workbook->send($filename);
$worksheet =& $workbook->addWorksheet('Report');
$workbook->send($filename);
$worksheet =& $workbook->addWorksheet('Report');
$worksheet->setInputEncoding(api_get_system_encoding());
$line = 0;
$column = 0; //skip the first column (row titles)
//headers
foreach ($data[0] as $header_col) {
$worksheet->write($line, $column, $header_col);
$column++;
}
$line++;
$line = 0;
$column = 0; //skip the first column (row titles)
//headers
foreach ($data[0] as $header_col) {
$worksheet->write($line, $column, $header_col);
$column++;
}
$line++;
$cant_students = count($data[1]);
for ($i=0;$i<$cant_students;$i++) {
$column = 0;
foreach ($data[1][$i] as $col_name) {
$worksheet->write($line,$column, html_entity_decode(strip_tags($col_name)));
$column++;
}
$line++;
}
$cant_students = count($data[1]);
for ($i=0;$i<$cant_students;$i++) {
$column = 0;
foreach ($data[1][$i] as $col_name) {
$worksheet->write($line,$column, html_entity_decode(strip_tags($col_name)));
$column++;
}
$line++;
}
$workbook->close();
exit;
}
/**
* Exports the complete report as a DOCX file
* @return boolean False on error
*/
public function exportCompleteReportDOC($data) {
}
/**
* Exports the complete report as a DOCX file
* @return boolean False on error
*/
public function exportCompleteReportDOC($data)
{
global $_course;
$filename = 'gb_results_'.$_course['code'].'_'.gmdate('YmdGis');
$filepath = api_get_path(SYS_ARCHIVE_PATH).$filename;
@ -308,12 +307,12 @@ class GradeBookResult
$docx->addList($values, $params);
//$docx->addFooter('', $paramsHeader);
$paramsPage = array(
// 'titlePage' => 1,
// 'titlePage' => 1,
'orient' => 'landscape',
// 'top' => 4000,
// 'bottom' => 4000,
// 'right' => 4000,
// 'left' => 4000
// 'top' => 4000,
// 'bottom' => 4000,
// 'right' => 4000,
// 'left' => 4000
);
$docx->createDocx($filepath,$paramsPage);
//output the results
@ -331,4 +330,3 @@ class GradeBookResult
return true;
}
}
endif;

@ -1,12 +1,11 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Script
* @package chamilo.gradebook
*/
/**
* Init
*/
$language_file= 'gradebook';
require_once '../inc/global.inc.php';

@ -1,12 +1,10 @@
<?php // $Id: $
<?php
/* For licensing terms, see /license.txt */
/**
* Script
* @package chamilo.gradebook
*/
/**
* Init
*/
$language_file = 'gradebook';
//$cidReset = true;
require_once '../inc/global.inc.php';
@ -18,16 +16,16 @@ api_block_anonymous_users();
block_students();
$interbreadcrumb[] = array (
'url' => $_SESSION['gradebook_dest'].'?',
'name' => get_lang('Gradebook'
'url' => $_SESSION['gradebook_dest'].'?',
'name' => get_lang('Gradebook'
));
$interbreadcrumb[] = array (
'url' => $_SESSION['gradebook_dest'].'?selectcat='.Security::remove_XSS($_GET['selectcat']),
'name' => get_lang('Details'
'url' => $_SESSION['gradebook_dest'].'?selectcat='.Security::remove_XSS($_GET['selectcat']),
'name' => get_lang('Details'
));
$interbreadcrumb[] = array (
'url' => 'gradebook_showlog_eval.php?visiblelog='.Security::remove_XSS($_GET['visiblelog']).'&amp;selectcat='.Security::remove_XSS($_GET['selectcat']),
'name' => get_lang('GradebookQualifyLog')
'url' => 'gradebook_showlog_eval.php?visiblelog='.Security::remove_XSS($_GET['visiblelog']).'&amp;selectcat='.Security::remove_XSS($_GET['selectcat']),
'name' => get_lang('GradebookQualifyLog')
);
$this_section = SECTION_COURSES;
Display :: display_header('');
@ -39,17 +37,17 @@ $t_user= Database :: get_main_table(TABLE_MAIN_USER);
$visible_log=Security::remove_XSS($_GET['visiblelog']);
$evaledit = Evaluation :: load($visible_log);
$sql="SELECT le.name,le.description,le.weight,le.visible,le.type,le.created_at,us.username FROM ".$t_linkeval_log." le INNER JOIN ".$t_user." us
$sql="SELECT le.name,le.description,le.weight,le.visible,le.type,le.created_at,us.username FROM ".$t_linkeval_log." le INNER JOIN ".$t_user." us
ON le.user_id_log=us.user_id where id_linkeval_log=".$evaledit[0]->get_id()." and type='evaluation';";
$result=Database::query($sql);
$list_info=array();
while ($row=Database::fetch_row($result)) {
$list_info[]=$row;
$list_info[]=$row;
}
foreach($list_info as $key => $info_log) {
$list_info[$key][5]=($info_log[5]) ? api_convert_and_format_date($info_log[5]) : 'N/A';
$list_info[$key][3]=($info_log[3]==1) ? get_lang('GradebookVisible') : get_lang('GradebookInvisible');
foreach($list_info as $key => $info_log) {
$list_info[$key][5]=($info_log[5]) ? api_convert_and_format_date($info_log[5]) : 'N/A';
$list_info[$key][3]=($info_log[3]==1) ? get_lang('GradebookVisible') : get_lang('GradebookInvisible');
}
$parameters=array('visiblelog'=>$visible_log,'selectcat'=>intval($_GET['selectcat']));

@ -1,12 +1,11 @@
<?php // $Id: $
<?php
/* For licensing terms, see /license.txt */
/**
* Script
* @package chamilo.gradebook
*/
/**
* Init
*/
$language_file = 'gradebook';
//$cidReset = true;
require_once '../inc/global.inc.php';
@ -35,17 +34,16 @@ $sql="SELECT lk.name,lk.description,lk.weight,lk.visible,lk.type,lk.created_at,u
$result=Database::query($sql);
$list_info=array();
while ($row=Database::fetch_row($result)) {
$list_info[]=$row;
$list_info[] = $row;
}
foreach($list_info as $key => $info_log) {
$list_info[$key][5]=($info_log[5]) ? api_convert_and_format_date($info_log[5]) : 'N/A';
$list_info[$key][3]=($info_log[3]==1) ? get_lang('GradebookVisible') : get_lang('GradebookInvisible');
$list_info[$key][5]=($info_log[5]) ? api_convert_and_format_date($info_log[5]) : 'N/A';
$list_info[$key][3]=($info_log[3]==1) ? get_lang('GradebookVisible') : get_lang('GradebookInvisible');
}
$parameters=array('visiblelink'=>Security::remove_XSS($_GET['visiblelink']),'selectcat'=>Security::remove_XSS($_GET['selectcat']));
$table = new SortableTableFromArrayConfig($list_info, 1,20,'gradebooklink');
$table->set_additional_parameters($parameters);
$table->set_header(0, get_lang('GradebookNameLog'));

@ -1,12 +1,10 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Script
* @package chamilo.gradebook
*/
/**
* Init
*/
$language_file= array('gradebook','tracking');
@ -20,22 +18,22 @@ require_once 'lib/fe/displaygradebook.php';
api_block_anonymous_users();
$eval= Evaluation :: load($_GET['selecteval']);
if ($eval[0]->get_category_id() < 0) {
// if category id is negative, then the evaluation's origin is a link
$link= LinkFactory :: get_evaluation_link($eval[0]->get_id());
$currentcat = Category :: load($link->get_category_id());
if ($eval[0]->get_category_id() < 0) {
// if category id is negative, then the evaluation's origin is a link
$link= LinkFactory :: get_evaluation_link($eval[0]->get_id());
$currentcat = Category :: load($link->get_category_id());
} else {
$currentcat = Category :: load($eval[0]->get_category_id());
$currentcat = Category :: load($eval[0]->get_category_id());
}
$interbreadcrumb[]= array (
'url' => $_SESSION['gradebook_dest'].'?selectcat=' . $currentcat[0]->get_id(), 'name' => get_lang('ToolGradebook'));
'url' => $_SESSION['gradebook_dest'].'?selectcat=' . $currentcat[0]->get_id(), 'name' => get_lang('ToolGradebook'));
if (api_is_allowed_to_edit()) {
$interbreadcrumb[]= array (
'url' => 'gradebook_view_result.php?selecteval=' . Security::remove_XSS($_GET['selecteval']),
'name' => get_lang('ViewResult'
));
$interbreadcrumb[]= array (
'url' => 'gradebook_view_result.php?selecteval=' . Security::remove_XSS($_GET['selecteval']),
'name' => get_lang('ViewResult'
));
}
$displayscore = ScoreDisplay :: instance();
@ -44,56 +42,56 @@ DisplayGradebook::display_header_result($eval[0], $currentcat[0]->get_id(), 0, '
//Bad, Regular, Good - User definitions
$displays = $displayscore->get_custom_score_display_settings();
if (!$displayscore->is_custom() || empty($displays)) {
if (api_is_platform_admin() || api_is_course_admin()) {
Display :: display_error_message(get_lang('PleaseEnableScoringSystem'),false);
Display :: display_error_message(get_lang('PleaseEnableScoringSystem'),false);
}
} else {
$allresults = Result::load(null,null,$eval[0]->get_id());
$nr_items = array();
foreach ($displays as $itemsdisplay) {
$nr_items[$itemsdisplay['display']] = 0;
}
$resultcount = 0;
foreach ($allresults as $result) {
$score = $result->get_score();
if (isset($score)) {
$display = $displayscore->display_score(array($score, $eval[0]->get_max()), SCORE_CUSTOM, SCORE_ONLY_CUSTOM, true);
$nr_items[$display]++;
$resultcount++;
}
}
} else {
$allresults = Result::load(null,null,$eval[0]->get_id());
$nr_items = array();
foreach ($displays as $itemsdisplay) {
$nr_items[$itemsdisplay['display']] = 0;
}
$resultcount = 0;
foreach ($allresults as $result) {
$score = $result->get_score();
if (isset($score)) {
$display = $displayscore->display_score(array($score, $eval[0]->get_max()), SCORE_CUSTOM, SCORE_ONLY_CUSTOM, true);
$nr_items[$display]++;
$resultcount++;
}
}
$keys = array_keys($nr_items);
// find the region with the most scores, this is 100% of the bar
$highest_ratio = 0;
foreach($keys as $key) {
if ($nr_items[$key] > $highest_ratio) {
$highest_ratio = $nr_items[$key];
}
}
// Generate table
$stattable= '<table class="data_table" cellspacing="0" cellpadding="3">';
$stattable .= '<tr><th>' . get_lang('ScoringSystem') . '</th>';
$keys = array_keys($nr_items);
// find the region with the most scores, this is 100% of the bar
$highest_ratio = 0;
foreach($keys as $key) {
if ($nr_items[$key] > $highest_ratio) {
$highest_ratio = $nr_items[$key];
}
}
// Generate table
$stattable= '<table class="data_table" cellspacing="0" cellpadding="3">';
$stattable .= '<tr><th>' . get_lang('ScoringSystem') . '</th>';
$stattable .= '<th>' . get_lang('Percentage') . '</th>';
$stattable .= '<th>' . get_lang('CountUsers') . '</th>';
//$stattable .= '<th>' . get_lang('Statistics') . '</th></tr>';
$counter=0;
foreach ($keys as $key) {
$bar = ($highest_ratio > 0?($nr_items[$key] / $highest_ratio) * 100:0);
$stattable .= '<tr class="row_' . ($counter % 2 == 0 ? 'odd' : 'even') . '">';
$stattable .= '<td width="150">' . $key . '</td>';
$stattable .= '<td width="550">'.Display::bar_progress($bar).'</td>';
$stattable .= '<td align="right">' . $nr_items[$key] . '</td>';
$counter++;
}
$stattable .= '</tr></table>';
echo $stattable;
$counter=0;
foreach ($keys as $key) {
$bar = ($highest_ratio > 0?($nr_items[$key] / $highest_ratio) * 100:0);
$stattable .= '<tr class="row_' . ($counter % 2 == 0 ? 'odd' : 'even') . '">';
$stattable .= '<td width="150">' . $key . '</td>';
$stattable .= '<td width="550">'.Display::bar_progress($bar).'</td>';
$stattable .= '<td align="right">' . $nr_items[$key] . '</td>';
$counter++;
}
$stattable .= '</tr></table>';
echo $stattable;
}
Display :: display_footer();

@ -1,13 +1,10 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Script
* @package chamilo.gradebook
*/
/**
* Init
*/
$language_file[] = 'gradebook';
require_once '../inc/global.inc.php';
@ -34,7 +31,7 @@ block_students();
$interbreadcrumb[] = array(
'url' => $_SESSION['gradebook_dest'],
'name' => get_lang('Gradebook'
));
));
//load the evaluation & category
$select_eval = Security::remove_XSS($_GET['selecteval']);
@ -321,12 +318,14 @@ if (isset($_GET['export'])) {
}
}
}
if (isset($_GET['resultdelete'])) {
$result = Result :: load($_GET['resultdelete']);
$result[0]->delete();
header('Location: gradebook_view_result.php?deleteresult=&selecteval=' . Security::remove_XSS($_GET['selecteval']));
exit;
}
if (isset($_POST['action'])) {
$number_of_selected_items = count($_POST['id']);
if ($number_of_selected_items == '0') {
@ -380,7 +379,7 @@ if (isset($_GET['print'])) {
}
$htmlHeadXtra[] = '<script type="text/javascript">
function confirmationuser() {
if (confirm("' . get_lang('DeleteUser') . '?"))
{return true;}

File diff suppressed because it is too large Load Diff

@ -1,12 +1,10 @@
<?php // $Id: $
<?php
/* For licensing terms, see /license.txt */
/**
* Script
* @package chamilo.gradebook
*/
/**
* Init
*/
$language_file = 'gradebook';
//$cidReset = true;
require_once '../inc/global.inc.php';
@ -16,13 +14,13 @@ require_once api_get_path(LIBRARY_PATH) . 'import.lib.php';
api_block_anonymous_users();
if (isset($_GET['userid'])) {
$user_id = Security::remove_XSS($_GET['userid']);
$user = UserManager::get_user_info_by_id($user_id);
if (!$user) {
api_not_allowed();
}
$user_id = Security::remove_XSS($_GET['userid']);
$user = UserManager::get_user_info_by_id($user_id);
if (!$user) {
api_not_allowed();
}
} else {
api_not_allowed();
api_not_allowed();
}
require_once 'lib/be.inc.php';
@ -32,14 +30,14 @@ block_students();
$form = new UserForm(UserForm :: TYPE_USER_INFO, $user, 'user_info_form', null, api_get_self() . '?userid=' . $user_id . '&selectcat=' . Security::remove_XSS($_GET['selectcat']));
if ($form->validate()) {
header('Location: user_stats.php?selectcat=' . Security::remove_XSS($_GET['selectcat']).'&userid=' .$user_id);
exit;
header('Location: user_stats.php?selectcat=' . Security::remove_XSS($_GET['selectcat']).'&userid=' .$user_id);
exit;
}
$interbreadcrumb[] = array (
'url' => $_SESSION['gradebook_dest'],
'name' => get_lang('Gradebook'
));
'url' => $_SESSION['gradebook_dest'],
'name' => get_lang('Gradebook'
));
Display :: display_header(get_lang('UserInfo'));
//User picture size is calculated from SYSTEM path
@ -50,12 +48,12 @@ $image_path = UserManager::get_user_picture_path_by_id($user_id,'web',false,true
$image_file = $image_path['dir'].$image_path['file'];
$img_attributes = 'src="'.$image_file.'?rand='.time().'" '
.'alt="'.api_get_person_name($user_data['firstname'], $user_data['lastname']).'" '
.'style="float:left; padding:5px;" ';
.'alt="'.api_get_person_name($user_data['firstname'], $user_data['lastname']).'" '
.'style="float:left; padding:5px;" ';
if ($image_size[0] > 300) {
//limit display width to 300px
$img_attributes .= 'width="300" ';
//limit display width to 300px
$img_attributes .= 'width="300" ';
}
//@todo need a "makeup"
echo '<img '.$img_attributes.'/>';

@ -1,12 +1,10 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Script
* @package chamilo.gradebook
*/
/**
* Init
*/
$language_file= 'gradebook';
@ -23,8 +21,8 @@ api_block_anonymous_users();
block_students();
$interbreadcrumb[]= array (
'url' => $_SESSION['gradebook_dest'],
'name' => get_lang('Gradebook'
'url' => $_SESSION['gradebook_dest'],
'name' => get_lang('Gradebook'
));
$category = Category :: load($_GET['selectcat']);
@ -33,37 +31,37 @@ $allevals= $category[0]->get_evaluations($my_user_id, true);
$alllinks= $category[0]->get_links($my_user_id, true);
if ($_GET['selectcat'] != null) {
$addparams= array (
'userid' => $my_user_id,
'selectcat' => Security::remove_XSS($_GET['selectcat'])
);
$addparams= array (
'userid' => $my_user_id,
'selectcat' => Security::remove_XSS($_GET['selectcat'])
);
} else {
$addparams= array (
'userid' => $my_user_id,
'selecteval' => Security::remove_XSS($_GET['selecteval'])
);
$addparams= array (
'userid' => $my_user_id,
'selecteval' => Security::remove_XSS($_GET['selecteval'])
);
}
$user_table= new UserTable($my_user_id, $allevals, $alllinks, $addparams);
if (isset ($_GET['exportpdf'])) {
$datagen = new UserDataGenerator($my_user_id, $allevals, $alllinks);
$data_array = $datagen->get_data(UserDataGenerator :: UDG_SORT_NAME, 0, null, true);
$newarray = array ();
$displayscore = Scoredisplay :: instance();
foreach ($data_array as $data) {
$datagen = new UserDataGenerator($my_user_id, $allevals, $alllinks);
$data_array = $datagen->get_data(UserDataGenerator :: UDG_SORT_NAME, 0, null, true);
$newarray = array ();
$displayscore = Scoredisplay :: instance();
foreach ($data_array as $data) {
$newarray[] = array_slice($data, 1);
}
$userinfo = get_user_info_from_id($my_user_id);
$html .= get_lang('Results').' : '.api_get_person_name($userinfo['firstname'], $userinfo['lastname']).' ('. api_convert_and_format_date(null, DATE_FORMAT_SHORT). ' ' . api_convert_and_format_date(null, TIME_NO_SEC_FORMAT) .')';
}
$userinfo = get_user_info_from_id($my_user_id);
$html .= get_lang('Results').' : '.api_get_person_name($userinfo['firstname'], $userinfo['lastname']).' ('. api_convert_and_format_date(null, DATE_FORMAT_SHORT). ' ' . api_convert_and_format_date(null, TIME_NO_SEC_FORMAT) .')';
if ($displayscore->is_custom()) {
$header_names= array (
if ($displayscore->is_custom()) {
$header_names= array (
get_lang('Evaluation'), get_lang('Course'), get_lang('Category'), get_lang('EvaluationAverage'),get_lang('Result'),get_lang('Display'));
} else {
$header_names= array (
get_lang('Evaluation'), get_lang('Course'), get_lang('Category'), get_lang('EvaluationAverage'),get_lang('Result'));
}
} else {
$header_names= array (
get_lang('Evaluation'), get_lang('Course'), get_lang('Category'), get_lang('EvaluationAverage'),get_lang('Result'));
}
$table = new HTML_Table(array('class' => 'data_table'));
$row = 0;
@ -87,21 +85,21 @@ if (isset ($_GET['exportpdf'])) {
require_once api_get_path(LIBRARY_PATH).'pdf.lib.php';
$pdf = new PDF();
$pdf->content_to_pdf($html);
exit;
exit;
}
$actions = '<div class="actions">';
if (isset($_GET['selectcat'])) {
$interbreadcrumb[]= array ('url' => 'gradebook_flatview.php?selectcat=' . Security::remove_XSS($_GET['selectcat']), 'name' => get_lang('FlatView'));
$actions.= '<a href=gradebook_flatview.php?selectcat=' .Security::remove_XSS($_GET['selectcat']) . '>' . Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('FlatView'),'',ICON_SIZE_MEDIUM).'</a>';
$interbreadcrumb[]= array ('url' => 'gradebook_flatview.php?selectcat=' . Security::remove_XSS($_GET['selectcat']), 'name' => get_lang('FlatView'));
$actions.= '<a href=gradebook_flatview.php?selectcat=' .Security::remove_XSS($_GET['selectcat']) . '>' . Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('FlatView'),'',ICON_SIZE_MEDIUM).'</a>';
}
if (isset ($_GET['selecteval'])) {
$interbreadcrumb[]= array (
'url' => 'gradebook_view_result.php?selecteval=' . Security::remove_XSS($_GET['selecteval']),
'name' => get_lang('ViewResult'
));
$actions.= '<a href=gradebook_view_result.php?selecteval=' . Security::remove_XSS($_GET['selecteval']) . '>
$interbreadcrumb[]= array (
'url' => 'gradebook_view_result.php?selecteval=' . Security::remove_XSS($_GET['selecteval']),
'name' => get_lang('ViewResult'
));
$actions.= '<a href=gradebook_view_result.php?selecteval=' . Security::remove_XSS($_GET['selecteval']) . '>
'.Display::return_icon('back.png', get_lang('BackToEvaluation'),'',ICON_SIZE_MEDIUM).'</a>';
}

Loading…
Cancel
Save