model() public static méthode

Register a model binder for a wildcard.
public static model ( string $key, string $class, Closure | null $callback = null ) : void
$key string
$class string
$callback Closure | null
Résultat void
Exemple #1
0
    /**
     * Render view.
     *
     * @return  string
     */
    public function content()
    {
        ob_start();
        foreach ($this->_group_by_city() as $city => $venues) {
            ?>

<article>
	<header>
		<h4><?php 
            echo HTML::chars($city);
            ?>
</h4>
	</header>

	<ul class="unstyled block-grid two-up">
	<?php 
            foreach ($venues as $venue) {
                ?>

		<li><?php 
                echo HTML::anchor(Route::model($venue), HTML::chars($venue->name));
                ?>
</li>

	<?php 
            }
            ?>
	</ul>

</article>

<?php 
        }
        return ob_get_clean();
    }
Exemple #2
0
 /**
  * Get newsfeed item as HTML
  *
  * @static
  * @param   Model_NewsfeedItem  $item
  * @return  string
  */
 public static function get(Model_NewsFeedItem $item)
 {
     $text = '';
     switch ($item->type) {
         case self::TYPE_EVENT:
             $event = Model_Event::factory($item->data['event_id']);
             if ($event->loaded()) {
                 $text = __('added new event<br />:event', array(':event' => HTML::anchor(Route::model($event), '<i class="icon-calendar icon-white"></i> ' . HTML::chars($event->name), array('class' => 'hoverable'))));
             }
             break;
         case self::TYPE_EVENT_EDIT:
             $event = Model_Event::factory($item->data['event_id']);
             if ($event->loaded()) {
                 $text = __('updated event<br />:event', array(':event' => HTML::anchor(Route::model($event), '<i class="icon-calendar icon-white"></i> ' . HTML::chars($event->name), array('class' => 'hoverable'))));
             }
             break;
         case self::TYPE_FAVORITE:
             $event = Model_Event::factory($item->data['event_id']);
             if ($event->loaded()) {
                 $text = __('added event to favorites<br />:event', array(':event' => HTML::anchor(Route::model($event), '<i class="icon-heart icon-white"></i> ' . HTML::chars($event->name), array('class' => 'hoverable'))));
             }
             break;
     }
     return $text;
 }
Exemple #3
0
 public function actionGet_route()
 {
     $criteria = new CDbCriteria();
     $criteria->limit = 8;
     $area = Area::model()->findAll($criteria);
     $html = '<ul class="local_trip_pro" id="local_trip_content_list" data-blockid="recommend_localjoin">';
     for ($j = 0; $j < count($area); $j++) {
         if ($j) {
             $html .= '<li class="local_trip_pro_li wq_clearfix hide" data-content="lj' . $j . '" style="display:none;">';
         } else {
             $html .= '<li class="local_trip_pro_li wq_clearfix" data-content="lj' . $j . '">';
         }
         $criteria1 = new CDbCriteria();
         $criteria1->condition = "(style & 4) !=0";
         $criteria1->addCondition('area ="' . $area[$j]->name . '"', 'AND');
         $criteria1->limit = 3;
         $route = Route::model()->findAll($criteria1);
         for ($i = 0; $i < count($route); $i++) {
             if ($i) {
                 $html .= '<a class="local_trip_right img_slide_animte_wrapper" href="';
             } else {
                 $html .= '<a class="local_trip_left_l img_slide_animte_wrapper" href="';
             }
             if ($i) {
                 $html .= '#" target="_blank"> <img class="local_trip_img_s img_slide_animte first_page"  src="' . $route[$i]->source . '" data-original="' . $route[$i]->source . '" style="display: block;"> <span class="local_trip_mask_s"></span> <span class="local_trip_txt_s" title="' . $route[$i]->name . '">' . $route[$i]->name . '</span>' . '<span class="local_trip_price_s font_size12"><span class="font_size16">' . $route[$i]->price . '</span>元/人起</span></a>';
             } else {
                 $html .= '#" target="_blank"> <img class="local_trip_img_l img_slide_animte first_page" alt=" ' . $route[$i]->name . '" src="' . $route[$i]->source . '" data-original="' . $route[$i]->source . '" style="display: block;"> <span class="local_trip_mask_l"></span> <span class="local_trip_bl"></span><span class="local_trip_txt_l" title="' . $route[$i]->name . '">' . $route[$i]->name . '</span>' . '<span class="local_trip_price_l font_size14 font_color_orange"><span class="font_size28">' . $route[$i]->price . '</span>元/人起</span></a>';
             }
         }
         $html .= '</li>';
     }
     $html .= '</ul>';
     echo $html;
 }
