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


PHP User_Model::current方法代码示例

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


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

示例1: edit

 public function edit($id)
 {
     $user = User_Model::current();
     $project = ORM::factory('project', $id);
     if (!$user->loaded && $project->user_can($user, 'edit')) {
         return $this->template->content = 'oh, come on!';
     }
     if ($post = $this->input->post('project')) {
         $validation = Projects_utils::projects_edit_validation($post);
         if (!$project->validate($validation, true)) {
             return $this->template->content = Kohana::debug($validation->errors());
         }
         if ($additional_user_emails = $this->input->post('additional_user_emails')) {
             $additional_user_roles = $this->input->post('additional_user_roles');
             foreach ($additional_user_emails as $email) {
                 Profiles_utils::reserve_email_if_available($email);
             }
             $additional_users = array_combine($additional_user_emails, $additional_user_roles);
             $project->add_user_roles($additional_users);
         }
         url::redirect($project->local_url);
     } else {
         HTMLPage::add_style('forms');
         $this->template->content = View::factory('projects/edit')->bind('project_types', Projects_utils::get_project_types_dropdown_array())->bind('project', $project)->bind('user', $user);
     }
 }
开发者ID:hdragomir,项目名称:ProjectsLounge,代码行数:26,代码来源:projects.php

示例2: profile

 public function profile($id)
 {
     $user = User_Model::current();
     $profile = ORM::factory('user', $id);
     if (!$profile->loaded) {
         $this->template->content = 'user now found';
     }
     $connections = array();
     foreach ($profile->projects as $project) {
         foreach ($project->users as $member) {
             if ($member->id != $profile->id) {
                 $connections[$member->id] = $member;
             }
         }
     }
     $this->template->content = View::factory('profiles/view', compact('profile', 'user', 'connections'));
 }
开发者ID:hdragomir,项目名称:ProjectsLounge,代码行数:17,代码来源:profiles.php

示例3:

<div id="user-top-menu">
<?php 
$user = User_Model::current();
if (!$user->loaded) {
    ?>
<a id="login" rel="nofollow" href="<?php 
    echo url::site('login');
    ?>
">Login to your account</a>

<?php 
} else {
    ?>

Howdy, <a href="<?php 
    echo $user->local_url;
    ?>
"><?php 
    echo $user;
    ?>
</a>.
<a href="<?php 
    echo url::site('logout');
    ?>
">Logout</a>.
<?php 
}
?>
</div>
开发者ID:hdragomir,项目名称:ProjectsLounge,代码行数:29,代码来源:user-top-menu.php


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