當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。