/** * Get styles * * @param * @return */ function getStyles() { global $styleDefinition; $all_styles = ilStyleDefinition::getAllSkinStyles(); // get all user assigned styles $all_user_styles = ilObjUser::_getAllUserAssignedStyles(); // output "other" row for all users, that are not assigned to // any existing style $users_missing_styles = 0; foreach ($all_user_styles as $style) { if (!isset($all_styles[$style])) { $style_arr = explode(":", $style); $users_missing_styles += ilObjUser::_getNumberOfUsersForStyle($style_arr[0], $style_arr[1]); } } if ($users_missing_styles > 0) { $all_styles["other"] = array("title" => $this->lng->txt("other"), "id" => "other", "template_id" => "", "style_id" => "", "template_name" => "", "style_name" => "", "users" => $users_missing_styles); } $this->setData($all_styles); }
/** * Miscellaneous * @group IL_Init */ public function testMiscellaneous() { $value = ""; include_once "./Services/User/classes/class.ilObjUser.php"; ilObjUser::_getNumberOfUsersForStyle("default", "delos"); ilObjUser::_getAllUserAssignedStyles(); ilObjUser::_moveUsersToStyle("default", "delos", "default", "delos"); $this->assertEquals("", $value); }
/** * Move user styles * * @param * @return */ function moveUserStylesObject() { global $ilCtrl, $lng; $to = explode(":", $_POST["to_style"]); if ($_POST["from_style"] != "other") { $from = explode(":", $_POST["from_style"]); ilObjUser::_moveUsersToStyle($from[0], $from[1], $to[0], $to[1]); } else { // get all user assigned styles $all_user_styles = ilObjUser::_getAllUserAssignedStyles(); // move users that are not assigned to // currently existing style foreach ($all_user_styles as $style) { if (!in_array($style, $all_styles)) { $style_arr = explode(":", $style); ilObjUser::_moveUsersToStyle($style_arr[0], $style_arr[1], $to[0], $to[1]); } } } ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true); $ilCtrl->redirect($this, "editSystemStyles"); }