Esempio n. 1
0
 public function execute(Request $request, Response $response)
 {
     // The user to (un)lock
     $userID = $request->getParameter("userID");
     // Check if to lock or unlock
     $lockState = $request->getParameter("lockState");
     $result = array("id" => $request->getParameter("senderID"), "command" => "lockUnlockUser");
     // Lock user
     if ($lockState == "lock") {
         $GLOBALS["USERMANAGEMENT_DATA_ACCESS"]->lockUser($userID);
     } else {
         $GLOBALS["USERMANAGEMENT_DATA_ACCESS"]->unlockUser($userID);
     }
     $result["status"] = usermanangement::get_instance()->get_user_status_html($GLOBALS["USERMANAGEMENT_DATA_ACCESS"]->getUserLogin($userID));
     $result["state"] = "ok";
     return $result;
 }
Esempio n. 2
0
 public function execute(Request $request, Response $response)
 {
     // The user to (un)lock
     $userID = $request->getParameter("userID");
     // Check if to lock or unlock
     $trashState = $request->getParameter("trashState");
     $result = array("id" => $request->getParameter("senderID"), "command" => "trashRestoreUser");
     // Lock user
     if ($trashState == "trash") {
         $GLOBALS["USERMANAGEMENT_DATA_ACCESS"]->trashUser($userID);
         $result["value"] = "trash";
     } else {
         $GLOBALS["USERMANAGEMENT_DATA_ACCESS"]->restoreUser($userID);
         $result["value"] = "restore";
     }
     $result["status"] = usermanangement::get_instance()->get_user_status_html($GLOBALS["USERMANAGEMENT_DATA_ACCESS"]->getUserLogin($userID));
     $result["trashdate"] = $GLOBALS["USERMANAGEMENT_DATA_ACCESS"]->getTrashDate($userID);
     $result["state"] = "ok";
     $viewHelper = new ViewHelper();
     $result["html"] = str_replace("</tr>", "", str_replace("<tr class=\"filter_user\" id=\"row[{$userID}]\">", "", $viewHelper->getEmployeeRow($userID, $GLOBALS["USERMANAGEMENT_DATA_ACCESS"]->getUserLogin($userID))));
     return $result;
 }
