Use Display::return_icon

1.10.x
Julio Montoya 12 years ago
parent 19c8453909
commit 2da43b751a
  1. 203
      main/newscorm/resourcelinker.inc.php

@ -51,10 +51,8 @@ function show_folder_up()
$level = FileManager::get_levels($folder); $level = FileManager::get_levels($folder);
if ($level == 1) { if ($level == 1) {
echo "<a href='".api_get_self( echo "<a href='".api_get_self()."?content=Document&amp;source_forum=".$_GET['source_forum']."&amp;source_id=$source_id&amp;action=$action&amp;learnpath_id=$learnpath_id&amp;chapter_id=$chapter_id&amp;originalresource=no'>
)."?content=Document&amp;source_forum=".$_GET['source_forum']."&amp;source_id=$source_id&amp;action=$action&amp;learnpath_id=$learnpath_id&amp;chapter_id=$chapter_id&amp;originalresource=no'><img src='../img/folder_up.gif' border='0' />".get_lang( ".Display::return_icon('folder_up.gif', get_lang('LevelUp'))."</a>";
'LevelUp'
)."</a>";
} }
if ($level && $level != 0 && $level != 1) { if ($level && $level != 0 && $level != 1) {
$folder_up = $folder; $folder_up = $folder;
@ -62,10 +60,8 @@ function show_folder_up()
$last = count($folder_temp) - 1; $last = count($folder_temp) - 1;
unset($folder_temp[$last]); unset($folder_temp[$last]);
$folder_up = implode('/', $folder_temp); $folder_up = implode('/', $folder_temp);
echo "<a href='".api_get_self( echo "<a href='".api_get_self()."?content=Document&amp;source_forum=".$_GET['source_forum']."&amp;folder=$folder_up&amp;source_id=$source_id&amp;action=$action&amp;learnpath_id=$learnpath_id&amp;chapter_id=$chapter_id&amp;originalresource=no'>
)."?content=Document&amp;source_forum=".$_GET['source_forum']."&amp;folder=$folder_up&amp;source_id=$source_id&amp;action=$action&amp;learnpath_id=$learnpath_id&amp;chapter_id=$chapter_id&amp;originalresource=no'><img src='../img/folder_up.gif' border='0' />".get_lang( ".Display::return_icon('folder_up.gif', get_lang('LevelUp'))."</a>";
'LevelUp'
)."</a>";
} }
} }
@ -100,10 +96,10 @@ function show_documents($folder)
if (FileManager::get_levels($row['path']) - 1 == 1) { if (FileManager::get_levels($row['path']) - 1 == 1) {
// showing the right icon. // showing the right icon.
if (file_or_folder($row['path'])) { if (file_or_folder($row['path'])) {
echo '<img src="../img/file.gif" align="middle" />'; echo Display::return_icon('file.gif');
} else { } else {
$image = FileManager::choose_image($row['path']); $image = FileManager::choose_image($row['path']);
echo "<img src=\"../img/$image\" align=\"middle\" />"; echo Display::return_icon($image);
} }
// Folders should be clickable. // Folders should be clickable.
@ -153,10 +149,10 @@ function show_documents($folder)
$good_key = key($good_paths); $good_key = key($good_paths);
// Showing the right icon. // Showing the right icon.
if (file_or_folder($path)) { if (file_or_folder($path)) {
echo '<img src="../img/file.gif" align="middle" />'; echo Display::return_icon('file.gif');
} else { } else {
$image = FileManager::choose_image($path); $image = FileManager::choose_image($path);
echo "<img src=\"../img/$image\" align=\"middle\" />"; echo Display::return_icon($image);
} }
// Folders should be clickable // Folders should be clickable
@ -246,33 +242,38 @@ function display_addedresource_link($type, $id, $style = '')
$TABLEAGENDA = Database::get_course_table(TABLE_AGENDA); $TABLEAGENDA = Database::get_course_table(TABLE_AGENDA);
$result = Database::query("SELECT * FROM $TABLEAGENDA WHERE c_id = $course_id AND id=$id"); $result = Database::query("SELECT * FROM $TABLEAGENDA WHERE c_id = $course_id AND id=$id");
$myrow = Database::fetch_array($result); $myrow = Database::fetch_array($result);
echo '<img src="../img/agenda.gif" align="middle" /> <a href="../calendar/agenda.php"'.$styling.'>'.$myrow['title']."</a><br />\n"; echo Display::return_icon('agenda.gif');
echo ' <a href="../calendar/agenda.php"'.$styling.'>'.$myrow['title']."</a>
<br />";
break; break;
case 'Ad_Valvas': case 'Ad_Valvas':
$tbl_announcement = Database::get_course_table(TABLE_ANNOUNCEMENT); $tbl_announcement = Database::get_course_table(TABLE_ANNOUNCEMENT);
$result = Database::query("SELECT * FROM $tbl_announcement WHERE c_id = $course_id AND id=$id"); $result = Database::query("SELECT * FROM $tbl_announcement WHERE c_id = $course_id AND id=$id");
$myrow = Database::fetch_array($result); $myrow = Database::fetch_array($result);
echo '<img src="../img/valves.gif" align="middle" /> <a href="../announcements/announcements.php"'.$styling.'>'.$myrow['title']."</a><br />\n"; echo Display::return_icon('valves.gif');
echo ' <a href="../announcements/announcements.php"'.$styling.'>'.$myrow['title']."</a><br />\n";
break; break;
case 'Link': case 'Link':
$TABLETOOLLINK = Database::get_course_table(TABLE_LINK); $TABLETOOLLINK = Database::get_course_table(TABLE_LINK);
$result = Database::query("SELECT * FROM $TABLETOOLLINK WHERE c_id = $course_id AND id=$id"); $result = Database::query("SELECT * FROM $TABLETOOLLINK WHERE c_id = $course_id AND id=$id");
$myrow = Database::fetch_array($result); $myrow = Database::fetch_array($result);
echo '<img src="../img/links.gif" align="middle" /> <a href="#" onclick="javascript:window.open(\'../link/link_goto.php?link_id='.$myrow['id'].'&amp;link_url='.urlencode( echo Display::return_icon('links.gif');
$myrow['url'] echo ' <a href="#" onclick="javascript:window.open(\'../link/link_goto.php?link_id='.$myrow['id'].'&amp;link_url='.urlencode($myrow['url'])."','MyWindow','width=500,height=400,top='+((screen.height-400)/2)+',left='+((screen.width-500)/2)+',scrollbars=1,resizable=1,menubar=1'); return false;\"".$styling.'>'.
)."','MyWindow','width=500,height=400,top='+((screen.height-400)/2)+',left='+((screen.width-500)/2)+',scrollbars=1,resizable=1,menubar=1'); return false;\"".$styling.'>'.$myrow['title']."</a><br />\n"; $myrow['title']."</a><br />";
break; break;
case 'Exercise': case 'Exercise':
$TBL_EXERCICES = Database::get_course_table(TABLE_QUIZ_TEST); $TBL_EXERCICES = Database::get_course_table(TABLE_QUIZ_TEST);
$result = Database::query("SELECT * FROM $TBL_EXERCICES WHERE c_id = $course_id AND iid = $id"); $result = Database::query("SELECT * FROM $TBL_EXERCICES WHERE c_id = $course_id AND iid = $id");
$myrow = Database::fetch_array($result); $myrow = Database::fetch_array($result);
echo '<img src="../img/quiz.gif" align="middle" /> <a href="../exercice/exercise_submit.php?exerciseId='.$myrow['id'].'"'.$styling.'>'.$myrow['title']."</a><br />\n"; echo Display::return_icon('quiz.gif');
echo ' <a href="../exercice/exercise_submit.php?exerciseId='.$myrow['id'].'"'.$styling.'>'.$myrow['title']."</a><br />";
break; break;
case 'Forum': case 'Forum':
$TBL_FORUMS = Database::get_course_table(TABLE_FORUM); $TBL_FORUMS = Database::get_course_table(TABLE_FORUM);
$result = Database::query("SELECT * FROM $TBL_FORUMS WHERE c_id = $course_id AND forum_id=$id"); $result = Database::query("SELECT * FROM $TBL_FORUMS WHERE c_id = $course_id AND forum_id=$id");
$myrow = Database::fetch_array($result); $myrow = Database::fetch_array($result);
echo '<img src="../img/forum.gif" align="middle" /> <a href="../phpbb/viewforum.php?forum='.$myrow['forum_id'].'&amp;md5='.$myrow['md5'].'"'.$styling.'>'.$myrow['forum_name']."</a><br />\n"; echo Display::return_icon('forum.gif');
echo ' <a href="../phpbb/viewforum.php?forum='.$myrow['forum_id'].'&amp;md5='.$myrow['md5'].'"'.$styling.'>'.$myrow['forum_name']."</a><br />";
break; break;
case 'Thread': //=topics case 'Thread': //=topics
//@deprecated bb_posts, bb_posts_text, bb_forums //@deprecated bb_posts, bb_posts_text, bb_forums
@ -294,7 +295,8 @@ function display_addedresource_link($type, $id, $style = '')
$sql = "SELECT * FROM $tbl_post p WHERE c_id = $course_id AND post_id = $id"; $sql = "SELECT * FROM $tbl_post p WHERE c_id = $course_id AND post_id = $id";
$result = Database::query($sql); $result = Database::query($sql);
$post = Database::fetch_object($result); $post = Database::fetch_object($result);
echo '<img src="../img/forum.gif" align="middle" /> <a href="../phpbb/viewtopic.php?topic='.$post->topic_id.'&amp;forum='.$post->forum_id.'"'.$styling.'>'.$post->post_title."</a><br />\n"; echo Display::return_icon('forum.gif');
echo ' <a href="../phpbb/viewtopic.php?topic='.$post->topic_id.'&amp;forum='.$post->forum_id.'"'.$styling.'>'.$post->post_title."</a><br />";
break; break;
case 'Document': case 'Document':
$dbTable = Database::get_course_table(TABLE_DOCUMENT); $dbTable = Database::get_course_table(TABLE_DOCUMENT);
@ -318,11 +320,12 @@ function display_addedresource_link($type, $id, $style = '')
} }
$in_frames = in_array($ext, $array_ext); $in_frames = in_array($ext, $array_ext);
echo Display::return_icon($image);
echo '<img src="../img/'.$image.'" align="middle" /> <a href="../document/'.($in_frames ? 'showinframes.php?file=' : 'download.php?doc_url=').$myrow['path'].'"'.$styling.'>'.$filename."</a><br />\n"; echo ' <a href="../document/'.($in_frames ? 'showinframes.php?file=' : 'download.php?doc_url=').$myrow['path'].'"'.$styling.'>'.$filename."</a><br />";
break; break;
case 'Externallink': case 'Externallink':
echo '<img src="../img/links.gif" align="middle" /> <a href="'.$id.'"'.$styling.'>'.$id."</a><br />\n"; echo Display::return_icon('links.gif');
echo ' <a href="'.$id.'"'.$styling.'>'.$id."</a><br />\n";
break; break;
} }
} }
@ -351,8 +354,6 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_
$_course = api_get_course_info(); $_course = api_get_course_info();
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
$tbl_lp_item = Database::get_course_table(TABLE_LP_ITEM); $tbl_lp_item = Database::get_course_table(TABLE_LP_ITEM);
$hyperlink_target_parameter = ''; //or e.g. 'target="_blank"' $hyperlink_target_parameter = ''; //or e.g. 'target="_blank"'
@ -388,21 +389,20 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_
} }
if ($icon != 'nolink') { if ($icon != 'nolink') {
if ($completed == 'completed') { if ($completed == 'completed') {
echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; echo Display::return_icon('checkbox_on2.gif');
//echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>";
} else { } else {
echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; echo Display::return_icon('checkbox_on2.gif', 'on', array('style' => 'visibility: hidden' ));
//echo "&nbsp;"; //echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>";
} }
} }
if (($builder != 'builder') && ($icon != 'wrap')) { if (($builder != 'builder') && ($icon != 'wrap')) {
echo "</td><td>"; echo "</td><td>";
} }
if ($myrow['title'] == '') { if ($myrow['title'] == '') {
echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang( echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>";
'StepDeleted2'
)."</span>";
return (true); return (true);
} }
@ -410,7 +410,7 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_
return (shorten($myrow['title'], $length)); return (shorten($myrow['title'], $length));
} }
if ($icon == 'icon') { if ($icon == 'icon') {
echo "<img src='../img/agenda.gif' align=\"absmiddle\" alt='agenda'>"; echo Display::return_icon('agenda.gif');
} }
if ($builder != 'builder') { if ($builder != 'builder') {
echo "<a href=\"".api_get_self( echo "<a href=\"".api_get_self(
@ -469,12 +469,13 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_
} }
if ($icon != 'nolink') { if ($icon != 'nolink') {
if ($completed == 'completed') { if ($completed == 'completed') {
echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; echo Display::return_icon('checkbox_on2.gif');
} else { } else {
echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; echo Display::return_icon('checkbox_on2.gif', 'on', array('style' => 'visibility: hidden'));
//echo "&nbsp;"; //echo "&nbsp;";
} }
} }
if (($builder != 'builder') && ($icon != 'wrap')) { if (($builder != 'builder') && ($icon != 'wrap')) {
echo "</td><td>"; echo "</td><td>";
} }
@ -492,7 +493,7 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_
return (shorten($title, $length)); return (shorten($title, $length));
} }
if ($icon == 'icon') { if ($icon == 'icon') {
echo "<img src='../img/valves.gif' align=\"absmiddle\" alt='ad valvas'>"; echo Display::return_icon('valves.gif');
} }
if ($builder != 'builder') { if ($builder != 'builder') {
echo "<a href=\"".api_get_self( echo "<a href=\"".api_get_self(
@ -543,10 +544,9 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_
} }
if ($icon != 'nolink') { if ($icon != 'nolink') {
if ($completed == 'completed') { if ($completed == 'completed') {
echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; echo Display::return_icon('checkbox_on2.gif');
} else { } else {
echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; echo Display::return_icon('checkbox_on2.gif', 'on', array('style' => 'visibility: hidden'));
//echo "&nbsp;";
} }
} }
if (($builder != 'builder') && ($icon != 'wrap')) { if (($builder != 'builder') && ($icon != 'wrap')) {
@ -566,9 +566,9 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_
} }
if ($icon == 'icon') { if ($icon == 'icon') {
if ($linktype == 'Link _self') { if ($linktype == 'Link _self') {
echo "<img src='../img/links.gif' align=\"absmiddle\" alt='links'>"; echo Display::return_icon('links.gif', get_lang('Links'));
} else { } else {
echo "<img src='../img/link_blank.gif' align=\"absmiddle\" alt='blank links'>"; echo Display::return_icon('link_blank.gif');
} }
} }
$thelink = $myrow['url']; $thelink = $myrow['url'];
@ -625,10 +625,9 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_
} }
if ($icon != 'nolink') { if ($icon != 'nolink') {
if ($completed == 'completed') { if ($completed == 'completed') {
echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; echo Display::return_icon('checkbox_on2.gif');
} else { } else {
echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; echo Display::return_icon('checkbox_on2.gif', 'on', array('style' => 'visibility: hidden'));
//echo "&nbsp;";
} }
} }
if (($builder != 'builder') && ($icon != 'wrap')) { if (($builder != 'builder') && ($icon != 'wrap')) {
@ -647,7 +646,7 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_
return (shorten($myrow['title'], $length)); return (shorten($myrow['title'], $length));
} }
if ($icon == 'icon') { if ($icon == 'icon') {
echo "<img src='../img/quiz.gif' align=\"absmiddle\" alt='quizz'>"; echo Display::return_icon('quiz.gif');
} }
if ($builder != 'builder') { if ($builder != 'builder') {
echo "<a href=\"".api_get_self( echo "<a href=\"".api_get_self(
@ -706,10 +705,9 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_
} }
if ($icon != 'nolink') { if ($icon != 'nolink') {
if ($completed == 'completed') { if ($completed == 'completed') {
echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; echo Display::return_icon('checkbox_on2.gif');
} else { } else {
echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; echo Display::return_icon('checkbox_on2.gif', 'on', array('style' => 'visibility: hidden'));
//echo "&nbsp;";
} }
} }
if (($builder != 'builder') && ($icon != 'wrap')) { if (($builder != 'builder') && ($icon != 'wrap')) {
@ -728,7 +726,7 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_
return (shorten($name, $length)); return (shorten($name, $length));
} }
if ($icon == 'icon') { if ($icon == 'icon') {
echo "<img src='../img/jqz.jpg' align=\"absmiddle\" alt='hot potatoes'>"; echo Display::return_icon('jqz.gif');
} }
$cid = $_course['official_code']; $cid = $_course['official_code'];
@ -782,10 +780,9 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_
} }
if ($icon != 'nolink') { if ($icon != 'nolink') {
if ($completed == 'completed') { if ($completed == 'completed') {
echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; echo Display::return_icon('checkbox_on2.gif');
} else { } else {
echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; echo Display::return_icon('checkbox_on2.gif', 'on', array('style' => 'visibility: hidden'));
//echo "&nbsp;";
} }
} }
if (($builder != 'builder') && ($icon != 'wrap')) { if (($builder != 'builder') && ($icon != 'wrap')) {
@ -805,7 +802,7 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_
return (shorten($myrow['forum_name'], $length)); return (shorten($myrow['forum_name'], $length));
} }
if ($icon == 'icon') { if ($icon == 'icon') {
echo "<img src='../img/forum.gif' align=\"absmiddle\" alt='forum'>"; echo Display::return_icon('forum.gif');
} }
$forumparameters = "forum=".$myrow["forum_id"]."&md5=".$myrow["md5"]; $forumparameters = "forum=".$myrow["forum_id"]."&md5=".$myrow["md5"];
if ($builder != 'builder') { if ($builder != 'builder') {
@ -858,10 +855,9 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_
} }
if ($icon != 'nolink') { if ($icon != 'nolink') {
if ($completed == 'completed') { if ($completed == 'completed') {
echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; echo Display::return_icon('checkbox_on2.gif');
} else { } else {
echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; echo Display::return_icon('checkbox_on2.gif', 'on', array('style' => 'visibility: hidden'));
//echo "&nbsp;";
} }
} }
if (($builder != 'builder') && ($icon != 'wrap')) { if (($builder != 'builder') && ($icon != 'wrap')) {
@ -881,7 +877,7 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_
return (shorten($myrow['topic_title'], $length)); return (shorten($myrow['topic_title'], $length));
} }
if ($icon == 'icon') { if ($icon == 'icon') {
echo "<img src='../img/forum.gif' align=\"absmiddle\" alt='forum'>"; echo Display::return_icon('forum.gif');
} }
if ($builder != 'builder') { if ($builder != 'builder') {
echo "<a href=\"".api_get_self( echo "<a href=\"".api_get_self(
@ -942,10 +938,9 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_
} }
if ($icon != 'nolink') { if ($icon != 'nolink') {
if ($completed == 'completed') { if ($completed == 'completed') {
echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; echo Display::return_icon('checkbox_on2.gif');
} else { } else {
echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; echo Display::return_icon('checkbox_on2.gif', 'on', array('style' => 'visibility: hidden'));
//echo "&nbsp;";
} }
} }
if (($builder != 'builder') && ($icon != 'wrap')) { if (($builder != 'builder') && ($icon != 'wrap')) {
@ -965,7 +960,7 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_
return (shorten($myrow["post_title"], $length)); return (shorten($myrow["post_title"], $length));
} }
if ($icon == 'icon') { if ($icon == 'icon') {
echo "<img src='../img/forum.gif' align=\"absmiddle\" alt='forum'>"; echo Display::return_icon('forum.gif');
} }
if ($builder != 'builder') { if ($builder != 'builder') {
echo "<a href=\"".api_get_self()."?action=closelesson&source_forum=".intval( echo "<a href=\"".api_get_self()."?action=closelesson&source_forum=".intval(
@ -1017,10 +1012,9 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_
if ($icon != 'nolink') { if ($icon != 'nolink') {
if ($completed == 'completed') { if ($completed == 'completed') {
echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; echo Display::return_icon('checkbox_on2.gif');
} else { } else {
echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; echo Display::return_icon('checkbox_on2.gif', 'on', array('style' => 'visibility: hidden'));
//echo "&nbsp;";
} }
} }
if (($builder != 'builder') && ($icon != 'wrap')) { if (($builder != 'builder') && ($icon != 'wrap')) {
@ -1049,7 +1043,7 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_
return (shorten($filename, $length)); return (shorten($filename, $length));
} }
if ($icon == 'icon') { if ($icon == 'icon') {
echo "<img src='../img/$image' align=\"absmiddle\" alt='$image'>"; echo Display::return_icon($image);
} }
if ($builder != 'builder') { if ($builder != 'builder') {
echo "<a href=\"".api_get_self( echo "<a href=\"".api_get_self(
@ -1107,10 +1101,9 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_
} }
if ($icon != 'nolink') { if ($icon != 'nolink') {
if ($completed == 'completed') { if ($completed == 'completed') {
echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; echo Display::return_icon('checkbox_on2.gif');
} else { } else {
echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; echo Display::return_icon('checkbox_on2.gif', 'on', array('style' => 'visibility: hidden'));
//echo "&nbsp;";
} }
} }
if (($builder != 'builder') && ($icon != 'wrap')) { if (($builder != 'builder') && ($icon != 'wrap')) {
@ -1129,7 +1122,7 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_
return (shorten($name, $length)); return (shorten($name, $length));
} }
if ($icon == 'icon') { if ($icon == 'icon') {
echo "<img src='../img/works.gif' align=\"absmiddle\">"; echo Display::return_icon('works.gif');
} }
if ($builder != 'builder') { if ($builder != 'builder') {
echo "<a href=\"".api_get_self( echo "<a href=\"".api_get_self(
@ -1177,10 +1170,9 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_
} }
if ($icon != 'nolink') { if ($icon != 'nolink') {
if ($completed == 'completed') { if ($completed == 'completed') {
echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; echo Display::return_icon('checkbox_on2.gif');
} else { } else {
echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; echo Display::return_icon('checkbox_on2.gif', 'on', array('style' => 'visibility: hidden'));
//echo "&nbsp;";
} }
} }
if (($builder != 'builder') && ($icon != 'wrap')) { if (($builder != 'builder') && ($icon != 'wrap')) {
@ -1199,7 +1191,7 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_
return (shorten($name, $length)); return (shorten($name, $length));
} }
if ($icon == 'icon') { if ($icon == 'icon') {
echo "<img src='../img/dropbox.gif' align=\"absmiddle\">"; echo Display::return_icon('dropbox.gif');
} }
if ($builder != 'builder') { if ($builder != 'builder') {
@ -1248,10 +1240,9 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_
} }
if ($icon != 'nolink') { if ($icon != 'nolink') {
if ($completed == 'completed') { if ($completed == 'completed') {
echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; echo Display::return_icon('checkbox_on2.gif');
} else { } else {
echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; echo Display::return_icon('checkbox_on2.gif', 'on', array('style' => 'visibility: hidden'));
//echo "&nbsp;";
} }
} }
if (($builder != 'builder') && ($icon != 'wrap')) { if (($builder != 'builder') && ($icon != 'wrap')) {
@ -1270,7 +1261,7 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_
return (shorten($name, $length)); return (shorten($name, $length));
} }
if ($icon == 'icon') { if ($icon == 'icon') {
echo "<img src='../img/introduction.gif' align=\"absmiddle\" alt='introduction'>"; echo Display::return_icon('introduction.gif');
} }
if ($builder != 'builder') { if ($builder != 'builder') {
@ -1317,10 +1308,9 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_
} }
if ($icon != 'nolink') { if ($icon != 'nolink') {
if ($completed == 'completed') { if ($completed == 'completed') {
echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; echo Display::return_icon('checkbox_on2.gif');
} else { } else {
echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; echo Display::return_icon('checkbox_on2.gif', 'on', array('style' => 'visibility: hidden'));
//echo "&nbsp;";
} }
} }
if (($builder != 'builder') && ($icon != 'wrap')) { if (($builder != 'builder') && ($icon != 'wrap')) {
@ -1339,7 +1329,7 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_
return (shorten($name, $length)); return (shorten($name, $length));
} }
if ($icon == 'icon') { if ($icon == 'icon') {
echo "<img src='../img/info.gif' align=\"absmiddle\" alt='info'>"; echo Display::return_icon('info.gif');
} }
if ($builder != 'builder') { if ($builder != 'builder') {
@ -1386,10 +1376,9 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_
} }
if ($icon != 'nolink') { if ($icon != 'nolink') {
if ($completed == 'completed') { if ($completed == 'completed') {
echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; echo Display::return_icon('checkbox_on2.gif');
} else { } else {
echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; echo Display::return_icon('checkbox_on2.gif', 'on', array('style' => 'visibility: hidden'));
//echo "&nbsp;";
} }
} }
if (($builder != 'builder') && ($icon != 'wrap')) { if (($builder != 'builder') && ($icon != 'wrap')) {
@ -1408,7 +1397,7 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_
return (shorten($name, $length)); return (shorten($name, $length));
} }
if ($icon == 'icon') { if ($icon == 'icon') {
echo "<img src='../img/group.gif' align=\"absmiddle\" alt='group'>"; echo Display::return_icon('group.gif');
} }
if ($builder != 'builder') { if ($builder != 'builder') {
@ -1457,10 +1446,9 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_
} }
if ($icon != 'nolink') { if ($icon != 'nolink') {
if ($completed == 'completed') { if ($completed == 'completed') {
echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; echo Display::return_icon('checkbox_on2.gif');
} else { } else {
echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; echo Display::return_icon('checkbox_on2.gif', 'on', array('style' => 'visibility: hidden'));
//echo "&nbsp;";
} }
} }
if (($builder != 'builder') && ($icon != 'wrap')) { if (($builder != 'builder') && ($icon != 'wrap')) {
@ -1479,7 +1467,7 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_
return (shorten($name, $length)); return (shorten($name, $length));
} }
if ($icon == 'icon') { if ($icon == 'icon') {
echo "<img src='../img/members.gif' align=\"absmiddle\" alt='members'>"; echo Display::return_icon('members.gif');
} }
if ($builder != 'builder') { if ($builder != 'builder') {
@ -1833,7 +1821,9 @@ function remove_resource($resource_key)
function show_addresource_button($additionalparameters = '') function show_addresource_button($additionalparameters = '')
{ {
global $charset; global $charset;
echo '<label for="addresources"><img src="../img/attachment.gif" /></label><input class="link_alike" type="submit" name="addresources" id="addresources" value="'.api_htmlentities( echo '<label for="addresources">
'.Display::return_icon('attachment.gif').'
</label><input class="link_alike" type="submit" name="addresources" id="addresources" value="'.api_htmlentities(
get_lang('Attachment'), get_lang('Attachment'),
ENT_QUOTES, ENT_QUOTES,
$charset $charset
@ -1858,7 +1848,6 @@ function delete_one_added_resource($source_type, $source_id, $resource_type, $re
*/ */
function delete_added_resource($type, $id) function delete_added_resource($type, $id)
{ {
$_course = api_get_course_info();
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
$TABLERESOURCE = Database::get_course_table(TABLE_LINKED_RESOURCES); $TABLERESOURCE = Database::get_course_table(TABLE_LINKED_RESOURCES);
$sql = "DELETE FROM $TABLERESOURCE WHERE c_id = $course_id AND source_type='$type' and source_id='$id'"; $sql = "DELETE FROM $TABLERESOURCE WHERE c_id = $course_id AND source_type='$type' and source_id='$id'";
@ -1871,7 +1860,6 @@ function delete_added_resource($type, $id)
*/ */
function delete_all_resources_type($type) function delete_all_resources_type($type)
{ {
$_course = api_get_course_info();
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
$TABLERESOURCE = Database::get_course_table(TABLE_LINKED_RESOURCES); $TABLERESOURCE = Database::get_course_table(TABLE_LINKED_RESOURCES);
$sql = "DELETE FROM $TABLERESOURCE WHERE c_id = $course_id AND source_type='$type'"; $sql = "DELETE FROM $TABLERESOURCE WHERE c_id = $course_id AND source_type='$type'";
@ -1943,13 +1931,6 @@ function update_added_resources($type, $id)
function display_added_resources($type, $id, $style = '') function display_added_resources($type, $id, $style = '')
{ {
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
// The array containing the icons
$arr_icons = array(
'Agenda' => '../img/agenda.gif',
'Ad Valvas' => '../img/valves.gif',
'Link' => '../img/links.gif',
'Exercise' => '../img/quiz.gif'
);
global $origin; global $origin;
$TABLERESOURCE = Database::get_course_table(TABLE_LINKED_RESOURCES); $TABLERESOURCE = Database::get_course_table(TABLE_LINKED_RESOURCES);
@ -2008,9 +1989,9 @@ function display_resources($showdeleteimg)
echo "<a href=".api_get_self( echo "<a href=".api_get_self(
)."?showresources=true&amp;source_forum=".$_GET['source_forum']."&amp;resourceaction=removeresource&amp;locationkey=".key( )."?showresources=true&amp;source_forum=".$_GET['source_forum']."&amp;resourceaction=removeresource&amp;locationkey=".key(
$addedresource $addedresource
)."&amp;source_id=$source_id&amp;action=$action&amp;learnpath_id=$learnpath_id&amp;chapter_id=$chapter_id&amp;originalresource=no><img src='../img/delete.gif' border='0' alt='resource ".get_lang( )."&amp;source_id=$source_id&amp;action=$action&amp;learnpath_id=$learnpath_id&amp;chapter_id=$chapter_id&amp;originalresource=no>
'Delete' ".Display::return_icon('delete.gif', get_lang('Delete'))."
)."' /></a><br />"; </a><br />";
} }
echo '</td></tr>'; echo '</td></tr>';
next($addedresource); next($addedresource);
@ -2101,34 +2082,32 @@ function rl_get_html_resource_link($course_code, $type, $id, $style = '', $new_w
$TABLEAGENDA = Database::get_course_table(TABLE_AGENDA); $TABLEAGENDA = Database::get_course_table(TABLE_AGENDA);
$result = Database::query("SELECT * FROM $TABLEAGENDA WHERE c_id = $course_id AND id=$id"); $result = Database::query("SELECT * FROM $TABLEAGENDA WHERE c_id = $course_id AND id=$id");
$myrow = Database::fetch_array($result); $myrow = Database::fetch_array($result);
$output = '<img src="../img/agenda.gif" align="middle" /> <a href="../calendar/agenda.php"'.$styling.' '.$target.'>'.$myrow['title']."</a><br />\n"; $output = Display::return_icon('agenda.gif').' <a href="../calendar/agenda.php"'.$styling.' '.$target.'>'.$myrow['title']."</a><br />\n";
break; break;
case TOOL_ANNOUNCEMENT: case TOOL_ANNOUNCEMENT:
$tbl_announcement = Database::get_course_table(TABLE_ANNOUNCEMENT); $tbl_announcement = Database::get_course_table(TABLE_ANNOUNCEMENT);
$result = Database::query("SELECT * FROM $tbl_announcement WHERE c_id = $course_id AND id=$id"); $result = Database::query("SELECT * FROM $tbl_announcement WHERE c_id = $course_id AND id=$id");
$myrow = Database::fetch_array($result); $myrow = Database::fetch_array($result);
$output = '<img src="../img/valves.gif" align="middle" /> <a href="../announcements/announcements.php"'.$styling.' '.$target.'>'.$myrow['title']."</a><br />\n"; $output = Display::return_icon('valves.gif').' <a href="../announcements/announcements.php"'.$styling.' '.$target.'>'.$myrow['title']."</a><br />\n";
break; break;
case TOOL_LINK: case TOOL_LINK:
//doesn't take $target into account //doesn't take $target into account
$TABLETOOLLINK = Database::get_course_table(TABLE_LINK); $TABLETOOLLINK = Database::get_course_table(TABLE_LINK);
$result = Database::query("SELECT * FROM $TABLETOOLLINK WHERE c_id = $course_id AND id=$id"); $result = Database::query("SELECT * FROM $TABLETOOLLINK WHERE c_id = $course_id AND id=$id");
$myrow = Database::fetch_array($result); $myrow = Database::fetch_array($result);
$output = '<img src="../img/links.gif" align="middle" /> <a href="#" onclick="javascript:window.open(\'../link/link_goto.php?link_id='.$myrow['id'].'&amp;link_url='.urlencode( $output = Display::return_icon('links.gif').' <a href="#" onclick="javascript:window.open(\'../link/link_goto.php?link_id='.$myrow['id'].'&amp;link_url='.urlencode($myrow['url'])."','MyWindow','width=500,height=400,top='+((screen.height-400)/2)+',left='+((screen.width-500)/2)+',scrollbars=1,resizable=1,menubar=1'); return false;\"".$styling.'>'.$myrow['title']."</a><br />";
$myrow['url']
)."','MyWindow','width=500,height=400,top='+((screen.height-400)/2)+',left='+((screen.width-500)/2)+',scrollbars=1,resizable=1,menubar=1'); return false;\"".$styling.'>'.$myrow['title']."</a><br />\n";
break; break;
case TOOL_QUIZ: case TOOL_QUIZ:
$TBL_EXERCICES = Database::get_course_table(TABLE_QUIZ_TEST); $TBL_EXERCICES = Database::get_course_table(TABLE_QUIZ_TEST);
$result = Database::query("SELECT * FROM $TBL_EXERCICES WHERE c_id = $course_id AND iid = $id"); $result = Database::query("SELECT * FROM $TBL_EXERCICES WHERE c_id = $course_id AND iid = $id");
$myrow = Database::fetch_array($result); $myrow = Database::fetch_array($result);
$output = '<img src="../img/quiz.gif" align="middle" /> <a href="../exercice/exercise_submit.php?exerciseId='.$myrow['id'].'"'.$styling.' '.$target.'>'.$myrow['title']."</a><br />\n"; $output = Display::return_icon('quiz.gif').' <a href="../exercice/exercise_submit.php?exerciseId='.$myrow['id'].'"'.$styling.' '.$target.'>'.$myrow['title']."</a><br />";
break; break;
case TOOL_FORUM: case TOOL_FORUM:
$TBL_FORUMS = Database::get_course_table(TABLE_FORUM); $TBL_FORUMS = Database::get_course_table(TABLE_FORUM);
$result = Database::query("SELECT * FROM $TBL_FORUMS WHERE c_id = $course_id AND forum_id=$id"); $result = Database::query("SELECT * FROM $TBL_FORUMS WHERE c_id = $course_id AND forum_id=$id");
$myrow = Database::fetch_array($result); $myrow = Database::fetch_array($result);
$output = '<img src="../img/forum.gif" align="middle" /> <a href="../phpbb/viewforum.php?forum='.$myrow['forum_id'].'&md5='.$myrow['md5'].'"'.$styling.' '.$target.'>'.$myrow['forum_name']."</a><br />\n"; $output = Display::return_icon('forum.gif').' <a href="../phpbb/viewforum.php?forum='.$myrow['forum_id'].'&md5='.$myrow['md5'].'"'.$styling.' '.$target.'>'.$myrow['forum_name']."</a><br />";
break; break;
case TOOL_THREAD: //=topics case TOOL_THREAD: //=topics
//$tbl_forum = Database::get_course_table(TABLE_FORUM); //$tbl_forum = Database::get_course_table(TABLE_FORUM);
@ -2138,7 +2117,7 @@ function rl_get_html_resource_link($course_code, $type, $id, $style = '', $new_w
$sql_title = "SELECT * FROM $tbl_post WHERE c_id = $course_id AND post_id=".$id; $sql_title = "SELECT * FROM $tbl_post WHERE c_id = $course_id AND post_id=".$id;
$result_title = Database::query($sql_title); $result_title = Database::query($sql_title);
$myrow_title = Database::fetch_array($result_title); $myrow_title = Database::fetch_array($result_title);
$output = '<img src="../img/forum.gif" align="middle" /> <a href="../phpbb/viewtopic.php?topic='.$myrow_title['thread_id'].'&forum='.$myrow_title['forum_id'].'" '.$styling.' '.$target.'>'.$myrow_title['post_title']."</a><br />\n"; $output = Display::return_icon('forum.gif').' <a href="../phpbb/viewtopic.php?topic='.$myrow_title['thread_id'].'&forum='.$myrow_title['forum_id'].'" '.$styling.' '.$target.'>'.$myrow_title['post_title']."</a><br />\n";
break; break;
case TOOL_POST: case TOOL_POST:
$tbl_post = Database::get_course_table(TABLE_FORUM_POST); $tbl_post = Database::get_course_table(TABLE_FORUM_POST);
@ -2146,7 +2125,7 @@ function rl_get_html_resource_link($course_code, $type, $id, $style = '', $new_w
$sql = "SELECT * FROM $tbl_post p WHERE c_id = $course_id AND p.post_id = $id"; $sql = "SELECT * FROM $tbl_post p WHERE c_id = $course_id AND p.post_id = $id";
$result = Database::query($sql); $result = Database::query($sql);
$post = Database::fetch_array($result); $post = Database::fetch_array($result);
$output = '<img src="../img/forum.gif" align="middle" /> <a href="../phpbb/viewtopic.php?topic='.$post['thread_id'].'&forum='.$post['forum_id'].'"'.$styling.' '.$target.'>'.$post['post_title']."</a><br />\n"; $output = Display::return_icon('forum.gif').' <a href="../phpbb/viewtopic.php?topic='.$post['thread_id'].'&forum='.$post['forum_id'].'"'.$styling.' '.$target.'>'.$post['post_title']."</a><br />";
break; break;
case TOOL_DOCUMENT: case TOOL_DOCUMENT:
$tbl_doc = Database::get_course_table(TABLE_DOCUMENT); $tbl_doc = Database::get_course_table(TABLE_DOCUMENT);
@ -2160,7 +2139,7 @@ function rl_get_html_resource_link($course_code, $type, $id, $style = '', $new_w
$ext = strtolower($ext[sizeof($ext) - 1]); $ext = strtolower($ext[sizeof($ext) - 1]);
$myrow['path'] = rawurlencode($myrow['path']); $myrow['path'] = rawurlencode($myrow['path']);
$in_frames = in_array($ext, array('htm', 'html', 'gif', 'jpg', 'jpeg', 'png')); $in_frames = in_array($ext, array('htm', 'html', 'gif', 'jpg', 'jpeg', 'png'));
$output = '<img src="../img/'.$image.'" align="middle" /> <a href="../document/'.($in_frames ? 'showinframes.php?file=' : 'download.php?doc_url=').$myrow['path'].'"'.$styling.' '.$target.'>'.$filename."</a><br />\n"; $output = Display::return_icon($image).' <a href="../document/'.($in_frames ? 'showinframes.php?file=' : 'download.php?doc_url=').$myrow['path'].'"'.$styling.' '.$target.'>'.$filename."</a><br />";
break; break;
/* /*
case 'Externallink': case 'Externallink':

Loading…
Cancel
Save