File: 0.01.1a/request.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: * Request Display 25: **/ 26: 27: 28: // Output buffer on and start FreeDESK then discard startup whitespace-spam 29: ob_start(); 30: include("core/FreeDESK.php"); 31: $DESK = new FreeDESK("./"); 32: $DESK->Start(); 33: ob_end_clean(); 34: 35: 36: if (!isset($_REQUEST['sid']) || !$DESK->ContextManager->Open(ContextType::User, $_REQUEST['sid'])) 37: { 38: $data=array("title"=>$DESK->Lang->Get("welcome")); 39: $DESK->Skin->IncludeFile("min_header.php",$data); 40: 41: echo "\n\n"; 44: 45: echo "

".$DESK->Lang->Get("login_invalid").":

\n";
46: 47: 48: $DESK->Skin->IncludeFile("min_footer.php"); 49: exit(); 50: } 51: 52: 53: // So we're authenticated let's view the main page 54: $data=array("title"=>"FreeDESK"); 55: $DESK->Skin->IncludeFile("min_header.php",$data); 56: 57: if (isset($_REQUEST['id'])) 58: { 59: $id=$_REQUEST['id']; 60: 61: $request = $DESK->RequestManager->Fetch($id); 62: 63: if ($request === false) 64: { 65: echo $DESK->Lang->Get("entity_not_found"); 66: $DESK->Skin->IncludeFile("min_footer.php"); 67: exit(); 68: } 69: 70: echo "
\n"; 71: echo "".$DESK->Lang->Get("request")." ".$id.": "; 72: 73: $q="SELECT * FROM ".$DESK->Database->Table("customer")." WHERE ".$DESK->Database->Field("customerid")."=".$DESK->Database->Safe($request->Get("customerid"))." LIMIT 0,1"; 74: $r=$DESK->Database->Query($q); 75: $cust = $DESK->Database->FetchAssoc($r); 76: $DESK->Database->Free($r); 77: 78: echo $cust['firstname']." ".$cust['lastname']; 79: 80: echo "\n"; 81: echo "
";
82: 83: $request->LoadUpdates(); 84: 85: $panes = array( 86: "log" => array( "title" => "Request History" ), 87: "details" => array( "title" => "Details" ), 88: "update" => array( "title" => "Update Request" ) ); 89: 90: $data = array( "id" => "request", "panes" => $panes ); 91: $DESK->Skin->IncludeFile("pane_start.php", $data); 92: 93: echo "
\n"; 94: 95: $updates = $request->GetUpdates(); 96: 97: foreach($updates as $update) 98: { 99: echo "
\n"; 100: echo "
\n"; 101: echo $update['updatedt']." : ".$update['updateby']."\n"; 102: echo "
\n";
103: echo "
"; 104: echo $update['update']."\n\n"; 105: echo "
\n";
106: echo "
\n";
107: } 108: 109: echo "
";
110: 111: echo "
\n"; 112: 113: echo "\n"; 114: 115: $statuses = $DESK->RequestManager->StatusList(); 116: $priorities = $DESK->RequestManager->GetPriorityList(); 117: 118: echo "\n"; 119: echo "\n"; 120: echo "\n"; 126: echo "\n"; 127: 128: echo "\n"; 129: echo "\n"; 130: echo "\n"; 136: echo "\n"; 137: 138: echo "
".$DESK->Lang->Get("status").": "; 121: if (isset($statuses[$request->Get("status")])) 122: echo $statuses[$request->Get("status")]; 123: else 124: echo $DESK->Lang->Get("unknown"); 125: echo "
".$DESK->Lang->Get("priority").": "; 131: if (isset($priorities[$request->Get("priority")])) 132: echo $priorities[$request->Get("priority")]['priorityname']; 133: else 134: echo $DESK->Lang->Get("unknown"); 135: echo "
\n";
139: 140: echo "
";
141: 142: echo "
\n"; 143: 144: echo "
"; 145: 146: echo "\n"; 147: 148: echo "\n"; 155: echo "\n"; 188: 189: echo "\n"; 205: 206: if ($DESK->Email->hasAccounts()) 207: { 208: echo "\n"; 211: echo "\n"; 212: echo "\n"; 213: } 214: 215: echo "\n"; 224: 225: echo "
\n"; 149: 150: echo "\n"; 151: echo "\n"; 152: echo "\n"; 153: 154: echo "
"; 156: 157: echo $DESK->Lang->Get("assign")." "; 158: 159: echo ""; 160: 161: echo "\n"; 186: 187: echo "
\n"; 190: 191: echo $DESK->Lang->Get("status"); 192: 193: echo "\n"; 194: 195: $statuses = $DESK->RequestManager->StatusList(); 196: 197: echo "\n"; 204: echo "
\n"; 209: echo $DESK->Lang->Get("email_customer")."\n"; 210: echo "
\n"; 216: 217: echo "Lang->Get("save")."\" onclick=\"DESK.formAPI('request_update',false,true,DESKRequest.emailUpdateCheck);\">"; 218: 219: echo "\n"; 220: 221: echo "Lang->Get("save_close")."\" onclick=\"DESK.formAPI('request_update',true,false,DESKRequest.emailUpdateCheck);\">"; 222: 223: echo "
";
226: 227: echo "\n";
228: 229: echo "
";
230: 231: echo "\n"; 234: 235: 236: 237: $DESK->Skin->IncludeFile("pane_finish.php"); 238: } 239: else // new request 240: { 241: 242: echo "
\n"; 243: 244: echo "
\n"; 245: echo "\n"; 246: 247: $table=$DESK->DataDictionary->Tables["customer"]; 248: 249: foreach($table->fields as $id => $field) 250: { 251: if ($field->searchable) 252: { 253: echo "\n"; 254: $val=""; 255: if (isset($_REQUEST[$field->field])) 256: { 257: $val=$_REQUEST[$field->field]; 258: $searchnow=true; 259: } 260: echo "\n"; 261: } 262: } 263: echo "\n"; 264: echo "\n"; 265: echo ""; 266: echo "
".$field->name."field."\" value=\"".$val."\" />
Lang->Get("search")."\" onclick=\"DESKRequest.searchCustomer();\" />
\n";
267: echo "\n";
268: 269: 270: echo "
";
271: echo "
\n"; 272: echo "
".$DESK->Lang->Get("customer")." : \n";
273: echo "Change"; 274: echo "
";
275: 276: echo "
\n";
277: 278: echo "
"; 279: 280: echo "\n"; 281: 282: echo "\n"; 287: echo "\n"; 318: 319: echo "\n"; 335: 336: echo "\n"; 350: 351: if ($DESK->Email->hasAccounts()) 352: { 353: echo "\n"; 356: echo "\n"; 357: echo "\n"; 358: } 359: 360: echo "\n"; 369: 370: echo "
\n"; 283: 284: echo "\n"; 285: 286: echo "
"; 288: 289: echo $DESK->Lang->Get("assign")." "; 290: 291: echo ""; 292: 293: echo "\n"; 316: 317: echo "
\n"; 320: 321: echo $DESK->Lang->Get("status"); 322: 323: echo "\n"; 324: 325: $statuses = $DESK->RequestManager->StatusList(); 326: 327: echo "\n"; 333: 334: echo "
\n"; 337: 338: echo $DESK->Lang->Get("priority"); 339: 340: echo ""; 341: 342: $priorities = $DESK->RequestManager->GetPriorityList(); 343: 344: echo "
\n"; 354: echo $DESK->Lang->Get("email_customer")."\n"; 355: echo "
\n"; 361: 362: echo "Lang->Get("save")."\" onclick=\"DESKRequest.Create();\" />"; 363: 364: echo "\n"; 365: 366: echo "Lang->Get("save_close")."\" onclick=\"DESKRequest.Create(true);\" />"; 367: 368: echo "
";
371: 372: echo "";
373: 374: } 375: 376: 377: 378: $DESK->Skin->IncludeFile("min_footer.php"); 379: 380: 381: ?> 382: