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'));
$link['cmd'] = "hide=yes";
$lnk[] = $link;
}
if($toolsRow['visibility'] == '0' && $toolsRow['admin'] !='1')
{
$link['name'] = Display::return_icon('invisible.gif', get_lang('Activate'));
$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'] . "";
}
}
}
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" . '';
}
else if(strpos($toolsRow['name'],'chat')!==false && api_get_course_setting('allow_open_chat_window')==true)
{
/*
$toollink = "\t" . '';
*/
$toollink = "\t" . '';
}
else
{
if (count(explode('type=classroom',$toolsRow['link']))==2 || count(explode('type=conference',$toolsRow['link']))==2) {
$toollink = "\t" . '';
} else {
$toollink = "\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'));
echo ' ';
echo $toollink;
/*
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(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']))
{
?>