本文整理汇总了PHP中ilObjUser::_getNumberOfUsersForStyle方法的典型用法代码示例。如果您正苦于以下问题:PHP ilObjUser::_getNumberOfUsersForStyle方法的具体用法?PHP ilObjUser::_getNumberOfUsersForStyle怎么用?PHP ilObjUser::_getNumberOfUsersForStyle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ilObjUser
的用法示例。
在下文中一共展示了ilObjUser::_getNumberOfUsersForStyle方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getStyles
/**
* 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);
}
示例2: testMiscellaneous
/**
* 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);
}
示例3: saveStyleSettingsObject
/**
* save skin and style settings
*/
function saveStyleSettingsObject()
{
global $styleDefinition, $ilCtrl;
// check if one style is activated
if (count($_POST["st_act"]) < 1) {
$this->ilias->raiseError($this->lng->txt("at_least_one_style"), $this->ilias->error_obj->MESSAGE);
}
//set default skin and style
if ($_POST["default_skin_style"] != "") {
$sknst = explode(":", $_POST["default_skin_style"]);
if ($this->ilias->ini->readVariable("layout", "style") != $sknst[1] || $this->ilias->ini->readVariable("layout", "skin") != $sknst[0]) {
$this->ilias->ini->setVariable("layout", "skin", $sknst[0]);
$this->ilias->ini->setVariable("layout", "style", $sknst[1]);
}
$this->ilias->ini->write();
}
// check if a style should be deactivated, that still has
// a user assigned to
$all_styles = ilStyleDefinition::getAllSkinStyles();
foreach ($all_styles as $st) {
if (!isset($_POST["st_act"][$st["id"]])) {
if (ilObjUser::_getNumberOfUsersForStyle($st["template_id"], $st["style_id"]) > 1) {
$this->ilias->raiseError($this->lng->txt("cant_deactivate_if_users_assigned"), $this->ilias->error_obj->MESSAGE);
} else {
ilObjStyleSettings::_deactivateStyle($st["template_id"], $st["style_id"]);
}
} else {
ilObjStyleSettings::_activateStyle($st["template_id"], $st["style_id"]);
}
}
ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
$ilCtrl->redirect($this, "editSystemStyles");
}
示例4: getAllSkinStyles
/**
* Get all skins/styles
*
* @param
* @return
*/
public static function getAllSkinStyles()
{
global $styleDefinition;
$all_styles = array();
$templates = $styleDefinition->getAllTemplates();
foreach ($templates as $template) {
// get styles definition for template
$styleDef = new ilStyleDefinition($template["id"]);
$styleDef->startParsing();
$styles = $styleDef->getStyles();
foreach ($styles as $style) {
$num_users = ilObjUser::_getNumberOfUsersForStyle($template["id"], $style["id"]);
// default selection list
$all_styles[$template["id"] . ":" . $style["id"]] = array("title" => $styleDef->getTemplateName() . " / " . $style["name"], "id" => $template["id"] . ":" . $style["id"], "template_id" => $template["id"], "style_id" => $style["id"], "template_name" => $styleDef->getTemplateName(), "substyle" => $style["substyle"], "style_name" => $style["name"], "users" => $num_users);
}
}
return $all_styles;
}