| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
function toolbar_pagesetup() { |
|---|
| 4 |
|
|---|
| 5 |
global $CFG, $metatags; |
|---|
| 6 |
require_once($CFG->dirroot.'lib/filelib.php'); // to ensure file_get_contents() |
|---|
| 7 |
$css = file_get_contents($CFG->dirroot . "mod/toolbar/css"); |
|---|
| 8 |
$css = str_replace("{{url}}", $CFG->wwwroot, $css); |
|---|
| 9 |
$metatags .= $css; |
|---|
| 10 |
*/ |
|---|
| 11 |
} |
|---|
| 12 |
|
|---|
| 13 |
function toolbar_init() { |
|---|
| 14 |
global $CFG, $template; |
|---|
| 15 |
$CFG->templates->variables_substitute['toolbar'][] = "toolbar_mainbody"; |
|---|
| 16 |
$CFG->templates->variables_substitute['searchbox'][] = "toolbar_searchbox"; |
|---|
| 17 |
} |
|---|
| 18 |
|
|---|
| 19 |
function toolbar_mainbody($vars) { |
|---|
| 20 |
|
|---|
| 21 |
global $CFG; |
|---|
| 22 |
require_once($CFG->dirroot.'lib/filelib.php'); |
|---|
| 23 |
if (isloggedin()) { |
|---|
| 24 |
$toolbar = file_get_contents($CFG->dirroot . "mod/toolbar/toolbar.inc"); |
|---|
| 25 |
} else { |
|---|
| 26 |
$toolbar = file_get_contents($CFG->dirroot . "mod/toolbar/toolbarloggedout.inc"); |
|---|
| 27 |
} |
|---|
| 28 |
|
|---|
| 29 |
if (isset($vars[1]) && $vars[1] == 'box') { |
|---|
| 30 |
$css = file_get_contents($CFG->dirroot . "mod/toolbar/css-box"); |
|---|
| 31 |
} else { |
|---|
| 32 |
$css = file_get_contents($CFG->dirroot . "mod/toolbar/css"); |
|---|
| 33 |
} |
|---|
| 34 |
$css = str_replace("{{url}}", $CFG->wwwroot, $css); |
|---|
| 35 |
$toolbar .= "{$css}"; |
|---|
| 36 |
|
|---|
| 37 |
$toolbar = str_replace("{{url}}", $CFG->wwwroot, $toolbar); |
|---|
| 38 |
$toolbar = str_replace("{{menu}}", templates_variables_substitute(array(array(),"menu")), $toolbar); |
|---|
| 39 |
$toolbar = str_replace("{{topmenu}}", templates_variables_substitute(array(array(),"topmenu")), $toolbar); |
|---|
| 40 |
$toolbar = str_replace("{{logon}}", __gettext("Log on:"), $toolbar); |
|---|
| 41 |
$toolbar = str_replace("{{username}}", __gettext("Username"), $toolbar); |
|---|
| 42 |
$toolbar = str_replace("{{password}}", __gettext("Password"), $toolbar); |
|---|
| 43 |
$toolbar = str_replace("{{poweredby}}", __gettext("Powered by Elgg"), $toolbar); |
|---|
| 44 |
$toolbar = str_replace("{{remember}}", __gettext("Remember me"), $toolbar); |
|---|
| 45 |
if (isloggedin()) { |
|---|
| 46 |
$toolbar = str_replace("{{usericon}}", "<a href=\"{$CFG->wwwroot}{$_SESSION['username']}\">" . user_icon_html($_SESSION['userid'], 50) . "</a>", $toolbar); |
|---|
| 47 |
} else { |
|---|
| 48 |
$toolbar = str_replace("{{usericon}}", user_icon_html(-1, 50), $toolbar); |
|---|
| 49 |
} |
|---|
| 50 |
|
|---|
| 51 |
return $toolbar; |
|---|
| 52 |
|
|---|
| 53 |
} |
|---|
| 54 |
|
|---|
| 55 |
function toolbar_searchbox($vars) { |
|---|
| 56 |
|
|---|
| 57 |
global $CFG; |
|---|
| 58 |
$all = __gettext("all"); |
|---|
| 59 |
$people = __gettext("People"); |
|---|
| 60 |
$communities = __gettext("Communities"); |
|---|
| 61 |
$tagcloud = __gettext("Tag cloud"); |
|---|
| 62 |
$browse = __gettext("Browse"); |
|---|
| 63 |
$searchdefault = __gettext("Search"); |
|---|
| 64 |
|
|---|
| 65 |
$searchbox = <<< END |
|---|
| 66 |
|
|---|
| 67 |
<div id="search-header"><!-- open search-header div --> |
|---|
| 68 |
<form id="searchform" action="{$CFG->wwwroot}search/index.php" method="get"> |
|---|
| 69 |
<p><input type="text" size="20" name="tag" value="{$searchdefault}" onclick="if (this.value=='{$searchdefault}') { this.value='' }" /> |
|---|
| 70 |
<select name="user_type"> |
|---|
| 71 |
<option value="">-- {$all} --</option> |
|---|
| 72 |
<option value="person">{$people}</option> |
|---|
| 73 |
<option value="community">{$communities}</option> |
|---|
| 74 |
</select> |
|---|
| 75 |
<input type="submit" value="Go" /><span><br />[<a href="{$CFG->wwwroot}mod/browser/"><b>{$browse}</b></a>] [<a href="{$CFG->wwwroot}search/tags.php"><b>{$tagcloud}</b></a>]</span></p> |
|---|
| 76 |
</form> |
|---|
| 77 |
</div><!-- close search-header div --> |
|---|
| 78 |
|
|---|
| 79 |
END; |
|---|
| 80 |
|
|---|
| 81 |
return $searchbox; |
|---|
| 82 |
|
|---|
| 83 |
} |
|---|
| 84 |
|
|---|
| 85 |
?> |
|---|