Subversion-Projekte lars-tiefland.content-management

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
<?php
2
 
3
    //$Id: projekt_benutzer.php 3931 2011-09-16 08:17:57Z tiefland $
4
 
5
    /**
6
     * @author Lars Tiefland <tiefland@weban.de>
7
     * @copyright 2008 Webagentur Niewerth
8
     * @package Content-management
9
     * @version $Rev: 3931 $
10
     * @license propietary
11
     * @filesource
12
     *
13
     */
14
 
15
    /**
16
     *
17
     * @author Lars Tiefland <tiefland@weban.de>
18
     * @copyright 2008 Webagentur Niewerth
19
     * @package Content-management
20
     */
21
 
22
    require_once  "includes/common.php";
23
 
24
    if ( $projekt_recht )
25
    {
26
        $status_ids[]=-1;
27
        $status_values[]="--- Bitte w&auml;hlen ---";
28
        $status_ids[]="User View";
29
        $status_values[]="User View";
30
        $status_ids[]="User Write";
31
        $status_values[]="User Write";
32
        $status_ids[]="Admin";
33
        $status_values[]="Amin";
34
        $GLOBALS["ui"]->assign("status_ids", $status_ids);
35
        $GLOBALS["ui"]->assign("status_values", $status_values);
36
 
37
        $p = Projekt::getProjekte();
38
        $pl_ids[] = -1;
39
        $pl_names[] = "--- Bitte w&auml;hlen ---";
40
        $l = Login::getLogins();
41
        if ( is_array($l) )
42
        {
43
            foreach ( $l as $projekt_leiter )
44
            {
45
                $pl_ids[] = $projekt_leiter->pl_id;
46
                $pl_names[] = $projekt_leiter->pl_nname . ", " . $projekt_leiter->pl_vname;
47
            }
48
        }
49
        $p_ids[] = -1;
50
        $p_names[] = "--- Bitte w&auml;hlen ---";
51
        if ( is_array($p) )
52
        {
53
            foreach ( $p as $projekt )
54
            {
55
                $p_ids[] = $projekt->p_id;
56
                $p_names[] = $projekt->p_name;
57
            }
58
        }
59
        $GLOBALS["ui"]->assign( "projekt_ids", $p_ids );
60
        $GLOBALS["ui"]->assign( "projekte", $p_names );
61
 
62
        $GLOBALS["ui"]->assign( "login_ids", $pl_ids );
63
        $GLOBALS["ui"]->assign( "logins", $pl_names );
64
        switch ( $_POST["action"] )
65
        {
66
            case "new":
67
                $GLOBALS["ui"]->assign( "action", "save" );
68
                $GLOBALS["ui"]->display( "projekt_benutzer_new.tpl" );
69
                break;
70
            case "save":
71
            case "update":
72
                if(!isset($_POST["intern"]))
73
                {
74
                    $_POST["intern"]=0;
75
                }
76
                $pb = new Projekt_Benutzer($_POST["pb_id"],false);
77
                $res=$pb->update( $_POST["pb_id"], $_POST["l_id"], $_POST["p_id"], $_POST["status"], $_POST["intern"] );
78
                if($res)
79
                {
80
                    $res = $pb->save( $_POST["action"] );
81
                }
82
                //if($res)
83
                {
84
                    $pb = Projekt_Benutzer::getProjektBenutzer();
85
 
86
                    $GLOBALS["ui"]->assign( "projekt_benutzer", $pb );
87
                    $GLOBALS["ui"]->display( "projekt_benutzer.tpl" );
88
                }
89
                break;
90
            case "view":
91
            case "edit":
92
                $pb = new Projekt_Benutzer( $_POST["id"], false );
93
                $GLOBALS["ui"]->assign( "projekt_benutzer", $pb );
94
                $GLOBALS["ui"]->assign( "id", $pb->pb_id );
95
                $GLOBALS["ui"]->assign( "act_projekt", $pb->pb_projekte[0]->p_id );
96
                $GLOBALS["ui"]->assign( "act_login", $pb->login->pl_id );
97
                $GLOBALS["ui"]->assign("act_status", $pb->status);
98
                $GLOBALS["ui"]->assign("checked", ($pb->intern)?"checked='checked'":"");
99
                $GLOBALS["ui"]->assign( "view", ($_POST["action"] == "view") ? true : false );
100
                $GLOBALS["ui"]->assign( "action", "update" );
101
 
102
                $GLOBALS["ui"]->display( ($_POST["action"] == "edit") ? "projekt_benutzer_new.tpl" :
103
                    "projekt_benutzer_view.tpl" );
104
                break;
105
            case "delete":
106
                $pb = new Projekt_Benutzer( $_POST["id"], false );
107
                $res = $pb->save( "delete" );
108
                //if($res)
109
                {
110
                    $pb = Projekt_Benutzer::getProjektBenutzer();
111
 
112
                    $GLOBALS["ui"]->assign( "projekt_benutzer", $pb );
113
                    $GLOBALS["ui"]->display( "projekt_benutzer.tpl" );
114
                }
115
                break;
116
            default:
117
                $pb = Projekt_Benutzer::getProjektBenutzer();
118
 
119
                $GLOBALS["ui"]->assign( "projekt_benutzer", $pb );
120
                $GLOBALS["ui"]->display( "projekt_benutzer.tpl" );
121
                break;
122
        }
123
    }
124
?>