diff --git a/main/gradebook/gradebook_flatview.php b/main/gradebook/gradebook_flatview.php
index 37e4698ad1..f206b7b9b0 100755
--- a/main/gradebook/gradebook_flatview.php
+++ b/main/gradebook/gradebook_flatview.php
@@ -4,9 +4,6 @@
* Script
* @package chamilo.gradebook
*/
-/**
- * Init
- */
$language_file = 'gradebook';
require_once '../inc/global.inc.php';
@@ -14,7 +11,7 @@ $current_course_tool = TOOL_GRADEBOOK;
api_protect_course_script();
-require_once 'lib/be.inc.php';
+require_once 'lib/be.inc.php';
require_once 'lib/fe/dataform.class.php';
require_once 'lib/fe/userform.class.php';
require_once 'lib/flatview_data_generator.class.php';
@@ -84,10 +81,10 @@ if ($simple_search_form->validate() && (empty($keyword))) {
if (!empty($keyword)) {
$users = find_students($keyword);
-
+
} else {
if (isset($alleval) && isset($alllinks)) {
- $users = get_all_users($alleval, $alllinks);
+ $users = get_all_users($alleval, $alllinks);
} else {
$users = null;
}
@@ -97,36 +94,42 @@ $offset = isset($_GET['offset']) ? $_GET['offset'] : '0';
$flatviewtable = new FlatViewTable($cat[0], $users, $alleval, $alllinks, true, $offset, $addparams);
-$parameters=array('selectcat'=>intval($_GET['selectcat']));
+$parameters = array('selectcat' => intval($_GET['selectcat']));
$flatviewtable->set_additional_parameters($parameters);
-if (isset($_GET['export_pdf']) && $_GET['export_pdf'] == 'category') {
- $params = array();
+$params = array();
+if (isset($_GET['export_pdf']) && $_GET['export_pdf'] == 'category') {
$params['only_total_category'] = true;
$params['join_firstname_lastname'] = true;
$params['show_official_code'] = true;
- $params['export_pdf'] = true;
+ $params['export_pdf'] = true;
if ($cat[0]->is_locked() == true || api_is_platform_admin()) {
Display :: set_header(null, false, false);
export_pdf_flatview($cat, $users, $alleval, $alllinks, $params);
}
}
-
+
if (isset($_GET['exportpdf'])) {
$interbreadcrumb[] = array (
'url' => api_get_self().'?selectcat=' . Security::remove_XSS($_GET['selectcat']),
'name' => get_lang('FlatView')
);
-
- $export_pdf_form = new DataForm(DataForm::TYPE_EXPORT_PDF, 'export_pdf_form', null, api_get_self().'?exportpdf=&offset='.intval($_GET['offset']).'&selectcat='.intval($_GET['selectcat']), '_blank', '');
- if ($export_pdf_form->validate()) {
- $params = array();
+ $export_pdf_form = new DataForm(
+ DataForm::TYPE_EXPORT_PDF,
+ 'export_pdf_form',
+ null,
+ api_get_self() . '?exportpdf=&offset=' . intval($_GET['offset']) . '&selectcat=' . intval($_GET['selectcat']),
+ '_blank',
+ ''
+ );
+
+ if ($export_pdf_form->validate()) {
$params = $export_pdf_form->exportValues();
Display :: set_header(null, false, false);
- $params['join_firstname_lastname'] = true;
+ $params['join_firstname_lastname'] = true;
$params['show_official_code'] = true;
- $params['export_pdf'] = true;
+ $params['export_pdf'] = true;
$params['only_total_category'] = false;
export_pdf_flatview($cat, $users, $alleval, $alllinks, $params);
} else {
@@ -135,78 +138,77 @@ if (isset($_GET['exportpdf'])) {
}
if (isset ($_GET['print'])) {
- $printable_data = get_printable_data($cat[0], $users, $alleval, $alllinks);
+ $printable_data = get_printable_data($cat[0], $users, $alleval, $alllinks, $params);
echo print_table($printable_data[1],$printable_data[0], get_lang('FlatView'), $cat[0]->get_name());
exit;
-}
-
-if (!empty($_GET['export_report']) && $_GET['export_report'] == 'export_report') {
- if (api_is_platform_admin() || api_is_course_admin() || api_is_course_coach()) {
- $user_id = null;
-
- if (empty($_SESSION['export_user_fields'])) {
- $_SESSION['export_user_fields'] = false;
- }
- if (!api_is_allowed_to_edit(false, false) and !api_is_course_tutor()) {
- $user_id = api_get_user_id();
- }
-
- require_once 'gradebook_result.class.php';
- $printable_data = get_printable_data($cat[0], $users, $alleval, $alllinks);
-
- switch($_GET['export_format']) {
- case 'xls':
- $export = new GradeBookResult();
- $export->exportCompleteReportXLS($printable_data);
- break;
- case 'doc':
- $export = new GradeBookResult();
- $export->exportCompleteReportDOC($printable_data);
+}
+
+if (!empty($_GET['export_report']) && $_GET['export_report'] == 'export_report') {
+ if (api_is_platform_admin() || api_is_course_admin() || api_is_course_coach()) {
+ $user_id = null;
+
+ if (empty($_SESSION['export_user_fields'])) {
+ $_SESSION['export_user_fields'] = false;
+ }
+ if (!api_is_allowed_to_edit(false, false) and !api_is_course_tutor()) {
+ $user_id = api_get_user_id();
+ }
+
+ require_once 'gradebook_result.class.php';
+ $printable_data = get_printable_data($cat[0], $users, $alleval, $alllinks, $params);
+
+ switch ($_GET['export_format']) {
+ case 'xls':
+ $export = new GradeBookResult();
+ $export->exportCompleteReportXLS($printable_data);
+ break;
+ case 'doc':
+ $export = new GradeBookResult();
+ $export->exportCompleteReportDOC($printable_data);
exit;
- break;
- case 'csv':
- default:
- $export = new GradeBookResult();
- $export->exportCompleteReportCSV($printable_data);
- exit;
- break;
- }
- } else {
- api_not_allowed(true);
- }
+ break;
+ case 'csv':
+ default:
+ $export = new GradeBookResult();
+ $export->exportCompleteReportCSV($printable_data);
+ exit;
+ break;
+ }
+ } else {
+ api_not_allowed(true);
+ }
}
$addparams = array ('selectcat' => $cat[0]->get_id());
if (isset($_GET['search'])) {
- $addparams['search'] = $keyword;
+ $addparams['search'] = $keyword;
}
-
$this_section = SECTION_COURSES;
-if (isset($_GET['exportpdf'])) {
- $export_pdf_form->display();
+if (isset($_GET['exportpdf'])) {
+ $export_pdf_form->display();
} else {
- Display :: display_header(get_lang('FlatView'));
+ Display :: display_header(get_lang('FlatView'));
}
if (isset($_GET['isStudentView']) && $_GET['isStudentView'] == 'false') {
- DisplayGradebook :: display_header_reduce_flatview($cat[0], $showeval, $showlink, $simple_search_form);
- $flatviewtable->display();
+ DisplayGradebook :: display_header_reduce_flatview($cat[0], $showeval, $showlink, $simple_search_form);
+ $flatviewtable->display();
} elseif (isset($_GET['selectcat']) && ($_SESSION['studentview'] == 'teacherview')) {
- DisplayGradebook :: display_header_reduce_flatview($cat[0], $showeval, $showlink, $simple_search_form);
-
- // main graph
- $flatviewtable->display();
- // @todo this needs a fix
- //$image_file = $flatviewtable->display_graph();
- //@todo load images with jquery
- echo '
';
- if (!empty($image_file)) {
- echo '

';
- }
- $flatviewtable->display_graph_by_resource();
- echo '
';
+ DisplayGradebook :: display_header_reduce_flatview($cat[0], $showeval, $showlink, $simple_search_form);
+
+ // main graph
+ $flatviewtable->display();
+ // @todo this needs a fix
+ //$image_file = $flatviewtable->display_graph();
+ //@todo load images with jquery
+ echo '';
+ if (!empty($image_file)) {
+ echo '

';
+ }
+ $flatviewtable->display_graph_by_resource();
+ echo '
';
}
Display :: display_footer();
diff --git a/main/gradebook/lib/fe/flatviewtable.class.php b/main/gradebook/lib/fe/flatviewtable.class.php
index 24340a77b0..9aaab91bba 100755
--- a/main/gradebook/lib/fe/flatviewtable.class.php
+++ b/main/gradebook/lib/fe/flatviewtable.class.php
@@ -1,18 +1,12 @@
selectcat = $selectcat;
$this->datagen = new FlatViewDataGenerator($users, $evals, $links, array('only_subcat' => $this->selectcat->get_id()));
@@ -47,9 +47,9 @@ class FlatViewTable extends SortableTable
}
/**
- * Display the graph of the total results of all students
- * */
- function display_graph()
+ * Display the graph of the total results of all students
+ * */
+ public function display_graph()
{
include_once api_get_path(LIBRARY_PATH) . 'pchart/pData.class.php';
include_once api_get_path(LIBRARY_PATH) . 'pchart/pChart.class.php';
@@ -163,7 +163,10 @@ class FlatViewTable extends SortableTable
return api_get_path(WEB_ARCHIVE_PATH) . $img_file;
}
- function display_graph_by_resource()
+ /**
+ *
+ */
+ public function display_graph_by_resource()
{
require_once api_get_path(LIBRARY_PATH) . 'pchart/pData.class.php';
require_once api_get_path(LIBRARY_PATH) . 'pchart/pChart.class.php';
@@ -186,7 +189,7 @@ class FlatViewTable extends SortableTable
$user_results = $this->datagen->get_data_to_graph2(false);
$pre_result = $new_result = array();
- $DataSet = new pData();
+ $DataSet = new pData();
//filling the Dataset
foreach ($user_results as $result) {
//print_r($result);
@@ -225,7 +228,7 @@ class FlatViewTable extends SortableTable
}
}
- //fixing $resource_list
+ //fixing $resource_list
$max = 0;
$new_list = array();
foreach ($resource_list as $key => $value) {
@@ -266,7 +269,7 @@ class FlatViewTable extends SortableTable
// the graph id
$gradebook_id = intval($_GET['selectcat']);
$graph_id = api_get_user_id() . 'ByResource' . $gradebook_id . api_get_course_id() . api_get_session_id();
-
+
if ($show_draw) {
//if ($Cache->IsInCache($graph_id, $DataSet->GetData())) {
if (0) {
@@ -283,12 +286,12 @@ class FlatViewTable extends SortableTable
// Adding the color schemma
$Test->loadColorPalette(api_get_path(LIBRARY_PATH) . "pchart/palette/pastel.txt");
-
+
// set font of the axes
$Test->setFontProperties(api_get_path(LIBRARY_PATH) . "pchart/fonts/tahoma.ttf", 8);
$area_graph_w = $chart_size_w - 130;
$Test->setGraphArea(50, 30, $area_graph_w, $chart_size_h - 50);
-
+
$Test->drawFilledRoundedRectangle(5, 5, $chart_size_w - 1, $chart_size_h - 20, 5, 240, 240, 240);
//$Test->drawRoundedRectangle(5,5,790,330,5,230,230,230);
//background color area & stripe or not
@@ -302,7 +305,7 @@ class FlatViewTable extends SortableTable
$Test->setFixedScale(0, $max);
}
}
-
+
$Test->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_ADDALLSTART0, 150, 150, 150, TRUE, 0, 1, FALSE);
//background grid
@@ -411,7 +414,7 @@ class FlatViewTable extends SortableTable
/**
* Function used by SortableTable to get total number of items in the table
*/
- function get_total_number_of_items()
+ public function get_total_number_of_items()
{
return $this->datagen->get_total_users_count();
}
@@ -419,7 +422,7 @@ class FlatViewTable extends SortableTable
/**
* Function used by SortableTable to generate the data to display
*/
- function get_table_data($from = 1, $per_page = null, $column = null, $direction = null, $sort = null)
+ 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();
@@ -430,8 +433,8 @@ class FlatViewTable extends SortableTable
} else {
$selectlimit = $totalitems;
}
+ $header = null;
if ($this->limit_enabled && $totalitems > LIMIT) {
- $calcprevious = LIMIT;
$header .= ''
. ''
. '';
@@ -522,11 +525,13 @@ class FlatViewTable extends SortableTable
return $table_data;
}
- // Other functions
-
+ /**
+ * @param $user_id
+ * @param $name
+ * @return string
+ */
private function build_name_link($user_id, $name)
{
return '' . $name . '';
}
-
}
diff --git a/main/gradebook/lib/flatview_data_generator.class.php b/main/gradebook/lib/flatview_data_generator.class.php
index e3000af948..58ff8d07bc 100755
--- a/main/gradebook/lib/flatview_data_generator.class.php
+++ b/main/gradebook/lib/flatview_data_generator.class.php
@@ -1,13 +1,12 @@
users = (isset($users) ? $users : array());
$this->evals = (isset($evals) ? $evals : array());
$this->links = (isset($links) ? $links : array());
@@ -39,51 +39,55 @@ class FlatViewDataGenerator
/**
* Get total number of users (rows)
*/
- public function get_total_users_count() {
+ public function get_total_users_count()
+ {
return count($this->users);
}
/**
* Get total number of evaluations/links (columns) (the 2 users columns not included)
*/
- public function get_total_items_count() {
+ public function get_total_items_count()
+ {
return count($this->evals_links);
}
/**
* Get array containing column header names (incl user columns)
- * @param int Start item offset
- * @param int Number of items to get
- * @param bool whether to show the details or not
- * @return array List of headers
+ * @param int $items_start Start item offset
+ * @param int $items_count Number of items to get
+ * @param bool $show_detail whether to show the details or not
+ * @return array List of headers
*/
- public function get_header_names($items_start = 0, $items_count = null , $show_detail = false) {
- $headers = array();
-
+ public function get_header_names($items_start = 0, $items_count = null, $show_detail = false)
+ {
+ $headers = array();
+
if (isset($this->params['show_official_code']) && $this->params['show_official_code']) {
$headers[] = get_lang('OfficialCode');
- }
+ }
if (isset($this->params['join_firstname_lastname']) && $this->params['join_firstname_lastname']) {
if (api_is_western_name_order()) {
- $headers[] = get_lang('FirstnameAndLastname');
+ $headers[] = get_lang('FirstnameAndLastname');
} else {
- $headers[] = get_lang('LastnameAndFirstname');
+ $headers[] = get_lang('LastnameAndFirstname');
}
} else {
if (api_is_western_name_order()) {
$headers[] = get_lang('FirstName');
- $headers[] = get_lang('LastName');
+ $headers[] = get_lang('LastName');
} else {
$headers[] = get_lang('LastName');
- $headers[] = get_lang('FirstName');
+ $headers[] = get_lang('FirstName');
}
}
+
if (!isset($items_count)) {
$items_count = count($this->evals_links) - $items_start;
}
-
+
$parent_id = $this->category->get_parent_id();
-
+
if ($parent_id == 0 or $this->params['only_subcat'] == $this->category->get_id()) {
$main_weight = $this->category->get_weight();
$grade_model_id = $this->category->get_grade_model_id();
@@ -91,73 +95,81 @@ class FlatViewDataGenerator
$main_cat = Category::load($parent_id, null, null);
$main_weight = $main_cat[0]->get_weight();
$grade_model_id = $main_cat[0]->get_grade_model_id();
- }
-
+ }
+
$use_grade_model = true;
if (empty($grade_model_id) || $grade_model_id == -1) {
- $use_grade_model = false;
+ $use_grade_model = false;
}
-
+
//@todo move these in a function
$sum_categories_weight_array = array();
+ $mainCategoryId = null;
if (isset($this->category) && !empty($this->category)) {
- $categories = Category::load(null, null, null, $this->category->get_id());
+ $mainCategoryId = $this->category->get_id();
+ $categories = Category::load(null, null, null, $this->category->get_id());
if (!empty($categories)) {
- foreach ($categories as $category) {
+ foreach ($categories as $category) {
$sum_categories_weight_array[$category->get_id()] = $category->get_weight();
}
} else {
- $sum_categories_weight_array[$this->category->get_id()] = $this->category->get_weight();
+ $sum_categories_weight_array[$this->category->get_id()] = $this->category->get_weight();
}
}
-
- //No category was added
-
- $course_code = api_get_course_id();
- $session_id = api_get_session_id();
+
+ // No category was added
+
+ $course_code = api_get_course_id();
+ $session_id = api_get_session_id();
$allcat = $this->category->get_subcategories(null, $course_code, $session_id, 'ORDER BY id');
-
- if ($parent_id == 0 && !empty($allcat)) {
-
- //Means there are any subcategory
+
+ if ($parent_id == 0 && !empty($allcat)) {
+ // 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 %";
if (isset($this->params['export_pdf']) && $this->params['export_pdf']) {
$add_weight = null;
}
- $headers[] = Display::url($sub_cat->get_name(), api_get_self().'?selectcat='.$sub_cat->get_id()).$add_weight;
+ $headers[] = Display::url($sub_cat->get_name(), api_get_self().'?selectcat='.$sub_cat->get_id()).$add_weight;
}
} else {
- if (!isset($this->params['only_total_category']) || (isset($this->params['only_total_category']) && $this->params['only_total_category'] == false)) {
+ if (!isset($this->params['only_total_category']) ||
+ (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++) {
- $item = $this->evals_links[$count + $items_start];
+ $item = $this->evals_links[$count + $items_start];
+ var_dump($item);
$weight = round(100*$item->get_weight()/$main_weight,1);
- $headers[] = $item->get_name().' '.$weight.' % ';
+ $headers[] = $item->get_name().' '.$weight.' % ';
}
- }
+ }
}
+
$headers[] = api_strtoupper(get_lang('GradebookQualificationTotal'));
+
return $headers;
}
-
- function get_max_result_by_link($id) {
+
+ public function get_max_result_by_link($id)
+ {
$max = 0;
foreach ($this->users as $user) {
- $item = $this->evals_links [$id];
- $score = $item->calc_score($user[0]);
+ $item = $this->evals_links [$id];
+ $score = $item->calc_score($user[0]);
if ($score[0] > $max) {
$max = $score[0];
- }
- }
+ }
+ }
return $max ;
}
/**
* Get array containing evaluation items
*/
- public function get_evaluation_items($items_start = 0, $items_count = null) {
+ public function get_evaluation_items($items_start = 0, $items_count = null)
+ {
$headers = array();
if (!isset($items_count)) {
$items_count = count($this->evals_links) - $items_start;
@@ -167,7 +179,7 @@ class FlatViewDataGenerator
$headers[] = $item->get_name();
}
return $headers;
- }
+ }
/**
* Get actual array data
@@ -177,10 +189,15 @@ class FlatViewDataGenerator
* 2: user firstname
* 3+: evaluation/link scores
*/
- public function get_data ($users_sorting = 0, $users_start = 0, $users_count = null,
- $items_start = 0, $items_count = null,
- $ignore_score_color = false, $show_all = false) {
-
+ public function get_data(
+ $users_sorting = 0,
+ $users_start = 0,
+ $users_count = null,
+ $items_start = 0,
+ $items_count = null,
+ $ignore_score_color = false,
+ $show_all = false
+ ) {
// do some checks on users/items counts, redefine if invalid values
if (!isset($users_count)) {
$users_count = count ($this->users) - $users_start;
@@ -286,7 +303,7 @@ class FlatViewDataGenerator
if ($export_to_pdf) {
if (api_is_western_name_order()) {
$row['firstname'] = $user[3];
- $row['lastname'] = $user[2];
+ $row['lastname'] = $user[2];
} else {
$row['lastname'] = $user[2];
$row['firstname'] = $user[3];
@@ -363,7 +380,7 @@ class FlatViewDataGenerator
$score = $item->calc_score($user_id);
$real_score = $score;
$divide = ( ($score[1])==0 ) ? 1 : $score[1];
-
+
//sub cat weight
$sub_cat_percentage = $sum_categories_weight_array[$item->get_category_id()];
@@ -378,8 +395,8 @@ class FlatViewDataGenerator
$item_total += $item->get_weight();
/*
- $complete_score = $scoredisplay->display_score($score, SCORE_DIV_PERCENT, SCORE_ONLY_SCORE);
- $temp_score = $scoredisplay->display_score(array($item_value, null), SCORE_DIV_SIMPLE_WITH_CUSTOM);
+ $complete_score = $scoredisplay->display_score($score, SCORE_DIV_PERCENT, SCORE_ONLY_SCORE);
+ $temp_score = $scoredisplay->display_score(array($item_value, null), SCORE_DIV_SIMPLE_WITH_CUSTOM);
$temp_score = Display::tip($temp_score, $complete_score);*/
//if (true)
@@ -394,14 +411,14 @@ class FlatViewDataGenerator
if (!isset($this->params['only_total_category']) || (isset($this->params['only_total_category']) && $this->params['only_total_category'] == false)) {
if (!$show_all) {
- if (in_array($item->get_type() , array(LINK_EXERCISE, LINK_DROPBOX, LINK_STUDENTPUBLICATION,
+ if (in_array($item->get_type() , array(LINK_EXERCISE, LINK_DROPBOX, LINK_STUDENTPUBLICATION,
LINK_LEARNPATH, LINK_FORUM_THREAD, LINK_ATTENDANCE, LINK_SURVEY, LINK_HOTPOTATOES))) {
if (!empty($score[0])) {
$row[] = $temp_score.' ';
} else {
$row[] = '';
}
- } else {
+ } else {
$row[] = $temp_score.' ';
}
} else {
@@ -437,9 +454,9 @@ class FlatViewDataGenerator
/**
* Get actual array data evaluation/link scores
*/
- public function get_evaluation_sumary_results ($session_id = null) {
-
- $usertable = array ();
+ public function get_evaluation_sumary_results ($session_id = null)
+ {
+ $usertable = array();
foreach ($this->users as $user) { $usertable[] = $user; }
$selected_users = $usertable;
@@ -450,7 +467,7 @@ class FlatViewDataGenerator
$row = array ();
for ($count=0;$count < count($this->evals_links); $count++) {
$item = $this->evals_links [$count];
- $score = $item->calc_score($user[0]);
+ $score = $item->calc_score($user[0]);
$porcent_score = isset($score[1]) && $score[1] > 0 ? ($score[0]*100)/$score[1] :0;
$row[$item->get_name()] = $porcent_score;
}
@@ -484,7 +501,11 @@ class FlatViewDataGenerator
return $result;
}
- public function get_data_to_graph () {
+ /**
+ * @return array
+ */
+ public function get_data_to_graph()
+ {
// do some checks on users/items counts, redefine if invalid values
$usertable = array ();
foreach ($this->users as $user) {
@@ -494,7 +515,7 @@ class FlatViewDataGenerator
usort($usertable, array ('FlatViewDataGenerator','sort_by_first_name'));
$data = array ();
-
+
$selected_users = $usertable;
foreach ($selected_users as $user) {
$row = array ();
@@ -505,19 +526,19 @@ class FlatViewDataGenerator
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];
$item_value += $score[0]/$divide*$item->get_weight();
$item_total += $item->get_weight();
-
-
+
+
$score_denom = ($score[1]==0) ? 1 : $score[1];
$score_final = ($score[0] / $score_denom) * 100;
$row[] = $score_final;
}
$total_score = array($item_value, $item_total);
$score_final = ($item_value / $item_total) * 100;
-
+
$row[] = $score_final;
$data[] = $row;
}
@@ -526,10 +547,11 @@ class FlatViewDataGenerator
/**
* This is a function to show the generated data
- * @param type $displayWarning
+ * @param bool $displayWarning
* @return array
*/
- public function get_data_to_graph2 ($displayWarning = true) {
+ public function get_data_to_graph2($displayWarning = true)
+ {
// do some checks on users/items counts, redefine if invalid values
$usertable = array ();
foreach ($this->users as $user) {
@@ -549,16 +571,13 @@ class FlatViewDataGenerator
$item_value = 0;
$item_total = 0;
$final_score = 0;
-
$item_value_total = 0;
-
-
$convert_using_the_global_weight = true;
$course_code = api_get_course_id();
$session_id = api_get_session_id();
$allcat = $this->category->get_subcategories(null, $course_code, $session_id, 'ORDER BY id');
-
+
if ($parent_id == 0 && !empty($allcat)) {
foreach ($allcat as $sub_cat) {
@@ -570,21 +589,16 @@ class FlatViewDataGenerator
$sub_cat_percentage = $sum_categories_weight_array[$sub_cat->get_id()];
$item_value = $score[0]/$divide*$main_weight;
$item_total += $sub_cat->get_weight();
-
- $row[] = array ($item_value, trim($scoredisplay->display_score($real_score, SCORE_CUSTOM,null, true)));
-
+ $row[] = array ($item_value, trim($scoredisplay->display_score($real_score, SCORE_CUSTOM,null, true)));
$item_value_total += $item_value;
$final_score += $score[0];
//$final_score = ($final_score / $item_total) * 100;
-
+
}
$total_score = array($final_score, $item_total);
$row[] = array ($final_score, trim($scoredisplay->display_score($total_score, SCORE_CUSTOM, null, true)));
-
-
} else {
-
for ($count=0;$count < count($this->evals_links); $count++) {
$item = $this->evals_links [$count];
$score = $item->calc_score($user[0]);
@@ -594,7 +608,7 @@ class FlatViewDataGenerator
$score_denom=($score[1]==0) ? 1 : $score[1];
$score_final = ($score[0] / $score_denom) * 100;
$row[] = array ($score_final, trim($scoredisplay->display_score($score, SCORE_CUSTOM,null, true)));
-
+
}
$total_score=array($item_value,$item_total);
$score_final = ($item_value / $item_total) * 100;
@@ -602,20 +616,20 @@ class FlatViewDataGenerator
Display::display_warning_message( Display::display_warning_message($total_score[1]));
}
$row[] =array ($score_final, trim($scoredisplay->display_score($total_score, SCORE_CUSTOM, null, true)));
-
}
-
+
$data[] = $row;
}
return $data;
}
- // Sort functions - used internally
- function sort_by_last_name($item1, $item2) {
+ public function sort_by_last_name($item1, $item2)
+ {
return api_strcmp($item1[2], $item2[2]);
}
- function sort_by_first_name($item1, $item2) {
+ public function sort_by_first_name($item1, $item2)
+ {
return api_strcmp($item1[3], $item2[3]);
}
}