Minor - format code

1.9.x
Julio Montoya 11 years ago
parent 74ce6a861a
commit e66dbbc716
  1. 30
      main/inc/ajax/course_home.ajax.php
  2. 2
      main/inc/lib/model.lib.php
  3. 7
      main/mySpace/lp_tracking.php
  4. 10
      main/newscorm/learnpathList.class.php

@ -119,6 +119,7 @@ switch ($action) {
$session_id = intval($_REQUEST['session_id']);
$course_id = intval($_REQUEST['course_id']);
//Filter users that does not belong to the session
if (!api_is_platform_admin()) {
$new_session_list = UserManager::get_personal_session_course_list(api_get_user_id());
@ -135,22 +136,28 @@ switch ($action) {
if (!$sidx) {
$sidx = 1;
}
$start = $limit*$page - $limit;
$course_list = SessionManager::get_course_list_by_session_id($session_id);
$course_list = SessionManager::get_course_list_by_session_id($session_id);
$count = 0;
$temp = array();
foreach ($course_list as $item) {
$list = new LearnpathList(api_get_user_id(), $item['code'], $session_id);
$list = new LearnpathList(api_get_user_id(), $item['code'], $session_id);
$flat_list = $list->get_flat_list();
$lps[$item['code']] = $flat_list;
$course_url = api_get_path(WEB_COURSE_PATH).$item['directory'].'/?id_session='.$session_id;
$item['title'] = Display::url($item['title'], $course_url, array('target'=>SESSION_LINK_TARGET));
$item['title'] = Display::url($item['title'], $course_url, array('target' => SESSION_LINK_TARGET));
foreach($flat_list as $lp_id => $lp_item) {
foreach ($flat_list as $lp_id => $lp_item) {
$temp[$count]['id']= $lp_id;
$lp_url = api_get_path(WEB_CODE_PATH).'newscorm/lp_controller.php?cidReq='.$item['code'].'&id_session='.$session_id.'&lp_id='.$lp_id.'&action=view';
$last_date = Tracking::get_last_connection_date_on_the_course(api_get_user_id(),$item['code'], $session_id, false);
$last_date = Tracking::get_last_connection_date_on_the_course(
api_get_user_id(),
$item['code'],
$session_id,
false
);
if ($lp_item['modified_on'] == '0000-00-00 00:00:00' || empty($lp_item['modified_on'])) {
$lp_date = api_get_local_time($lp_item['created_on']);
$image = 'new.gif';
@ -160,6 +167,7 @@ switch ($action) {
$image = 'moderator_star.png';
$label = get_lang('LearnpathUpdated');
}
if (strtotime($last_date) < strtotime($lp_date)) {
$icons = Display::return_icon($image, get_lang('TitleNotification').': '.$label.' - '.$lp_date);
}
@ -170,7 +178,7 @@ switch ($action) {
$date = '-';
}
//Checking LP publicated and expired_on dates
// Checking LP publicated and expired_on dates
if (!empty($lp_item['publicated_on']) && $lp_item['publicated_on'] != '0000-00-00 00:00:00') {
if ($now < api_strtotime($lp_item['publicated_on'], 'UTC')) {
continue;
@ -183,7 +191,11 @@ switch ($action) {
}
}
$temp[$count]['cell']=array($date, $item['title'], Display::url($icons.' '.$lp_item['lp_name'], $lp_url, array('target'=>SESSION_LINK_TARGET)));
$temp[$count]['cell'] = array(
$date,
$item['title'],
Display::url($icons.' '.$lp_item['lp_name'], $lp_url, array('target'=>SESSION_LINK_TARGET))
);
$temp[$count]['course'] = strip_tags($item['title']);
$temp[$count]['lp'] = $lp_item['lp_name'];
$temp[$count]['date'] = $lp_item['publicated_on'];

@ -170,12 +170,14 @@ class Model
return $id;
}
}
return false;
}
/**
* Updates the obj in the database. The $params['id'] must exist in order to update a record
* @param array $values
*
* @return bool
*
*/

@ -41,12 +41,12 @@ if (isset($_GET['course'])) {
$user_infos = UserManager :: get_user_info_by_id($user_id);
$name = api_get_person_name($user_infos['firstname'], $user_infos['lastname']);
if (!api_is_platform_admin(true) && !CourseManager :: is_course_teacher(api_get_user_id(), $cidReq) && !Tracking :: is_allowed_to_coach_student(api_get_user_id(), $_GET['student_id']) && !api_is_drh() && !api_is_course_tutor()) {
api_not_allowed();
if (!api_is_platform_admin(true) && !CourseManager :: is_course_teacher(api_get_user_id(), $cidReq) && !Tracking :: is_allowed_to_coach_student(api_get_user_id(), $_GET['student_id']) && !api_is_drh() && !api_is_course_tutor()) {
api_not_allowed();
}
$course_exits = CourseManager::course_exists($cidReq);
if (!empty($course_exits)) {
if (!empty($course_exits)) {
$course_info = api_get_course_info($cidReq);
} else {
api_not_allowed();
@ -96,7 +96,6 @@ $list = learnpath :: get_flat_ordered_items_list($lp_id, 0, $course_info['real_i
$origin = 'tracking';
if ($export_csv) {
require_once api_get_path(SYS_CODE_PATH).'newscorm/lp_stats.php';
//Export :: export_table_csv($csv_content, 'reporting_student');
} else {
ob_start();
require_once api_get_path(SYS_CODE_PATH).'newscorm/lp_stats.php';

@ -31,7 +31,7 @@ class learnpathList
* @param int Optional session id (otherwise we use api_get_session_id())
* @return void
*/
function __construct($user_id, $course_code = '', $session_id = null, $order_by = null, $check_publication_dates = false)
public function __construct($user_id, $course_code = '', $session_id = null, $order_by = null, $check_publication_dates = false)
{
$course_info = api_get_course_info($course_code);
$lp_table = Database::get_course_table(TABLE_LP_MAIN);
@ -65,10 +65,10 @@ class learnpathList
if ($check_publication_dates) {
$time_conditions = " AND (
(publicated_on <> '0000-00-00 00:00:00' AND publicated_on < '$now' AND expired_on <> '0000-00-00 00:00:00' AND expired_on > '$now' ) OR
(publicated_on <> '0000-00-00 00:00:00' AND publicated_on < '$now' AND expired_on = '0000-00-00 00:00:00') OR
(publicated_on = '0000-00-00 00:00:00' AND expired_on <> '0000-00-00 00:00:00' AND expired_on > '$now') OR
(publicated_on = '0000-00-00 00:00:00' AND expired_on = '0000-00-00 00:00:00' ))
(publicated_on <> '0000-00-00 00:00:00' AND publicated_on < '$now' AND expired_on <> '0000-00-00 00:00:00' AND expired_on > '$now' ) OR
(publicated_on <> '0000-00-00 00:00:00' AND publicated_on < '$now' AND expired_on = '0000-00-00 00:00:00') OR
(publicated_on = '0000-00-00 00:00:00' AND expired_on <> '0000-00-00 00:00:00' AND expired_on > '$now') OR
(publicated_on = '0000-00-00 00:00:00' AND expired_on = '0000-00-00 00:00:00' ))
";
}

Loading…
Cancel
Save