Minor - format code

1.9.x
Julio Montoya 10 years ago
parent 6d12eee8ff
commit efb6f4f6a3
  1. 48
      main/inc/lib/course.lib.php

@ -3920,7 +3920,8 @@ class CourseManager
* @param string Original field name
* @return int Course id
*/
public static function get_course_id_from_original_id($original_course_id_value, $original_course_id_name) {
public static function get_course_id_from_original_id($original_course_id_value, $original_course_id_name)
{
$t_cfv = Database::get_main_table(TABLE_MAIN_COURSE_FIELD_VALUES);
$table_field = Database::get_main_table(TABLE_MAIN_COURSE_FIELD);
$sql_course = "SELECT course_code FROM $table_field cf INNER JOIN $t_cfv cfv ON cfv.field_id=cf.id WHERE field_variable='$original_course_id_name' AND field_value='$original_course_id_value'";
@ -4149,9 +4150,16 @@ class CourseManager
if (isset($course_info['user_course_cat'])) {
$user_course_category = $course_info['user_course_cat'];
}
$output = array ($user_course_category, $html, $course_info['id_session'], $session, 'active' => $active, 'session_category_id' => $session_category_id);
$output = array(
$user_course_category,
$html,
$course_info['id_session'],
$session,
'active' => $active,
'session_category_id' => $session_category_id
);
} else {
$output = array ($course_info['user_course_cat'], $html);
$output = array($course_info['user_course_cat'], $html);
}
return $output;
}
@ -4164,7 +4172,8 @@ class CourseManager
* @param int destination session id
* @return bool
*/
public static function copy_course($source_course_code, $source_session_id, $destination_course_code, $destination_session_id, $params = array()) {
public static function copy_course($source_course_code, $source_session_id, $destination_course_code, $destination_session_id, $params = array())
{
require_once api_get_path(SYS_CODE_PATH).'coursecopy/classes/CourseBuilder.class.php';
require_once api_get_path(SYS_CODE_PATH).'coursecopy/classes/CourseRestorer.class.php';
require_once api_get_path(SYS_CODE_PATH).'coursecopy/classes/CourseSelectForm.class.php';
@ -4182,7 +4191,6 @@ class CourseManager
return false;
}
/**
* A simpler version of the copy_course, the function creates an empty course with an autogenerated course code
*
@ -4292,8 +4300,6 @@ class CourseManager
}
return false;
}
return false;
}
/**
@ -4536,10 +4542,15 @@ class CourseManager
$action_done = 'nothing';
$result = Database::select('id, vote', $table_user_course_vote, array('where' => array('user_id = ? AND c_id = ? AND session_id = ? AND url_id = ?' => $params)), 'first');
$result = Database::select(
'id, vote',
$table_user_course_vote,
array('where' => array('user_id = ? AND c_id = ? AND session_id = ? AND url_id = ?' => $params)),
'first'
);
if (empty($result)) {
$result = Database::insert($table_user_course_vote, $params);
Database::insert($table_user_course_vote, $params);
$points_to_add = $vote;
$add_user = true;
$action_done = 'added';
@ -4548,13 +4559,24 @@ class CourseManager
$points_to_add = $vote - $result['vote'];
$add_user = false;
$result = Database::update($table_user_course_vote, $my_params, array('user_id = ? AND c_id = ? AND session_id = ? AND url_id = ?' => $params));
Database::update(
$table_user_course_vote,
$my_params,
array('user_id = ? AND c_id = ? AND session_id = ? AND url_id = ?' => $params)
);
$action_done = 'updated';
}
//Current points
// Current points
if (!empty($points_to_add)) {
self::update_course_ranking($course_id, $session_id, $url_id, $points_to_add, false, $add_user);
self::update_course_ranking(
$course_id,
$session_id,
$url_id,
$points_to_add,
false,
$add_user
);
}
return $action_done;
}
@ -5157,7 +5179,7 @@ class CourseManager
$sql = "SELECT * FROM $table
WHERE
course_code = $courseCode AND
course_code = '$courseCode' AND
session_id = $sessionId AND
login_course_date BETWEEN '$startDate' AND '$endDate'
";

Loading…
Cancel
Save