Minor - format code use (int)

pull/2585/head
Julio 8 years ago
parent 85b509b86a
commit 0679040ea2
  1. 18
      main/inc/lib/document.lib.php
  2. 5
      main/work/add_document.php

@ -1317,10 +1317,10 @@ class DocumentManager
return false;
}
$session_id = empty($session_id) ? api_get_session_id() : intval($session_id);
$session_id = empty($session_id) ? api_get_session_id() : (int) $session_id;
$www = api_get_path(WEB_COURSE_PATH).$course_info['path'].'/document';
$TABLE_DOCUMENT = Database::get_course_table(TABLE_DOCUMENT);
$id = intval($id);
$id = (int) $id;
$sessionCondition = api_get_session_condition($session_id, true, true);
$sql = "SELECT * FROM $TABLE_DOCUMENT
@ -3321,7 +3321,7 @@ class DocumentManager
api_get_user_id()
);
if ($showInvisibleFiles == false) {
if ($showInvisibleFiles === false) {
if (!$is_visible) {
continue;
}
@ -3342,7 +3342,7 @@ class DocumentManager
} else {
if (is_array($parentData)) {
$documents[$parentData['title']] = [
'id' => intval($folderId),
'id' => (int) $folderId,
'files' => $newResources,
];
}
@ -3361,15 +3361,15 @@ class DocumentManager
);
$return .= $write_result;
if ($lp_id == false) {
$url = api_get_path(WEB_AJAX_PATH).'lp.ajax.php?a=get_documents&url='.$overwrite_url.'&lp_id='.$lp_id.'&cidReq='.$course_info['code'];
if ($lp_id === false) {
$url = api_get_path(WEB_AJAX_PATH).
'lp.ajax.php?a=get_documents&url='.$overwrite_url.'&lp_id='.$lp_id.'&cidReq='.$course_info['code'];
$return .= "<script>
$('.doc_folder').click(function() {
var realId = this.id;
var my_id = this.id.split('_')[2];
var tempId = 'temp_'+my_id;
$('#res_'+my_id).show();
var tempDiv = $('#'+realId).find('#'+tempId);
if (tempDiv.length == 0) {
$.ajax({
@ -3391,7 +3391,6 @@ class DocumentManager
$('.lp_resource').remove();
$('.document_preview_container').html('');
});
</script>";
} else {
//For LPs
@ -3414,7 +3413,6 @@ class DocumentManager
image.attr('src', '".Display::returnIconPath('nolines_minus.gif')."');
$('#'+id).hide();
$('#'+tempId).show();
var tempDiv = $('#'+parentId).find('#'+tempId);
if (tempDiv.length == 0) {
$.ajax({
@ -3495,7 +3493,7 @@ class DocumentManager
$return .= '</div>';
$return .= '</ul>';
} else {
if ($resource['filetype'] == 'folder') {
if ($resource['filetype'] === 'folder') {
$return .= self::parseFolder($folderId, $resource, $lp_id);
} else {
$return .= self::parseFile(

@ -6,8 +6,8 @@ require_once 'work.lib.php';
$current_course_tool = TOOL_STUDENTPUBLICATION;
$workId = isset($_GET['id']) ? intval($_GET['id']) : null;
$docId = isset($_GET['document_id']) ? intval($_GET['document_id']) : null;
$workId = isset($_GET['id']) ? (int) $_GET['id'] : null;
$docId = isset($_GET['document_id']) ? (int) $_GET['document_id'] : null;
$action = isset($_GET['action']) ? $_GET['action'] : null;
if (empty($workId)) {
@ -51,7 +51,6 @@ switch ($action) {
if (empty($docId)) {
Display::display_header(null);
$documents = getAllDocumentToWork($workId, api_get_course_int_id());
if (!empty($documents)) {
echo Display::page_subheader(get_lang('DocumentsAdded'));

Loading…
Cancel
Save