Remove unused code, format code, update docs

1.10.x
Julio Montoya 10 years ago
parent 954e7be989
commit 65ee1ebf4d
  1. 38
      main/gradebook/gradebook.php
  2. 11
      main/gradebook/gradebook_add_cat.php
  3. 2
      main/gradebook/gradebook_add_link_select_course.php
  4. 21
      main/gradebook/gradebook_display_summary.php
  5. 13
      main/gradebook/gradebook_edit_all.php
  6. 11
      main/gradebook/gradebook_edit_eval.php
  7. 11
      main/gradebook/gradebook_edit_link.php
  8. 11
      main/gradebook/gradebook_edit_result.php
  9. 9
      main/gradebook/gradebook_showlog_eval.php
  10. 12
      main/gradebook/gradebook_showlog_link.php
  11. 7
      main/gradebook/gradebook_view_result.php
  12. 98
      main/gradebook/lib/be/dropboxlink.class.php
  13. 169
      main/gradebook/lib/gradebook_result.class.php
  14. 22
      main/gradebook/lib/results_data_generator.class.php
  15. 34
      main/gradebook/lib/scoredisplay.class.php
  16. 59
      main/gradebook/lib/user_data_generator.class.php
  17. 18
      main/gradebook/open_document.php
  18. 19
      main/gradebook/user_stats.php
  19. 4
      main/group/group.php
  20. 8
      main/group/group_category.php
  21. 4
      main/group/group_edit.php
  22. 7
      main/group/group_overview.php
  23. 8
      main/group/group_space.php
  24. 2
      main/group/settings.php
  25. 12
      main/group/tutor_settings.php

@ -33,10 +33,11 @@ api_block_anonymous_users();
$htmlHeadXtra[]= '<script type="text/javascript"> $htmlHeadXtra[]= '<script type="text/javascript">
function confirmation () function confirmation ()
{ {
if (confirm("' . get_lang('DeleteAll') . '?")) if (confirm("'.get_lang('DeleteAll').'?")) {
{return true;} return true;
else } else {
{return false;} return false;
}
} }
</script>'; </script>';
$filter_confirm_msg = true; $filter_confirm_msg = true;
@ -68,7 +69,7 @@ if (isset ($_GET['createallcategories'])) {
$selectcat=isset($_GET['selectcat']) ? Security::remove_XSS($_GET['selectcat']) : ''; $selectcat=isset($_GET['selectcat']) ? Security::remove_XSS($_GET['selectcat']) : '';
if (isset ($_GET['movecat'])) { if (isset ($_GET['movecat'])) {
$move_cat=Security::remove_XSS($_GET['movecat']); $move_cat = Security::remove_XSS($_GET['movecat']);
GradebookUtils::block_students(); GradebookUtils::block_students();
$cats= Category :: load($move_cat); $cats= Category :: load($move_cat);
if (!isset ($_GET['targetcat'])) { if (!isset ($_GET['targetcat'])) {
@ -94,9 +95,9 @@ if (isset ($_GET['movecat'])) {
header('Location: ' . api_get_self() . '?categorymoved=&selectcat=' . Security::remove_XSS($_GET['selectcat'])); header('Location: ' . api_get_self() . '?categorymoved=&selectcat=' . Security::remove_XSS($_GET['selectcat']));
exit; exit;
} }
unset ($targetcat); unset($targetcat);
} }
unset ($cats); unset($cats);
} }
//move an evaluation //move an evaluation
@ -140,7 +141,14 @@ if (isset ($_GET['movelink'])) {
GradebookUtils::block_students(); GradebookUtils::block_students();
$get_move_link=Security::remove_XSS($_GET['movelink']); $get_move_link=Security::remove_XSS($_GET['movelink']);
$link= LinkFactory :: load($get_move_link); $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'])); $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()) { if ($move_form->validate()) {
$targetcat= Category :: load($move_form->exportValue('move_cat')); $targetcat= Category :: load($move_form->exportValue('move_cat'));
$link[0]->move_to_cat($targetcat[0]); $link[0]->move_to_cat($targetcat[0]);
@ -468,12 +476,12 @@ if (!empty($keyword)) {
$allcat= array (); $allcat= array ();
if ((isset($_GET['selectcat']) && $_GET['selectcat']==0) && isset($_GET['search'])) { if ((isset($_GET['selectcat']) && $_GET['selectcat']==0) && isset($_GET['search'])) {
$allcat= $cats[0]->get_subcategories(null); $allcat= $cats[0]->get_subcategories(null);
$allcat_info = Category :: find_category($keyword,$allcat); $allcat_info = Category::find_category($keyword,$allcat);
$alleval=array(); $alleval=array();
$alllink=array(); $alllink=array();
} else { } else {
$alleval = Evaluation :: find_evaluations($keyword, $cats[0]->get_id()); $alleval = Evaluation::find_evaluations($keyword, $cats[0]->get_id());
$alllink = LinkFactory :: find_links($keyword, $cats[0]->get_id()); $alllink = LinkFactory::find_links($keyword, $cats[0]->get_id());
} }
} elseif (isset ($_GET['studentoverview'])) { } elseif (isset ($_GET['studentoverview'])) {
@ -586,7 +594,13 @@ if (isset($allcat_info) && count($allcat_info)>=0 && (isset($_GET['selectcat'])
} else { } else {
$allcat=$allcat; $allcat=$allcat;
} }
$gradebooktable= new GradebookTable($cats[0], $allcat, $alleval, $alllink, $addparams); $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()) { 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);
} }

