diff --git a/main/coursecopy/recycle_course.php b/main/coursecopy/recycle_course.php index f5a4823df4..63fc11cd5e 100755 --- a/main/coursecopy/recycle_course.php +++ b/main/coursecopy/recycle_course.php @@ -18,7 +18,7 @@ api_protect_course_script(true); // Check access rights (only teachers are allowed here) if (!api_is_allowed_to_edit()) { - api_not_allowed(true); + api_not_allowed(true); } // Section for the tabs @@ -63,9 +63,7 @@ if (Security::check_token('post') && ( } $cr = new CourseRecycler($course); $cr->recycle($recycle_type); - Display::display_confirmation_message(get_lang('RecycleFinished')); - } elseif (Security::check_token('post') && ( isset($_POST['recycle_option']) && $_POST['recycle_option'] == 'select_items' diff --git a/main/inc/lib/link.lib.php b/main/inc/lib/link.lib.php index 053edc330a..34c4fef700 100755 --- a/main/inc/lib/link.lib.php +++ b/main/inc/lib/link.lib.php @@ -805,11 +805,11 @@ class Link extends Model $sql = "SELECT *, linkcat.id FROM $tblLinkCategory linkcat - INNER JOIN $tblItemProperty itemproperties - ON (linkcat.id = itemproperties.ref AND linkcat.c_id = itemproperties.c_id) + INNER JOIN $tblItemProperty ip + ON (linkcat.id = ip.ref AND linkcat.c_id = ip.c_id) WHERE - itemproperties.tool = '" . TOOL_LINK_CATEGORY . "' AND - (itemproperties.visibility = '0' OR itemproperties.visibility = '1') + ip.tool = '" . TOOL_LINK_CATEGORY . "' AND + (ip.visibility = '0' OR ip.visibility = '1') $sessionCondition AND linkcat.c_id = " . $courseId . " ORDER BY linkcat.display_order DESC"; @@ -831,11 +831,11 @@ class Link extends Model $sql = "SELECT DISTINCT linkcat.*, visibility FROM $tblLinkCategory linkcat - INNER JOIN $tblItemProperty itemproperties - ON (linkcat.id = itemproperties.ref AND linkcat.c_id = itemproperties.c_id) + INNER JOIN $tblItemProperty ip + ON (linkcat.id = ip.ref AND linkcat.c_id = ip.c_id) WHERE - itemproperties.tool = '" . TOOL_LINK_CATEGORY . "' AND - (itemproperties.visibility = '0' OR itemproperties.visibility = '1') + ip.tool = '" . TOOL_LINK_CATEGORY . "' AND + (ip.visibility = '0' OR ip.visibility = '1') $sessionCondition AND linkcat.c_id = " . $courseId . " ORDER BY linkcat.display_order DESC @@ -863,17 +863,19 @@ class Link extends Model // Condition for the session. $condition_session = api_get_session_condition($session_id, true, true, 'link.session_id'); $content = ''; - $sql = "SELECT *, link.id FROM $tbl_link link - INNER JOIN $TABLE_ITEM_PROPERTY itemproperties - ON (link.id=itemproperties.ref AND link.c_id = itemproperties.c_id) + $sql = "SELECT *, link.id + FROM $tbl_link link + INNER JOIN $TABLE_ITEM_PROPERTY ip + ON (link.id=ip.ref AND link.c_id = ip.c_id) WHERE - itemproperties.tool='" . TOOL_LINK . "' AND + ip.tool='" . TOOL_LINK . "' AND link.category_id='" . $catid . "' AND - (itemproperties.visibility='0' OR itemproperties.visibility='1') + (ip.visibility='0' OR ip.visibility='1') $condition_session AND link.c_id = " . $course_id . " AND - itemproperties.c_id = " . $course_id . " + ip.c_id = " . $course_id . " ORDER BY link.display_order ASC"; + $result = Database:: query($sql); $numberoflinks = Database:: num_rows($result); if ($numberoflinks > 0) { @@ -1498,8 +1500,6 @@ class Link extends Model public static function listLinksAndCategories($course_id, $session_id, $categoryId, $show = 'none', $token = null) { $tbl_link = Database::get_course_table(TABLE_LINK); - - $_user = api_get_user_info(); $categoryId = intval($categoryId); /* Action Links */ @@ -1544,7 +1544,6 @@ class Link extends Model // Validation when belongs to a session $showChildren = $categoryId == $myrow['id'] || $show == 'all'; - $session_img = api_get_session_image($myrow['session_id'], $_user['status']); $myrow['description'] = $myrow['description']; $strVisibility = ''; diff --git a/src/Chamilo/CourseBundle/Component/CourseCopy/Course.php b/src/Chamilo/CourseBundle/Component/CourseCopy/Course.php index 618e940f41..692adec0f1 100644 --- a/src/Chamilo/CourseBundle/Component/CourseCopy/Course.php +++ b/src/Chamilo/CourseBundle/Component/CourseCopy/Course.php @@ -40,7 +40,7 @@ class Course if (is_array($resources)) { foreach ($resources as $resource) { Resource::setClassType($resource); - if ($resource->links_to($resource_to_check) ) { + if ($resource->links_to($resource_to_check)) { return true; } if ($type == RESOURCE_LEARNPATH && get_class($resource)=='CourseCopyLearnpath') { @@ -85,7 +85,7 @@ class Course */ public function show() { - + } /** diff --git a/src/Chamilo/CourseBundle/Component/CourseCopy/CourseRecycler.php b/src/Chamilo/CourseBundle/Component/CourseCopy/CourseRecycler.php index 34034015ac..ff7f3b7bdb 100644 --- a/src/Chamilo/CourseBundle/Component/CourseCopy/CourseRecycler.php +++ b/src/Chamilo/CourseBundle/Component/CourseCopy/CourseRecycler.php @@ -330,7 +330,7 @@ class CourseRecycler { $link_cat_table = Database :: get_course_table(TABLE_LINK_CATEGORY); $link_table = Database :: get_course_table(TABLE_LINK); - $sql = "SELECT lc.id FROM ".$link_cat_table." lc + $sql = "SELECT lc.id FROM $link_cat_table lc LEFT JOIN ".$link_table." l ON lc.id=l.category_id AND diff --git a/src/Chamilo/CourseBundle/Component/CourseCopy/CourseRestorer.php b/src/Chamilo/CourseBundle/Component/CourseCopy/CourseRestorer.php index 3f6da4afec..61e1808f01 100644 --- a/src/Chamilo/CourseBundle/Component/CourseCopy/CourseRestorer.php +++ b/src/Chamilo/CourseBundle/Component/CourseCopy/CourseRestorer.php @@ -1307,15 +1307,14 @@ class CourseRestorer if (is_object($link_cat) && !$link_cat->is_restored()) { $sql = "SELECT MAX(display_order) FROM $link_cat_table WHERE c_id = ".$this->destination_course_id; - $result=Database::query($sql); - list($orderMax)=Database::fetch_array($result,'NUM'); - $display_order=$orderMax+1; + $result = Database::query($sql); + list($orderMax) = Database::fetch_array($result, 'NUM'); + $display_order = $orderMax + 1; $params['c_id'] = $this->destination_course_id; $params['category_title'] = self::DBUTF8($link_cat->title); $params['description'] = self::DBUTF8($link_cat->description); $params['display_order'] = $display_order; - $new_id = Database::insert($link_cat_table, $params); if ($new_id) {