0)
$all_tools_list[] = $toolsRow;
}
else
$all_tools_list[] = $toolsRow;
}
}
if(isset($all_tools_list))
{
$lnk = '';
foreach($all_tools_list as $toolsRow)
{
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"]));
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;
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 AND REACTIVATE
-----------------------------------------------------------
*/
if ($_GET["id"]==strval(intval($_GET["id"]))) {
$sql="UPDATE $tool_table SET visibility='".Database::escape_string($requested_visible)."' WHERE id='".$_GET["id"]."'";
api_sql_query($sql,__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
{
api_sql_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
{
api_sql_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']))
{
?>
".'

'; ?>