Exemple #4
0
    /**
     * Render view.
     *
     * @return  string
     */
    public function content()
    {
        ob_start();
        foreach ($this->_group_by_city() as $city => $venues) {
            ?>

<header>
	<h4><?php 
            echo HTML::chars($city);
            ?>
</h4>
</header>

<ul class="list-unstyled row">
<?php 
            foreach ($venues as $venue) {
                ?>

	<li class="col-xs-6 col-sm-4 col-md-3"><?php 
                echo HTML::anchor(Route::model($venue), HTML::chars($venue->name));
                ?>
</li>

<?php 
            }
            ?>
</ul>

<?php 
        }
        return ob_get_clean();
    }
Exemple #5
0
 /**
  * Construct controller
  */
 public function before()
 {
     parent::before();
     $this->page_title = __('Forum');
     // Generic page actions
     $this->page_actions['new-posts'] = array('link' => Route::url('forum'), 'text' => '<i class="icon-comment icon-white"></i> ' . __('New posts'));
     // Forum areas dropdown
     $groups = Model_Forum_Group::factory()->find_all();
     $areas = array();
     foreach ($groups as $group) {
         $divider = false;
         foreach ($group->areas() as $area) {
             if (Permission::has($area, Model_Forum_Area::PERMISSION_READ, self::$user)) {
                 $divider = true;
                 $areas[] = array('link' => Route::model($area), 'text' => HTML::entities($area->name));
             }
         }
         if ($divider) {
             $areas[] = array('divider' => true);
         }
     }
     array_pop($areas);
     $this->page_actions['areas'] = array('link' => Route::url('forum_group'), 'text' => '<i class="icon-folder-open icon-white"></i> ' . __('Areas'));
     $this->page_actions['area'] = array('link' => Route::url('forum_group'), 'text' => '', 'dropdown' => $areas);
     if (self::$user) {
         $this->page_actions['private-messages'] = array('link' => Forum::private_messages_url(), 'text' => '<i class="icon-envelope icon-white"></i> ' . __('Private messages'));
     }
 }
Exemple #6
0
    /**
     * Render view.
     *
     * @return  string
     */
    public function content()
    {
        if (!$this->topics) {
            return '';
        }
        ob_start();
        ?>

<ul class="list-unstyled">

		<?php 
        foreach ($this->topics as $topic) {
            ?>
		<li>
			<?php 
            echo HTML::anchor(Route::model($topic, '?page=last#last'), Forum::topic($topic), array('title' => HTML::chars($topic->name)));
            ?>
		</li>
		<?php 
        }
        ?>

</ul>

<?php 
        return ob_get_clean();
    }
Exemple #7
0
    /**
     * Render view.
     *
     * @return  string
     */
    public function content()
    {
        if (!$this->blog_entries) {
            return '';
        }
        ob_start();
        ?>

<ul class="unstyled">

	<?php 
        foreach ($this->blog_entries as $entry) {
            ?>
	<li><?php 
            echo HTML::anchor(Route::model($entry), HTML::chars($entry->name));
            ?>
</li>
	<?php 
        }
        ?>

</ul>

<?php 
        return ob_get_clean();
    }
