Remove resource table, remove lp/resourcelinker code and calls around chamilo

pull/2487/head
jmontoyaa 9 years ago
parent d09700505b
commit b44babec41
  1. 4
      app/Migrations/Schema/V111/Version111.php
  2. 3
      main/forum/forumfunction.inc.php
  3. 4
      main/inc/lib/database.constants.inc.php
  4. 12
      main/inc/lib/tracking.lib.php
  5. 294
      main/lp/learnpath.class.php
  6. 10
      main/lp/lp_add.php
  7. 7
      main/lp/lp_add_audio.php
  8. 1
      main/lp/lp_add_category.php
  9. 5
      main/lp/lp_add_item.php
  10. 6
      main/lp/lp_admin_view.php
  11. 6
      main/lp/lp_build.php
  12. 2
      main/lp/lp_controller.php
  13. 8
      main/lp/lp_edit_item.php
  14. 7
      main/lp/lp_edit_item_prereq.php
  15. 6
      main/lp/lp_move_item.php
  16. 4
      main/lp/lp_view_item.php
  17. 1915
      main/lp/resourcelinker.inc.php
  18. 941
      main/lp/resourcelinker.php
  19. 50
      src/Chamilo/CoreBundle/Composer/ScriptHandler.php
  20. 20
      src/Chamilo/CourseBundle/Component/CourseCopy/CourseBuilder.php
  21. 9
      src/Chamilo/CourseBundle/Component/CourseCopy/CourseRecycler.php

@ -303,6 +303,10 @@ class Version111 extends AbstractMigrationChamilo
$this->addSql('CREATE TABLE version (id int unsigned NOT NULL AUTO_INCREMENT, version varchar(255), PRIMARY KEY(id), UNIQUE(version));');
}
if ($schema->hasTable('resource')) {
$schema->dropTable('resource');
}
$this->addSql('DELETE FROM settings_current WHERE variable = "service_visio"');
$this->addSql('DELETE FROM settings_current WHERE variable = "course_create_active_tools" AND subkey = "online_conference"');
$this->addSql('DELETE FROM settings_options WHERE variable = "visio_use_rtmpt"');

@ -3766,9 +3766,6 @@ function store_edit_post($forumInfo, $values)
);
}
// Storing the attachments if any.
//update_added_resources('forum_post', $values['post_id']);
$message = get_lang('EditPostStored').'<br />';
$message .= get_lang('ReturnTo').' <a href="viewforum.php?'.api_get_cidreq().'&forum='.intval($_GET['forum']).'&">'.get_lang('Forum').'</a><br />';
$message .= get_lang('ReturnTo').' <a href="viewthread.php?'.api_get_cidreq().'&forum='.intval($_GET['forum']).'&gradebook='.$gradebook.'&thread='.$values['thread_id'].'&post='.Security::remove_XSS($_GET['post']).'">'.get_lang('Message').'</a>';

@ -201,10 +201,6 @@ define('TABLE_QUIZ_QUESTION_CATEGORY', 'quiz_question_category');
define('TABLE_QUIZ_QUESTION_REL_CATEGORY', 'quiz_question_rel_category');
define('TABLE_QUIZ_REL_CATEGORY', 'quiz_rel_category');
// Linked resource table
//@todo table exists?
define('TABLE_LINKED_RESOURCES', 'resource');
// New SCORM tables
define('TABLE_LP_MAIN', 'lp');
define('TABLE_LP_ITEM', 'lp_item');

