Beispiel #1
0
 /**
  * Get post Uri
  *
  * @return string
  */
 public function getLink($type = 'default', $param = NULL)
 {
     switch ($type) {
         case 'edit':
             $uri = new Stack(array('name' => 'post.link.edit'));
             $uri->append('post');
             $uri->append('edit');
             break;
         case 'delete':
             $uri = new Stack(array('name' => 'post.link.edit'));
             $uri->append('post');
             $uri->append('delete');
             break;
         case 'hide':
             $uri = new Stack(array('name' => 'post.link.hide'));
             $uri->append('post');
             $uri->append('hide');
             break;
         case 'full':
             return '<a href="' . $this->getLink() . $param . '">' . $this->name . '</a>';
             break;
         default:
             $uri = new Stack(array('name' => 'post.link'));
             $uri->append('post');
     }
     $uri->append($this->id);
     return l('/' . $uri->render('/'));
 }
Beispiel #2
0
 /**
  * Получение ссылки на страницу
  *
  * @return string
  */
 public function getLink($type = 'default', $param = NULL)
 {
     switch ($type) {
         case 'edit':
             $uri = new Stack(array('name' => 'page.link.edit'));
             $uri->append('admin');
             $uri->append('pages');
             $uri->append($this->object()->id);
             break;
         default:
             if ($route = route($this->route, 'id')) {
                 return l('/' . $route->route);
             } else {
                 $uri = new Stack(array('name' => 'page.link.show'));
                 $uri->append('pages');
                 $uri->append('show');
                 $uri->append($this->id);
             }
     }
     return l('/' . $uri->render('/'));
 }
Beispiel #3
0
<table class="table table-bordered table-striped">
    <thead>
        <tr>
           <?php 
$thead = new Stack(array('name' => $options->name . '.thead'));
$thead->append('<th>' . t('Имя пользователя') . '</th>');
$thead->append('<th>' . t('Постов') . '</th>');
cogear()->gears->Comments && $thead->append('<th>' . t('Комментариев') . '</th>');
$thead->append('<th>' . t('Зарегистрирован') . '</th>');
echo $thead->render();
?>
        </tr>
    </thead>
    <tbody>
        <?php 
foreach ($users as $user) {
    $tr = new Stack(array('name' => $options->name . '.tr'));
    $tr->append('<td>' . $user->getLink('avatar') . ' ' . $user->getLink('profile') . '</td>');
    $tr->append('<td>' . $user->posts . '</td>');
    cogear()->gears->Comments && $tr->append('<td>' . $user->comments . '</td>');
    $tr->append('<td>' . df($user->reg_date, 'd M Y') . '</td>');
    echo '<tr>' . $tr->render() . '</tr>';
}
?>
    </tbody>
</table>
Beispiel #4
0
 /**
  * Get user profile link
  */
 public function getLink($type = 'default', $param = NULL)
 {
     switch ($type) {
         case 'profile':
             $uri = new Stack(array('name' => 'user.link.profile'));
             $uri->append($this->getLink());
             $name = $this->getName($param);
             if ($param) {
                 $name = '<b>' . $name . '</b>';
             }
             return HTML::a($uri->render('/'), $name);
             break;
         case 'avatar':
             $uri = new Stack(array('name' => 'user.link.avatar'));
             $uri->append($this->getLink());
             $param or $param = 'avatar.small';
             return HTML::a($uri->render('/'), $this->getAvatarImage($param), array('data-id' => $this->id));
             break;
         case 'edit':
             $uri = new Stack(array('name' => 'user.link.edit'));
             $uri->append('user');
             $uri->append('edit');
             $uri->append($this->id);
             break;
         default:
             $uri = new Stack(array('name' => 'user.link'));
             $uri->append('user');
             $uri->append($this->login);
     }
     return l('/' . $uri->render('/'));
 }
Beispiel #5
0
<div id="profile" class="shd">
    <?php 
$userinfo = new Stack('profile.user');
$userinfo->append($user->getAvatar('profile'));
$userinfo->append($user->getName());
if (access('User.edit', $user)) {
    $userinfo->append(HTML::a($user->getLink('edit'), icon('pencil'), array('class' => 'sh')));
}
echo '<div class="page-header"><h2>' . $userinfo . '</h2></div>';
?>

    <div class="form-horizontal profile_fields">
        <?php 
$fields = new Stack(array('name' => 'user.profile.fields'));
$fields->object($user);
$fields->append(array('label' => t('Зарегистрирован'), 'value' => df($user->reg_date)));
$fields->append(array('label' => t('Последнее посещение'), 'value' => df($user->last_visit)));
$fields->init();
foreach ($fields as $field) {
    ?>
            <div class="control-group">
                <div class="control-label"><?php 
    echo $field['label'];
    ?>
</div>
                <div class="controls"><?php 
    echo $field['value'];
    ?>
</div>
            </div>
            <?php