Skip to content

Commit

Permalink
Add filter $ignoreCategoryFilter see BT#10675
Browse files Browse the repository at this point in the history
  • Loading branch information
jmontoyaa committed Feb 9, 2016
1 parent 197a7ee commit d477333
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 15 deletions.
17 changes: 8 additions & 9 deletions main/inc/lib/tracking.lib.php
Expand Up @@ -4273,12 +4273,8 @@ public static function show_user_progress(
$all_exercise_start_time = array();

foreach ($course_in_session as $my_session_id => $session_data) {

$course_list = $session_data['course_list'];
$session_name = $session_data['name'];

$user_count = count(SessionManager::get_users_by_session($my_session_id));

$exercise_graph_name_list = array();
//$user_results = array();
$exercise_graph_list = array();
Expand All @@ -4292,6 +4288,7 @@ public static function show_user_progress(
false,
1
);

foreach ($exercise_list as $exercise_data) {
$exercise_obj = new Exercise($course_data['id']);
$exercise_obj->read($exercise_data['id']);
Expand Down Expand Up @@ -4366,7 +4363,9 @@ public static function show_user_progress(
);
}

$html .= Display::page_subheader(Display::return_icon('session.png', get_lang('Sessions'), array(), ICON_SIZE_SMALL).' '.get_lang('Sessions'));
$html .= Display::page_subheader(
Display::return_icon('session.png', get_lang('Sessions'), array(), ICON_SIZE_SMALL) . ' ' . get_lang('Sessions')
);

$html .= '<table class="data_table" width="100%">';
$html .= '<tr>
Expand Down Expand Up @@ -4459,7 +4458,6 @@ public static function show_user_progress(

if (isset($_GET['session_id'])) {
$session_id_from_get = intval($_GET['session_id']);

$session_data = $course_in_session[$session_id_from_get];
$course_list = $session_data['course_list'];

Expand Down Expand Up @@ -4520,7 +4518,6 @@ public static function show_user_progress(
'my_average' => $my_average
);

$weighting = 0;
$last_connection = Tracking:: get_last_connection_date_on_the_course(
$user_id,
$courseInfo,
Expand Down Expand Up @@ -4572,7 +4569,7 @@ public static function show_user_progress(
} else {
$progress = '0%';
}
//Progress
// Progress
$html .= Display::tag('td', $progress, array('align'=>'center'));
if (is_numeric($percentage_score)) {
$percentage_score = $percentage_score.'%';
Expand Down Expand Up @@ -4735,7 +4732,7 @@ public static function show_course_detail($user_id, $course_code, $session_id)
);
if (!empty($exercise_stat)) {

//Always getting the BEST attempt
// Always getting the BEST attempt
$score = $exercise_stat['exe_result'];
$weighting = $exercise_stat['exe_weighting'];
$exe_id = $exercise_stat['exe_id'];
Expand Down Expand Up @@ -4808,6 +4805,8 @@ public static function show_course_detail($user_id, $course_code, $session_id)
$course_info['code'],
$session_id,
'publicated_on ASC',
true,
null,
true
);

Expand Down
17 changes: 11 additions & 6 deletions main/newscorm/learnpathList.class.php
Expand Up @@ -32,6 +32,7 @@ class LearnpathList
* @param string $order_by
* @param string $check_publication_dates
* @param int $categoryId
* @param bool $ignoreCategoryFilter
*
* @return void
*/
Expand All @@ -41,7 +42,8 @@ public function __construct(
$session_id = null,
$order_by = null,
$check_publication_dates = false,
$categoryId = null
$categoryId = null,
$ignoreCategoryFilter = false
) {
$course_info = api_get_course_info($course_code);
$lp_table = Database::get_course_table(TABLE_LP_MAIN);
Expand Down Expand Up @@ -83,11 +85,14 @@ public function __construct(
";
}

if (!empty($categoryId)) {
$categoryId = intval($categoryId);
$categoryFilter = " AND category_id = $categoryId";
} else {
$categoryFilter = " AND (category_id = 0 OR category_id IS NULL) ";
$categoryFilter = '';
if ($ignoreCategoryFilter == false) {
if (!empty($categoryId)) {
$categoryId = intval($categoryId);
$categoryFilter = " AND category_id = $categoryId";
} else {
$categoryFilter = " AND (category_id = 0 OR category_id IS NULL) ";
}
}

$sql = "SELECT * FROM $lp_table
Expand Down

0 comments on commit d477333

Please sign in to comment.