Minor format code, removing commented code.

1.9.x
Julio Montoya 11 years ago
parent 9286b7c2d2
commit fe67e262b0
  1. 140
      main/document/document.inc.php

@ -38,7 +38,6 @@ function build_directory_selector($folders, $document_id, $group_dir = '', $chan
} }
} }
$form = new FormValidator('selector', 'GET', api_get_self() . '?' . api_get_cidreq()); $form = new FormValidator('selector', 'GET', api_get_self() . '?' . api_get_cidreq());
$form->addElement('hidden', 'cidReq', api_get_course_id()); $form->addElement('hidden', 'cidReq', api_get_course_id());
$parent_select = $form->addElement('select', 'id', get_lang('CurrentDirectory'), '', 'onchange="javascript: document.selector.submit();"'); $parent_select = $form->addElement('select', 'id', get_lang('CurrentDirectory'), '', 'onchange="javascript: document.selector.submit();"');
@ -111,11 +110,6 @@ function create_document_link(
$visibility $visibility
) { ) {
global $dbl_click_id; global $dbl_click_id;
if (isset($_SESSION['_gid'])) {
$req_gid = '&gidReq=' . $_SESSION['_gid'];
} else {
$req_gid = '';
}
$course_info = api_get_course_info(); $course_info = api_get_course_info();
$www = api_get_path(WEB_COURSE_PATH) . $course_info['path'] . '/document'; $www = api_get_path(WEB_COURSE_PATH) . $course_info['path'] . '/document';
@ -134,6 +128,9 @@ function create_document_link(
// Add class="invisible" on invisible files // Add class="invisible" on invisible files
$visibility_class = ($visibility == false) ? ' class="muted"' : ''; $visibility_class = ($visibility == false) ? ' class="muted"' : '';
$forcedownload_link = null;
$forcedownload_icon = null;
$prevent_multiple_click = null;
if (!$show_as_icon) { if (!$show_as_icon) {
// Build download link (icon) // Build download link (icon)
@ -156,26 +153,21 @@ function create_document_link(
$is_browser_viewable_file = is_browser_viewable($ext); $is_browser_viewable_file = is_browser_viewable($ext);
if ($is_browser_viewable_file) { if ($is_browser_viewable_file) {
//$url = 'showinframes.php?'.api_get_cidreq().'&file='.$url_path.$req_gid; /*if ($ext == 'pdf') {
$url = 'showinframes.php?' . api_get_cidreq() . '&id=' . $document_data['id'] . $req_gid; $url = api_get_self() . '?' . api_get_cidreq() . '&action=download&id=' . $document_data['id'];
} else {*/
$url = 'showinframes.php?' . api_get_cidreq() . '&id=' . $document_data['id'];
//}
} else { } else {
// url-encode for problematic characters (we may not call them dangerous characters...) // url-encode for problematic characters (we may not call them dangerous characters...)
$path = str_replace('%2F', '/', $url_path) . '?' . api_get_cidreq(); $path = str_replace('%2F', '/', $url_path) . '?' . api_get_cidreq();
//$new_path = '?id='.$document_data['id'];
$url = $www . $path; $url = $www . $path;
} }
//$path = str_replace('%2F', '/',$url_path).'?'.api_get_cidreq();
$path = str_replace('%2F', '/', $url_path); //yox view hack otherwise the image can't be well read
$url = $www . $path;
// Disabled fragment of code, there is a special icon for opening in a new window. /*$path = str_replace('%2F', '/', $url_path); //yox view hack otherwise the image can't be well read
//// Files that we want opened in a new window $url = $www . $path;*/
//if ($ext == 'txt' || $ext == 'log' || $ext == 'css' || $ext == 'js') { // Add here
// $target = '_blank';
//}
} else { } else {
//$url = api_get_self().'?'.api_get_cidreq().'&curdirpath='.$url_path.$req_gid; $url = api_get_self() . '?' . api_get_cidreq() . '&id=' . $document_data['id'];
$url = api_get_self() . '?' . api_get_cidreq() . '&id=' . $document_data['id'] . $req_gid;
} }
// The little download icon // The little download icon
@ -243,7 +235,7 @@ function create_document_link(
api_get_setting('users_copy_files') == 'true' && api_get_setting('users_copy_files') == 'true' &&
!api_is_anonymous() !api_is_anonymous()
) { ) {
$copy_myfiles_link = ($filetype == 'file') ? api_get_self() . '?' . api_get_cidreq() . '&action=copytomyfiles&id=' . $document_data['id'] . $req_gid : api_get_self() . '?' . api_get_cidreq(); $copy_myfiles_link = ($filetype == 'file') ? api_get_self() . '?' . api_get_cidreq() . '&action=copytomyfiles&id=' . $document_data['id'] : api_get_self() . '?' . api_get_cidreq();
if ($filetype == 'file') { if ($filetype == 'file') {
$copy_to_myfiles = '<a href="' . $copy_myfiles_link . '" style="float:right"' . $prevent_multiple_click . '>' . $copy_to_myfiles = '<a href="' . $copy_myfiles_link . '" style="float:right"' . $prevent_multiple_click . '>' .
@ -270,18 +262,18 @@ function create_document_link(
$open_in_new_window_link = '<a href="' . $www . str_replace('%2F', '/', $url_path) . '?' . api_get_cidreq() . '" style="float:right"' . $prevent_multiple_click . ' target="_blank">' . $open_in_new_window_link = '<a href="' . $www . str_replace('%2F', '/', $url_path) . '?' . api_get_cidreq() . '" style="float:right"' . $prevent_multiple_click . ' target="_blank">' .
Display::return_icon('open_in_new_window.png', get_lang('OpenInANewWindow'), array(), ICON_SIZE_SMALL) . '&nbsp;&nbsp;</a>'; Display::return_icon('open_in_new_window.png', get_lang('OpenInANewWindow'), array(), ICON_SIZE_SMALL) . '&nbsp;&nbsp;</a>';
} }
//target="'.$target.'"
if ($filetype == 'file') { if ($filetype == 'file') {
// Sound preview with jplayer // Sound preview with jplayer
if (preg_match('/mp3$/i', urldecode($url)) || if (preg_match('/mp3$/i', urldecode($url)) ||
(preg_match('/wav$/i', urldecode($url)) && !preg_match('/_chnano_.wav$/i', urldecode($url))) || (preg_match('/wav$/i', urldecode($url)) && !preg_match('/_chnano_.wav$/i', urldecode($url))) ||
preg_match('/ogg$/i', urldecode($url)) preg_match('/ogg$/i', urldecode($url))
) { ) {
return '<span style="float:left" ' . $visibility_class . '>' . $title . '</span>' . $force_download_html . $send_to . $copy_to_myfiles . $open_in_new_window_link . $pdf_icon; return '<span style="float:left" ' . $visibility_class . '>' .
$title .
'</span>' . $force_download_html . $send_to . $copy_to_myfiles . $open_in_new_window_link . $pdf_icon;
} elseif ( } elseif (
// Show preview // Show preview
//preg_match('/html$/i', urldecode($url)) ||
//preg_match('/htm$/i', urldecode($url)) ||
preg_match('/swf$/i', urldecode($url)) || preg_match('/swf$/i', urldecode($url)) ||
preg_match('/png$/i', urldecode($url)) || preg_match('/png$/i', urldecode($url)) ||
preg_match('/gif$/i', urldecode($url)) || preg_match('/gif$/i', urldecode($url)) ||
@ -289,19 +281,24 @@ function create_document_link(
preg_match('/jpeg$/i', urldecode($url)) || preg_match('/jpeg$/i', urldecode($url)) ||
preg_match('/bmp$/i', urldecode($url)) || preg_match('/bmp$/i', urldecode($url)) ||
preg_match('/svg$/i', urldecode($url)) || preg_match('/svg$/i', urldecode($url)) ||
(preg_match('/wav$/i', urldecode($url)) && preg_match('/_chnano_.wav$/i', urldecode($url)) && api_get_setting('enable_nanogong') == 'true') (
preg_match('/wav$/i', urldecode($url)) &&
preg_match('/_chnano_.wav$/i', urldecode($url)) &&
api_get_setting('enable_nanogong') == 'true'
)
) { ) {
//yox view
//$url = 'showinframesmin.php?'.api_get_cidreq().'&id='.$document_data['id'].$req_gid;
// Simpler version of showinframesmin.php with no headers // Simpler version of showinframesmin.php with no headers
$url = 'show_content.php?' . api_get_cidreq() . '&id=' . $document_data['id'] . $req_gid . '&width=700&height=500'; $url = 'show_content.php?' . api_get_cidreq() . '&id=' . $document_data['id']. '&width=700&height=500';
$class = 'ajax'; $class = 'ajax';
if ($visibility == false) { if ($visibility == false) {
$class = "ajax invisible"; $class = "ajax invisible";
} }
return '<a href="' . $url . '" class="' . $class . '" title="' . $tooltip_title_alt . '" style="float:left">' . $title . '</a>' . $force_download_html . $send_to . $copy_to_myfiles . $open_in_new_window_link . $pdf_icon; return '<a href="' . $url . '" class="' . $class . '" title="' . $tooltip_title_alt . '" style="float:left">' . $title . '</a>' . $force_download_html . $send_to . $copy_to_myfiles . $open_in_new_window_link . $pdf_icon;
} else { } else {
$url = 'showinframes.php?' . api_get_cidreq() . '&id=' . $document_data['id'] . $req_gid;
//if ($ext != 'pdf') {
$url = 'showinframes.php?' . api_get_cidreq() . '&id=' . $document_data['id'];
//}
// No plugin just the old and good showinframes.php page // No plugin just the old and good showinframes.php page
return '<a href="' . $url . '" title="' . $tooltip_title_alt . '" style="float:left" ' . $visibility_class . ' >' . $title . '</a>' . $force_download_html . $send_to . $copy_to_myfiles . $open_in_new_window_link . $pdf_icon; return '<a href="' . $url . '" title="' . $tooltip_title_alt . '" style="float:left" ' . $visibility_class . ' >' . $title . '</a>' . $force_download_html . $send_to . $copy_to_myfiles . $open_in_new_window_link . $pdf_icon;
} }
@ -325,8 +322,6 @@ function create_document_link(
return $sound_preview; return $sound_preview;
} elseif ( } elseif (
// Show preview // Show preview
//preg_match('/html$/i', urldecode($url)) ||
//preg_match('/htm$/i', urldecode($url)) ||
preg_match('/swf$/i', urldecode($url)) || preg_match('/swf$/i', urldecode($url)) ||
preg_match('/png$/i', urldecode($url)) || preg_match('/png$/i', urldecode($url)) ||
preg_match('/gif$/i', urldecode($url)) || preg_match('/gif$/i', urldecode($url)) ||
@ -336,7 +331,7 @@ function create_document_link(
preg_match('/svg$/i', urldecode($url)) || preg_match('/svg$/i', urldecode($url)) ||
(preg_match('/wav$/i', urldecode($url)) && preg_match('/_chnano_.wav$/i', urldecode($url)) && api_get_setting('enable_nanogong') == 'true') (preg_match('/wav$/i', urldecode($url)) && preg_match('/_chnano_.wav$/i', urldecode($url)) && api_get_setting('enable_nanogong') == 'true')
) { ) {
$url = 'showinframes.php?' . api_get_cidreq() . '&id=' . $document_data['id'] . $req_gid; $url = 'showinframes.php?' . api_get_cidreq() . '&id=' . $document_data['id'];
return '<a href="' . $url . '" title="' . $tooltip_title_alt . '" ' . $visibility_class . ' style="float:left">' . return '<a href="' . $url . '" title="' . $tooltip_title_alt . '" ' . $visibility_class . ' style="float:left">' .
build_document_icon_tag($filetype, $path) . build_document_icon_tag($filetype, $path) .
Display::return_icon('shared.png', get_lang('ResourceShared'), array()) . '</a>'; Display::return_icon('shared.png', get_lang('ResourceShared'), array()) . '</a>';
@ -370,9 +365,13 @@ function create_document_link(
preg_match('/jpeg$/i', urldecode($url)) || preg_match('/jpeg$/i', urldecode($url)) ||
preg_match('/bmp$/i', urldecode($url)) || preg_match('/bmp$/i', urldecode($url)) ||
preg_match('/svg$/i', urldecode($url)) || preg_match('/svg$/i', urldecode($url)) ||
(preg_match('/wav$/i', urldecode($url)) && preg_match('/_chnano_.wav$/i', urldecode($url)) && api_get_setting('enable_nanogong') == 'true') (
preg_match('/wav$/i', urldecode($url)) &&
preg_match('/_chnano_.wav$/i', urldecode($url)) &&
api_get_setting('enable_nanogong') == 'true'
)
) { ) {
$url = 'showinframes.php?' . api_get_cidreq() . '&id=' . $document_data['id'] . $req_gid; //without preview $url = 'showinframes.php?' . api_get_cidreq() . '&id=' . $document_data['id']; //without preview
return '<a href="' . $url . '" title="' . $tooltip_title_alt . '" ' . $visibility_class . ' style="float:left">' . return '<a href="' . $url . '" title="' . $tooltip_title_alt . '" ' . $visibility_class . ' style="float:left">' .
build_document_icon_tag($filetype, $path) . '</a>'; build_document_icon_tag($filetype, $path) . '</a>';
} else { } else {
@ -394,7 +393,8 @@ function create_document_link(
* @param string $path * @param string $path
* @return string img html tag * @return string img html tag
*/ */
function build_document_icon_tag($type, $path) { function build_document_icon_tag($type, $path)
{
$basename = basename($path); $basename = basename($path);
$current_session_id = api_get_session_id(); $current_session_id = api_get_session_id();
$is_allowed_to_edit = api_is_allowed_to_edit(null, true); $is_allowed_to_edit = api_is_allowed_to_edit(null, true);
@ -507,12 +507,8 @@ function build_document_icon_tag($type, $path) {
* @param int $id dbase id of the document * @param int $id dbase id of the document
* @return string html img tags with hyperlinks * @return string html img tags with hyperlinks
*/ */
function build_edit_icons($document_data, $id, $is_template, $is_read_only = 0, $visibility) { function build_edit_icons($document_data, $id, $is_template, $is_read_only = 0, $visibility)
if (isset($_SESSION['_gid'])) { {
$req_gid = '&gidReq=' . $_SESSION['_gid'];
} else {
$req_gid = '';
}
$web_odf_extension_list = DocumentManager::get_web_odf_extension_list(); $web_odf_extension_list = DocumentManager::get_web_odf_extension_list();
$document_id = $document_data['id']; $document_id = $document_data['id'];
$type = $document_data['filetype']; $type = $document_data['filetype'];
@ -552,13 +548,17 @@ function build_edit_icons($document_data, $id, $is_template, $is_read_only = 0,
if ($is_read_only /* or ($session_id!=api_get_session_id()) */) { if ($is_read_only /* or ($session_id!=api_get_session_id()) */) {
if (api_is_course_admin() || api_is_platform_admin()) { if (api_is_course_admin() || api_is_platform_admin()) {
if ($extension == 'svg' && api_browser_support('svg') && api_get_setting('enabled_support_svg') == 'true') { if ($extension == 'svg' && api_browser_support('svg') && api_get_setting('enabled_support_svg') == 'true') {
$modify_icons = '<a href="edit_draw.php?' . api_get_cidreq() . '&id=' . $document_id . $req_gid . '">' . Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>'; $modify_icons = '<a href="edit_draw.php?' . api_get_cidreq() . '&id=' . $document_id . '">' .
Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>';
} elseif (in_array($extension, $web_odf_extension_list) && api_get_setting('enabled_support_odf') === true) { } elseif (in_array($extension, $web_odf_extension_list) && api_get_setting('enabled_support_odf') === true) {
$modify_icons = '<a href="edit_odf.php?' . api_get_cidreq() . '&id=' . $document_id . $req_gid . '">' . Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>'; $modify_icons = '<a href="edit_odf.php?' . api_get_cidreq() . '&id=' . $document_id . '">' .
Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>';
} elseif ($extension == 'png' || $extension == 'jpg' || $extension == 'jpeg' || $extension == 'bmp' || $extension == 'gif' || $extension == 'pxd' && api_get_setting('enabled_support_pixlr') == 'true') { } elseif ($extension == 'png' || $extension == 'jpg' || $extension == 'jpeg' || $extension == 'bmp' || $extension == 'gif' || $extension == 'pxd' && api_get_setting('enabled_support_pixlr') == 'true') {
$modify_icons = '<a href="edit_paint.php?' . api_get_cidreq() . '&id=' . $document_id . $req_gid . '">' . Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>'; $modify_icons = '<a href="edit_paint.php?' . api_get_cidreq() . '&id=' . $document_id . '">' .
Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>';
} else { } else {
$modify_icons = '<a href="edit_document.php?' . api_get_cidreq() . '&id=' . $document_id . $req_gid . '">' . Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>'; $modify_icons = '<a href="edit_document.php?' . api_get_cidreq() . '&id=' . $document_id. '">' .
Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>';
} }
} else { } else {
$modify_icons = Display::return_icon('edit_na.png', get_lang('Modify'), '', ICON_SIZE_SMALL); $modify_icons = Display::return_icon('edit_na.png', get_lang('Modify'), '', ICON_SIZE_SMALL);
@ -574,31 +574,39 @@ function build_edit_icons($document_data, $id, $is_template, $is_read_only = 0,
$modify_icons = Display::return_icon('edit_na.png', get_lang('Modify'), '', ICON_SIZE_SMALL); $modify_icons = Display::return_icon('edit_na.png', get_lang('Modify'), '', ICON_SIZE_SMALL);
} elseif ($is_certificate_mode ) { } elseif ($is_certificate_mode ) {
// gradebook category doesn't seem to be taken into account // gradebook category doesn't seem to be taken into account
$modify_icons = '<a href="edit_document.php?' . api_get_cidreq() . '&amp;id=' . $document_id . $req_gid . '&curdirpath=/certificates">' . Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>'; $modify_icons = '<a href="edit_document.php?' . api_get_cidreq() . '&amp;id=' . $document_id . '&curdirpath=/certificates">' . Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>';
} else { } else {
if (api_get_session_id()) { if (api_get_session_id()) {
if ($document_data['session_id'] == api_get_session_id()) { if ($document_data['session_id'] == api_get_session_id()) {
if ($extension == 'svg' && api_browser_support('svg') && api_get_setting('enabled_support_svg') == 'true') { if ($extension == 'svg' && api_browser_support('svg') && api_get_setting('enabled_support_svg') == 'true') {
$modify_icons = '<a href="edit_draw.php?' . api_get_cidreq() . '&amp;id=' . $document_id . $req_gid . '">' . Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>'; $modify_icons = '<a href="edit_draw.php?' . api_get_cidreq() . '&amp;id=' . $document_id . '">' .
Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>';
} elseif (in_array($extension, $web_odf_extension_list) && api_get_setting('enabled_support_odf') === true) { } elseif (in_array($extension, $web_odf_extension_list) && api_get_setting('enabled_support_odf') === true) {
$modify_icons = '<a href="edit_odf.php?' . api_get_cidreq() . '&id=' . $document_id . $req_gid . '">' . Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>'; $modify_icons = '<a href="edit_odf.php?' . api_get_cidreq() . '&id=' . $document_id . '">' .
Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>';
} elseif ($extension == 'png' || $extension == 'jpg' || $extension == 'jpeg' || $extension == 'bmp' || $extension == 'gif' || $extension == 'pxd' && api_get_setting('enabled_support_pixlr') == 'true') { } elseif ($extension == 'png' || $extension == 'jpg' || $extension == 'jpeg' || $extension == 'bmp' || $extension == 'gif' || $extension == 'pxd' && api_get_setting('enabled_support_pixlr') == 'true') {
$modify_icons = '<a href="edit_paint.php?' . api_get_cidreq() . '&id=' . $document_id . $req_gid . '">' . Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>'; $modify_icons = '<a href="edit_paint.php?' . api_get_cidreq() . '&id=' . $document_id . '">' .
Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>';
} else { } else {
$modify_icons = '<a href="edit_document.php?' . api_get_cidreq() . '&amp;id=' . $document_id . $req_gid . '">' . Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>'; $modify_icons = '<a href="edit_document.php?' . api_get_cidreq() . '&amp;id=' . $document_id . '">' .
Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>';
} }
} else { } else {
$modify_icons .= '&nbsp;' . Display::return_icon('edit_na.png', get_lang('Edit'), array(), ICON_SIZE_SMALL) . '</a>'; $modify_icons .= '&nbsp;' . Display::return_icon('edit_na.png', get_lang('Edit'), array(), ICON_SIZE_SMALL) . '</a>';
} }
} else { } else {
if ($extension == 'svg' && api_browser_support('svg') && api_get_setting('enabled_support_svg') == 'true') { if ($extension == 'svg' && api_browser_support('svg') && api_get_setting('enabled_support_svg') == 'true') {
$modify_icons = '<a href="edit_draw.php?' . api_get_cidreq() . '&amp;id=' . $document_id . $req_gid . '">' . Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>'; $modify_icons = '<a href="edit_draw.php?' . api_get_cidreq() . '&amp;id=' . $document_id . '">' .
Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>';
} elseif (in_array($extension, $web_odf_extension_list) && api_get_setting('enabled_support_odf') === true) { } elseif (in_array($extension, $web_odf_extension_list) && api_get_setting('enabled_support_odf') === true) {
$modify_icons = '<a href="edit_odf.php?' . api_get_cidreq() . '&id=' . $document_id . $req_gid . '">' . Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>'; $modify_icons = '<a href="edit_odf.php?' . api_get_cidreq() . '&id=' . $document_id . '">' .
Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>';
} elseif ($extension == 'png' || $extension == 'jpg' || $extension == 'jpeg' || $extension == 'bmp' || $extension == 'gif' || $extension == 'pxd' && api_get_setting('enabled_support_pixlr') == 'true') { } elseif ($extension == 'png' || $extension == 'jpg' || $extension == 'jpeg' || $extension == 'bmp' || $extension == 'gif' || $extension == 'pxd' && api_get_setting('enabled_support_pixlr') == 'true') {
$modify_icons = '<a href="edit_paint.php?' . api_get_cidreq() . '&amp;id=' . $document_id . $req_gid . '">' . Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>'; $modify_icons = '<a href="edit_paint.php?' . api_get_cidreq() . '&amp;id=' . $document_id . '">' .
Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>';
} else { } else {
$modify_icons = '<a href="edit_document.php?' . api_get_cidreq() . '&amp;id=' . $document_id . $req_gid . '">' . Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>'; $modify_icons = '<a href="edit_document.php?' . api_get_cidreq() . '&amp;id=' . $document_id . '">' .
Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>';
} }
} }
} }
@ -609,12 +617,14 @@ function build_edit_icons($document_data, $id, $is_template, $is_read_only = 0,
} else { } else {
if (api_get_session_id()) { if (api_get_session_id()) {
if ($document_data['session_id'] == api_get_session_id()) { if ($document_data['session_id'] == api_get_session_id()) {
$modify_icons .= '&nbsp;<a href="' . api_get_self() . '?' . api_get_cidreq() . '&amp;id=' . $parent_id . '&amp;move=' . $document_id . $req_gid . '">' . Display::return_icon('move.png', get_lang('Move'), array(), ICON_SIZE_SMALL) . '</a>'; $modify_icons .= '&nbsp;<a href="' . api_get_self() . '?' . api_get_cidreq() . '&amp;id=' . $parent_id . '&amp;move=' . $document_id . '">' .
Display::return_icon('move.png', get_lang('Move'), array(), ICON_SIZE_SMALL) . '</a>';
} else { } else {
$modify_icons .= '&nbsp;' . Display::return_icon('move_na.png', get_lang('Move'), array(), ICON_SIZE_SMALL) . '</a>'; $modify_icons .= '&nbsp;' . Display::return_icon('move_na.png', get_lang('Move'), array(), ICON_SIZE_SMALL) . '</a>';
} }
} else { } else {
$modify_icons .= '&nbsp;<a href="' . api_get_self() . '?' . api_get_cidreq() . '&amp;id=' . $parent_id . '&amp;move=' . $document_id . $req_gid . '">' . Display::return_icon('move.png', get_lang('Move'), array(), ICON_SIZE_SMALL) . '</a>'; $modify_icons .= '&nbsp;<a href="' . api_get_self() . '?' . api_get_cidreq() . '&amp;id=' . $parent_id . '&amp;move=' . $document_id . '">' .
Display::return_icon('move.png', get_lang('Move'), array(), ICON_SIZE_SMALL) . '</a>';
} }
} }
@ -628,7 +638,7 @@ function build_edit_icons($document_data, $id, $is_template, $is_read_only = 0,
} else { } else {
$tip_visibility = get_lang('Hide'); $tip_visibility = get_lang('Hide');
} }
$modify_icons .= '&nbsp;<a href="' . api_get_self() . '?' . api_get_cidreq() . '&amp;id=' . $parent_id . '&amp;' . $visibility_command . '=' . $id . $req_gid . '&amp;' . $sort_params . '">' . $modify_icons .= '&nbsp;<a href="' . api_get_self() . '?' . api_get_cidreq() . '&amp;id=' . $parent_id . '&amp;' . $visibility_command . '=' . $id . '&amp;' . $sort_params . '">' .
Display::return_icon($visibility_icon . '.png', $tip_visibility, '', ICON_SIZE_SMALL) . '</a>'; Display::return_icon($visibility_icon . '.png', $tip_visibility, '', ICON_SIZE_SMALL) . '</a>';
} }
} }
@ -643,22 +653,22 @@ function build_edit_icons($document_data, $id, $is_template, $is_read_only = 0,
$_GET['curdirpath'] == '/certificates' && $_GET['curdirpath'] == '/certificates' &&
DocumentManager::get_default_certificate_id(api_get_course_id()) == $id DocumentManager::get_default_certificate_id(api_get_course_id()) == $id
) { ) {
$modify_icons .= '&nbsp;<a href="' . api_get_self() . '?' . api_get_cidreq() . '&amp;curdirpath=' . $curdirpath . '&action=delete_item&id='.$parent_id.'&deleteid='.$document_id.$req_gid.'&amp;' . $sort_params . 'delete_certificate_id=' . $id . '" onclick="return confirmation(\'' . $titleToShow . '\');">' . $modify_icons .= '&nbsp;<a href="' . api_get_self() . '?' . api_get_cidreq() . '&amp;curdirpath=' . $curdirpath . '&action=delete_item&id='.$parent_id.'&deleteid='.$document_id.'&amp;' . $sort_params . 'delete_certificate_id=' . $id . '" onclick="return confirmation(\'' . $titleToShow . '\');">' .
Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL) . '</a>'; Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL) . '</a>';
} else { } else {
if ($is_certificate_mode) { if ($is_certificate_mode) {
$modify_icons .= '&nbsp;<a href="' . api_get_self() . '?' . api_get_cidreq() . '&amp;curdirpath=' . $curdirpath . '&action=delete_item&id='.$parent_id.'&deleteid=' . $document_id . $req_gid . '&amp;' . $sort_params . '" onclick="return confirmation(\'' . $titleToShow . '\');">' . $modify_icons .= '&nbsp;<a href="' . api_get_self() . '?' . api_get_cidreq() . '&amp;curdirpath=' . $curdirpath . '&action=delete_item&id='.$parent_id.'&deleteid=' . $document_id . '&amp;' . $sort_params . '" onclick="return confirmation(\'' . $titleToShow . '\');">' .
Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL) . '</a>'; Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL) . '</a>';
} else { } else {
if (api_get_session_id()) { if (api_get_session_id()) {
if ($document_data['session_id'] == api_get_session_id()) { if ($document_data['session_id'] == api_get_session_id()) {
$modify_icons .= '&nbsp;<a href="' . api_get_self() . '?' . api_get_cidreq() . '&amp;curdirpath=' . $curdirpath . '&action=delete_item&id='.$parent_id.'&deleteid='.$document_id . $req_gid . '&amp;' . $sort_params . '" onclick="return confirmation(\'' . $titleToShow . '\');">'. $modify_icons .= '&nbsp;<a href="' . api_get_self() . '?' . api_get_cidreq() . '&amp;curdirpath=' . $curdirpath . '&action=delete_item&id='.$parent_id.'&deleteid='.$document_id . '&amp;' . $sort_params . '" onclick="return confirmation(\'' . $titleToShow . '\');">'.
Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL) . '</a>'; Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL) . '</a>';
} else { } else {
$modify_icons .= '&nbsp;' . Display::return_icon('delete_na.png', get_lang('ThisFolderCannotBeDeleted'), array(), ICON_SIZE_SMALL); $modify_icons .= '&nbsp;' . Display::return_icon('delete_na.png', get_lang('ThisFolderCannotBeDeleted'), array(), ICON_SIZE_SMALL);
} }
} else { } else {
$modify_icons .= '&nbsp;<a href="' . api_get_self() . '?' . api_get_cidreq() . '&amp;curdirpath=' . $curdirpath . '&action=delete_item&id='.$parent_id.'&deleteid='.$document_id . $req_gid . '&amp;' . $sort_params . '" onclick="return confirmation(\'' . $titleToShow. '\');">' . $modify_icons .= '&nbsp;<a href="' . api_get_self() . '?' . api_get_cidreq() . '&amp;curdirpath=' . $curdirpath . '&action=delete_item&id='.$parent_id.'&deleteid='.$document_id . '&amp;' . $sort_params . '" onclick="return confirmation(\'' . $titleToShow. '\');">' .
Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL) . '</a>'; Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL) . '</a>';
} }
} }
@ -687,7 +697,7 @@ function build_edit_icons($document_data, $id, $is_template, $is_read_only = 0,
if ($type == 'file' && ($extension == 'html' || $extension == 'htm')) { if ($type == 'file' && ($extension == 'html' || $extension == 'htm')) {
if ($is_template == 0) { if ($is_template == 0) {
if ((isset($_GET['curdirpath']) && $_GET['curdirpath'] != '/certificates') || !isset($_GET['curdirpath'])) { if ((isset($_GET['curdirpath']) && $_GET['curdirpath'] != '/certificates') || !isset($_GET['curdirpath'])) {
$modify_icons .= '&nbsp;<a href="' . api_get_self() . '?' . api_get_cidreq() . '&amp;curdirpath=' . $curdirpath . '&amp;add_as_template=' . $id . $req_gid . '&amp;' . $sort_params . '">' . $modify_icons .= '&nbsp;<a href="' . api_get_self() . '?' . api_get_cidreq() . '&amp;curdirpath=' . $curdirpath . '&amp;add_as_template=' . $id . '&amp;' . $sort_params . '">' .
Display::return_icon('wizard.png', get_lang('AddAsTemplate'), array(), ICON_SIZE_SMALL) . '</a>'; Display::return_icon('wizard.png', get_lang('AddAsTemplate'), array(), ICON_SIZE_SMALL) . '</a>';
} }
if (isset($_GET['curdirpath']) && $_GET['curdirpath'] == '/certificates') {//allow attach certificate to course if (isset($_GET['curdirpath']) && $_GET['curdirpath'] == '/certificates') {//allow attach certificate to course
@ -702,16 +712,16 @@ function build_edit_icons($document_data, $id, $is_template, $is_read_only = 0,
$certificate = get_lang('NoDefaultCertificate'); $certificate = get_lang('NoDefaultCertificate');
} }
if (isset($_GET['selectcat'])) { if (isset($_GET['selectcat'])) {
$modify_icons .= '&nbsp;<a href="' . api_get_self() . '?' . api_get_cidreq() . '&amp;curdirpath=' . $curdirpath . '&amp;selectcat=' . Security::remove_XSS($_GET['selectcat']) . '&amp;set_certificate=' . $id . $req_gid . '&amp;' . $sort_params . '"> $modify_icons .= '&nbsp;<a href="' . api_get_self() . '?' . api_get_cidreq() . '&amp;curdirpath=' . $curdirpath . '&amp;selectcat=' . Security::remove_XSS($_GET['selectcat']) . '&amp;set_certificate=' . $id . '&amp;' . $sort_params . '">
<img src="../img/' . $visibility_icon_certificate . '.png" border="0" title="' . $certificate . '" alt="" /></a>'; <img src="../img/' . $visibility_icon_certificate . '.png" border="0" title="' . $certificate . '" alt="" /></a>';
if ($is_preview) { if ($is_preview) {
$modify_icons .= '&nbsp;<a target="_blank" href="' . api_get_self() . '?' . api_get_cidreq() . '&amp;curdirpath=' . $curdirpath . '&amp;set_preview=' . $id . $req_gid . '&amp;' . $sort_params . '" >' . $modify_icons .= '&nbsp;<a target="_blank" href="' . api_get_self() . '?' . api_get_cidreq() . '&amp;curdirpath=' . $curdirpath . '&amp;set_preview=' . $id . '&amp;' . $sort_params . '" >' .
Display::return_icon('preview_view.png', $preview, '', ICON_SIZE_SMALL) . '</a>'; Display::return_icon('preview_view.png', $preview, '', ICON_SIZE_SMALL) . '</a>';
} }
} }
} }
} else { } else {
$modify_icons .= '&nbsp;<a href="' . api_get_self() . '?' . api_get_cidreq() . '&curdirpath=' . $curdirpath . '&amp;remove_as_template=' . $id . $req_gid . '&amp;' . $sort_params . '">' . $modify_icons .= '&nbsp;<a href="' . api_get_self() . '?' . api_get_cidreq() . '&curdirpath=' . $curdirpath . '&amp;remove_as_template=' . $id. '&amp;' . $sort_params . '">' .
Display::return_icon('wizard_na.png', get_lang('RemoveAsTemplate'), '', ICON_SIZE_SMALL) . '</a>'; Display::return_icon('wizard_na.png', get_lang('RemoveAsTemplate'), '', ICON_SIZE_SMALL) . '</a>';
} }
$modify_icons .= '&nbsp;<a href="' . api_get_self() . '?' . api_get_cidreq() . '&action=export_to_pdf&id=' . $id . '">' . $modify_icons .= '&nbsp;<a href="' . api_get_self() . '?' . api_get_cidreq() . '&action=export_to_pdf&id=' . $id . '">' .

Loading…
Cancel
Save