예제 #1
0
파일: index.php 프로젝트: robkaper/kiki
    $section = new Section((int) $_GET['id']);
    echo $section->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=\"3\">" . _("Create a new section") . "</td>\n";
    echo "</tr>\n";
    echo "<tr><th></th><th></th><th></th><th>URL</th><th>Title</th><th>Type</th></tr>\n";
    echo "</thead>\n";
    echo "<tbody>\n";
    $q = "SELECT id,base_uri,title,type from sections ORDER BY base_uri ASC";
    $rs = $db->query($q);
    if ($db->numRows($rs)) {
        $section = new Section();
        while ($o = $db->fetchObject($rs)) {
            $section->setFromObject($o);
            echo "<tr>\n";
            echo "<td><a href=\"?id=" . $section->id() . "\"><img src=\"/kiki/img/iconic/black/pen_alt_fill_16x16.png\" alt=\"Edit\"></a></td>\n";
            echo "<td></td>\n";
            // <a href=\"". $section->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>" . $section->baseURI() . "</td>\n";
            echo "<td>" . $section->title() . "</td>\n";
            echo "<td>" . $section->type() . "</td>\n";
            echo "</tr>\n";
        }
    }
    echo "</tbody>\n";
    echo "</table>\n";
예제 #2
0
파일: section.php 프로젝트: robkaper/kiki
<?php

use Kiki\Section;
use Kiki\Template;
use Kiki\Router;
/**
 * Handles creation and modification requests (POSTS) for sections.
 *
 * @package Kiki
 * @author Rob Kaper <http://robkaper.nl/>
 * @copyright 2010-2011 Rob Kaper <http://robkaper.nl/>
 * @license Released under the terms of the MIT license.
 */
if ($_POST) {
    $section = new Section($_POST['sectionId']);
    $errors = array();
    if (!$user->id()) {
        $errors[] = "Je bent niet ingelogd.";
    }
    if (!$user->isAdmin()) {
        $errors[] = "Je hebt geen admin rechten.";
    }
    $section->setBaseURI($_POST['baseURI']);
    $section->setTitle($_POST['title']);
    $section->setType($_POST['type']);
    if (!$section->baseURI()) {
        $errors[] = "Je kunt de URL naam niet leeg laten.";
    }
    // if ( strstr( $section->baseURI(), "/" ) )
    //   $errors[] = "Een URL naam mag geen <q>/</q> bevatten.";
    if (!sizeof($errors)) {
예제 #3
0
파일: index.php 프로젝트: robkaper/kiki
 $q = "SELECT a.id FROM articles a LEFT JOIN objects o ON o.object_id=a.object_id LEFT JOIN sections s ON s.id=o.section_id WHERE o.section_id=0 OR s.type='pages' ORDER BY s.base_uri ASC, FIELD(a.cname, 'index') ASC";
 $pages = $db->getObjectIds($q);
 echo "<ul>";
 echo "<li>";
 echo "<a href=\"?id=0\"><img src=\"/kiki/img/iconic/black/pen_alt_fill_16x16.png\" alt=\"New\"> " . _("Create a new page") . "</a>\n";
 echo "</li>";
 echo "</ul>";
 echo "<table>\n";
 echo "<thead>\n";
 echo "<tr><th></th><th></th><th></th></th><th colspan=\"2\">URL</th><th>Title</th></tr>\n";
 echo "</thead>\n";
 echo "<tbody>\n";
 if (count($pages)) {
     foreach ($pages as $pageId) {
         $article = new Article($pageId);
         $section = new Section($article->sectionId());
         $class = $article->visible() ? "" : "disabled";
         echo "<tr class=\"{$class}\">\n";
         echo "<td><a href=\"?id=" . $article->id() . "\"><img src=\"/kiki/img/iconic/black/pen_alt_fill_16x16.png\" alt=\"Edit\"></a></td>\n";
         echo "<td><a href=\"" . $article->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";
         if ($section->baseURI()) {
             echo "<td>" . $section->baseURI() . "</td>\n";
             echo "<td>" . $article->cname() . "</td>\n";
         } else {
             echo "<td colspan=\"2\">" . $article->cname() . "</td>\n";
         }
         echo "<td>" . $article->title() . "</td>\n";
         echo "</tr>\n";
     }
 }