Source for file btf_functions.php
Documentation is available at btf_functions.php
// $Id: btf_functions.php 13294 2007-09-27 02:14:48Z yannoo $
==============================================================================
Dokeos - elearning and course management software
Copyright (c) 2004-2005 Dokeos S.A.
Copyright (c) 2003 Ghent University
Copyright (c) 2001 Universite Catholique de Louvain
Copyright (c) various contributors
Copyright (c) Bart Mollet, Hogeschool Gent
For a full list of contributors, see "credits.txt".
The full license can be read in "license.txt".
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
See the GNU General Public License for more details.
Contact address: Dokeos, 44 rue des palais, B-1030 Brussels, Belgium
==============================================================================
==============================================================================
* HOME PAGE FUNCTIONS (BASIC TOOLS FIXED)
* This page, included in every course's index.php is the home
* page.To make administration simple, the professor edits his
* course from it's home page. Only the login detects that the
* visitor is allowed to activate, deactivate home page links,
* access to Professor's tools (statistics, edit forums...).
* @package dokeos.course_home
==============================================================================
$toolsRow_all = array ();
$sql = "SELECT a.*, t.image img, t.row, t.column FROM $TBL_ACCUEIL a, $TABLE_TOOLS t
WHERE a.link=t.link AND t.position='basic' ORDER BY t.row, t.column";
$sql = "SELECT a.*, t.image img FROM $TBL_ACCUEIL a, $TABLE_TOOLS t
WHERE (a.link=t.link AND t.position='external')
OR (a.visibility <= 1 AND (a.image = 'external.gif' OR a.image = 'scormbuilder.gif' OR t.image = 'blog.gif') AND a.image=t.image)
$sql = "SELECT a.*, t.image img FROM $TBL_ACCUEIL a, $TABLE_TOOLS t
WHERE a.visibility = 1 AND ((a.link=t.link AND t.position='external')
OR ((a.image = 'external.gif' OR a.image = 'scormbuilder.gif' OR t.image = 'blog.gif') AND a.image=t.image))
$sql = "SELECT a.*, t.image img, t.row, t.column FROM $TBL_ACCUEIL a, $TABLE_TOOLS t
WHERE admin=1 AND a.link=t.link ORDER BY t.row, t.column";
$sql = "SELECT *, image img FROM $TBL_ACCUEIL WHERE visibility = 2 ORDER BY id";
// grabbing all the tools from $course_tool_table
if ($tempRow['img'] !== "scormbuilder.gif" AND $tempRow['img'] !== "blog.gif")
$toolsRow_all[] = $tempRow;
// grabbing all the links that have the property on_homepage set to 1
$sql_links = "SELECT tl.*, tip.visibility
LEFT JOIN $tbl_item_property tip ON tip.tool='link' AND tip.ref=tl.id
WHERE tl.on_homepage='1' AND tip.visibility != 2";
$sql_links = "SELECT tl.*, tip.visibility
LEFT JOIN $tbl_item_property tip ON tip.tool='link' AND tip.ref=tl.id
WHERE tl.on_homepage='1' AND tip.visibility = 1";
$properties['name'] = $links_row['title'];
$properties['link'] = $links_row['url'];
$properties['visibility'] = $links_row['visibility'];
$properties['img'] = 'external.gif';
$toolsRow_all[] = $properties;
// draw line between basic and external, only if there are entries in External
if ($cat == "External" && count($toolsRow_all))
$table->setCellContents(0, 0, '<hr noshade="noshade" size="1"/>');
$table->updateCellAttributes(0, 0, 'colspan="3"');
$cell_number += $numcols;
foreach ($toolsRow_all as $toolsRow)
$tool_name = ($toolsRow['name_translated'] != "" ? $toolsRow['name_translated'] : htmlspecialchars($toolsRow['name'],ENT_QUOTES,$charset)); // RH: added htmlspecialchars
if ($toolsRow['img'] != "external.gif")
$qm_or_amp = ((strpos($toolsRow['link'], '?') === FALSE) ? '?' : '&');
else // if an external link ends with 'login=', add the actual login...
$pos = strpos($toolsRow['link'], "?login=");
$pos2 = strpos($toolsRow['link'], "&login=");
if ($pos !== false or $pos2 !== false)
$link_annex = $_user['username'];
// setting the actual image url
if ($toolsRow['visibility'] or $cat == 'courseAdmin' or $cat == 'claroAdmin')
$cell_content .= '<a href="'. $toolsRow['link']. $link_annex. '" target="'. $toolsRow['target']. '"><img src="'. $toolsRow['img']. '" alt="" border="0" style="vertical-align:middle;"/></a>'. "\n";
$cell_content .= '<a href="'. $toolsRow['link']. $link_annex. '" target="'. $toolsRow['target']. '">'. $tool_name. "</a>\n";
$cell_content .= '<a href="'. $toolsRow['link']. $link_annex. '" target="'. $toolsRow['target']. '"><img src="'. str_replace(".gif", "_na.gif", $toolsRow['img']). '" alt="" border="0" style="vertical-align:middle;"/></a>'. "\n";
$cell_content .= '<a href="'. $toolsRow['link']. $link_annex. '" target="'. $toolsRow['target']. '" class="invisible">'. $tool_name. '</a>'. "\n";
$cell_content .= '<img src="'. str_replace(".gif", "_na.gif", $toolsRow['img']). '" alt="" border="0" style="vertical-align:middle;">'. "\n";
$cell_content .= '<span class="invisible">'. $tool_name. '</span>';
if ($toolsRow["visibility"])
$link['cmd'] = "hide=yes";
$link['cmd'] = "restore=yes";
/*if($toolsRow["img"] == $dokeosRepositoryWeb."img/external.gif")
$link['name'] = get_lang('Remove'); $link['cmd'] = "remove=yes";
if ($toolsRow["visibility"]==2 and $cat=="claroAdmin")
$link['name'] = get_lang('Delete'); $link['cmd'] = "askDelete=yes";
//echo "<div class=courseadmin>";
foreach ($lnk as $thisLnk)
if ($toolsRow['adminlink'])
//echo "edit link:".$properties['adminlink'];
$cell_content .= "<a href=\"". api_get_self(). "?id=". $toolsRow["id"]. "&". $thisLnk['cmd']. "\">". $thisLnk['name']. "</a>";
// RH: Allow editing of invisible homepage links (modified external_module)
$cell_content .= "<a class=\"nobold\" href=\"". api_get_path(WEB_CODE_PATH). 'external_module/external_module.php'. "?id=". $toolsRow["id"]. "\">". get_lang("Edit"). "</a>";
$table->setCellContents($cell_number / $numcols, ($cell_number) % $numcols, $cell_content);
$table->updateCellAttributes($cell_number / $numcols, ($cell_number) % $numcols, 'width="32%" height="42"');
} // end function showtools2($cat)
|