Fix link category c_item_property error see BT#13149

pull/2487/head
jmontoyaa 8 years ago
parent 4b7dace513
commit 74e6f39bc3
  1. 5
      main/inc/lib/api.lib.php
  2. 31
      main/inc/lib/link.lib.php

@ -6815,11 +6815,6 @@ function api_set_default_visibility(
}
$groupInfo = GroupManager::get_group_properties($group_id);
$groupIid = 0;
if ($groupInfo) {
$groupIid = $groupInfo['iid'];
}
$original_tool_id = $tool_id;
switch ($tool_id) {

@ -96,8 +96,6 @@ class Link extends Model
$sql = "UPDATE ".$this->table." SET id = iid WHERE iid = $id";
Database:: query($sql);
api_set_default_visibility($id, TOOL_LINK);
api_item_property_update(
$course_info,
TOOL_LINK,
@ -105,6 +103,8 @@ class Link extends Model
'LinkAdded',
api_get_user_id()
);
api_set_default_visibility($id, TOOL_LINK);
}
return $id;
@ -356,6 +356,14 @@ class Link extends Model
// add link_category visibility
// course ID is taken from context in api_set_default_visibility
//api_set_default_visibility($linkId, TOOL_LINK_CATEGORY);
api_item_property_update(
$_course,
TOOL_LINK_CATEGORY,
$linkId,
'LinkCategoryAdded',
api_get_user_id()
);
api_set_default_visibility($linkId, TOOL_LINK_CATEGORY);
}
@ -792,6 +800,7 @@ class Link extends Model
$tblLinkCategory = Database::get_course_table(TABLE_LINK_CATEGORY);
$tblItemProperty = Database::get_course_table(TABLE_ITEM_PROPERTY);
$courseId = intval($courseId);
$courseInfo = api_get_course_info_by_id($courseId);
// Condition for the session.
$sessionCondition = api_get_session_condition(
@ -834,7 +843,14 @@ class Link extends Model
foreach ($categories as & $category) {
if (!isset($categoryInItemProperty[$category['id']])) {
api_set_default_visibility($category['id'], TOOL_LINK_CATEGORY);
api_item_property_update(
$courseInfo,
TOOL_LINK_CATEGORY,
$category['id'],
'LinkCategoryAdded',
api_get_user_id()
);
//api_set_default_visibility($category['id'], TOOL_LINK_CATEGORY);
}
}
@ -1583,8 +1599,13 @@ class Link extends Model
* @param string $show
* @param null $token
*/
public static function listLinksAndCategories($course_id, $session_id, $categoryId, $show = 'none', $token = null)
{
public static function listLinksAndCategories(
$course_id,
$session_id,
$categoryId,
$show = 'none',
$token = null
) {
$tbl_link = Database::get_course_table(TABLE_LINK);
$tblCIP = Database::get_course_table(TABLE_ITEM_PROPERTY);
$categoryId = intval($categoryId);

Loading…
Cancel
Save