public function exec() { $db = Core::getDb(); $user = Core::getUser(); $q = $db->buildQuery("select id from events where cname='%s'", $this->objectId); $eventId = $db->getSingleValue($q); if ($eventId) { $event = new Event($eventId); if ($event->id()) { $this->template = 'pages/event'; $this->status = 200; $this->title = "Event: " . $event->title(); $this->content = $event->content(); return true; } } return false; }
echo $album->form(); } } else { echo "<table>\n"; echo "<thead>\n"; echo "<tr>\n"; echo "<td colspan=\"3\"><a href=\"?id=0\"><img src=\"/kiki/img/iconic/black/pen_alt_fill_16x16.png\" alt=\"New\"></a></td>\n"; echo "<td colspan=\"2\">" . _("Create a new event") . "</td>\n"; echo "</tr>\n"; echo "<tr><th></th><th></th><th></th><th>Date</th><th>Title</th></tr>\n"; echo "</thead>\n"; echo "<tbody>\n"; $q = "SELECT id from events ORDER BY start desc LIMIT 25"; $rs = $db->query($q); if ($db->numRows($rs)) { while ($o = $db->fetchObject($rs)) { $event = new Event($o->id); $class = $event->visible() ? "" : "disabled"; echo "<tr class=\"{$class}\">\n"; echo "<td><a href=\"?id=" . $event->id() . "\"><img src=\"/kiki/img/iconic/black/pen_alt_fill_16x16.png\" alt=\"Edit\"></a></td>\n"; echo "<td><a href=\"" . $event->url() . "\"><img src=\"/kiki/img/iconic/black/magnifying_glass_16x16.png\" alt=\"View\"></a></td>\n"; echo "<td><a href=\"\"><img src=\"/kiki/img/iconic/black/trash_stroke_16x16.png\" alt=\"Delete\"></a></td>\n"; echo "<td>" . $event->start() . "</td>\n"; echo "<td>" . $event->title() . "</td>\n"; echo "</tr>\n"; } } echo "</tbody>\n"; echo "</table>\n"; } $this->content = ob_get_clean();