本文整理汇总了PHP中Model_User::is_current_user方法的典型用法代码示例。如果您正苦于以下问题:PHP Model_User::is_current_user方法的具体用法?PHP Model_User::is_current_user怎么用?PHP Model_User::is_current_user使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Model_User
的用法示例。
在下文中一共展示了Model_User::is_current_user方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: before
public function before()
{
$returnData = parent::before();
if (Model_User::is_current_user('teacher')) {
Response::redirect('site/404');
}
return $returnData;
}
示例2: getSubjectOptions
/**
* Gets all subjects as options used for forms
*
* @return array the subjects as assoc array ['id' => 'value']
*/
public static function getSubjectOptions()
{
$where = [];
if (!Model_User::is_current_user('admin')) {
$where = ['user_id' => Auth::get('id')];
}
$subjects = static::find('all', ['where' => $where]);
return Arr::assoc_to_keyval($subjects, 'id', 'subject_code');
}
示例3: action_delete
public function action_delete($id = null)
{
if (Model_User::is_current_user('teacher')) {
Response::redirect('site/404');
}
if ($user = Model_User::find('first', ['where' => ['id' => $id]])) {
$user->delete();
Session::set_flash('success', e('Deleted user #' . $id));
} else {
Session::set_flash('error', e('Could not delete user #' . $id));
}
Response::redirect('site/users');
}
示例4: action_delete
public function action_delete($id = null)
{
$where = ['id' => $id];
if (Model_User::is_current_user('teacher')) {
$where['subject.user_id'] = Auth::get('id');
}
if ($syllabus = Model_Syllabus::find('first', ['where' => $where, 'related' => ['subject']])) {
$syllabus->delete();
Session::set_flash('success', e('Deleted syllabus #' . $id));
} else {
Session::set_flash('error', e('Could not delete syllabus #' . $id));
}
Response::redirect('site/syllabuses');
}
示例5: array
?>
</td>
<td><?php
echo $item->contact_num;
?>
</td>
<td><?php
echo $item->address;
?>
</td>
<td>
<?php
echo Html::anchor('site/users/view/' . $item->id, 'View');
?>
<?php
if (Model_User::is_current_user('admin')) {
?>
|
<?php
echo Html::anchor('site/users/edit/' . $item->id, 'Edit');
?>
|
<?php
echo Html::anchor('site/users/delete/' . $item->id, 'Delete', array('onclick' => "return confirm('Are you sure?')"));
?>
<?php
}
?>
</td>
</tr>
示例6: get_list_of_teachers
/**
* Get list of teachers
*
* @return array
*/
public static function get_list_of_teachers()
{
$users = [];
if (!Model_User::is_current_user('teacher')) {
$users = Model_User::find('all', array('where' => array('group' => '50')));
} else {
}
return Arr::assoc_to_keyval($users, 'id', 'fullname');
}