当前位置: 首页>>代码示例>>PHP>>正文


PHP User::name方法代码示例

本文整理汇总了PHP中app\models\User::name方法的典型用法代码示例。如果您正苦于以下问题:PHP User::name方法的具体用法?PHP User::name怎么用?PHP User::name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\models\User的用法示例。


在下文中一共展示了User::name方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: actionAjaxentermsg

 public function actionAjaxentermsg($id = null)
 {
     if (isset($_GET['text'])) {
         if (!Yii::$app->user->isGuest) {
             $model = new Msgs();
             $model->admin_id = Yii::$app->user->id;
             $model->text = $_GET['text'];
             $model->time = time();
             $model->unit_type = 1;
             $model->unit_id = $id;
             if ($model->save()) {
                 echo '<tr>
                     <th>' . User::name(Yii::$app->user->id) . '<br/>
                         <span style="font-size: xx-small; color: #c0c0c0;">(' . date('d.m.y', time()) . ')</span>
                     </th>
                     <td>' . nl2br(HTML::encode($_GET['text'])) . '</td>
                 </tr>';
             } else {
                 echo '== данные не сохранились... ==';
             }
         } else {
             echo '<tr class="grey">
                     <th>
                         Гость<br/>
                         <span style="font-size: xx-small;">(' . date('d.m.y', time()) . ')</span>
                     </th>
                     <td>' . nl2br(HTML::encode($_GET['text'])) . '</td>
             </tr>';
         }
     } else {
         echo '== данные не получены... ==';
     }
 }
开发者ID:Nechhist,项目名称:to.ru,代码行数:33,代码来源:MsgsController.php

示例2: index

 function index()
 {
     /////////////////
     // Load Filter //
     /////////////////
     $filters = $this->request->only('id', 'name', 'sort', 'email', 'reset_password', 'auth_app', 'auth_data', 'auth_role', 'skip', 'take', 'with_count');
     ///////////
     // Query //
     ///////////
     if (!$filters['take']) {
         $filters['take'] = 50;
     } else {
         $filters['take'] = min($filters['take'] * 1, 50);
     }
     $filters['skip'] = $filters['skip'] * 1;
     if ($filters['id']) {
         $data = new Collection();
         $dt = Model::find($filters['id']);
         $data->push($dt);
     } else {
         if ($filters['email']) {
             $data = new Collection();
             $q = Model::where('email', $filters['email']);
             $data = $q->get();
         } else {
             if ($filters['reset_password']) {
                 $data = new Collection();
                 $q = Model::where('reset_password', $filters['reset_password']);
                 $data = $q->get();
             } else {
                 $q = Model::name($filters['name']);
                 if ($filters['auth_app']) {
                     $q = $q->auth($filters['auth_app'], $filters['auth_data'], $filters['auth_role']);
                 }
                 if ($filters['with_count']) {
                     $count = $q->count();
                 }
                 //////////
                 // MODE //
                 //////////
                 switch (strtolower($filters['sort'])) {
                     case 'asc':
                         $q = $q->orderby('name', 'asc');
                         break;
                     case 'desc':
                         $q = $q->orderby('name', 'desc');
                         break;
                     case 'latest-created':
                         $q = $q->latest('created_at');
                         break;
                 }
                 $data = $q->skip($filters['skip'])->take($filters['take'])->get();
             }
         }
     }
     //////////////
     // Response //
     //////////////
     return response()->json(JSend::success(['count' => $count, 'data' => $data->toArray()])->asArray())->setCallback($this->request->input('callback'));
 }
开发者ID:erickmo,项目名称:CapcusAPI,代码行数:60,代码来源:UserAPI.php

示例3: actionAjaxenterchatmain

 public function actionAjaxenterchatmain()
 {
     if (isset($_GET['text']) && $_GET['text'] != NULL) {
         $_GET['text'] = substr($_GET['text'], 0, 254);
         if (!Yii::$app->user->isGuest) {
             // проверка на спам.
             $check = Chatmain::findOne(['admin_id' => Yii::$app->user->id]);
             if ($check && $check['time'] < time() - 10) {
                 // создание новой записи
                 $model = new Chatmain();
                 $model->admin_id = Yii::$app->user->id;
                 $model->text = $_GET['text'];
                 $model->time = time();
                 if ($model->save()) {
                     echo '<div>
                     <span>' . User::name(Yii::$app->user->id) . ': </span>
                     <span>' . nl2br(HTML::encode($_GET['text'])) . '</span>
                 </div>';
                 } else {
                     echo '== данные не сохранились... ==';
                 }
             } else {
                 '<div class="grey">
                     <span>.User::name(Yii::$app->user->id): </span>
                     <span>' . nl2br(HTML::encode($_GET['text'])) . '</span>
                     <span> (Антиспам: сообщение не будет сохранено)</span>
                 </div>';
             }
         } else {
             echo '<div class="grey">
                 <span>Гость: </span>
                 <span>' . nl2br(HTML::encode($_GET['text'])) . '</span>
             </div>';
         }
     }
     //else echo '== данные не получены... ==';
 }
