0) { while($links_row = Database::fetch_array($result_links)) { unset($properties); $properties['name'] = $links_row['title']; $properties['session_id'] = $links_row['session_id']; $properties['link'] = $links_row['url']; $properties['visibility'] = $links_row['visibility']; $properties['image'] = ($links_row['visibility']== '0') ? "file_html.gif" : "file_html.gif"; $properties['adminlink'] = api_get_path(WEB_CODE_PATH) . "link/link.php?action=editlink&id=".$links_row['id']; $properties['target'] = $links_row['target']; $tmp_all_tools_list[] = $properties; } } } if(isset($tmp_all_tools_list)) { foreach($tmp_all_tools_list as $toolsRow) { if($toolsRow['image'] == 'blog.gif') { // Init $tbl_blogs_rel_user = Database::get_course_table(TABLE_BLOGS_REL_USER); // Get blog id $blog_id = substr($toolsRow['link'], strrpos($toolsRow['link'], '=') + 1, strlen($toolsRow['link'])); // Get blog members if($is_platform_admin) { $sql_blogs = " SELECT * FROM " . $tbl_blogs_rel_user . " `blogs_rel_user` WHERE `blog_id` = " . $blog_id; } else { $sql_blogs = " SELECT * FROM " . $tbl_blogs_rel_user . " `blogs_rel_user` WHERE `blog_id` = " . $blog_id . " AND `user_id` = " . api_get_user_id(); } $result_blogs = Database::query($sql_blogs, __FILE__, __LINE__); if(Database::num_rows($result_blogs) > 0) $all_tools_list[] = $toolsRow; } else $all_tools_list[] = $toolsRow; } } if(isset($all_tools_list)) { $lnk = ''; foreach($all_tools_list as $toolsRow) { if (api_get_session_id()!=0 && in_array($toolsRow['name'],array('course_maintenance','course_setting'))) { continue; } if(!($i%2)) {echo "\n";} // This part displays the links to hide or remove a tool. // These links are only visible by the course manager. unset($lnk); echo '' . "\n"; if($is_allowed_to_edit) { if($toolsRow['visibility'] == '1' && $toolsRow['admin'] !='1') { $link['name'] = Display::return_icon('visible.gif', get_lang('Deactivate'),array('id'=>'linktool_'.$toolsRow["id"])); $link['cmd'] = "hide=yes"; $lnk[] = $link; } if($toolsRow['visibility'] == '0' && $toolsRow['admin'] !='1') { $link['name'] = Display::return_icon('invisible.gif', get_lang('Activate'),array('id'=>'linktool_'.$toolsRow["id"])); $link['cmd'] = "restore=yes"; $lnk[] = $link; } if(!empty($toolsRow['adminlink'])) { echo ''.Display::return_icon('edit.gif', get_lang('Edit')).''; } } // Both checks are necessary as is_platform_admin doesn't take student view into account if( $is_platform_admin && $is_allowed_to_edit) { if($toolsRow['admin'] !='1') { $link['cmd'] = "hide=yes"; } } if(isset($lnk) && is_array($lnk)) { foreach($lnk as $this_link) { if(empty($toolsRow['adminlink'])) { echo "" . $this_link['name'] . ""; //echo "" . $this_link['name'] . ""; } } } else{ echo '    ';} // NOTE : table contains only the image file name, not full path if(!stristr($toolsRow['link'], 'http://') && !stristr($toolsRow['link'], 'https://') && !stristr($toolsRow['link'],'ftp://')) $toolsRow['link'] = $web_code_path . $toolsRow['link']; if($toolsRow['visibility'] == '0' && $toolsRow['admin'] != '1') { $class="class=\"invisible\""; $info = pathinfo($toolsRow['image']); $basename = basename ($toolsRow['image'],'.'.$info['extension']); // $file is set to "index" $toolsRow['image'] = $basename.'_na.'.$info['extension']; } else $class=''; $qm_or_amp = ((strpos($toolsRow['link'], '?') === FALSE) ? '?' : '&'); //If it's a link, we don't add the cidReq if($toolsRow['image'] == 'file_html.gif' || $toolsRow['image'] == 'file_html_na.gif'){ $toolsRow['link'] = $toolsRow['link'].$qm_or_amp; } else{ $toolsRow['link'] = $toolsRow['link'].$qm_or_amp.api_get_cidreq(); } if(strpos($toolsRow['name'],'visio_')!==false) { /* $toollink = "\t" . ''; */ $toollink = "\t" . ''; $my_tool_link = "\t" . ''; } else if(strpos($toolsRow['name'],'chat')!==false && api_get_course_setting('allow_open_chat_window')==true) { /* $toollink = "\t" . ''; */ $toollink = "\t" . ''; $my_tool_link="\t" . ''; } else { if (count(explode('type=classroom',$toolsRow['link']))==2 || count(explode('type=conference',$toolsRow['link']))==2) { //$toollink = "\t" . ''; $toollink = "\t" . ''; $my_tool_link = "\t" . ''; } else { //$toollink = "\t" . ''; $toollink = "\t" . ''; $my_tool_link = "\t" . ''; } } echo $toollink; //var_dump($toollink); /* Display::display_icon($toolsRow['image'], get_lang(ucfirst($toolsRow['name']))); */ if ($toolsRow['image'] == 'file_html.gif' || $toolsRow['image'] == 'file_html_na.gif' || $toolsRow['image'] == 'scormbuilder.gif' || $toolsRow['image'] == 'scormbuilder_na.gif' || $toolsRow['image'] == 'blog.gif' || $toolsRow['image'] == 'blog_na.gif' || $toolsRow['image'] == 'external.gif' || $toolsRow['image'] == 'external_na.gif') { $tool_name = stripslashes($toolsRow['name']); } else { $tool_name = get_lang(ucfirst($toolsRow['name'])); } Display::display_icon($toolsRow['image'], $tool_name, array('class'=>'tool-icon','id'=>'toolimage_'.$toolsRow["id"])); //validacion when belongs to a session $session_img = api_get_session_image($toolsRow['session_id'], $_user['status']); echo ' '; echo $my_tool_link; /* echo ($toolsRow['image'] == 'file_html_na.gif' || $toolsRow['image'] == 'file_html.gif' || $toolsRow['image'] == 'scormbuilder.gif' || $toolsRow['image'] == 'scormbuilder_na.gif' || $toolsRow['image'] == 'blog.gif' || $toolsRow['image'] == 'blog_na.gif' || $toolsRow['image'] == 'external.gif' || $toolsRow['image'] == 'external_na.gif') ? ' '.stripslashes($toolsRow['name']) : ' '.get_lang(ucfirst($toolsRow['name'])); */ echo "{$tool_name}$session_img"; echo "\t" . ''; echo ''; if($i%2) { echo ""; } $i++; } } if($i%2) { echo " \n", "\n"; } } //End of functions show tools /* ============================================================================== MAIN CODE ============================================================================== */ /* ----------------------------------------------------------- Work with data post askable by admin of course (franglais, clean this) ----------------------------------------------------------- */ if (isset($_GET['sent_http_request']) && $_GET['sent_http_request']==1) { if(api_is_allowed_to_edit()) { $tool_table = Database::get_course_table(TABLE_TOOL_LIST); $tool_id = Security::remove_XSS($_GET["id"]); $tool_info = api_get_tool_information($tool_id); $tool_visibility = $tool_info['visibility']; $tool_image = $tool_info['image']; $new_image = str_replace('.gif','_na.gif',$tool_image); $requested_image = ($tool_visibility == 0 ) ? $tool_image : $new_image; $requested_clase = ($tool_visibility == 0 ) ? 'visible' : 'invisible'; $requested_message = ($tool_visibility == 0 ) ? 'is_active' : 'is_inactive'; $requested_view = ($tool_visibility == 0 ) ? 'visible.gif' : 'invisible.gif'; $requested_visible = ($tool_visibility == 0 ) ? 1 : 0; /* ----------------------------------------------------------- HIDE ----------------------------------------------------------- */ if(isset($_GET['visibility']) && $_GET['visibility']==0) // visibility 1 -> 0 { if ($_GET["id"]==strval(intval($_GET["id"]))) { $sql="UPDATE $tool_table SET visibility=0 WHERE id='".$_GET["id"]."'"; Database::query($sql,__FILE__,__LINE__); } } /* ----------------------------------------------------------- REACTIVATE ----------------------------------------------------------- */ elseif(isset($_GET['visibility'])&& $_GET['visibility']==1) // visibility 0,2 -> 1 { if ($_GET["id"]==strval(intval($_GET["id"]))) { Database::query("UPDATE $tool_table SET visibility=1 WHERE id='".$_GET["id"]."'",__FILE__,__LINE__); } } $response_data = array( 'image' => $requested_image, 'tclass' => $requested_clase, 'message' => $requested_message, 'view' => $requested_view ); print(json_encode($response_data)); exit; } } else { if(api_is_allowed_to_edit()) { /* ----------------------------------------------------------- HIDE ----------------------------------------------------------- */ if(!empty($_GET['hide'])) // visibility 1 -> 0 { Database::query("UPDATE $tool_table SET visibility=0 WHERE id='".$_GET["id"]."'",__FILE__,__LINE__); Display::display_confirmation_message(get_lang('ToolIsNowHidden')); } /* ----------------------------------------------------------- REACTIVATE ----------------------------------------------------------- */ elseif(!empty($_GET['restore'])) // visibility 0,2 -> 1 { Database::query("UPDATE $tool_table SET visibility=1 WHERE id='".$_GET["id"]."'",__FILE__,__LINE__); Display::display_confirmation_message(get_lang('ToolIsNowVisible')); } } } // work with data post askable by admin of course if(api_is_platform_admin()) { // Show message to confirm that a tools must be hide from available tools // visibility 0,1->2 if(!empty($_GET['askDelete'])) { ?>

     |  ">
0) { $rows_session_category = Database::store_result($rs_category); $rows_session_category = $rows_session_category[0]; $session_category = $rows_session_category['name']; } if ($session['date_start'] == '00-00-0000') { $msg_date = get_lang('NoTimeLimits'); } else { $msg_date = get_lang('From').' '.$session['date_start'].' '.get_lang('To').' '.$session['date_end']; } $output = ''; if (!empty($session_category)) { $output .= ''. get_lang('SessionCategory') . ': ' . '' . $session_category .''; } $output .= ''. get_lang('SessionName') . ': ' . '' . $session['name'] .''. get_lang('GeneralCoach') . ': ' . '' . $session['lastname'].' '.$session['firstname'].' ('.$session['username'].')' .''; $output .= ''. get_lang('SessionIdentifier') . ': '. Display::return_icon('star.png', ' ', array('align' => 'absmiddle')) .''. get_lang('Date') . ': ' . '' . $msg_date .''; return $output; } /* ============================================================================== COURSE ADMIN ONLY VIEW ============================================================================== */ // start of tools for CourseAdmins (teachers/tutors) if(api_is_allowed_to_edit()) { $current_protocol = $_SERVER['SERVER_PROTOCOL']; $current_host = $_SERVER['HTTP_HOST']; $server_protocol = substr($current_protocol,0,strrpos($current_protocol,'/')); $server_protocol = $server_protocol.'://'; if ($current_host == 'localhost') { //Get information of path $info = explode('courses',api_get_self()); $path_work = substr($info[0], 0, strlen($info[0])); } else { $path_work = ""; } ?> 0) { ?>
0) { ?>