Example #1
0
 function editPoll($p)
 {
     if (empty($_POST['poll_q'])) {
         return;
     }
     PollItem::updatePoll($p['poll'], $p['poll_q']);
     if (!empty($p['poll_ts'])) {
         PollItem::updatePoll($p['poll'], $p['poll_q'], $p['poll_ts']);
     }
     if (!empty($_POST['poll_te'])) {
         PollItem::updatePoll($p['poll'], $p['poll_q'], '', $p['poll_te']);
     }
     $cats = new CategoryList(POLL);
     $cats->setOwner($p['poll']);
     foreach ($cats->getItems() as $i => $opt) {
         if (!empty($p['poll_a' . $i])) {
             $opt->title = $p['poll_a' . $i];
             $opt->store();
         }
     }
     if (!empty($p['poll_new_a'])) {
         $item = new CategoryItem(POLL);
         $item->owner = $p['poll'];
         $item->title = $p['poll_new_a'];
         $item->store();
     }
     js_redirect('a/polls/edit/' . $p['poll']);
 }
Example #2
0
 private function showPage()
 {
     if (isset($_POST['newpost'])) {
         new CreatePost($_POST['title'], $_POST['image'], $_POST['indeximage'], $_POST['short_text'], $_POST['text'], $_POST['category']);
         header("Location: home.php");
     }
     $ctglist = new CategoryList();
     $data = array('categories' => $ctglist->getCategories());
     $this->loadView('newpost', $data);
 }
 private function editPost()
 {
     if (isset($_POST['editpost'])) {
         $post = new Post($_GET["id"]);
         $post->edit($_POST['title'], $_POST['image'], $_POST['indeximage'], $_POST['short_text'], $_POST['text'], $_POST['category']);
         header("Location: home.php");
     }
     $post = new Post($_GET["id"]);
     $ctglist = new CategoryList();
     $data = array('post' => $post->getInfos(), 'categories' => $ctglist->getCategories());
     $this->loadView('cm_editpost', $data);
 }
Example #4
0
 protected function loadView($view_name, $data = array())
 {
     //létrehozom a footer és header view-ekben szükséges objektumokat
     $postlist = new Postlist();
     //friss posztok listájához kell
     $recent_links = $postlist->getRecentPosts();
     $categorylist = new CategoryList();
     //kategóriák listájához kell
     $category_links = $categorylist->getCategories();
     //beillesztem a részeket és közzé az aktuális view-et, vagyis a tartalmat
     require 'view/blog_header.php';
     require 'view/' . $view_name . '.php';
     require 'view/blog_footer.php';
 }
 /**
  * @see	\wcf\data\category\CategoryNodeTree::buildTree()
  */
 protected function buildTree()
 {
     $categoryList = new CategoryList();
     $categoryList->getConditionBuilder()->add('category.objectTypeID = ?', array(CategoryHandler::getInstance()->getObjectTypeByName($this->objectType)->objectTypeID));
     $categoryList->readObjects();
     foreach ($categoryList as $category) {
         if (!isset($this->categoryStructureCache[$category->parentCategoryID])) {
             $this->categoryStructureCache[$category->parentCategoryID] = array();
         }
         $this->categoryStructureCache[$category->parentCategoryID][] = $category->categoryID;
         $this->categoryCache[$category->categoryID] = $category;
     }
     parent::buildTree();
 }
Example #6
0
     $active = true;
 }
 if (!$poll->time_start) {
     $active = true;
 }
 echo '<div class="item">';
 if ($active) {
     echo 'Active poll: ';
 }
 echo $poll->text . '<br/><br/>';
 echo '<div id="poll' . $this->child . '">';
 if ($poll->time_start) {
     echo 'Starts: ' . $poll->time_start . ', ends ' . $poll->time_end . '<br/>';
 }
 if ($session->id && $active && !Rating::hasAnswered(POLL, $this->child)) {
     $cats = new CategoryList(POLL);
     $cats->setOwner($this->child);
     $list = $cats->getItems();
     if (!$list) {
         echo '<div class="critical">No options is available to this poll!</div>';
     } else {
         if (count($list) == 1) {
             echo '<div class="critical">Only one options is available to this poll!</div>';
         } else {
             foreach ($list as $opt) {
                 echo '<div class="poll_item" onclick="submit_poll(' . $this->child . ',' . $opt->id . ')">' . $opt->title . '</div><br/>';
             }
         }
     }
 } else {
     if ($session->id) {
Example #7
0
<?php

require_once '../nl-init.php';
require_once '../class/nl-category-class.php';
require_once 'api_headers.php';
if (is_get()) {
    $categoryID = _get("categoryID", 0);
    if ($categoryID <= 0) {
        $categoryList = new CategoryList();
        echo $categoryList->getJson();
    }
}