Ejemplo n.º 1
0
 public function getDelete(Post $ad)
 {
     if ($ad) {
         $ad->delete();
     }
     return $this->redirector->route('ad.list');
 }
Ejemplo n.º 2
0
 public function getDelete(Post $tab)
 {
     if ($tab) {
         $tab->delete();
     }
     return Redirect::route('tab.list');
 }
Ejemplo n.º 3
0
 /**
  * @param Post $Post
  */
 public function savePost(Post $Post)
 {
     $tags = $Post->get(Post::FIELD_TAGS);
     foreach ($tags as $tag) {
         $this->getRedis()->zadd($this->getFeedName($tag), [$Post->getId() => $Post->get(Post::FIELD_CREATE_AT)]);
     }
 }
Ejemplo n.º 4
0
 public function testSaveLoad()
 {
     $User = $this->createUser();
     $User->set(User::FIELD_NAME, 'yakud');
     $User->save();
     $Post = $this->createPost();
     $Post->set(Post::FIELD_TITLE, 'title');
     $Post->set(Post::FIELD_CONTENT, 'Content');
     $Post->set(Post::FIELD_USER_OWNER, $User);
     $Post->save();
     $LoadedPost = new Post();
     $LoadedPost->setId($Post->getId());
     $LoadedPost->load();
     $this->assertEquals($Post, $LoadedPost);
     $this->assertEquals($User, $LoadedPost->get(Post::FIELD_USER_OWNER));
 }
Ejemplo n.º 5
0
 public function page_by_permalink($permalink)
 {
     $post = Post::where("permalink", $permalink)->where("type", 2)->first();
     if ($post) {
         return $post;
     }
     return false;
 }
Ejemplo n.º 6
0
 public function display($idstring = "")
 {
     if ($idstring != "") {
         $options = phoneme_unserialize(widgetOptions($idstring)->options);
     }
     $post_numbers = $options['sometext'];
     $posts = Post::orderBy("id", "desc")->take($post_numbers)->get();
     include __DIR__ . "/display.php";
 }
Ejemplo n.º 7
0
 /**
  * @param User $User
  * @param int $title
  * @param int $content
  * @param array $tags
  * @return Post
  */
 public function createPost(User $User, $title, $content, array $tags = [])
 {
     $Post = new Post();
     $Post->set(Post::FIELD_USER_OWNER, $User);
     $Post->set(Post::FIELD_TITLE, $title);
     $Post->set(Post::FIELD_CONTENT, $content);
     $Post->set(Post::FIELD_TAGS, $tags);
     $Post->set(Post::FIELD_CREATE_AT, Time::getTime());
     $Post->save();
     $FeedProvider = $this->getFeedProvider();
     $FeedProvider->getFeed(FeedType::MAIN)->savePost($Post);
     $FeedProvider->getFeed(FeedType::USER)->savePost($Post);
     $FeedProvider->getFeed(FeedType::TAG)->savePost($Post);
     return $Post;
 }
Ejemplo n.º 8
0
 public function home()
 {
     $posts = Post::where('type', 1)->orderBy("id", 'desc')->take(5)->get();
     $slides = $this->slider->get_images(5);
     return $this->view->make("Striped::index", compact('posts', 'slides'));
 }
Ejemplo n.º 9
0
 /**
  * @param Post $Post
  */
 public function savePost(Post $Post)
 {
     $ownerId = $Post->getOwner()->getId();
     $this->getRedis()->zadd($this->getFeedName($ownerId), [$Post->getId() => $Post->get(Post::FIELD_CREATE_AT)]);
 }
Ejemplo n.º 10
0
 public function backend_menu_tree($items, $parent_id = 0)
 {
     $childs = $this->get_node_childs($items, $parent_id);
     $output = "";
     if (!empty($childs)) {
         $output .= "<ol class='dd-list'>";
         foreach ($childs as $b) {
             $the_url = $b['url'];
             if (!$the_url) {
                 $post = \Post\Post::find($b['post_id']);
                 $the_url = $post ? url($post->permalink) : "";
             }
             $output .= "<li class='dd-item' data-id='" . $b['id'] . "'>" . "<a target='_parent' class='btn btn-danger btn-xs delete_toggle' rel='" . $b['id'] . "' href='#'><i class='fa fa-trash-o'></i></a>\n\t\t\t\t            <a target='_parent' class='btn btn-primary btn-xs edit_toggle' rel='" . $b['id'] . "'><i class='fa fa-edit'></i></a>" . "<div class='dd-handle' data-url='" . $the_url . "'>" . $b['title'] . "</div>";
             $output .= $this->backend_menu_tree($items, $b['id']);
             $output .= '</li>';
         }
         $output .= "</ol>";
     }
     return $output;
 }
Ejemplo n.º 11
0
echo $formatter->asText($this->title);
?>
</h1>
        </div>
        <div id="t<?php 
echo $topic->id;
?>
" class="topic-discussion">
            <?php 
foreach ($posts as $post) {
    ?>
                <?php 
    $item['post_count']++;
    ?>
                <?php 
    echo Post::widget(['model' => $post, 'topic' => $topic, 'count' => $item['post_count']]);
    ?>
            <?php 
}
?>
        </div>
        <?php 
if (!Yii::$app->getUser()->getIsGuest()) {
    ?>
        <?php 
    echo Editor::widget(['activeFormOptions' => ['action' => Url::to(['/topic/default/view', 'id' => $topic->id, '#' => 'postform'])], 'model' => $model, 'messageAttribute' => 'message']);
    ?>
        <?php 
}
?>
        <div class="pagination-center">
Ejemplo n.º 12
0
 public function getList()
 {
     $posts = Post::where('type', PostType::post)->get();
     return $this->theme->baseDashboard("Post::PostList", compact('posts'));
 }
Ejemplo n.º 13
0
 public function getList()
 {
     $pages = Post::where('type', PostType::page)->get();
     return $this->theme->baseDashboard("Post::PageList")->with('pages', $pages);
 }
Ejemplo n.º 14
0
 /**
  * @param Post $Post
  */
 public function savePost(Post $Post)
 {
     $this->getRedis()->zadd($this->getFeedName(), [$Post->getId() => $Post->get(Post::FIELD_CREATE_AT)]);
 }
Ejemplo n.º 15
0
 public function postAddItem($menu_id)
 {
     if (!is_null($this->request->get('page-id'))) {
         $page_id = $this->request->get('page-id');
         $max = MainMenu::max('weight');
         $post = Post::find($page_id);
         MainMenu::insert(['title' => $post->subject, 'parent_id' => '0', 'url' => '', 'post_id' => $post->id, 'menu_id' => $menu_id, 'weight' => $max + 1]);
         return $this->redirector->route('menu.update', [$menu_id]);
     }
     $max = MainMenu::max('weight');
     MainMenu::insert(['title' => "عنوان", 'parent_id' => '0', 'url' => '', 'menu_id' => $menu_id, 'weight' => $max + 1]);
     return $this->redirector->route('menu.update', [$menu_id]);
 }