Exemple #8
0
    /**
     * Render view.
     *
     * @return  string
     */
    public function content()
    {
        ob_start();
        $tags = $this->group->tags();
        if (empty($tags)) {
            ?>

<div class="empty">
	<?php 
            echo __('No tags yet.');
            ?>
</div>

<?php 
        } else {
            ?>

<ul>
	<?php 
            foreach ($tags as $tag) {
                ?>
	<li><?php 
                echo HTML::anchor(Route::model($tag), $tag->name);
                ?>
</li>
	<?php 
            }
            ?>
</ul>

<?php 
        }
        echo Form::open();
        ?>

<fieldset>

	<?php 
        echo Form::control_group(Form::input('name', $this->group->name, array('class' => 'input-xxlarge', 'maxlength' => 32)), array('name' => __('Name')), Arr::get($this->errors, 'name'));
        ?>

	<?php 
        echo Form::control_group(Form::input('description', $this->group->description, array('class' => 'input-xxlarge')), array('description' => __('Short description')), Arr::get($this->errors, 'description'));
        ?>

</fieldset>

<fieldset class="form-actions">
	<?php 
        echo Form::button('save', __('Save'), array('type' => 'submit', 'class' => 'btn btn-success btn-large'));
        ?>
	<?php 
        echo HTML::anchor(Request::back(Route::url('tags'), true), __('Cancel'), array('class' => 'cancel'));
        ?>
</fieldset>

<?php 
        echo Form::close();
        return ob_get_clean();
    }
Exemple #9
0
 /**
  * Action: edit
  */
 public function action_edit()
 {
     $this->history = false;
     // Load role
     $role_id = (int) $this->request->param('id', 0);
     if ($role_id) {
         $role = Model_Role::factory($role_id);
         if (!$role->loaded()) {
             throw new Model_Exception($role, $role_id);
         }
         Permission::required($role, Model_Role::PERMISSION_UPDATE, self::$user);
     } else {
         $role = Model_Role::factory();
         Permission::required($role, Model_Role::PERMISSION_CREATE, self::$user);
     }
     // Handle post
     $errors = array();
     if ($_POST) {
         $role->name = Arr::get($_POST, 'name');
         $role->description = Arr::get($_POST, 'description');
         try {
             $role->save();
             $this->request->redirect(Route::url('roles'));
         } catch (Validation_Exception $e) {
             $errors = $e->array->errors('validate');
         }
     }
     // Set title
     $this->view = View_Page::factory(__('Role') . ($role->name ? ': ' . $role->name : ''));
     // Set actions
     if ($role->loaded() && Permission::has($role, Model_Role::PERMISSION_DELETE, self::$user)) {
         $this->page_actions[] = array('link' => Route::model($role, 'delete') . '?token=' . Security::csrf(), 'text' => '<i class="icon-trash icon-white"></i> ' . __('Delete role'), 'class' => 'btn btn-danger role-delete');
     }
     $this->view->add(View_Page::COLUMN_MAIN, $this->section_role($role, $errors));
 }
Exemple #10
0
    /**
     * Render view.
     *
     * @return  string
     */
    public function content()
    {
        ob_start();
        ?>

<ul class="list-unstyled">

	<?php 
        foreach ($this->venues as $venue) {
            ?>

	<li><?php 
            echo HTML::anchor(Route::model($venue), HTML::chars($venue->name));
            ?>
</li>

	<?php 
        }
        ?>

</ul>

<?php 
        return ob_get_clean();
    }
Exemple #11
0
    /**
     * Render view.
     *
     * @return  string
     */
    public function content()
    {
        if (!$this->blog_entries) {
            return '';
        }
        ob_start();
        ?>

<ul class="list-unstyled">

	<?php 
        foreach ($this->blog_entries as $entry) {
            ?>
	<li><?php 
            echo __(':blog by :author', array(':blog' => HTML::anchor(Route::model($entry), HTML::chars($entry->name)), ':author' => HTML::user($entry->author())));
            ?>
</li>
	<?php 
        }
        ?>

</ul>

<?php 
        return ob_get_clean();
    }
Exemple #12
0
 /**
  * Render content.
  *
  * @return  string
  */
 public function content()
 {
     ob_start();
     // Stamp
     echo HTML::time(Date('l ', $this->event->stamp_begin) . Date::format('DDMMYYYY', $this->event->stamp_begin), $this->event->stamp_begin, true);
     // Location
     if ($this->event->venue) {
         echo ' @ ', HTML::anchor(Route::model($this->event->venue), HTML::chars($this->event->venue->name)), ', ', HTML::chars($this->event->venue->city_name);
     } elseif ($this->event->venue_name) {
         echo ' @ ', $this->event->venue_url ? HTML::anchor($this->event->venue_url, $this->event->venue_name) : HTML::chars($this->event->venue_name), $this->event->city_name ? ', ' . HTML::chars($this->event->city_name) : '';
     } elseif ($this->event->city_name) {
         echo ' @ ', HTML::chars($this->event->city_name);
     }
     // Flyer
     if ($this->event->flyer_front) {
         echo '<figure>', HTML::image($this->event->flyer_front->get_url(Model_Image::SIZE_THUMBNAIL)), '</figure>';
     } elseif ($this->event->flyer_back) {
         echo '<figure>', HTML::image($this->event->flyer_back->get_url(Model_Image::SIZE_THUMBNAIL)), '</figure>';
     } elseif (Valid::url($this->event->flyer_front_url)) {
         echo '<br /><figure>', HTML::image($this->event->flyer_front_url, array('width' => 160)), '</figure>';
     }
     // Favorites
     if ($this->event->favorite_count) {
         echo '<span class="stats"><i class="icon-heart"></i> ' . $this->event->favorite_count . '</span>';
     }
     return ob_get_clean();
 }
Exemple #13
0
 /**
  * Render content.
  *
  * @return  string
  */
 public function content()
 {
     ob_start();
     // Stamp
     echo HTML::time(Date('l ', $this->event->stamp_begin) . Date::format('DDMMYYYY', $this->event->stamp_begin), $this->event->stamp_begin, true);
     // Location
     if ($this->event->venue) {
         echo ' @ ', HTML::anchor(Route::model($this->event->venue), HTML::chars($this->event->venue->name)), ', ', HTML::chars($this->event->venue->city_name);
     } elseif ($this->event->venue_name) {
         echo ' @ ', $this->event->venue_url ? HTML::anchor($this->event->venue_url, $this->event->venue_name) : HTML::chars($this->event->venue_name), $this->event->city_name ? ', ' . HTML::chars($this->event->city_name) : '';
     } elseif ($this->event->city_name) {
         echo ' @ ', HTML::chars($this->event->city_name);
     }
     // Flyer
     if ($flyer = $this->event->flyer()) {
         echo '<figure>', HTML::image($flyer->image_url(Model_Image::SIZE_THUMBNAIL)), '</figure>';
     } elseif ($this->event->flyer_front_url) {
         echo '<figure>', HTML::image($this->event->flyer_front_url, ['class' => 'img-responsive']), '</figure>';
     }
     // Favorites
     if ($this->event->favorite_count) {
         echo '<span class="stats"><i class="fa fa-heart"></i> ' . $this->event->favorite_count . '</span>';
     }
     return ob_get_clean();
 }
Exemple #14
0
    /**
     * Render content.
     *
     * @return  string
     */
    public function content()
    {
        if (!$this->events) {
            return '';
        }
        ob_start();
        ?>

<ul class="list-unstyled">

	<?php 
        foreach ($this->events as $event) {
            ?>
	<li>
		<span title="<?php 
            echo Date::format(Date::DATETIME, $event->stamp_begin) . ($event->stamp_end ? ' - ' . Date::format(Date::TIME, $event->stamp_end) : '');
            ?>
"><?php 
            echo Date::format(Date::DM_PADDED, $event->stamp_begin);
            ?>
</span>
		<?php 
            echo HTML::anchor(Route::model($event), HTML::chars($event->name), array('class' => 'hoverable', 'title' => HTML::chars($event->name)));
            ?>
	</li>
	<?php 
        }
        ?>

</ul>

<?php 
        return ob_get_clean();
    }