@ -161,17 +161,6 @@ $interbreadcrumb[]= array( 'url' =>'index.php','name' => get_lang('ToolGradebook
Display :: display_header(get_lang('NewCategory')); Display :: display_header(get_lang('NewCategory'));
$display_form = true; $display_form = true;
/*if (!empty($grading_contents)) {
$count_items = count($grading_contents['items']);
$cats = Category :: load(null, null, $course_code, null, null, $session_id, false); //already init
$cats_count = count($cats) - 1 ;
if ($cats_count >= $count_items) {
Display::display_warning_message(get_lang('CheckYourGradingModelValues'));
$display_form = false;
}
}*/
if ($display_form) { if ($display_form) {
$form->display(); $form->display();
} }

@ -5,7 +5,7 @@
* Script * Script
* @package chamilo.gradebook * @package chamilo.gradebook
*/ */
//$cidReset = true;
require_once '../inc/global.inc.php'; require_once '../inc/global.inc.php';
$current_course_tool = TOOL_GRADEBOOK; $current_course_tool = TOOL_GRADEBOOK;

@ -63,21 +63,6 @@ switch ($action) {
$userId = isset($_GET['user_id']) && $_GET['user_id'] ? $_GET['user_id'] : null; $userId = isset($_GET['user_id']) && $_GET['user_id'] ? $_GET['user_id'] : null;
GradebookUtils::generateTable($userId, $cat_id); GradebookUtils::generateTable($userId, $cat_id);
break; break;
/*case 'generate_all_certificates':
$user_list = CourseManager::get_user_list_from_course_code(api_get_course_id(), api_get_session_id());
if (!empty($user_list)) {
foreach ($user_list as $user_info) {
if ($user_info['status'] == INVITEE) {
continue;
}
Category::register_user_certificate($cat_id, $user_info['user_id']);
}
}
break;
case 'delete_all_certificates':
Category::deleteAllCertificates($cat_id);
break;*/
} }
$course_code = api_get_course_id(); $course_code = api_get_course_id();
@ -94,12 +79,6 @@ $token = Security::get_token();
echo Display::page_header(get_lang('GradebookListOfStudentsReports')); echo Display::page_header(get_lang('GradebookListOfStudentsReports'));
echo '<div class="btn-group">'; echo '<div class="btn-group">';
/*$url = api_get_self().'?action=generate_all_certificates'.'&'.api_get_cidReq().'&selectcat='.$cat_id;
echo Display::url(get_lang('GenerateCertificates'), $url, array('class' => 'btn'));
*/
/*$url = api_get_self().'?action=delete_all_certificates'.'&'.api_get_cidReq().'&selectcat='.$cat_id;
echo Display::url(get_lang('DeleteAllCertificates'), $url, array('class' => 'btn'));*/
if (count($userList) > 0) { if (count($userList) > 0) {
$url = api_get_self().'?action=export_all&'.api_get_cidReq().'&selectcat='.$cat_id; $url = api_get_self().'?action=export_all&'.api_get_cidReq().'&selectcat='.$cat_id;
echo Display::url(get_lang('ExportAllToPDF'), $url, array('class' => 'btn btn-default')); echo Display::url(get_lang('ExportAllToPDF'), $url, array('class' => 'btn btn-default'));

@ -34,13 +34,13 @@ $tbl_forum_thread = Database:: get_course_table(TABLE_FORUM_THREAD);
$tbl_work = Database:: get_course_table(TABLE_STUDENT_PUBLICATION); $tbl_work = Database:: get_course_table(TABLE_STUDENT_PUBLICATION);
$tbl_attendance = Database:: get_course_table(TABLE_ATTENDANCE); $tbl_attendance = Database:: get_course_table(TABLE_ATTENDANCE);
$table_evaluated[LINK_EXERCISE] = array(TABLE_QUIZ_TEST, 'title', 'id', get_lang('Exercise')); $table_evaluated[LINK_EXERCISE] = array(TABLE_QUIZ_TEST, 'title', 'id', get_lang('Exercise'));
$table_evaluated[LINK_DROPBOX] = array(TABLE_DROPBOX_FILE, 'name','id', get_lang('Dropbox')); $table_evaluated[LINK_DROPBOX] = array(TABLE_DROPBOX_FILE, 'name','id', get_lang('Dropbox'));
$table_evaluated[LINK_STUDENTPUBLICATION] = array(TABLE_STUDENT_PUBLICATION, 'url','id', get_lang('Student_publication')); $table_evaluated[LINK_STUDENTPUBLICATION] = array(TABLE_STUDENT_PUBLICATION, 'url','id', get_lang('Student_publication'));
$table_evaluated[LINK_LEARNPATH] = array(TABLE_LP_MAIN, 'name','id', get_lang('Learnpath')); $table_evaluated[LINK_LEARNPATH] = array(TABLE_LP_MAIN, 'name','id', get_lang('Learnpath'));
$table_evaluated[LINK_FORUM_THREAD] = array(TABLE_FORUM_THREAD, 'thread_title_qualify', 'thread_id', get_lang('Forum')); $table_evaluated[LINK_FORUM_THREAD] = array(TABLE_FORUM_THREAD, 'thread_title_qualify', 'thread_id', get_lang('Forum'));
$table_evaluated[LINK_ATTENDANCE] = array(TABLE_ATTENDANCE, 'attendance_title_qualify', 'id', get_lang('Attendance')); $table_evaluated[LINK_ATTENDANCE] = array(TABLE_ATTENDANCE, 'attendance_title_qualify', 'id', get_lang('Attendance'));
$table_evaluated[LINK_SURVEY] = array(TABLE_SURVEY, 'code', 'survey_id', get_lang('Survey')); $table_evaluated[LINK_SURVEY] = array(TABLE_SURVEY, 'code', 'survey_id', get_lang('Survey'));
$submitted = isset($_POST['submitted']) ? $_POST['submitted'] : ''; $submitted = isset($_POST['submitted']) ? $_POST['submitted'] : '';
if ($submitted==1) { if ($submitted==1) {
@ -206,7 +206,6 @@ if (!isset($_GET['exportpdf']) and !isset($_GET['export_certificate'])) {
</div> </div>
<?php <?php
$form->display(); $form->display();
$formNormal = new FormValidator('normal_weight', 'post', $currentUrl); $formNormal = new FormValidator('normal_weight', 'post', $currentUrl);

@ -5,7 +5,7 @@
* Script * Script
* @package chamilo.gradebook * @package chamilo.gradebook
*/ */
//$cidReset = true;
require_once '../inc/global.inc.php'; require_once '../inc/global.inc.php';
api_block_anonymous_users(); api_block_anonymous_users();
GradebookUtils::block_students(); GradebookUtils::block_students();
@ -33,15 +33,6 @@ if ($form->validate()) {
$eval->set_category_id($values['hid_category_id']); $eval->set_category_id($values['hid_category_id']);
$parent_cat = Category :: load($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'];
} 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']; $final_weight = $values['weight_mask'];
$eval->set_weight($final_weight); $eval->set_weight($final_weight);

@ -5,7 +5,6 @@
* Script * Script
* @package chamilo.gradebook * @package chamilo.gradebook
*/ */
//$cidReset = true;
require_once '../inc/global.inc.php'; require_once '../inc/global.inc.php';
api_block_anonymous_users(); api_block_anonymous_users();
@ -45,16 +44,6 @@ if ($form->validate()) {
$values = $form->exportValues(); $values = $form->exportValues();
$parent_cat = Category :: load($values['select_gradebook']); $parent_cat = Category :: load($values['select_gradebook']);
$final_weight = null;
/*
if ($parent_cat[0]->get_parent_id() == 0) {
$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']; $final_weight = $values['weight_mask'];
$link->set_weight($final_weight); $link->set_weight($final_weight);

@ -16,7 +16,14 @@ $evaluation = Evaluation :: load ($select_eval);
$evaluation[0]->check_lock_permissions(); $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); $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(); $table = $edit_result_form->toHtml();
if ($edit_result_form->validate()) { if ($edit_result_form->validate()) {
$values = $edit_result_form->exportValues(); $values = $edit_result_form->exportValues();
@ -43,6 +50,6 @@ $interbreadcrumb[]= array (
'name' => get_lang('ViewResult') 'name' => get_lang('ViewResult')
); );
Display :: display_header(get_lang('EditResult')); Display :: display_header(get_lang('EditResult'));
DisplayGradebook :: display_header_result ($evaluation[0],null,0,0); DisplayGradebook::display_header_result($evaluation[0],null,0,0);
echo $table; echo $table;
Display :: display_footer(); Display :: display_footer();

@ -4,7 +4,7 @@
* Script * Script
* @package chamilo.gradebook * @package chamilo.gradebook
*/ */
//$cidReset = true;
require_once '../inc/global.inc.php'; require_once '../inc/global.inc.php';
api_block_anonymous_users(); api_block_anonymous_users();
GradebookUtils::block_students(); GradebookUtils::block_students();
@ -44,8 +44,11 @@ foreach($list_info as $key => $info_log) {
$list_info[$key][3]=($info_log[3]==1) ? get_lang('GradebookVisible') : get_lang('GradebookInvisible'); $list_info[$key][3]=($info_log[3]==1) ? get_lang('GradebookVisible') : get_lang('GradebookInvisible');
} }
$parameters=array('visiblelog'=>$visible_log,'selectcat'=>intval($_GET['selectcat'])); $parameters = array(
$table = new SortableTableFromArrayConfig($list_info, 1,20,'gradebookeval'); 'visiblelog' => $visible_log,
'selectcat' => intval($_GET['selectcat']),
);
$table = new SortableTableFromArrayConfig($list_info, 1, 20, 'gradebookeval');
$table->set_additional_parameters($parameters); $table->set_additional_parameters($parameters);
$table->set_header(0, get_lang('GradebookNameLog')); $table->set_header(0, get_lang('GradebookNameLog'));

@ -5,7 +5,7 @@
* Script * Script
* @package chamilo.gradebook * @package chamilo.gradebook
*/ */
//$cidReset = true;
require_once '../inc/global.inc.php'; require_once '../inc/global.inc.php';
api_block_anonymous_users(); api_block_anonymous_users();
@ -24,7 +24,10 @@ $t_user = Database :: get_main_table(TABLE_MAIN_USER);
$t_link_log = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_LINKEVAL_LOG); $t_link_log = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_LINKEVAL_LOG);
$visible_link=Security::remove_XSS($_GET['visiblelink']); $visible_link=Security::remove_XSS($_GET['visiblelink']);
$evaledit = EvalLink :: load($visible_link); $evaledit = EvalLink :: load($visible_link);
$sql="SELECT lk.name,lk.description,lk.weight,lk.visible,lk.type,lk.created_at,us.username from ".$t_link_log." lk inner join ".$t_user." us on lk.user_id_log=us.user_id where lk.id_linkeval_log=".$evaledit[0]->get_id()." and lk.type='link';"; $sql = "SELECT lk.name,lk.description,lk.weight,lk.visible,lk.type,lk.created_at,us.username
FROM ".$t_link_log." lk inner join ".$t_user." us
ON lk.user_id_log=us.user_id
WHERE lk.id_linkeval_log=".$evaledit[0]->get_id()." AND lk.type='link';";
$result=Database::query($sql); $result=Database::query($sql);
$list_info=array(); $list_info=array();
while ($row=Database::fetch_row($result)) { while ($row=Database::fetch_row($result)) {
@ -36,7 +39,10 @@ foreach($list_info as $key => $info_log) {
$list_info[$key][3]=($info_log[3]==1) ? get_lang('GradebookVisible') : get_lang('GradebookInvisible'); $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'])); $parameters = array(
'visiblelink' => Security::remove_XSS($_GET['visiblelink']),
'selectcat' => Security::remove_XSS($_GET['selectcat']),
);
$table = new SortableTableFromArrayConfig($list_info, 1,20,'gradebooklink'); $table = new SortableTableFromArrayConfig($list_info, 1,20,'gradebooklink');
$table->set_additional_parameters($parameters); $table->set_additional_parameters($parameters);

@ -63,6 +63,7 @@ if (isset($_GET['editres'])) {
null, null,
api_get_self() . '?editres=' . $resultedit[0]->get_id() . '&selecteval=' . $select_eval_edit.'&'.api_get_cidreq() api_get_self() . '?editres=' . $resultedit[0]->get_id() . '&selecteval=' . $select_eval_edit.'&'.api_get_cidreq()
); );
if ($edit_res_form->validate()) { if ($edit_res_form->validate()) {
$values = $edit_res_form->exportValues(); $values = $edit_res_form->exportValues();
@ -125,7 +126,11 @@ if (isset($_GET['import'])) {
exit; exit;
break; break;
} else { } else {
GradebookUtils::overwritescore($allresult->get_id(), $importedresult['score'], $eval[0]->get_max()); GradebookUtils::overwritescore(
$allresult->get_id(),
$importedresult['score'],
$eval[0]->get_max()
);
$overwritescore++; $overwritescore++;
$added = '1'; $added = '1';
} }

@ -8,62 +8,62 @@
*/ */
class DropboxLink extends EvalLink class DropboxLink extends EvalLink
{ {
private $dropbox_table = null; private $dropbox_table = null;
/** /**
* Constructor * Constructor
*/ */
public function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();
$this->set_type(LINK_DROPBOX); $this->set_type(LINK_DROPBOX);
} }
/** /**
* *
* Returns the URL of a document * Returns the URL of a document
* This function is loaded when using a gradebook as a tab (gradebook = -1) see issue #2705 * This function is loaded when using a gradebook as a tab (gradebook = -1) see issue #2705
*/ */
public function get_view_url($stud_id) public function get_view_url($stud_id)
{ {
// find a file uploaded by the given student, // find a file uploaded by the given student,
// with the same title as the evaluation name // with the same title as the evaluation name
$eval = $this->get_evaluation(); $eval = $this->get_evaluation();
$sql = 'SELECT filename FROM '.$this->get_dropbox_table() $sql = 'SELECT filename FROM '.$this->get_dropbox_table()
.' WHERE c_id = '.$this->course_id.' AND uploader_id = '.intval($stud_id) .' WHERE c_id = '.$this->course_id.' AND uploader_id = '.intval($stud_id)
." AND title = '".Database::escape_string($eval->get_name())."'"; ." AND title = '".Database::escape_string($eval->get_name())."'";
$result = Database::query($sql); $result = Database::query($sql);
if ($fileurl = Database::fetch_row($result)) { if ($fileurl = Database::fetch_row($result)) {
return null; return null;
} else { } else {
return null; return null;
} }
} }
public function get_type_name() public function get_type_name()
{ {
return get_lang('LMSDropbox'); return get_lang('LMSDropbox');
} }
public function is_allowed_to_change_name() public function is_allowed_to_change_name()
{ {
return false; return false;
} }
/** /**
* Lazy load function to get the dropbox database table * Lazy load function to get the dropbox database table
*/ */
private function get_dropbox_table() private function get_dropbox_table()
{ {
$this->dropbox_table = Database :: get_course_table(TABLE_DROPBOX_FILE); $this->dropbox_table = Database :: get_course_table(TABLE_DROPBOX_FILE);
return $this->dropbox_table; return $this->dropbox_table;
} }
public function get_icon_name() public function get_icon_name()
{ {
return 'dropbox'; return 'dropbox';
} }
} }

@ -16,170 +16,6 @@ class GradeBookResult
*/ */
public function __construct($get_questions=false,$get_answers=false) public function __construct($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);
$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;
}
/**
* 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);
// 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
*/
public 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_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES);
$TBL_TRACK_HOTPOTATOES = Database::get_main_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 ,
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
user_id=te.exe_user_id AND te.c_id = ce.c_id
ORDER BY te.c_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,
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.c_id = $course_id
ORDER BY tth.c_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
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.c_id = ce.c_id
ORDER BY te.c_id ASC, ce.title ASC, te.exe_date ASC";
$hpsql="SELECT '',exe_name, exe_result , exe_weighting, exe_date
FROM $TBL_TRACK_HOTPOTATOES
WHERE exe_user_id = '".$user_id."' AND c_id = $course_id
ORDER BY c_id ASC, exe_date ASC";
}
$results = StatsUtils::getManyResultsXCol($sql, 8);
$hpresults = StatsUtils::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;
} }
/** /**
@ -191,7 +27,6 @@ class GradeBookResult
*/ */
public function exportCompleteReportCSV($dato) public function exportCompleteReportCSV($dato)
{ {
//$this->_getGradeBookReporting($document_path,$user_id);
$filename = 'gradebook_results_'.gmdate('YmdGis').'.csv'; $filename = 'gradebook_results_'.gmdate('YmdGis').'.csv';
if (!empty($user_id)) { if (!empty($user_id)) {
$filename = 'gradebook_results_user_'.$user_id.'_'.gmdate('YmdGis').'.csv'; $filename = 'gradebook_results_user_'.$user_id.'_'.gmdate('YmdGis').'.csv';
@ -235,6 +70,7 @@ class GradeBookResult
header('Content-Description: '.$filename); header('Content-Description: '.$filename);
header('Content-transfer-encoding: binary'); header('Content-transfer-encoding: binary');
echo $data; echo $data;
return true; return true;
} }
@ -287,8 +123,6 @@ class GradeBookResult
$_course = api_get_course_info(); $_course = api_get_course_info();
$filename = 'gb_results_'.$_course['code'].'_'.gmdate('YmdGis'); $filename = 'gb_results_'.$_course['code'].'_'.gmdate('YmdGis');
$filepath = api_get_path(SYS_ARCHIVE_PATH).$filename; $filepath = api_get_path(SYS_ARCHIVE_PATH).$filename;
//build the results
$inc = api_get_path(LIBRARY_PATH).'phpdocx/classes/CreateDocx.inc';
require_once api_get_path(LIBRARY_PATH).'phpdocx/classes/CreateDocx.inc'; require_once api_get_path(LIBRARY_PATH).'phpdocx/classes/CreateDocx.inc';
$docx = new CreateDocx(); $docx = new CreateDocx();
$paramsHeader = array( $paramsHeader = array(
@ -333,6 +167,7 @@ class GradeBookResult
header('Cache-Control: must-revalidate, post-check=0,pre-check=0'); header('Cache-Control: must-revalidate, post-check=0,pre-check=0');
header('Pragma: public'); header('Pragma: public');
echo $data; echo $data;
return true; return true;
} }
} }

