added resources from course outside a session inside the course in a session - partial BT#570

skala
Cristian Fasanando 15 years ago
parent d13eb61118
commit a0b1e45ff8
  1. 5
      main/inc/lib/document.lib.php
  2. 15
      main/inc/lib/main_api.lib.php

@ -524,9 +524,8 @@ class DocumentManager {
//condition for the session
$current_session_id = api_get_session_id();
$condition_session = " AND (id_session = '$current_session_id' OR (id_session = '0' AND insert_date <= (SELECT creation_date FROM $TABLE_COURSE WHERE code = '{$_course[id]}')))";
$sql = "SELECT *
$condition_session = " AND (id_session = '$current_session_id' OR id_session = '0')";
$sql = "SELECT docs.id, docs.filetype, docs.path, docs.title, docs.comment, docs.size, docs.readonly, last.visibility
FROM ".$TABLE_ITEMPROPERTY." AS last, ".$TABLE_DOCUMENT." AS docs
WHERE docs.id = last.ref
AND docs.path LIKE '".$path.$added_slash."%'

@ -1575,23 +1575,16 @@ function api_get_session_image($session_id, $status_id) {
* @return string condition of the session
*/
function api_get_session_condition($session_id, $state = true, $both = false) {
$session_id = intval($session_id);
//condition to show resources by session
$condition_session = '';
$condition_add = $state == false ? " WHERE " : " AND ";
if ($session_id > 0) {
if (api_is_session_in_category($session_id,'20091U') || $both) {
$condition_session = $condition_add . " ( session_id = ".(int)$session_id." OR session_id = 0 ) ";
} else {
$condition_session = $condition_add . " session_id = ".(int)$session_id." ";
}
$condition_add = $state == false ? " WHERE " : " AND ";
if ($session_id > 0) {
$condition_session = $condition_add."(session_id = ".(int)$session_id." OR session_id = 0)";
} else {
$condition_session = $condition_add . " session_id = 0 ";
$condition_session = $condition_add."session_id = 0";
}
return $condition_session;
}
/**

Loading…
Cancel
Save