' . TB_USER . '.vorname,
					' . TB_USER . '.flag_active
				from
					' . TB_USER . '
				order by ' . TB_USER . '.name
			';
$raw = $db->query($sql);
if ($db->num_rows($raw)) {
    $first_user = 0;
    $i = 0;
    while ($current = $db->fetch_array($raw)) {
        if (!$first_user) {
            $first_user = $current[id];
        }
        $fields[0][selections][$i][value] = $current[id];
        $fields[0][selections][$i][title] = '[' . $current[flag_active] . '] ' . $current[name] . ', ' . $current[vorname];
        $i++;
    }
}
$presets = array('auswahl' => $first_user);
$fields[] = array('type' => 'hidden', 'important' => 0, 'selections' => array(0 => array('value' => 'administration_user_view', 'name' => 'action')));
$fields[] = array('type' => 'buttons', 'important' => 0, 'selections' => array(0 => array('value' => 'Zum User >>', 'type' => 'submit', 'name' => 'submit')));
$form->load_presets($presets);
$form->load_form($fields);
$form->precheck_form();
$message = $form->build_form();
$form->form_shutdown();
$menu = array();
$menu[0][text] = 'Neuen User anlegen';
$menu[0][link] = $PHP_SELF . '?action=administration_user_create';
echo $page->dialog_box('Benutzerverwaltung', $message, $menu, 0, '50%');
Ejemplo n.º 2
0
    function edit_link_interface($id)
    {
        global $log, $db, $session, $page;
        $log->add_to_log('Link::edit_link_interface()', 'edit_link_interface() called...', 'debug');
        require_once 'inc/classes/class_form2.inc.php';
        $form = new Form2($GLOBALS[PHP_SELF], $method, 'edit_link_interface');
        $fields = $this->link_form('Los>>', 'intern_link_edit', $id);
        $form->load_form($fields);
        $sql = '
				select
					' . TB_LINKS . '.id,
					ref_object_id,
					uri,
					ref_category_id,
					description,
					date_format(' . TB_OBJECT . '.date_create, "%d.%m.%Y %H:%i") as date_create_readable,
					' . TB_OBJECT . '.flag_public
				from
					' . TB_LINKS . ',
					' . TB_OBJECT . '
				where
					' . TB_OBJECT . '.id = ' . $id . '
					and
					' . TB_OBJECT . '.id = ' . TB_LINKS . '.ref_object_id
				order by
					date_create desc
				limit 10
			';
        $raw = $db->query($sql);
        if ($db->num_rows($raw)) {
            $current = $db->fetch_array($raw);
            $presets = array('uri' => $current[uri], 'description' => $current[description], 'flag_public' => $current[flag_public], 'ref_category_id' => $current[ref_category_id]);
            $form->load_presets($presets);
            $form->precheck_form();
            if (!$GLOBALS[submit]) {
                $form->set_precheck_error();
            }
            if ($form->is_form_error()) {
                $message .= $form->build_form();
                $width = '50%';
                $title = 'Link editieren';
            } else {
                $message = 'Der Link wird abgespeichert...';
                $link_data = array(0 => array('name' => 'flag_public', 'value' => $form->return_submitted_field('flag_public')));
                $this->update_tb_object($link_data);
                $link_data = array(0 => array('name' => 'uri', 'value' => trim($form->return_submitted_field('uri'))), 1 => array('name' => 'description', 'value' => htmlentities(trim($form->return_submitted_field('description')))), 2 => array('name' => 'ref_category_id', 'value' => $form->return_submitted_field('ref_category_id')));
                $title = 'Link gespeichert!';
                if ($db->update_row($current[id], TB_LINKS, $link_data)) {
                    $message .= '<b class=ok>OK</b>';
                } else {
                    $message .= '<b class=warning><br>Warnung</b>! Es wurden keine Datensätze geändert! Evtl. hast du gar nix geändert!...(siehe logfiles)';
                }
                $menu = array();
                $menu[0][text] = '&lt;&lt;Zur Link übersicht';
                $menu[0][link] = $GLOBALS[PHP_SELF] . '?action=intern_link';
                $form->form_shutdown();
            }
            $width = '50%';
        } else {
            $title = 'Fehler';
            $message = 'Whoups! Der ausgewählte Link wurde nicht gefunden... *urgs*';
            $width = '50%';
            $menu = array();
            $menu[0][text] = '&lt;&lt;Zur Link übersicht';
            $menu[0][link] = $GLOBALS[PHP_SELF] . '?action=intern_link';
        }
        return $page->dialog_box($title, $message, 0, $menu, $width);
    }
 function create_userlist_interface($id, $action, $type, $preset = 0)
 {
     global $log, $db, $page;
     require_once 'inc/classes/class_form2.inc.php';
     $form = new Form2($GLOBALS[PHP_SELF], 'get', 'create_userlist', $action, $id);
     $fields = $this->create_userlist_dialog('abspeichern&gt;&gt;', $action);
     $form->load_form($fields);
     $form->precheck_form();
     if (!$GLOBALS[submit]) {
         $form->set_precheck_error();
     }
     if ($form->is_form_error()) {
         $message = $form->build_form();
         $width = '50%';
         $title = 'Liste anlegen';
     } else {
         $width = '50%';
         if ($this->create_userlist($id)) {
             $title = 'Liste angelegt';
             $message = '<p class=ok>Liste wurde angelegt!</p>';
             $menu = array();
             switch ($type) {
                 case 'report':
                     $menu[0][text] = 'Zum Bericht';
                     $menu[0][link] = $GLOBALS[PHP_SELF] . '?action=report_read&id=' . $id;
                     break;
                 case 'date':
                     $menu[0][text] = 'Zum Termin';
                     $menu[0][link] = $GLOBALS[PHP_SELF] . '?action=date_view&id=' . $id;
                     break;
                 default:
             }
             $form->form_shutdown();
         } else {
             $title = 'Fehler';
             $message = '<p class=error>Fehler beim anlegen der Userliste! (logfiles?)</p>';
         }
     }
     return $page->dialog_box($title, $message, 0, $menu, $width);
 }
