本文整理汇总了PHP中UserUtil::wrapUserInfo方法的典型用法代码示例。如果您正苦于以下问题:PHP UserUtil::wrapUserInfo方法的具体用法?PHP UserUtil::wrapUserInfo怎么用?PHP UserUtil::wrapUserInfo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserUtil
的用法示例。
在下文中一共展示了UserUtil::wrapUserInfo方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handleUsers
public function handleUsers($event)
{
$users = array();
$records = User::model()->fetchAll(array("condition" => "status IN (0,1)"));
if (!empty($records)) {
foreach ($records as $record) {
$users[$record["uid"]] = UserUtil::wrapUserInfo($record);
}
}
Syscache::model()->modify("users", $users);
}
示例2: actionAdd
public function actionAdd()
{
MainUtil::checkLicenseLimit();
if (EnvUtil::submitCheck("userSubmit")) {
$origPass = filter_input(INPUT_POST, "password", FILTER_SANITIZE_STRING);
$_POST["salt"] = StringUtil::random(6);
$_POST["password"] = !empty($origPass) ? md5(md5($origPass) . $_POST["salt"]) : "";
$_POST["createtime"] = TIMESTAMP;
$_POST["guid"] = StringUtil::createGuid();
$this->dealWithSpecialParams();
$data = User::model()->create();
$newId = User::model()->add($data, true);
if ($newId) {
UserCount::model()->add(array("uid" => $newId));
$ip = Ibos::app()->setting->get("clientip");
UserStatus::model()->add(array("uid" => $newId, "regip" => $ip, "lastip" => $ip));
UserProfile::model()->add(array("uid" => $newId));
if (!empty($_POST["auxiliarydept"])) {
$deptIds = StringUtil::getId($_POST["auxiliarydept"]);
$this->handleAuxiliaryDept($newId, $deptIds, $_POST["deptid"]);
}
if (!empty($_POST["auxiliarypos"])) {
$posIds = StringUtil::getId($_POST["auxiliarypos"]);
$this->handleAuxiliaryPosition($newId, $posIds, $_POST["positionid"]);
}
$newUser = User::model()->fetchByPk($newId);
$users = UserUtil::loadUser();
$users[$newId] = UserUtil::wrapUserInfo($newUser);
User::model()->makeCache($users);
OrgUtil::update();
OrgUtil::hookSyncUser($newId, $origPass, 1);
$this->success(Ibos::lang("Save succeed", "message"), $this->createUrl("user/index"));
} else {
$this->error(Ibos::lang("Add user failed"), $this->createUrl("user/index"));
}
} else {
$deptid = "";
$manager = "";
$account = Ibos::app()->setting->get("setting/account");
if ($account["mixed"]) {
$preg = "[0-9]+[A-Za-z]+|[A-Za-z]+[0-9]+";
} else {
$preg = "^[A-Za-z0-9\\!\\@\\#\$\\%\\^\\&\\*\\.\\~]{" . $account["minlength"] . ",32}\$";
}
if ($deptid = EnvUtil::getRequest("deptid")) {
$deptid = StringUtil::wrapId(EnvUtil::getRequest("deptid"), "d");
$manager = StringUtil::wrapId(Department::model()->fetchManagerByDeptid(EnvUtil::getRequest("deptid")), "u");
}
$this->setPageTitle(Ibos::lang("Add user"));
$this->setPageState("breadCrumbs", array(array("name" => Ibos::lang("Organization"), "url" => $this->createUrl("department/index")), array("name" => Ibos::lang("User manager"), "url" => $this->createUrl("user/index")), array("name" => Ibos::lang("Add user"))));
$this->render("add", array("deptid" => $deptid, "manager" => $manager, "passwordLength" => $account["minlength"], "preg" => $preg));
}
}
示例3: updateByUid
public function updateByUid($uid, $attributes)
{
$counter = $this->updateByPk($uid, $attributes);
$users = UserUtil::loadUser();
$users[$uid] = UserUtil::wrapUserInfo(array_merge($users[$uid], $attributes));
$this->makeCache($users);
return $counter;
}
示例4: addUser
private function addUser()
{
if (Ibos::app()->request->isAjaxRequest) {
$fields = array("username", "password", "realname", "mobile", "deptid", "positionid", "email");
if (empty($_POST["username"]) || empty($_POST["password"])) {
$this->ajaxReturn(array("isSuccess" => false, "msg" => Ibos::lang("Username or password not empty")));
}
foreach ($fields as $field) {
if (isset($_POST[$field]) && !empty($_POST[$field])) {
$_POST[$field] = StringUtil::filterDangerTag($_POST[$field]);
}
}
$salt = StringUtil::random(6);
$userData = array("salt" => $salt, "username" => $_POST["username"], "password" => !empty($_POST["password"]) ? md5(md5($_POST["password"]) . $salt) : "", "realname" => $_POST["realname"], "mobile" => $_POST["mobile"], "createtime" => TIMESTAMP, "deptid" => intval($_POST["deptid"]), "positionid" => intval($_POST["positionid"]), "email" => $_POST["email"]);
$newId = User::model()->add($userData, true);
if ($newId) {
UserCount::model()->add(array("uid" => $newId));
$ip = Ibos::app()->setting->get("clientip");
UserStatus::model()->add(array("uid" => $newId, "regip" => $ip, "lastip" => $ip));
UserProfile::model()->add(array("uid" => $newId));
$newUser = User::model()->fetchByPk($newId);
$users = UserUtil::loadUser();
$users[$newId] = UserUtil::wrapUserInfo($newUser);
User::model()->makeCache($users);
OrgUtil::update();
$res["isSuccess"] = true;
} else {
$res["isSuccess"] = false;
$res["msg"] = Ibos::lang("Add user failed");
}
$this->ajaxReturn($res);
}
}