diff --git a/main/gradebook/gradebook.php b/main/gradebook/gradebook.php
index ed96babf4c..d1d355078c 100755
--- a/main/gradebook/gradebook.php
+++ b/main/gradebook/gradebook.php
@@ -21,6 +21,8 @@ if (!empty($_GET['course'])) {
unset($_GET['course']);
}
+$selectcat = isset($_GET['selectcat']) ? (int) $_GET['selectcat'] : 0;
+
$htmlHeadXtra[] = '';
if (isset($_GET['deleteall'])) {
$eval[0]->delete_results();
+ Display::addFlash(Display::return_message(get_lang('AllResultDeleted')));
header('Location: '.api_get_path(WEB_CODE_PATH).'gradebook/gradebook_view_result.php?allresdeleted=&selecteval=' . $select_eval.'&'.api_get_cidreq());
exit;
}
@@ -443,10 +450,6 @@ if (isset($_GET['addresultnostudents'])) {
Display :: display_warning_message(get_lang('AddResultNoStudents'), false);
}
-if (isset($_GET['editresmessage'])) {
- Display :: display_confirmation_message(get_lang('ResultEdited'), false);
-}
-
if (isset($_GET['addresult'])) {
Display :: display_confirmation_message(get_lang('ResultAdded'), false);
}
@@ -462,18 +465,10 @@ if (isset($_GET['deleteresult'])) {
if (isset($_GET['editallresults'])) {
Display :: display_confirmation_message(get_lang('AllResultsEdited'), false);
}
-if (isset($_GET['importok'])) {
- Display :: display_confirmation_message(get_lang('FileUploadComplete'), false);
-}
-if (isset($_GET['importnofile'])) {
- Display :: display_warning_message(get_lang('ImportNoFile'), false);
-}
if (isset($_GET['incorrectdata'])) {
Display :: display_warning_message(get_lang('IncorrectData'), false);
}
-if (isset($_GET['nothingadded'])) {
- Display :: display_warning_message(get_lang('ProblemUploadingFile'), false);
-}
+
if (isset($_GET['massdelete'])) {
Display :: display_confirmation_message(get_lang('ResultsDeleted'), false);
}
@@ -483,18 +478,13 @@ if (isset($_GET['nouser'])) {
if (isset($_GET['overwritemax'])) {
Display :: display_warning_message(get_lang('OverWriteMax'), false);
}
-if (isset($_GET['importoverwritescore'])) {
- Display :: display_confirmation_message(get_lang('ImportOverWriteScore') . ' ' . $_GET['importoverwritescore']);
-}
+
if (isset($_GET['import_user_error'])) {
$userinfo = api_get_user_info($_GET['import_user_error']);
Display:: display_warning_message(
get_lang('UserInfoDoesNotMatch').' '.api_get_person_name($userinfo['firstname'], $userinfo['lastname'])
);
}
-if (isset($_GET['allresdeleted'])) {
- Display :: display_confirmation_message(get_lang('AllResultDeleted'));
-}
if (isset($_GET['import_score_error'])) {
$userinfo = api_get_user_info($_GET['import_score_error']);
Display :: display_warning_message(get_lang('ScoreDoesNotMatch') . ' ' . api_get_person_name($userinfo['firstname'], $userinfo['lastname']));
diff --git a/main/gradebook/index.php b/main/gradebook/index.php
index d1b7c45fb6..ebef10fbc8 100755
--- a/main/gradebook/index.php
+++ b/main/gradebook/index.php
@@ -101,10 +101,11 @@ if (empty($cats)) {
$first_time = 1;
}
-$_GET['selectcat'] = $cats[0]->get_id();
+$selectCat = (int) $cats[0]->get_id();
+$_GET['selectcat'] = $selectCat;
if (isset($_GET['isStudentView'])) {
- if ((isset($_GET['selectcat']) && $_GET['selectcat'] > 0) && (isset($_SESSION['studentview']) && $_SESSION['studentview'] == 'true')) {
+ if ($selectCat > 0 && (isset($_SESSION['studentview']) && $_SESSION['studentview'] == 'true')) {
$interbreadcrumb[] = array(
'url' => 'index.php'.'?selectcat=0&isStudentView=true',
'name' => get_lang('ToolGradebook'),
@@ -112,27 +113,37 @@ if (isset($_GET['isStudentView'])) {
}
}
-if ((isset($_GET['selectcat']) && $_GET['selectcat']>0) &&
- (isset($_SESSION['studentview']) && $_SESSION['studentview']=='true')
-) {
+if ($selectCat > 0 && (isset($_SESSION['studentview']) && $_SESSION['studentview']=='true')) {
} else {
- if (!isset($_GET['selectcat']) &&
- ($_SESSION['studentview']=='studentview') ||
- (isset($_GET['isStudentView']) && $_GET['isStudentView']=='true')
+ if (empty($selectCat) && (
+ $_SESSION['studentview']=='studentview') || (isset($_GET['isStudentView']) && $_GET['isStudentView']=='true')
) {
Display :: display_header(get_lang('Gradebook'));
//Introduction tool: student view
- Display::display_introduction_section(TOOL_GRADEBOOK, array('ToolbarSet' => 'AssessmentsIntroduction'));
- $addparams=array();
- $cats = Category :: load (0, null, null, null, null, null, false);
- $allcat= $cats[0]->get_subcategories($stud_id, $course_code, $session_id);
- $alleval= $cats[0]->get_evaluations($stud_id);
- $alllink= $cats[0]->get_links($stud_id);
- $gradebooktable= new GradebookTable($cats[0], $allcat, $alleval,$alllink, $addparams);
+ Display::display_introduction_section(
+ TOOL_GRADEBOOK,
+ array('ToolbarSet' => 'AssessmentsIntroduction')
+ );
+ $addparams = array();
+ $cats = Category:: load(0, null, null, null, null, null, false);
+ $allcat = $cats[0]->get_subcategories(
+ $stud_id,
+ $course_code,
+ $session_id
+ );
+ $alleval = $cats[0]->get_evaluations($stud_id);
+ $alllink = $cats[0]->get_links($stud_id);
+ $gradebooktable = new GradebookTable(
+ $cats[0],
+ $allcat,
+ $alleval,
+ $alllink,
+ $addparams
+ );
$gradebooktable->display();
- Display :: display_footer();
+ Display:: display_footer();
exit;
}
}
@@ -171,14 +182,16 @@ if (isset($_GET['movecat'])) {
GradebookUtils::block_students();
$cats= Category :: load($_GET['movecat']);
if (!isset ($_GET['targetcat'])) {
- $move_form= new CatForm(CatForm :: TYPE_MOVE,
+ $move_form= new CatForm(
+ CatForm :: TYPE_MOVE,
$cats[0],
'move_cat_form',
null,
api_get_self() . '?movecat=' . Security::remove_XSS($_GET['movecat'])
- . '&selectcat=' . Security::remove_XSS($_GET['selectcat']));
+ . '&selectcat=' . $selectCat
+ );
if ($move_form->validate()) {
- header('Location: ' . api_get_self() . '?selectcat=' . Security::remove_XSS($_GET['selectcat'])
+ header('Location: ' . api_get_self() . '?selectcat=' . $selectCat
. '&movecat=' . Security::remove_XSS($_GET['movecat'])
. '&targetcat=' . $move_form->exportValue('move_cat'));
exit;
@@ -189,7 +202,7 @@ if (isset($_GET['movecat'])) {
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']));
+ header('Location: ' . api_get_self() . '?categorymoved=&selectcat=' . $selectCat);
exit;
}
unset ($targetcat);
@@ -203,16 +216,17 @@ if (isset($_GET['moveeval'])) {
$evals= Evaluation :: load($_GET['moveeval']);
if (!isset ($_GET['targetcat'])) {
- $move_form= new EvalForm(EvalForm :: TYPE_MOVE,
+ $move_form= new EvalForm(
+ EvalForm :: TYPE_MOVE,
$evals[0],
null,
'move_eval_form',
null,
- api_get_self() . '?moveeval=' . Security::remove_XSS($_GET['moveeval'])
- . '&selectcat=' . Security::remove_XSS($_GET['selectcat']));
+ api_get_self() . '?moveeval=' . Security::remove_XSS($_GET['moveeval']). '&selectcat=' . $selectCat
+ );
if ($move_form->validate()) {
- header('Location: ' .api_get_self() . '?selectcat=' . Security::remove_XSS($_GET['selectcat'])
+ header('Location: ' .api_get_self() . '?selectcat='.$selectCat
. '&moveeval=' . Security::remove_XSS($_GET['moveeval'])
. '&targetcat=' . $move_form->exportValue('move_cat'));
exit;
@@ -223,12 +237,12 @@ if (isset($_GET['moveeval'])) {
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']));
+ header('Location: ' . api_get_self() . '?evaluationmoved=&selectcat=' . $selectCat);
exit;
}
- unset ($targetcat);
+ unset($targetcat);
}
- unset ($evals);
+ unset($evals);
}
//move a link
@@ -241,14 +255,14 @@ if (isset($_GET['movelink'])) {
$link[0],
'move_link_form',
null,
- api_get_self() . '?movelink=' . $_GET['movelink'] . '&selectcat=' . Security::remove_XSS($_GET['selectcat'])
+ api_get_self() . '?movelink=' . $_GET['movelink'] . '&selectcat=' . $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']));
+ unset($link);
+ header('Location: ' . api_get_self(). '?linkmoved=&selectcat=' . $selectCat);
exit;
}
}
@@ -408,9 +422,7 @@ if (!empty($course_to_crsind) && !isset($_GET['confirm'])) {
}
$button = '
';
-
- $my_category = $catobj->shows_all_information_an_category($catobj->get_id());
- $user_id = api_get_user_id();
- $course_code = $my_category['course_code'];
- $courseInfo = api_get_course_info($course_code);
- $courseId = $courseInfo['real_id'];
-
- $status_user = api_get_status_of_user_in_course($user_id, $courseId);
- if (api_is_allowed_to_edit(null, true)) {
- if ($selectcat == '0') {
-
- } else {
-
- $my_category = $catobj->shows_all_information_an_category($catobj->get_id());
- $my_api_cidreq = api_get_cidreq();
- if ($my_api_cidreq == '') {
- $my_api_cidreq = 'cidReq=' . $my_category['course_code'];
- }
-
- if (!$message_resource) {
- $myname = $catobj->shows_all_information_an_category($catobj->get_id());
-
- $my_course_id = api_get_course_id();
- $my_file = substr($_SESSION['gradebook_dest'], 0, 5);
-
- $header .= '
' .
- Display::return_icon('stats.png', get_lang('FlatView'), '', ICON_SIZE_MEDIUM) . '';
- $header .= ' | ' .
- Display::return_icon('certificate_list.png', get_lang('GradebookSeeListOfStudentsCertificates'), '', ICON_SIZE_MEDIUM) . '';
-
- $visibility_icon = ($catobj->is_visible() == 0) ? 'invisible' : 'visible';
- $visibility_command = ($catobj->is_visible() == 0) ? 'set_visible' : 'set_invisible';
-
- //Right icons
- $modify_icons = '' . Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_MEDIUM) . '';
- if ($catobj->get_name() != api_get_course_id()) {
- $modify_icons .= ' ' . Display::return_icon('delete.png', get_lang('DeleteAll'), '', ICON_SIZE_MEDIUM) . '';
- }
- $header .= Display::div($modify_icons, array('class' => 'right'));
- }
- }
- } elseif (isset($_GET['search'])) {
- $header .= '' . get_lang('SearchResults') . ' :';
- }
- $header .= '';
- echo $header;
- }
-
/**
* Displays the header for the gradebook containing the navigation tree and links
* @param Category $catobj
@@ -428,7 +228,6 @@ class DisplayGradebook
$show_add_link = true,
$certificateLinkInfo = null
) {
-
$userId = api_get_user_id();
$courseCode = api_get_course_id();
$courseId = api_get_course_int_id();
@@ -451,9 +250,6 @@ class DisplayGradebook
$grade_model_id = $catobj->get_grade_model_id();
$header = null;
- //@todo move these in a function
- $sum_categories_weight_array = array();
-
if (isset($catobj) && !empty($catobj)) {
$categories = Category::load(
null,
@@ -463,14 +259,6 @@ class DisplayGradebook
null,
$sessionId
);
-
- if (!empty($categories)) {
- foreach ($categories as $category) {
- $sum_categories_weight_array[$category->get_id()] = $category->get_weight();
- }
- } else {
- $sum_categories_weight_array[$catobj->get_id()] = $catobj->get_weight();
- }
}
if (!$is_course_admin && ($status <> 1 || $sessionStatus == 0) && $selectcat <> 0) {
@@ -516,7 +304,7 @@ class DisplayGradebook
}
// show navigation tree and buttons?
- if (($showtree == '1') || (isset($_GET['studentoverview']))) {
+ if ($showtree == '1' || isset($_GET['studentoverview'])) {
$header = '';
$header .= '';
if (!$selectcat == '0') {
@@ -566,8 +354,6 @@ class DisplayGradebook
// for course admin & platform admin add item buttons are added to the header
$actionsLeft = '';
- $my_category = $catobj->shows_all_information_an_category($catobj->get_id());
- $user_id = api_get_user_id();
$my_api_cidreq = api_get_cidreq();
if (api_is_allowed_to_edit(null, true)) {
@@ -603,23 +389,23 @@ class DisplayGradebook
if ($my_category['generate_certificates'] == 1) {
$actionsLeft .= Display::url(
Display::return_icon(
- 'certificate_list.png',
- get_lang('GradebookSeeListOfStudentsCertificates'),
- '',
- ICON_SIZE_MEDIUM
- ),
- "gradebook_display_certificate.php?$my_api_cidreq&cat_id=" . intval($_GET['selectcat'])
+ 'certificate_list.png',
+ get_lang('GradebookSeeListOfStudentsCertificates'),
+ '',
+ ICON_SIZE_MEDIUM
+ ),
+ "gradebook_display_certificate.php?$my_api_cidreq&cat_id=" . $selectcat
);
}
$actionsLeft .= Display::url(
Display::return_icon(
- 'user.png',
- get_lang('GradebookListOfStudentsReports'),
- '',
- ICON_SIZE_MEDIUM
- ),
- "gradebook_display_summary.php?$my_api_cidreq&selectcat=" . intval($_GET['selectcat'])
+ 'user.png',
+ get_lang('GradebookListOfStudentsReports'),
+ '',
+ ICON_SIZE_MEDIUM
+ ),
+ "gradebook_display_summary.php?$my_api_cidreq&selectcat=" . $selectcat
);
// Right icons
@@ -721,13 +507,12 @@ class DisplayGradebook
/**
* @param int $userid
*/
- public static function display_header_user($userid)
+ public static function display_header_user($userid, $categoryId)
{
- $select_cat = intval($_GET['selectcat']);
$user_id = $userid;
$user = api_get_user_info($user_id);
- $catcourse = Category :: load($select_cat);
+ $catcourse = Category :: load($categoryId);
$scoredisplay = ScoreDisplay :: instance();
$scorecourse = $catcourse[0]->calc_score($user_id);
@@ -743,7 +528,6 @@ class DisplayGradebook
$my_score_denom = ($score[1] == 0) ? 1 : $score[1];
$item_value+=$score[0] / $my_score_denom * $item->get_weight();
$item_total+=$item->get_weight();
- //$row[] = $scoredisplay->display_score($score,SCORE_DIV_PERCENT);
}
$item_value = number_format($item_value, 2, '.', ' ');
$total_score = array($item_value, $item_total);
diff --git a/main/gradebook/lib/fe/gradebooktable.class.php b/main/gradebook/lib/fe/gradebooktable.class.php
index 778e06fee6..28e52cb5bd 100755
--- a/main/gradebook/lib/fe/gradebooktable.class.php
+++ b/main/gradebook/lib/fe/gradebooktable.class.php
@@ -113,7 +113,8 @@ class GradebookTable extends SortableTable
if ($this->teacherView) {
$this->set_header($column++, get_lang('Modify'), false, 'width="195px"');
// Actions on multiple selected documents.
- $this->set_form_actions(array(
+ $this->set_form_actions(
+ array(
'setvisible' => get_lang('SetVisible'),
'setinvisible' => get_lang('SetInvisible'),
'deleted' => get_lang('DeleteSelected')
@@ -169,21 +170,22 @@ class GradebookTable extends SortableTable
switch ($this->column) {
// Type
- case (0 + $col_adjust) :
+ case (0 + $col_adjust):
$sorting = GradebookDataGenerator :: GDG_SORT_TYPE;
break;
- case (1 + $col_adjust) :
+ case (1 + $col_adjust):
$sorting = GradebookDataGenerator :: GDG_SORT_NAME;
break;
- case (2 + $col_adjust) :
+ case (2 + $col_adjust):
$sorting = GradebookDataGenerator :: GDG_SORT_DESCRIPTION;
break;
- case (3 + $col_adjust) :
+ case (3 + $col_adjust):
$sorting = GradebookDataGenerator :: GDG_SORT_WEIGHT;
break;
- case (4 + $col_adjust) :
+ case (4 + $col_adjust):
$sorting = GradebookDataGenerator :: GDG_SORT_DATE;
- case (5 + $col_adjust) :
+ break;
+ case (5 + $col_adjust):
$sorting = GradebookDataGenerator :: GDG_SORT_ID;
break;
}
@@ -210,13 +212,13 @@ class GradebookTable extends SortableTable
}
if (empty($this->studentList)) {
- $studentList = CourseManager::get_user_list_from_course_code(
- $course_code,
- $session_id,
- null,
- null,
- $statusToFilter
- );
+ $studentList = CourseManager::get_user_list_from_course_code(
+ $course_code,
+ $session_id,
+ null,
+ null,
+ $statusToFilter
+ );
$this->studentList = $studentList;
}
@@ -233,7 +235,6 @@ class GradebookTable extends SortableTable
// generate the data to display
$sortable_data = array();
$weight_total_links = 0;
- $main_categories = array();
$main_cat = Category::load(
null,
null,
@@ -301,7 +302,7 @@ class GradebookTable extends SortableTable
$weight = $scoredisplay->display_score(
array(
$data['3'],
- $this->currentcat->get_weight(),
+ $this->currentcat->get_weight()
),
SCORE_SIMPLE,
SCORE_BOTH,
@@ -433,7 +434,6 @@ class GradebookTable extends SortableTable
// Links.
foreach ($data_array2 as $data) {
-
$row = array();
$item = $data[0];
@@ -579,7 +579,6 @@ class GradebookTable extends SortableTable
if ($this->teacherView) {
// Total for teacher.
if (count($main_cat) > 1) {
-
if (intval($total_categories_weight) == $main_weight) {
$total = GradebookUtils::score_badges(
array(
@@ -668,7 +667,7 @@ class GradebookTable extends SortableTable
$totalResult,
$totalRanking,
$totalBest,
- $totalAverage,
+ $totalAverage
);
} else {
$row = array(
@@ -679,7 +678,7 @@ class GradebookTable extends SortableTable
$totalResult,
$totalRanking,
$totalBest,
- $totalAverage,
+ $totalAverage
);
}
@@ -697,9 +696,7 @@ class GradebookTable extends SortableTable
) {
$id_cat = intval($_GET['selectcat']);
$category = Category::load($id_cat);
-
$weight_category = intval($this->build_weight($category[0]));
-
$course_code = $this->build_course_code($category[0]);
$weight_total_links = round($weight_total_links);
@@ -755,7 +752,7 @@ class GradebookTable extends SortableTable
is_array($course_codes)
) {
$warning_message = '';
- for ($x = 0; $xdrawRectangle(0,0,$xSize-10,$ySize-10,array("R"=>0,"G"=>0,"B"=>0));
-
$pChart->drawText(10,16,get_lang('Results'),array("FontSize"=>11,"Align"=> TEXT_ALIGN_BOTTOMMIDDLE));
-
$pChart->setGraphArea(50, 30, $xSize-50, $ySize-50);
-
$pChart->setFontProperties(
array(
'FontName' => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf',
@@ -840,7 +834,15 @@ class GradebookTable extends SortableTable
/* Draw the line chart */
$pChart->drawLineChart();
- $pChart->drawPlotChart(array("DisplayValues"=>TRUE,"PlotBorder"=>TRUE,"BorderSize"=>2,"Surrounding"=>-60,"BorderAlpha"=>80));
+ $pChart->drawPlotChart(
+ array(
+ "DisplayValues" => true,
+ "PlotBorder" => true,
+ "BorderSize" => 2,
+ "Surrounding" => -60,
+ "BorderAlpha" => 80,
+ )
+ );
/* Write the chart legend */
$pChart->drawLegend(
@@ -910,13 +912,13 @@ class GradebookTable extends SortableTable
{
switch ($item->get_item_type()) {
// category
- case 'C' :
+ case 'C':
return 'CATE' . $item->get_id();
// evaluation
- case 'E' :
+ case 'E':
return 'EVAL' . $item->get_id();
// link
- case 'L' :
+ case 'L':
return 'LINK' . $item->get_id();
}
}
@@ -944,7 +946,7 @@ class GradebookTable extends SortableTable
switch ($item->get_item_type()) {
// category
- case 'C' :
+ case 'C':
$prms_uri='?selectcat=' . $item->get_id() . '&view='.$view;
if (isset($_GET['isStudentView'])) {
@@ -960,7 +962,7 @@ class GradebookTable extends SortableTable
. ''
. ($item->is_course() ? ' [' . $item->get_course_code() . ']'.$show_message : '');
// evaluation
- case 'E' :
+ case 'E':
$cat = new Category();
$course_id = CourseManager::get_course_by_category($categoryId);
$show_message = $cat->show_message_resource_delete($course_id);
@@ -1035,13 +1037,13 @@ class GradebookTable extends SortableTable
{
switch ($item->get_item_type()) {
// category
- case 'C' :
+ case 'C':
return GradebookUtils::build_edit_icons_cat($item, $this->currentcat);
// evaluation
- case 'E' :
+ case 'E':
return GradebookUtils::build_edit_icons_eval($item, $this->currentcat->get_id());
// link
- case 'L' :
+ case 'L':
return GradebookUtils::build_edit_icons_link($item, $this->currentcat->get_id());
}
}
diff --git a/main/gradebook/lib/fe/linkaddeditform.class.php b/main/gradebook/lib/fe/linkaddeditform.class.php
index 33bb0fa778..cc5ae0b6d1 100755
--- a/main/gradebook/lib/fe/linkaddeditform.class.php
+++ b/main/gradebook/lib/fe/linkaddeditform.class.php
@@ -9,108 +9,106 @@
*/
class LinkAddEditForm extends FormValidator
{
- const TYPE_ADD = 1;
+ const TYPE_ADD = 1;
const TYPE_EDIT = 2;
- /**
- * Constructor
- * To add link, define category_object and link_type
- * To edit link, define link_object
- */
- public function __construct(
- $form_type,
- $category_object,
- $link_type,
- $link_object,
- $form_name,
- $action = null
- ) {
- parent :: __construct($form_name, 'post', $action);
-
- // set or create link object
- if (isset($link_object)) {
- $link = $link_object;
- } elseif (isset($link_type) && isset($category_object)) {
- $link = LinkFactory :: create ($link_type);
- $link->set_course_code(api_get_course_id());
- $link->set_category_id($category_object[0]->get_id());
- } else {
- die ('LinkAddEditForm error: define link_type/category_object or link_object');
- }
-
- $defaults = array();
- $this->addElement('hidden', 'zero', 0);
-
- if (!empty($_GET['editlink'])) {
- $this->addElement('header', '', get_lang('EditLink'));
- }
-
- // ELEMENT: name
- if ($form_type == self :: TYPE_ADD || $link->is_allowed_to_change_name()) {
- if ($link->needs_name_and_description()) {
- $this->addText('name', get_lang('Name'), true, array('size'=>'40', 'maxlength'=>'40'));
- } else {
- $select = $this->addElement('select', 'select_link', get_lang('ChooseItem'));
- foreach ($link->get_all_links() as $newlink) {
- $select->addoption($newlink[1],$newlink[0]);
- }
- }
- } else {
- $this->addElement('label',get_lang('Name'), ''.$link->get_name().' ['.$link->get_type_name().']');
- $this->addElement('hidden','name_link',$link->get_name(),array('id'=>'name_link'));
- }
-
- if (count($category_object) == 1) {
- $this->addElement('hidden', 'select_gradebook', $category_object[0]->get_id());
- } else {
- $select_gradebook = $this->addElement(
- 'select',
- 'select_gradebook',
- get_lang('SelectGradebook'),
- array(),
- array('id' => 'hide_category_id')
- );
- $this->addRule('select_gradebook', get_lang('ThisFieldIsRequired'), 'nonzero');
-
- $default_weight = 0;
- if (!empty($category_object)) {
- foreach ($category_object as $my_cat) {
-
- if ($my_cat->get_course_code() == api_get_course_id()) {
- $grade_model_id = $my_cat->get_grade_model_id();
- if (empty($grade_model_id)) {
-
- if ($my_cat->get_parent_id() == 0 ) {
- $default_weight = $my_cat->get_weight();
- $select_gradebook->addoption(get_lang('Default'), $my_cat->get_id());
- } else {
- $select_gradebook->addoption($my_cat->get_name(), $my_cat->get_id());
- }
- } else {
- $select_gradebook->addoption(get_lang('Select'), 0);
- }
- if ($link->get_category_id() == $my_cat->get_id()) {
- $default_weight = $my_cat->get_weight();
- }
- }
- }
- }
- }
-
- $this->addText(
- 'weight_mask',
- array(get_lang('Weight'), null, ' [0 .. '.$category_object[0]->get_weight().'] '),
- true,
- array(
- 'size' => '4',
- 'maxlength' => '5',
- 'class' => 'span1'
- )
- );
-
- $this->addElement('hidden', 'weight');
-
- /*
+ /**
+ * Constructor
+ * To add link, define category_object and link_type
+ * To edit link, define link_object
+ */
+ public function __construct(
+ $form_type,
+ $category_object,
+ $link_type,
+ $link_object,
+ $form_name,
+ $action = null
+ ) {
+ parent :: __construct($form_name, 'post', $action);
+
+ // set or create link object
+ if (isset($link_object)) {
+ $link = $link_object;
+ } elseif (isset($link_type) && isset($category_object)) {
+ $link = LinkFactory :: create ($link_type);
+ $link->set_course_code(api_get_course_id());
+ $link->set_category_id($category_object[0]->get_id());
+ } else {
+ die ('LinkAddEditForm error: define link_type/category_object or link_object');
+ }
+
+ $defaults = array();
+ $this->addElement('hidden', 'zero', 0);
+
+ if (!empty($_GET['editlink'])) {
+ $this->addElement('header', '', get_lang('EditLink'));
+ }
+
+ // ELEMENT: name
+ if ($form_type == self :: TYPE_ADD || $link->is_allowed_to_change_name()) {
+ if ($link->needs_name_and_description()) {
+ $this->addText('name', get_lang('Name'), true, array('size'=>'40', 'maxlength'=>'40'));
+ } else {
+ $select = $this->addElement('select', 'select_link', get_lang('ChooseItem'));
+ foreach ($link->get_all_links() as $newlink) {
+ $select->addoption($newlink[1],$newlink[0]);
+ }
+ }
+ } else {
+ $this->addElement('label',get_lang('Name'), ''.$link->get_name().' ['.$link->get_type_name().']');
+ $this->addElement('hidden','name_link',$link->get_name(),array('id'=>'name_link'));
+ }
+
+ if (count($category_object) == 1) {
+ $this->addElement('hidden', 'select_gradebook', $category_object[0]->get_id());
+ } else {
+ $select_gradebook = $this->addElement(
+ 'select',
+ 'select_gradebook',
+ get_lang('SelectGradebook'),
+ array(),
+ array('id' => 'hide_category_id')
+ );
+ $this->addRule('select_gradebook', get_lang('ThisFieldIsRequired'), 'nonzero');
+
+ $default_weight = 0;
+ if (!empty($category_object)) {
+ foreach ($category_object as $my_cat) {
+ if ($my_cat->get_course_code() == api_get_course_id()) {
+ $grade_model_id = $my_cat->get_grade_model_id();
+ if (empty($grade_model_id)) {
+ if ($my_cat->get_parent_id() == 0 ) {
+ $default_weight = $my_cat->get_weight();
+ $select_gradebook->addoption(get_lang('Default'), $my_cat->get_id());
+ } else {
+ $select_gradebook->addoption($my_cat->get_name(), $my_cat->get_id());
+ }
+ } else {
+ $select_gradebook->addoption(get_lang('Select'), 0);
+ }
+ if ($link->get_category_id() == $my_cat->get_id()) {
+ $default_weight = $my_cat->get_weight();
+ }
+ }
+ }
+ }
+ }
+
+ $this->addText(
+ 'weight_mask',
+ array(get_lang('Weight'), null, ' [0 .. '.$category_object[0]->get_weight().'] '),
+ true,
+ array(
+ 'size' => '4',
+ 'maxlength' => '5',
+ 'class' => 'span1'
+ )
+ );
+
+ $this->addElement('hidden', 'weight');
+
+ /*
// ELEMENT: weight
$this->addText('weight', array(get_lang('Weight'), null, '/ '.$default_weight.''), true, array (
@@ -119,76 +117,76 @@ class LinkAddEditForm extends FormValidator
'class' => 'span1'
));*/
- $this->addRule('weight_mask',get_lang('OnlyNumbers'),'numeric');
- $this->addRule(array ('weight_mask', 'zero'), get_lang('NegativeValue'), 'compare', '>=');
- if ($form_type == self :: TYPE_EDIT) {
- $parent_cat = Category :: load($link->get_category_id());
-
- if ($parent_cat[0]->get_parent_id() == 0) {
- $values['weight'] = $link->get_weight();
- } else {
- $cat = Category :: load($parent_cat[0]->get_parent_id());
- //$global_weight = $cat[0]->get_weight();
- //$values['weight'] = $link->get_weight()/$parent_cat[0]->get_weight()*$global_weight;
- //var_dump($global_weight, $link->get_weight(), $parent_cat[0]->get_weight());
- //$weight = $parent_cat[0]->get_weight()* $link->get_weight() / $global_weight;
- //$values['weight'] = $weight;
- $values['weight'] = $link->get_weight() ;
- }
- $defaults['weight_mask'] = $values['weight'] ;
- $defaults['select_gradebook'] = $link->get_category_id();
-
- }
- // ELEMENT: max
- if ($link->needs_max()) {
- if ($form_type == self :: TYPE_EDIT && $link->has_results()) {
- $this->addText('max', get_lang('QualificationNumeric'), false, array ('size' => '4','maxlength' => '5', 'disabled' => 'disabled'));
- } else {
- $this->addText('max', get_lang('QualificationNumeric'), true, array ('size' => '4','maxlength' => '5'));
- $this->addRule('max', get_lang('OnlyNumbers'), 'numeric');
- $this->addRule(array ('max', 'zero'), get_lang('NegativeValue'), 'compare', '>=');
- }
- if ($form_type == self :: TYPE_EDIT) {
- $defaults['max'] = $link->get_max();
- }
- }
-
- // ELEMENT: description
- if ($link->needs_name_and_description()) {
- $this->addElement('textarea', 'description', get_lang('Description'), array ('rows' => '3','cols' => '34'));
- if ($form_type == self :: TYPE_EDIT) {
- $defaults['description'] = $link->get_description();
- }
- }
-
- // ELEMENT: visible
- $visible = ($form_type == self :: TYPE_EDIT && $link->is_visible()) ? '1' : '0';
- $this->addElement('checkbox', 'visible', null, get_lang('Visible'), $visible);
- if ($form_type == self :: TYPE_EDIT) {
- $defaults['visible'] = $link->is_visible();
- }
-
- // ELEMENT: add results
- if ($form_type == self :: TYPE_ADD && $link->needs_results()) {
- $this->addElement('checkbox', 'addresult', get_lang('AddResult'));
- }
- // submit button
- if ($form_type == self :: TYPE_ADD) {
- $this->addButtonCreate(get_lang('CreateLink'));
- } else {
- $this->addButtonUpdate(get_lang('LinkMod'));
- }
-
- if ($form_type == self :: TYPE_ADD) {
- $setting = api_get_setting('tool_visible_by_default_at_creation');
- $visibility_default = 1;
- if (isset($setting['gradebook']) && $setting['gradebook'] == 'false') {
- $visibility_default = 0;
- }
- $defaults['visible'] = $visibility_default;
- }
-
- // set default values
- $this->setDefaults($defaults);
+ $this->addRule('weight_mask',get_lang('OnlyNumbers'),'numeric');
+ $this->addRule(array ('weight_mask', 'zero'), get_lang('NegativeValue'), 'compare', '>=');
+ if ($form_type == self :: TYPE_EDIT) {
+ $parent_cat = Category :: load($link->get_category_id());
+
+ if ($parent_cat[0]->get_parent_id() == 0) {
+ $values['weight'] = $link->get_weight();
+ } else {
+ $cat = Category :: load($parent_cat[0]->get_parent_id());
+ //$global_weight = $cat[0]->get_weight();
+ //$values['weight'] = $link->get_weight()/$parent_cat[0]->get_weight()*$global_weight;
+ //var_dump($global_weight, $link->get_weight(), $parent_cat[0]->get_weight());
+ //$weight = $parent_cat[0]->get_weight()* $link->get_weight() / $global_weight;
+ //$values['weight'] = $weight;
+ $values['weight'] = $link->get_weight() ;
+ }
+ $defaults['weight_mask'] = $values['weight'] ;
+ $defaults['select_gradebook'] = $link->get_category_id();
+
+ }
+ // ELEMENT: max
+ if ($link->needs_max()) {
+ if ($form_type == self :: TYPE_EDIT && $link->has_results()) {
+ $this->addText('max', get_lang('QualificationNumeric'), false, array ('size' => '4','maxlength' => '5', 'disabled' => 'disabled'));
+ } else {
+ $this->addText('max', get_lang('QualificationNumeric'), true, array ('size' => '4','maxlength' => '5'));
+ $this->addRule('max', get_lang('OnlyNumbers'), 'numeric');
+ $this->addRule(array ('max', 'zero'), get_lang('NegativeValue'), 'compare', '>=');
+ }
+ if ($form_type == self :: TYPE_EDIT) {
+ $defaults['max'] = $link->get_max();
+ }
+ }
+
+ // ELEMENT: description
+ if ($link->needs_name_and_description()) {
+ $this->addElement('textarea', 'description', get_lang('Description'), array ('rows' => '3','cols' => '34'));
+ if ($form_type == self :: TYPE_EDIT) {
+ $defaults['description'] = $link->get_description();
+ }
+ }
+
+ // ELEMENT: visible
+ $visible = ($form_type == self :: TYPE_EDIT && $link->is_visible()) ? '1' : '0';
+ $this->addElement('checkbox', 'visible', null, get_lang('Visible'), $visible);
+ if ($form_type == self :: TYPE_EDIT) {
+ $defaults['visible'] = $link->is_visible();
+ }
+
+ // ELEMENT: add results
+ if ($form_type == self :: TYPE_ADD && $link->needs_results()) {
+ $this->addElement('checkbox', 'addresult', get_lang('AddResult'));
+ }
+ // submit button
+ if ($form_type == self :: TYPE_ADD) {
+ $this->addButtonCreate(get_lang('CreateLink'));
+ } else {
+ $this->addButtonUpdate(get_lang('LinkMod'));
+ }
+
+ if ($form_type == self :: TYPE_ADD) {
+ $setting = api_get_setting('tool_visible_by_default_at_creation');
+ $visibility_default = 1;
+ if (isset($setting['gradebook']) && $setting['gradebook'] == 'false') {
+ $visibility_default = 0;
+ }
+ $defaults['visible'] = $visibility_default;
+ }
+
+ // set default values
+ $this->setDefaults($defaults);
}
}
diff --git a/main/gradebook/lib/fe/linkform.class.php b/main/gradebook/lib/fe/linkform.class.php
index 482d7bce2c..e6e1b30240 100755
--- a/main/gradebook/lib/fe/linkform.class.php
+++ b/main/gradebook/lib/fe/linkform.class.php
@@ -10,133 +10,138 @@
*/
class LinkForm extends FormValidator
{
- const TYPE_CREATE = 1;
- const TYPE_MOVE = 2;
- /** @var Category */
- private $category_object;
- private $link_object;
- private $extra;
+ const TYPE_CREATE = 1;
+ const TYPE_MOVE = 2;
+ /** @var Category */
+ private $category_object;
+ private $link_object;
+ private $extra;
- /**
- * Builds a form containing form items based on a given parameter
- * @param int form_type 1=choose link
- * @param obj cat_obj the category object
- * @param string form name
- * @param method
- * @param action
- */
- public function __construct(
- $form_type,
- $category_object,
- $link_object,
- $form_name,
- $method = 'post',
- $action = null,
- $extra = null
- ) {
- parent :: __construct($form_name, $method, $action);
+ /**
+ * Builds a form containing form items based on a given parameter
+ * @param int form_type 1=choose link
+ * @param obj cat_obj the category object
+ * @param string form name
+ * @param method
+ * @param action
+ */
+ public function __construct(
+ $form_type,
+ $category_object,
+ $link_object,
+ $form_name,
+ $method = 'post',
+ $action = null,
+ $extra = null
+ ) {
+ parent :: __construct($form_name, $method, $action);
- if (isset ($category_object)) {
- $this->category_object = $category_object;
- } else {
- if (isset($link_object)) {
- $this->link_object = $link_object;
- }
- }
+ if (isset ($category_object)) {
+ $this->category_object = $category_object;
+ } else {
+ if (isset($link_object)) {
+ $this->link_object = $link_object;
+ }
+ }
- if (isset ($extra)) {
- $this->extra = $extra;
- }
- if ($form_type == self :: TYPE_CREATE) {
- $this->build_create();
- } elseif ($form_type == self :: TYPE_MOVE) {
- $this->build_move();
- }
- }
+ if (isset ($extra)) {
+ $this->extra = $extra;
+ }
+ if ($form_type == self :: TYPE_CREATE) {
+ $this->build_create();
+ } elseif ($form_type == self :: TYPE_MOVE) {
+ $this->build_move();
+ }
+ }
- protected function build_move()
- {
- $renderer =& $this->defaultRenderer();
- $renderer->setCustomElementTemplate('{element} ');
- $this->addElement('static',null,null,'"'.$this->link_object->get_name().'" ');
- $this->addElement('static',null,null,get_lang('MoveTo').' : ');
- $select = $this->addElement('select','move_cat',null,null);
- $line = '';
- foreach ($this->link_object->get_target_categories() as $cat) {
- for ($i=0;$i<$cat[2];$i++) {
- $line .= '—';
- }
- $select->addoption($line.' '.$cat[1],$cat[0]);
- $line = '';
- }
- $this->addElement('submit', null, get_lang('Ok'));
- }
+ protected function build_move()
+ {
+ $renderer =& $this->defaultRenderer();
+ $renderer->setCustomElementTemplate('{element} ');
+ $this->addElement(
+ 'static',
+ null,
+ null,
+ '"'.$this->link_object->get_name().'" '
+ );
+ $this->addElement('static', null, null, get_lang('MoveTo').' : ');
+ $select = $this->addElement('select', 'move_cat', null, null);
+ $line = '';
+ foreach ($this->link_object->get_target_categories() as $cat) {
+ for ($i = 0; $i < $cat[2]; $i++) {
+ $line .= '—';
+ }
+ $select->addoption($line.' '.$cat[1], $cat[0]);
+ $line = '';
+ }
+ $this->addElement('submit', null, get_lang('Ok'));
+ }
- /**
- * Builds the form
- */
- protected function build_create()
- {
- $this->addElement('header', get_lang('MakeLink'));
- $select = $this->addElement(
- 'select',
- 'select_link',
- get_lang('ChooseLink'),
- null,
- array('onchange' => 'document.create_link.submit()')
- );
+ /**
+ * Builds the form
+ */
+ protected function build_create()
+ {
+ $this->addElement('header', get_lang('MakeLink'));
+ $select = $this->addElement(
+ 'select',
+ 'select_link',
+ get_lang('ChooseLink'),
+ null,
+ array('onchange' => 'document.create_link.submit()')
+ );
- $linkTypes = LinkFactory::get_all_types();
+ $linkTypes = LinkFactory::get_all_types();
- $select->addoption('['.get_lang('ChooseLink').']', 0);
+ $select->addoption('['.get_lang('ChooseLink').']', 0);
- $courseCode = $this->category_object->get_course_code();
+ $courseCode = $this->category_object->get_course_code();
- foreach ($linkTypes as $linkType) {
- // The hot potatoe link will be added "inside" the exercise option.
- if ($linkType == LINK_HOTPOTATOES) {
- continue;
- }
- $link = $this->createLink($linkType, $courseCode);
- // disable this element if the link works with a dropdownlist
- // and if there are no links left
- if (!$link->needs_name_and_description() && count($link->get_all_links()) == '0') {
- $select->addoption($link->get_type_name(), $linkType, 'disabled');
- } else {
- if ($link->get_type() == LINK_EXERCISE) {
- // Adding exercise
- $select->addoption($link->get_type_name(), $linkType);
- // Adding hot potatoes
- $linkHot = $this->createLink(LINK_HOTPOTATOES, $courseCode);
- $select->addoption(
- ' '.$linkHot->get_type_name(),
- LINK_HOTPOTATOES
- );
- } else {
- $select->addoption($link->get_type_name(), $linkType);
- }
- }
- }
+ foreach ($linkTypes as $linkType) {
+ // The hot potatoe link will be added "inside" the exercise option.
+ if ($linkType == LINK_HOTPOTATOES) {
+ continue;
+ }
+ $link = $this->createLink($linkType, $courseCode);
+ // disable this element if the link works with a dropdownlist
+ // and if there are no links left
+ if (!$link->needs_name_and_description() && count($link->get_all_links()) == '0') {
+ $select->addoption($link->get_type_name(), $linkType, 'disabled');
+ } else {
+ if ($link->get_type() == LINK_EXERCISE) {
+ // Adding exercise
+ $select->addoption($link->get_type_name(), $linkType);
+ // Adding hot potatoes
+ $linkHot = $this->createLink(LINK_HOTPOTATOES, $courseCode);
+ $select->addoption(
+ ' '.$linkHot->get_type_name(),
+ LINK_HOTPOTATOES
+ );
+ } else {
+ $select->addoption($link->get_type_name(), $linkType);
+ }
+ }
+ }
- if (isset($this->extra)) {
- $this->setDefaults(array('select_link' => $this->extra));
- }
- }
+ if (isset($this->extra)) {
+ $this->setDefaults(array('select_link' => $this->extra));
+ }
+ }
- /**
- * @param integer $link
- * @param null|string $courseCode
- * @return AttendanceLink|DropboxLink|ExerciseLink|ForumThreadLink|LearnpathLink|null|StudentPublicationLink|SurveyLink
- */
- private function createLink($link, $courseCode)
- {
- $link = LinkFactory::create($link);
- if (!empty($courseCode)) {
- $link->set_course_code($courseCode);
- } elseif(!empty($_GET['course_code'])) {
- $link->set_course_code(Database::escape_string($_GET['course_code'], null, false));
- }
+ /**
+ * @param integer $link
+ * @param null|string $courseCode
+ * @return AttendanceLink|DropboxLink|ExerciseLink|ForumThreadLink|LearnpathLink|null|StudentPublicationLink|SurveyLink
+ */
+ private function createLink($link, $courseCode)
+ {
+ $link = LinkFactory::create($link);
+ if (!empty($courseCode)) {
+ $link->set_course_code($courseCode);
+ } elseif(!empty($_GET['course_code'])) {
+ $link->set_course_code(Database::escape_string($_GET['course_code'], null, false));
+ }
- return $link;
- }
+ return $link;
+ }
}
diff --git a/main/gradebook/lib/fe/resulttable.class.php b/main/gradebook/lib/fe/resulttable.class.php
index 14e4302f66..9d976b6fe7 100755
--- a/main/gradebook/lib/fe/resulttable.class.php
+++ b/main/gradebook/lib/fe/resulttable.class.php
@@ -10,166 +10,165 @@
*/
class ResultTable extends SortableTable
{
- private $datagen;
- private $evaluation;
- private $allresults;
- private $iscourse;
-
- /**
- * Constructor
- */
+ private $datagen;
+ private $evaluation;
+ private $allresults;
+ private $iscourse;
+
+ /**
+ * Constructor
+ */
public function __construct($evaluation, $results = array(), $iscourse, $addparams = null,$forprint = false)
- {
- parent :: __construct('resultlist', null, null, (api_is_western_name_order() xor api_sort_by_first_name()) ? 2 : 1);
-
- $this->datagen = new ResultsDataGenerator($evaluation, $results, true);
-
- $this->evaluation = $evaluation;
- $this->iscourse = $iscourse;
- $this->forprint = $forprint;
-
- if (isset ($addparams)) {
- $this->set_additional_parameters($addparams);
- }
- $scoredisplay = ScoreDisplay :: instance();
- $column= 0;
- if ($this->iscourse == '1') {
- $this->set_header($column++, '', false);
- $this->set_form_actions(array (
- 'delete' => get_lang('Delete')
- ));
- }
- if (api_is_western_name_order()) {
- $this->set_header($column++, get_lang('FirstName'));
- $this->set_header($column++, get_lang('LastName'));
- } else {
- $this->set_header($column++, get_lang('LastName'));
- $this->set_header($column++, get_lang('FirstName'));
- }
- $this->set_header($column++, get_lang('Score'));
- if ($scoredisplay->is_custom()) {
- $this->set_header($column++, get_lang('Display'));
- }
- if (!$this->forprint) {
- $this->set_header($column++, get_lang('Modify'),false);
- }
+ {
+ parent :: __construct('resultlist', null, null, (api_is_western_name_order() xor api_sort_by_first_name()) ? 2 : 1);
+
+ $this->datagen = new ResultsDataGenerator($evaluation, $results, true);
+
+ $this->evaluation = $evaluation;
+ $this->iscourse = $iscourse;
+ $this->forprint = $forprint;
+
+ if (isset ($addparams)) {
+ $this->set_additional_parameters($addparams);
+ }
+ $scoredisplay = ScoreDisplay :: instance();
+ $column= 0;
+ if ($this->iscourse == '1') {
+ $this->set_header($column++, '', false);
+ $this->set_form_actions(array (
+ 'delete' => get_lang('Delete')
+ ));
+ }
+ if (api_is_western_name_order()) {
+ $this->set_header($column++, get_lang('FirstName'));
+ $this->set_header($column++, get_lang('LastName'));
+ } else {
+ $this->set_header($column++, get_lang('LastName'));
+ $this->set_header($column++, get_lang('FirstName'));
+ }
+ $this->set_header($column++, get_lang('Score'));
+ if ($scoredisplay->is_custom()) {
+ $this->set_header($column++, get_lang('Display'));
+ }
+ if (!$this->forprint) {
+ $this->set_header($column++, get_lang('Modify'),false);
+ }
}
-
- /**
- * Function used by SortableTable to get total number of items in the table
- */
- public function get_total_number_of_items ()
+ /**
+ * Function used by SortableTable to get total number of items in the table
+ */
+ public function get_total_number_of_items ()
{
- return $this->datagen->get_total_results_count();
- }
-
- /**
- * Function used by SortableTable to generate the data to display
- */
- public function get_table_data($from = 1, $per_page = null, $column = null, $direction = null, $sort = null) {
-
- $is_western_name_order = api_is_western_name_order();
- $scoredisplay = ScoreDisplay :: instance();
-
- // determine sorting type
- $col_adjust = $this->iscourse == '1' ? 1 : 0;
-
- switch ($this->column) {
- // first name or last name
- case (0 + $col_adjust):
- if ($is_western_name_order) {
- $sorting = ResultsDataGenerator :: RDG_SORT_FIRSTNAME;
- } else {
- $sorting = ResultsDataGenerator :: RDG_SORT_LASTNAME;
- }
- break;
+ return $this->datagen->get_total_results_count();
+ }
+
+ /**
+ * Function used by SortableTable to generate the data to display
+ */
+ public function get_table_data($from = 1, $per_page = null, $column = null, $direction = null, $sort = null) {
+
+ $is_western_name_order = api_is_western_name_order();
+ $scoredisplay = ScoreDisplay :: instance();
+
+ // determine sorting type
+ $col_adjust = $this->iscourse == '1' ? 1 : 0;
+
+ switch ($this->column) {
+ // first name or last name
+ case (0 + $col_adjust):
+ if ($is_western_name_order) {
+ $sorting = ResultsDataGenerator :: RDG_SORT_FIRSTNAME;
+ } else {
+ $sorting = ResultsDataGenerator :: RDG_SORT_LASTNAME;
+ }
+ break;
// first name or last name
- case (1 + $col_adjust):
- if ($is_western_name_order) {
- $sorting = ResultsDataGenerator :: RDG_SORT_LASTNAME;
- } else {
- $sorting = ResultsDataGenerator :: RDG_SORT_FIRSTNAME;
- }
- break;
+ case (1 + $col_adjust):
+ if ($is_western_name_order) {
+ $sorting = ResultsDataGenerator :: RDG_SORT_LASTNAME;
+ } else {
+ $sorting = ResultsDataGenerator :: RDG_SORT_FIRSTNAME;
+ }
+ break;
//Score
- case (2 + $col_adjust):
- $sorting = ResultsDataGenerator :: RDG_SORT_SCORE;
- break;
- case (3 + $col_adjust):
- $sorting = ResultsDataGenerator :: RDG_SORT_MASK;
- break;
- }
-
- if ($this->direction == 'DESC') {
- $sorting |= ResultsDataGenerator :: RDG_SORT_DESC;
- } else {
- $sorting |= ResultsDataGenerator :: RDG_SORT_ASC;
- }
-
- $data_array = $this->datagen->get_data($sorting, $from, $this->per_page);
-
- // generate the data to display
- $sortable_data = array();
- foreach ($data_array as $item) {
- $row = array ();
- if ($this->iscourse == '1') {
- $row[] = $item['result_id'];
- }
- if ($is_western_name_order) {
- $row[] = $item['firstname'];
- $row[] = $item['lastname'];
- } else {
- $row[] = $item['lastname'];
- $row[] = $item['firstname'];
- }
-
- $row[] = Display::bar_progress($item['percentage_score'], false, $item['score']);
+ case (2 + $col_adjust):
+ $sorting = ResultsDataGenerator :: RDG_SORT_SCORE;
+ break;
+ case (3 + $col_adjust):
+ $sorting = ResultsDataGenerator :: RDG_SORT_MASK;
+ break;
+ }
+
+ if ($this->direction == 'DESC') {
+ $sorting |= ResultsDataGenerator :: RDG_SORT_DESC;
+ } else {
+ $sorting |= ResultsDataGenerator :: RDG_SORT_ASC;
+ }
+
+ $data_array = $this->datagen->get_data($sorting, $from, $this->per_page);
+
+ // generate the data to display
+ $sortable_data = array();
+ foreach ($data_array as $item) {
+ $row = array ();
+ if ($this->iscourse == '1') {
+ $row[] = $item['result_id'];
+ }
+ if ($is_western_name_order) {
+ $row[] = $item['firstname'];
+ $row[] = $item['lastname'];
+ } else {
+ $row[] = $item['lastname'];
+ $row[] = $item['firstname'];
+ }
+
+ $row[] = Display::bar_progress($item['percentage_score'], false, $item['score']);
//$row[] = Display::bar_progress($item['percentage_score'], true);
- if ($scoredisplay->is_custom()) {
- $row[] = $item['display'];
- }
- if (!$this->forprint) {
- $row[] = $this->build_edit_column ($item);
- }
- $sortable_data[] = $row;
- }
-
- return $sortable_data;
- }
-
- private function build_edit_column ($item)
- {
- $status = CourseManager::get_user_in_course_status(api_get_user_id(), api_get_course_id());
- $locked_status = $this->evaluation->get_locked();
- if (api_is_allowed_to_edit(null, true) && $locked_status == 0) {
- //api_is_course_admin()
- $edit_column = ''.
- Display::return_icon('edit.png', get_lang('Modify'),'','22').'';
- $edit_column .= ' '.
- Display::return_icon('delete.png', get_lang('Delete'),'','22').'';
- }
-
- if ($this->evaluation->get_course_code() == null) {
- $edit_column .= ' ';
- $edit_column .= Display::return_icon('delete.png', get_lang('Delete'));
- $edit_column .= '';
- $edit_column .= ' ';
- $edit_column .= Display::return_icon('statistics.gif', get_lang('Statistics'));
- $edit_column .= '';
- }
-
- // Evaluation's origin is a link
- if ($this->evaluation->get_category_id() < 0) {
- $link = LinkFactory::get_evaluation_link($this->evaluation->get_id());
- $doc_url = $link->get_view_url($item['id']);
-
- if ($doc_url != null) {
- $edit_column .= ' ';
- $edit_column .= Display::return_icon('link.gif', get_lang('OpenDocument')).'';
- }
- }
-
- return $edit_column;
- }
+ if ($scoredisplay->is_custom()) {
+ $row[] = $item['display'];
+ }
+ if (!$this->forprint) {
+ $row[] = $this->build_edit_column ($item);
+ }
+ $sortable_data[] = $row;
+ }
+
+ return $sortable_data;
+ }
+
+ private function build_edit_column ($item)
+ {
+ $status = CourseManager::get_user_in_course_status(api_get_user_id(), api_get_course_id());
+ $locked_status = $this->evaluation->get_locked();
+ if (api_is_allowed_to_edit(null, true) && $locked_status == 0) {
+ //api_is_course_admin()
+ $edit_column = ''.
+ Display::return_icon('edit.png', get_lang('Modify'),'','22').'';
+ $edit_column .= ' '.
+ Display::return_icon('delete.png', get_lang('Delete'),'','22').'';
+ }
+
+ if ($this->evaluation->get_course_code() == null) {
+ $edit_column .= ' ';
+ $edit_column .= Display::return_icon('delete.png', get_lang('Delete'));
+ $edit_column .= '';
+ $edit_column .= ' ';
+ $edit_column .= Display::return_icon('statistics.gif', get_lang('Statistics'));
+ $edit_column .= '';
+ }
+
+ // Evaluation's origin is a link
+ if ($this->evaluation->get_category_id() < 0) {
+ $link = LinkFactory::get_evaluation_link($this->evaluation->get_id());
+ $doc_url = $link->get_view_url($item['id']);
+
+ if ($doc_url != null) {
+ $edit_column .= ' ';
+ $edit_column .= Display::return_icon('link.gif', get_lang('OpenDocument')).'';
+ }
+ }
+
+ return $edit_column;
+ }
}
diff --git a/main/gradebook/lib/fe/scoredisplayform.class.php b/main/gradebook/lib/fe/scoredisplayform.class.php
index 3ab1322e01..102d84062e 100755
--- a/main/gradebook/lib/fe/scoredisplayform.class.php
+++ b/main/gradebook/lib/fe/scoredisplayform.class.php
@@ -146,7 +146,8 @@ class ScoreDisplayForm extends FormValidator
}
}
- function validate() {
+ public function validate()
+ {
return parent :: validate();
}
}
diff --git a/main/gradebook/lib/fe/userform.class.php b/main/gradebook/lib/fe/userform.class.php
index f99a38dc06..4407394931 100755
--- a/main/gradebook/lib/fe/userform.class.php
+++ b/main/gradebook/lib/fe/userform.class.php
@@ -9,71 +9,72 @@
*/
class UserForm extends FormValidator
{
- const TYPE_USER_INFO= 1;
- const TYPE_SIMPLE_SEARCH = 3;
- /**
- * Builds a form containing form items based on a given parameter
- * @param int form_type 1 = user_info
- * @param user array
- * @param string form name
- * @param method
- * @param action
- */
- public function __construct($form_type, $user, $form_name, $method= 'post', $action= null)
- {
- parent :: __construct($form_name, $method, $action);
- $this->form_type= $form_type;
- if (isset ($user)) {
- $this->user_info= $user;
- }
- if (isset ($result_object)) {
- $this->result_object= $result_object;
- }
- if ($this->form_type == self :: TYPE_USER_INFO) {
- $this->build_user_info_form();
- }
- elseif ($this->form_type == self :: TYPE_SIMPLE_SEARCH) {
- $this->build_simple_search();
- }
- $this->setDefaults();
- }
+ const TYPE_USER_INFO= 1;
+ const TYPE_SIMPLE_SEARCH = 3;
- protected function build_simple_search()
- {
- if (isset($_GET['search']) && (!empty($_GET['search']))) {
- $this->setDefaults(array(
- 'keyword' => Security::remove_XSS($_GET['search'])
- ));
- }
- $renderer =& $this->defaultRenderer();
- $renderer->setCustomElementTemplate('{element} ');
- $this->addElement('text','keyword','');
- $this->addButtonSearch(get_lang('Search'), 'submit');
- }
+ /**
+ * Builds a form containing form items based on a given parameter
+ * @param int form_type 1 = user_info
+ * @param user array
+ * @param string form name
+ * @param method
+ * @param action
+ */
+ public function __construct($form_type, $user, $form_name, $method= 'post', $action= null)
+ {
+ parent :: __construct($form_name, $method, $action);
+ $this->form_type= $form_type;
+ if (isset ($user)) {
+ $this->user_info= $user;
+ }
+ if (isset ($result_object)) {
+ $this->result_object= $result_object;
+ }
+ if ($this->form_type == self :: TYPE_USER_INFO) {
+ $this->build_user_info_form();
+ }
+ elseif ($this->form_type == self :: TYPE_SIMPLE_SEARCH) {
+ $this->build_simple_search();
+ }
+ $this->setDefaults();
+ }
- protected function build_user_info_form()
- {
- if (api_is_western_name_order()) {
- $this->addElement('static', 'fname', get_lang('FirstName'), $this->user_info['firstname']);
- $this->addElement('static', 'lname', get_lang('LastName'), $this->user_info['lastname']);
- } else {
- $this->addElement('static', 'lname', get_lang('LastName'), $this->user_info['lastname']);
- $this->addElement('static', 'fname', get_lang('FirstName'), $this->user_info['firstname']);
- }
- $this->addElement('static', 'uname', get_lang('UserName'), $this->user_info['username']);
- $this->addElement('static', 'email', get_lang('Email'), '' . $this->user_info['email'] . '');
- $this->addElement('static', 'ofcode', get_lang('OfficialCode'), $this->user_info['official_code']);
- $this->addElement('static', 'phone', get_lang('Phone'), $this->user_info['phone']);
- $this->addButtonSave(get_lang('Back'), 'submit');
- }
+ protected function build_simple_search()
+ {
+ if (isset($_GET['search']) && (!empty($_GET['search']))) {
+ $this->setDefaults(array(
+ 'keyword' => Security::remove_XSS($_GET['search'])
+ ));
+ }
+ $renderer =& $this->defaultRenderer();
+ $renderer->setCustomElementTemplate('{element} ');
+ $this->addElement('text','keyword','');
+ $this->addButtonSearch(get_lang('Search'), 'submit');
+ }
- function display()
- {
- parent :: display();
- }
+ protected function build_user_info_form()
+ {
+ if (api_is_western_name_order()) {
+ $this->addElement('static', 'fname', get_lang('FirstName'), $this->user_info['firstname']);
+ $this->addElement('static', 'lname', get_lang('LastName'), $this->user_info['lastname']);
+ } else {
+ $this->addElement('static', 'lname', get_lang('LastName'), $this->user_info['lastname']);
+ $this->addElement('static', 'fname', get_lang('FirstName'), $this->user_info['firstname']);
+ }
+ $this->addElement('static', 'uname', get_lang('UserName'), $this->user_info['username']);
+ $this->addElement('static', 'email', get_lang('Email'), '' . $this->user_info['email'] . '');
+ $this->addElement('static', 'ofcode', get_lang('OfficialCode'), $this->user_info['official_code']);
+ $this->addElement('static', 'phone', get_lang('Phone'), $this->user_info['phone']);
+ $this->addButtonSave(get_lang('Back'), 'submit');
+ }
- function setDefaults($defaults= array(), $filter = null)
- {
- parent :: setDefaults($defaults, $filter);
- }
+ function display()
+ {
+ parent :: display();
+ }
+
+ function setDefaults($defaults= array(), $filter = null)
+ {
+ parent :: setDefaults($defaults, $filter);
+ }
}
diff --git a/main/gradebook/lib/fe/usertable.class.php b/main/gradebook/lib/fe/usertable.class.php
index 16be247fe9..ff3d125c57 100755
--- a/main/gradebook/lib/fe/usertable.class.php
+++ b/main/gradebook/lib/fe/usertable.class.php
@@ -10,128 +10,129 @@
*/
class UserTable extends SortableTable
{
- private $userid;
- private $datagen;
+ private $userid;
+ private $datagen;
- /**
- * Constructor
- */
- public function __construct($userid, $evals = array(), $links = array(), $addparams = null)
- {
- parent :: __construct ('userlist', null, null, 0);
- $this->userid = $userid;
- $this->datagen = new UserDataGenerator($userid, $evals, $links);
- if (isset($addparams)) {
- $this->set_additional_parameters($addparams);
- }
- $column = 0;
- $this->set_header($column++, get_lang('Type'));
- $this->set_header($column++, get_lang('Evaluation'));
- $this->set_header($column++, get_lang('Course'));
- $this->set_header($column++, get_lang('Category'));
- $this->set_header($column++, get_lang('EvaluationAverage'));
- $this->set_header($column++, get_lang('Result'));
+ /**
+ * Constructor
+ */
+ public function __construct($userid, $evals = array(), $links = array(), $addparams = null)
+ {
+ parent :: __construct('userlist', null, null, 0);
+ $this->userid = $userid;
+ $this->datagen = new UserDataGenerator($userid, $evals, $links);
+ if (isset($addparams)) {
+ $this->set_additional_parameters($addparams);
+ }
+ $column = 0;
+ $this->set_header($column++, get_lang('Type'));
+ $this->set_header($column++, get_lang('Evaluation'));
+ $this->set_header($column++, get_lang('Course'));
+ $this->set_header($column++, get_lang('Category'));
+ $this->set_header($column++, get_lang('EvaluationAverage'));
+ $this->set_header($column++, get_lang('Result'));
- $scoredisplay = ScoreDisplay :: instance();
- if ($scoredisplay->is_custom()) {
- $this->set_header($column++, get_lang('Display'));
- }
- }
+ $scoredisplay = ScoreDisplay :: instance();
+ if ($scoredisplay->is_custom()) {
+ $this->set_header($column++, get_lang('Display'));
+ }
+ }
- /**
- * Function used by SortableTable to get total number of items in the table
- */
- function get_total_number_of_items()
- {
- return $this->datagen->get_total_items_count();
- }
+ /**
+ * Function used by SortableTable to get total number of items in the table
+ */
+ function get_total_number_of_items()
+ {
+ return $this->datagen->get_total_items_count();
+ }
- /**
- * Function used by SortableTable to generate the data to display
- */
- public function get_table_data($from = 1, $per_page = null, $column = null, $direction = null, $sort = null)
- {
- $scoredisplay = ScoreDisplay :: instance();
+ /**
+ * Function used by SortableTable to generate the data to display
+ */
+ public function get_table_data($from = 1, $per_page = null, $column = null, $direction = null, $sort = null)
+ {
+ $scoredisplay = ScoreDisplay :: instance();
- // determine sorting type
- switch ($this->column) {
- // Type
- case 0:
- $sorting = UserDataGenerator :: UDG_SORT_TYPE;
- break;
- case 1:
- $sorting = UserDataGenerator :: UDG_SORT_NAME;
- break;
- case 2:
- $sorting = UserDataGenerator :: UDG_SORT_COURSE;
- break;
- case 3:
- $sorting = UserDataGenerator :: UDG_SORT_CATEGORY;
- break;
- case 4:
- $sorting = UserDataGenerator :: UDG_SORT_AVERAGE;
- break;
- case 5:
- $sorting = UserDataGenerator :: UDG_SORT_SCORE;
- break;
- case 6:
- $sorting = UserDataGenerator :: UDG_SORT_MASK;
- break;
- }
- if ($this->direction == 'DESC') {
- $sorting |= UserDataGenerator :: UDG_SORT_DESC;
- } else {
- $sorting |= UserDataGenerator :: UDG_SORT_ASC;
- }
- $data_array = $this->datagen->get_data($sorting, $from, $this->per_page);
- // generate the data to display
- $sortable_data = array();
- foreach ($data_array as $data) {
- if ($data[2]!="") {//filter by course removed
- $row = array ();
- $row[] = $this->build_type_column($data[0]);
- $row[] = $this->build_name_link($data[0]);
- $row[] = $data[2];
- $row[] = $data[3];
- $row[] = $data[4];
- $row[] = $data[5];
- if ($scoredisplay->is_custom())
- $row[] = $data[6];
- $sortable_data[] = $row;
- }
- }
+ // determine sorting type
+ switch ($this->column) {
+ // Type
+ case 0:
+ $sorting = UserDataGenerator :: UDG_SORT_TYPE;
+ break;
+ case 1:
+ $sorting = UserDataGenerator :: UDG_SORT_NAME;
+ break;
+ case 2:
+ $sorting = UserDataGenerator :: UDG_SORT_COURSE;
+ break;
+ case 3:
+ $sorting = UserDataGenerator :: UDG_SORT_CATEGORY;
+ break;
+ case 4:
+ $sorting = UserDataGenerator :: UDG_SORT_AVERAGE;
+ break;
+ case 5:
+ $sorting = UserDataGenerator :: UDG_SORT_SCORE;
+ break;
+ case 6:
+ $sorting = UserDataGenerator :: UDG_SORT_MASK;
+ break;
+ }
+ if ($this->direction == 'DESC') {
+ $sorting |= UserDataGenerator :: UDG_SORT_DESC;
+ } else {
+ $sorting |= UserDataGenerator :: UDG_SORT_ASC;
+ }
+ $data_array = $this->datagen->get_data($sorting, $from, $this->per_page);
+ // generate the data to display
+ $sortable_data = array();
+ foreach ($data_array as $data) {
+ if ($data[2]!="") {//filter by course removed
+ $row = array ();
+ $row[] = $this->build_type_column($data[0]);
+ $row[] = $this->build_name_link($data[0]);
+ $row[] = $data[2];
+ $row[] = $data[3];
+ $row[] = $data[4];
+ $row[] = $data[5];
+ if ($scoredisplay->is_custom()) {
+ $row[] = $data[6];
+ }
+ $sortable_data[] = $row;
+ }
+ }
- return $sortable_data;
- }
+ return $sortable_data;
+ }
- /**
- * @param $item
- * @return string
- */
- private function build_type_column($item)
- {
- return GradebookUtils::build_type_icon_tag($item->get_icon_name());
- }
+ /**
+ * @param $item
+ * @return string
+ */
+ private function build_type_column($item)
+ {
+ return GradebookUtils::build_type_icon_tag($item->get_icon_name());
+ }
- /**
- * @param $item
- * @return string
- */
- private function build_name_link($item)
- {
- switch ($item->get_item_type()) {
- // evaluation
- case 'E' :
- return ' '
- . ''
- . $item->get_name()
- . '';
- // link
- case 'L' :
- return ' '
- . $item->get_name()
- . ''
- . ' [' . $item->get_type_name() . ']';
- }
- }
+ /**
+ * @param $item
+ * @return string
+ */
+ private function build_name_link($item)
+ {
+ switch ($item->get_item_type()) {
+ // evaluation
+ case 'E':
+ return ' '
+ . ''
+ . $item->get_name()
+ . '';
+ // link
+ case 'L':
+ return ' '
+ . $item->get_name()
+ . ''
+ . ' [' . $item->get_type_name() . ']';
+ }
+ }
}
diff --git a/main/gradebook/lib/flatview_data_generator.class.php b/main/gradebook/lib/flatview_data_generator.class.php
index 1da62b572f..af4ced4563 100755
--- a/main/gradebook/lib/flatview_data_generator.class.php
+++ b/main/gradebook/lib/flatview_data_generator.class.php
@@ -165,14 +165,13 @@ class FlatViewDataGenerator
// Means there are any subcategory
foreach ($allcat as $sub_cat) {
-
$sub_cat_weight = round(100 * $sub_cat->get_weight() / $main_weight, 1);
$add_weight = " $sub_cat_weight %";
$mainHeader = Display::url(
- $sub_cat->get_name(),
- api_get_self().'?selectcat='.$sub_cat->get_id().'&'.api_get_cidreq()
- ).$add_weight;
+ $sub_cat->get_name(),
+ api_get_self().'?selectcat='.$sub_cat->get_id().'&'.api_get_cidreq()
+ ).$add_weight;
if (api_get_setting('gradebook_detailed_admin_view') === 'true') {
@@ -209,7 +208,7 @@ class FlatViewDataGenerator
(isset($this->params['only_total_category']) &&
$this->params['only_total_category'] == false)
) {
- for ($count=0; ($count < $items_count ) && ($items_start + $count < count($this->evals_links)); $count++) {
+ for ($count = 0; ($count < $items_count) && ($items_start + $count < count($this->evals_links)); $count++) {
/** @var AbstractLink $item */
$item = $this->evals_links[$count + $items_start];
$weight = round(100 * $item->get_weight() / $main_weight, 1);
@@ -523,6 +522,7 @@ class FlatViewDataGenerator
}
$item_value_total += $item_value;
}
+
if ($convert_using_the_global_weight) {
//$item_total = $main_weight;
}
@@ -716,7 +716,7 @@ class FlatViewDataGenerator
foreach ($selected_users as $user) {
$row = array ();
- for ($count=0;$count < count($this->evals_links); $count++) {
+ for ($count = 0; $count < count($this->evals_links); $count++) {
$item = $this->evals_links [$count];
$score = $item->calc_score($user[0]);
$porcent_score = isset($score[1]) && $score[1] > 0 ? ($score[0]*100)/$score[1] :0;
@@ -731,7 +731,7 @@ class FlatViewDataGenerator
$tmp = array();
foreach ($items as $item => $value) {
$tmp[] = $item;
- if (in_array($item,$tmp)) {
+ if (in_array($item, $tmp)) {
$data_by_item[$item][$uid] = $value;
}
}
@@ -784,7 +784,7 @@ class FlatViewDataGenerator
$item_value = 0;
$item_total = 0;
- for ($count=0;$count < count($this->evals_links); $count++) {
+ for ($count = 0; $count < count($this->evals_links); $count++) {
$item = $this->evals_links[$count];
$score = $item->calc_score($user[0]);
@@ -803,6 +803,7 @@ class FlatViewDataGenerator
$row[] = $score_final;
$data[] = $row;
}
+
return $data;
}
@@ -840,7 +841,6 @@ class FlatViewDataGenerator
$parent_id = $this->category->get_parent_id();
if ($parent_id == 0 && !empty($allcat)) {
-
foreach ($allcat as $sub_cat) {
$score = $sub_cat->calc_score($user[0]);
$real_score = $score;
@@ -866,7 +866,7 @@ class FlatViewDataGenerator
trim($scoredisplay->display_score($total_score, SCORE_CUSTOM, null, true))
);
} else {
- for ($count=0;$count < count($this->evals_links); $count++) {
+ for ($count = 0; $count < count($this->evals_links); $count++) {
$item = $this->evals_links [$count];
$score = $item->calc_score($user[0]);
$divide = ($score[1]) == 0 ? 1 : $score[1];
@@ -880,9 +880,9 @@ class FlatViewDataGenerator
$total_score=array($item_value,$item_total);
$score_final = ($item_value / $item_total) * 100;
if ($displayWarning) {
- Display::display_warning_message( Display::display_warning_message($total_score[1]));
+ Display::display_warning_message($total_score[1]);
}
- $row[] =array ($score_final, trim($scoredisplay->display_score($total_score, SCORE_CUSTOM, null, true)));
+ $row[] = array($score_final, trim($scoredisplay->display_score($total_score, SCORE_CUSTOM, null, true)));
}
$data[] = $row;
diff --git a/main/gradebook/lib/gradebook_data_generator.class.php b/main/gradebook/lib/gradebook_data_generator.class.php
index f191e44c09..fd83583b5c 100755
--- a/main/gradebook/lib/gradebook_data_generator.class.php
+++ b/main/gradebook/lib/gradebook_data_generator.class.php
@@ -210,15 +210,13 @@ class GradebookDataGenerator
if (!empty($score['score'][0])) {
$invalidateResults = false;
- }
+ }
$rankingStudentList[$user['user_id']] = $score['score'][0];
}
$scoreDisplay = ScoreDisplay::instance();
$score = AbstractLink::getCurrentUserRanking($userId, $rankingStudentList);
-
$row['ranking'] = $scoreDisplay->display_score($score, SCORE_DIV, SCORE_BOTH, true);
-
if ($invalidateResults) {
$row['ranking'] = null;
}
@@ -321,7 +319,7 @@ class GradebookDataGenerator
if (!empty($score)) {
switch ($item->get_item_type()) {
// category
- case 'C' :
+ case 'C':
if ($score != null) {
if ($forceSimpleResult) {
return
@@ -349,8 +347,8 @@ class GradebookDataGenerator
}
break;
// evaluation and link
- case 'E' :
- case 'L' :
+ case 'E':
+ case 'L':
//if ($parentId == 0) {
$scoreWeight = [
($score[1] > 0) ? $score[0] / $score[1] * $item->get_weight() : 0,
@@ -502,7 +500,7 @@ class GradebookDataGenerator
}
if ($timestamp1 == $timestamp2) {
- return $this->sort_by_name($item1,$item2);
+ return $this->sort_by_name($item1, $item2);
} else {
return ($timestamp1 < $timestamp2 ? -1 : 1);
}
diff --git a/main/gradebook/lib/gradebook_result.class.php b/main/gradebook/lib/gradebook_result.class.php
index 80bac373fb..b95ec1dcbb 100644
--- a/main/gradebook/lib/gradebook_result.class.php
+++ b/main/gradebook/lib/gradebook_result.class.php
@@ -36,16 +36,15 @@ class GradeBookResult
//titles
foreach ($dato[0] as $header_col) {
- if(!empty($header_col)) {
+ if (!empty($header_col)) {
$data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($header_col))).';';
}
}
- $data .="\r\n";
+ $data .= "\r\n";
$cant_students = count($dato[1]);
- //print_r($data); exit();
- for($i=0;$i<$cant_students;$i++) {
+ 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))).';';
@@ -101,7 +100,11 @@ class GradeBookResult
for ($i = 0; $i < $cant_students; $i++) {
$column = 0;
foreach ($data[1][$i] as $col_name) {
- $worksheet->SetCellValueByColumnAndRow($line,$column, html_entity_decode(strip_tags($col_name)));
+ $worksheet->SetCellValueByColumnAndRow(
+ $line,
+ $column,
+ html_entity_decode(strip_tags($col_name))
+ );
$column++;
}
$line++;
diff --git a/main/gradebook/lib/scoredisplay.class.php b/main/gradebook/lib/scoredisplay.class.php
index 6d08bda10b..7812e50845 100755
--- a/main/gradebook/lib/scoredisplay.class.php
+++ b/main/gradebook/lib/scoredisplay.class.php
@@ -62,7 +62,6 @@ class ScoreDisplay
}
// Loading portal settings + using standard functions.
-
$value = api_get_setting('gradebook_score_display_coloring');
$value = $value['my_display_coloring'];
@@ -342,23 +341,23 @@ class ScoreDisplay
private function display_default($score, $type)
{
switch ($type) {
- case SCORE_DIV : // X / Y
+ case SCORE_DIV: // X / Y
return $this->display_as_div($score);
- case SCORE_PERCENT : // XX %
+ case SCORE_PERCENT: // XX %
return $this->display_as_percent($score);
- case SCORE_DIV_PERCENT : // X / Y (XX %)
+ case SCORE_DIV_PERCENT: // X / Y (XX %)
return $this->display_as_div($score).' (' . $this->display_as_percent($score) . ')';
- case SCORE_AVERAGE : // XX %
+ case SCORE_AVERAGE: // XX %
return $this->display_as_percent($score);
- case SCORE_DECIMAL : // 0.50 (X/Y)
+ case SCORE_DECIMAL: // 0.50 (X/Y)
return $this->display_as_decimal($score);
- case SCORE_DIV_PERCENT_WITH_CUSTOM : // X / Y (XX %) - Good!
+ case SCORE_DIV_PERCENT_WITH_CUSTOM: // X / Y (XX %) - Good!
$custom = $this->display_custom($score);
if (!empty($custom)) {
$custom = ' - '.$custom;
}
return $this->display_as_div($score).' (' . $this->display_as_percent($score) . ')'.$custom;
- case SCORE_DIV_SIMPLE_WITH_CUSTOM : // X - Good!
+ case SCORE_DIV_SIMPLE_WITH_CUSTOM: // X - Good!
$custom = $this->display_custom($score);
if (!empty($custom)) {
diff --git a/main/gradebook/lib/user_data_generator.class.php b/main/gradebook/lib/user_data_generator.class.php
index bca049de65..ed1babf170 100755
--- a/main/gradebook/lib/user_data_generator.class.php
+++ b/main/gradebook/lib/user_data_generator.class.php
@@ -10,28 +10,28 @@
*/
class UserDataGenerator
{
- // Sorting types constants
- const UDG_SORT_TYPE = 1;
- const UDG_SORT_NAME = 2;
- const UDG_SORT_COURSE = 4;
- const UDG_SORT_CATEGORY = 8;
- const UDG_SORT_AVERAGE = 16;
- const UDG_SORT_SCORE = 32;
- const UDG_SORT_MASK = 64;
-
- const UDG_SORT_ASC = 128;
- const UDG_SORT_DESC = 256;
-
- private $items;
- private $userid;
-
- private $coursecodecache;
- private $categorycache;
- private $scorecache;
- private $avgcache;
-
- public function __construct($userid, $evals = array(), $links = array())
- {
+ // Sorting types constants
+ const UDG_SORT_TYPE = 1;
+ const UDG_SORT_NAME = 2;
+ const UDG_SORT_COURSE = 4;
+ const UDG_SORT_CATEGORY = 8;
+ const UDG_SORT_AVERAGE = 16;
+ const UDG_SORT_SCORE = 32;
+ const UDG_SORT_MASK = 64;
+
+ const UDG_SORT_ASC = 128;
+ const UDG_SORT_DESC = 256;
+
+ private $items;
+ private $userid;
+
+ private $coursecodecache;
+ private $categorycache;
+ private $scorecache;
+ private $avgcache;
+
+ public function __construct($userid, $evals = array(), $links = array())
+ {
$this->userid = $userid;
$evals_filtered = array();
$result = array();
@@ -62,330 +62,330 @@ class UserDataGenerator
$this->avgcache = null;
}
- /**
- * Get total number of items (rows)
- */
- public function get_total_items_count()
- {
- return count($this->items);
- }
-
- /**
- * Get actual array data
- * @return array 2-dimensional array - each array contains the elements:
- * 0: eval/link object
- * 1: item name
- * 2: course name
- * 3: category name
- * 4: average score
- * 5: student's score
- * 6: student's score as custom display (only if custom scoring enabled)
- */
- public function get_data($sorting = 0, $start = 0, $count = null, $ignore_score_color = false)
- {
- // do some checks on count, redefine if invalid value
- if (!isset($count)) {
- $count = count ($this->items) - $start;
- }
- if ($count < 0) {
- $count = 0;
- }
- $allitems = $this->items;
-
- // sort users array
- if ($sorting & self :: UDG_SORT_TYPE) {
- usort($allitems, array('UserDataGenerator', 'sort_by_type'));
- }elseif ($sorting & self :: UDG_SORT_NAME) {
- usort($allitems, array('UserDataGenerator', 'sort_by_name'));
- } elseif ($sorting & self :: UDG_SORT_COURSE) {
- usort($allitems, array('UserDataGenerator', 'sort_by_course'));
- } elseif ($sorting & self :: UDG_SORT_CATEGORY) {
- usort($allitems, array('UserDataGenerator', 'sort_by_category'));
- } elseif ($sorting & self :: UDG_SORT_AVERAGE) {
- // if user sorts on average scores, first calculate them and cache them
- foreach ($allitems as $item) {
- $this->avgcache[$item->get_item_type() . $item->get_id()]= $item->calc_score();
- }
- usort($allitems, array('UserDataGenerator', 'sort_by_average'));
- } elseif ($sorting & self :: UDG_SORT_SCORE) {
- // if user sorts on student's scores, first calculate them and cache them
- foreach ($allitems as $item) {
- $this->scorecache[$item->get_item_type() . $item->get_id()]
- = $item->calc_score($this->userid);
- }
- usort($allitems, array('UserDataGenerator', 'sort_by_score'));
- } elseif ($sorting & self :: UDG_SORT_MASK) {
- // if user sorts on student's masks, first calculate scores and cache them
- foreach ($allitems as $item) {
- $this->scorecache[$item->get_item_type() . $item->get_id()]
- = $item->calc_score($this->userid);
- }
- usort($allitems, array('UserDataGenerator', 'sort_by_mask'));
- }
-
- if ($sorting & self :: UDG_SORT_DESC) {
- $allitems = array_reverse($allitems);
- }
- // select the items we have to display
- $visibleitems = array_slice($allitems, $start, $count);
-
- // fill score cache if not done yet
- if (!isset ($this->scorecache)) {
- foreach ($visibleitems as $item) {
- $this->scorecache[$item->get_item_type() . $item->get_id()]
- = $item->calc_score($this->userid);
- }
-
- }
- // generate the data to display
- $scoredisplay = ScoreDisplay :: instance();
- $data = array();
- foreach ($visibleitems as $item) {
- $row = array ();
- $row[] = $item;
- $row[] = $item->get_name();
- $row[] = $this->build_course_name($item);
- $row[] = $this->build_category_name($item);
- $row[] = $this->build_average_column($item, $ignore_score_color);
- $row[] = $this->build_result_column($item, $ignore_score_color);
- if ($scoredisplay->is_custom())
- $row[] = $this->build_mask_column($item, $ignore_score_color);
- $data[] = $row;
- }
- return $data;
- }
-
- /**
- * @param $item1
- * @param $item2
- * @return int
- */
- function sort_by_type($item1, $item2)
- {
- if ($item1->get_item_type() == $item2->get_item_type()) {
- return $this->sort_by_name($item1,$item2);
- } else {
- return ($item1->get_item_type() < $item2->get_item_type() ? -1 : 1);
- }
- }
-
- /**
- * @param $item1
- * @param $item2
- * @return int
- */
- function sort_by_course($item1, $item2)
- {
- $name1 = api_strtolower($this->get_course_name_from_code_cached($item1->get_course_code()));
- $name2 = api_strtolower($this->get_course_name_from_code_cached($item2->get_course_code()));
- return api_strnatcmp($name1, $name2);
- }
-
- /**
- * @param $item1
- * @param $item2
- * @return int
- */
- function sort_by_category($item1, $item2)
- {
- $cat1 = $this->get_category_cached($item1->get_category_id());
- $cat2 = $this->get_category_cached($item2->get_category_id());
- $name1 = api_strtolower($this->get_category_name_to_display($cat1));
- $name2 = api_strtolower($this->get_category_name_to_display($cat2));
-
- return api_strnatcmp($name1, $name2);
- }
-
- /**
- * @param $item1
- * @param $item2
- * @return int
- */
- function sort_by_name($item1, $item2)
- {
- return api_strnatcmp($item1->get_name(),$item2->get_name());
- }
-
- /**
- * @param $item1
- * @param $item2
- * @return int
- */
- function sort_by_average($item1, $item2)
- {
- $score1 = $this->avgcache[$item1->get_item_type() . $item1->get_id()];
- $score2 = $this->avgcache[$item2->get_item_type() . $item2->get_id()];
-
- return $this->compare_scores($score1, $score2);
- }
-
- /**
- * @param $item1
- * @param $item2
- * @return int
- */
- function sort_by_score($item1, $item2)
- {
- $score1 = $this->scorecache[$item1->get_item_type() . $item1->get_id()];
- $score2 = $this->scorecache[$item2->get_item_type() . $item2->get_id()];
-
- return $this->compare_scores($score1, $score2);
- }
-
- /**
- * @param $item1
- * @param $item2
- * @return int
- */
- function sort_by_mask($item1, $item2)
- {
- $score1 = $this->scorecache[$item1->get_item_type() . $item1->get_id()];
- $score2 = $this->scorecache[$item2->get_item_type() . $item2->get_id()];
-
- return ScoreDisplay :: compare_scores_by_custom_display($score1, $score2);
- }
-
- /**
- * @param $score1
- * @param $score2
- * @return int
- */
- function compare_scores($score1, $score2)
- {
- if (!isset($score1)) {
- return (isset($score2) ? 1 : 0);
- } elseif (!isset($score2)) {
- return -1;
- } elseif (($score1[0]/$score1[1]) == ($score2[0]/$score2[1])) {
- return 0;
- } else {
- return (($score1[0]/$score1[1]) < ($score2[0]/$score2[1]) ? -1 : 1);
- }
- }
-
- /**
- * @param $item
- * @return mixed
- */
- private function build_course_name($item)
- {
- return $this->get_course_name_from_code_cached($item->get_course_code());
- }
-
- /**
- * @param $item
- * @return string
- */
- private function build_category_name($item)
- {
- $cat = $this->get_category_cached($item->get_category_id());
-
- return $this->get_category_name_to_display($cat);
- }
-
- /**
- * @param $item
- * @param $ignore_score_color
- * @return string
- */
- private function build_average_column($item, $ignore_score_color)
- {
- if (isset($this->avgcache)) {
- $avgscore = $this->avgcache[$item->get_item_type() . $item->get_id()];
- } else {
- $avgscore = $item->calc_score();
- }
-
- $scoredisplay = ScoreDisplay :: instance();
- $displaytype = SCORE_AVERAGE;
- /*if ($ignore_score_color)
- $displaytype |= SCORE_IGNORE_SPLIT;
+ /**
+ * Get total number of items (rows)
+ */
+ public function get_total_items_count()
+ {
+ return count($this->items);
+ }
+
+ /**
+ * Get actual array data
+ * @return array 2-dimensional array - each array contains the elements:
+ * 0: eval/link object
+ * 1: item name
+ * 2: course name
+ * 3: category name
+ * 4: average score
+ * 5: student's score
+ * 6: student's score as custom display (only if custom scoring enabled)
+ */
+ public function get_data($sorting = 0, $start = 0, $count = null, $ignore_score_color = false)
+ {
+ // do some checks on count, redefine if invalid value
+ if (!isset($count)) {
+ $count = count ($this->items) - $start;
+ }
+ if ($count < 0) {
+ $count = 0;
+ }
+ $allitems = $this->items;
+
+ // sort users array
+ if ($sorting & self :: UDG_SORT_TYPE) {
+ usort($allitems, array('UserDataGenerator', 'sort_by_type'));
+ }elseif ($sorting & self :: UDG_SORT_NAME) {
+ usort($allitems, array('UserDataGenerator', 'sort_by_name'));
+ } elseif ($sorting & self :: UDG_SORT_COURSE) {
+ usort($allitems, array('UserDataGenerator', 'sort_by_course'));
+ } elseif ($sorting & self :: UDG_SORT_CATEGORY) {
+ usort($allitems, array('UserDataGenerator', 'sort_by_category'));
+ } elseif ($sorting & self :: UDG_SORT_AVERAGE) {
+ // if user sorts on average scores, first calculate them and cache them
+ foreach ($allitems as $item) {
+ $this->avgcache[$item->get_item_type() . $item->get_id()]= $item->calc_score();
+ }
+ usort($allitems, array('UserDataGenerator', 'sort_by_average'));
+ } elseif ($sorting & self :: UDG_SORT_SCORE) {
+ // if user sorts on student's scores, first calculate them and cache them
+ foreach ($allitems as $item) {
+ $this->scorecache[$item->get_item_type() . $item->get_id()]
+ = $item->calc_score($this->userid);
+ }
+ usort($allitems, array('UserDataGenerator', 'sort_by_score'));
+ } elseif ($sorting & self :: UDG_SORT_MASK) {
+ // if user sorts on student's masks, first calculate scores and cache them
+ foreach ($allitems as $item) {
+ $this->scorecache[$item->get_item_type() . $item->get_id()]
+ = $item->calc_score($this->userid);
+ }
+ usort($allitems, array('UserDataGenerator', 'sort_by_mask'));
+ }
+
+ if ($sorting & self :: UDG_SORT_DESC) {
+ $allitems = array_reverse($allitems);
+ }
+ // select the items we have to display
+ $visibleitems = array_slice($allitems, $start, $count);
+
+ // fill score cache if not done yet
+ if (!isset ($this->scorecache)) {
+ foreach ($visibleitems as $item) {
+ $this->scorecache[$item->get_item_type() . $item->get_id()]
+ = $item->calc_score($this->userid);
+ }
+
+ }
+ // generate the data to display
+ $scoredisplay = ScoreDisplay :: instance();
+ $data = array();
+ foreach ($visibleitems as $item) {
+ $row = array ();
+ $row[] = $item;
+ $row[] = $item->get_name();
+ $row[] = $this->build_course_name($item);
+ $row[] = $this->build_category_name($item);
+ $row[] = $this->build_average_column($item, $ignore_score_color);
+ $row[] = $this->build_result_column($item, $ignore_score_color);
+ if ($scoredisplay->is_custom())
+ $row[] = $this->build_mask_column($item, $ignore_score_color);
+ $data[] = $row;
+ }
+ return $data;
+ }
+
+ /**
+ * @param $item1
+ * @param $item2
+ * @return int
+ */
+ function sort_by_type($item1, $item2)
+ {
+ if ($item1->get_item_type() == $item2->get_item_type()) {
+ return $this->sort_by_name($item1,$item2);
+ } else {
+ return ($item1->get_item_type() < $item2->get_item_type() ? -1 : 1);
+ }
+ }
+
+ /**
+ * @param $item1
+ * @param $item2
+ * @return int
+ */
+ function sort_by_course($item1, $item2)
+ {
+ $name1 = api_strtolower($this->get_course_name_from_code_cached($item1->get_course_code()));
+ $name2 = api_strtolower($this->get_course_name_from_code_cached($item2->get_course_code()));
+ return api_strnatcmp($name1, $name2);
+ }
+
+ /**
+ * @param $item1
+ * @param $item2
+ * @return int
+ */
+ function sort_by_category($item1, $item2)
+ {
+ $cat1 = $this->get_category_cached($item1->get_category_id());
+ $cat2 = $this->get_category_cached($item2->get_category_id());
+ $name1 = api_strtolower($this->get_category_name_to_display($cat1));
+ $name2 = api_strtolower($this->get_category_name_to_display($cat2));
+
+ return api_strnatcmp($name1, $name2);
+ }
+
+ /**
+ * @param $item1
+ * @param $item2
+ * @return int
+ */
+ function sort_by_name($item1, $item2)
+ {
+ return api_strnatcmp($item1->get_name(),$item2->get_name());
+ }
+
+ /**
+ * @param $item1
+ * @param $item2
+ * @return int
+ */
+ function sort_by_average($item1, $item2)
+ {
+ $score1 = $this->avgcache[$item1->get_item_type() . $item1->get_id()];
+ $score2 = $this->avgcache[$item2->get_item_type() . $item2->get_id()];
+
+ return $this->compare_scores($score1, $score2);
+ }
+
+ /**
+ * @param $item1
+ * @param $item2
+ * @return int
+ */
+ function sort_by_score($item1, $item2)
+ {
+ $score1 = $this->scorecache[$item1->get_item_type() . $item1->get_id()];
+ $score2 = $this->scorecache[$item2->get_item_type() . $item2->get_id()];
+
+ return $this->compare_scores($score1, $score2);
+ }
+
+ /**
+ * @param $item1
+ * @param $item2
+ * @return int
+ */
+ function sort_by_mask($item1, $item2)
+ {
+ $score1 = $this->scorecache[$item1->get_item_type() . $item1->get_id()];
+ $score2 = $this->scorecache[$item2->get_item_type() . $item2->get_id()];
+
+ return ScoreDisplay :: compare_scores_by_custom_display($score1, $score2);
+ }
+
+ /**
+ * @param $score1
+ * @param $score2
+ * @return int
+ */
+ function compare_scores($score1, $score2)
+ {
+ if (!isset($score1)) {
+ return (isset($score2) ? 1 : 0);
+ } elseif (!isset($score2)) {
+ return -1;
+ } elseif (($score1[0]/$score1[1]) == ($score2[0]/$score2[1])) {
+ return 0;
+ } else {
+ return (($score1[0]/$score1[1]) < ($score2[0]/$score2[1]) ? -1 : 1);
+ }
+ }
+
+ /**
+ * @param $item
+ * @return mixed
+ */
+ private function build_course_name($item)
+ {
+ return $this->get_course_name_from_code_cached($item->get_course_code());
+ }
+
+ /**
+ * @param $item
+ * @return string
+ */
+ private function build_category_name($item)
+ {
+ $cat = $this->get_category_cached($item->get_category_id());
+
+ return $this->get_category_name_to_display($cat);
+ }
+
+ /**
+ * @param $item
+ * @param $ignore_score_color
+ * @return string
+ */
+ private function build_average_column($item, $ignore_score_color)
+ {
+ if (isset($this->avgcache)) {
+ $avgscore = $this->avgcache[$item->get_item_type() . $item->get_id()];
+ } else {
+ $avgscore = $item->calc_score();
+ }
+
+ $scoredisplay = ScoreDisplay :: instance();
+ $displaytype = SCORE_AVERAGE;
+ /*if ($ignore_score_color)
+ $displaytype |= SCORE_IGNORE_SPLIT;
*/
- return $scoredisplay->display_score($avgscore, $displaytype);
- }
-
- /**
- * @param $item
- * @param $ignore_score_color
- * @return string
- */
- private function build_result_column($item, $ignore_score_color)
- {
- $studscore = $this->scorecache[$item->get_item_type() . $item->get_id()];
- $scoredisplay = ScoreDisplay :: instance();
- $displaytype = SCORE_DIV_PERCENT;
- if ($ignore_score_color) {
- $displaytype |= SCORE_IGNORE_SPLIT;
- }
-
- return $scoredisplay->display_score($studscore, $displaytype, SCORE_ONLY_DEFAULT);
- }
-
- /**
- * @param $item
- * @param $ignore_score_color
- * @return string
- */
- private function build_mask_column($item, $ignore_score_color)
- {
- $studscore = $this->scorecache[$item->get_item_type() . $item->get_id()];
- $scoredisplay = ScoreDisplay :: instance();
- $displaytype = SCORE_DIV_PERCENT;
- if ($ignore_score_color) {
- $displaytype |= SCORE_IGNORE_SPLIT;
- }
- return $scoredisplay->display_score($studscore, $displaytype, SCORE_ONLY_CUSTOM);
- }
-
- /**
- * @param $coursecode
- * @return mixed
- */
- private function get_course_name_from_code_cached($coursecode)
- {
- if (isset ($this->coursecodecache)
- && isset ($this->coursecodecache[$coursecode])) {
- return $this->coursecodecache[$coursecode];
- } else {
- $name = CourseManager::getCourseNameFromCode($coursecode);
- $this->coursecodecache[$coursecode] = $name;
- return $name;
- }
- }
-
- /**
- * @param $category_id
- * @return null
- */
- private function get_category_cached($category_id)
- {
- if (isset ($this->categorycache)
- && isset ($this->categorycache[$category_id])) {
- return $this->categorycache[$category_id];
- }else {
- $cat = Category::load($category_id);
- if (isset($cat)){
- $this->categorycache[$category_id] = $cat[0];
- return $cat[0];
- }else
- return null;
- }
- }
-
- /**
- * @param $cat
- * @return string
- */
- private function get_category_name_to_display($cat)
- {
- if (isset($cat)) {
- if ($cat->get_parent_id() == '0' || $cat->get_parent_id() == null){
- return '';
- } else {
- return $cat->get_name();
- }
- } else {
- return '';
- }
- }
+ return $scoredisplay->display_score($avgscore, $displaytype);
+ }
+
+ /**
+ * @param $item
+ * @param $ignore_score_color
+ * @return string
+ */
+ private function build_result_column($item, $ignore_score_color)
+ {
+ $studscore = $this->scorecache[$item->get_item_type() . $item->get_id()];
+ $scoredisplay = ScoreDisplay :: instance();
+ $displaytype = SCORE_DIV_PERCENT;
+ if ($ignore_score_color) {
+ $displaytype |= SCORE_IGNORE_SPLIT;
+ }
+
+ return $scoredisplay->display_score($studscore, $displaytype, SCORE_ONLY_DEFAULT);
+ }
+
+ /**
+ * @param $item
+ * @param $ignore_score_color
+ * @return string
+ */
+ private function build_mask_column($item, $ignore_score_color)
+ {
+ $studscore = $this->scorecache[$item->get_item_type() . $item->get_id()];
+ $scoredisplay = ScoreDisplay :: instance();
+ $displaytype = SCORE_DIV_PERCENT;
+ if ($ignore_score_color) {
+ $displaytype |= SCORE_IGNORE_SPLIT;
+ }
+ return $scoredisplay->display_score($studscore, $displaytype, SCORE_ONLY_CUSTOM);
+ }
+
+ /**
+ * @param $coursecode
+ * @return mixed
+ */
+ private function get_course_name_from_code_cached($coursecode)
+ {
+ if (isset ($this->coursecodecache) && isset ($this->coursecodecache[$coursecode])) {
+ return $this->coursecodecache[$coursecode];
+ } else {
+ $name = CourseManager::getCourseNameFromCode($coursecode);
+ $this->coursecodecache[$coursecode] = $name;
+ return $name;
+ }
+ }
+
+ /**
+ * @param $category_id
+ * @return null
+ */
+ private function get_category_cached($category_id)
+ {
+ if (isset ($this->categorycache) && isset ($this->categorycache[$category_id])) {
+ return $this->categorycache[$category_id];
+ } else {
+ $cat = Category::load($category_id);
+ if (isset($cat)) {
+ $this->categorycache[$category_id] = $cat[0];
+
+ return $cat[0];
+ } else {
+ return null;
+ }
+ }
+ }
+
+ /**
+ * @param $cat
+ * @return string
+ */
+ private function get_category_name_to_display($cat)
+ {
+ if (isset($cat)) {
+ if ($cat->get_parent_id() == '0' || $cat->get_parent_id() == null) {
+ return '';
+ } else {
+ return $cat->get_name();
+ }
+ } else {
+ return '';
+ }
+ }
}
diff --git a/main/gradebook/user_stats.php b/main/gradebook/user_stats.php
index 6c4818686e..6237ac39eb 100755
--- a/main/gradebook/user_stats.php
+++ b/main/gradebook/user_stats.php
@@ -115,6 +115,6 @@ $actions.='';
Display :: display_header(get_lang('ResultsPerUser'));
echo $actions;
-DisplayGradebook :: display_header_user($_GET['userid']);
+DisplayGradebook :: display_header_user($_GET['userid'], $category[0]->get_id());
$user_table->display();
Display :: display_footer();
diff --git a/main/group/group.php b/main/group/group.php
index 9812ce7820..9107cfbf6f 100755
--- a/main/group/group.php
+++ b/main/group/group.php
@@ -94,7 +94,6 @@ if (isset($_GET['action']) && $is_allowed_in_course) {
*/
if (api_is_allowed_to_edit(false, true)) {
-
// Post-actions
if (isset($_POST['action'])) {
switch ($_POST['action']) {
@@ -165,7 +164,6 @@ Display::display_introduction_section(TOOL_GROUP);
$actionsLeft = '';
if (api_is_allowed_to_edit(false, true)) {
-
$actionsLeft .= ''.
Display::return_icon('add-groups.png', get_lang('NewGroupCreate'), '', ICON_SIZE_MEDIUM).'';
diff --git a/main/group/group_category.php b/main/group/group_category.php
index ac46375f74..c7c8fe3265 100755
--- a/main/group/group_category.php
+++ b/main/group/group_category.php
@@ -188,7 +188,8 @@ $form->addGroup(
'',
Display::return_icon('work.png', get_lang('GroupWork'), array(), ICON_SIZE_SMALL) . ' ' . get_lang('GroupWork'),
'',
- false);
+ false
+);
// Calendar settings.
$group = array(
@@ -275,17 +276,17 @@ $currentUrl = api_get_path(WEB_CODE_PATH).'group/group.php?'.api_get_cidreq();
if ($form->validate()) {
$values = $form->exportValues();
if ($values['max_member_no_limit'] == GroupManager::MEMBER_PER_GROUP_NO_LIMIT) {
- $max_member = GroupManager::MEMBER_PER_GROUP_NO_LIMIT;
- } else {
- $max_member = $values['max_member'];
- }
+ $max_member = GroupManager::MEMBER_PER_GROUP_NO_LIMIT;
+ } else {
+ $max_member = $values['max_member'];
+ }
- $self_reg_allowed = isset($values['self_reg_allowed']) ? $values['self_reg_allowed'] : 0;
- $self_unreg_allowed = isset($values['self_unreg_allowed']) ? $values['self_unreg_allowed'] : 0;
+ $self_reg_allowed = isset($values['self_reg_allowed']) ? $values['self_reg_allowed'] : 0;
+ $self_unreg_allowed = isset($values['self_unreg_allowed']) ? $values['self_unreg_allowed'] : 0;
- switch ($values['action']) {
- case 'update_settings':
- GroupManager::update_category(
+ switch ($values['action']) {
+ case 'update_settings':
+ GroupManager::update_category(
$values['id'],
$values['title'],
$values['description'],
@@ -304,8 +305,8 @@ if ($form->validate()) {
Display::addFlash(Display::return_message(get_lang('GroupPropertiesModified')));
header("Location: ".$currentUrl."&category=".$values['id']);
exit;
- case 'add_category':
- GroupManager :: create_category(
+ case 'add_category':
+ GroupManager :: create_category(
$values['title'],
$values['description'],
$values['doc_state'],
@@ -323,8 +324,8 @@ if ($form->validate()) {
Display::addFlash(Display::return_message(get_lang('CategoryCreated')));
header("Location: ".$currentUrl);
exit;
- break;
- }
+ break;
+ }
}
// Else display the form
@@ -339,10 +340,10 @@ echo '';
$defaults = $category;
$defaults['action'] = $action;
if ($defaults['max_student'] == GroupManager::MEMBER_PER_GROUP_NO_LIMIT) {
- $defaults['max_member_no_limit'] = GroupManager::MEMBER_PER_GROUP_NO_LIMIT;
+ $defaults['max_member_no_limit'] = GroupManager::MEMBER_PER_GROUP_NO_LIMIT;
} else {
- $defaults['max_member_no_limit'] = 1;
- $defaults['max_member'] = $defaults['max_student'];
+ $defaults['max_member_no_limit'] = 1;
+ $defaults['max_member'] = $defaults['max_student'];
}
$form->setDefaults($defaults);
$form->display();
diff --git a/main/group/group_creation.php b/main/group/group_creation.php
index e8b6ed536f..c20c64ee18 100755
--- a/main/group/group_creation.php
+++ b/main/group/group_creation.php
@@ -52,10 +52,10 @@ if (isset($_POST['action'])) {
exit;
break;
case 'create_subgroups':
- GroupManager::create_subgroups(
- $_POST['base_group'],
- $_POST['number_of_groups']
- );
+ GroupManager::create_subgroups(
+ $_POST['base_group'],
+ $_POST['number_of_groups']
+ );
Display::addFlash(Display::return_message(get_lang('GroupsAdded')));
header("Location: ".$currentUrl);
exit;
@@ -146,25 +146,25 @@ if (isset($_POST['number_of_groups'])) {
EOT;
- $renderer->setCustomElementTemplate($element_template);
+ $renderer->setCustomElementTemplate($element_template);
$form->addElement('header', $nameTools);
- $form->addElement('hidden', 'action');
- $form->addElement('hidden', 'number_of_groups');
- $defaults = array();
- // Table heading
- $group_el = array();
- $group_el[] = $form->createElement('static', null, null, ''.get_lang('GroupName').'');
+ $form->addElement('hidden', 'action');
+ $form->addElement('hidden', 'number_of_groups');
+ $defaults = array();
+ // Table heading
+ $group_el = array();
+ $group_el[] = $form->createElement('static', null, null, ''.get_lang('GroupName').'');
- if (api_get_setting('allow_group_categories') === 'true') {
- $group_el[] = $form->createElement('static', null, null, ''.get_lang('GroupCategory').'');
- }
- $group_el[] = $form->createElement('static', null, null, ''.get_lang('GroupPlacesThis').'');
- $form->addGroup($group_el, 'groups', null, "", false);
- // Checkboxes
- if ($_POST['number_of_groups'] > 1) {
- $group_el = array ();
- $group_el[] = $form->createElement('static', null, null, ' ');
- if (api_get_setting('allow_group_categories') === 'true') {
+ if (api_get_setting('allow_group_categories') === 'true') {
+ $group_el[] = $form->createElement('static', null, null, ''.get_lang('GroupCategory').'');
+ }
+ $group_el[] = $form->createElement('static', null, null, ''.get_lang('GroupPlacesThis').'');
+ $form->addGroup($group_el, 'groups', null, " | ", false);
+ // Checkboxes
+ if ($_POST['number_of_groups'] > 1) {
+ $group_el = array ();
+ $group_el[] = $form->createElement('static', null, null, ' ');
+ if (api_get_setting('allow_group_categories') === 'true') {
$group_el[] = $form->createElement(
'checkbox',
'same_category',
@@ -172,7 +172,7 @@ EOT;
get_lang('SameForAll'),
array('onclick' => "javascript: switch_state('category');")
);
- }
+ }
$group_el[] = $form->createElement(
'checkbox',
'same_places',
@@ -180,13 +180,13 @@ EOT;
get_lang('SameForAll'),
array('onclick' => "javascript: switch_state('places');")
);
- $form->addGroup($group_el, 'groups', null, ' | ', false);
- }
- // Properties for all groups
- for ($group_number = 0; $group_number < $_POST['number_of_groups']; $group_number ++) {
- $group_el = array();
- $group_el[] = $form->createElement('text', 'group_'.$group_number.'_name');
- if (api_get_setting('allow_group_categories') === 'true') {
+ $form->addGroup($group_el, 'groups', null, ' | ', false);
+ }
+ // Properties for all groups
+ for ($group_number = 0; $group_number < $_POST['number_of_groups']; $group_number ++) {
+ $group_el = array();
+ $group_el[] = $form->createElement('text', 'group_'.$group_number.'_name');
+ if (api_get_setting('allow_group_categories') === 'true') {
$group_el[] = $form->createElement(
'select',
'group_'.$group_number.'_category',
@@ -194,7 +194,7 @@ EOT;
$cat_options,
array('id' => 'category_'.$group_number)
);
- } else {
+ } else {
$group_el[] = $form->createElement('hidden', 'group_'.$group_number.'_category', 0);
$defaults['group_'.$group_number.'_category'] = array_keys($cat_options)[0];
}
@@ -205,110 +205,110 @@ EOT;
array('class' => 'span1', 'id' => 'places_'.$group_number)
);
- if ($_POST['number_of_groups'] < 10000) {
- if ($group_id < 10) {
- $prev = '000';
- } elseif ($group_id < 100) {
- $prev = '00';
- } elseif ($group_id<1000) {
- $prev = '0';
- } else {
- $prev = '';
- }
- }
+ if ($_POST['number_of_groups'] < 10000) {
+ if ($group_id < 10) {
+ $prev = '000';
+ } elseif ($group_id < 100) {
+ $prev = '00';
+ } elseif ($group_id<1000) {
+ $prev = '0';
+ } else {
+ $prev = '';
+ }
+ }
- $defaults['group_'.$group_number.'_name'] = get_lang('GroupSingle').' '.$prev.$group_id ++;
- $form->addGroup($group_el, 'group_'.$group_number, null, ' | ', false);
- }
- $defaults['action'] = 'create_groups';
- $defaults['number_of_groups'] = intval($_POST['number_of_groups']);
- $form->setDefaults($defaults);
- $form->addButtonCreate(get_lang('CreateGroup'), 'submit');
+ $defaults['group_'.$group_number.'_name'] = get_lang('GroupSingle').' '.$prev.$group_id ++;
+ $form->addGroup($group_el, 'group_'.$group_number, null, ' | ', false);
+ }
+ $defaults['action'] = 'create_groups';
+ $defaults['number_of_groups'] = intval($_POST['number_of_groups']);
+ $form->setDefaults($defaults);
+ $form->addButtonCreate(get_lang('CreateGroup'), 'submit');
$form->display();
}
} else {
- /*
- * Show form to generate new groups
- */
- $create_groups_form = new FormValidator('create_groups', 'post', api_get_self().'?'.api_get_cidreq());
- $create_groups_form->addElement('header', $nameTools);
+ /*
+ * Show form to generate new groups
+ */
+ $create_groups_form = new FormValidator('create_groups', 'post', api_get_self().'?'.api_get_cidreq());
+ $create_groups_form->addElement('header', $nameTools);
$create_groups_form->addText('number_of_groups',get_lang('NumberOfGroupsToCreate'),null,array('value'=>'1'));
$create_groups_form->addButton('submit', get_lang('ProceedToCreateGroup'),'plus','primary');
- $defaults = array();
- $defaults['number_of_groups'] = 1;
- $create_groups_form->setDefaults($defaults);
- $create_groups_form->display();
+ $defaults = array();
+ $defaults['number_of_groups'] = 1;
+ $create_groups_form->setDefaults($defaults);
+ $create_groups_form->display();
- /*
- * Show form to generate subgroups
- */
- if (api_get_setting('allow_group_categories') === 'true' && count(GroupManager :: get_group_list()) > 0) {
- $base_group_options = array ();
- $groups = GroupManager :: get_group_list();
- foreach ($groups as $index => $group) {
- $number_of_students = GroupManager :: number_of_students($group['id']);
- if ($number_of_students > 0) {
- $base_group_options[$group['id']] = $group['name'].' ('.$number_of_students.' '.get_lang('Users').')';
- }
- }
- if (count($base_group_options) > 0) {
- $create_subgroups_form = new FormValidator('create_subgroups', 'post', api_get_self().'?'.api_get_cidreq());
+ /*
+ * Show form to generate subgroups
+ */
+ if (api_get_setting('allow_group_categories') === 'true' && count(GroupManager :: get_group_list()) > 0) {
+ $base_group_options = array ();
+ $groups = GroupManager :: get_group_list();
+ foreach ($groups as $index => $group) {
+ $number_of_students = GroupManager :: number_of_students($group['id']);
+ if ($number_of_students > 0) {
+ $base_group_options[$group['id']] = $group['name'].' ('.$number_of_students.' '.get_lang('Users').')';
+ }
+ }
+ if (count($base_group_options) > 0) {
+ $create_subgroups_form = new FormValidator('create_subgroups', 'post', api_get_self().'?'.api_get_cidreq());
$create_subgroups_form->addElement('header', get_lang('CreateSubgroups'));
$create_subgroups_form->addElement('html', get_lang('CreateSubgroupsInfo'));
- $create_subgroups_form->addElement('hidden', 'action');
- $group_el = array();
- $group_el[] = $create_subgroups_form->createElement('static', null, null, get_lang('CreateNumberOfGroups'));
- $group_el[] = $create_subgroups_form->createElement('text', 'number_of_groups', null, array('size' => 3));
- $group_el[] = $create_subgroups_form->createElement('static', null, null, get_lang('WithUsersFrom'));
- $group_el[] = $create_subgroups_form->createElement('select', 'base_group', null, $base_group_options);
- $group_el[] = $create_subgroups_form->createElement('button', 'submit', get_lang('Ok'));
- $create_subgroups_form->addGroup($group_el, 'create_groups', null, null, false);
- $defaults = array();
- $defaults['action'] = 'create_subgroups';
- $create_subgroups_form->setDefaults($defaults);
- $create_subgroups_form->display();
- }
- }
+ $create_subgroups_form->addElement('hidden', 'action');
+ $group_el = array();
+ $group_el[] = $create_subgroups_form->createElement('static', null, null, get_lang('CreateNumberOfGroups'));
+ $group_el[] = $create_subgroups_form->createElement('text', 'number_of_groups', null, array('size' => 3));
+ $group_el[] = $create_subgroups_form->createElement('static', null, null, get_lang('WithUsersFrom'));
+ $group_el[] = $create_subgroups_form->createElement('select', 'base_group', null, $base_group_options);
+ $group_el[] = $create_subgroups_form->createElement('button', 'submit', get_lang('Ok'));
+ $create_subgroups_form->addGroup($group_el, 'create_groups', null, null, false);
+ $defaults = array();
+ $defaults['action'] = 'create_subgroups';
+ $create_subgroups_form->setDefaults($defaults);
+ $create_subgroups_form->display();
+ }
+ }
- /*
- * Show form to generate groups from classes subscribed to the course
- */
+ /*
+ * Show form to generate groups from classes subscribed to the course
+ */
$options['where'] = array(" usergroup.course_id = ? " => api_get_course_int_id());
$obj = new UserGroup();
$classes = $obj->getUserGroupInCourse($options);
- if (count($classes) > 0) {
- echo ''.get_lang('GroupsFromClasses').'';
- echo '';
- echo ''.get_lang('GroupsFromClassesInfo').' ';
- echo '';
- foreach ($classes as $index => $class) {
- $number_of_users = count($obj->get_users_by_usergroup($class['id']));
- echo '- ';
- echo $class['name'];
- echo ' ('.$number_of_users.' '.get_lang('Users').')';
- echo '
';
- }
- echo ' ';
+ if (count($classes) > 0) {
+ echo ''.get_lang('GroupsFromClasses').'';
+ echo '';
+ echo ''.get_lang('GroupsFromClassesInfo').' ';
+ echo '';
+ foreach ($classes as $index => $class) {
+ $number_of_users = count($obj->get_users_by_usergroup($class['id']));
+ echo '- ';
+ echo $class['name'];
+ echo ' ('.$number_of_users.' '.get_lang('Users').')';
+ echo '
';
+ }
+ echo ' ';
- $create_class_groups_form = new FormValidator('create_class_groups_form', 'post', api_get_self().'?'.api_get_cidreq());
- $create_class_groups_form->addElement('hidden', 'action');
- if (api_get_setting('allow_group_categories') === 'true') {
- $group_categories = GroupManager :: get_categories();
- $cat_options = array();
- foreach ($group_categories as $index => $category) {
- $cat_options[$category['id']] = $category['title'];
- }
- $create_class_groups_form->addElement('select', 'group_category', null, $cat_options);
- } else {
- $create_class_groups_form->addElement('hidden', 'group_category');
- }
- $create_class_groups_form->addElement('submit', 'submit', get_lang('Ok'));
- $defaults['group_category'] = GroupManager::DEFAULT_GROUP_CATEGORY;
- $defaults['action'] = 'create_class_groups';
- $create_class_groups_form->setDefaults($defaults);
- $create_class_groups_form->display();
- echo ' ';
- }
+ $create_class_groups_form = new FormValidator('create_class_groups_form', 'post', api_get_self().'?'.api_get_cidreq());
+ $create_class_groups_form->addElement('hidden', 'action');
+ if (api_get_setting('allow_group_categories') === 'true') {
+ $group_categories = GroupManager :: get_categories();
+ $cat_options = array();
+ foreach ($group_categories as $index => $category) {
+ $cat_options[$category['id']] = $category['title'];
+ }
+ $create_class_groups_form->addElement('select', 'group_category', null, $cat_options);
+ } else {
+ $create_class_groups_form->addElement('hidden', 'group_category');
+ }
+ $create_class_groups_form->addElement('submit', 'submit', get_lang('Ok'));
+ $defaults['group_category'] = GroupManager::DEFAULT_GROUP_CATEGORY;
+ $defaults['action'] = 'create_class_groups';
+ $create_class_groups_form->setDefaults($defaults);
+ $create_class_groups_form->display();
+ echo ' ';
+ }
}
Display :: display_footer();
diff --git a/main/group/group_overview.php b/main/group/group_overview.php
index a481d6c1a7..4e5f60cbc7 100755
--- a/main/group/group_overview.php
+++ b/main/group/group_overview.php
@@ -84,31 +84,31 @@ if (!isset ($_GET['origin']) || $_GET['origin'] != 'learnpath') {
$actions = ''.
Display::return_icon('add.png', get_lang('NewGroupCreate'), '', ICON_SIZE_MEDIUM).'';
- if (api_get_setting('allow_group_categories') === 'true') {
- $actions.= ''.
- Display::return_icon('new_folder.png', get_lang('AddCategory'), '', ICON_SIZE_MEDIUM).'';
- } else {
- $actions.= ''.
- Display::return_icon('settings.png', get_lang('PropModify'), '', ICON_SIZE_MEDIUM).'';
- }
- $actions.= ''.
- Display::return_icon('import_csv.png', get_lang('Import'), '', ICON_SIZE_MEDIUM).'';
+if (api_get_setting('allow_group_categories') === 'true') {
+ $actions.= ''.
+ Display::return_icon('new_folder.png', get_lang('AddCategory'), '', ICON_SIZE_MEDIUM).'';
+} else {
+ $actions.= ''.
+ Display::return_icon('settings.png', get_lang('PropModify'), '', ICON_SIZE_MEDIUM).'';
+}
+$actions.= ''.
+ Display::return_icon('import_csv.png', get_lang('Import'), '', ICON_SIZE_MEDIUM).'';
- $actions.= ''.
- Display::return_icon('export_csv.png', get_lang('Export'), '', ICON_SIZE_MEDIUM).'';
+$actions.= ''.
+ Display::return_icon('export_csv.png', get_lang('Export'), '', ICON_SIZE_MEDIUM).'';
- $actions.= ''.
- Display::return_icon('export_excel.png', get_lang('ExportAsXLS'), '', ICON_SIZE_MEDIUM).'';
+$actions.= ''.
+Display::return_icon('export_excel.png', get_lang('ExportAsXLS'), '', ICON_SIZE_MEDIUM).'';
- $actions.= ''.
- Display::return_icon('pdf.png', get_lang('ExportToPDF'), '', ICON_SIZE_MEDIUM).'';
+$actions.= ''.
+ Display::return_icon('pdf.png', get_lang('ExportToPDF'), '', ICON_SIZE_MEDIUM).'';
- $actions.= ''.
- Display::return_icon('group.png', get_lang('Groups'),'',ICON_SIZE_MEDIUM).'';
+$actions.= ''.
+ Display::return_icon('group.png', get_lang('Groups'),'',ICON_SIZE_MEDIUM).'';
- $actions.= ''.
- Display::return_icon('user.png', get_lang('GoTo').' '.get_lang('Users'), '', ICON_SIZE_MEDIUM).'';
+$actions.= ''.
+Display::return_icon('user.png', get_lang('GoTo').' '.get_lang('Users'), '', ICON_SIZE_MEDIUM).'';
// Action links
echo '';
diff --git a/main/group/group_space.php b/main/group/group_space.php
index 21c8e70288..d7a4025682 100755
--- a/main/group/group_space.php
+++ b/main/group/group_space.php
@@ -422,7 +422,7 @@ function get_group_user_data($from, $number_of_items, $column, $direction)
$course_id = api_get_course_int_id();
// Query
- if (api_get_setting('show_email_addresses') == 'true') {
+ if (api_get_setting('show_email_addresses') === 'true') {
$sql = "SELECT user.id AS col0,
".(api_is_western_name_order() ?
"user.firstname AS col1,
@@ -443,21 +443,20 @@ function get_group_user_data($from, $number_of_items, $column, $direction)
} else {
if (api_is_allowed_to_edit()) {
$sql = "SELECT DISTINCT
- u.id AS col0,
- ".(api_is_western_name_order() ?
- "u.firstname AS col1,
- u.lastname AS col2,"
- :
- "u.lastname AS col1,
- u.firstname AS col2,"
- )."
- u.email AS col3
- FROM $table_user u
- INNER JOIN $table_group_user gu
- ON (gu.user_id = u.id) AND gu.c_id = $course_id
- WHERE gu.group_id = '".Database::escape_string($current_group['id'])."'
- ORDER BY col$column $direction
- LIMIT $from, $number_of_items";
+ u.id AS col0,
+ ".(api_is_western_name_order() ?
+ "u.firstname AS col1,
+ u.lastname AS col2,"
+ :
+ "u.lastname AS col1,
+ u.firstname AS col2,")."
+ u.email AS col3
+ FROM $table_user u
+ INNER JOIN $table_group_user gu
+ ON (gu.user_id = u.id) AND gu.c_id = $course_id
+ WHERE gu.group_id = '".Database::escape_string($current_group['id'])."'
+ ORDER BY col$column $direction
+ LIMIT $from, $number_of_items";
} else {
$sql = "SELECT DISTINCT
user.id AS col0,
@@ -467,14 +466,14 @@ function get_group_user_data($from, $number_of_items, $column, $direction)
:
"user.lastname AS col1,
user.firstname AS col2 "
- )."
- FROM $table_user user, $table_group_user group_rel_user
- WHERE
- group_rel_user.c_id = $course_id AND
- group_rel_user.user_id = user.id AND
- group_rel_user.group_id = '".Database::escape_string($current_group['id'])."'
- ORDER BY col$column $direction
- LIMIT $from,$number_of_items";
+ )."
+ FROM $table_user user, $table_group_user group_rel_user
+ WHERE
+ group_rel_user.c_id = $course_id AND
+ group_rel_user.user_id = user.id AND
+ group_rel_user.group_id = '".Database::escape_string($current_group['id'])."'
+ ORDER BY col$column $direction
+ LIMIT $from,$number_of_items";
}
}
diff --git a/main/group/member_settings.php b/main/group/member_settings.php
index 5fd9b66ddb..5a19e80eec 100755
--- a/main/group/member_settings.php
+++ b/main/group/member_settings.php
@@ -152,7 +152,7 @@ if (!empty($complete_user_list)) {
if ($orderUserListByOfficialCode === 'true') {
$officialCode = !empty($user['official_code']) ? $user['official_code']." - " : '? - ';
- $name = $officialCode." ".api_get_person_name($user['firstname'], $user['lastname']).' ('.$user['username'].')';
+ $name = $officialCode.' '.api_get_person_name($user['firstname'], $user['lastname']).' ('.$user['username'].')';
}
$possible_users[$user['user_id']] = $name.$groupNameListToString;
}
diff --git a/main/group/tutor_settings.php b/main/group/tutor_settings.php
index 1dff16728d..81ddf24624 100755
--- a/main/group/tutor_settings.php
+++ b/main/group/tutor_settings.php
@@ -19,13 +19,13 @@ $current_course_tool = TOOL_GROUP;
api_protect_course_script(true);
$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');
$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']);
-$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);
if (!api_is_allowed_to_edit(false, true) && !$is_group_member) {
api_not_allowed(true);
@@ -97,9 +97,6 @@ function sort_users($user_a, $user_b)
}
}
-
-/* MAIN CODE */
-
$htmlHeadXtra[] = ' | |