/** * Summary of execute * @param \DOMElement $apiDocument * @return \DOMElement * @throws ApiException * @throws \Exception */ public function execute(\DOMElement $apiDocument) { $username = isset($_GET['user']) ? trim($_GET['user']) : ''; $wikiusername = isset($_GET['wikiuser']) ? trim($_GET['wikiuser']) : ''; if ($username === '' && $wikiusername === '') { throw new ApiException("Please specify a username using either user or wikiuser parameters."); } $userElement = $this->document->createElement("user"); $apiDocument->appendChild($userElement); $this->database = gGetDb(); if ($username !== '') { $this->user = \User::getByUsername($username, $this->database); } else { $this->user = \User::getByOnWikiUsername($wikiusername, $this->database); } if ($this->user === false) { $userElement->setAttribute("missing", "true"); return $apiDocument; } $userElement->setAttribute("username", $this->user->getUsername()); $userElement->setAttribute("status", $this->user->getStatus()); $userElement->setAttribute("lastactive", $this->user->getLastActive()); $userElement->setAttribute("welcome_template", $this->user->getWelcomeTemplate()); $userElement->setAttribute("onwikiname", $this->user->getOnWikiName()); $userElement->setAttribute("oauth", $this->user->isOAuthLinked() ? "true" : "false"); return $apiDocument; }
public static function doUpdate(User $vo) { $user = R::dispense('user'); $user->id = $vo->getId(); $user->username = $vo->getUserName(); $user->status = $vo->getStatus(); $user->password = $vo->getPassword(); return $id = R::store($user); }
public function execute(\DOMElement $apiDocument) { $username = isset($_GET['user']) ? trim($_GET['user']) : ''; if ($username == '') { throw new ApiException("Please specify a username"); } $userElement = $this->document->createElement("user"); $userElement->setAttribute("name", $username); $apiDocument->appendChild($userElement); $this->database = gGetDb(); $this->user = \User::getByUsername($username, $this->database); if ($this->user === false) { $userElement->setAttribute("missing", "true"); return $apiDocument; } $userElement->setAttribute("level", $this->user->getStatus()); $userElement->setAttribute("created", $this->getAccountsCreated()); $userElement->setAttribute("today", $this->getToday()); if ($this->user->isAdmin()) { $this->fetchAdminData($userElement); } return $apiDocument; }
public function update(User $user) { if ($this->find($user->getId())) { $id = $user->getId(); $username = $user->getUsername(); $password = $user->getPassword(); $email = $user->getEmail(); $previlege = $user->getPrevilege(); $status = $user->getStatus(); $sql = "UPDATE " . $this->TABLE_NAME . " SET\n username='******',password='******',email='{$email}',previlege='{$previlege}',status='{$status}'\n WHERE id='{$id}'"; if ($result = mysql_query($sql, $this->connection)) { return true; } else { return false; } } else { return false; } }
$params = explode('/', $_GET['url']); /* Memcache */ if (class_exists('Memcache')) { try { $memcache = new Memcache(); @$memcache->connect('127.0.0.1', 11211); } catch (Exception $e) { $memcache = null; } } /* Routes acceptable not logged in */ try { switch (true) { case validateRoute('GET', 'auth'): $user->login($_GET["username"], $_GET["password"]); httpResponse($user->getStatus()); break; case validateRoute('POST', 'auth'): httpResponse($user->create($postdata)); break; case validateRoute('POST', 'recover/by-passkey'): httpResponse($user->recoverByPasskey($postdata)); break; case validateRoute('POST', 'recover/by-email'): httpResponse($user->recoverByEmail($postdata)); break; case validateRoute('GET', 'recover/by-email'): httpResponse($user->gotRecoverByEmail($_GET["secret"])); break; case validateRoute('GET', 'find-torrents'): $torrentsFinder = new TorrentsFinder($db);
<?php /** * Created by JetBrains PhpStorm. * User: Chaula * Date: 1/24/15 * Time: 2:02 PM * Licenced to EMBRACE */ require_once "signup.class.php"; require_once "/../utils/view.class.php"; $user = new User(''); if (isset($_POST)) { if (!empty($_POST)) { $username = isset($_POST['username']) ? trim($_POST['username']) : ''; $email = isset($_POST['email']) ? trim($_POST['email']) : ''; $pass = isset($_POST['password']) ? trim($_POST['password']) : ''; $pass_two = isset($_POST['password_two']) ? trim($_POST['password_two']) : ''; $phone = isset($_POST['phone']) ? trim($_POST['phone']) : ''; $sex = isset($_POST['sex']) ? trim($_POST['sex']) : ''; $city = isset($_POST['city']) ? trim($_POST['city']) : ''; $about = isset($_POST['about']) ? trim($_POST['about']) : ''; $user = new User($username, $email, $pass, $pass_two, $phone, $sex, $city, $about); if ($user->getStatus() === true) { header('Location: confirm.php'); } } }
$referrer = optional_param("referrer", $CFG->homeAddress . "index.php", PARAM_URL); if ($referrer == "") { $referrer = $CFG->homeAddress . "index.php"; } if (empty($id) || empty($key)) { header('Location: ' . $CFG->homeAddress . 'index.php'); return; } $auth = new UserAuthentication($id); $userauth = $auth->load(); $errors = array(); if ($userauth instanceof UserAuthentication && $userauth->validateRegistrationKey($key)) { if ($userauth->completeVerification($key)) { $user = new User($userauth->getUserID()); if ($user instanceof User) { $status = $user->getStatus(); if ($status == $CFG->USER_STATUS_ACTIVE || $status == $CFG->USER_STATUS_REPORTED) { createSession($user); header('Location: ' . $referrer); die; } else { if ($status == $CFG->USER_STATUS_UNVALIDATED) { array_push($errors, $LNG->LOGIN_EXTERNAL_ERROR_ACCOUNT_UNVALIDATED); } else { if ($status == $CFG->USER_STATUS_UNAUTHORIZED) { array_push($errors, $LNG->LOGIN_EXTERNAL_ERROR_ACCOUNT_UNAUTHORIZED); } else { if ($status == $CFG->USER_STATUS_SUSPENDED) { array_push($errors, $LNG->LOGIN_EXTERNAL_ERROR_ACCOUNT_SUSPENDED); } }
private function getParams(User $user) { $params = array(':id' => $user->getId(), ':first_name' => $user->getFirstName(), ':user_password' => $user->getUserpassword(), ':status' => $user->getStatus()); return $params; }
function Main() { switch ($this->formArray["formAction"]) { case "edit": $UserDetails = new SoapObject(NCCBIZ . "UserDetails.php", "urn:Object"); if (!($xmlStr = $UserDetails->getUserDetails($this->formArray["userID"]))) { $this->tpl->set_block("rptsTemplate", "Table", "TableBlock"); $this->tpl->set_var("TableBlock", "User record not found"); } else { if (!($domDoc = domxml_open_mem($xmlStr))) { $this->tpl->set_block("rptsTemplate", "Table", "TableBlock"); $this->tpl->set_var("TableBlock", "error xmlDoc"); } else { $user = new User(); $user->parseDomDocument($domDoc); $this->formArray["userID"] = $user->getUserID(); $this->formArray["userType"] = $user->getUserType(); $this->formArray["username"] = $user->getUsername(); $this->formArray["password"] = $user->getPassword(); $this->formArray["personID"] = $user->getPersonID(); $this->formArray["status"] = $user->getStatus(); } } $PersonDetails = new SoapObject(NCCBIZ . "PersonDetails.php", "urn:Object"); if (!($xmlStr = $PersonDetails->getPersonDetails($this->formArray["personID"]))) { $this->tpl->set_block("rptsTemplate", "Table", "TableBlock"); $this->tpl->set_var("TableBlock", "Person record not found"); } else { if (!($domDoc = domxml_open_mem($xmlStr))) { $this->tpl->set_block("rptsTemplate", "Table", "TableBlock"); $this->tpl->set_var("TableBlock", "error xmlDoc"); } else { $person = new Person(); $person->parseDomDocument($domDoc); list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $person->getBirthday()); $this->formArray["personID"] = $person->getPersonID(); $this->formArray["lastName"] = $person->getLastName(); $this->formArray["firstName"] = $person->getFirstName(); $this->formArray["middleName"] = $person->getMiddleName(); $this->formArray["gender"] = $person->getGender(); $this->formArray["birth_year"] = removePreZero($dateArr["year"]); $this->formArray["birth_month"] = removePreZero($dateArr["month"]); $this->formArray["birth_day"] = removePreZero($dateArr["day"]); $this->formArray["maritalStatus"] = $person->getMaritalStatus(); $this->formArray["tin"] = $person->getTin(); $address = $person->addressArray[0]; if (is_a($address, Address)) { $this->formArray["addressID"] = $address->getAddressID(); $this->formArray["number"] = $address->getNumber(); $this->formArray["street"] = $address->getStreet(); $this->formArray["barangay"] = $address->getBarangay(); $this->formArray["district"] = $address->getDistrict(); $this->formArray["municipalityCity"] = $address->getMunicipalitycity(); $this->formArray["province"] = $address->getProvince(); } $this->formArray["telephone"] = $person->getTelephone(); $this->formArray["mobileNumber"] = $person->getMobileNumber(); $this->formArray["email"] = $person->getEmail(); } } $this->tpl->set_block("rptsTemplate", "NewUserPassword", "NewUserPasswordBlock"); $this->tpl->set_var("NewUserPasswordBlock", ""); $this->tpl->set_block("rptsTemplate", "OldUserPassword", "OldUserPasswordBlock"); $this->tpl->set_var("oldNewUserRowspan", 5); //$this->tpl->set_var("oldNewUserRowspan", 3); $this->tpl->parse("OldUserPasswordBlock", "OldUserPassword", true); break; case "save": /* if($this->isOldPasswordCorrect()==false){ $this->message = "Error. Cannot Save. Old password incorrect to create new password."; $this->tpl->set_var("message", $this->message); $this->tpl->parse("MessageBlock", "Message", true); $this->tpl->set_block("rptsTemplate", "NewUserPassword", "NewUserPasswordBlock"); $this->tpl->set_var("NewUserPasswordBlock", ""); $this->tpl->set_block("rptsTemplate", "OldUserPassword", "OldUserPasswordBlock"); $this->tpl->set_var("oldNewUserRowspan", 3); $this->tpl->parse("OldUserPasswordBlock", "OldUserPassword", true); break; } */ if ($this->formArray["newPassword"] != "" && $this->formArray["newPassword"] != "null") { $this->formArray["password"] = md5($this->formArray["newPassword"]); } if ($this->usernameAlreadyExists() == true) { $this->message = "Error. Cannot Save. Username already exists."; $this->tpl->set_var("message", $this->message); $this->tpl->parse("MessageBlock", "Message", true); $this->tpl->set_block("rptsTemplate", "NewUserPassword", "NewUserPasswordBlock"); $this->tpl->set_block("rptsTemplate", "OldUserPassword", "OldUserPasswordBlock"); if ($this->formArray["personID"] != "") { $this->tpl->set_var("NewUserPasswordBlock", ""); $this->tpl->set_var("oldNewUserRowspan", 3); $this->tpl->parse("OldUserPasswordBlock", "OldUserPassword", true); } else { $this->tpl->set_var("oldNewUserRowspan", 2); $this->tpl->parse("NewUserPasswordBlock", "NewUserPassword", true); $this->tpl->set_var("OldUserPasswordBlock", ""); } break; } $PersonEncode = new SoapObject(NCCBIZ . "PersonEncode.php", "urn:Object"); if ($this->formArray["personID"] != "") { $PersonDetails = new SoapObject(NCCBIZ . "PersonDetails.php", "urn:Object"); if (!($xmlStr = $PersonDetails->getPersonDetails($this->formArray["personID"]))) { $this->tpl->set_block("rptsTemplate", "Table", "TableBlock"); $this->tpl->set_var("TableBlock", "Person record not found"); } else { if (!($domDoc = domxml_open_mem($xmlStr))) { $this->tpl->set_block("rptsTemplate", "Table", "TableBlock"); $this->tpl->set_var("TableBlock", "error xmlDoc"); } else { $person = new Person(); $person->parseDomDocument($domDoc); $address = $person->addressArray[0]; if (is_a($address, Address)) { $address->setAddressID($this->formArray["addressID"]); $address->setNumber($this->formArray["number"]); $address->setStreet($this->formArray["street"]); $address->setBarangay($this->formArray["barangay"]); $address->setDistrict($this->formArray["district"]); $address->setMunicipalityCity($this->formArray["municipalityCity"]); $address->setProvince($this->formArray["province"]); $address->setDomDocument(); } $person->setPersonID($this->formArray["personID"]); $person->setPersonType("adminUser"); $person->setLastName($this->formArray["lastName"]); $person->setFirstName($this->formArray["firstName"]); $person->setMiddleName($this->formArray["middleName"]); $person->setGender($this->formArray["gender"]); $person->setBirthday($this->birthdate); $person->setMaritalStatus($this->formArray["maritalStatus"]); $person->setTin($this->formArray["tin"]); $person->setAddressArray($address); $person->setTelephone($this->formArray["telephone"]); $person->setMobileNumber($this->formArray["mobileNumber"]); $person->setEmail($this->formArray["email"]); $person->setDomDocument(); $doc = $person->getDomDocument(); //echo $doc->html_dump_mem(); $xmlStr = $doc->dump_mem(true); if (!($ret = $PersonEncode->updatePerson($xmlStr))) { exit("error update"); } } } } else { $address = new Address(); $address->setNumber($this->formArray["number"]); $address->setStreet($this->formArray["street"]); $address->setBarangay($this->formArray["barangay"]); $address->setDistrict($this->formArray["district"]); $address->setMunicipalityCity($this->formArray["municipalityCity"]); $address->setProvince($this->formArray["province"]); $address->setDomDocument(); $person = new Person(); $person->setPersonID($this->formArray["personID"]); $person->setPersonType("adminUser"); $person->setLastName($this->formArray["lastName"]); $person->setFirstName($this->formArray["firstName"]); $person->setMiddleName($this->formArray["middleName"]); $person->setGender($this->formArray["gender"]); $person->setBirthday($this->birthdate); $person->setMaritalStatus($this->formArray["maritalStatus"]); $person->setTin($this->formArray["tin"]); $person->setAddressArray($address); $person->setTelephone($this->formArray["telephone"]); $person->setMobileNumber($this->formArray["mobileNumber"]); $person->setEmail($this->formArray["email"]); $person->setDomDocument(); $doc = $person->getDomDocument(); $xmlStr = $doc->dump_mem(true); //echo $this->formArray["ownerID"].$xmlStr; if (!($ret = $PersonEncode->savePerson($xmlStr, $this->formArray["ownerID"]))) { exit("error save"); } } $this->formArray["personID"] = $ret; $UserEncode = new SoapObject(NCCBIZ . "UserEncode.php", "urn:Object"); if ($this->formArray["userID"] != "") { $UserDetails = new SoapObject(NCCBIZ . "UserDetails.php", "urn:Object"); if (!($xmlStr = $UserDetails->getUserDetails($this->formArray["userID"]))) { exit("User record not found"); } else { if (!($domDoc = domxml_open_mem($xmlStr))) { $this->tpl->set_block("rptsTemplate", "Table", "TableBlock"); $this->tpl->set_var("TableBlock", "error xmlDoc"); } else { $user = new User(); $user->parseDomDocument($domDoc); $user->setUserID($this->formArray["userID"]); $user->setUserType($this->formArray["userType"]); $user->setUsername($this->formArray["username"]); $user->setPassword($this->formArray["password"]); $user->setPersonID($this->formArray["personID"]); $user->setStatus($this->formArray["status"]); $user->setDomDocument(); $doc = $user->getDomDocument(); $xmlStr = $doc->dump_mem(true); if (!($ret = $UserEncode->updateUser($xmlStr))) { exit("error update"); } } } } else { $user = new User(); //$user->setUserID($this->formArray["userID"]); $user->setUserType($this->formArray["userType"]); $user->setUsername($this->formArray["username"]); $user->setPassword(md5($this->formArray["password"])); $user->setPersonID($this->formArray["personID"]); $user->setStatus($this->formArray["status"]); $user->setDomDocument(); $doc = $user->getDomDocument(); $xmlStr = $doc->dump_mem(true); if (!($ret = $UserEncode->saveUser($xmlStr))) { exit("error save"); } } header("location: UserClose.php" . $this->sess->url("")); exit; break; case "cancel": header("location: UserClose.php" . $this->sess->url("")); exit; break; default: $this->tpl->set_block("rptsTemplate", "UserID", "UserIDBlock"); $this->tpl->set_var("UserIDBlock", ""); $this->tpl->set_block("rptsTemplate", "ACK", "ACKBlock"); $this->tpl->set_var("ACKBlock", ""); $this->tpl->set_block("rptsTemplate", "NewUserPassword", "NewUserPasswordBlock"); $this->tpl->set_var("oldNewUserRowspan", 2); $this->tpl->parse("NewUserPasswordBlock", "NewUserPassword", true); $this->tpl->set_block("rptsTemplate", "OldUserPassword", "OldUserPasswordBlock"); $this->tpl->set_var("OldUserPasswordBlock", ""); } $this->setForm(); if ($this->message == "") { $this->tpl->set_var("MessageBlock", ""); } $this->tpl->parse("templatePage", "rptsTemplate"); $this->tpl->finish("templatePage"); $this->tpl->p("templatePage"); }
public function update(User $user) { $id = intval($user->getId()); $email = $this->db->quote($user->getEmail()); $name = $this->db->quote($user->getName()); $surname = $this->db->quote($user->getSurname()); $hash = $user->getHash(); $status = intval($user->getStatus()); $dateConnection = date('Y-m-d H:i:s', $user->getDateConnection()); $query = ' UPDATE user SET email = ' . $email . ', name = ' . $name . ', surname = ' . $surname . ', `hash` = "' . $hash . '", `status` = ' . $status . ', date_connection = "' . $dateConnection . '" WHERE id = ' . $id; $res = $this->db->exec($query); if ($res) { return $this->readById($id); } else { throw new Exception('Database error'); } }
/** * Create new account * * @param User $user * * @return User */ function createAccount($user) { $dao = $this->getDao(); $user_id = $dao->create($user->getUserName(), $user->getEmail(), $user->getPassword(), $user->getRealName(), $user->getRegisterPurpose(), $user->getStatus(), $user->getShell(), $user->getUnixStatus(), $user->getUnixUid(), $user->getUnixBox(), $user->getLdapId(), $_SERVER['REQUEST_TIME'], $user->getConfirmHash(), $user->getMailSiteUpdates(), $user->getMailVA(), $user->getStickyLogin(), $user->getAuthorizedKeys(), $user->getNewMail(), $user->getPeopleViewSkills(), $user->getPeopleResume(), $user->getTimeZone(), $user->getFontSize(), $user->getTheme(), $user->getLanguageID(), $user->getExpiryDate(), $_SERVER['REQUEST_TIME']); if (!$user_id) { $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('include_exit', 'error')); return 0; } else { $user = $this->getUserById($user_id); $this->assignNextUnixUid($user); // Create the first layout for the user and add some initial widgets $lm = $this->_getWidgetLayoutManager(); $lm->createDefaultLayoutForUser($user_id); if ($user->getStatus() == 'A' or $user->getStatus() == 'R') { $em = $this->_getEventManager(); $em->processEvent('project_admin_activate_user', array('user_id' => $user_id)); } return $user; } }
public function testGetAndSetStatus() { $this->user->setStatus(new Status(array())); $this->assertInstanceOf('League\\Twitter\\Status', $this->user->getStatus()); }
/** * @return bool true if the user is considered valid (active or restricted) */ private function isValidUser(User $user) { return isset(self::$user_status[$user->getStatus()]); }
function showEditUser($urid, $message = "") { $user = new User($urid); $returnStr = $this->showSysAdminHeader(Language::messageSMSTitle()); $returnStr .= '<div id="wrap">'; $returnStr .= $this->showNavBar(); $returnStr .= '<div class="container"><p>'; $returnStr .= '<ol class="breadcrumb">'; $returnStr .= '<li>' . setSessionParamsHref(array('page' => 'sysadmin.users'), Language::headerUsers()) . '</li>'; if ($user->getUsername() == '') { $returnStr .= '<li>' . Language::labelUserAddUser() . '</li>'; } else { $returnStr .= '<li>' . Language::labelEdit() . ' ' . $user->getUsername() . '</li>'; } $returnStr .= '</ol>'; $returnStr .= $message; $returnStr .= $this->displayComboBox(); $returnStr .= '<form id="editform" method="post">'; $returnStr .= '<span class="label label-default">' . Language::labelUserGeneral() . '</span>'; $returnStr .= '<div class="well">'; $returnStr .= setSessionParamsPost(array('page' => 'sysadmin.users.edituserres', 'urid' => $urid)); $returnStr .= '<div class="row">'; $returnStr .= '<div class="col-md-6">'; $returnStr .= '<table>'; $returnStr .= '<tr><td>' . Language::labelUserUserName() . '</td><td><input type="text" class="form-control" name="username" value="' . convertHTLMEntities($user->getUsername(), ENT_QUOTES) . '"></td></tr>'; $returnStr .= '<tr><td>' . Language::labelUserUserNameName() . '</td><td><input type="text" class="form-control" name="name" value="' . convertHTLMEntities($user->getName(), ENT_QUOTES) . '"></td></tr>'; $returnStr .= '<tr><td align=top>' . Language::labelUserActive() . '</td><td>'; $returnStr .= $this->showDropDown(array(VARIABLE_ENABLED => Language::labelEnabled(), VARIABLE_DISABLED => Language::labelDisabled()), $user->getStatus(), 'status'); $returnStr .= '</td></tr>'; $returnStr .= '<tr><td align=top>' . Language::labelUserUserType() . '</td><td>'; $returnStr .= $this->showDropDown(array(USER_INTERVIEWER => Language::labelInterviewer(), USER_NURSE => Language::labelNurse(), USER_SUPERVISOR => Language::labelSupervisor(), USER_TRANSLATOR => Language::labelTranslator(), USER_RESEARCHER => Language::labelResearcher(), USER_SYSADMIN => Language::labelSysadmin(), USER_TESTER => Language::labelTester()), $user->getUserType(), 'usertype', 'usertype'); $returnStr .= '</td></tr>'; $returnStr .= "<script type='text/javascript'>"; $returnStr .= '$( document ).ready(function() { $("#usertype").change(function (e) { if (this.value == ' . USER_NURSE . ') { $("#subtype").show(); $("#subtype2").hide(); } else if (this.value == ' . USER_SYSADMIN . ') { $("#subtype2").show(); $("#subtype").hide(); } else { $("#subtype").hide(); $("#subtype2").hide(); } if (this.value == ' . USER_INTERVIEWER . ' || this.value == ' . USER_CATIINTERVIEWER . ' || this.value == ' . USER_NURSE . ' || this.value == ' . USER_SUPERVISOR . ') { $("#super").show(); $("#accessdiv").hide(); $("#surveyaccess").hide(); } else { $("#super").hide(); $("#accessdiv").show(); $("#surveyaccess").show(); } }); })'; $returnStr .= "</script>"; if (inArray($user->getUserType(), array(USER_NURSE))) { $returnStr .= '<tr id=subtype><td align=top>' . Language::labelUserUserSubType() . '</td><td>'; $returnStr .= $this->showDropDown(array(USER_NURSE_MAIN => Language::labelNurseMain(), USER_NURSE_LAB => Language::labelNurseLab(), USER_NURSE_FIELD => Language::labelNurseField(), USER_NURSE_VISION => Language::labelNurseVision()), $user->getUserSubType(), 'usersubtype'); $returnStr .= '</td></tr>'; } else { if (inArray($user->getUserType(), array(USER_SYSADMIN))) { $returnStr .= '<tr id=subtype2><td align=top>' . Language::labelUserUserSubType() . '</td><td>'; $returnStr .= $this->showDropDown(array(USER_SYSADMIN_MAIN => Language::labelSysadminMain(), USER_SYSADMIN => Language::labelSysadminAdmin()), $user->getUserSubType(), 'usersubtype'); $returnStr .= '</td></tr>'; } else { $returnStr .= '<tr id=subtype style="display: none;"><td align=top>' . Language::labelUserUserSubType() . '</td><td>'; $returnStr .= $this->showDropDown(array(USER_NURSE_MAIN => Language::labelNurseMain(), USER_NURSE_LAB => Language::labelNurseLab(), USER_NURSE_FIELD => Language::labelNurseField(), USER_NURSE_VISION => Language::labelNurseVision()), $user->getUserSubType(), 'usersubtype'); $returnStr .= '</td></tr>'; $returnStr .= '<tr id=subtype2 style="display: none;"><td align=top>' . Language::labelUserUserSubType() . '</td><td>'; $returnStr .= $this->showDropDown(array(USER_SYSADMIN_MAIN => Language::labelSysadminMain(), USER_SYSADMIN => Language::labelSysadminAdmin()), $user->getUserSubType(), 'usersubtype'); $returnStr .= '</td></tr>'; } } if (inArray($user->getUserType(), array(USER_INTERVIEWER, USER_CATIINTERVIEWER, USER_NURSE, USER_SUPERVISOR))) { $returnStr .= '<tr id=super><td>' . Language::labelUserSupervisor() . '</td><td>'; $users = new Users(); $users = $users->getUsersByType(USER_SUPERVISOR); $returnStr .= $this->displayUsers($users, $user->getSupervisor(), 'uridsel', true); $returnStr .= '</td></tr>'; } $extra = ''; if (inArray($user->getUserType(), array(USER_NURSE, USER_INTERVIEWER, USER_SUPERVISOR, USER_CATIINTERVIEWER))) { $extra = "style='display: none;'"; } $returnStr .= '<tr id="surveyaccess"' . $extra . '><td>' . Language::labelUserSurveyAllowed() . '</td><td>' . $this->displaySurveys(SETTING_USER_SURVEYS . "[]", SETTING_USER_SURVEYS, implode("~", $user->getSurveysAccess()), '', "multiple") . '</td></tr>'; $returnStr .= '</table></div>'; $returnStr .= '<div class="col-md-6">'; $returnStr .= '<table>'; $returnStr .= '<tr><td align=top>' . Language::labelUserPassword() . '</td><td><input type="text" class="form-control" name="pwd1"></td></tr>'; $returnStr .= '<tr><td align=top>' . Language::labelUserPassword2() . '</td><td><input type="text" class="form-control" name="pwd2"></td></tr>'; $returnStr .= '</table></div></div>'; if ($urid != "") { $returnStr .= '<br/><input type="submit" class="btn btn-default" value="' . Language::buttonEdit() . '"/>'; } else { $returnStr .= '<br/><input type="submit" class="btn btn-default" value="' . Language::buttonAdd() . '"/>'; } $returnStr .= '</div></form>'; $suid = $_SESSION['SUID']; /* available surveys */ if ($urid != "") { $extra = ''; if (inArray($user->getUserType(), array(USER_NURSE, USER_INTERVIEWER, USER_SUPERVISOR, USER_CATIINTERVIEWER))) { $extra = "style='display: none;'"; } $returnStr .= "<div " . $extra . " id='accessdiv'>"; $returnStr .= "<form id=refreshform method=post>"; $returnStr .= '<input type=hidden name=page value="sysadmin.users.edituser">'; $returnStr .= '<input type=hidden name="' . SMS_POST_SURVEY . '" id="' . SMS_POST_SURVEY . '_hidden" value="' . getSurvey() . '">'; $returnStr .= "</form>"; $returnStr .= '<form id="editform1" method="post">'; $returnStr .= setSessionParamsPost(array('page' => 'sysadmin.users.edituseraccessres', 'urid' => $urid)); $returnStr .= '<span class="label label-default">' . Language::labelUserAccess() . '</span>'; $returnStr .= '<div class="well">'; $returnStr .= "<table>"; $allsurveys = $user->getSurveysAccess(); if (!inArray($suid, $allsurveys)) { $suid = $allsurveys[0]; } $survey = new Survey($suid); $u = $_SESSION['URID']; $_SESSION['URID'] = $urid; // pretend to be edited user for a moment to get surveys to display $returnStr .= '<tr><td>' . Language::labelUserSurveyAccess() . '</td><td>' . $this->displaySurveys(SMS_POST_SURVEY, SMS_POST_SURVEY, $suid, '', "") . '</td></tr>'; $_SESSION['URID'] = $u; $returnStr .= "<script type='text/javascript'>"; $returnStr .= '$( document ).ready(function() { $("#' . SMS_POST_SURVEY . '").change(function (e) { $("#' . SMS_POST_SURVEY . '_hidden").val(this.value); $("#refreshform").submit(); }); })'; $returnStr .= "</script>"; /* available modes */ $modes = Common::surveyModes(); $allowedmodes = explode("~", $survey->getAllowedModes()); $usermodes = $user->getModes($suid); foreach ($allowedmodes as $mode) { $returnStr .= "<tr class='modesrow'><td>" . $modes[$mode] . "</td><td>"; $returnStr .= $this->displayUserMode(SETTING_USER_MODE . $mode, inArray($mode, $usermodes)); $userlanguages = $user->getLanguages($suid, $mode); $returnStr .= "<td>" . Language::labelUserLanguageAllowed() . "</td>"; $returnStr .= "<td>" . $this->displayLanguagesAdmin(SETTING_USER_LANGUAGES . $mode, SETTING_USER_LANGUAGES . $mode, $userlanguages, true, false, false, "multiple", $survey->getAllowedLanguages($mode)) . "</td>"; $returnStr .= "</tr>"; } $returnStr .= '</table>'; $returnStr .= '<br/><input type="submit" class="btn btn-default" value="' . Language::buttonEdit() . '"/>'; $returnStr .= '</div></form></div>'; } $returnStr .= '</p></div> </div>'; //container and wrap $returnStr .= $this->showBottomBar(); $returnStr .= $this->showFooter(false); return $returnStr; }