/** * Create new view. * * @param string $mode * @param Model_Forum_Post $forum_post * * @throws InvalidArgumentException */ public function __construct($mode, Model_Forum_Post $forum_post = null) { parent::__construct(); if (!in_array($mode, array(self::EDIT_POST, self::EDIT_TOPIC, self::NEW_TOPIC, self::QUOTE, self::REPLY))) { throw new InvalidArgumentException('Invalid edit mode: ' . $mode); } $this->mode = $mode; $this->forum_post = $forum_post; $this->class .= ' ' . $this->mode; }
/** * Create new view. * * @param Model_Forum_Post $forum_post * @param Model_Forum_Topic $forum_topic */ public function __construct(Model_Forum_Post $forum_post, Model_Forum_Topic $forum_topic) { parent::__construct(); $this->forum_post = $forum_post; $this->forum_topic = $forum_topic; // Get post author $this->author = Model_User::find_user($this->forum_post->author_id); // Viewer's post $this->my = self::$_user && $this->author && $this->author->id == self::$_user_id; // Topic author's post $this->owner = $this->author ? $this->author->id == $this->forum_topic->author_id : $this->forum_post->author_name == $this->forum_topic->author_name; $this->id = 'post-' . $this->forum_post->id; $this->class = 'media permalink post' . ($this->owner ? ' owner' : '') . ($this->my ? ' my' : ''); }
/** * Create new view. * * @param Model_Event $event */ public function __construct(Model_Event $event) { parent::__construct(); $this->event = $event; $this->id = 'event-' . $event->id; $this->title = HTML::anchor(Route::model($event), HTML::chars($event->name)) . ' <small>' . HTML::chars($event->city_name) . '</small>'; // Meta if ($tags = $event->tags()) { $this->meta = implode(', ', $tags); } else { if ($event->music) { $this->meta = $event->music; } } }
/** * Create new view. * * @param Model_Music_Track $track */ public function __construct($track = null) { parent::__construct(); $this->track = $track; $this->id = 'music-' . $track->id; $this->title = HTML::anchor(Route::model($track), HTML::chars($track->name)); $author = $this->track->author(); $this->subtitle = HTML::user($author, null, null, Route::url('profile_music', array('username' => urlencode($author['username'])))); // Meta if ($tags = $track->tags()) { $this->meta = '<small>' . implode(', ', $tags) . '</small>'; } else { if ($track->music) { $this->meta = '<small>' . $track->music . '</small>'; } } }
/** * Create new view. * * @param Model_Event $event */ public function __construct(Model_Event $event) { parent::__construct(); $this->event = $event; $this->id = 'event-' . $event->id; $this->title = HTML::anchor(Route::model($event), HTML::chars($event->name)); // Venue if ($this->event->venue_hidden) { $this->subtitle = __('Underground') . ', ' . HTML::chars($this->event->city_name); } elseif ($venue = $this->event->venue()) { $this->subtitle = HTML::anchor(Route::model($venue), HTML::chars($venue->name)) . ', ' . HTML::chars($venue->city_name); } else { $this->subtitle = HTML::chars($this->event->venue_name . ', ' . $this->event->city_name); } // Meta if ($tags = $event->tags()) { $this->meta = '<small>' . implode(', ', $tags) . '</small>'; } else { if ($event->music) { $this->meta = '<small>' . $event->music . '</small>'; } } }
/** * Create new article. * * @param Model_Event $event */ public function __construct(Model_Event $event) { parent::__construct(); $this->event = $event; }
/** * Create new view. * * @param Model_Image|string $image * @param string $link */ public function __construct($image = null, $link = null) { parent::__construct(); $this->image = $image; $this->link = $link; }
/** * Create new view. * * @param Model_Music_Track $track */ public function __construct(Model_Music_Track $track) { parent::__construct(); $this->track = $track; }
/** * Create new view. * * @param Model_Flyer[] $flyers */ public function __construct($flyers) { parent::__construct(); $this->flyers = $flyers; }