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


PHP UserAction::create方法代码示例

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


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

示例1: _doKickFromAod

 public static function _doKickFromAod()
 {
     $user = Member::findMemberId($_SESSION['memberid']);
     $id = $_POST['id'];
     Member::kickFromAod($id);
     UserAction::create(array('type_id' => 2, 'date' => date("Y-m-d H:i:s"), 'user_id' => $user, 'target_id' => $id));
 }
开发者ID:Oogieboogie23,项目名称:Division-Tracker,代码行数:7,代码来源:MemberController.php

示例2: _updateLoa

 public static function _updateLoa()
 {
     $user = User::find(intval($_SESSION['userid']));
     $member = Member::find(intval($_SESSION['memberid']));
     if (isset($_POST['remove']) || isset($_POST['approve'])) {
         if ($user->role < 2) {
             $data = array('success' => false, 'message' => "You are not authorized to perform that action.");
         } else {
             $loa = isset($_POST['loa_id']) ? LeaveOfAbsence::findById($_POST['loa_id']) : null;
             if (isset($_POST['remove'])) {
                 $revoked = LeaveOfAbsence::delete($loa->id);
                 UserAction::create(array('type_id' => 8, 'date' => date("Y-m-d H:i:s"), 'user_id' => $member->member_id, 'target_id' => $loa->member_id));
                 $data = array('success' => true, 'message' => "Leave of absence successfully removed.");
             } else {
                 if (isset($_POST['approve'])) {
                     if ($member->member_id == $loa->member_id) {
                         $data = array('success' => false, 'message' => "You can't approve your own leave of absence!");
                     } else {
                         $approved = LeaveOfAbsence::approve($loa->id, $member->member_id);
                         UserAction::create(array('type_id' => 7, 'date' => date("Y-m-d H:i:s"), 'user_id' => $member->member_id, 'target_id' => $loa->member_id));
                         $data = array('success' => true, 'message' => "Leave of absence successfully approved.");
                     }
                 }
             }
         }
     } else {
         $date = date('Y-m-d', strtotime($_POST['date']));
         $reason = $_POST['reason'];
         $comment = htmlentities($_POST['comment'], ENT_QUOTES);
         $name = Member::findForumName($_POST['id']);
         if ($name) {
             if (strtotime($date) > strtotime('now')) {
                 if (LeaveOfAbsence::exists($member->member_id)) {
                     $data = array('success' => false, 'message' => "This member already has an LOA in place!");
                 } else {
                     LeaveOfAbsence::add($_POST['id'], $date, $reason, $comment, $member->game_id);
                     UserAction::create(array('type_id' => 11, 'date' => date("Y-m-d H:i:s"), 'user_id' => $_POST['id']));
                     $data = array('success' => true, 'Request successfully submitted!', 'id' => $_POST['id'], 'name' => $name, 'date' => date('M d, Y', strtotime($date)), 'reason' => $reason);
                 }
             } else {
                 $data = array('success' => false, 'message' => "Date cannot be before today's date.");
             }
         } else {
             $data = array('success' => false, 'message' => 'The member id you provided appears to be invalid.');
         }
     }
     echo json_encode($data);
 }
开发者ID:higginsd,项目名称:Division-Tracker,代码行数:48,代码来源:DivisionController.php


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