Exemple #15
0
    /**
     * Render view.
     *
     * @return  string
     */
    public function content()
    {
        if (!$this->topics) {
            return '';
        }
        ob_start();
        ?>

<ul class="unstyled">

		<?php 
        foreach ($this->topics as $topic) {
            ?>
		<li>
			<small class="ago"><?php 
            echo HTML::time(Date::short_span($topic->last_posted, true), $topic->last_posted);
            ?>
</small>
			<?php 
            echo HTML::anchor(Route::model($topic), '<i class="muted iconic-upload"></i>', array('title' => __('First post')));
            ?>
			<?php 
            echo HTML::anchor(Route::model($topic, '?page=last#last'), HTML::chars($topic->name), array('title' => $topic->name));
            ?>
		</li>
		<?php 
        }
        ?>

</ul>

<?php 
        return ob_get_clean();
    }
Exemple #16
0
    /**
     * Render view.
     *
     * @return  string
     */
    public function content()
    {
        ob_start();
        $uri = Route::model($this->venue, 'combine');
        ?>

<ul class="unstyled">

	<?php 
        foreach ($this->venues as $venue) {
            ?>

	<li><?php 
            echo floor($venue['similarity']);
            ?>
% <?php 
            echo HTML::anchor($uri . '/' . $venue['venue']->id, HTML::chars($venue['venue']->name) . ', ' . HTML::chars($venue['venue']->city_name));
            ?>
</li>

	<?php 
        }
        ?>

</ul>

<?php 
        return ob_get_clean();
    }
Exemple #17
0
    /**
     * Render view.
     *
     * @return  string
     */
    public function content()
    {
        ob_start();
        ?>

<div class="row">

	<?php 
        foreach ($this->images as $image) {
            $gallery = $image->gallery();
            ?>

	<div class="<?php 
            echo $this->wide ? 'col-xs-6 col-sm-4 col-md-3 col-lg-2' : 'col-xs-12 col-sm-6';
            ?>
">
		<div class="thumbnail">

			<?php 
            echo HTML::anchor(Route::url('gallery_image', array('gallery_id' => Route::model_id($gallery), 'id' => $image->id)), HTML::image($image->get_url('thumbnail', $gallery->dir)));
            ?>

			<div class="caption">
				<h4><?php 
            echo HTML::anchor(Route::model($gallery), HTML::chars($gallery->name));
            ?>
</h4>
			</div>

			<small class="stats label label-default">

	<?php 
            switch ($this->type) {
                case Model_Image::TOP_COMMENTED:
                    echo '<i class="fa fa-comment"></i> ', Num::format($image->comment_count, 0);
                    break;
                case Model_Image::TOP_RATED:
                    echo '<i class="fa fa-star"></i> ', round($image->rate_total / $image->rate_count, 2);
                    break;
                case Model_Image::TOP_VIEWED:
                    echo '<i class="fa fa-eye"></i> ', Num::format($image->view_count, 0);
                    break;
            }
            ?>

			</small>
		</div>
	</div>

<?php 
        }
        ?>

</div>

<?php 
        return ob_get_clean();
    }
Exemple #18
0
 /**
  * Find all venues in autocomplete friend array.
  *
  * @param   boolean  $skip
  * @return  array
  */
 public function find_all_autocomplete($skip = null)
 {
     $venues = array();
     foreach ($this->find_all() as $venue) {
         if ($skip && $skip == $venue->id) {
             continue;
         }
         $venues[] = array('id' => $venue->id, 'label' => $venue->name, 'value' => $venue->name, 'city' => $venue->city_name, 'latitude' => $venue->latitude, 'longitude' => $venue->longitude, 'url' => URL::site(Route::model($venue), true));
     }
     return $venues;
 }