@ -321,7 +321,7 @@ class Tracking
$title = $row['mytitle'];
if (empty($title)) {
$title = rl_get_resource_name($courseInfo['code'], $lp_id, $row['myid']);
$title = learnpath::rl_get_resource_name($courseInfo['code'], $lp_id, $row['myid']);
}
if (in_array($row['item_type'], $chapterTypes)) {
@ -702,7 +702,7 @@ class Tracking
$time_for_total = $subtotal_time;
$time = learnpathItem::getScormTimeFromParameter('js', $subtotal_time);
if (empty($title)) {
$title = rl_get_resource_name($courseInfo['code'], $lp_id, $row['myid']);
$title = learnpath::rl_get_resource_name($courseInfo['code'], $lp_id, $row['myid']);
}
$action = null;
@ -6708,7 +6708,7 @@ class TrackingUserLog
* @param int $course_id
* @param int $session_id
*/
public function display_login_tracking_info($view, $user_id, $course_id, $session_id = 0)
public static function display_login_tracking_info($view, $user_id, $course_id, $session_id = 0)
{
$MonthsLong = $GLOBALS['MonthsLong'];
@ -6791,7 +6791,7 @@ class TrackingUserLog
* @return array
* @todo remove globals
*/
public function display_exercise_tracking_info($view, $user_id, $courseCode)
public static function display_exercise_tracking_info($view, $user_id, $courseCode)
{
global $TBL_TRACK_HOTPOTATOES, $TABLECOURSE_EXERCICES, $TABLETRACK_EXERCICES, $dateTimeFormatLong;
$courseId = api_get_course_int_id($courseCode);
@ -6894,7 +6894,7 @@ class TrackingUserLog
* Displays the student publications for a specific user in a specific course.
* @todo remove globals
*/
public function display_student_publications_tracking_info($view, $user_id, $course_id)
public static function display_student_publications_tracking_info($view, $user_id, $course_id)
{
global $TABLETRACK_UPLOADS, $TABLECOURSE_WORK;
$_course = api_get_course_info_by_id($course_id);
@ -6962,7 +6962,7 @@ class TrackingUserLog
* Displays the links followed for a specific user in a specific course.
* @todo remove globals
*/
public function display_links_tracking_info($view, $user_id, $courseCode)
public static function display_links_tracking_info($view, $user_id, $courseCode)
{
global $TABLETRACK_LINKS, $TABLECOURSE_LINKS;
$courseId = api_get_course_int_id($courseCode);

@ -3179,12 +3179,8 @@ class learnpath
if (empty($toc_list)) {
$toc_list = $this->get_toc();
}
//$html = '<div id="scorm_title" class="scorm-heading">'.Security::remove_XSS($this->get_name()) . '</div>';
$html = '<div class="scorm-body">';
$html .= '<div id="inner_lp_toc" class="inner_lp_toc scrollbar-light">';
require_once 'resourcelinker.inc.php';
// Temporary variables.
$mycurrentitemid = $this->get_current_item_id();
@ -3228,7 +3224,7 @@ class learnpath
// Learning path title
$title = $item['title'];
if (empty ($title)) {
$title = rl_get_resource_name(api_get_course_id(), $this->get_id(), $item['id']);
$title = self::rl_get_resource_name(api_get_course_id(), $this->get_id(), $item['id']);
}
$title = Security::remove_XSS($title);
@ -3415,9 +3411,7 @@ class learnpath
// @todo Use constants instead of int values.
switch ($lp_type) {
case 1 :
require_once 'resourcelinker.inc.php';
$file = rl_get_resource_link_for_learnpath(
$file = self::rl_get_resource_link_for_learnpath(
$course_id,
$this->get_id(),
$item_id,
@ -3555,8 +3549,8 @@ class learnpath
$decoded = html_entity_decode($lp_item_path);
list ($decoded) = explode('?', $decoded);
if (!is_file(realpath($sys_course_path . '/scorm/' . $lp_path . '/' . $decoded))) {
require_once 'resourcelinker.inc.php';
$file = rl_get_resource_link_for_learnpath(
$file = self::rl_get_resource_link_for_learnpath(
$course_id,
$this->get_id(),
$item_id,
@ -11216,6 +11210,286 @@ EOD;
return true;
}
/**
* Returns an HTML-formatted link to a resource, to incorporate directly into
* the new learning path tool.
*
* The function is a big switch on tool type.
* In each case, we query the corresponding table for information and build the link
* with that information.
* @author Yannick Warnier <ywarnier@beeznest.org> - rebranding based on previous work (display_addedresource_link_in_learnpath())
* @param int $course_id Course code
* @param int $learningPathId The learning path ID (in lp table)
* @param int $id_in_path the unique index in the items table
* @param int $lpViewId
* @return string
*/
public static function rl_get_resource_link_for_learnpath($course_id, $learningPathId, $id_in_path, $lpViewId)
{
$tbl_lp_item = Database::get_course_table(TABLE_LP_ITEM);
$course_info = api_get_course_info_by_id($course_id);
$course_id = $course_info['real_id'];
$course_code = $course_info['code'];
$session_id = api_get_session_id();
$learningPathId = intval($learningPathId);
$id_in_path = intval($id_in_path);
$lpViewId = intval($lpViewId);
$em = Database::getManager();
$sql = "SELECT * FROM $tbl_lp_item
WHERE
c_id = $course_id AND
lp_id = $learningPathId AND
id = $id_in_path
";
$res_item = Database::query($sql);
if (Database::num_rows($res_item) < 1) {
return -1;
}
$row_item = Database::fetch_array($res_item, 'ASSOC');
$type = strtolower($row_item['item_type']);
$id = (strcmp($row_item['path'], '') == 0) ? '0' : $row_item['path'];
$origin = 'learnpath';
$main_dir_path = api_get_path(WEB_CODE_PATH);
$main_course_path = api_get_path(WEB_COURSE_PATH).$course_info['directory'].'/';
$link = '';
switch ($type) {
case 'dir':
$link .= $main_dir_path . 'lp/blank.php';
case TOOL_CALENDAR_EVENT:
$link .= $main_dir_path.'calendar/agenda.php?origin='.$origin.'&agenda_id='.$id;
break;
case TOOL_ANNOUNCEMENT:
$link .= $main_dir_path.'announcements/announcements.php?origin='.$origin.'&ann_id='.$id;
break;
case TOOL_LINK:
$TABLETOOLLINK = Database::get_course_table(TABLE_LINK);
$result = Database::query("SELECT * FROM $TABLETOOLLINK WHERE c_id = $course_id AND id=$id");
$myrow = Database::fetch_array($result);
$thelink = $myrow["url"];
$link .= $thelink;
break;
case TOOL_QUIZ:
if (!empty($id)) {
$TBL_EXERCICES = Database::get_course_table(TABLE_QUIZ_TEST);
$sql = "SELECT * FROM $TBL_EXERCICES WHERE c_id = $course_id AND id=$id";
$result= Database::query($sql);
$myrow=Database::fetch_array($result);
if ($row_item['title'] != '') {
$myrow['title'] = $row_item['title'];
}
$link .= $main_dir_path . 'exercise/overview.php?cidReq='.$course_code.'&session_id='.$session_id.'&lp_init=1&origin='.$origin.'&learnpath_id='.$learningPathId.'&learnpath_item_id='.$id_in_path.'&exerciseId='.$id;
}
break;
case 'hotpotatoes': //lowercase because of strtolower above
$TBL_DOCUMENT = Database::get_course_table(TABLE_DOCUMENT);
$result = Database::query("SELECT * FROM ".$TBL_DOCUMENT." WHERE c_id = $course_id AND id=$id");
$myrow = Database::fetch_array($result);
$path = $myrow['path'];
$link .= $main_dir_path . 'exercise/showinframes.php?file='.$path.'' .
'&origin='.$origin.'&cid='.$course_code.'&uid='.api_get_user_id().'' .
'&learnpath_id='.$learningPathId.'&learnpath_item_id='.$id_in_path.'&lp_view_id='.$lpViewId;
break;
case TOOL_FORUM:
$link .= $main_dir_path.'forum/viewforum.php?forum='.$id.'&lp=true&origin=learnpath';
break;
case TOOL_THREAD: //forum post
$tbl_topics = Database::get_course_table(TABLE_FORUM_THREAD);
if (!empty($id)) {
$sql = "SELECT * FROM $tbl_topics WHERE c_id = $course_id AND thread_id=$id";
$result = Database::query($sql);
$myrow = Database::fetch_array($result);
$link .= $main_dir_path.'forum/viewthread.php?origin=learnpath&thread='.$id.'' .
'&forum='.$myrow['forum_id'].'&lp=true';
}
break;
case TOOL_POST:
$tbl_post = Database::get_course_table(TABLE_FORUM_POST);
$result = Database::query("SELECT * FROM $tbl_post WHERE c_id = $course_id AND post_id=$id");
$myrow = Database::fetch_array($result);
$title = $myrow['post_title'];
//$desc = $row_item['description'];
$posternom = $myrow['poster_name'];
$posttime = $myrow['post_date'];
$posttext = $myrow['post_text'];
$posttitle = $title;
$posttext = str_replace('"', "'", $posttext);
$link .= $main_dir_path.'forum/viewthread.php?post='.$id.'' .
'&thread='.$myrow['thread_id'].'&forum='.$myrow['forum_id'].'' .
'&lp=true';
break;
case TOOL_DOCUMENT:
$document = $em
->getRepository('ChamiloCourseBundle:CDocument')
->findOneBy(['cId' => $course_id, 'id' => $id]);
if (!$document) {
break;
}
$documentPathInfo = pathinfo($document->getPath());
$jplayer_supported_files = ['mp4', 'ogv', 'flv', 'm4v'];
$extension = isset($documentPathInfo['extension']) ? $documentPathInfo['extension'] : '';
$showDirectUrl = !in_array($extension, $jplayer_supported_files);
if ($showDirectUrl) {
$link = $main_course_path . 'document' . $document->getPath() . '?' . api_get_cidreq();
} else {
$link = api_get_path(WEB_CODE_PATH) . 'document/showinframes.php?' . http_build_query([
'cidReq' => $course_code,
'id' => $id,
'origin' => 'learnpathitem'
]);
}
$openmethod = 2;
$officedoc = false;
Session::write('openmethod',$openmethod);
Session::write('officedoc',$officedoc);
break;
case TOOL_LP_FINAL_ITEM:
$link .= api_get_path(WEB_CODE_PATH) . 'lp/lp_final_item.php?'.api_get_cidreq().'&id='.$id.'&lp_id='.$learningPathId;
break;
case 'assignments':
$link .= $main_dir_path.'work/work.php?origin='.$origin;
break;
case TOOL_DROPBOX:
$link .= $main_dir_path.'dropbox/index.php?origin=learnpath';
break;
case 'introduction_text': //DEPRECATED
$link .= '';
break;
case TOOL_COURSE_DESCRIPTION:
$link .= $main_dir_path.'course_description?origin=learnpath';
break;
case TOOL_GROUP:
$link .= $main_dir_path.'group/group.php?origin='.$origin;
break;
case TOOL_USER:
$link .= $main_dir_path.'user/user.php?origin='.$origin;
break;
case TOOL_STUDENTPUBLICATION:
$link .= $main_dir_path.'work/work_list.php?'.api_get_cidreq().'&id='.$row_item['path'].'&origin=learnpath';
break;
} //end switch
return $link;
}
/**
* Gets the name of a resource (generally used in learnpath when no name is provided)
*
* @author Yannick Warnier <ywarnier@beeznest.org>
* @param string Course code
* @param string The tool type (using constants declared in main_api.lib.php)
* @param integer The resource ID
*/
public static function rl_get_resource_name($course_code, $learningPathId, $id_in_path)
{
$_course = api_get_course_info($course_code);
$course_id = $_course['real_id'];
$tbl_lp_item = Database::get_course_table(TABLE_LP_ITEM);
$learningPathId = intval($learningPathId);
$id_in_path = intval($id_in_path);
$sql_item = "SELECT item_type, title, ref FROM $tbl_lp_item
WHERE c_id = $course_id AND lp_id = $learningPathId AND id = $id_in_path";
$res_item = Database::query($sql_item);
if (Database::num_rows($res_item) < 1) {
return '';
}
$row_item = Database::fetch_array($res_item);
$type = strtolower($row_item['item_type']);
$id = $row_item['ref'];
$output = '';
switch ($type) {
case TOOL_CALENDAR_EVENT:
$TABLEAGENDA = Database::get_course_table(TABLE_AGENDA);
$result = Database::query("SELECT * FROM $TABLEAGENDA WHERE c_id = $course_id AND id=$id");
$myrow = Database::fetch_array($result);
$output = $myrow['title'];
break;
case TOOL_ANNOUNCEMENT:
$tbl_announcement = Database::get_course_table(TABLE_ANNOUNCEMENT);
$result = Database::query("SELECT * FROM $tbl_announcement WHERE c_id = $course_id AND id=$id");
$myrow = Database::fetch_array($result);
$output = $myrow['title'];
break;
case TOOL_LINK:
// Doesn't take $target into account.
$TABLETOOLLINK = Database::get_course_table(TABLE_LINK);
$result = Database::query("SELECT * FROM $TABLETOOLLINK WHERE c_id = $course_id AND id=$id");
$myrow = Database::fetch_array($result);
$output = $myrow['title'];
break;
case TOOL_QUIZ:
$TBL_EXERCICES = Database::get_course_table(TABLE_QUIZ_TEST);
$result = Database::query("SELECT * FROM $TBL_EXERCICES WHERE c_id = $course_id AND id=$id");
$myrow = Database::fetch_array($result);
$output = $myrow['title'];
break;
case TOOL_FORUM:
$TBL_FORUMS = Database::get_course_table(TABLE_FORUM);
$result = Database::query("SELECT * FROM $TBL_FORUMS WHERE c_id = $course_id AND forum_id=$id");
$myrow = Database::fetch_array($result);
$output = $myrow['forum_name'];
break;
case TOOL_THREAD: //=topics
$tbl_post = Database::get_course_table(TABLE_FORUM_POST);
// Grabbing the title of the post.
$sql_title = "SELECT * FROM $tbl_post WHERE c_id = $course_id AND post_id=".$id;
$result_title = Database::query($sql_title);
$myrow_title = Database::fetch_array($result_title);
$output = $myrow_title['post_title'];
break;
case TOOL_POST:
$tbl_post = Database::get_course_table(TABLE_FORUM_POST);
//$tbl_post_text = Database::get_course_table(FORUM_POST_TEXT_TABLE);
$sql = "SELECT * FROM $tbl_post p WHERE c_id = $course_id AND p.post_id = $id";
$result = Database::query($sql);
$post = Database::fetch_array($result);
$output = $post['post_title'];
break;
case 'dir':
$title = $row_item['title'];
if (!empty($title)) {
$output = $title;
} else {
$output = '-';
}
break;
case TOOL_DOCUMENT:
$title = $row_item['title'];
if (!empty($title)) {
$output = $title;
} else {
$output = '-';
}
break;
case 'hotpotatoes':
$tbl_doc = Database::get_course_table(TABLE_DOCUMENT);
$result = Database::query("SELECT * FROM $tbl_doc WHERE c_id = $course_id AND id = $id");
$myrow = Database::fetch_array($result);
$pathname = explode('/', $myrow['path']); // Making a correct name for the link.
$last = count($pathname) - 1; // Making a correct name for the link.
$filename = $pathname[$last]; // Making a correct name for the link.
$image = choose_image($filename);
$ext = explode('.', $filename);
$ext = strtolower($ext[sizeof($ext) - 1]);
$myrow['path'] = rawurlencode($myrow['path']);
$in_frames = in_array($ext, array('htm', 'html', 'gif', 'jpg', 'jpeg', 'png'));
$output = $filename;
break;
}
return stripslashes($output);
}
}
if (!function_exists('trim_value')) {

@ -19,10 +19,7 @@ api_protect_course_script();
/* Libraries */
require 'learnpath_functions.inc.php';
require 'resourcelinker.inc.php';
// Rewrite the language file, sadly overwritten by resourcelinker.inc.php.
/* Header and action code */
$currentstyle = api_get_setting('stylesheets');
$htmlHeadXtra[] = '<script>
function activate_start_date() {
@ -50,14 +47,7 @@ $isStudentView = isset($_REQUEST['isStudentView']) ? $_REQUEST['isStudentView']
$learnpath_id = isset($_REQUEST['lp_id']) ? $_REQUEST['lp_id'] : null;
/* MAIN CODE */
// Using the resource linker as a tool for adding resources to the learning path.
if ($action == 'add' && $type == 'learnpathitem') {
$htmlHeadXtra[] = "<script> window.location=\"../resourcelinker/resourcelinker.php?source_id=5&action=$action&learnpath_id=$learnpath_id&chapter_id=$chapter_id&originalresource=no\"; </script>";
}
if ((!$is_allowed_to_edit) || ($isStudentView)) {
//error_log('New LP - User not authorized in lp_add.php');
header('location:lp_controller.php?action=view&lp_id='.$learnpath_id);
exit;
}

@ -12,7 +12,6 @@ $this_section = SECTION_COURSES;
api_protect_course_script();
require_once 'learnpath_functions.inc.php';
require_once 'resourcelinker.inc.php';
$is_allowed_to_edit = api_is_allowed_to_edit(null, true);
@ -23,12 +22,6 @@ $submit = isset($_POST['submit_button']) ? $_POST['submit_button'] : null;
$type = isset($_GET['type']) ? $_GET['type'] : null;
$action = isset($_GET['action']) ? $_GET['action'] : null;
// Using the resource linker as a tool for adding resources to the learning path.
if ($action == 'add' && $type == 'learnpathitem') {
$htmlHeadXtra[] = "<script>
window.location=\"../resourcelinker/resourcelinker.php?source_id=5&action=$action&learnpath_id=$learnpath_id&chapter_id=$chapter_id&originalresource=no\";
</script>";
}
if ((!$is_allowed_to_edit) || ($isStudentView)) {
error_log('New LP - User not authorized in lp_add_item.php');
header('location:lp_controller.php?action=view&lp_id='.$learnpath_id);

@ -10,7 +10,6 @@ $this_section = SECTION_COURSES;
api_protect_course_script();
require 'learnpath_functions.inc.php';
require 'resourcelinker.inc.php';
$is_allowed_to_edit = api_is_allowed_to_edit(null, true);

@ -20,7 +20,6 @@ $this_section = SECTION_COURSES;
api_protect_course_script();
require_once 'learnpath_functions.inc.php';
require_once 'resourcelinker.inc.php';
/** @var learnpath $learnPath */
$learnPath = Session::read('oLP');
@ -74,10 +73,6 @@ $submit = isset($_POST['submit_button']) ? $_POST['submit_button'] : null;
$type = isset($_GET['type']) ? $_GET['type'] : null;
$action = isset($_GET['action']) ? $_GET['action'] : null;
// Using the resource linker as a tool for adding resources to the learning path.
if ($action == 'add' && $type == 'learnpathitem') {
$htmlHeadXtra[] = "<script type='text/javascript'> window.location=\"../resourcelinker/resourcelinker.php?source_id=5&action=$action&learnpath_id=$learnpath_id&chapter_id=$chapter_id&originalresource=no\"; </script>";
}
if (!$is_allowed_to_edit) {
error_log('New LP - User not authorized in lp_add_item.php');
header('location:lp_controller.php?action=view&lp_id='.$learnpath_id);

@ -18,8 +18,6 @@ api_protect_course_script();
/* Libraries */
include 'learnpath_functions.inc.php';
include 'resourcelinker.inc.php';
/* Constants and variables */
$is_allowed_to_edit = api_is_allowed_to_edit(null, true);
@ -31,10 +29,6 @@ $learnpath_id = (int)$_REQUEST['lp_id'];
$submit = isset($_POST['submit_button']) ? $_POST['submit_button'] : null;
$_course = api_get_course_info();
// Using the resource linker as a tool for adding resources to the learning path.
if ($action == 'add' and $type == 'learnpathitem') {
$htmlHeadXtra[] = "<script> window.location=\"../resourcelinker/resourcelinker.php?source_id=5&action=$action&learnpath_id=$learnpath_id&chapter_id=$chapter_id&originalresource=no\"; </script>";
}
if ((!$is_allowed_to_edit) || ($isStudentView)) {
error_log('New LP - User not authorized in lp_admin_view.php');
header('location:lp_controller.php?action=view&lp_id='.$learnpath_id);

@ -17,7 +17,6 @@ $this_section = SECTION_COURSES;
api_protect_course_script();
include 'learnpath_functions.inc.php';
include 'resourcelinker.inc.php';
/* Constants and variables */
@ -32,11 +31,6 @@ $learnpath_id = (int) $_REQUEST['lp_id'];
$submit = $_POST['submit_button'];
/* MAIN CODE */
// Using the resource linker as a tool for adding resources to the learning path.
if ($action=="add" and $type=="learnpathitem") {
$htmlHeadXtra[] = "<script language='JavaScript' type='text/javascript'> window.location=\"../resourcelinker/resourcelinker.php?source_id=5&action=$action&learnpath_id=$learnpath_id&chapter_id=$chapter_id&originalresource=no\"; </script>";
}
if ((!$is_allowed_to_edit) || ($isStudentView)) {
error_log('New LP - User not authorized in lp_build.php');
header('location:lp_controller.php?action=view&lp_id='.$learnpath_id);

@ -1021,6 +1021,7 @@ switch ($action) {
}
break;
case 'add_sub_item': // Add an item inside a dir/chapter.
// @todo check if this is @deprecated
if (!$is_allowed_to_edit) {
api_not_allowed(true);
}
@ -1032,7 +1033,6 @@ switch ($action) {
if (!empty($_REQUEST['parent_item_id'])) {
$_SESSION['from_learnpath'] = 'yes';
$_SESSION['origintoolurl'] = 'lp_controller.php?action=admin_view&lp_id='.intval($_REQUEST['lp_id']);
require 'resourcelinker.php';
} else {
require 'lp_admin_view.php';
}

@ -19,7 +19,6 @@ api_protect_course_script();
/* Libraries */
include 'learnpath_functions.inc.php';
include 'resourcelinker.inc.php';
/* Header and action code */
@ -70,13 +69,10 @@ $submit = isset($_POST['submit_button']) ? $_POST['submit_button'] : null;
/* MAIN CODE */
// Using the resource linker as a tool for adding resources to the learning path.
if ($action == 'add' && $type == 'learnpathitem') {
$htmlHeadXtra[] = "<script language='JavaScript' type='text/javascript'> window.location=\"../resourcelinker/resourcelinker.php?source_id=5&action=$action&learnpath_id=$learnpath_id&chapter_id=$chapter_id&originalresource=no\"; </script>";
}
if ((!$is_allowed_to_edit) || ($isStudentView)) {
error_log('New LP - User not authorized in lp_add_item.php');
header('location:lp_controller.php?action=view&lp_id='.$learnpath_id);
exit;
}
// From here on, we are admin because of the previous condition, so don't check anymore.
@ -148,7 +144,7 @@ $(document).ready(function() {
}, {
selector: '#doc_form'
});
$('.lp-btn-associate-forum').on('click', function (e) {
var associate = confirm('<?php echo get_lang('ConfirmAssociateForumToLPItem') ?>');

@ -16,7 +16,6 @@ api_protect_course_script();
/* Libraries */
include 'learnpath_functions.inc.php';
include 'resourcelinker.inc.php';
/* Constants and variables */
@ -31,14 +30,10 @@ $learnpath_id = isset($_REQUEST['lp_id']) ? (int) $_REQUEST['lp_id'] : null;
$submit = isset($_POST['submit_button']) ? $_POST['submit_button'] : null;
/* MAIN CODE */
// Using the resource linker as a tool for adding resources to the learning path.
if ($action == 'add' and $type == 'learnpathitem') {
$htmlHeadXtra[] = "<script> window.location=\"../resourcelinker/resourcelinker.php?source_id=5&action=$action&learnpath_id=$learnpath_id&chapter_id=$chapter_id&originalresource=no\"; </script>";
}
if ((!$is_allowed_to_edit) || ($isStudentView)) {
error_log('New LP - User not authorized in lp_edit_item_prereq.php');
header('location:lp_controller.php?action=view&lp_id=' . $learnpath_id);
exit;
}
$course_id = api_get_course_int_id();

@ -16,7 +16,6 @@ $this_section = SECTION_COURSES;
api_protect_course_script();
include 'learnpath_functions.inc.php';
include 'resourcelinker.inc.php';
/* Header and action code */
$htmlHeadXtra[] = '<script type="text/javascript">'.
@ -65,11 +64,6 @@ $learnpath_id = (int) $_REQUEST['lp_id'];
$submit = isset($_POST['submit_button']) ? $_POST['submit_button'] : '';
/* MAIN CODE */
// Using the resource linker as a tool for adding resources to the learning path.
if ($action == 'add' && $type == 'learnpathitem') {
$htmlHeadXtra[] = "<script type='text/javascript'> window.location=\"../resourcelinker/resourcelinker.php?source_id=5&action=$action&learnpath_id=$learnpath_id&chapter_id=$chapter_id&originalresource=no\"; </script>";
}
if ((!$is_allowed_to_edit) || ($isStudentView)) {
header('location:lp_controller.php?action=view&lp_id='.$learnpath_id);
}

@ -60,10 +60,6 @@ $tbl_lp_view = Database::get_course_table(TABLE_LP_VIEW);
$isStudentView = (empty($_REQUEST['isStudentView']) ? 0 : (int) $_REQUEST['isStudentView']);
$learnpath_id = (int) $_REQUEST['lp_id'];
// Using the resource linker as a tool for adding resources to the learning path.
if ($action == 'add' && $type == 'learnpathitem') {
$htmlHeadXtra[] = "<script> window.location=\"../resourcelinker/resourcelinker.php?source_id=5&action=$action&learnpath_id=$learnpath_id&chapter_id=$chapter_id&originalresource=no\"; </script>";
}
if ((!$is_allowed_to_edit) || $isStudentView) {
error_log('New LP - User not authorized in lp_view_item.php');
header('location:lp_controller.php?action=view&lp_id='.$learnpath_id);

File diff suppressed because it is too large Load Diff

@ -1,941 +0,0 @@
<?php
/* For licensing terms, see /license.txt */
/**
* @author Patrick Cool, original code
* @author Denes Nagy - many bugfixes and improvements, adjusted for learning path
* @author Roan Embrechts - refactoring, code cleaning
* @package chamilo.resourcelinker
* @todo reorganise code,
* use Database API instead of creating table names locally.
*/
// Flag to allow for anonymous user - needs to be set before global.inc.php.
use ChamiloSession as Session;
$use_anonymous = true;
require_once '../inc/global.inc.php';
$this_section = SECTION_COURSES;
api_protect_course_script();
/* Libraries */
include 'resourcelinker.inc.php';
/* Constants and variables */
$link_table = Database :: get_course_table(TABLE_LINK);
$item_property_table = Database :: get_course_table(TABLE_ITEM_PROPERTY);
$tbl_lp = Database::get_course_table(TABLE_LP_MAIN);
$tbl_lp_item = Database::get_course_table(TABLE_LP_ITEM);
$action = $_REQUEST['action'];
$add = $_REQUEST['add'];
$chapter_id = $_REQUEST['parent_item_id'];
$content = $_REQUEST['content'];
// Note by Patrick Cool: This has been solved belowd. This piece of code hacking produced too much errors.
/*
if (empty($content)) {
// Adds a default to the item-type selection.
$content = 'Document';
}
*/
$folder = $_REQUEST['folder'];
$id = $_REQUEST['id'];
$learnpath_id = $_REQUEST['lp_id'];
$originalresource = $_REQUEST['originalresource'];
$show_resources = $_REQUEST['show_resources'];
$source_forum = $_REQUEST['source_forum'];
$source_id = $_REQUEST['source_id'];
$target = $_REQUEST['target'];
$external_link = $_REQUEST['external_link'];
$from_learnpath = $_SESSION['from_learnpath'];
// This variable controls wether the link to add a dir/chapter in a module or
// another dir/chapter is shown. This allows to create multi-level learnpaths,
// but export features are not ready for this, yet, so use at your own risks
// default : false -> do not display link
// This setting should be moved to the platform configuration page in time...
$multi_level_learnpath = true;
/* MAIN CODE */
if ($from_learnpath == 'yes') {
// Start from clear every time in LearnPath Builder.
$_SESSION['addedresource'] = null;
$_SESSION['addedresourceid'] = null;
$_SESSION['addedresourceassigned'] = null;
unset ($_SESSION['addedresource']);
unset ($_SESSION['addedresourceid']);
unset ($_SESSION['addedresourceassigned']);
}
$course_id = api_get_course_int_id();
// Process a new dir/chapter?
if (!empty ($_POST['add_dir']) && !empty ($_POST['title'])) {
$title = $_POST['title'];
$description = '';
/*if (!empty ($_POST['description'])) {
$description = $_POST['description'];
}*/
// Get max display_order so far in this parent dir/chapter.
$sql = "SELECT MAX(display_order) as maxi FROM $tbl_lp_item " .
"WHERE c_id = $course_id AND lp_id = $learnpath_id ".
" AND parent_item_id = $chapter_id";
$res = Database::query($sql);
$row = Database::fetch_array($res);
$lastorder_item = $row['maxi'];
if (empty($lastorder_item)) {
$lastorder_item = 0;
$previous = 0;
} else {
$sql = "SELECT id FROM $tbl_lp_item " .
"WHERE lp_id = $learnpath_id AND parent_item_id=$chapter_id AND display_order = $lastorder_item";
$result = Database::query($sql);
$row = Database::fetch_array($result);
$previous = $row['id'];
}
$order = $lastorder_item + 1;
$sql = "INSERT INTO $tbl_lp_item "."(c_id, lp_id,item_type,title,parent_item_id,previous_item_id, next_item_id, display_order) " .
"VALUES "."($course_id, $learnpath_id,'dir','$title', $chapter_id, $previous, 0, $order )";
//error_log('New LP - Inserting new resource: '.$sql, 0);
$res = Database::query($sql);
$my_id = Database::insert_id($res);
if ($previous > 0) {
$sql = "UPDATE $tbl_lp_item SET next_item_id = $my_id WHERE id=$previous";
$res = Database::query($sql);
}
if ($res !== false) {
$title = '';
$description = '';
}
$resource_added = true;
}
// This if when a external link is submitted.
if (!empty ($_POST['external_link_submit'])) {
if ($external_link == '' || $external_link == 'http://') {
$InvalidURL = 1;
} else {
$add = true;
if ($add_2_links != 'niet toevoegen') {
// Add external link to the links table.
$pos = strpos($external_link, 'ttp:');
if ($pos == '') {
$external_link = 'http://'.$external_link;
}
$sql = "INSERT INTO $link_table (c_id, url, title, category_id)
VALUES ($course_id, '$external_link','$external_link','$add_2_links')";
$result = Database::query($sql);
$addedresource[] = "Link";
$addedresourceid[] = Database::insert_id();
$_SESSION['addedresource'] = $addedresource;
$_SESSION['addedresourceid'] = $addedresourceid;
} else {
// Do not add external link to the links table.
$addedresource[] = "Externallink";
$addedresourceid[] = $external_link;
$_SESSION['addedresource'] = $addedresource;
$_SESSION['addedresourceid'] = $addedresourceid;
}
}
}
// Loading the session variables into local array.
$addedresource = $_SESSION['addedresource'];
$addedresourceid = $_SESSION['addedresourceid'];
// This is when a resource was added to the session.
if ($add) {
// Adding the new variable to the local array.
if (empty($_POST['external_link_submit'])) {
// That case is already arranged, see upwards.
$addedresource[] = $content;
$addedresourceid[] = $add;
}
$addedresourceassigned[] = 0;
// Loading the local array into the session variable.
$_SESSION['addedresource'] = $addedresource;
$_SESSION['addedresourceid'] = $addedresourceid;
// We assign to dirs/chapters immediately!
$resource_added = false;
if ($from_learnpath == 'yes') {
$i = 0;
// Calculating the last order of the items of this dir/chapter.
$sql = "SELECT MAX(display_order) as maxi FROM $tbl_lp_item " .
"WHERE c_id = $course_id AND lp_id = $learnpath_id AND parent_item_id=$chapter_id";
$result = Database::query($sql);
$row = Database::fetch_array($result);
$lastorder_item = $row['maxi'];
if (empty($lastorder_item)) {
$lastorder_item = 0;
$previous = 0;
} else {
$sql = "SELECT id FROM $tbl_lp_item " .
"WHERE lp_id = $learnpath_id AND parent_item_id=$chapter_id AND display_order = $lastorder_item";
//error_log('New LP - resourcelinker.php - '.$sql, 0);
$result = Database::query($sql);
$row = Database::fetch_array($result);
$previous = $row['id'];
}
$lastorder = $lastorder_item + 1;
foreach ($addedresource as $addedresource_item) {
// In the case we added a dir/chapter, add this into the dirs/chapters list with the correct parent_id.
if ($addedresource_item == 'Chap') {
$sql = "INSERT INTO $tbl_lp_item " .
"(c_id, lp_id,item_type,title,parent_item_id,previous_item_id,next_item_id,display_order) " .
"VALUES ($course_id, ".$learnpath_id.",'dir','".$learnpath_chapter_name."',".$chapter_id.",$previous,0,".$lastorder.")";
//error_log('New LP - Inserting new resource: '.$sql, 0);
$res = Database::query($sql);
$my_id = Database::insert_id($res);
if ($previous > 0) {
$sql = "UPDATE $tbl_lp_item SET next_item_id = $my_id WHERE id=$previous";
$res = Database::query($sql);
}
}
if (!$addedresourceassigned[$i]) {
// Not to assign it twice
switch ($addedresource_item) {
case 'Assignment':
case 'Ass':
//set tool type
$addedresource_item = 'Assignments';
$title = get_lang('Assignments');
break;
case 'Drop':
//$addedresource_item = 'Dropbox';
$addedresource_item = TOOL_DROPBOX;
$title = get_lang('Dropbox');
break;
case 'Intro':
$addedresource_item = 'Introduction_text';
//$addedresource_item = TOOL_INTRO;
$title = get_lang('IntroductionText');
break;
case 'Course_desc':
//$addedresource_item = 'Course_description';
$addedresource_item = TOOL_COURSE_DESCRIPTION;
$title = get_lang('CourseDescription');
break;
case 'Group':
//$addedresource_item = 'Groups';
$addedresource_item = TOOL_GROUP;
$title = get_lang('Groups');
break;
case 'User':
//$addedresource_item = 'Users';
$addedresource_item = TOOL_USER;
$title = get_lang('Users');
break;
case 'Link':
/*
if ($target == '') {
$target = '_self';
}
*/
//$addedresource_item .= ' '.$target;
//error_log('New LP - resourcelinker.php - In Link addition: '.$external_link);
$addedresource_item = TOOL_LINK;
$title = $external_link;
break;
case 'Document':
$addedresource_item = TOOL_DOCUMENT;
//get title from tool-type table
$tooltable = Database::get_course_table(TABLE_DOCUMENT);
$result = Database::query("SELECT * FROM $tooltable WHERE id=".$addedresourceid[$i]);
$myrow = Database::fetch_array($result);
$title = $myrow['title'];
break;
case 'Exercise':
$addedresource_item = TOOL_QUIZ;
//get title from tool-type table
$tooltable = Database::get_course_table(TABLE_QUIZ_TEST);
$result = Database::query("SELECT * FROM $tooltable WHERE id=".$addedresourceid[$i]);
$myrow = Database::fetch_array($result);
$title = $myrow['title'];
break;
case 'Forum':
$addedresource_item = TOOL_FORUM;
//TODO
break;
case 'Agenda':
$addedresource_item = TOOL_CALENDAR_EVENT;
//get title from tool-type table
$tooltable = Database::get_course_table(TABLE_AGENDA);
$result = Database::query("SELECT * FROM $tooltable WHERE id=".$addedresourceid[$i]);
$myrow = Database::fetch_array($result);
$title = $myrow['title'];
break;
case 'Ad_Valvas':
$addedresource_item = TOOL_ANNOUNCEMENT;
//get title from tool-type table
$tooltable = Database::get_course_table(TABLE_ANNOUNCEMENT);
$result = Database::query("SELECT * FROM $tooltable WHERE id=".$addedresourceid[$i]);
$myrow = Database::fetch_array($result);
$title = $myrow['title'];
break;
}
$sql = "INSERT INTO $tbl_lp_item (c_id, lp_id, title, parent_item_id, item_type, ref, previous_item_id, next_item_id, display_order) " .
"VALUES ($course_id, $learnpath_id, '$title','$chapter_id', '$addedresource_item','$addedresourceid[$i]',$previous,0,'".$lastorder."')";
//error_log('New LP - Inserting new resource: '.$sql, 0);
$result = Database::query($sql);
$my_id = Database::insert_id($result);
if ($previous > 0) {
$sql = "UPDATE $tbl_lp_item SET next_item_id = $my_id WHERE id = $previous";
//error_log($sql, 0);
$res = Database::query($sql);
}
$addedresourceassigned[$i] = 1;
$resource_added = true;
}
$i ++;
$lastorder ++;
}
//$_SESSION['addedresource']=null;
//$_SESSION['addedresourceid']=null;
// cleaning up the session once again
$_SESSION['addedresource'] = null;
$_SESSION['addedresourceid'] = null;
$_SESSION['addedresourceassigned'] = null;
unset ($_SESSION['addedresource']);
unset ($_SESSION['addedresourceid']);
unset ($_SESSION['addedresourceassigned']);
}
}
/*
BREADCRUMBS
This part is to allow going back to the tool where you came from
in a previous version I used the table tool_list, but since the forum can access the
resource_linker from two different pages (newtopic.php and editpost.php) and this is different
from the link field in tool_list, I decide to hardcode this stuff here.
By doing this, you can easily control which pages can access the toollinker and which not.
*/
if (isset($_SESSION['gradebook'])) {
$gradebook = $_SESSION['gradebook'];
}
if (!empty($gradebook) && $gradebook == 'view') {
$interbreadcrumb[] = array (
'url' => '../gradebook/'.$_SESSION['gradebook_dest'],
'name' => get_lang('ToolGradebook')
);
}
if ($_GET['source_id']) {
switch ($_GET['source_id']) {
case '1': // coming from Agenda
if ($action == 'edit') {
$url = "../calendar/agenda.php?action=edit&id=49&originalresource=$originalresource";
}
elseif ($action == 'add') {
$url = "../calendar/agenda.php?action=add&originalresource=$originalresource";
} else {
$url = "../calendar/agenda.php?action=add";
}
$originaltoolname = get_lang('Agenda');
$breadcrumbelement = array ('url' => $url, 'name' => $originaltoolname);
unset($_SESSION['from_learnpath']);
unset ($from_learnpath);
break;
case '2': // coming from forum: new topic
$url = "../phpbb/newtopic.php?forum=$source_forum&md5=$md5";
$originaltoolname = get_lang('ForumAddNewTopic');
$breadcrumbelement = array ('url' => $url, 'name' => $originaltoolname);
unset($_SESSION['from_learnpath']);
unset ($from_learnpath);
break;
case '3': // coming from forum: edit topic
$url = "../phpbb/editpost.php?post_id=$post_id&topic=$topic&forum=$forum&md5=$md5&originalresource=no";
$originaltoolname = get_lang('ForumEditTopic');
$breadcrumbelement = array ('url' => $url, 'name' => $originaltoolname);
unset($_SESSION['from_learnpath']);
unset ($from_learnpath);
break;
case '4': // coming from exercises: edit topic
$url = "../exercise/admin.php?modifyAnswers=$modifyAnswers";
$originaltoolname = get_lang('ExerciseAnswers');
$breadcrumbelement = array ('url' => $url, 'name' => $originaltoolname);
unset($_SESSION['from_learnpath']);
unset ($from_learnpath);
break;
case '5': // coming from learning path
$from_learnpath = 'yes';
Session::write('from_learnpath',$from_learnpath);
break;
/* end add Frederik.Vermeire@pandora.be */
}
// We do not come from the learning path. We store the name of the tool & url in a session.
if ($from_learnpath != 'yes') {
if (!$_SESSION['origintoolurl'] || $_SESSION['origintoolurl'] != $interbreadcrumb['url']) {
$_SESSION['origintoolurl'] = $breadcrumbelement['url'];
$_SESSION['origintoolname'] = $breadcrumbelement['name'];
$interbreadcrumb = '';
}
}
}
// This part of the code is the actual breadcrumb mechanism. If we do not come from the learning path we use
// the information from the session. Else we use the information of the learningpath itself.
if ($from_learnpath != 'yes') {
$nameTools = get_lang('Attachment');
$interbreadcrumb[] = array ('url' => $_SESSION['origintoolurl'], 'name' => $_SESSION['origintoolname']);
} else {
$learnpath_select_query = " SELECT * FROM $tbl_lp
WHERE id=$learnpath_id";
$sql_result = Database::query($learnpath_select_query);
$therow = Database::fetch_array($sql_result);
$learnpath_dir_query = " SELECT * FROM $tbl_lp_item
WHERE (lp_id = '$learnpath_id' and id = '$chapter_id')";
$sql_result = Database::query($learnpath_dir_query);
$therow2 = Database::fetch_array($sql_result);
$from_learnpath = 'yes';
$_SESSION['from_learnpath'] = $from_learnpath;
$interbreadcrumb[] = array ('url' => "../lp/lp_controller.php?action=list", 'name' => get_lang('LearningPath'));
$interbreadcrumb[] = array ('url' => "../lp/lp_controller.php?action=admin_view&lp_id=$learnpath_id", 'name' => stripslashes("{$therow['name']}"));
$interbreadcrumb[] = array ('url' => api_get_self()."?action=$action&lp_id=$learnpath_id&parent_item_id=$chapter_id&originalresource=no", 'name' => "{$therow2['title']}");
}
$htmlHeadXtra[] = '<script type="text/javascript">
/* <![CDATA[ */
function targetfunc(input)
{
window.location=window.location+"&amp;target="+document.learnpath_link.target.value;
}
/* ]]> */
</script>';
Display :: display_header($nameTools);
echo "<h3>".$nameTools;
if ($from_learnpath == 'yes') {
echo get_lang('AddResource')." - {$therow2['title']}";
}
echo "</h3>";
// We retrieve the tools that are active.
// We use this to check which resources a student may add (only the modules that are active).
// See http://www.dokeos.com/forum/viewtopic.php?t=4858
$active_modules = array();
$tool_table = Database::get_course_table(TABLE_TOOL_LIST);
$sql_select_active = "SELECT * FROM $tool_table WHERE visibility='1'";
$result_select_active = Database::query($sql_select_active);
while ($row = Database::fetch_array($result_select_active)) {
$active_modules[] = $row['name'];
}
?>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="300" valign="top" style='padding-right:15px;'>
<table width="300" border="0" cellspacing="0" cellpadding="0" style='border-right:1px solid grey;'>
<?php if ($from_learnpath != 'yes') { ?>
<tr>
<td width="26%"><b><?php echo get_lang('CourseResources'); ?></b></td>
</tr>
<?php
if (api_is_allowed_to_edit() || in_array(TOOL_DOCUMENT, $active_modules)) {
?>
<tr>
<td><?php echo "<a href=\"".api_get_self()."?content=Document&action=$action&id=$id&lp_id=$learnpath_id&parent_item_id=$chapter_id&source_forum=$source_forum&originalresource=no\">".get_lang('Documents')."</a>"; ?></td>
</tr>
<?php
}
if (api_is_allowed_to_edit() || in_array(TOOL_CALENDAR_EVENT, $active_modules)) {
?>
<tr>
<td><?php echo "<a href=\"".api_get_self()."?content=Agenda&action=$action&id=$id&lp_id=$learnpath_id&parent_item_id=$chapter_id&source_forum=$source_forum&originalresource=no\">".get_lang('Agenda')."</a>"; ?></td>
</tr>
<?php
}
if (api_is_allowed_to_edit() || in_array(TOOL_ANNOUNCEMENT, $active_modules)) {
?>
<tr>
<td><?php echo "<a href=\"".api_get_self()."?content=Ad_Valvas&action=$action&id=$id&lp_id=$learnpath_id&parent_item_id=$chapter_id&source_forum=$source_forum&originalresource=no\">".get_lang('AdValvas')."</a>"; ?></td>
</tr>
<?php
}
if (api_is_allowed_to_edit() || in_array(TOOL_BB_FORUM, $active_modules)) {
?>
<tr>
<td><?php echo "<a href=\"".api_get_self()."?content=Forum&action=$action&id=$id&lp_id=$learnpath_id&parent_item_id=$chapter_id&source_forum=$source_forum&originalresource=no\">".get_lang('Forum')."</a>"; ?></td>
</tr>
<?php
}
if (api_is_allowed_to_edit() || in_array(TOOL_LINK, $active_modules)) {
?>
<tr>
<td><?php echo "<a href=\"".api_get_self()."?content=Link&action=$action&id=$id&lp_id=$learnpath_id&parent_item_id=$chapter_id&source_forum=$source_forum&originalresource=no\">".get_lang('Links')."</a>"; ?></td>
</tr>
<?php
}
if (api_is_allowed_to_edit() || in_array(TOOL_QUIZ, $active_modules)) {
?>
<tr>
<td><?php echo "<a href=\"".api_get_self()."?content=Exercise&action=$action&id=$id&lp_id=$learnpath_id&parent_item_id=$chapter_id&source_forum=$source_forum&originalresource=no\">".get_lang('Exercise')."</a>"; ?></td>
</tr>
<?php
}
} else {
?>
<!--tr>
<td width="26%"><b><?php echo get_lang('ExportableCourseResources'); ?></b></td>
</tr-->
<?php if ($multi_level_learnpath === true ) { ?>
<tr>
<td><?php echo "<a href=\"".api_get_self()."?content=dir&action=$action&id=$id&lp_id=$learnpath_id&parent_item_id=$chapter_id&source_forum=$source_forum&originalresource=no\">".get_lang('Chapter')."</a>"; ?></td>
</tr>
<?php } ?>
<tr>
<td><?php echo "<a href=\"".api_get_self()."?content=Document&action=$action&id=$id&lp_id=$learnpath_id&parent_item_id=$chapter_id&source_forum=$source_forum&originalresource=no\">".get_lang('Document')."</a>"; ?></td>
</tr>
<tr>
<td><?php echo "<a href=\"".api_get_self()."?content=Exercise&action=$action&id=$id&lp_id=$learnpath_id&parent_item_id=$chapter_id&source_forum=$source_forum&originalresource=no\">".get_lang('Exercise')."</a>"; ?></td>
</tr>
<tr>
<td><?php echo "<a href=\"".api_get_self()."?content=Link&action=$action&id=$id&lp_id=$learnpath_id&parent_item_id=$chapter_id&source_forum=$source_forum&originalresource=no\">".get_lang('Link')."</a>"; ?></td>
</tr>
<tr>
<td><?php echo "<a href=\"".api_get_self()."?content=Forum&action=$action&id=$id&lp_id=$learnpath_id&parent_item_id=$chapter_id&source_forum=$source_forum&originalresource=no\">".get_lang('Forum')."</a>"; ?></td>
</tr>
<tr>
<td><?php echo "<a href=\"".api_get_self()."?content=Agenda&action=$action&id=$id&lp_id=$learnpath_id&parent_item_id=$chapter_id&source_forum=$source_forum&originalresource=no\">".get_lang('Agenda')."</a>"; ?></td>
</tr>
<tr>
<td><?php echo "<a href=\"".api_get_self()."?content=Ad_Valvas&action=$action&id=$id&lp_id=$learnpath_id&parent_item_id=$chapter_id&source_forum=$source_forum&originalresource=no\">".get_lang('AdValvas')."</a>"; ?></td>
</tr>
<!--tr>
<td><?php echo "<a href=\"".api_get_self()."?content=Course_description&action=$action&lp_id=$learnpath_id&parent_item_id=$chapter_id&source_forum=$source_forum&originalresource=no\">".get_lang('CourseDescription')."</a>"; ?></td>
</tr-->
<!--tr>
<td><?php echo "<a href=\"".api_get_self()."?content=Introduction_text&action=$action&lp_id=$learnpath_id&parent_item_id=$chapter_id&source_forum=$source_forum&originalresource=no\">".get_lang('IntroductionText')."</a>"; ?></td>
</tr-->
<!--tr>
<td>&nbsp;</td>
</tr-->
<!--tr>
<td width="26%"><b><?php echo get_lang('LMSRelatedCourseMaterial'); ?></b></td>
</tr-->
<tr>
<td><?php echo "<a href=\"".api_get_self()."?content=Dropbox&action=$action&lp_id=$learnpath_id&parent_item_id=$chapter_id&source_forum=$source_forum&originalresource=no\">".get_lang('Dropbox')."</a>"; ?></td>
</tr>
<tr>
<td><?php echo "<a href=\"".api_get_self()."?content=Assignment&action=$action&lp_id=$learnpath_id&parent_item_id=$chapter_id&source_forum=$source_forum&originalresource=no\">".get_lang('Assignments')."</a>"; ?></td>
</tr>
<tr>
<td><?php echo "<a href=\"".api_get_self()."?content=Groups&action=$action&lp_id=$learnpath_id&parent_item_id=$chapter_id&source_forum=$source_forum&originalresource=no\">".get_lang('Groups')."</a>"; ?></td>
</tr>
<tr>
<td><?php echo "<a href=\"".api_get_self()."?content=Users&action=$action&lp_id=$learnpath_id&parent_item_id=$chapter_id&source_forum=$source_forum&originalresource=no\">".get_lang('Users')."</a>"; ?></td>
</tr>
<?php
}
?>
<!--tr>
<td>&nbsp;</td>
</tr-->
<!--tr>
<td><b><?php echo get_lang('ExternalResources'); ?></b></td>
</tr-->
<tr>
<td><?php echo "<a href=\"".api_get_self()."?content=Externallink&action=$action&id=$id&lp_id=$learnpath_id&parent_item_id=$chapter_id&source_forum=$source_forum&originalresource=no\">".get_lang('ExternalLink')."</a>"; ?></td>
</tr>
<?php
if ($from_learnpath != 'yes') {
echo "<tr><td>&nbsp;</td></tr>";
echo "<tr><td><b>".get_lang('ResourcesAdded')." (";
echo count($addedresource);
echo ")</b></td></tr>";
echo "<tr><td nowrap><a href=\"".api_get_self()."?showresources=true&action=$action&id=$id&lp_id=$learnpath_id&parent_item_id=$chapter_id&source_forum=$source_forum&originalresource=no\">".get_lang('ShowDelete')."</a>";
echo "</td></tr>";
}
?>
<tr>
<td>&nbsp;</td>
</tr>
<!--<tr>
<td><b><?php echo get_lang('BackTo'); ?></b></td>
</tr>//-->
<tr>
<td>
<?php
if ($from_learnpath != 'yes') {
echo "<form method=\"post\" action=\"{$_SESSION['origintoolurl']}\" style=\"margin: 0px;\"><input type=\"submit\" value=\"".' '.get_lang('Ok').' '."\"></form>";
} else {
echo "<form method=\"get\" action=\"lp_controller.php\" style=\"margin: 0px;\"><input type=\"hidden\" name=\"lp_id\" value=\"".htmlentities($learnpath_id)."\"><input type=\"hidden\" name=\"action\" value=\"admin_view\"><input type=\"submit\" value=\"".' '.get_lang('Ok').' '."\"></form>";
}
?>
</td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
</table>
</td>
<td valign="top">
<?php
if ($resource_added) {
Display :: display_normal_message(get_lang('ResourceAdded'));
}
if ($InvalidURL) {
Display :: display_normal_message(get_lang('GiveURL'));
}
if ($from_learnpath != 'yes') {
echo count($addedresource)." ".strtolower(get_lang('ResourcesAdded'))."<br />";
}
//echo "<hr />";
// Agenda items -->
if ($content == 'Agenda') {
$TABLEAGENDA = Database::get_course_table(TABLE_AGENDA);
$TABLE_ITEM_PROPERTY = Database::get_course_table(TABLE_ITEM_PROPERTY);
$sql = "SELECT agenda.*, toolitemproperties.*
FROM ".$TABLEAGENDA." agenda, ".$TABLE_ITEM_PROPERTY." toolitemproperties
WHERE
agenda.id = toolitemproperties.ref
AND toolitemproperties.tool='".TOOL_CALENDAR_EVENT."'
AND (toolitemproperties.to_group_id='0' OR toolitemproperties.to_group_id IS NULL)
AND toolitemproperties.visibility='1'";
$result = Database::query($sql);
while ($myrow = Database::fetch_array($result)) {
echo "<table width=\"100%\"><tr><td bgcolor=\"#E6E6E6\">";
echo "<img src='../img/agenda.gif' alt='agenda'>";
echo api_convert_and_format_date($myrow['start_date'], null, date_default_timezone_get())."<br />";
echo "<b>".$myrow['title']."</b></td></tr><tr><td>";
echo $myrow['content']."<br />";
showorhide_addresourcelink($content, $myrow['id']);
echo "</td></tr></table><br />";
}
} // end if ($_GET['resource'] == 'Agenda')
/* Chapter */
if ($content == 'dir') {
echo '<table><form name="add_dir" action="'.'" method="POST">'."\n";
echo ' <tr><td>'.get_lang('Title').'</td><td><input type="text" name="title" value="'.$title.'"></input></td></tr>'."\n";
echo ' <tr><td>'.get_lang('Description').'</td><td><input type="text" name="description" value="'.$description.'"></input></td></tr>'."\n";
echo ' <tr><td></td><td><input type="submit" name="add_dir" value="'.get_lang('AddIt').'"/></td></tr>'."\n";
echo '</form></table>'."\n";
//echo "<hr />";
}
/* Documents */
// We show the documents in the following cases
// 1. the link to add documenets in the resource linker was clicked
// 2. we come to the resource linker for the first time (documents = default). In this case it can only be shown if
// a. one is a teacher (documents can be shown even if the tool is inactive)
// b. one is a student AND the documents tool is active. Student cannot add documents if the documents tool is inactive (teacher can do this)
if ($content == 'Document' || (empty($content) && (api_is_allowed_to_edit() || in_array(TOOL_DOCUMENT, $active_modules))) && !$_GET['showresources']) {
// setting variables for file locations
$baseServDir = $_configuration['root_sys'];
$courseDir = $_course['path'].'/document';
$baseWorkDir = $baseServDir.$courseDir;
// showing the link to move one folder up (when not in the root folder)
show_folder_up($chapter_id);
// showing the blue bar with the path in it when we are not in the root
if (get_levels($folder)) {
echo "<table width=\"100%\"><tr><td bgcolor=\"#4171B5\">";
echo "<img src=\"../img/opendir.gif\" alt='directory'><font color=\"#ffffff\"><b>";
echo $folder."</b></font></td></tr></table>";
}
// Showing the documents and subfolders of the folder we are in.
show_documents($folder, $chapter_id);
//echo "<hr />";
}
/* Ad Valvas */
if ($content == 'Ad_Valvas') {
$tbl_announcement = Database :: get_course_table(TABLE_ANNOUNCEMENT);
$sql = "SELECT * FROM ".$tbl_announcement." a, ".$item_property_table." i
WHERE
i.tool = '".TOOL_ANNOUNCEMENT."' AND
a.id=i.ref AND
i.visibility='1' AND
(i.to_group_id = 0 OR i.to_group_id IS NULL) AND
i.to_user_id IS NULL
ORDER BY a.display_order ASC";
//error_log($sql, 0);
$result = Database::query($sql);
while ($myrow = Database::fetch_array($result)) {
echo "<table width=\"100%\"><tr><td>";
echo "<img src='../img/valves.gif' alt='advalvas'>";
echo api_convert_and_format_date($myrow['end_date'], DATE_FORMAT_LONG, date_default_timezone_get());
echo "</td></tr><tr><td>";
echo $myrow['title']."<br />";
showorhide_addresourcelink($content, $myrow['id']);
echo "</td></tr></table>";
}
}
/* Forums */
if ($content == 'Forum') {
$TBL_FORUMS = Database::get_course_table(TABLE_FORUM);
$TBL_CATAGORIES = Database::get_course_table(TABLE_FORUM_CATEGORY);
$TBL_FORUMTOPICS = Database::get_course_table(TABLE_FORUM_THREAD);
$tbl_posts = Database::get_course_table(TABLE_FORUM_POST);
echo "<table width='100%'>";
// Displaying the categories and the forums.
if (!$forum and !$thread) {
$sql = "SELECT * FROM ".$TBL_FORUMS." forums, ".$TBL_CATAGORIES." categories WHERE forums.forum_category=categories.cat_id ORDER BY forums.forum_category DESC";
//error_log($sql, 0);
$result = Database::query($sql);
while ($myrow = Database::fetch_array($result)) {
if ($myrow['cat_title'] !== $old_cat_title) {
echo "<tr><td bgcolor='#4171B5' colspan='2'><font color='white'><b>".$myrow['cat_title']."</b></font></td></tr>";
}
$old_cat_title = $myrow['cat_title'];
echo "<tr><td><img src='../img/forum.gif'><a href='".api_get_self()."?content=Forum&category=".$myrow['cat_id']."&forum=".$myrow['forum_id']."&action=$action&lp_id=$learnpath_id&parent_item_id=$chapter_id&originalresource=no'>".$myrow['forum_name']."</td><td>";
showorhide_addresourcelink('Forum', $myrow['forum_id']);
echo "</td></tr>";
}
}
// Displaying all the threads of one forum.
if ($forum) {
// Displaying the category title.
$sql = "SELECT * FROM ".$TBL_CATAGORIES." WHERE cat_id=$category";
$result = Database::query($sql);
$myrow = Database::fetch_array($result);
echo "<tr><td bgcolor='#4171B5' colspan='2'><font color='white'><b>".$myrow['cat_title']."</b></font></td></tr>";
// Displaying the forum title.
$sql = "SELECT * FROM ".$TBL_FORUMS." forums, ".$TBL_FORUMTOPICS." topics WHERE forums.forum_id=topics.forum_id";
$result = Database::query($sql);
$myrow = Database::fetch_array($result);
echo "<tr><td bgcolor='#cccccc' colspan='2'><b>".$myrow['forum_name']."</b></td></tr>";
if (!$thread) {
// Displaying all the threads of this forum.
$sql = "SELECT * FROM ".$TBL_FORUMTOPICS." WHERE forum_id=$forum";
$result = Database::query($sql);
while ($myrow = Database::fetch_array($result)) {
echo "<tr><td><a href='".api_get_self()."?content=Forum&category=$category&forum=1&thread=".$myrow['topic_id']."&action=$action&lp_id=$learnpath_id&parent_item_id=$chapter_id&originalresource=no'>".$myrow['topic_title']."</a> (".$myrow['prenom']." ".$myrow['nom'].")</td><td>";
showorhide_addresourcelink("Thread", $myrow['topic_id']);
echo "</td></tr>";
}
} else {
// Displaying all the replies.
$sql = "SELECT * FROM ".$tbl_posts." post WHERE post.topic_id=$thread ORDER BY post.post_id ASC";
$result = Database::query($sql);
while ($myrow = Database::fetch_array($result)) {
echo "<tr><td><b>".$myrow['post_title']."</b><br />";
echo $myrow['post_text']."</td>";
echo "<td>";
showorhide_addresourcelink('Post', $myrow['post_id']);
echo "</td></tr><tr><td colspan='2'><hr noshade></td></tr>";
}
}
}
echo "</table>";
}
/* Links */
if ($content == 'Link') {
// Including the links language file.
include "../lang/$language/link.inc.php";
$tbl_categories = Database::get_course_table(TABLE_LINK_CATEGORY);
if (($learnpath_id != '') and ($content == 'Link')) {
echo "<form name='learnpath_link'><table>";
echo "<tr></td><td align='left'>".get_lang('LinkTarget')." :</td><td align='left'><select name='target' onchange='javascript: targetfunc();'><option value='_self' ";
if ($target == '_self') {
echo "selected";
}
echo ">".get_lang('SameWindow')."</option><option value='_blank'";
if ($target == '_blank') {
echo "selected";
}
echo ">".get_lang('NewWindow')."</option></select></td></tr></table></form>";
}
// Showing the links that are in the root (having no category).
$sql = "SELECT * FROM ".$link_table." l, ".$item_property_table." ip WHERE (l.category_id=0 or l.category_id IS NULL) AND ip.tool = '".TOOL_LINK."' AND l.id=ip.ref AND ip.visibility='1'";
$result = Database::query($sql);
if (Database::num_rows($result) > 0) {
echo "<table width=\"100%\"><tr><td bgcolor=\"#E6E6E6\"><i>".get_lang('NoCategory')."</i></td></tr></table>";
while ($myrow = Database::fetch_array($result)) {
echo "<img src='../img/links.gif'>".$myrow['title'];
echo "<br />";
showorhide_addresourcelink($content, $myrow['id']);
echo "<br /><br />";
}
}
// Showing the categories and the links in it.
$sqlcategories = "SELECT * FROM ".$tbl_categories." ORDER by display_order DESC";
$resultcategories = Database::query($sqlcategories) or die;
while ($myrow = @Database::fetch_array($resultcategories)) {
$sql_links = "SELECT * FROM ".$link_table." l, ".$item_property_table." ip WHERE l.category_id='".$myrow['id']."' AND ip.tool = '".TOOL_LINK."' AND l.id=ip.ref AND ip.visibility='1' ORDER BY l.display_order DESC";
echo "<table width=\"100%\"><tr><td bgcolor=\"#E6E6E6\"><i>".$myrow['category_title']."</i></td></tr></table>";
$result_links = Database::query($sql_links);
while ($myrow = Database::fetch_array($result_links)) {
echo "<img src='../img/links.gif' />".$myrow['title'];
echo "<br />";
showorhide_addresourcelink($content, $myrow['id']);
echo "<br /><br />";
}
}
}
/* Exercise */
if (($content == 'Exercise') || ($content == 'HotPotatoes')) {
$TBL_EXERCICES = Database::get_course_table(TABLE_QUIZ_TEST);
$result = Database::query("SELECT * FROM ".$TBL_EXERCICES." WHERE active='1' ORDER BY id ASC");
while ($myrow = Database::fetch_array($result)) {
echo "<img src='../img/quiz.gif'>".$myrow['title']."<br />";
showorhide_addresourcelink($content, $myrow["id"]);
echo "<br /><br />";
}
if ($from_learnpath == 'yes') {
$uploadPath = '/HotPotatoes_files';
$TBL_DOCUMENT = Database::get_course_table(TABLE_DOCUMENT);
$documentPath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document';
$sql = "SELECT * FROM ".$TBL_DOCUMENT." WHERE (path LIKE '%htm%' OR path LIKE '%html%') AND path LIKE '".$uploadPath."/%/%' ORDER BY id ASC";
$result = Database::query($sql);
while ($myrow = Database::fetch_array($result)) {
$path = $myrow['path'];
echo "<img src='../img/jqz.jpg'>".GetQuizName($path, $documentPath)."<br />";
showorhide_addresourcelink('HotPotatoes', $myrow['id']);
echo "<br /><br />";
}
}
}
/* External Links */
if ($content == 'Externallink') {
?>
<form name="form1" method="post" action="">
<table width="80%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="right"><?php echo get_lang('ExternalLink'); ?> : &nbsp;</td>
<td align="left"><input name="external_link" type="text" id="external_link" value="http://"></td>
<?php
if ($learnpath_id != '') {
echo "</tr><tr><td align='right'>".get_lang('LinkTarget')." :</td><td align='left'><select name='target'><option value='_self'>".get_lang('SameWindow')."</option><option value='_blank'>".get_lang('NewWindow')."</option></select></td>";
}
?>
</tr>
<tr>
<td><?php if ($is_allowedToEdit) {echo get_lang('AddToLinks');} ?></td>
<td>
<?php if ($is_allowedToEdit){?>
<select name="add_2_links" id="add_2_links">
<option value="niet toevoegen" selected="selected">-<?php echo get_lang('DontAdd'); ?>-</option>
<option value="0"><?php echo get_lang('MainCategory'); ?></option>
<?php
$tbl_categories = Database::get_course_table(TABLE_LINK_CATEGORY);
$sql = "SELECT * FROM $tbl_categories ORDER BY display_order ASC";
echo $sql;
$result = Database::query($sql);
while ($row = Database::fetch_array($result)) {
echo "<option value='".$row['id']."'>".$row['category_title']."</option>";
}
?>
</select><?php } ?></td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input name="external_link_submit" type="submit" id="external_link_submit" value="<?php echo get_lang('AddIt'); ?>"></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td colspan="2">&nbsp;</td>
</tr>
</table>
</form>
<?php
}
/* Assignments */
if ($content == 'Assignment') {
echo "<a href=".api_get_self()."?content=Ass&add=Ass&action=$action&lp_id=$learnpath_id&parent_item_id=$chapter_id&originalresource=no>".get_lang('AddAssignmentPage')."</a>";
}
/* Dropbox */
if ($content == 'Dropbox') {
echo "<a href='".api_get_self()."?content=Drop&add=Drop&action=$action&lp_id=$learnpath_id&parent_item_id=$chapter_id&originalresource=no'>".get_lang('DropboxAdd')."</a>";
}
/* Introduction text */
if ($content == 'Introduction_text') {
echo "<a href='".api_get_self()."?content=Intro&add=Intro&action=$action&lp_id=$learnpath_id&parent_item_id=$chapter_id&originalresource=no'>".get_lang('IntroductionTextAdd')."</a>";
}
/* Course description */
if ($content == 'Course_description') {
echo "<a href='".api_get_self()."?content=Course_desc&add=Course_desc&action=$action&lp_id=$learnpath_id&parent_item_id=$chapter_id&originalresource=no'>".get_lang('CourseDescriptionAdd')."</a>";
}
/* Groups */
if ($content == 'Groups') {
echo "<a href='".api_get_self()."?content=Group&add=Group&action=$action&lp_id=$learnpath_id&parent_item_id=$chapter_id&originalresource=no'>".get_lang('GroupsAdd')."</a>";
}
/* Users */
if ($content == 'Users') {
echo "<a href='".api_get_self()."?content=User&add=User&action=$action&lp_id=$learnpath_id&parent_item_id=$chapter_id&originalresource=no'>".get_lang('UsersAdd')."</a>";
}
if ($showresources) {
//echo "<h4>".get_lang('ResourceAdded')."</h4>";
display_resources(1);
}
echo "</td></tr></table>";
/* FOOTER */
Display :: display_footer();

@ -29,6 +29,7 @@ class ScriptHandler
{
$paths = [
__DIR__.'/../../../../archive/',
__DIR__.'/../../../../main/announcements/resources',
__DIR__.'/../../../../main/conference/',
__DIR__.'/../../../../main/course_notice/',
__DIR__.'/../../../../main/metadata/',
@ -60,7 +61,6 @@ class ScriptHandler
__DIR__.'/../../../../main/inc/lib/pchart/',
__DIR__.'/../../../../main/inc/lib/pclzip/',
__DIR__.'/../../../../main/inc/lib/htmlpurifier',
__DIR__.'/../../../../main/announcements/resources',
__DIR__.'/../../../../main/resourcelinker',
//Remove from 1.10
__DIR__.'/../../../../plugin/ticket',
@ -75,28 +75,43 @@ class ScriptHandler
__DIR__.'/../../../../main/admin/group_add.php',
__DIR__.'/../../../../main/admin/group_edit.php',
__DIR__.'/../../../../main/admin/group_list.php',
__DIR__.'/../../../../main/admin/admin_page.class.php',
__DIR__.'/../../../../main/admin/system_management.php',
__DIR__.'/../../../../main/announcements/resources/announcements.inc.php',
__DIR__.'/../../../../main/exercice/addlimits.php',
__DIR__.'/../../../../main/announcements/resources/announcements_email.class.php',
__DIR__.'/../../../../main/auth/external_login/facebook-php-sdk/src/base_facebook.php',
__DIR__.'/../../../../main/auth/external_login/facebook-php-sdk/src/facebook.php',
__DIR__.'/../../../../main/auth/external_login/facebook-php-sdk/src/base_facebook.php',
__DIR__.'/../../../../main/course_description/ajax_controller.class.php',
__DIR__.'/../../../../main/course_description/controller.class.php',
__DIR__.'/../../../../main/course_description/course_description.class.php',
__DIR__.'/../../../../main/course_description/course_description_form.class.php',
__DIR__.'/../../../../main/course_description/course_description_repository.class.php',
__DIR__.'/../../../../main/course_description/course_description_type.class.php',
__DIR__.'/../../../../main/course_description/course_description_type_repository.class.php',
__DIR__.'/../../../../main/course_description/course_import.class.php',
__DIR__.'/../../../../main/course_description/csv_reader.class.php',
__DIR__.'/../../../../main/course_description/csv_writer.class.php',
__DIR__.'/../../../../main/course_description/request.class.php',
__DIR__.'/../../../../main/course_description/upload_file_form.class.php',
__DIR__.'/../../../../main/calendar/agenda.inc.php',
__DIR__.'/../../../../main/calendar/agenda.lib.php',
__DIR__.'/../../../../main/announcements/resources/announcements_email.class.php',
__DIR__.'/../../../../main/inc/lib/main_api.lib.php',
__DIR__.'/../../../../main/exercice/addlimits.php',
__DIR__.'/../../../../main/exercice/testcategory.class.php',
__DIR__.'/../../../../main/exercice/export/scorm/scorm_export.php',
__DIR__.'/../../../../main/exercice/testheaderpage.php',
__DIR__.'/../../../../main/inc/lib/main_api.lib.php',
//__DIR__.'/../../../../main/inc/lib/nusoap/class.soapclient.php',
__DIR__.'/../../../../main/inc/lib/nusoap/nusoap.php',
__DIR__.'/../../../../main/admin/admin_page.class.php',
__DIR__.'/../../../../main/inc/lib/autoload.class.php',
__DIR__.'/../../../../main/inc/autoload.inc.php',
__DIR__.'/../../../../main/inc/lib/uri.class.php',
__DIR__.'/../../../../main/inc/lib/db.class.php',
__DIR__.'/../../../../main/install/i_database.class.php',
__DIR__.'/../../../../main/inc/lib/phpmailer/test/phpmailerTest.php',
__DIR__.'/../../../../main/inc/lib/xht.lib.php',
__DIR__.'/../../../../main/inc/lib/xmd.lib.php',
__DIR__.'/../../../../main/inc/lib/entity.class.php',
__DIR__.'/../../../../main/inc/lib/entity_repository.class.php',
__DIR__.'/../../../../main/install/install.class.php',
__DIR__.'/../../../../main/inc/lib/javascript.class.php',
__DIR__.'/../../../../main/inc/lib/course.class.php',
__DIR__.'/../../../../main/inc/lib/document.class.php',
@ -108,7 +123,6 @@ class ScriptHandler
__DIR__.'/../../../../main/inc/lib/response.class.php',
__DIR__.'/../../../../main/inc/lib/result_set.class.php',
__DIR__.'/../../../../main/inc/lib/session_handler.class.php',
__DIR__.'/../../../../main/exercice/testcategory.class.php',
__DIR__.'/../../../../main/inc/lib/WCAG/WCAG_rendering.php',
__DIR__.'/../../../../main/inc/lib/zip.class.php',
__DIR__.'/../../../../main/inc/lib/student_publication.class.php',
@ -123,22 +137,8 @@ class ScriptHandler
__DIR__.'/../../../../main/inc/lib/system/web/request_server.class.php',
__DIR__.'/../../../../main/inc/lib/page.class.php',
__DIR__.'/../../../../main/inc/lib/mail.lib.inc.php',
__DIR__.'/../../../../main/admin/system_management.php',
__DIR__.'/../../../../main/auth/external_login/facebook-php-sdk/src/base_facebook.php',
__DIR__.'/../../../../main/course_description/ajax_controller.class.php',
__DIR__.'/../../../../main/course_description/controller.class.php',
__DIR__.'/../../../../main/course_description/course_description.class.php',
__DIR__.'/../../../../main/course_description/course_description_form.class.php',
__DIR__.'/../../../../main/course_description/course_description_repository.class.php',
__DIR__.'/../../../../main/course_description/course_description_type.class.php',
__DIR__.'/../../../../main/course_description/course_description_type_repository.class.php',
__DIR__.'/../../../../main/course_description/course_import.class.php',
__DIR__.'/../../../../main/course_description/csv_reader.class.php',
__DIR__.'/../../../../main/course_description/csv_writer.class.php',
__DIR__.'/../../../../main/course_description/request.class.php',
__DIR__.'/../../../../main/course_description/upload_file_form.class.php',
__DIR__.'/../../../../main/auth/external_login/facebook-php-sdk/src/facebook.php',
__DIR__.'/../../../../main/auth/external_login/facebook-php-sdk/src/base_facebook.php',
__DIR__.'/../../../../main/install/i_database.class.php',
__DIR__.'/../../../../main/install/install.class.php',
__DIR__.'/../../../../main/inc/latex.php',
__DIR__.'/../../../../main/inc/lib/formvalidator/Element/calendar_popup.php',
__DIR__.'/../../../../main/inc/lib/formvalidator/Element/datepicker.php',
@ -150,6 +150,8 @@ class ScriptHandler
__DIR__.'/../../../../main/inc/lib/formvalidator/Element/style_reset_button.php',
__DIR__.'/../../../../main/inc/lib/formvalidator/Element/style_submit_button.php',
__DIR__.'/../../../../main/inc/lib/formvalidator/Element/tbl_change.js.php',
__DIR__.'/../../../../main/lp/resourcelinker.php',
__DIR__.'/../../../../main/lp/resourcelinker.inc.php',
__DIR__.'/../../../../src/Chamilo/CoreBundle/Entity/GroupRelGroup.php',
__DIR__.'/../../../../src/Chamilo/CoreBundle/Entity/GroupRelTag.php',
__DIR__.'/../../../../src/Chamilo/CoreBundle/Entity/GroupRelUser.php',

@ -136,7 +136,6 @@ class CourseBuilder
$courseCode = '',
$with_base_content = false
) {
$table_link = Database:: get_course_table(TABLE_LINKED_RESOURCES);
$table_properties = Database:: get_course_table(TABLE_ITEM_PROPERTY);
$course = api_get_course_info($courseCode);
$courseId = $course['real_id'];
@ -153,25 +152,6 @@ class CourseBuilder
);
}
//TABLE_LINKED_RESOURCES is the "resource" course table, which is deprecated, apparently
foreach ($this->course->resources as $type => $resources) {
foreach ($resources as $id => $resource) {
$sql = "SELECT * FROM $table_link
WHERE
c_id = $courseId AND
source_type = '".$resource->get_type()."' AND
source_id = '".$resource->get_id()."'";
$res = Database::query($sql);
while ($link = Database::fetch_object($res)) {
$this->course->resources[$type][$id]->add_linked_resource(
$link->resource_type,
$link->resource_id
);
}
}
}
// Once we've built the resources array a bit more, try to get items
// from the item_property table and order them in the "resources" array
foreach ($this->course->resources as $type => $resources) {

@ -49,7 +49,6 @@ class CourseRecycler
}
$table_tool_intro = Database::get_course_table(TABLE_TOOL_INTRO);
$table_linked_resources = Database::get_course_table(TABLE_LINKED_RESOURCES);
$table_item_properties = Database::get_course_table(TABLE_ITEM_PROPERTY);
$this->type = $backupType;
@ -73,14 +72,8 @@ class CourseRecycler
foreach ($this->course->resources as $type => $resources) {
foreach ($resources as $id => $resource) {
$sql = "DELETE FROM $table_linked_resources
WHERE
c_id = ".$this->course_id." AND
(source_type = '".$type."' AND source_id = '".$id."') OR
(resource_type = '".$type."' AND resource_id = '".$id."') ";
Database::query($sql);
if (is_numeric($id)) {
$sql = "DELETE FROM ".$table_item_properties."
$sql = "DELETE FROM $table_item_properties
WHERE c_id = ".$this->course_id." AND tool ='".$resource->get_tool()."' AND ref=".$id;
Database::query($sql);
} elseif ($type == RESOURCE_TOOL_INTRO) {

Loading…
Cancel
Save