@ -79,7 +79,11 @@ class ResultsDataGenerator
if ($pdf) { if ($pdf) {
$user['score'] = $result->get_score(); $user['score'] = $result->get_score();
} else { } else {
$user['score'] = $this->get_score_display($result->get_score(),true, $ignore_score_color); $user['score'] = $this->get_score_display(
$result->get_score(),
true,
$ignore_score_color
);
} }
$user['percentage_score'] = intval($scoredisplay->display_score( $user['percentage_score'] = intval($scoredisplay->display_score(
array($result->get_score(), $this->evaluation->get_max()), array($result->get_score(), $this->evaluation->get_max()),
@ -92,7 +96,11 @@ class ResultsDataGenerator
$user['scoreletter'] = $result->get_score(); $user['scoreletter'] = $result->get_score();
} }
if ($scoredisplay->is_custom()) { if ($scoredisplay->is_custom()) {
$user['display'] = $this->get_score_display($result->get_score(), false, $ignore_score_color); $user['display'] = $this->get_score_display(
$result->get_score(),
false,
$ignore_score_color
);
} }
$table[] = $user; $table[] = $user;
} }
@ -112,6 +120,7 @@ class ResultsDataGenerator
$table = array_reverse($table); $table = array_reverse($table);
} }
$return = array_slice($table, $start, $count); $return = array_slice($table, $start, $count);
return $return; return $return;
} }
@ -131,8 +140,15 @@ class ResultsDataGenerator
if ($realscore === true) { if ($realscore === true) {
$type = SCORE_DIV_PERCENT ; $type = SCORE_DIV_PERCENT ;
} }
return $scoredisplay->display_score(array($score, $this->evaluation->get_max()), $type, SCORE_BOTH, $ignore_score_color);
return $scoredisplay->display_score(
array($score, $this->evaluation->get_max()),
$type,
SCORE_BOTH,
$ignore_score_color
);
} }
return ''; return '';
} }

