本文整理匯總了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));
}
示例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);
}