Ejemplo n.º 4
0
 function edit_user_interface($id, $action, $restricted = 1, $finish_menu = 0)
 {
     global $log, $db, $page, $session;
     $log->add_to_log('User::edit_user_interface()', 'edit_user_interface() called!', 'debug');
     /*******************************************************************************
      * Zuerstmal die Userdaten holen:
      *******************************************************************************/
     if ($this->load_user($id)) {
         $log->add_to_log('User::edit_user_interface()', 'Ok, userdata loaded successfuly, commencing!', 'debug');
         $form = new Form2($GLOBALS[PHP_SELF], 'get', 'user_create');
         $fields = $this->user_form('abspeichern', $action, $id, 1, $restricted);
         $presets = array('geburtstag' => $this->user_info('geburtstag'), 'email' => $this->user_info('email'), 'name' => $this->user_info('name'), 'vorname' => $this->user_info('vorname'), 'funktion' => array(0 => $this->user_info('rang')), 'einheit' => array(0 => $this->user_info('ref_einheit_id')));
         $form->load_presets($presets);
         $form->load_form($fields);
         $form->precheck_form();
         $password = 0;
         if ($form->return_submitted_field('old_password') or !$restricted and $form->return_submitted_field('new_password')) {
             // $log->add_to_log('User::edit_user_interface()', 'Requesting password-change!', 'debug');
             /*******************************************************************************
              * Hossa, da will jemand sein Passwort ändern:
              ******************************************************************************/
             if ($form->return_submitted_field('new_password') != $this->user_info('password')) {
                 if ($form->return_submitted_field('old_password') == $this->user_info('password') or !$restricted) {
                     if ($form->return_submitted_field('new_password') == $form->return_submitted_field('new_password_confirm')) {
                         $password = $form->return_submitted_field('new_password');
                         $message = '<b class=ok>Passwort wurde geändert!</b>';
                     } else {
                         $form->set_precheck_error();
                         $message = '<b class=error>Die beiden neuen Passwörter stimmen nicht überein!</b>';
                     }
                 } else {
                     $form->set_precheck_error();
                     $message = '<b class=error>Das eingegebene Passwort ist nicht richtig!</b>';
                 }
             }
         }
         if (!$GLOBALS[submit]) {
             $form->set_precheck_error();
         }
         if ($form->is_form_error()) {
             $title = 'User editieren';
             $message .= $form->build_form();
         } else {
             $tmp = explode('.', $form->return_submitted_field('geburtstag'));
             $geburtstag = $tmp[2] . '-' . $tmp[1] . '-' . $tmp[0];
             $user_data = array();
             if (!$restricted) {
                 $user_data[] = array('name' => 'name', 'value' => trim($form->return_submitted_field('name')));
                 $user_data[] = array('name' => 'vorname', 'value' => trim($form->return_submitted_field('vorname')));
                 $user_data[] = array('name' => 'rang', 'value' => trim($form->return_submitted_field('funktion')));
                 $user_data[] = array('name' => 'ref_einheit_id', 'value' => trim($form->return_submitted_field('einheit')));
             }
             $user_data[] = array('name' => 'email', 'value' => trim($form->return_submitted_field('email')));
             $user_data[] = array('name' => 'geburtstag', 'value' => $geburtstag);
             if ($password) {
                 $user_data[] = array('name' => 'password', 'value' => $password);
             }
             if ($this->update_user($id, $user_data) > 0) {
                 $title = 'User geändert!';
                 $message = 'Die Änderungen wurden erfolgreich abgespeichert!';
                 if ($finish_menu) {
                     $bottom_menu = $finish_menu;
                 } else {
                     $bottom_menu = array();
                     $bottom_menu[0][text] = 'Zum User';
                     $bottom_menu[0][link] = $GLOBALS[PHP_SELF] . '?action=administration_user_view&auswahl=' . $id;
                 }
             } else {
                 $log->add_to_log('User::edit_user_interface()', 'Error while saving user (ID: ' . $id . ')! User::update_user() returned < 0!! Aborting!', 'error');
                 $title = 'Fehler';
                 $message = 'Urgs! Beim abspeichern der Änderungen ist etwas schiefgelaufen!! (logfiles?)';
                 $bottom_menu = array();
                 $bottom_menu[0][text] = '&lt;&lt;User nochmal editieren';
                 $bottom_menu[0][link] = $GLOBALS[PHP_SELF] . '?action=' . $action . '&id=' . $id;
             }
             $form->form_shutdown();
         }
         return $page->dialog_box($title, $message, $menu, $bottom_menu, '100%');
     } else {
         $log->add_to_log('User::edit_user_interface()', 'Error while loading user! User::load_user() returned 0!! Aborting!', 'error');
         return $page->dialog_box('Fehler', 'Whoups!! Konnte den gewählten User (ID: <b>' . $id . '</b>) nicht finden... breche ab!', 0, 0, '100%');
     }
 }