Exemple #19
0
    /**
     * Render view.
     *
     * @return  string
     */
    public function content()
    {
        ob_start();
        // Title
        if ($this->area->description) {
            echo $this->area->description . '<hr>';
        }
        if ($this->area->topic_count) {
            // Area has topics
            $last_topic = $this->area->last_topic();
            $last_poster = $last_topic->last_post()->author();
            ?>

		<div class="media">
			<div class="pull-left">
				<?php 
            echo HTML::avatar($last_poster ? $last_poster['avatar'] : null, $last_poster ? $last_poster['username'] : null, false);
            ?>
			</div>
			<div class="media-body">
				<small class="ago"><?php 
            echo HTML::time(Date::short_span($last_topic->last_posted, true, true), $last_topic->last_posted);
            ?>
</small>
				<?php 
            echo $last_poster ? HTML::user($last_poster) : HTML::chars($last_topic->last_poster);
            ?>
				<br>
				<?php 
            echo HTML::anchor(Route::model($last_topic, '?page=last#last'), Forum::topic($last_topic), array('title' => HTML::chars($last_topic->name)));
            ?>
<br />
			</div>
		</div>

		<small class="stats muted">
			<i class="icon-comments"></i> <?php 
            echo Num::format($this->area->topic_count, 0);
            ?>
			<i class="icon-comment"></i> <?php 
            echo Num::format($this->area->post_count, 0);
            ?>
		</small>

<?php 
        } else {
            // Empty area
            echo __('No topics yet.');
        }
        return ob_get_clean();
    }
Exemple #20
0
 /**
  * Get anchor to newsfeed item target.
  *
  * @static
  * @param   Model_NewsfeedItem  $item
  * @return  string
  */
 public static function get_link(Model_NewsfeedItem $item)
 {
     $text = '';
     switch ($item->type) {
         case self::TYPE_VENUE:
         case self::TYPE_VENUE_EDIT:
             $venue = Model_Venue::factory($item->data['venue_id']);
             if ($venue->loaded()) {
                 $text = HTML::anchor(Route::model($venue), '<i class="fa fa-map-marker"></i> ' . HTML::chars($venue->name), array('class' => 'venue'));
             }
             break;
     }
     return $text;
 }
Exemple #21
0
 /**
  * Create new view.
  *
  * @param  Model_Blog_Entry  $blog_entry
  * @param  boolean           $show_title
  */
 public function __construct(Model_Blog_Entry $blog_entry, $show_title = false)
 {
     parent::__construct();
     $this->blog_entry = $blog_entry;
     if ($show_title) {
         $author = $blog_entry->author();
         //			$this->avatar   = HTML::avatar($author['avatar'], $author['username']);
         $this->title = HTML::anchor(Route::model($blog_entry), HTML::chars($blog_entry->name));
         $this->subtitle = __('By :user, :date', array(':user' => HTML::user($author), ':date' => date('l ', $blog_entry->created) . Date::format(Date::DMY_SHORT, $blog_entry->created)));
         if (Permission::has($blog_entry, Model_Blog_Entry::PERMISSION_COMMENTS)) {
             $this->subtitle .= ' | ' . HTML::anchor(Route::model($blog_entry), __('Comments') . ' (' . (int) $blog_entry->comment_count . ')');
         }
     }
 }
Exemple #22
0
 /**
  * Get anchor to newsfeed item target.
  *
  * @static
  * @param   Model_NewsfeedItem  $item
  * @return  string
  */
 public static function get_link(Model_NewsfeedItem $item)
 {
     $text = '';
     switch ($item->type) {
         case self::TYPE_MIX:
         case self::TYPE_TRACK:
             $track = Model_Music_Track::factory($item->data['track_id']);
             if ($track->loaded()) {
                 $text = HTML::anchor(Route::model($track), '<i class="fa fa-music"></i> ' . HTML::chars($track->name), array('title' => $track->name));
             }
             break;
     }
     return $text;
 }
