本文整理汇总了PHP中UserManager::deactivate_users方法的典型用法代码示例。如果您正苦于以下问题:PHP UserManager::deactivate_users方法的具体用法?PHP UserManager::deactivate_users怎么用?PHP UserManager::deactivate_users使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserManager
的用法示例。
在下文中一共展示了UserManager::deactivate_users方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: deactivate_zombies
/**
* @param $ceiling
*/
static function deactivate_zombies($ceiling)
{
$zombies = self::list_zombies($ceiling);
$ids = array();
foreach ($zombies as $zombie) {
$ids[] = $zombie['user_id'];
}
UserManager::deactivate_users($ids);
}
示例2: action_deactivate
function action_deactivate($ids)
{
return UserManager::deactivate_users($ids);
}
示例3: change_user_session
/**
* Changes the user from one session to another due a reason
* @params int user_id
* @params int old session id
* @params int new session id
* @params int see SessionManager::get_session_change_user_reasons()
*/
static function change_user_session($user_id, $old_session_id, $new_session_id, $reason_id)
{
if (!empty($user_id) && !empty($old_session_id) && !empty($new_session_id)) {
$user_id = intval($user_id);
$old_session_id = intval($old_session_id);
$new_session_id = intval($new_session_id);
$reason_id = intval($reason_id);
$tbl_session_rel_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
$tbl_session_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_USER);
$tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
// Update number of users
$update_sql = "UPDATE {$tbl_session} SET nbr_users = nbr_users - 1 WHERE id = '{$old_session_id}' ";
Database::query($update_sql);
// Get the list of courses related to this session
$course_list = SessionManager::get_course_list_by_session_id($old_session_id);
if (!empty($course_list)) {
foreach ($course_list as $course) {
$courseId = $course['id'];
// Delete user from course
//Database::query("DELETE FROM $tbl_session_rel_course_rel_user WHERE id_session='$session_id' AND course_code='$course_code' AND id_user='$user_id'");
//if (Database::affected_rows()) {
// Update number of users in this relation
$sql = "UPDATE {$tbl_session_rel_course} SET nbr_users = nbr_users - 1 WHERE id_session = '{$old_session_id}' AND c_id='{$courseId}'";
Database::query($sql);
//}
}
}
//Deal with reasons
switch ($reason_id) {
case self::SESSION_CHANGE_USER_REASON_SCHEDULE:
case self::SESSION_CHANGE_USER_REASON_CLASSROOM:
case self::SESSION_CHANGE_USER_REASON_LOCATION:
//Adding to the new session
self::suscribe_users_to_session($new_session_id, array($user_id), null, false);
//Setting move_to if session was provided
$sql = "UPDATE {$tbl_session_rel_user} SET moved_to = '{$new_session_id}'\n WHERE id_session = '{$old_session_id}' AND id_user ='{$user_id}'";
Database::query($sql);
break;
case self::SESSION_CHANGE_USER_REASON_ENROLLMENT_ANNULATION:
UserManager::deactivate_users(array($user_id));
break;
}
$now = api_get_utc_datetime();
//Setting the moved_status
$sql = "UPDATE {$tbl_session_rel_user} SET moved_status = {$reason_id}, moved_at = '{$now}'\n WHERE id_session = '{$old_session_id}' AND id_user ='{$user_id}'";
Database::query($sql);
return true;
}
return;
}
示例4: testDeactivate_users2
/**
* Generated from @assert (array(-1)) === false.
*
* @covers UserManager::deactivate_users
*/
public function testDeactivate_users2()
{
$this->assertSame(false, UserManager::deactivate_users(array(-1)));
}