0)
$all_tools_list[] = $toolsRow;
}
else
$all_tools_list[] = $toolsRow;
}
}
if(isset($all_tools_list))
{
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(api_is_allowed_to_edit())
{
if($toolsRow['visibility'] == '1' && $toolsRow['admin'] !='1' && !strpos($toolsRow['link'],'learnpath_handler.php?learnpath_id'))
{
$link['name'] = ' ';
$link['cmd'] = "hide=yes";
$lnk[] = $link;
}
if($toolsRow['visibility'] == '0' && $toolsRow['admin'] !='1')
{
$link['name'] = ' ';
$link['cmd'] = "restore=yes";
$lnk[] = $link;
}
if($toolsRow['adminlink'])
{
echo ' ';
}
}
if( api_is_platform_admin() )
{
if($toolsRow['admin'] !='1')
{
$link['cmd'] = "hide=yes";
}
}
if(is_array($lnk))
{
foreach($lnk as $this_link)
{
if(!$toolsRow['adminlink'])
{
echo "" . $this_link['name'] . "";
}
}
}
else{ echo ' ';}
// Allow editing of invisible homepage links (modified external_module)
if($toolsRow["added_tool"] == 1 &&
api_is_allowed_to_edit() && !$toolsRow["visibility"])
echo "". get_lang("Edit"). "";
// 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) ? '?' : '&');
echo "\t" . '   ';
echo ' ';
echo ($toolsRow['image'] == 'external.gif' || $toolsRow['image'] == 'external_na.gif' || $toolsRow['image'] == 'scormbuilder.gif' || $toolsRow['image'] == 'blog.gif') ? ' '.htmlspecialchars(stripslashes($toolsRow['name'])) : ' '.get_lang($toolsRow['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())
{
/* Work request */
/*
-----------------------------------------------------------
Modify home page
-----------------------------------------------------------
*/
/*
* display message to confirm that a tool must be hidden from the list of available tools
* (visibility 0,1->2)
*/
/*if($_GET["remove"])
{
$msgDestroy=get_lang('DelLk').'
';
$msgDestroy.=''.get_lang('No').' | ';
$msgDestroy.=''.get_lang('Yes').'';
Display :: display_normal_message($msgDestroy);
}*/
/*
* Process hiding a tools from available tools.
* visibility=2 are only view by Dokeos Administrator (visibility 0,1->2)
*/
/*elseif($_GET["destroy"])
{
api_sql_query("UPDATE $tool_table SET visibility='2' WHERE id='".$_GET["id"]."'",__FILE__,__LINE__);
}*/
/*
-----------------------------------------------------------
HIDE
-----------------------------------------------------------
*/
if($_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($_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($_GET["askDelete"])
{
?>