Ejemplo n.º 1
0
<?php

$t = new Title("Benutzer verwalten");
$t->setAlign("left");
$t->show();
$spc = new Spacer(10);
$spc->show();
if ($_SESSION['config']->CURRENTUSER->STATUS == "admin" && !$_SESSION['config']->CURRENTUSER->STATUS == "user") {
    $e = new Error("Kein Zugriff", " Sie haben keine Berechtigung für diesen Bereich!");
}
$userTable = new DbTable($_SESSION['config']->DBCONNECT, "user", array("Vorname", "Nachname", "User", "Email", "Status"), "Vorname, Nachname, Benutzername, Email, Status", "", " Vorname ASC ", " User != 'Developer' AND  User != 'admin' ");
$userTable->setHeaderEnabled(true);
$userTable->setDeleteInUpdate(true);
$userTable->setToCheck("Vorname, Nachname, User, Email, Status");
// Neuer Eintrag
if (isset($_REQUEST['InsertIntoDBuser']) && $_REQUEST['InsertIntoDBuser'] == "Speichern") {
    if ($userTable->doInsert()) {
        $userTable->refresh();
    }
    $spc->show();
} else {
    if (isset($_REQUEST[$userTable->getNewEntryButtonName()])) {
        $userTable->setBorder(0);
        $insMsk = $userTable->getInsertMask();
        $hdnFld = $insMsk->getAttribute(1);
        if ($hdnFld instanceof Hiddenfield) {
            $insMsk->setAttribute(1, new Hiddenfield($userTable->getNewEntryButtonName(), "-"));
        }
        $insMsk->show();
        $spc->show();
    }
       BENUTZERSTATUS ANZEIGEN
       ------------------------------------ */
    $USR = $_SESSION['config']->CURRENTUSER;
    $USERSTATUS = new UserStatus($USR, -1, -1);
    $tbl = new Table(array(""));
    $tbl->setAlign("center");
    $r = $tbl->createRow();
    $r->setAttribute(0, $USERSTATUS);
    $tbl->addRow($r);
    $tbl->show();
    /* --------------------------------- */
} else {
    $alarmgeberDBTbl = new DbTable($_SESSION['config']->DBCONNECT, "homecontrol_alarm_geber", array("name", "ip"), "", "", "name", "");
    $alarmgeberDBTbl->setDeleteInUpdate(true);
    $alarmgeberDBTbl->setHeaderEnabled(true);
    $alarmgeberDBTbl->setToCheck("name", "ip");
    $alarmgeberDBTbl->setWidth("100%");
    // --------------------------------------------------
    //  Neuer Eintrag
    // --------------------------------------------------
    if (isset($_REQUEST['dbTableNew' . $alarmgeberDBTbl->TABLENAME])) {
        $alarmgeberDBTbl->showInsertMask();
    }
    if (isset($_REQUEST['InsertIntoDB' . $alarmgeberDBTbl->TABLENAME]) && $_REQUEST['InsertIntoDB' . $alarmgeberDBTbl->TABLENAME] == "Speichern") {
        $alarmgeberDBTbl->doInsert();
    }
    // --------------------------------------------------
    //  Bearbeiten-Maske
    // --------------------------------------------------
    if (isset($_REQUEST["DbTableUpdate" . $alarmgeberDBTbl->TABLENAME])) {
        $alarmgeberDBTbl->doUpdate();
    $tbl->show();
    /* --------------------------------- */
} else {
    // -----------------------------------
    //   Image Upload
    // -----------------------------------
    $t = new Title("Etagen");
    $t->setAlign("left");
    $t->show();
    $spc = new Spacer(20);
    $ln = new Line();
    $scDbTable = new DbTable($_SESSION['config']->DBCONNECT, 'homecontrol_etagen', array("name", "pic"), "Name, Raumplan", "pic = 'pics/default_etage.jpg'", "name", "");
    $scDbTable->setDeleteInUpdate(true);
    $scDbTable->setHeaderEnabled(true);
    $scDbTable->setNoInsertCols(array("pic"));
    $scDbTable->setToCheck("name");
    $scDbTable->setWidth("100%");
    $spc->show();
    $scDbTable->setBorder(0);
    // --------------------------------------------------
    //  Neuer Eintrag
    // --------------------------------------------------
    if (isset($_REQUEST['dbTableNewhomecontrol_etagen'])) {
        $scDbTable->showInsertMask();
    }
    if (isset($_REQUEST['InsertIntoDBhomecontrol_etagen']) && $_REQUEST['InsertIntoDBhomecontrol_etagen'] == "Speichern") {
        $scDbTable->doInsert();
        //       $getMaxSql = "SELECT max(id) maxId FROM homecontrol_etagen";
        //       $rslt = $_SESSION['config']->DBCONNECT->executeQuery($getMaxSql);
        //       $r = mysql_fetch_array($rslt);
        //       exec("cp /var/www/pics/default_etage.jpg /var/www/pics/raumplan/".$r['maxId'].".jpg");