@ -124,7 +124,7 @@ class ScoreDisplay
/** /**
* Is coloring enabled ? * Is coloring enabled ?
*/ */
public function is_coloring_enabled () public function is_coloring_enabled()
{ {
return $this->coloring_enabled; return $this->coloring_enabled;
} }
@ -132,14 +132,15 @@ class ScoreDisplay
/** /**
* Is custom score display enabled ? * Is custom score display enabled ?
*/ */
public function is_custom() { public function is_custom()
{
return $this->custom_enabled; return $this->custom_enabled;
} }
/** /**
* Is upperlimit included ? * Is upperlimit included ?
*/ */
public function is_upperlimit_included () public function is_upperlimit_included()
{ {
return $this->upperlimit_included; return $this->upperlimit_included;
} }
@ -151,6 +152,7 @@ class ScoreDisplay
*/ */
public function get_custom_score_display_settings() public function get_custom_score_display_settings()
{ {
return $this->custom_display; return $this->custom_display;
} }
@ -170,8 +172,8 @@ class ScoreDisplay
private function get_current_gradebook_category_id() private function get_current_gradebook_category_id()
{ {
$tbl_gradebook_category = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_CATEGORY); $tbl_gradebook_category = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_CATEGORY);
$curr_course_code = api_get_course_id(); $curr_course_code = api_get_course_id();
$curr_session_id = api_get_session_id(); $curr_session_id = api_get_session_id();
if (empty($curr_session_id)) { if (empty($curr_session_id)) {
$session_condition = ' AND session_id is null '; $session_condition = ' AND session_id is null ';
@ -179,13 +181,15 @@ class ScoreDisplay
$session_condition = ' AND session_id = '.$curr_session_id; $session_condition = ' AND session_id = '.$curr_session_id;
} }
$sql = 'SELECT id FROM '.$tbl_gradebook_category.' WHERE course_code = "'.$curr_course_code.'" '. $session_condition; $sql = 'SELECT id FROM '.$tbl_gradebook_category.'
WHERE course_code = "'.$curr_course_code.'" '. $session_condition;
$rs = Database::query($sql); $rs = Database::query($sql);
$category_id = 0; $category_id = 0;
if (Database::num_rows($rs) > 0) { if (Database::num_rows($rs) > 0) {
$row = Database::fetch_row($rs); $row = Database::fetch_row($rs);
$category_id = $row[0]; $category_id = $row[0];
} }
return $category_id; return $category_id;
} }
@ -267,6 +271,7 @@ class ScoreDisplay
if (!isset($number_decimals)) { if (!isset($number_decimals)) {
$number_decimals = 0; $number_decimals = 0;
} }
return $number_decimals; return $number_decimals;
} }
@ -303,6 +308,7 @@ class ScoreDisplay
if ($type == SCORE_BAR) { if ($type == SCORE_BAR) {
$percentage = $my_score[0]/$my_score[1]*100; $percentage = $my_score[0]/$my_score[1]*100;
return Display::bar_progress($percentage); return Display::bar_progress($percentage);
} }
@ -325,6 +331,7 @@ class ScoreDisplay
$display = Display::tag('font', $display, array('color'=>'red')); $display = Display::tag('font', $display, array('color'=>'red'));
} }
} }
return $display; return $display;
} }
@ -404,6 +411,7 @@ class ScoreDisplay
private function display_as_decimal($score) private function display_as_decimal($score)
{ {
$score_denom = ($score[1]==0) ? 1 : $score[1]; $score_denom = ($score[1]==0) ? 1 : $score[1];
return $this->format_score($score[0]/$score_denom); return $this->format_score($score[0]/$score_denom);
} }
@ -413,13 +421,15 @@ class ScoreDisplay
private function display_as_percent($score) private function display_as_percent($score)
{ {
$score_denom = ($score[1]==0) ? 1 : $score[1]; $score_denom = ($score[1]==0) ? 1 : $score[1];
return $this->format_score($score[0]/$score_denom*100) . ' %'; return $this->format_score($score[0]/$score_denom*100) . ' %';
} }
/** /**
*
* Returns 10.00 / 10.00 for array("100", "100"); * Returns 10.00 / 10.00 for array("100", "100");
* @param array $score * @param array $score
*
* @return string
*/ */
private function display_as_div($score) private function display_as_div($score)
{ {
@ -471,20 +481,23 @@ class ScoreDisplay
$category_id = $this->get_current_gradebook_category_id(); $category_id = $this->get_current_gradebook_category_id();
} }
$sql = 'SELECT score_color_percent FROM '.$tbl_display.' WHERE category_id = '.$category_id.' LIMIT 1'; $sql = 'SELECT score_color_percent FROM '.$tbl_display.'
WHERE category_id = '.$category_id.'
LIMIT 1';
$result = Database::query($sql); $result = Database::query($sql);
$score = 0; $score = 0;
if (Database::num_rows($result) > 0) { if (Database::num_rows($result) > 0) {
$row = Database::fetch_row($result); $row = Database::fetch_row($result);
$score = $row[0]; $score = $row[0];
} }
return $score; return $score;
} }
/** /**
* Get current custom score display settings * Get current custom score display settings
* @param int Gradebook category id * @param int Gradebook category id
* @return array 2-dimensional array - every element contains 3 subelements (id, score, display) * @return array 2-dimensional array every element contains 3 subelements (id, score, display)
*/ */
private function get_custom_displays($category_id = null) private function get_custom_displays($category_id = null)
{ {
@ -498,6 +511,7 @@ class ScoreDisplay
WHERE category_id = '.$category_id.' WHERE category_id = '.$category_id.'
ORDER BY score'; ORDER BY score';
$result = Database::query($sql); $result = Database::query($sql);
return Database::store_result($result,'ASSOC'); return Database::store_result($result,'ASSOC');
} }

