123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271 |
- <?php
- require_once api_get_path(LIBRARY_PATH).'course_home.lib.php';
- $hide = isset($_GET['hide']) && $_GET['hide'] == 'yes' ? 'yes' : null;
- $restore = isset($_GET['restore']) && $_GET['restore'] == 'yes' ? 'yes' : null;
- $id = isset($_GET['id']) ? intval($_GET['id']) : null;
- $TABLE_TOOLS = Database::get_main_table(TABLE_MAIN_COURSE_MODULE);
- $TBL_ACCUEIL = Database::get_course_table(TABLE_TOOL_LIST);
- if (api_is_allowed_to_edit(null,true)) {
-
- if($remove)
- {
- $sql = "SELECT * FROM $TBL_ACCUEIL WHERE id=$id";
- $result = Database::query($sql,__FILE__,__LINE__);
- $toolsRow = Database::fetch_array($result);
- $tool_name = htmlspecialchars($toolsRow['name'] != "" ? $toolsRow['name'] : $toolsRow['link'],ENT_QUOTES,$charset);
- if($toolsRow['img'] != "external.gif")
- {
- $toolsRow['link']=api_get_path(WEB_CODE_PATH).$toolsRow['link'];
- }
- $toolsRow['image']=api_get_path(WEB_CODE_PATH)."img/".$toolsRow['image'];
- echo "<br><br><br>\n";
- echo "<table class=\"message\" width=\"70%\" align=\"center\">\n",
- "<tr><td width=\"7%\" align=\"center\">\n",
- "<a href=\"".$toolsRow['link']."\">".Display::return_icon($toolsRow['image'], get_lang('Delete')),"</a></td>\n",
- "<td width=\"28%\" height=\"45\"><small>\n",
- "<a href=\"".$toolsRow['link']."\">".$tool_name."</a></small></td>\n";
- echo "<td align=\"center\">\n",
- "<font color=\"#ff0000\">",
- " ",
- "<strong>",get_lang('DelLk'),"</strong>",
- "<br> \n",
- "<a href=\"".api_get_self()."\">",get_lang('No'),"</a>\n",
- " | \n",
- "<a href=\"".api_get_self()."?destroy=yes&id=$id\">",get_lang('Yes'),"</a>\n",
- "</font></td></tr>\n",
- "</table>\n";
- echo "<br><br><br>\n";
- }
-
- elseif ($destroy)
- {
- Database::query("UPDATE $TBL_ACCUEIL SET visibility='2' WHERE id=$id");
- }
-
- elseif ($hide)
- {
- Database::query("UPDATE $TBL_ACCUEIL SET visibility=0 WHERE id=$id");
- Display::display_confirmation_message(get_lang('ToolIsNowHidden'));
- }
-
- elseif ($restore)
- {
- Database::query("UPDATE $TBL_ACCUEIL SET visibility=1 WHERE id=$id");
- Display::display_confirmation_message(get_lang('ToolIsNowVisible'));
- }
-
- elseif (isset ($update) && $update)
- {
- $result = Database::query("SELECT * FROM $TBL_ACCUEIL WHERE id=$id");
- $toolsRow = Database::fetch_array($result);
- $racine = $_configuration['root_sys']."/".$currentCourseID."/images/";
- $chemin = $racine;
- $name = $toolsRow[1];
- $image = $toolsRow[3];
- echo "<tr>\n",
- "<td colspan=\"4\">\n",
- "<table>\n",
- "<tr>\n",
- "<td>\n",
- "<form method=\"post\" action=\"".api_get_self()."\">\n",
- "<input type=\"hidden\" name=\"id\" value=\"$id\">\n",
- "Image : ".Display::return_icon($image)."\n",
- "</td>\n",
- "<td>\n",
- "<select name=\"image\">\n",
- "<option selected>",$image,"</option>\n";
- if ($dir = @opendir($chemin))
- {
- while($file = readdir($dir))
- {
- if($file==".." OR $file==".")
- {
- unset($file);
- }
- echo "<option>",$file,"</option>\n";
- }
- closedir($dir);
- }
- echo "</select>\n",
- "</td>\n",
- "</tr>\n",
- "<tr>\n",
- "<td>",get_lang('NameOfTheLink')," : </td>\n",
- "<td><input type=\"text\" name=\"name\" value=\"",$name,"\"></td>\n",
- "</tr>\n",
- "<tr>\n",
- "<td>Lien :</td>\n",
- "<td><input type=\"text\" name=\"link\" value=\"",$link,"\"></td>\n",
- "</tr>\n",
- "<tr>\n",
- "<td colspan=\"2\"><input type=\"submit\" name=\"submit\" value=\"",get_lang('Ok'),"\"></td>\n",
- "</tr>\n",
- "</form>\n",
- "</table>\n",
- "</td>\n",
- "</tr>\n";
- }
- }
- if ($is_platformAdmin && api_is_allowed_to_edit(null,true) && !api_is_coach())
- {
-
-
- if($askDelete)
- {
- echo "<table align=\"center\"><tr>\n",
- "<td colspan=\"4\">\n",
- "<br><br>\n",
- "<font color=\"#ff0000\">",
- " ",
- "<strong>",get_lang('DelLk'),"</strong>",
- "<br> \n",
- "<a href=\"".api_get_self()."\">",get_lang('No'),"</a>\n",
- " | \n",
- "<a href=\"".api_get_self()."?delete=yes&id=$id\">",get_lang('Yes'),"</a>\n",
- "</font>\n",
- "<br><br><br>\n",
- "</td>\n",
- "</tr>",
- "</table>\n";
- }
-
- elseif (isset($delete) && $delete)
- {
- Database::query("DELETE FROM $TBL_ACCUEIL WHERE id=$id AND added_tool=1");
- }
- }
- echo "<table class=\"item\" align=\"center\" border=\"0\" width=\"95%\">\n";
- echo "<tr>\n<td colspan=\"6\"> </td>\n</tr>\n";
- echo "<tr>\n<td colspan=\"6\">";
- CourseHome::show_tool_3column('Basic');
- CourseHome::show_tool_3column('External');
- echo "</td>\n</tr>\n";
- if (api_is_allowed_to_edit(null,true) && !api_is_coach()) {
- echo "<tr><td colspan=\"6\"><hr noshade size=\"1\" /></td></tr>\n",
- "<tr>\n","<td colspan=\"6\">\n",
- "<font color=\"#F66105\">\n",get_lang('CourseAdminOnly'),"</font>\n",
- "</td>\n","</tr>\n";
- echo "<tr>\n<td colspan=\"6\">";
- CourseHome::show_tool_3column('courseAdmin');
- echo "</td>\n</tr>\n";
- }
- if ($is_platformAdmin && api_is_allowed_to_edit(null,true) && !api_is_coach())
- {
- echo "<tr>","<td colspan=\"6\">",
- "<hr noshade size=\"1\" />",
- "</td>","</tr>\n",
- "<tr>\n","<td colspan=\"6\">\n",
- "<font color=\"#F66105\" >",get_lang('PlatformAdminOnly'),"</font>\n",
- "</td>\n","</tr>\n";
- echo "<tr>\n<td colspan=\"6\">";
- CourseHome::show_tool_3column('platformAdmin');
- echo "</td>\n</tr>\n";
- }
- echo "</table>\n";
- ?>
|