Merge pull request #289 from ycastillo/yoselyn.7107

Yoselyn.7107
1.9.x
Julio Montoya 11 years ago
commit b37483d3a5
  1. 15
      main/inc/lib/link.lib.php
  2. 9
      main/newscorm/learnpath.class.php
  3. 2
      main/newscorm/lp_controller.php

@ -44,6 +44,21 @@ class Link extends Model
}
return $id;
}
function updateLink($linkId, $linkUrl)
{
$tblLink = Database :: get_course_table(TABLE_LINK);
$linkUrl = Database::escape_string($linkUrl);
$linkId = intval($linkId);
$courseId = api_get_course_int_id();
$session_id = api_get_session_id();
if ($linkUrl != '') {
$query = "UPDATE $tblLink SET url = '$linkUrl' WHERE id = $linkId AND c_id = $courseId AND session_id = $session_id";
$resLink = Database::query($query);
} else {
return false;
}
}
}

@ -1132,7 +1132,7 @@ class learnpath
* @param array The array resulting of the $_FILES[mp3] element
* @return boolean True on success, false on error
*/
public function edit_item($id, $parent, $previous, $title, $description, $prerequisites = 0, $audio = null, $max_time_allowed = 0)
public function edit_item($id, $parent, $previous, $title, $description, $prerequisites = 0, $audio = null, $max_time_allowed = 0, $url = '')
{
$course_id = api_get_course_int_id();
if ($this->debug > 0) {
@ -1342,6 +1342,13 @@ class learnpath
Database::query($sql_update_order);
}
if ($row_select['item_type'] == 'link') {
require_once api_get_path(LIBRARY_PATH).'link.lib.php';
$link = new Link();
$linkId = $row_select['path'];
$link->updateLink($linkId, $url);
}
}
/**

@ -586,7 +586,7 @@ switch ($action) {
if (isset($_FILES['mp3'])) {
$audio = $_FILES['mp3'];
}
$_SESSION['oLP']->edit_item($_REQUEST['id'], $_POST['parent'], $_POST['previous'], $post_title, $_POST['description'], $_POST['prerequisites'], $audio, $_POST['maxTimeAllowed']);
$_SESSION['oLP']->edit_item($_REQUEST['id'], $_POST['parent'], $_POST['previous'], $post_title, $_POST['description'], $_POST['prerequisites'], $audio, $_POST['maxTimeAllowed'], $_POST['url']);
if (isset($_POST['content_lp'])) {
$_SESSION['oLP']->edit_document($_course);

Loading…
Cancel
Save