mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-06-07 05:39:21 +00:00
add handling of substitutes
This commit is contained in:
parent
fedcdb1b99
commit
06c71cc332
|
@ -95,6 +95,14 @@ if ($action == "adduser") {
|
||||||
$group->addUser($newUser);
|
$group->addUser($newUser);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Set substitute user if set */
|
||||||
|
if(isset($_POST["substitute"]) && $_POST["substitute"]) {
|
||||||
|
foreach($_POST["substitute"] as $substitute) {
|
||||||
|
$subsuser = $dms->getUser($substitute);
|
||||||
|
$newUser->addSubstitute($subsuser);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else UI::exitError(getMLText("admin_tools"),getMLText("access_denied"));
|
else UI::exitError(getMLText("admin_tools"),getMLText("access_denied"));
|
||||||
|
|
||||||
|
@ -316,6 +324,26 @@ else if ($action == "edituser") {
|
||||||
$group->removeUser($editedUser);
|
$group->removeUser($editedUser);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Set substitute user if set */
|
||||||
|
if(isset($_POST["substitute"]) && $_POST["substitute"])
|
||||||
|
$newsubs = $_POST['substitute'];
|
||||||
|
else
|
||||||
|
$newsubs = array();
|
||||||
|
$oldsubs = array();
|
||||||
|
foreach($editedUser->getSubstitutes() as $k)
|
||||||
|
$oldsubs[] = $k->getID();
|
||||||
|
|
||||||
|
$addsubs = array_diff($newsubs, $oldsubs);
|
||||||
|
foreach($addsubs as $subid) {
|
||||||
|
$subsuser = $dms->getUser($subid);
|
||||||
|
$editedUser->addSubstitute($subsuser);
|
||||||
|
}
|
||||||
|
$delsubs = array_diff($oldsubs, $newsubs);
|
||||||
|
foreach($delsubs as $subid) {
|
||||||
|
$subsuser = $dms->getUser($subid);
|
||||||
|
$editedUser->removeSubstitute($subsuser);
|
||||||
|
}
|
||||||
|
|
||||||
$session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_edit_user')));
|
$session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_edit_user')));
|
||||||
add_log_line(".php&action=edituser&userid=".$userid);
|
add_log_line(".php&action=edituser&userid=".$userid);
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,6 +35,7 @@ class SeedDMS_View_UsrMgr extends SeedDMS_Bootstrap_Style {
|
||||||
$dms = $this->params['dms'];
|
$dms = $this->params['dms'];
|
||||||
$user = $this->params['user'];
|
$user = $this->params['user'];
|
||||||
$seluser = $this->params['seluser'];
|
$seluser = $this->params['seluser'];
|
||||||
|
$users = $this->params['allusers'];
|
||||||
$groups = $this->params['allgroups'];
|
$groups = $this->params['allgroups'];
|
||||||
$passwordstrength = $this->params['passwordstrength'];
|
$passwordstrength = $this->params['passwordstrength'];
|
||||||
$passwordexpiration = $this->params['passwordexpiration'];
|
$passwordexpiration = $this->params['passwordexpiration'];
|
||||||
|
@ -189,6 +190,32 @@ class SeedDMS_View_UsrMgr extends SeedDMS_Bootstrap_Style {
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
|
?>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<div class="cbSelectTitle"><?php printMLText("substitute_user");?>:</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<select class="chzn-select-deselect" name="substitute[]" multiple data-placeholder="<?php printMLText('select_users'); ?>" data-no_results_text="<?php printMLText('unknown_owner'); ?>">
|
||||||
|
<?php
|
||||||
|
if($currUser) {
|
||||||
|
$substitutes = $currUser->getSubstitutes();
|
||||||
|
} else {
|
||||||
|
$substitutes = array();
|
||||||
|
}
|
||||||
|
foreach ($users as $usr) {
|
||||||
|
if ($usr->isGuest() || ($currUser && $usr->getID() == $currUser->getID()))
|
||||||
|
continue;
|
||||||
|
$checked=false;
|
||||||
|
foreach ($substitutes as $r) if ($r->getID()==$usr->getID()) $checked=true;
|
||||||
|
|
||||||
|
print "<option value=\"".$usr->getID()."\" ".($checked?"selected='selected' ":"").">". htmlspecialchars($usr->getLogin()." - ".$usr->getFullName())."</option>";
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<?php
|
||||||
if($workflowmode == "traditional" || $workflowmode == 'traditional_only_approval') {
|
if($workflowmode == "traditional" || $workflowmode == 'traditional_only_approval') {
|
||||||
if($workflowmode == "traditional") {
|
if($workflowmode == "traditional") {
|
||||||
?>
|
?>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user