开发者ID:Nechhist,项目名称:to.ru,代码行数:37,代码来源:ChatmainController.php

示例4:

                            <!-- <td onclick="link('user/index')">Пользователи</td> -->
                        </table>
                    </div>
                    <div class="col-lg-6 col-md-6 col-sm-6 col-xm-12" style="align-items: right">
                        <!-- таблица правого меню -->
                        <table class="header-table-small" align="right">
                            <th><span id="menuMsgLink" style="color: cornflowerblue ; font-weight: lighter; margin-right: 5px" ></span></th>
                            <td onclick="link('/link')" id="menuLink"><span id="count_links"><?php 
echo $count_links;
?>
</span></td>
                            <?php 
if (!Yii::$app->user->isGuest) {
    ?>
                                <td class="header_td_link" onclick="alert('Раздел НАСТРОЙКИ ПОЛЬЗОВАТЕЛЯ врененно в разработке')"><?php 
    echo User::name(Yii::$app->user->id);
    ?>
</td>
                                <td class="header_td_link" onclick="link('/logout')">Выход</td>
                            <?php 
} else {
    ?>
                                <td class="header_td_link" onclick="link('/signup')">Регистрация</td>
                                <td class="header_td_link" onclick="link('/login')">Вход</td>
                            <?php 
}
?>
                        </table>
                    </div>
                </div>
            </td>
开发者ID:Nechhist,项目名称:to.ru,代码行数:31,代码来源:_header.php

示例5: count

        <td>Всего: <?php 
echo count($msgs);
?>
</td>
    </tr>
</table>
<table style="width: 100%">
    <tr>
        <td style="width: 60%; padding: 10px; border: 2px solid #39b3d7; vertical-align: top;">
            <table id="msgs" class="tbl_msgs">
                <?php 
foreach ($msgs as $one) {
    ?>
                    <tr>
                        <th><?php 
    echo User::name($one['admin_id']);
    ?>
<br/><span style="font-size: xx-small; color: #c0c0c0;">(<?php 
    echo date('d.m.y', $one['time']);
    ?>
)</th>
                        <td><?php 
    echo nl2br(HTML::encode($one['text']));
    ?>
</td>
                    </tr>
                <?php 
}
?>
            </table>
        </td>
开发者ID:Nechhist,项目名称:to.ru,代码行数:31,代码来源:view.php

示例6: date

    ?>
</td>
                            <td><?php 
    echo T::name($one->t_id, 1);
    ?>
</td>
                            <td><?php 
    echo HTML::encode($one->name);
    ?>
</td>
                            <td><?php 
    echo Season::nets(1, $one->net_type);
    ?>
</td>
                            <td><?php 
    echo User::name($one->admin_id);
    ?>
</td>
                            <td><?php 
    echo date('d.m.y в H:i', $one->time_update);
    ?>
</td>
                        </tr>
                    <?php 
}
?>
                </table>
            </div>
        </div>

        <div class="col-lg-4 col-md-4 hidden-sm hidden-xs" style="margin: 0; padding: 0; padding-left: 10px;">
开发者ID:Nechhist,项目名称:to.ru,代码行数:31,代码来源:index.php

示例7:

            <span>
                <?php 
if ($t['game'] != null) {
    echo '(' . HTML::encode($t['game']) . ')';
}
?>
            </span>
        </td>
        <td>

            <!-- Админ - Сайт - Избранное -->
            <table style="width: 100%">
                <tr>
                    <td>
                        <strong>Админ: </strong><span style="color: #666666"><?php 
echo User::name($t['admin_id']);
?>
</span>.
                        <?php 
if ($t['site'] != null) {
    ?>
<strong>Сайт: </strong><a href="<?php 
    echo $t['site'];
    ?>
" target="_blank"><?php 
    echo HTML::encode($t['site']);
    ?>
</a><?php 
}
?>
                    </td>
开发者ID:Nechhist,项目名称:to.ru,代码行数:31,代码来源:_header.php

示例8: nl2br

<?php

/* @var $this yii\web\View */
use yii\helpers\Html;
use app\models\User;
//var_dump($news); exit;
?>
<div>
    <div>
        <span><?php 
echo User::name($msg->admin_id);
?>
: </span>
        <span><?php 
echo nl2br(HTML::encode($msg->text));
?>
</span>
    </div>
</div>
开发者ID:Nechhist,项目名称:to.ru,代码行数:19,代码来源:_message.php


注:本文中的app\models\User::name方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。