本文整理汇总了PHP中UserUtil::loadUser方法的典型用法代码示例。如果您正苦于以下问题:PHP UserUtil::loadUser方法的具体用法?PHP UserUtil::loadUser怎么用?PHP UserUtil::loadUser使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserUtil
的用法示例。
在下文中一共展示了UserUtil::loadUser方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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));
}
}
示例2: getDataByLetter
protected function getDataByLetter()
{
$deptid = intval(EnvUtil::getRequest("deptid"));
if (!empty($deptid)) {
$deptids = Department::model()->fetchChildIdByDeptids($deptid, true);
$uids = User::model()->fetchAllUidByDeptids($deptids, false);
} else {
$users = UserUtil::loadUser();
$uids = ConvertUtil::getSubByKey($users, "uid");
}
$uids = $this->removeDisabledUid($uids);
$res = UserUtil::getUserByPy($uids);
return ContactUtil::handleLetterGroup($res);
}
示例3: createStaticJs
private static function createStaticJs()
{
CacheUtil::load(array("department", "position"), true);
$unit = Ibos::app()->setting->get("setting/unit");
$department = DepartmentUtil::loadDepartment();
$users = UserUtil::loadUser();
$position = PositionUtil::loadPosition();
$positionCategory = PositionUtil::loadPositionCategory();
$companyData = self::initCompany($unit);
$deptData = self::initDept($department);
$userData = self::initUser($users);
$posData = self::initPosition($position);
$posCatData = self::initPositionCategory($positionCategory);
$default = file_get_contents(PATH_ROOT . "/static/js/src/org.default.js");
if ($default) {
$patterns = array("/\\{\\{(company)\\}\\}/", "/\\{\\{(department)\\}\\}/", "/\\{\\{(position)\\}\\}/", "/\\{\\{(users)\\}\\}/", "/\\{\\{(positioncategory)\\}\\}/");
$replacements = array($companyData, $deptData, $posData, $userData, $posCatData);
$new = preg_replace($patterns, $replacements, $default);
FileUtil::createFile("data/org.js", $new);
CacheUtil::update("setting");
}
}
示例4: 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;
}
示例5: exportExcel
public static function exportExcel($id)
{
$data = Email::model()->fetchById($id);
if ($data) {
$users = UserUtil::loadUser();
header("Cache-control: private");
header("Content-type: application/vnd.ms-excel");
header("Content-Disposition: attachment; filename=" . ConvertUtil::iIconv($data["subject"], CHARSET, "GBK") . "(" . date("Y-m-d") . ").xls");
//$html = " <html xmlns:o=\"urn:schemas-microsoft-com:office:office\"\r\n\t\txmlns:x=\"urn:schemas-microsoft-com:office:excel\"\r\n\t\txmlns=\"http://www.w3.org/TR/REC-html40\">\r\n\t\t<head>\r\n\t\t<title></title>\r\n\t\t<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\r\n\t\t</head>\r\n\t\t<body topmargin=\"5\">\r\n\t\t <table border=\"1\" cellspacing=\"1\" width=\"95%\" class=\"small\" cellpadding=\"3\">\r\n\t\t\t<tr style=\"BACKGROUND: #D3E5FA; color: #000000; font-weight: bold;\">\r\n\t\t\t <td align=\"center\">收件人:</td>\r\n\t\t\t <td align=\"center\">发件人:</td>\r\n\t\t\t <td align=\"center\">抄送:</td>\r\n\t\t\t <td align=\"center\">重要性:</td>\r\n\t\t\t <td align=\"center\">标题:</td>\r\n\t\t\t <td align=\"center\">发送时间:</td>\r\n\t\t\t <td align=\"center\">内容:</td>\r\n\t\t\t <td align=\"center\">附件名称:</td>\r\n\t\t\t</tr> ";
$html = '<html xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office:excel"
xmlns="http://www.w3.org/TR/REC-html40">
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body topmargin="5">
<table border="1" cellspacing="1" width="95%" class="small" cellpadding="3">
<tr style="BACKGROUND: #D3E5FA; color: #000000; font-weight: bold;">
<td align="center">收件人:</td>
<td align="center">发件人:</td>
<td align="center">抄送:</td>
<td align="center">重要性:</td>
<td align="center">标题:</td>
<td align="center">发送时间:</td>
<td align="center">内容:</td>
<td align="center">附件名称:</td>
</tr>';
$data["toname"] = self::joinStringByArray($data["toids"], $users, "realname", ";");
$data["content"] = str_replace(" ", " ", $data["content"]);
$data["content"] = str_replace("\n", "<br>", $data["content"]);
$data["fromname"] = isset($users[$data["fromid"]]) ? $users[$data["fromid"]]["realname"] : "";
$data["copytoname"] = self::joinStringByArray($data["copytoids"], $users, "realname", ";");
$important_desc = "";
if ($data["important"] == "0") {
$important_desc = "";
} elseif ($data["important"] == "1") {
$important_desc = "<font color=\"#ff6600\">一般邮件</font>";
} elseif ($data["important"] == "2") {
$important_desc = "<font color=\"#FF0000\">重要邮件</font>";
}
$attachmentname = "";
if ($data["attachmentid"] !== "") {
$tempdata = AttachUtil::getAttach($data["attachmentid"]);
foreach ($tempdata as $value) {
$attachmentname .= $value["filename"] . "; ";
}
}
$data["sendtime"] = ConvertUtil::formatDate($data["sendtime"]);
//$html .= "\r\n <tr>\r\n <td nowrap align=\"center\">" . $data["toname"] . "</td>\r\n <td nowrap align=\"center\">" . $data["fromname"] . "</td>\r\n <td>" . $data["copytoname"] . "</td>\r\n <td nowrap align=\"center\">" . $important_desc . "</td>\r\n <td nowrap>" . $data["subject"] . "</td>\r\n <td nowrap align=\"center\" x:str=\"" . $data["sendtime"] . "\">" . $data["sendtime"] . "</td>\r\n <td>" . $data["content"] . "</td>\r\n <td>" . $attachmentname . "</td>\r\n </tr>\r\n </table>";
$html .= '<tr>
<td nowrap align="center">' . $data["toname"] . '</td>
<td nowrap align="center">' . $data["fromname"] . '</td>
<td>' . $data["copytoname"] . '</td>
<td nowrap align="center">' . $important_desc . '</td>
<td nowrap>' . $data["subject"] . '</td>
<td nowrap align="center" x:str="' . $data["sendtime"] . '">' . $data["sendtime"] . '</td>
<td>' . $data["content"] . '</td>
<td>' . $attachmentname . '</td>
</tr></table>';
echo $html;
}
}
示例6: getUserByPy
public static function getUserByPy($uids = null, $first = false)
{
$group = array();
if (is_array($uids)) {
$list = User::model()->fetchAllByUids($uids);
} else {
$list = UserUtil::loadUser();
}
foreach ($list as $k => $v) {
$py = ConvertUtil::getPY($v["realname"], $first);
if (!empty($py)) {
$group[strtoupper($py[0])][] = $k;
}
}
ksort($group);
$data = array("datas" => $list, "group" => $group);
return $data;
}
示例7: actionBindingUser
public function actionBindingUser()
{
if (EnvUtil::submitCheck("formhash")) {
$map = filter_input(INPUT_POST, "map", FILTER_SANITIZE_STRING);
if (!empty($map)) {
UserBinding::model()->deleteAllByAttributes(array("app" => "bqq"));
$maps = explode(",", $map);
foreach ($maps as $relation) {
list($uid, $openId) = explode("=", $relation);
UserBinding::model()->add(array("uid" => $uid, "bindvalue" => $openId, "app" => "bqq"));
}
$this->ajaxReturn(array("isSuccess" => true));
}
$this->ajaxReturn(array("isSuccess" => false));
} elseif (MessageUtil::getIsImOpen("qq")) {
$imCfg = Ibos::app()->setting->get("setting/im/qq");
$factory = new ICIMFactory();
$adapter = $factory->createAdapter("ICIMQq", $imCfg);
$api = $adapter->getApi();
$rs = $api->getUserList(array("timestamp" => 0));
$bqqUsers = array();
if (substr($rs, 0, 5) !== "error") {
$rsArr = json_decode($rs, true);
if (isset($rsArr["ret"]) && $rsArr["ret"] == 0) {
$bqqUsers = $rsArr["data"]["items"];
}
}
$data = array("ibosUsers" => UserUtil::loadUser(), "binds" => UserBinding::model()->fetchAllSortByPk("uid", "app = 'bqq'"), "bqqUsers" => $bqqUsers);
$this->renderPartial("qqbinding", $data);
}
}
示例8: autoProcessor
//.........这里部分代码省略.........
}
break;
case "sys_manager3":
$main = Ibos::app()->user->deptid;
$deptCache = DepartmentUtil::loadDepartment();
$dept_str = Department::model()->queryDept($main);
$temp = explode(",", $dept_str);
$count = count($temp);
$dept = $temp[$count - 2];
if ($deptCache[$dept]["manager"] != 0) {
$autoValue = User::model()->fetchRealnameByUid($deptCache[$dept]["manager"]);
}
break;
default:
break;
}
if ($value == "" && !$readOnly || $this->flow->isFixed() && $readOnly && StringUtil::findIn($this->process->processitemauto, $item["data-title"]) && $this->rp->opflag) {
$eleout = "\t\t\t\t<input type=\"text\" style=\"width:{$width} px;\" name=\"data_{$item["itemid"]}\" value=\"{$autoValue}\" title=\"{$item["data-title"]}\" />";
} else {
$eleout = "\t\t\t\t<input type=\"text\" style=\"width:{$width} px;\" name=\"data_{$item["itemid"]}\" value=\"{$value}\" title=\"{$item["data-title"]}\" />";
}
$hidden = isset($item["data-hide"]) ? $item["data-hide"] : "0";
if ($hidden == "1") {
$eleout = str_ireplace("type=\"text\"", "type=\"hidden\"", $eleout);
}
if (!$readOnly) {
if ($this->inApp && $this->flow->isFixed() && StringUtil::findIn($this->process->processitemauto, $item["data-title"])) {
$readOnly = true;
} else {
$eleout = str_ireplace("<input", "<input data-orig-value=\"{$autoValue}\" data-focus=\"restore\"", $eleout);
}
}
if ($readOnly) {
$this->setCommonReadOnly($item, $eleout, "input");
}
} else {
$autoValue = "<option value=\"\"";
if ($value == "") {
$autoValue .= " selected";
}
$autoValue .= "></option>\n";
switch ($field) {
case "sys_list_dept":
$cache = DepartmentUtil::loadDepartment();
$str = StringUtil::getTree($cache, "<option value='\$deptid' \$selected>\$spacer\$deptname</option>", $value);
$autoValue .= $str;
break;
case "sys_list_user":
foreach (UserUtil::loadUser() as $user) {
$selected = $value == $user["uid"] ? "selected" : "";
$autoValue .= "<option {$selected} value='" . $user["uid"] . "'>" . $user["realname"] . "</option>";
}
break;
case "sys_list_pos":
foreach (PositionUtil::loadPosition() as $pos) {
$selected = $value == $pos["positionid"] ? "selected" : "";
$autoValue .= "<option {$selected} value='" . $pos["positionid"] . "'>" . $pos["posname"] . "</option>";
}
break;
case "sys_list_prcsuser1":
$autoValue .= $this->getProcessUserList($this->flow->flowid, 0, $value);
break;
case "sys_list_prcsuser2":
$autoValue .= $this->getProcessUserList($this->flow->flowid, $this->process->processid, $value, true);
break;
case "sys_list_sql":
$sql = $item["data-src"];
$tempopt = array("uid" => Ibos::app()->user->uid, "deptid" => Ibos::app()->user->deptid, "positionid" => Ibos::app()->user->positionid, "runid" => $this->inDebug ? "" : $this->run->runid);
$autoValue = $this->execSysSql($sql, $tempopt);
$autoValue .= $this->arrayTolist($autoValue, $value);
break;
case "sys_list_manager1":
$main = Ibos::app()->user->deptid;
$autoValue .= $this->getManagerList($main, $value);
break;
case "sys_list_manager2":
$main = Ibos::app()->user->deptid;
$deptCache = DepartmentUtil::loadDepartment();
$upid = $deptCache[$main]["upid"];
if ($upid != 0) {
$autoValue .= $this->getManagerList($main, $value);
}
break;
case "sys_list_manager3":
$main = Ibos::app()->user->deptid;
$deptCache = DepartmentUtil::loadDepartment();
$dept_str = Department::model()->queryDept($main);
$temp = explode(",", $dept_str);
$count = count($temp);
$dept = $temp[$count - 2];
$autoValue .= $this->getManagerList($dept, $value);
break;
}
$eleout = "\t\t\t\t\t<select title=\"{$item["data-title"]}\" name=\"data_{$item["itemid"]}\">\r\n\t\t\t\t\t{$autoValue}\r\n\t\t\t\t\t</select>";
if ($readOnly) {
$this->setCommonReadOnly($item, $eleout, "select");
}
}
return $eleout;
}
示例9: fetchAllUidsByDocId
public function fetchAllUidsByDocId($docId)
{
$doc = $this->fetchByPk($docId);
if (empty($doc)) {
return null;
}
if ($doc["deptid"] == "alldept" || empty($doc["deptid"]) && empty($doc["positionid"]) && empty($doc["uid"])) {
$users = UserUtil::loadUser();
$uids = ConvertUtil::getSubByKey($users, "uid");
} else {
$uids = array();
if (!empty($doc["deptid"])) {
$deptids = Department::model()->fetchChildIdByDeptids($doc["deptid"], true);
$uids = array_merge($uids, User::model()->fetchAllUidByDeptids($deptids, false));
}
if (!empty($doc["positionid"])) {
$uids = array_merge($uids, User::model()->fetchAllUidByPositionIds($doc["positionid"], false));
}
if (!empty($doc["uid"])) {
$uids = array_merge($uids, explode(",", $doc["uid"]));
}
}
return array_unique($uids);
}
示例10: 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);
}
}