Minor - format code.

1.10.x
Julio Montoya 9 years ago
parent c0b18f0cea
commit 8d4f4df1af
  1. 57
      main/newscorm/learnpath.class.php

@ -1046,12 +1046,14 @@ class learnpath
if ($this->type == 2 || $this->type == 3) {
// This is a scorm learning path, delete the files as well.
$sql = "SELECT path FROM $lp WHERE c_id = ".$course_id." AND id = " . $this->lp_id;
$sql = "SELECT path FROM $lp
WHERE c_id = ".$course_id." AND id = " . $this->lp_id;
$res = Database::query($sql);
if (Database :: num_rows($res) > 0) {
$row = Database :: fetch_array($res);
$path = $row['path'];
$sql = "SELECT id FROM $lp WHERE c_id = ".$course_id." AND path = '$path' AND id != " . $this->lp_id;
$sql = "SELECT id FROM $lp
WHERE c_id = ".$course_id." AND path = '$path' AND id != " . $this->lp_id;
$res = Database::query($sql);
if (Database :: num_rows($res) > 0) { // Another learning path uses this directory, so don't delete it.
if ($this->debug > 2) {
@ -1079,7 +1081,8 @@ class learnpath
$tbl_tool = Database :: get_course_table(TABLE_TOOL_LIST);
$link = 'newscorm/lp_controller.php?action=view&lp_id='.$this->lp_id;
// Delete tools
$sql = "DELETE FROM $tbl_tool WHERE c_id = ".$course_id." AND (link LIKE '$link%' AND image='scormbuilder.gif')";
$sql = "DELETE FROM $tbl_tool
WHERE c_id = ".$course_id." AND (link LIKE '$link%' AND image='scormbuilder.gif')";
Database::query($sql);
$sql = "DELETE FROM $lp WHERE c_id = ".$course_id." AND id = " . $this->lp_id;
@ -1095,20 +1098,6 @@ class learnpath
api_get_user_id()
);
// Delete link of gradebook tool
//$tbl_grade_link = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_LINK);
/*$sql = 'SELECT gl.id FROM ' . $tbl_grade_link . ' gl WHERE gl.type="4" AND gl.ref_id="' . $id . '";';
$result = Database::query($sql);
$row = Database :: fetch_array($result, 'ASSOC');*/
// Fixing gradebook link deleted see #5229.
/*
if (!empty($row['id'])) {
$link = LinkFactory :: load($row['id']);
if ($link[0] != null) {
$link[0]->delete();
}
}*/
$link_info = GradebookUtils::is_resource_in_course_gradebook(api_get_course_id(), 4 , $id, api_get_session_id());
if ($link_info !== false) {
GradebookUtils::remove_resource_from_course_gradebook($link_info['id']);
@ -1588,12 +1577,12 @@ class learnpath
$row_parent = Database :: fetch_array($res_parent);
$parent = $row_parent['parent_item_id'];
$sql_bros = "SELECT * FROM $lp_item
WHERE
c_id = ".$course_id." AND
parent_item_id = $parent AND
id = $id AND
item_type='dokeos_chapter'
ORDER BY display_order";
WHERE
c_id = ".$course_id." AND
parent_item_id = $parent AND
id = $id AND
item_type='dokeos_chapter'
ORDER BY display_order";
$res_bros = Database::query($sql_bros);
$list = array ();
while ($row_bro = Database :: fetch_array($res_bros)) {
@ -1610,7 +1599,8 @@ class learnpath
* @param integer Item ID
* @return array A list of all the "brother items" (or an empty array on failure)
*/
public function get_brother_items($id) {
public function get_brother_items($id)
{
$course_id = api_get_course_int_id();
if ($this->debug > 0) {
error_log('New LP - In learnpath::get_brother_items(' . $id . ')', 0);
@ -1965,6 +1955,7 @@ class learnpath
<a id="scorm-next" href="" onClick="switch_item(' . $mycurrentitemid . ',\'next\');return false;" title="next" ><img border="0" src="../img/btn_next.png" title="' . get_lang('ScormNext') . '"></a>
</div>';
}
return $navbar;
}
@ -2125,7 +2116,7 @@ class learnpath
$index = $this->index;
if (isset ($this->ordered_items[$index -1])) {
$index--;
while (isset($this->ordered_items[$index]) AND ($this->items[$this->ordered_items[$index]]->get_type() == 'dir' || $this->items[$this->ordered_items[$index]]->get_type() == 'dokeos_chapter')) {
while (isset($this->ordered_items[$index]) && ($this->items[$this->ordered_items[$index]]->get_type() == 'dir' || $this->items[$this->ordered_items[$index]]->get_type() == 'dokeos_chapter')) {
$index--;
if ($index < 0) {
return $this->index;
@ -2588,7 +2579,6 @@ class learnpath
*/
public function get_preview_image_path($size = null, $path_type = 'web')
{
$preview_image = $this->get_preview_image();
if (isset($preview_image) && !empty($preview_image)) {
$image_sys_path = api_get_path(SYS_COURSE_PATH).$this->course_info['path'].'/upload/learning_path/images/';
@ -2618,7 +2608,7 @@ class learnpath
/**
* Gets the learnpath author
* @return string LP's author
* @return string LP's author
*/
public function get_author()
{
@ -3895,9 +3885,9 @@ class learnpath
/**
* Move a learnpath up (display_order)
* @param integer Learnpath ID
* @param integer $lp_id Learnpath ID
*/
public function move_up($lp_id)
public static function move_up($lp_id)
{
$course_id = api_get_course_int_id();
$lp_table = Database :: get_course_table(TABLE_LP_MAIN);
@ -3942,9 +3932,9 @@ class learnpath
/**
* Move a learnpath down (display_order)
* @param integer Learnpath ID
* @param integer $lp_id Learnpath ID
*/
public function move_down($lp_id)
public static function move_down($lp_id)
{
$course_id = api_get_course_int_id();
$lp_table = Database :: get_course_table(TABLE_LP_MAIN);
@ -3952,8 +3942,9 @@ class learnpath
WHERE c_id = ".$course_id."
ORDER BY display_order";
$res = Database::query($sql);
if ($res === false)
if ($res === false) {
return false;
}
$lps = array ();
$lp_order = array ();
$num = Database :: num_rows($res);
@ -3968,7 +3959,7 @@ class learnpath
$need_fix = true;
$sql_u = "UPDATE $lp_table SET display_order = $i
WHERE c_id = ".$course_id." AND id = " . $row['id'];
$res_u = Database::query($sql_u);
Database::query($sql_u);
}
$row['display_order'] = $i;
$lps[$row['id']] = $row;

Loading…
Cancel
Save