public function exec() { $db = Core::getDb(); $user = Core::getUser(); $path = explode("/", $this->objectId); $albumId = 0; $pictureId = 0; if (count($path) == 2) { list($albumId, $pictureId) = $path; } else { if (count($path) == 1) { list($albumId) = $path; } } if ($albumId) { $album = new \Kiki\Album($albumId); if ($album->id()) { $this->template = 'pages/default'; $this->status = 200; $this->title = "Album: " . $album->title(); $this->content = $album->show($pictureId); return true; } } return false; }
$album = new Album($id); 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>" . _("Create a new album") . "</td>\n"; echo "</tr>\n"; echo "<tr><th></th><th></th><th></th><th>Title</th></tr>\n"; echo "</thead>\n"; echo "<tbody>\n"; $q = "SELECT id from albums where system=false ORDER BY id desc LIMIT 25"; $rs = $db->query($q); if ($db->numRows($rs)) { while ($o = $db->fetchObject($rs)) { $album = new \Kiki\Album($o->id); $class = ""; // $album->visible() ? "" : "disabled"; echo "<tr class=\"{$class}\">\n"; echo "<td><a href=\"?id=" . $album->id() . "\"><img src=\"/kiki/img/iconic/black/pen_alt_fill_16x16.png\" alt=\"Edit\"></a></td>\n"; echo "<td><a href=\"" . $album->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>" . $album->title() . "</td>\n"; echo "</tr>\n"; } } echo "</tbody>\n"; echo "</table>\n"; } $this->content = ob_get_clean();