41 $err = _(
"the login must not be empty");
42 }
else if (
$login ==
"-") {
43 }
else if (
$login ==
"-") {
66 $q->AddQuery(sprintf(
"login='%s'", pg_escape_string(mb_strtolower(
$login))));
67 if (
$id)
$q->AddQuery(sprintf(
"id != %d",
$id));
68 $q->Query(0, 0,
"TABLE");
69 $err =
$q->basic_elem->msg_err;
70 if ((
$err ==
"") && (
$q->nb > 0))
$err = _(
"login yet use");
81 include_once (
'FDL/Lib.Dir.php');
84 "us_whatid = '" . intval($this->
getRawValue(
"US_WHATID")) .
"'"
87 if (count(
$tdoc) > 0)
return _(
"system id already set in database\nThis kind of document can not be duplicated");
96 $err = parent::preDocDelete();
99 if (($uid > 0) && ($uid < 10))
$err = _(
"this system user cannot be deleted");
110 $accountIds = array_unique($accountIds);
111 $kr = array_search(
'', $accountIds);
112 if ($kr !==
false) unset($accountIds[$kr]);
114 if (count($accountIds) > 0) {
115 $sql = sprintf(
"select id from users where fid in (%s)", implode(
',', $accountIds));
117 $sysIds = array_unique($sysIds);
128 function ChooseGroup($target =
"_self", $ulink =
true, $abstract =
false)
132 $action->parent->AddJsRef($action->GetParam(
"CORE_PUBURL") .
"/FDL/Layout/mktree.js");
133 $action->parent->addCssRef($action->GetParam(
"CORE_PUBURL") .
"/USERCARD/Layout/choosegroup.css");
139 if (!
$user->isAffected()) {
140 return sprintf(_(
"user #%d does not exist") , $iduser);
142 $ugroup =
$user->GetGroupsId();
152 $this->lay->set(
"wid", ($iduser ==
"") ?
"0" : $iduser);
154 $q2 =
new queryDb(
"",
"Account");
155 $groups = $q2->Query(0, 0,
"TABLE",
"select users.*, groups.idgroup from users, groups where users.id = groups.iduser and users.accounttype='G'");
157 $q2 =
new queryDb(
"",
"Account");
158 $mgroups = $q2->Query(0, 0,
"TABLE",
"select users.* from users where accounttype='G' and id not in (select iduser from groups, users u where groups.idgroup = u.id and u.accounttype='G')");
161 foreach ($groups as $k => $v) {
162 $v[
"login"] = htmlspecialchars($v[
"login"]);
163 $v[
"firstname"] = htmlspecialchars($v[
"firstname"]);
164 $v[
"lastname"] = htmlspecialchars($v[
"lastname"]);
165 $groupuniq[$v[
"id"]] = $v;
167 if (in_array($v[
"id"], $ugroup)) {
168 $groupuniq[$v[
"id"]][
"checkbox"] =
"checked";
170 $groupuniq[$v[
"id"]][
"checkbox"] =
"";
177 $iconGroup = $this->
getIcon(
'', 14);
180 foreach ($mgroups as $k => $v) {
181 $v[
"login"] = htmlspecialchars($v[
"login"]);
182 $v[
"firstname"] = htmlspecialchars($v[
"firstname"]);
183 $v[
"lastname"] = htmlspecialchars($v[
"lastname"]);
186 $tgroup[$k][
"SUBUL"] = $cgroup;
191 $tgroup[$k][
"icon"] =
$icon;
193 $tgroup[$k][
"icon"] = $iconGroup;
196 $groupuniq[$v[
"id"]] = $v;
197 if (in_array($v[
"id"], $ugroup)) {
198 $groupuniq[$v[
"id"]][
"checkbox"] =
"checked";
200 $groupuniq[$v[
"id"]][
"checkbox"] =
"";
204 $this->lay->setBlockData(
"LI", $tgroup);
205 uasort($groupuniq, array(
209 $this->lay->setBlockData(
"SELECTGROUP", $groupuniq);
220 foreach ($groups as $k => $v) {
221 if ($v[
"idgroup"] ==
$id) {
228 $tlay[$k][
"icon"] =
$icon;
230 $tlay[$k][
"icon"] =
"Images/igroup.gif";
235 if (count($tlay) == 0)
return "";
237 $lay =
new Layout(
"USERCARD/Layout/ligroup.xml", $action);
242 $lay->setBlockData(
"LI", $tlay);
250 return strcasecmp(
$a[
'lastname'], $b[
'lastname']);
259 include_once (
"FDL/Lib.Usercard.php");
263 $gidnew = isset($_POST[
"gidnew"]) ? $_POST[
"gidnew"] :
'';
265 if ($gidnew ==
"Y") {
269 $gids = $_POST[
"gid"];
270 if ($gids ==
"") $gids = array();
273 $rgid = $gAccount->GetGroupsId();
274 if ((count($rgid) != count($gids)) || (count(array_diff($rgid, $gids)) != 0)) {
275 $gdel = array_diff($rgid, $gids);
276 $gadd = array_diff($gids, $rgid);
278 $g =
new Group(
"", $gAccount->id);
279 foreach ($gadd as $gid) {
280 $g->iduser = $gAccount->id;
285 $err.= $gdoc->insertDocument($this->
id);
288 foreach ($gdel as $gid) {
293 if (!method_exists($gdoc,
"deleteMember")) AddWarningMsg(
"no group $gid/" . $gdoc->id);
296 $err = $gdoc->removeDocument($this->
id);
317 if ($u->isAffected()) {
319 $du =
new_Doc($this->dbaccess, $u->fid);
320 if ($du->isAlive())
return $du;
335 } elseif ($this->wuser) {
336 if ($this->wuser->fid != $this->getRawValue(
"us_whatid")) {
342 if (!isset($this->wuser)) {
348 if (!isset($this->wuser))
return false;
365 if (isset($this->wuser)) {
Layout is a template generator.
getTDoc($dbaccess, $id, $sqlfilters=array(), $result=array())
_getChildsGroup($id, $groups)
print< H1 > Check Database< i > $dbaccess</i ></H1 > $a
getIcon($idicon="", $size=null, $otherId=null)
getSystemIds(array $accountIds)
getAccount($nocache=false)
internalGetDocCollection($dbaccess, $dirid, $start="0", $slice="ALL", $sqlfilters=array(), $userid=1, $qtype="LIST", $fromid="", $distinct=false, $orderby="title", $latest=true, $trash="", &$debug=null, $folderRecursiveLevel=2, $join= '',\SearchDoc &$searchDoc=null)
new_Doc($dbaccess, $id= '', $latest=false)
ExistsLogin($login, $unused=0)
postAffect(array $data, $more, $reset)
simpleQuery($dbaccess, $query, &$result=array(), $singlecolumn=false, $singleresult=false, $useStrict=null)
if($file) if($subject==""&&$file) if($subject=="") $err
ChooseGroup($target="_self", $ulink=true, $abstract=false)
getRawValue($idAttr, $def="")