@ -32,35 +32,35 @@ class UserDataGenerator
public function UserDataGenerator($userid, $evals = array(), $links = array()) public function UserDataGenerator($userid, $evals = array(), $links = array())
{ {
$this->userid = $userid; $this->userid = $userid;
$evals_filtered = array(); $evals_filtered = array();
$result = array(); $result = array();
foreach ($evals as $eval) { foreach ($evals as $eval) {
$toadd = true; $toadd = true;
$coursecode = $eval->get_course_code(); $coursecode = $eval->get_course_code();
if (isset($coursecode)) { if (isset($coursecode)) {
$result = Result :: load(null, $userid, $eval->get_id()); $result = Result :: load(null, $userid, $eval->get_id());
if (count($result) == 0) { if (count($result) == 0) {
$toadd = false; $toadd = false;
} }
} }
if ($toadd) { if ($toadd) {
$evals_filtered_copy = $evals; $evals_filtered_copy = $evals;
} }
} }
if (count($result) == 0) { if (count($result) == 0) {
$evals_filtered=$evals; $evals_filtered=$evals;
} else { } else {
$evals_filtered=$evals_filtered_copy; $evals_filtered=$evals_filtered_copy;
} }
$this->items = array_merge($evals_filtered, $links); $this->items = array_merge($evals_filtered, $links);
$this->coursecodecache = array(); $this->coursecodecache = array();
$this->categorycache = array(); $this->categorycache = array();
$this->scorecache = null; $this->scorecache = null;
$this->avgcache = null; $this->avgcache = null;
} }
/** /**
* Get total number of items (rows) * Get total number of items (rows)
@ -192,6 +192,7 @@ class UserDataGenerator
$cat2 = $this->get_category_cached($item2->get_category_id()); $cat2 = $this->get_category_cached($item2->get_category_id());
$name1 = api_strtolower($this->get_category_name_to_display($cat1)); $name1 = api_strtolower($this->get_category_name_to_display($cat1));
$name2 = api_strtolower($this->get_category_name_to_display($cat2)); $name2 = api_strtolower($this->get_category_name_to_display($cat2));
return api_strnatcmp($name1, $name2); return api_strnatcmp($name1, $name2);
} }
@ -214,6 +215,7 @@ class UserDataGenerator
{ {
$score1 = $this->avgcache[$item1->get_item_type() . $item1->get_id()]; $score1 = $this->avgcache[$item1->get_item_type() . $item1->get_id()];
$score2 = $this->avgcache[$item2->get_item_type() . $item2->get_id()]; $score2 = $this->avgcache[$item2->get_item_type() . $item2->get_id()];
return $this->compare_scores($score1, $score2); return $this->compare_scores($score1, $score2);
} }
@ -226,6 +228,7 @@ class UserDataGenerator
{ {
$score1 = $this->scorecache[$item1->get_item_type() . $item1->get_id()]; $score1 = $this->scorecache[$item1->get_item_type() . $item1->get_id()];
$score2 = $this->scorecache[$item2->get_item_type() . $item2->get_id()]; $score2 = $this->scorecache[$item2->get_item_type() . $item2->get_id()];
return $this->compare_scores($score1, $score2); return $this->compare_scores($score1, $score2);
} }
@ -238,6 +241,7 @@ class UserDataGenerator
{ {
$score1 = $this->scorecache[$item1->get_item_type() . $item1->get_id()]; $score1 = $this->scorecache[$item1->get_item_type() . $item1->get_id()];
$score2 = $this->scorecache[$item2->get_item_type() . $item2->get_id()]; $score2 = $this->scorecache[$item2->get_item_type() . $item2->get_id()];
return ScoreDisplay :: compare_scores_by_custom_display($score1, $score2); return ScoreDisplay :: compare_scores_by_custom_display($score1, $score2);
} }
@ -313,6 +317,7 @@ class UserDataGenerator
if ($ignore_score_color) { if ($ignore_score_color) {
$displaytype |= SCORE_IGNORE_SPLIT; $displaytype |= SCORE_IGNORE_SPLIT;
} }
return $scoredisplay->display_score($studscore, $displaytype, SCORE_ONLY_DEFAULT); return $scoredisplay->display_score($studscore, $displaytype, SCORE_ONLY_DEFAULT);
} }

@ -1,18 +0,0 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Script
* @package chamilo.gradebook
*/
/**
* Init
*/
//Disabling code due issue #2705 gradebook with id "-1"
exit;
/*
require_once '../inc/global.inc.php';
require_once '../inc/lib/document.lib.php';
api_block_anonymous_users();
DocumentManager :: file_send_for_download(api_get_path(SYS_COURSE_PATH).$_GET['file']);
exit;
*/

