本文整理汇总了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);
}