protected function build_list_element($dir, rsContainer $Li, $show_ids)
 {
     $Li = $this->subordinate_dir($dir, $Li);
     $filesdb = new rsMysql('files');
     $files = $filesdb->get('SELECT * FROM `' . $filesdb->get_dbtable() . '` WHERE `parentdir` = ' . $dir['id'] . ' ORDER BY `title` ASC');
     if (count($files) > 0) {
         $List = $Li->subordinate('ul');
     }
     foreach ($files as $file) {
         $this->subordinate_file($file, $List);
     }
     if ($dir['offspring'] > 0) {
         $this->list_branch($dir['id'], $Li->subordinate('ul'), $show_ids);
     }
 }
 protected function build_usercreation(rsContainer $Container)
 {
     if (isset($_GET['k']) && $_GET['k'] == 'usercreation') {
         if (isset($_POST['email'])) {
             $gebdatum = intval($_POST['geburtsdatum']);
             $userdb = new rsMysql('user');
             $userdb->insert(array('vorname' => $_POST['vorname'], 'nachname' => $_POST['nachname'], 'nickname' => strtolower($_POST['nickname']), 'typ' => $_POST['typ'], 'amt' => $_POST['amt'], 'email' => strtolower($_POST['email']), 'passwort' => crypt($_POST['passwort'], CRYPT_PHRASE), 'geburtsdatum' => intval($gebdatum), 'aktiv' => 1));
             $userid = $userdb->getColumn('id', '`email` = "' . mysql_real_escape_string($_POST['email']) . '"');
             if ($_POST['docs'] != '' || $_POST['mediadirs'] != '') {
                 $rightsdb = new rsMysql('rights');
                 $rightsdb->insert(array('docid' => $_POST['docs'], 'mediaid' => $_POST['mediadirs'], 'userid' => $userid));
             }
             $Container->subordinate('p', array('class' => 'success'), 'Der Benutzer "' . $_POST['vorname'] . ' ' . $_POST['nachname'] . '" (' . strtolower($_POST['nickname']) . ' / ' . strtolower($_POST['email']) . ') wurde eingerichtet.');
         }
         $Container = $Container->subordinate('form', array('method' => 'post', 'class' => 'spalten'));
         $Container->subordinate('p', '<div>Vorname:</div>')->subordinate('input', array('type' => 'text', 'name' => 'vorname'));
         $Container->subordinate('p', '<div>Nachname:</div>')->subordinate('input', array('type' => 'text', 'name' => 'nachname'));
         $Container->subordinate('p', '<div>Nickname:</div>')->subordinate('input', array('type' => 'text', 'name' => 'nickname'));
         $Container->subordinate('p', '<div>Passwort:</div>')->subordinate('input', array('type' => 'password', 'name' => 'passwort'));
         $Container->subordinate('p', '<div>eMail-Adresse:</div>')->subordinate('input', array('type' => 'text', 'name' => 'email'));
         $Container->subordinate('p', '<div>Amt:</div>')->subordinate('input', array('type' => 'text', 'name' => 'amt'));
         $Container->subordinate('p', '<div>Geburtsdatum:</div>')->subordinate('input', array('type' => 'text', 'name' => 'geburtsdatum'));
         $Typ = $Container->subordinate('p', '<div>Benutzer-Typ:</div>')->subordinate('select', array('name' => 'typ'));
         $Typ->subordinate('option', array('value' => 'schueler'), 'Sch&uuml;ler');
         $Typ->subordinate('option', array('value' => 'lehrer'), 'Lehrer');
         $Typ->subordinate('option', array('value' => 'aussenstehender'), 'Au&szlig;enstehender');
         $Container->subordinate('p', '<div>Dokument(e):</div>')->subordinate('input', array('type' => 'text', 'name' => 'docs'));
         $Container->subordinate('p', '<div>Medienverzeichniss(e):</div>')->subordinate('input', array('type' => 'text', 'name' => 'mediadirs'));
         $Container->subordinate('p', '<div></div>')->subordinate('input', array('type' => 'submit', 'value' => 'Einrichten'))->subordinate('input', array('type' => 'button', 'onClick' => 'document.location.href=\'?i=' . $this->docid . '&j=administration\'', 'value' => 'Abbrechen'));
     }
     if (isset($_GET['k']) && $_GET['k'] == 'userpwautogeneration') {
         $this->head->link_stylesheet('static/css/autouserpwupdate.css', 'print');
         $userdb = new rsMysql('user');
         $List = $Container->subordinate('table', array('id' => 'updated_users'));
         foreach ($userdb->get('SELECT * FROM `%TABLE` WHERE `passwort` = "" AND `typ` = "schueler"') as $benutzer) {
             $generated_pw = substr(md5($benutzer['vorname'] . $benutzer['nachname'] . $benutzer['klasse'] . time()), 0, 8);
             if (!isset($_GET['debug'])) {
                 // Zu Testzwecken!
                 $userdb->update(array('passwort' => crypt($generated_pw, CRYPT_PHRASE), 'nickname' => $benutzer['id'], 'aktiv' => 1), '`id`=' . $benutzer['id']);
             }
             $List->subordinate('tr')->subordinate('td', '<b>' . $benutzer['klasse'] . ')</b>')->append('td', '<b>' . $benutzer['nachname'] . '</b>,')->append('td', '<b>' . $benutzer['vorname'] . '</b>')->append('td', 'Benutzer: <b>' . $benutzer['id'] . '</b>')->append('td', 'Passwort: <b>' . $generated_pw . '</b>');
         }
     } elseif (!isset($_GET['k'])) {
         $this->build_adminpanel('Benutzer', 'user.png', array(array('label' => 'Neuen Benutzer einrichten', 'action' => 'location.href=\'?i=' . $this->docid . '&j=administration&k=usercreation\''), array('label' => 'Benutzer verwalten', 'action' => 'location.href=\'?i=' . $this->docid . '&j=administration&k=usermanagement\''), array('label' => 'Tempor&auml;re Passw&ouml;rter zuweisen', 'action' => 'location.href=\'?i=' . $this->docid . '&j=administration&k=userpwautogeneration\'')), $Container);
     }
 }
 protected function build_postlist(rsContainer $Container)
 {
     $Container->subordinate('h2', 'G&auml;stebuch-Eintr&auml;ge');
     $start = isset($_GET['start']) ? intval($_GET['start']) : 0;
     $postdb = new rsMysql('guestbook');
     $entries = $postdb->get('SELECT * FROM  `%TABLE` WHERE `valid` = "1" ORDER BY `id` DESC LIMIT ' . $start . ' , ' . ($start + $this->entries_per_page));
     $Postlist = $Container->subordinate('ul', array('class' => 'guestbook list'));
     foreach ($entries as $entry) {
         $PostLi = $Postlist->subordinate('li');
         $PostLi->subordinate('div', array('class' => 'meta'), $entry['name'])->subordinate('br')->subordinate('span', array('class' => 'date'), '(' . date('d.m.Y', $entry['timestamp']) . ')')->parent_subordinate('br')->swallow($this->is_author($entry) ? ' [<a href="?i=' . $this->docid . '&delete=' . $entry['id'] . '">Eintrag l&ouml;schen</a>]' : '');
         $PostLi->subordinate('p', array('class' => 'post text'), $entry['text']);
     }
 }