Exemple #23
0
 /**
  * Get anchor to newsfeed item target.
  *
  * @static
  * @param   Model_NewsfeedItem  $item
  * @return  string
  */
 public static function get_link(Model_NewsfeedItem $item)
 {
     $text = '';
     switch ($item->type) {
         case self::TYPE_COMMENT:
         case self::TYPE_ENTRY:
             $entry = Model_Blog_Entry::factory($item->data['entry_id']);
             if ($entry->loaded()) {
                 $text = HTML::anchor(Route::model($entry), '<i class="fa fa-book"></i> ' . HTML::chars($entry->name), array('title' => $entry->name));
             }
             break;
     }
     return $text;
 }
Exemple #24
0
 /**
  * Get anchor to newsfeed item target.
  *
  * @static
  * @param   Model_NewsfeedItem  $item
  * @return  string
  */
 public static function get_link(Model_NewsfeedItem $item)
 {
     $text = '';
     switch ($item->type) {
         case self::TYPE_EVENT:
         case self::TYPE_EVENT_EDIT:
         case self::TYPE_FAVORITE:
             $event = Model_Event::factory($item->data['event_id']);
             if ($event->loaded()) {
                 $text = HTML::anchor(Route::model($event), '<i class="fa fa-calendar"></i> ' . HTML::chars($event->name), array('class' => 'hoverable'));
             }
             break;
     }
     return $text;
 }
Exemple #25
0
    /**
     * Render view.
     *
     * @return  string
     */
    public function content()
    {
        ob_start();
        $groups = Model_Tag_Group::factory()->find_all();
        if (empty($groups)) {
            ?>

<div class="empty">
	<?php 
            echo __('No groups yet.');
            ?>
</div>

<?php 
        } else {
            ?>

<ul class="unstyled">

	<?php 
            foreach ($groups as $group) {
                ?>
	<li>
		<h3><?php 
                echo HTML::anchor(Route::model($group), $group->name);
                ?>
</h3>
		<sup><?php 
                echo $group->description;
                ?>
</sup><br />
		<?php 
                foreach ($group->tags() as $tag) {
                    echo HTML::anchor(Route::model($tag), $tag->name) . ' ';
                }
                ?>
	</li>
	<?php 
            }
            ?>

</ul>

<?php 
        }
        return ob_get_clean();
    }
Exemple #26
0
    /**
     * Render view.
     *
     * @return  string
     */
    public function content()
    {
        ob_start();
        if ($this->gallery->links) {
            $links = explode("\n", $this->gallery->links);
            $count = 0;
            ?>

<ul class="list-unstyled">

	<?php 
            foreach ($links as $link) {
                list($user_id, $url) = explode(',', $link, 2);
                ?>
	<li>
		<?php 
                echo HTML::anchor($url, Text::limit_url($url, 75));
                ?>
 &copy; <?php 
                echo HTML::user($user_id);
                ?>
		<?php 
                if (Visitor::$user && $user_id == Visitor::$user->id || Permission::has($this->gallery, Model_Gallery::PERMISSION_UPDATE)) {
                    ?>
		<?php 
                    echo HTML::anchor(Route::model($this->gallery) . '?delete_link=' . $count . '&' . Security::csrf_query(), __('Remove'), array('class' => 'btn btn-danger btn-xs link-delete'));
                    ?>
		<?php 
                }
                ?>
	</li>
	<?php 
                $count++;
            }
            ?>

</ul>

<?php 
        }
        // Add new link
        if (Permission::has($this->gallery, Model_Gallery::PERMISSION_CREATE)) {
            echo HTML::anchor('#add-link', '<i class="fa fa-plus-circle"></i> ' . __('Add link'), array('data-toggle' => 'collapse', 'data-target' => '#form-link'));
            echo $this->form();
        }
        return ob_get_clean();
    }