@ -52,11 +52,22 @@ if (isset ($_GET['exportpdf'])) {
$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) .')'; $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()) { if ($displayscore->is_custom()) {
$header_names= array ( $header_names = array(
get_lang('Evaluation'), get_lang('Course'), get_lang('Category'), get_lang('EvaluationAverage'),get_lang('Result'),get_lang('Display')); get_lang('Evaluation'),
get_lang('Course'),
get_lang('Category'),
get_lang('EvaluationAverage'),
get_lang('Result'),
get_lang('Display'),
);
} else { } else {
$header_names= array ( $header_names = array(
get_lang('Evaluation'), get_lang('Course'), get_lang('Category'), get_lang('EvaluationAverage'),get_lang('Result')); get_lang('Evaluation'),
get_lang('Course'),
get_lang('Category'),
get_lang('EvaluationAverage'),
get_lang('Result'),
);
} }
$table = new HTML_Table(array('class' => 'data_table')); $table = new HTML_Table(array('class' => 'data_table'));

@ -194,13 +194,9 @@ if (api_is_allowed_to_edit(false, true)) {
$actionsRight = GroupManager::getSearchForm(); $actionsRight = GroupManager::getSearchForm();
$toolbar = Display::toolbarAction('toolbar-groups', $content = array( 0 => $actionsLeft, 1 => $actionsRight )); $toolbar = Display::toolbarAction('toolbar-groups', $content = array( 0 => $actionsLeft, 1 => $actionsRight ));
$group_cats = GroupManager::get_categories(api_get_course_id()); $group_cats = GroupManager::get_categories(api_get_course_id());
echo $toolbar; echo $toolbar;
echo UserManager::getUserSubscriptionTab(3); echo UserManager::getUserSubscriptionTab(3);

@ -80,7 +80,7 @@ $(document).ready( function() {
}); });
</script>'; </script>';
$interbreadcrumb[] = array ('url' => 'group.php', 'name' => get_lang('Groups')); $interbreadcrumb[] = array('url' => 'group.php?'.api_get_cidReq(), 'name' => get_lang('Groups'));
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
@ -88,7 +88,11 @@ $course_id = api_get_course_int_id();
if (isset($_GET['id'])) { if (isset($_GET['id'])) {
// Update settings of existing category // Update settings of existing category
$action = 'update_settings'; $action = 'update_settings';
$form = new FormValidator('group_category', 'post', '?id='.$category['id']); $form = new FormValidator(
'group_category',
'post',
api_get_self().'?id='.$category['id'].'&'.api_get_cidReq()
);
$form->addElement('hidden', 'id'); $form->addElement('hidden', 'id');
} else { } else {
// Checks if the field was created in the table Category. It creates it if is neccesary // Checks if the field was created in the table Category. It creates it if is neccesary

@ -11,8 +11,6 @@
* @todo course admin functionality to create groups based on who is in which course (or class). * @todo course admin functionality to create groups based on who is in which course (or class).
*/ */
/* INIT SECTION */
require '../inc/global.inc.php'; require '../inc/global.inc.php';
$this_section = SECTION_COURSES; $this_section = SECTION_COURSES;
$current_course_tool = TOOL_GROUP; $current_course_tool = TOOL_GROUP;
@ -24,7 +22,7 @@ $group_id = api_get_group_id();
$current_group = GroupManager :: get_group_properties($group_id); $current_group = GroupManager :: get_group_properties($group_id);
$nameTools = get_lang('EditGroup'); $nameTools = get_lang('EditGroup');
$interbreadcrumb[] = array ('url' => 'group.php', 'name' => get_lang('Groups')); $interbreadcrumb[] = array ('url' => 'group.php?'.api_get_cidReq(), 'name' => get_lang('Groups'));
$interbreadcrumb[] = array ('url' => 'group_space.php?'.api_get_cidReq(), 'name' => $current_group['name']); $interbreadcrumb[] = array ('url' => 'group_space.php?'.api_get_cidReq(), 'name' => $current_group['name']);
$is_group_member = GroupManager :: is_tutor_of_group(api_get_user_id(), $group_id); $is_group_member = GroupManager :: is_tutor_of_group(api_get_user_id(), $group_id);

@ -64,9 +64,7 @@ if (isset($_GET['action'])) {
} }
/* Header */ /* Header */
$interbreadcrumb[] = array('url' => 'group.php?'.api_get_cidReq(), 'name' => get_lang('Groups'));
$interbreadcrumb[] = array('url' => 'group.php', 'name' => get_lang('Groups'));
if (!isset ($_GET['origin']) || $_GET['origin'] != 'learnpath') { if (!isset ($_GET['origin']) || $_GET['origin'] != 'learnpath') {
// So we are not in learnpath tool // So we are not in learnpath tool
if (!$is_allowed_in_course) { if (!$is_allowed_in_course) {
@ -124,9 +122,6 @@ echo GroupManager::getSearchForm();
echo '</div>'; echo '</div>';
echo '</div>'; echo '</div>';
echo '</div>'; echo '</div>';
echo '</div>'; echo '</div>';
echo GroupManager::getOverview($courseId, $keyword); echo GroupManager::getOverview($courseId, $keyword);

@ -30,7 +30,7 @@ if (empty($current_group)) {
$this_section = SECTION_COURSES; $this_section = SECTION_COURSES;
$nameTools = get_lang('GroupSpace'); $nameTools = get_lang('GroupSpace');
$interbreadcrumb[] = array('url' => 'group.php', 'name' => get_lang('Groups')); $interbreadcrumb[] = array('url' => 'group.php?'.api_get_cidReq(), 'name' => get_lang('Groups'));
/* Ensure all private groups // Juan Carlos Raña Trabado */ /* Ensure all private groups // Juan Carlos Raña Trabado */
@ -231,6 +231,7 @@ if (api_is_allowed_to_edit(false, true) ||
'content' => Display::return_icon('folder.png', get_lang('GroupDocument'), array(), ICON_SIZE_MEDIUM) 'content' => Display::return_icon('folder.png', get_lang('GroupDocument'), array(), ICON_SIZE_MEDIUM)
); );
} }
if ($current_group['calendar_state'] == GroupManager::TOOL_PUBLIC) { if ($current_group['calendar_state'] == GroupManager::TOOL_PUBLIC) {
// Link to a group-specific part of agenda // Link to a group-specific part of agenda
$actions_array[] = array( $actions_array[] = array(
@ -239,6 +240,7 @@ if (api_is_allowed_to_edit(false, true) ||
); );
} }
if ($current_group['work_state'] == GroupManager::TOOL_PUBLIC) { if ($current_group['work_state'] == GroupManager::TOOL_PUBLIC) {
// Link to the works area of this group // Link to the works area of this group
$actions_array[] = array( $actions_array[] = array(
@ -246,6 +248,7 @@ if (api_is_allowed_to_edit(false, true) ||
'content' => Display::return_icon('work.png', get_lang('GroupWork'), array(), ICON_SIZE_MEDIUM) 'content' => Display::return_icon('work.png', get_lang('GroupWork'), array(), ICON_SIZE_MEDIUM)
); );
} }
if ($current_group['announcements_state'] == GroupManager::TOOL_PUBLIC) { if ($current_group['announcements_state'] == GroupManager::TOOL_PUBLIC) {
// Link to a group-specific part of announcements // Link to a group-specific part of announcements
$actions_array[] = array( $actions_array[] = array(
@ -253,6 +256,7 @@ if (api_is_allowed_to_edit(false, true) ||
'content' => Display::return_icon('announce.png', get_lang('GroupAnnouncements'), array(), ICON_SIZE_MEDIUM) 'content' => Display::return_icon('announce.png', get_lang('GroupAnnouncements'), array(), ICON_SIZE_MEDIUM)
); );
} }
if ($current_group['wiki_state'] == GroupManager::TOOL_PUBLIC) { if ($current_group['wiki_state'] == GroupManager::TOOL_PUBLIC) {
// Link to the wiki area of this group // Link to the wiki area of this group
$actions_array[] = array( $actions_array[] = array(
@ -260,6 +264,7 @@ if (api_is_allowed_to_edit(false, true) ||
'content' => Display::return_icon('wiki.png', get_lang('GroupWiki'), array(), 32) 'content' => Display::return_icon('wiki.png', get_lang('GroupWiki'), array(), 32)
); );
} }
if ($current_group['chat_state'] == GroupManager::TOOL_PUBLIC ) { if ($current_group['chat_state'] == GroupManager::TOOL_PUBLIC ) {
// Link to the chat area of this group // Link to the chat area of this group
if (api_get_course_setting('allow_open_chat_window')) { if (api_get_course_setting('allow_open_chat_window')) {
@ -274,6 +279,7 @@ if (api_is_allowed_to_edit(false, true) ||
); );
} }
} }
if (!empty($actions_array)) { if (!empty($actions_array)) {
echo Display::actions($actions_array); echo Display::actions($actions_array);
} }

@ -21,7 +21,7 @@ $group_id = api_get_group_id();
$current_group = GroupManager::get_group_properties($group_id); $current_group = GroupManager::get_group_properties($group_id);
$nameTools = get_lang('EditGroup'); $nameTools = get_lang('EditGroup');
$interbreadcrumb[] = array('url' => 'group.php', 'name' => get_lang('Groups')); $interbreadcrumb[] = array('url' => 'group.php?'.api_get_cidReq(), 'name' => get_lang('Groups'));
$interbreadcrumb[] = array('url' => 'group_space.php?'.api_get_cidReq(), 'name' => $current_group['name']); $interbreadcrumb[] = array('url' => 'group_space.php?'.api_get_cidReq(), 'name' => $current_group['name']);
$is_group_member = GroupManager::is_tutor_of_group(api_get_user_id(), $group_id); $is_group_member = GroupManager::is_tutor_of_group(api_get_user_id(), $group_id);

@ -22,7 +22,7 @@ $group_id = api_get_group_id();
$current_group = GroupManager :: get_group_properties($group_id); $current_group = GroupManager :: get_group_properties($group_id);
$nameTools = get_lang('EditGroup'); $nameTools = get_lang('EditGroup');
$interbreadcrumb[] = array ('url' => 'group.php', 'name' => get_lang('Groups')); $interbreadcrumb[] = array ('url' => 'group.php?'.api_get_cidReq(), 'name' => get_lang('Groups'));
$interbreadcrumb[] = array ('url' => 'group_space.php?'.api_get_cidReq(), 'name' => $current_group['name']); $interbreadcrumb[] = array ('url' => 'group_space.php?'.api_get_cidReq(), 'name' => $current_group['name']);
$is_group_member = GroupManager :: is_tutor_of_group(api_get_user_id(), $group_id); $is_group_member = GroupManager :: is_tutor_of_group(api_get_user_id(), $group_id);
@ -152,7 +152,13 @@ if (!empty($complete_user_list)) {
} }
} }
$group_tutors_element = $form->addElement('advmultiselect', 'group_tutors', get_lang('GroupTutors'), $possible_users, 'style="width: 280px;"'); $group_tutors_element = $form->addElement(
'advmultiselect',
'group_tutors',
get_lang('GroupTutors'),
$possible_users,
'style="width: 280px;"'
);
// submit button // submit button
$form->addButtonSave(get_lang('SaveSettings')); $form->addButtonSave(get_lang('SaveSettings'));
@ -192,8 +198,6 @@ if (!empty($_GET['keyword']) && !empty($_GET['submit'])) {
} }
Display :: display_header($nameTools, 'Group'); Display :: display_header($nameTools, 'Group');
$form->setDefaults($defaults); $form->setDefaults($defaults);
echo GroupManager::getSettingBar('tutor'); echo GroupManager::getSettingBar('tutor');
$form->display(); $form->display();

Loading…
Cancel
Save