From 5f88378b950bcfe519b6053a4e0955b52cf32b5c Mon Sep 17 00:00:00 2001
From: Angel Fernando Quiroz Campos
Date: Fri, 26 May 2017 12:14:57 -0500
Subject: [PATCH] Minor - Format code
---
main/document/document.php | 484 +++++++++++++++++++++----------------
1 file changed, 276 insertions(+), 208 deletions(-)
diff --git a/main/document/document.php b/main/document/document.php
index 7370de43ae..dcfcd16792 100755
--- a/main/document/document.php
+++ b/main/document/document.php
@@ -9,19 +9,19 @@ use ChamiloSession as Session;
* This script allows the user to manage files and directories on a remote http
* server.
* The user can : - navigate through files and directories.
- * - upload a file
- * - delete, copy a file or a directory
- * - edit properties & content (name, comments, html content)
+ * - upload a file
+ * - delete, copy a file or a directory
+ * - edit properties & content (name, comments, html content)
* The script is organised in four sections.
*
* 1) Execute the command called by the user
- * Note: somme commands of this section are organised in two steps.
- * The script always begins with the second step,
- * so it allows to return more easily to the first step.
+ * Note: somme commands of this section are organised in two steps.
+ * The script always begins with the second step,
+ * so it allows to return more easily to the first step.
*
- * Note (March 2004) some editing functions (renaming, commenting)
- * are moved to a separate page, edit_document.php. This is also
- * where xml and other stuff should be added.
+ * Note (March 2004) some editing functions (renaming, commenting)
+ * are moved to a separate page, edit_document.php. This is also
+ * where xml and other stuff should be added.
* 2) Define the directory to display
* 3) Read files and directories from the directory defined in part 2
* 4) Display all of that on an HTML page
@@ -67,9 +67,9 @@ if (!$allowUseTool) {
DocumentManager::removeGeneratedAudioTempFile();
if (
- isset($_SESSION['temp_realpath_image']) &&
- !empty($_SESSION['temp_realpath_image']) &&
- file_exists($_SESSION['temp_realpath_image'])
+ isset($_SESSION['temp_realpath_image'])
+ && !empty($_SESSION['temp_realpath_image'])
+ && file_exists($_SESSION['temp_realpath_image'])
) {
unlink($_SESSION['temp_realpath_image']);
}
@@ -109,15 +109,15 @@ $capturePluginInstalled = in_array('jcapture', $pluginList);
if ($capturePluginInstalled) {
$jcapturePath = api_get_path(WEB_PLUGIN_PATH).'jcapture/plugin_applet.php';
- $htmlHeadXtra[] = '';
+
+ ';
}
if (empty($courseInfo)) {
@@ -196,9 +196,10 @@ if (!empty($groupId)) {
);
// Allowed to upload?
- if ($isAllowedToEdit ||
- GroupManager::is_subscribed($userId, $group_properties) ||
- GroupManager::is_tutor_of_group($userId, $group_properties, $courseId)
+ if (
+ $isAllowedToEdit
+ || GroupManager::is_subscribed($userId, $group_properties)
+ || GroupManager::is_tutor_of_group($userId, $group_properties, $courseId)
) {
// Only course admin or group members can upload
$group_member_with_upload_rights = true;
@@ -222,10 +223,11 @@ $curdirpath = isset($_GET['curdirpath']) ? Security::remove_XSS($_GET['curdirpat
switch ($action) {
case 'delete_item':
- if ($isAllowedToEdit ||
- $group_member_with_upload_rights ||
- DocumentManager::is_my_shared_folder(api_get_user_id(), $curdirpath, $sessionId) ||
- DocumentManager::is_my_shared_folder(api_get_user_id(), $moveTo, $sessionId)
+ if (
+ $isAllowedToEdit
+ || $group_member_with_upload_rights
+ || DocumentManager::is_my_shared_folder(api_get_user_id(), $curdirpath, $sessionId)
+ || DocumentManager::is_my_shared_folder(api_get_user_id(), $moveTo, $sessionId)
) {
if (isset($_GET['deleteid'])) {
if (!$isAllowedToEdit) {
@@ -241,14 +243,7 @@ switch ($action) {
}
}
- if (DocumentManager::check_readonly(
- $courseInfo,
- api_get_user_id(),
- '',
- $_GET['deleteid'],
- true
- )
- ) {
+ if (DocumentManager::check_readonly($courseInfo, api_get_user_id(), '', $_GET['deleteid'], true)) {
api_not_allowed();
}
}
@@ -318,8 +313,10 @@ switch ($action) {
// Launch event
Event::event_download($document_data['url']);
// Check visibility of document and paths
- if (!($isAllowedToEdit || $group_member_with_upload_rights)
- && !DocumentManager::is_visible_by_id($document_id, $courseInfo, $sessionId, api_get_user_id())) {
+ if (
+ !($isAllowedToEdit || $group_member_with_upload_rights)
+ && !DocumentManager::is_visible_by_id($document_id, $courseInfo, $sessionId, api_get_user_id())
+ ) {
api_not_allowed(true);
}
$full_file_name = $base_work_dir.$document_data['path'];
@@ -358,9 +355,11 @@ switch ($action) {
//filter when I am into shared folder, I can download only my shared folder
if (DocumentManager::is_any_user_shared_folder($document_data['path'], $sessionId)) {
- if (DocumentManager::is_my_shared_folder(api_get_user_id(), $document_data['path'], $sessionId)
+ if (
+ DocumentManager::is_my_shared_folder(api_get_user_id(), $document_data['path'], $sessionId)
|| $isAllowedToEdit
- || api_is_platform_admin()) {
+ || api_is_platform_admin()
+ ) {
require 'downloadfolder.inc.php';
}
} else {
@@ -372,26 +371,27 @@ switch ($action) {
}
break;
case 'export_to_pdf':
- if (api_get_setting('students_export2pdf') == 'true' || $isAllowedToEdit || api_is_platform_admin()) {
+ if (
+ api_get_setting('students_export2pdf') == 'true'
+ || $isAllowedToEdit
+ || api_is_platform_admin()
+ ) {
$orientation = 'landscape';
$showHeaderAndFooter = true;
+
if ($is_certificate_mode) {
$orientation = api_get_configuration_value('certificate_pdf_orientation');
$showHeaderAndFooter = !api_get_configuration_value('hide_header_footer_in_certificate');
}
- DocumentManager::export_to_pdf(
- $document_id,
- $course_code,
- $orientation,
- $showHeaderAndFooter
- );
+ DocumentManager::export_to_pdf($document_id, $course_code, $orientation, $showHeaderAndFooter);
}
break;
case 'copytomyfiles':
// Copy a file to general my files user's
- if (api_get_setting('allow_my_files') == 'true' &&
- api_get_setting('users_copy_files') == 'true'
+ if (
+ api_get_setting('allow_my_files') == 'true'
+ && api_get_setting('users_copy_files') == 'true'
&& api_get_user_id() != 0
&& !api_is_anonymous()
) {
@@ -433,7 +433,8 @@ switch ($action) {
}
$file_link = Display::url(
get_lang('SeeFile'),
- api_get_path(WEB_CODE_PATH).'social/myfiles.php?'.api_get_cidreq_params($cidReq, $id_session, $gidReq).
+ api_get_path(WEB_CODE_PATH).'social/myfiles.php?'
+ .api_get_cidreq_params($cidReq, $id_session, $gidReq).
'&parent_id='.$parent_id
);
@@ -443,16 +444,18 @@ switch ($action) {
if (file_exists($copyfile)) {
$message = get_lang('CopyAlreadyDone').'
';
- $message .= ''.
- get_lang("No").
- ' '.
- ' | '.
- ''.
- get_lang('Yes').
- '
';
+ $message .= ''
+ .get_lang("No")
+ .' '
+ .' | '
+ .''
+ .get_lang('Yes')
+ .' ';
if (!isset($_GET['copy'])) {
Display::addFlash(Display::return_message($message, 'warning', false));
}
@@ -480,10 +483,12 @@ switch ($action) {
break;
case 'convertToPdf':
// PDF format as target by default
- $formatTarget = $_REQUEST['formatTarget'] ?
- strtolower(Security::remove_XSS($_REQUEST['formatTarget'])) : 'pdf';
- $formatType = $_REQUEST['formatType'] ?
- strtolower(Security::remove_XSS($_REQUEST['formatType'])) : 'text';
+ $formatTarget = $_REQUEST['formatTarget']
+ ? strtolower(Security::remove_XSS($_REQUEST['formatTarget']))
+ : 'pdf';
+ $formatType = $_REQUEST['formatType']
+ ? strtolower(Security::remove_XSS($_REQUEST['formatType']))
+ : 'text';
// Get the document data from the ID
$document_info = DocumentManager::get_document_data_by_id(
$document_id,
@@ -491,8 +496,7 @@ switch ($action) {
true,
$session_id
);
- $file = $sys_course_path.$courseInfo['directory'].
- '/document'.$document_info['path'];
+ $file = $sys_course_path.$courseInfo['directory'].'/document'.$document_info['path'];
$fileInfo = pathinfo($file);
if ($fileInfo['extension'] == $formatTarget) {
Display::addFlash(Display::return_message(
@@ -503,18 +507,13 @@ switch ($action) {
!(
in_array(
$fileInfo['extension'],
- DocumentManager::getJodconverterExtensionList(
- 'from',
- $formatType
- )
+ DocumentManager::getJodconverterExtensionList('from', $formatType)
)
- ) || !(
+ )
+ || !(
in_array(
$formatTarget,
- DocumentManager::getJodconverterExtensionList(
- 'to',
- $formatType
- )
+ DocumentManager::getJodconverterExtensionList('to', $formatType)
)
)
) {
@@ -523,9 +522,9 @@ switch ($action) {
'warning'
));
} else {
- $convertedFile = $fileInfo['dirname'].DIRECTORY_SEPARATOR.
- $fileInfo['filename'].'_from_'.$fileInfo['extension'].
- '.'.$formatTarget;
+ $convertedFile = $fileInfo['dirname'].DIRECTORY_SEPARATOR
+ .$fileInfo['filename'].'_from_'.$fileInfo['extension']
+ .'.'.$formatTarget;
$convertedTitle = $document_info['title'];
$obj = new OpenofficePresentation(true);
if (file_exists($convertedFile)) {
@@ -550,8 +549,10 @@ switch ($action) {
$gidReq = Security::remove_XSS($_GET['gidReq']);
$file_link = Display::url(
get_lang('SeeFile'),
- api_get_path(WEB_CODE_PATH).
- 'document/showinframes.php?'.api_get_cidreq_params($cidReq, $id_session, $gidReq).'&id='.current($result)
+ api_get_path(WEB_CODE_PATH)
+ .'document/showinframes.php?'
+ .api_get_cidreq_params($cidReq, $id_session, $gidReq)
+ .'&id='.current($result)
);
Display::addFlash(Display::return_message(
get_lang('CopyMade').' '.$file_link,
@@ -677,10 +678,10 @@ if (!$parent_id) {
$current_folder_id = $document_id;
// Show preview
-if (isset($_GET['curdirpath']) &&
- $_GET['curdirpath'] == '/certificates' &&
- isset($_GET['set_preview']) &&
- $_GET['set_preview'] == strval(intval($_GET['set_preview']))
+if (
+ isset($_GET['curdirpath']) && $_GET['curdirpath'] == '/certificates'
+ && isset($_GET['set_preview'])
+ && $_GET['set_preview'] == strval(intval($_GET['set_preview']))
) {
if (isset($_GET['set_preview'])) {
// Generate document HTML
@@ -772,12 +773,12 @@ function convertModal (id, format) {
$("." + format + "FormatType").show();
$("#convertSelect").change(function() {
var formatTarget = $(this).val();
- window.location.href = "'.
- api_get_self().'?'.api_get_cidreq().
- '&curdirpath='.$curdirpath.
- '&action=convertToPdf&formatTarget='.
- '" + formatTarget + "&id=" + id + "&'.
- api_get_cidreq().'&formatType=" + format;
+ window.location.href = "'
+ .api_get_self().'?'.api_get_cidreq()
+ .'&curdirpath='.$curdirpath
+ .'&action=convertToPdf&formatTarget='
+ .'" + formatTarget + "&id=" + id + "&'
+ .api_get_cidreq().'&formatType=" + format;
});
$("#convertModal").on("hidden", function(){
$("." + format + "FormatType").hide();
@@ -796,7 +797,10 @@ if ($groupId != 0 && $curdirpath == '/') {
//if (!$isAllowedToEdit || api_is_coach()) { before
if (!$isAllowedToEdit && api_is_coach()) {
- if ($curdirpath != '/' && !(DocumentManager::is_visible($curdirpath, $courseInfo, $sessionId, 'folder'))) {
+ if (
+ $curdirpath != '/'
+ && !(DocumentManager::is_visible($curdirpath, $courseInfo, $sessionId, 'folder'))
+ ) {
api_not_allowed(true);
}
}
@@ -887,12 +891,21 @@ $_SESSION['image_files_only'] = '';
$image_files_only = '';
if ($is_certificate_mode) {
- $interbreadcrumb[] = array('url' => '../gradebook/index.php', 'name' => get_lang('Gradebook'));
+ $interbreadcrumb[] = array(
+ 'url' => '../gradebook/index.php',
+ 'name' => get_lang('Gradebook')
+ );
} else {
if ((isset($_GET['id']) && $_GET['id'] != 0) || isset($_GET['curdirpath']) || isset($_GET['createdir'])) {
- $interbreadcrumb[] = array('url' => 'document.php', 'name' => get_lang('Documents'));
+ $interbreadcrumb[] = array(
+ 'url' => 'document.php',
+ 'name' => get_lang('Documents')
+ );
} else {
- $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('Documents'));
+ $interbreadcrumb[] = array(
+ 'url' => '#',
+ 'name' => get_lang('Documents')
+ );
}
}
@@ -904,7 +917,10 @@ if (empty($document_data['parents'])) {
'name' => $document_data['title'],
);
} else {
- $interbreadcrumb[] = array('url' => '#', 'name' => $document_data['title']);
+ $interbreadcrumb[] = array(
+ 'url' => '#',
+ 'name' => $document_data['title']
+ );
}
} else {
$counter = 0;
@@ -933,8 +949,10 @@ if (isset($_GET['createdir'])) {
$js_path = api_get_path(WEB_LIBRARY_PATH).'javascript/';
-$htmlHeadXtra[] = ' ';
-$htmlHeadXtra[] = '';
+$htmlHeadXtra[] = ' ';
+$htmlHeadXtra[] = '';
$mediaplayer_path = api_get_path(WEB_LIBRARY_PATH).'mediaplayer/player.swf';
$documentAndFolders = DocumentManager::get_all_document_data(
@@ -983,7 +1001,8 @@ if (!empty($documentAndFolders)) {
$extension = 'oga';
}
- $params = array('url' => $document_data['direct_url'],
+ $params = array(
+ 'url' => $document_data['direct_url'],
'extension' => $extension,
'count' => $count
);
@@ -994,12 +1013,14 @@ if (!empty($documentAndFolders)) {
}
}
-$htmlHeadXtra[] = '';
+$htmlHeadXtra[] = '
+
+';
// Lib for event log, stats & tracking & record of the access
Event::event_access_tool(TOOL_DOCUMENT);
@@ -1013,10 +1034,10 @@ $moveForm = '';
/* MOVE FILE OR DIRECTORY */
//Only teacher and all users into their group and each user into his/her shared folder
-if ($isAllowedToEdit ||
- $group_member_with_upload_rights ||
- DocumentManager::is_my_shared_folder(api_get_user_id(), $curdirpath, $sessionId) ||
- DocumentManager::is_my_shared_folder(api_get_user_id(), $moveTo, $sessionId)
+if (
+ $isAllowedToEdit || $group_member_with_upload_rights
+ || DocumentManager::is_my_shared_folder(api_get_user_id(), $curdirpath, $sessionId)
+ || DocumentManager::is_my_shared_folder(api_get_user_id(), $moveTo, $sessionId)
) {
if (isset($_GET['move']) && $_GET['move'] != '') {
$my_get_move = intval($_REQUEST['move']);
@@ -1051,8 +1072,9 @@ if ($isAllowedToEdit ||
);
// filter if is my shared folder. TODO: move this code to build_move_to_selector function
- if (DocumentManager::is_my_shared_folder(api_get_user_id(), $curdirpath, $sessionId) &&
- !$isAllowedToEdit
+ if (
+ DocumentManager::is_my_shared_folder(api_get_user_id(), $curdirpath, $sessionId)
+ && !$isAllowedToEdit
) {
//only main user shared folder
$main_user_shared_folder_main = '/shared_folder/sf_user_'.api_get_user_id();
@@ -1060,7 +1082,10 @@ if ($isAllowedToEdit ||
$user_shared_folders = array();
foreach ($folders as $fold) {
- if ($main_user_shared_folder_main == $fold || preg_match($main_user_shared_folder_sub, $fold)) {
+ if (
+ $main_user_shared_folder_main == $fold
+ || preg_match($main_user_shared_folder_sub, $fold)
+ ) {
$user_shared_folders[] = $fold;
}
}
@@ -1176,9 +1201,9 @@ if ($isAllowedToEdit ||
/* DELETE FILE OR DIRECTORY */
//Only teacher and all users into their group
-if ($isAllowedToEdit ||
- $group_member_with_upload_rights ||
- DocumentManager::is_my_shared_folder(api_get_user_id(), $curdirpath, $sessionId)
+if (
+ $isAllowedToEdit || $group_member_with_upload_rights
+ || DocumentManager::is_my_shared_folder(api_get_user_id(), $curdirpath, $sessionId)
) {
if (isset($_POST['action']) && isset($_POST['ids'])) {
$files = $_POST['ids'];
@@ -1214,7 +1239,10 @@ if ($isAllowedToEdit ||
null,
$sessionId
)) {
- $messages .= Display::return_message(get_lang('VisibilityChanged').': '.$data['title'], 'confirmation');
+ $messages .= Display::return_message(
+ get_lang('VisibilityChanged').': '.$data['title'],
+ 'confirmation'
+ );
} else {
$messages .= Display::return_message(get_lang('ViModProb'), 'error');
}
@@ -1233,7 +1261,10 @@ if ($isAllowedToEdit ||
null,
$sessionId
)) {
- $messages .= Display::return_message(get_lang('VisibilityChanged').': '.$data['title'], 'confirmation');
+ $messages .= Display::return_message(
+ get_lang('VisibilityChanged').': '.$data['title'],
+ 'confirmation'
+ );
} else {
$messages .= Display::return_message(get_lang('ViModProb'), 'error');
}
@@ -1246,13 +1277,14 @@ if ($isAllowedToEdit ||
foreach ($files as $id) {
if (!$isAllowedToEdit) {
if (DocumentManager::check_readonly(
- $courseInfo,
- api_get_user_id(),
- null,
- $id,
- false,
- $sessionId
- )) {
+ $courseInfo,
+ api_get_user_id(),
+ null,
+ $id,
+ false,
+ $sessionId
+ )
+ ) {
$messages .= Display::return_message(
get_lang('CantDeleteReadonlyFiles'),
'error'
@@ -1293,9 +1325,9 @@ $dirForm = '';
/* CREATE DIRECTORY */
//Only teacher and all users into their group and any user into his/her shared folder
-if ($isAllowedToEdit ||
- $group_member_with_upload_rights ||
- DocumentManager::is_my_shared_folder(api_get_user_id(), $curdirpath, $sessionId)
+if (
+ $isAllowedToEdit || $group_member_with_upload_rights
+ || DocumentManager::is_my_shared_folder(api_get_user_id(), $curdirpath, $sessionId)
) {
// Create directory with $_POST data
if (isset($_POST['create_dir']) && $_POST['dirname'] != '') {
@@ -1369,8 +1401,9 @@ if ($isAllowedToEdit ||
/* VISIBILITY COMMANDS */
if ($isAllowedToEdit) {
- if ((isset($_GET['set_invisible']) && !empty($_GET['set_invisible'])) ||
- (isset($_GET['set_visible']) && !empty($_GET['set_visible']))
+ if (
+ (isset($_GET['set_invisible']) && !empty($_GET['set_invisible']))
+ || (isset($_GET['set_visible']) && !empty($_GET['set_visible']))
) {
// Make visible or invisible?
if (isset($_GET['set_visible'])) {
@@ -1423,35 +1456,38 @@ $templateForm = '';
/* TEMPLATE ACTION */
//Only teacher and all users into their group
-if ($isAllowedToEdit ||
- $group_member_with_upload_rights ||
- DocumentManager::is_my_shared_folder(api_get_user_id(), $curdirpath, $sessionId)
+if (
+ $isAllowedToEdit || $group_member_with_upload_rights
+ || DocumentManager::is_my_shared_folder(api_get_user_id(), $curdirpath, $sessionId)
) {
if (isset($_GET['add_as_template']) && !isset($_POST['create_template'])) {
$document_id_for_template = intval($_GET['add_as_template']);
// Create the form that asks for the directory name
$templateForm .= '
-
@@ -1475,10 +1511,11 @@ if ($isAllowedToEdit ||
if ($upload_ok) {
// Try to add an extension to the file if it hasn't one
- $new_file_name = $courseInfo['code'].'-'.add_ext_on_mime(
- stripslashes($_FILES['template_image']['name']),
- $_FILES['template_image']['type']
- );
+ $new_file_name = $courseInfo['code'].'-'
+ .add_ext_on_mime(
+ stripslashes($_FILES['template_image']['name']),
+ $_FILES['template_image']['type']
+ );
// Upload dir
$upload_dir = api_get_path(SYS_COURSE_PATH).$courseInfo['directory'].'/upload/template_thumbnails/';
@@ -1526,10 +1563,10 @@ if ($isAllowedToEdit ||
// END ACTION MENU
// Attach certificate in the gradebook
-if (isset($_GET['curdirpath']) &&
- $_GET['curdirpath'] == '/certificates' &&
- isset($_GET['set_certificate']) &&
- $_GET['set_certificate'] == strval(intval($_GET['set_certificate']))
+if (
+ isset($_GET['curdirpath']) && $_GET['curdirpath'] == '/certificates'
+ && isset($_GET['set_certificate'])
+ && $_GET['set_certificate'] == strval(intval($_GET['set_certificate']))
) {
if (isset($_GET['cidReq'])) {
$course_id = Security::remove_XSS($_GET['cidReq']); // course id
@@ -1596,7 +1633,10 @@ $btngroup = array('class' => 'btn btn-default');
/* GO TO PARENT DIRECTORY */
$actionsLeft = '';
-if ($curdirpath != '/' && $curdirpath != $group_properties['directory'] && !$is_certificate_mode) {
+if (
+ $curdirpath != '/' && $curdirpath != $group_properties['directory']
+ && !$is_certificate_mode
+) {
$actionsLeft = '';
$actionsLeft .= Display::return_icon('folder_up.png', get_lang('Up'), '', ICON_SIZE_MEDIUM);
$actionsLeft .= ' ';
@@ -1611,17 +1651,19 @@ if ($is_certificate_mode && $curdirpath != '/certificates') {
$column_show = array();
-if ($isAllowedToEdit ||
- $group_member_with_upload_rights ||
- DocumentManager::is_my_shared_folder(api_get_user_id(), $curdirpath, $sessionId)
+if (
+ $isAllowedToEdit || $group_member_with_upload_rights
+ || DocumentManager::is_my_shared_folder(api_get_user_id(), $curdirpath, $sessionId)
) {
// TODO:check enable more options for shared folders
/* CREATE NEW DOCUMENT OR NEW DIRECTORY / GO TO UPLOAD / DOWNLOAD ZIPPED FOLDER */
// Create new document
if (!$is_certificate_mode) {
$actionsLeft .= Display::url(
- Display::return_icon('new_document.png', get_lang('CreateDoc'), '', ICON_SIZE_MEDIUM),
- api_get_path(WEB_CODE_PATH).'document/create_document.php?'.api_get_cidreq().'&id='.$document_id
+ Display::return_icon('new_document.png', get_lang('CreateDoc'), '',
+ ICON_SIZE_MEDIUM),
+ api_get_path(WEB_CODE_PATH).'document/create_document.php?'
+ .api_get_cidreq().'&id='.$document_id
);
// Create new draw
@@ -1632,22 +1674,29 @@ if ($isAllowedToEdit ||
api_get_path(WEB_CODE_PATH).'document/create_draw.php?'.api_get_cidreq().'&id='.$document_id
);
} else {
- $actionsLeft .= Display::return_icon('new_draw_na.png', get_lang('BrowserDontSupportsSVG'), '', ICON_SIZE_MEDIUM);
+ $actionsLeft .= Display::return_icon(
+ 'new_draw_na.png',
+ get_lang('BrowserDontSupportsSVG'),
+ '',
+ ICON_SIZE_MEDIUM
+ );
}
}
// Create new paint
if (api_get_setting('enabled_support_pixlr') == 'true') {
$actionsLeft .= Display::url(
- Display::return_icon('new_paint.png', get_lang('PhotoRetouching'), '', ICON_SIZE_MEDIUM),
- api_get_path(WEB_CODE_PATH).'document/create_paint.php?'.api_get_cidreq().'&id='.$document_id
+ Display::return_icon('new_paint.png',
+ get_lang('PhotoRetouching'), '', ICON_SIZE_MEDIUM),
+ api_get_path(WEB_CODE_PATH).'document/create_paint.php?'
+ .api_get_cidreq().'&id='.$document_id
);
}
// Record an image clip from my webcam
if (api_get_setting('enable_webcam_clip') == 'true') {
$actionsLeft .= Display::url(
- Display::return_icon('webcam.png', get_lang('WebCamClip'), '', ICON_SIZE_MEDIUM),
+ Display::return_icon('webcam.png', get_lang('WebCamClip'), '', ICON_SIZE_MEDIUM),
api_get_path(WEB_CODE_PATH).'document/webcam_clip.php?'.api_get_cidreq().'&id='.$document_id
);
}
@@ -1672,15 +1721,22 @@ if ($isAllowedToEdit ||
// Create new certificate
if ($is_certificate_mode) {
$actionsLeft .= Display::url(
- Display::return_icon('new_certificate.png', get_lang('CreateCertificate'), '', ICON_SIZE_MEDIUM),
- api_get_path(WEB_CODE_PATH).'document/create_document.php?'.api_get_cidreq().'&id='.$document_id.'&certificate=true&selectcat='.$selectcat
+ Display::return_icon('new_certificate.png',
+ get_lang('CreateCertificate'),
+ '',
+ ICON_SIZE_MEDIUM
+ ),
+ api_get_path(WEB_CODE_PATH).'document/create_document.php?'
+ .api_get_cidreq().'&id='.$document_id.'&certificate=true&selectcat='
+ .$selectcat
);
}
// File upload link
if ($is_certificate_mode) {
$actionsLeft .= Display::url(
Display::return_icon('upload_certificate.png', get_lang('UploadCertificate'), '', ICON_SIZE_MEDIUM),
- api_get_path(WEB_CODE_PATH).'document/upload.php?'.api_get_cidreq().'&id='.$current_folder_id.'&certificate=true'
+ api_get_path(WEB_CODE_PATH).'document/upload.php?'.api_get_cidreq()
+ .'&id='.$current_folder_id.'&certificate=true'
);
} else {
$actionsLeft .= Display::url(
@@ -1753,7 +1809,6 @@ $userIsSubscribed = CourseManager::is_user_subscribed_in_course(
$courseInfo['code']
);
-
$getSizeURL = api_get_path(WEB_AJAX_PATH).'document.ajax.php?a=get_dir_size&'.api_get_cidreq();
if (isset($documentAndFolders) && is_array($documentAndFolders)) {
@@ -1809,8 +1864,9 @@ if (isset($documentAndFolders) && is_array($documentAndFolders)) {
false,
false
);
- $user_link = ''.
- get_lang('Owner').': '.UserManager::getUserProfileLink($userInfo).'
';
+ $user_link = ''
+ .get_lang('Owner').': '.UserManager::getUserProfileLink($userInfo)
+ .'
';
}
}
@@ -1827,8 +1883,9 @@ if (isset($documentAndFolders) && is_array($documentAndFolders)) {
$path_info = pathinfo($document_data['path']);
- if (isset($path_info['extension']) &&
- in_array($path_info['extension'], array('ogg', 'mp3', 'wav'))
+ if (
+ isset($path_info['extension'])
+ && in_array($path_info['extension'], array('ogg', 'mp3', 'wav'))
) {
$count++;
}
@@ -1847,13 +1904,14 @@ if (isset($documentAndFolders) && is_array($documentAndFolders)) {
);
// Document title with link
- $row[] = $link.$session_img.' '.$invisibility_span_open.
- ''.nl2br(htmlspecialchars($document_data['comment'], ENT_QUOTES, $charset)).' '.
- $invisibility_span_close.
- $user_link;
+ $row[] = $link.$session_img.' '.$invisibility_span_open.''
+ .nl2br(htmlspecialchars($document_data['comment'], ENT_QUOTES, $charset))
+ .' '.$invisibility_span_close.$user_link;
if ($document_data['filetype'] == 'folder') {
- $displaySize = ' ';
+ $displaySize = ' ';
} else {
$displaySize = format_file_size($document_data['size']);
}
@@ -1871,10 +1929,11 @@ if (isset($documentAndFolders) && is_array($documentAndFolders)) {
$row[] = $invisibility_span_open.$display_date.$invisibility_span_close;
// Admins get an edit column
- if ($isAllowedToEdit ||
- $groupMemberWithEditRights ||
- DocumentManager::is_my_shared_folder(api_get_user_id(), $curdirpath, $sessionId) ||
- $document_data['insert_user_id'] == api_get_user_id()
+ if (
+ $isAllowedToEdit
+ || $groupMemberWithEditRights
+ || DocumentManager::is_my_shared_folder(api_get_user_id(), $curdirpath, $sessionId)
+ || $document_data['insert_user_id'] == api_get_user_id()
) {
$is_template = isset($document_data['is_template']) ? $document_data['is_template'] : false;
@@ -1910,9 +1969,10 @@ if (isset($documentAndFolders) && is_array($documentAndFolders)) {
$countedPaths[$document_data['path']] = true;
}
- if ((isset($_GET['keyword']) &&
- DocumentManager::search_keyword($document_name, $_GET['keyword'])) ||
- !isset($_GET['keyword']) || empty($_GET['keyword'])
+ if (
+ (isset($_GET['keyword']) && DocumentManager::search_keyword($document_name, $_GET['keyword']))
+ || !isset($_GET['keyword'])
+ || empty($_GET['keyword'])
) {
$sortable_data[] = $row;
}
@@ -1926,13 +1986,15 @@ if (isset($documentAndFolders) && is_array($documentAndFolders)) {
if (!is_null($documentAndFolders)) {
// Show download zipped folder icon
if (!$is_certificate_mode && $total_size != 0
- && (api_get_setting('students_download_folders') == 'true'
- || $isAllowedToEdit
- || api_is_platform_admin()
+ && (
+ api_get_setting('students_download_folders') == 'true'
+ || $isAllowedToEdit
+ || api_is_platform_admin()
)
) {
//for student does not show icon into other shared folder, and does not show into main path (root)
- if (DocumentManager::is_my_shared_folder(api_get_user_id(), $curdirpath, $sessionId)
+ if (
+ DocumentManager::is_my_shared_folder(api_get_user_id(), $curdirpath, $sessionId)
&& $curdirpath != '/'
|| $isAllowedToEdit
|| api_is_platform_admin()
@@ -1944,7 +2006,8 @@ if (!is_null($documentAndFolders)) {
'',
ICON_SIZE_MEDIUM
),
- api_get_path(WEB_CODE_PATH).'document/document.php?'.api_get_cidreq().'&action=downloadfolder&id='.$document_id
+ api_get_path(WEB_CODE_PATH).'document/document.php?'
+ .api_get_cidreq().'&action=downloadfolder&id='.$document_id
);
}
}
@@ -1977,9 +2040,7 @@ if (!$is_certificate_mode && !isset($_GET['move'])) {
);
}
-if (($isAllowedToEdit || $group_member_with_upload_rights) &&
- count($documentAndFolders) > 1
-) {
+if (($isAllowedToEdit || $group_member_with_upload_rights) && count($documentAndFolders) > 1) {
$column_show[] = 1;
}
@@ -1988,7 +2049,8 @@ $column_show[] = 1;
$column_show[] = 1;
$column_show[] = 1;
-if ($isAllowedToEdit
+if (
+ $isAllowedToEdit
|| $group_member_with_upload_rights
|| DocumentManager::is_my_shared_folder(api_get_user_id(), $curdirpath, $sessionId)
) {
@@ -2039,7 +2101,10 @@ $table->set_additional_parameters($query_vars);
$column = 0;
-if (($isAllowedToEdit || $group_member_with_upload_rights) && count($documentAndFolders) > 1) {
+if (
+ ($isAllowedToEdit || $group_member_with_upload_rights)
+ && count($documentAndFolders) > 1
+) {
$table->set_header($column++, '', false, array('style' => 'width:12px;'));
}
$table->set_header($column++, get_lang('Type'), true, array('style' => 'width:30px;'));
@@ -2047,9 +2112,11 @@ $table->set_header($column++, get_lang('Name'));
$table->set_header($column++, get_lang('Size'), true, array('style' => 'width:50px;'));
$table->set_header($column++, get_lang('Date'), true, array('style' => 'width:150px;'));
// Admins get an edit column
-if ($isAllowedToEdit
+if (
+ $isAllowedToEdit
|| $group_member_with_upload_rights
- || DocumentManager::is_my_shared_folder(api_get_user_id(), $curdirpath, $sessionId)) {
+ || DocumentManager::is_my_shared_folder(api_get_user_id(), $curdirpath, $sessionId)
+) {
$table->set_header($column++, get_lang('Actions'), false, array('class' => 'td_actions'));
}
@@ -2127,40 +2194,41 @@ echo '
';
+
+';
// Footer
Display::display_footer();