Exemple #27
0
 /**
  * Get anchor to newsfeed item target.
  *
  * @static
  * @param   Model_NewsfeedItem  $item
  * @return  string
  */
 public static function get_link(Model_NewsfeedItem $item)
 {
     $text = '';
     switch ($item->type) {
         case self::TYPE_REPLY:
             $topic = Model_Forum_Topic::factory($item->data['topic_id']);
             if ($topic->loaded()) {
                 $text = HTML::anchor(Route::get('forum_post')->uri(array('topic_id' => Route::model_id($topic), 'id' => $item->data['post_id'])) . '#post-' . $item->data['post_id'], '<i class="fa fa-comments"></i> ' . HTML::chars($topic->name), array('title' => $topic->name));
             }
             break;
         case self::TYPE_TOPIC:
             $topic = Model_Forum_Topic::factory($item->data['topic_id']);
             if ($topic->loaded()) {
                 $text = HTML::anchor(Route::model($topic), '<i class="fa fa-comments"></i> ' . HTML::chars($topic->name), array('title' => $topic->name));
             }
             break;
     }
     return $text;
 }
Exemple #28
0
 /**
  * Get newsfeed item as HTML
  *
  * @param   Model_NewsfeedItem  $item
  * @return  string
  */
 public static function get(Model_NewsfeedItem $item)
 {
     $text = '';
     switch ($item->type) {
         case self::TYPE_COMMENT:
             $entry = Model_Blog_Entry::factory($item->data['entry_id']);
             if ($entry->loaded()) {
                 $text = __('commented to blog<br />:blog', array(':blog' => HTML::anchor(Route::model($entry), '<i class="icon-book icon-white"></i> ' . HTML::chars($entry->name), array('title' => $entry->name))));
             }
             break;
         case self::TYPE_ENTRY:
             $entry = Model_Blog_Entry::factory($item->data['entry_id']);
             if ($entry->loaded()) {
                 $text = __('wrote a new blog entry<br />:blog', array(':blog' => HTML::anchor(Route::model($entry), '<i class="icon-book icon-white"></i> ' . HTML::chars($entry->name), array('title' => $entry->name))));
             }
             break;
     }
     return $text;
 }
Exemple #29
0
 /**
  * Get newsfeed item as HTML
  *
  * @static
  * @param   Model_NewsfeedItem  $item
  * @return  string
  */
 public static function get(Model_NewsFeedItem $item)
 {
     $text = '';
     switch ($item->type) {
         case self::TYPE_REPLY:
             $topic = Model_Forum_Topic::factory($item->data['topic_id']);
             if ($topic->loaded()) {
                 $text = __('replied to topic<br />:topic', array(':topic' => HTML::anchor(Route::get('forum_post')->uri(array('topic_id' => Route::model_id($topic), 'id' => $item->data['post_id'])) . '#post-' . $item->data['post_id'], '<i class="icon-comment icon-white"></i> ' . HTML::chars($topic->name), array('title' => $topic->name))));
             }
             break;
         case self::TYPE_TOPIC:
             $topic = Model_Forum_Topic::factory($item->data['topic_id']);
             if ($topic->loaded()) {
                 $text = __('started a new topic<br />:topic', array(':topic' => HTML::anchor(Route::model($topic), '<i class="icon-comment icon-white"></i> ' . HTML::chars($topic->name), array('title' => $topic->name))));
             }
             break;
     }
     return $text;
 }
Exemple #30
0
 /**
  * Get newsfeed item as HTML
  *
  * @static
  * @param   Model_NewsfeedItem  $item
  * @return  string
  */
 public static function get(Model_NewsFeedItem $item)
 {
     $text = '';
     switch ($item->type) {
         case self::TYPE_VENUE:
             $venue = Model_Venue::factory($item->data['venue_id']);
             if ($venue->loaded()) {
                 $text = __('added new venue<br />:venue', array(':venue' => HTML::anchor(Route::model($venue), '<i class="icon-map-marker icon-white"></i> ' . HTML::chars($venue->name), array('class' => 'venue'))));
             }
             break;
         case self::TYPE_VENUE_EDIT:
             $venue = Model_Venue::factory($item->data['venue_id']);
             if ($venue->loaded()) {
                 $text = __('updated venue<br />:venue', array(':venue' => HTML::anchor(Route::model($venue), '<i class="icon-map-marker icon-white"></i> ' . HTML::chars($venue->name), array('class' => 'venue'))));
             }
             break;
     }
     return $text;
 }