This repository has been archived on 2024-09-05. You can view files and clone it, but cannot push or open issues or pull requests.
shimmie2/ext/tips/theme.php

96 lines
2.2 KiB
PHP
Raw Normal View History

2009-11-24 14:07:18 +00:00
<?php
class TipsTheme extends Themelet {
public function manageTips($url, $images) {
2010-05-28 13:26:46 +00:00
global $page, $user;
2009-11-24 14:07:18 +00:00
$select = "<select name='image'><option value=''>- Select Image -</option>";
foreach($images as $image){
$select .= "<option style='background-image:url(".$url.$image."); background-repeat:no-repeat; padding-left:20px;' value=\"".$image."\">".$image."</option>\n";
}
$select .= "</select>";
$html = "
".make_form(make_link("tips/save"))."
2009-11-24 14:07:18 +00:00
<table>
<tr>
<td>Enable:</td>
<td><input name='enable' type='checkbox' value='Y' checked/></td>
</tr>
<tr>
<td>Image:</td>
<td>{$select}</td>
</tr>
<tr>
<td>Message:</td>
<td><textarea name='text'></textarea></td>
</tr>
<tr>
<td colspan='2'><input type='submit' value='Submit' /></td>
</tr>
</table>
</form>
";
$page->set_title("Tips List");
$page->set_heading("Tips List");
$page->add_block(new NavBlock());
$page->add_block(new Block("Add Tip", $html, "main", 10));
}
public function showTip($url, $tip) {
global $page;
$img = "";
if(!empty($tip['image'])) {
$img = "<img src=".$url.$tip['image']." /> ";
}
$html = "<div id='tips'>".$img.$tip['text']."</div>";
$page->add_block(new Block(null, $html, "subheading", 10));
}
public function showAll($url, $tips){
global $user, $page;
$html = "<table id='poolsList' class='zebra'>".
"<thead><tr>".
"<th>ID</th>".
"<th>Enabled</th>".
"<th>Image</th>".
"<th>Text</th>";
if($user->is_admin()){
$html .= "<th>Action</th>";
}
$html .= "</tr></thead>";
2012-02-22 14:27:56 +00:00
foreach ($tips as $tip) {
2009-11-24 14:07:18 +00:00
$tip_enable = ($tip['enable'] == "Y") ? "Yes" : "No";
$set_link = "<a href='".make_link("tips/status/".$tip['id'])."'>".$tip_enable."</a>";
2012-02-22 14:27:56 +00:00
$html .= "<tr>".
2009-11-24 14:07:18 +00:00
"<td>".$tip['id']."</td>".
"<td>".$set_link."</td>".
(
empty($tip['image']) ?
"<td></td>" :
"<td><img src=".$url.$tip['image']." /></td>"
).
"<td class='left'>".$tip['text']."</td>";
$del_link = "<a href='".make_link("tips/delete/".$tip['id'])."'>Delete</a>";
if($user->is_admin()){
$html .= "<td>".$del_link."</td>";
}
$html .= "</tr>";
}
$html .= "</tbody></table>";
$page->add_block(new Block("All Tips", $html, "main", 20));
}
}