File: 0.00.1a/customer/index.php (View as Code)

1: 2: /* ------------------------------------------------------------- 3: This file is part of FreeDESK 4: 5: FreeDESK is (C) Copyright 2012 David Cutting 6: 7: FreeDESK is free software: you can redistribute it and/or modify 8: it under the terms of the GNU General Public License as published by 9: the Free Software Foundation, either version 3 of the License, or 10: (at your option) any later version. 11: 12: FreeDESK is distributed in the hope that it will be useful, 13: but WITHOUT ANY WARRANTY; without even the implied warranty of 14: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15: GNU General Public License for more details. 16: 17: You should have received a copy of the GNU General Public License 18: along with FreeDESK. If not, see www.gnu.org/licenses 19: 20: For more information see www.purplepixie.org/freedesk/ 21: -------------------------------------------------------------- */ 22: 23: 24: if (!isset($_REQUEST['sid'])) 25: { 26: header("Location: login.php"); 27: exit(); 28: } 29: require("../core/FreeDESK.php"); 30: $DESK = new FreeDESK("../"); 31: $DESK->Start(); 32: if (!$DESK->ContextManager->Open(ContextType::Customer, $_REQUEST['sid'])) 33: { 34: header("Location: login.php?e=expired"); 35: exit(); 36: } 37: 38: if (isset($_REQUEST['action'])) 39: { 40: if ($_REQUEST['action'] == "updaterequest") 41: { 42: $rid = $_REQUEST['requestid']; 43: $req = $DESK->RequestManager->Fetch($rid); 44: if ($rid !== false && $req->Get("customerid")==$DESK->ContextManager->Session->username) 45: { 46: $req->Update($_REQUEST['update']); 47: } 48: } 49: else if ($_REQUEST['action'] == "createrequest") 50: { 51: $req = $DESK->RequestManager->CreateById(""); 52: $rid=$req->Create($DESK->ContextManager->Session->username, 53: $_REQUEST['update'], 54: "", 55: 1 ); 56: $loc="./?mode=request&requestid=".$rid."&sid=".$_REQUEST['sid']; 57: header("Location: ".$loc); 58: exit(); 59: } 60: } 61: 62: ?> 63: 64: 65: 66: 67: FreeDESK Customer Interface 68: 69: 70:
71: 72:
FreeDESK Customer Interface
73: 77: 78: if (!isset($_REQUEST['mode'])) 79: { 80: ?> 81:
82: Welcome to the FreeDESK customer interface.

83: Please select an option from above.

84:
85: 86: } 87: else if ($_REQUEST['mode'] == "myrequests") 88: { 89: $data = array(); 90: $data[]=array("field"=>"customer", "value"=>$DESK->ContextManager->Session->username); 91: $pris = $DESK->RequestManager->GetPriorityList(); 92: $stats = $DESK->RequestManager->StatusList(); 93: $reqs = $DESK->RequestManager->SearchRequests($data); 94: echo "\n"; 95: foreach($reqs as $req) 96: { 97: echo "\n"; 98: echo "\n"; 99: echo "\n"; 100: echo "\n"; 106: echo "\n"; 112: echo "\n"; 113: } 114: echo "
ID ".$req['requestid']."".$req['openeddt'].""; 101: if (isset($pris[$req['priority']])) 102: echo $pris[$req['priority']]['priorityname']; 103: else 104: echo "-"; 105: echo ""; 107: if (isset($stats[$req['status']])) 108: echo $stats[$req['status']]; 109: else 110: echo "-"; 111: echo "
";
115: } 116: else if ($_REQUEST['mode'] == "request") 117: { 118: $req = $DESK->RequestManager->Fetch($_REQUEST['requestid']); 119: $cid = $req->Get("customerid"); 120: //echo $cid; 121: if ($req === false) 122: { 123: echo "

Request not found

";
124: } 125: else if ($cid != $DESK->ContextManager->Session->username) // not our request (naughty!) 126: { 127: echo "

Access to request denied

";
128: } 129: else 130: { 131: echo "\n"; 132: echo "\n"; 133: echo "\n"; 134: echo "\n"; 135: echo "\n"; 136: echo "\n"; 137: echo "\n"; 138: echo "
ID".$req->ID."
Opened".$req->Get("openeddt")."
\n";
139: 140: echo "

\n";
141: 142: $req->LoadUpdates(); 143: $updates=$req->GetUpdates(); 144: 145: echo "\n"; 146: foreach($updates as $update) 147: { 148: echo "\n"; 151: echo ""; 154: } 155: echo "
"; 149: echo $update['updatedt']." : ".$update['updateby']."\n"; 150: echo "
\n"; 152: echo nl2br($update['update']); 153: echo "
\n";
156: 157: echo "

";
158: 159: if ($req->Get("status")>0) 160: { 161: echo "
\n"; 162: echo "\n"; 163: echo "\n"; 164: echo "\n"; 165: echo "\n"; 166: echo "

Update Request

\n";
167: echo "
\n";
168: echo "\n"; 169: echo "\n";
170: } 171: else 172: { 173: echo "

Request is closed - contact Service Desk to reopen

\n";
174: } 175: 176: echo "

";
177: } 178: } 179: else if ($_REQUEST['mode'] == "new") 180: { 181: echo "

New Request

\n";
182: echo "Please enter as much information about the request as possible.

";
183: echo "
\n"; 184: echo "\n"; 185: echo "\n"; 186: echo "
\n";
187: echo "\n"; 188: echo "\n";
189: } 190: ?> 191:
192: 193: 194: 195: