summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authordeva <deva>2010-01-25 15:44:05 +0000
committerdeva <deva>2010-01-25 15:44:05 +0000
commit24e070a294aba51f85bc0120fd25e16426347d64 (patch)
tree0248211eae4bf9fda4ddcf793de8412fdccd6647 /utils
parentaf2ce991eed7d22831aaed980828b624e787470f (diff)
Added links module (no admin yet...)
Diffstat (limited to 'utils')
-rw-r--r--utils/modules/links.php (renamed from utils/links.php)64
1 files changed, 50 insertions, 14 deletions
diff --git a/utils/links.php b/utils/modules/links.php
index d9ed1d9..cf0cfed 100644
--- a/utils/links.php
+++ b/utils/modules/links.php
@@ -13,16 +13,20 @@ class Link {
public function show()
{
- echo "<div class=\"link\">\n";
+ $str = "";
+
+ $str .= "<div class=\"link\">\n";
if($this->icon != "") {
- echo " <a class=\"link_icon\" rel=\"external\" href=\"" . $this->href . "\">\n";
- echo " <img alt=\"" . $this->title . "\" src=\"" . $this->icon . "\"/>\n";
- echo " </a>\n";
+ $str .= " <a class=\"link_icon\" rel=\"external\" href=\"" . $this->href . "\">\n";
+ $str .= " <img alt=\"" . $this->title . "\" src=\"" . $this->icon . "\"/>\n";
+ $str .= " </a>\n";
}
- echo " <a class=\"link_title\" rel=\"external\" href=\"" . $this->href . "\">\n";
- echo " " . htmlspecialchars_decode($this->title, ENT_QUOTES) . "\n";
- echo " </a>\n";
- echo "</div>\n";
+ $str .= " <a class=\"link_title\" rel=\"external\" href=\"" . $this->href . "\">\n";
+ $str .= " " . htmlspecialchars_decode($this->title, ENT_QUOTES) . "\n";
+ $str .= " </a>\n";
+ $str .= "</div>\n";
+
+ return $str;
}
}
@@ -43,12 +47,15 @@ class LinkGroup {
public function show()
{
- echo "<div class=\"linkgroup\">\n";
- echo " <div class=\"linkgroup_title\">". htmlspecialchars_decode($this->title, ENT_QUOTES) . "</div>\n";
+ $str = "";
+ $str .= "<div class=\"linkgroup\">\n";
+ $str .= " <div class=\"linkgroup_title\">".
+ htmlspecialchars_decode($this->title, ENT_QUOTES) . "</div>\n";
foreach($this->links as $link) {
- $link->show();
+ $str .= $link->show();
}
- echo "</div>\n";
+ $str .= "</div>\n";
+ return $str;
}
}
@@ -60,6 +67,7 @@ class Links {
$key = $group->title;
$this->groups[$key] = $group;
}
+
/*
public function write()
{
@@ -81,11 +89,33 @@ class Links {
fclose($fp);
}
*/
- public function show($groupid)
+ // public function show($groupid)
+ public function run($params)
{
+ $str = "";
+
+ $groupid = "all";
+
+ foreach($params as $param) {
+ if(!$param) continue;
+ switch($param) {
+ case "all":
+ $groupid = "all";
+ break;
+
+ default:
+ $groupid = $param;
+ break;
+ }
+ }
+
+ $str .= "<div class=\"links\">\n";
foreach($this->groups as $group) {
- if($groupid == $group->id || $groupid == "all") $group->show();
+ if($groupid == $group->id || $groupid == "all") $str .= $group->show();
}
+ $str .= "</div>\n";
+
+ return $str;
}
private function read()
@@ -125,4 +155,10 @@ class Links {
}
}
+function links_init()
+{
+ global $DATA_DIR;
+ return new Links($DATA_DIR . "/links.xml");
+}
+
?> \ No newline at end of file