Esempio n. 3
0
 public function getEmployeeRow($userID, $login)
 {
     if (!$this->dataAccess->isTrashed($userID)) {
         $html = "  <tr class=\"filter_user\" id=\"row[" . $userID . "]\">\n";
         $userFullName = $this->dataAccess->getUserFirstName($userID) . " " . $this->dataAccess->getUserLastName($userID);
         $userStatus = $this->dataAccess->getUserStatus($userID) != "Teilnehmer" ? " - " . $this->dataAccess->getUserStatus($userID) : "";
         $iconId = $this->dataAccess->getUserIconId($userID);
         $icon_link = $iconId == 0 ? PATH_STYLE . "images/anonymous.jpg" : PATH_URL . "cached/get_document.php?id=" . $iconId . "&type=usericon&width=30&height=40";
         $html .= "    <td style=\"vertical-align:top;width: 26px;\"><img src=\"{$icon_link}\" width=\"26\" height=\"35\" alt=\"{$userFullName}\" title=\"{$userFullName}\"/></td>\n";
         //$html .= "    <td><input id=\"firstname[" . $userID . "]\" type=\"text\" class=\"greyInputField\" name=\"firstname\" value=\"" . $this->dataAccess->getUserFirstName($userID) . "\" onclick=\"enterField(this)\" onfocus=\"enterField(this)\" onblur=\"saveFieldValue(this)\" userID=\"" . $userID . "\" />";
         //$html .= "        <input id=\"lastname[" . $userID . "]\" type=\"text\" class=\"greyInputField\" name=\"lastname\" value=\"" . $this->dataAccess->getUserLastName($userID) . "\" onclick=\"enterField(this)\" onfocus=\"enterField(this)\" onblur=\"saveFieldValue(this)\" userID=\"" . $userID . "\" /> (<small>" . $login . "</small>)";
         //$html .= "        <br><input id=\"email[" . $userID . "]\" type=\"text\" class=\"greyInputField\" style=\"width:120px;\" name=\"email\" value=\"" . $this->dataAccess->getUserEmail($userID) . "\" onclick=\"enterField(this)\" onfocus=\"enterField(this)\" onblur=\"saveFieldValue(this)\" userID=\"" . $userID . "\" /></td>\n";
         $html .= "    <td style=\"width:370px;vertical-align:top;\"><img id=\"toggleImg[{$userID}]\" onclick=\"toggleEditMode({$userID})\" style=\"cursor:pointer;float:right;\" src=\"/styles/standard/images/edit_16.gif\">";
         $html .= "      <div class=\"readonly\" id=\"readonly_{$userID}\"><b style=\"cursor:pointer\" onclick=\"location.href = ('/user/{$login}/')\"><div id=\"readonly_firstname[{$userID}]\" style=\"color:#C36026;display:inline;margin-top:-16px;\">" . $this->dataAccess->getUserFirstName($userID) . "</div> <div id=\"readonly_lastname[{$userID}]\" style=\"color:#C36026;display:inline;\">" . $this->dataAccess->getUserLastName($userID) . "</div></b> (" . $login . ")" . $userStatus;
         $html .= "        <br><small id=\"readonly_email[{$userID}]\" >" . ($this->dataAccess->getUserEmail($userID) == "" ? "keine E-Mail-Adresse" : $this->dataAccess->getUserEmail($userID)) . "</small>";
         $html .= "      <br><small id=\"desc_{$userID}\">" . usermanangement::get_instance()->get_user_status_html($login) . "</small>";
         //$courses = $this->dataAccess->getCoursesForUser($userID);
         //$keys = array_keys($courses);
         //$course = $courses[$keys[0]];
         //$html .= "      <br><b>Kurse:</b><br> " . $course["COURSE_NAME"];
         //$html .= "<br><small>Rolle Teilnehmer</small>";
         //$html .= "<br><a href=\"\">Kurse verwalten</a>";
         $html .= "</div>";
         $html .= "<div class=\"edit\" id=\"edit_{$userID}\" style=\"display:none\"><div style=\"display:block;margin-bottom:3px\"><b>Benutzerkennung:</b> " . $login . "</div>";
         $html .= "<div style=\"display:block;white-space:nowrap;\"><table><tr><td style=\"padding:0px;margin:0px;background-color:#ffffff\"><b>Vorname:</b></td><td style=\"padding:0px;margin:0px;background-color:#ffffff;width:100%\"><input id=\"firstname[" . $userID . "]\" onclick=\"enterField(this)\" onfocus=\"enterField(this)\" onblur=\"saveFieldValue(this)\" userID=\"" . $userID . "\" style=\"width:100%;background-color:#ffffff;border: 1px solid #ccc;margin:1px;\" name=\"firstname\" value=\"" . $this->dataAccess->getUserFirstName($userID) . "\"></td></tr></table></div>";
         $html .= "<div style=\"display:block;white-space:nowrap;\"><table><tr><td style=\"padding:0px;margin:0px;background-color:#ffffff\"><b>Nachname:</b></td><td style=\"padding:0px;margin:0px;background-color:#ffffff;width:100%\"><input id=\"lastname[" . $userID . "]\" onclick=\"enterField(this)\" onfocus=\"enterField(this)\" onblur=\"saveFieldValue(this)\" userID=\"" . $userID . "\" style=\"width:100%;background-color:#ffffff;border: 1px solid #ccc;margin:1px;\" name=\"lastname\" value=\"" . $this->dataAccess->getUserLastName($userID) . "\"></td></tr></table></div>";
         $html .= "<div style=\"display:block;white-space:nowrap;\"><table><tr><td style=\"padding:0px;margin:0px;background-color:#ffffff\"><b>E-Mail:</b></td><td style=\"padding:0px;margin:0px;background-color:#ffffff;width:100%\"><input id=\"email[" . $userID . "]\" onclick=\"enterField(this)\" onfocus=\"enterField(this)\" onblur=\"saveFieldValue(this)\" userID=\"" . $userID . "\" style=\"width:100%;background-color:#ffffff;border: 1px solid #ccc;margin:1px;\" name=\"email\" value=\"" . $this->dataAccess->getUserEmail($userID) . "\"></td></tr></table></div>";
         //$html .= "<div style=\"display:block;white-space:nowrap;\"><b><a href=\"javascript:;\">Kurse verwalten</a></b></div>";
         $html .= "</div></td>\n";
         $html .= "    <td style=\"vertical-align:top;\"><div id=\"password_{$userID}\">" . $this->dataAccess->getPasswordHTML($userID) . "</div><a href=\"javascript:resetPW('{$login}', '{$userID}');\">zurücksetzen</a></td>";
         //$html .= "    <td align=\"center\"><input type=\"button\" name=\"resetPasswordButton\" value=\"reset Passwort\" userID=\"" . $userID . "\" />&nbsp;<input type=\"button\" name=\"deleteButton\" value=\"l&ouml;schen\" userID=\"" . $userID . "\" /></td>\n";
         //      $html .= "    <td align=\"center\">\n";
         //      $html .= "      <select id=\"role[" . $userID . "]\" style=\"font-family:Verdana; font-size:11px; height:20px;\" name=\"userRole\" userID=\"" . $userID . "\" onchange=\"saveRoleChange(this)\" class=\"greyInputField\">\n";
         //      $html .= "        <option value=\"0\">Mitarbeiter</option>\n";
         //      $html .= "        <option value=\"2\"" . ($GLOBALS["USERMANAGEMENT_DATA_ACCESS"]->isCustomerAdmin($userID) ? " selected" : "") . ">Kunden-Admin</option>\n";
         //
         //      if ($isAdmin) {
         //        $html .= "        <option value=\"3\"" . ($GLOBALS["USERMANAGEMENT_DATA_ACCESS"]->isAdmin($userID) ? " selected" : "") . ">System-Admin</option>\n";
         //      }
         //
         //      $html .= "      </select>\n";
         //      $html .= "    </td>\n";
         $html .= "    <td style=\"vertical-align:top;\"> <br><a href=\"javascript:showCourseDialog('{$login}', '{$userID}');\">verwalten</a></td>\n";
         $html .= "    <td style=\"vertical-align:top;\" align=\"center\"><div class=\"whiteCheckbox\"><input id=\"lockState[" . $userID . "]\" style=\"margin:0px;\" type=\"checkbox\"" . ($this->dataAccess->isLocked($userID) ? " CHECKED" : " ") . " name=\"lockState\" userID=\"" . $userID . "\" onclick=\"saveLockCheckboxValue(this)\" /></div></td>\n";
         //$html .= "    <td align=\"center\"><a login=\"".$login."\" id=\"action[" . $userID . "]\" userID=\"" . $userID . "\" action=\"trashbin\" onclick=\"confirmAction(this);return false;\" href=\"\">in Papierkorb legen</a><br><a login=\"".$login."\" id=\"action[" . $userID . "]\" userID=\"" . $userID . "\" action=\"resetPW\" onclick=\"confirmAction(this);return false;\" href=\"\">Passwort zurücksetzen</a>
         $html .= "    <td style=\"vertical-align:top;width:90px\" align=\"center\"><div class=\"whiteCheckbox\"><input id=\"trashState[" . $userID . "]\" style=\"margin:0px;\" type=\"checkbox\"" . ($this->dataAccess->isTrashed($userID) ? " CHECKED" : " ") . " name=\"trashState\" userID=\"" . $userID . "\" onclick=\"saveTrashCheckboxValue(this)\" /></div><div id=\"trashdate_{$userID}\">" . ($this->dataAccess->isTrashed($userID) ? "noch " . $this->dataAccess->getTrashDate($userID) . " Tage" : " ") . "</div></td>\n";
         $html .= "  </tr>\n";
         return $html;
     } else {
         $html = "  <tr class=\"filter_user\" id=\"row[" . $userID . "]\">\n";
         $userFullName = $this->dataAccess->getUserFirstName($userID) . " " . $this->dataAccess->getUserLastName($userID);
         $userStatus = $this->dataAccess->getUserStatus($userID) != "Teilnehmer" ? " - " . $this->dataAccess->getUserStatus($userID) : "";
         $iconId = $this->dataAccess->getUserIconId($userID);
         $icon_link = $iconId == 0 ? PATH_STYLE . "images/anonymous.jpg" : PATH_URL . "cached/get_document.php?id=" . $iconId . "&type=usericon&width=30&height=40";
         $html .= "    <td style=\"vertical-align:top;width: 26px;background-color:#f7f7f7;\"><img src=\"{$icon_link}\" width=\"26\" height=\"35\" alt=\"{$userFullName}\" title=\"{$userFullName}\"/></td>\n";
         //$html .= "    <td><input id=\"firstname[" . $userID . "]\" type=\"text\" class=\"greyInputField\" name=\"firstname\" value=\"" . $this->dataAccess->getUserFirstName($userID) . "\" onclick=\"enterField(this)\" onfocus=\"enterField(this)\" onblur=\"saveFieldValue(this)\" userID=\"" . $userID . "\" />";
         //$html .= "        <input id=\"lastname[" . $userID . "]\" type=\"text\" class=\"greyInputField\" name=\"lastname\" value=\"" . $this->dataAccess->getUserLastName($userID) . "\" onclick=\"enterField(this)\" onfocus=\"enterField(this)\" onblur=\"saveFieldValue(this)\" userID=\"" . $userID . "\" /> (<small>" . $login . "</small>)";
         //$html .= "        <br><input id=\"email[" . $userID . "]\" type=\"text\" class=\"greyInputField\" style=\"width:120px;\" name=\"email\" value=\"" . $this->dataAccess->getUserEmail($userID) . "\" onclick=\"enterField(this)\" onfocus=\"enterField(this)\" onblur=\"saveFieldValue(this)\" userID=\"" . $userID . "\" /></td>\n";
         $html .= "    <td style=\"width:370px;vertical-align:top;color:#aaa;background-color:#f7f7f7;\">";
         $html .= "      <div class=\"readonly\" id=\"readonly_{$userID}\"><b><div id=\"readonly_firstname[{$userID}]\" style=\"color:#aaa;display:inline;margin-top:-16px\">" . $this->dataAccess->getUserFirstName($userID) . "</div> <div id=\"readonly_lastname[{$userID}]\" style=\"color:#aaa;display:inline;\">" . $this->dataAccess->getUserLastName($userID) . "</div></b> (" . $login . ")" . $userStatus;
         $html .= "        <br><small id=\"readonly_email[{$userID}]\" >" . ($this->dataAccess->getUserEmail($userID) == "" ? "keine E-Mail-Adresse" : $this->dataAccess->getUserEmail($userID)) . "</small>";
         $html .= "      <br><small id=\"desc_{$userID}\">" . usermanangement::get_instance()->get_user_status_html($login) . "</small>";
         //$courses = $this->dataAccess->getCoursesForUser($userID);
         //$keys = array_keys($courses);
         //$course = $courses[$keys[0]];
         //$html .= "      <br><b>Kurse:</b><br> " . $course["COURSE_NAME"];
         //$html .= "<br><small>Rolle Teilnehmer</small>";
         //$html .= "<br><a href=\"\">Kurse verwalten</a>";
         $html .= "</div>";
         $html .= "<div class=\"edit\" id=\"edit_{$userID}\" style=\"display:none\"><div style=\"display:block;margin-bottom:3px\"><b>Benutzerkennung:</b> " . $login . "</div>";
         $html .= "<div style=\"display:block;white-space:nowrap;\"><table><tr><td style=\"padding:0px;margin:0px;background-color:#ffffff\"><b>Vorname:</b></td><td style=\"padding:0px;margin:0px;background-color:#ffffff;width:100%\"><input id=\"firstname[" . $userID . "]\" onclick=\"enterField(this)\" onfocus=\"enterField(this)\" onblur=\"saveFieldValue(this)\" userID=\"" . $userID . "\" style=\"width:100%;background-color:#ffffff;border: 1px solid #ccc;margin:1px;\" name=\"firstname\" value=\"" . $this->dataAccess->getUserFirstName($userID) . "\"></td></tr></table></div>";
         $html .= "<div style=\"display:block;white-space:nowrap;\"><table><tr><td style=\"padding:0px;margin:0px;background-color:#ffffff\"><b>Nachname:</b></td><td style=\"padding:0px;margin:0px;background-color:#ffffff;width:100%\"><input id=\"lastname[" . $userID . "]\" onclick=\"enterField(this)\" onfocus=\"enterField(this)\" onblur=\"saveFieldValue(this)\" userID=\"" . $userID . "\" style=\"width:100%;background-color:#ffffff;border: 1px solid #ccc;margin:1px;\" name=\"lastname\" value=\"" . $this->dataAccess->getUserLastName($userID) . "\"></td></tr></table></div>";
         $html .= "<div style=\"display:block;white-space:nowrap;\"><table><tr><td style=\"padding:0px;margin:0px;background-color:#ffffff\"><b>E-Mail:</b></td><td style=\"padding:0px;margin:0px;background-color:#ffffff;width:100%\"><input id=\"email[" . $userID . "]\" onclick=\"enterField(this)\" onfocus=\"enterField(this)\" onblur=\"saveFieldValue(this)\" userID=\"" . $userID . "\" style=\"width:100%;background-color:#ffffff;border: 1px solid #ccc;margin:1px;\" name=\"email\" value=\"" . $this->dataAccess->getUserEmail($userID) . "\"></td></tr></table></div>";
         //$html .= "<div style=\"display:block;white-space:nowrap;\"><b><a href=\"javascript:;\">Kurse verwalten</a></b></div>";
         $html .= "</div></td>\n";
         $html .= "    <td style=\"vertical-align:top;color:#aaa;background-color:#f7f7f7;\"><div id=\"password_{$userID}\">" . $this->dataAccess->getPasswordHTML($userID) . "</div>zurücksetzen</td>";
         //$html .= "    <td align=\"center\"><input type=\"button\" name=\"resetPasswordButton\" value=\"reset Passwort\" userID=\"" . $userID . "\" />&nbsp;<input type=\"button\" name=\"deleteButton\" value=\"l&ouml;schen\" userID=\"" . $userID . "\" /></td>\n";
         //      $html .= "    <td align=\"center\">\n";
         //      $html .= "      <select id=\"role[" . $userID . "]\" style=\"font-family:Verdana; font-size:11px; height:20px;\" name=\"userRole\" userID=\"" . $userID . "\" onchange=\"saveRoleChange(this)\" class=\"greyInputField\">\n";
         //      $html .= "        <option value=\"0\">Mitarbeiter</option>\n";
         //      $html .= "        <option value=\"2\"" . ($GLOBALS["USERMANAGEMENT_DATA_ACCESS"]->isCustomerAdmin($userID) ? " selected" : "") . ">Kunden-Admin</option>\n";
         //
         //      if ($isAdmin) {
         //        $html .= "        <option value=\"3\"" . ($GLOBALS["USERMANAGEMENT_DATA_ACCESS"]->isAdmin($userID) ? " selected" : "") . ">System-Admin</option>\n";
         //      }
         //
         //      $html .= "      </select>\n";
         //      $html .= "    </td>\n";
         $html .= "    <td style=\"vertical-align:top;color:#aaa;background-color:#f7f7f7;\">Teilnehmer<br>verwalten</td>\n";
         $html .= "    <td style=\"vertical-align:top;color:#aaa;background-color:#f7f7f7;\" align=\"center\"><div class=\"whiteCheckbox\"><input id=\"lockState[" . $userID . "]\" style=\"margin:0px;\" type=\"checkbox\"" . ($this->dataAccess->isLocked($userID) ? " CHECKED" : " ") . " name=\"lockState\" userID=\"" . $userID . "\" onchange=\"saveLockCheckboxValue(this)\" disabled /></div></td>\n";
         //$html .= "    <td align=\"center\"><a login=\"".$login."\" id=\"action[" . $userID . "]\" userID=\"" . $userID . "\" action=\"trashbin\" onclick=\"confirmAction(this);return false;\" href=\"\">in Papierkorb legen</a><br><a login=\"".$login."\" id=\"action[" . $userID . "]\" userID=\"" . $userID . "\" action=\"resetPW\" onclick=\"confirmAction(this);return false;\" href=\"\">Passwort zurücksetzen</a>
         $html .= "    <td style=\"vertical-align:top;width:90px\" align=\"center\"><div class=\"whiteCheckbox\"><input id=\"trashState[" . $userID . "]\" style=\"margin:0px;\" type=\"checkbox\"" . ($this->dataAccess->isTrashed($userID) ? " CHECKED" : " ") . " name=\"trashState\" userID=\"" . $userID . "\" onchange=\"saveTrashCheckboxValue(this)\" /></div><div id=\"trashdate_{$userID}\">" . ($this->dataAccess->isTrashed($userID) ? "noch " . $this->dataAccess->getTrashDate($userID) . " Tage" : " ") . "</div></td>\n";
         $html .= "  </tr>\n";
         return $html;
     }
 }
Esempio n. 4
0
    public function get_status_HTML()
    {
        $usermanagement_html = usermanangement::get_instance()->get_user_status_html($this->user_name);
        if ($usermanagement_html != null) {
            return $usermanagement_html;
        }
        $html = "";
        if (!self::$jsCodeOnce) {
            $js = <<<END
\t\t\t<script type="text/javascript">
\t\t\tfunction nextTry(user_name, course_id, ue_id, html_id) {
\t\t\t\tapath = "../units/" + ue_id + "/directaccess";

\t\t
\t\t\t\tnew Ajax.Request(apath, {
\t\t   \t \t\tmethod: "post",
\t\t    \t\tparameters: "case=nexttry&user_name=" + user_name + "&course_id=" + course_id,
\t\t    \t\tonFailure: function(){ alert("Error while telling answer."); },
\t\t    \t\tonSuccess: function(response){ document.getElementById(html_id).innerHTML = response.responseText; }});
\t\t\t}
\t\t\t</script>
END;
            $html .= $js;
            self::$jsCodeOnce = true;
        }
        $html .= "<div id=\"unit_elearning_status_" . $this->user_name . "\">";
        $html .= $this->get_internal_status_HTML();
        $html .= "</div>";
        return $html;
    }