Exemplo n.º 1
0
 public function post_guestreopenticket()
 {
     //Get our data
     $ticketid = Input::get('ticketid');
     $hash = Input::get('hash');
     //Fetch our ticket
     $ticket = Ticket::where('id', '=', $ticketid)->where('hash', '=', $hash)->first();
     if (!empty($ticket)) {
         //Reopen our ticket
         $ticket->status = 1;
         //Update our ticket
         $ticket->save();
         //Hell, let's just pull new replies in case something was updated
         $status = '<span style="margin-right: 10px;" class="badge badge-success">OPEN</span>';
         $response = '<div id="ticketreceived" data-tickethash="' . $ticket->hash . '" data-ticketid="' . $ticket->id . '" class="well"><div style="margin-top: 20px; margin-bottom: 40px;" class="row-fluid"><div style="border-bottom: 1px solid #e5e5e5;" class="span10 offset2"><h4>' . $status . ' ' . $ticket->subject . '</h4></div><div class="span2"><strong>' . $ticket->name . '</strong><br /><small>' . $ticket->created_at . '</small></div><div style="padding-top: 3px; padding-left: 3px; margin-left: 0px; border-left: 1px solid #e5e5e5;" class="span8">' . $ticket->description . '</div></div></div>';
         //Get our replies
         $replies = $ticket->replies()->get();
         foreach ($replies as $reply) {
             //Figure out if this is a staff reply
             if ($reply->staff == 0) {
                 $author = '<strong>' . $ticket->name . '</strong>';
             } else {
                 //Alright. It is a staff reply. Let's fetch the name of the auditor
                 $author = '<span class="label label-important"><i class="fa fa-bookmark fa-fw"></i>' . ConsoleUser::getName($reply->author) . '</span>';
             }
             $response .= '<div style="margin-top: 15px; margin-bottom: 15px;"><hr style="border-bottom: 0;" /></div><div class="well"><div style="margin-top: 20px; margin-bottom: 40px;" class="row-fluid"><div class="span2">' . $author . '<br /><small>' . $reply->created_at . '</small></div><div style="padding-top: 3px; padding-left: 3px; margin-left: 0px; border-left: 1px solid #e5e5e5;" class="span8">' . $reply->content . '</div></div></div>';
         }
         echo $response;
     }
 }
Exemplo n.º 2
0
 public function get_assignments()
 {
     //Just declare this here since laravel get's mad if it is empty
     $othersassignments = '';
     //Pull our assignments for the current user
     $assignments = Assignment::where('auditors', 'like', '%' . Auth::consoleuser()->get()->cid . ',%')->get();
     //Create an array of each VA that needs to be auditted
     $vaslist = array();
     foreach ($assignments as $assignment) {
         $vas = $assignment->vas;
         $vas = explode(',', $vas);
         //Remove the last empty value
         $vascount = count($vas) - 1;
         unset($vas[$vascount]);
         //Get our current VAs in progress into an array
         $vasInProgress = explode(',', $assignment->vas_in_progress);
         $vasInProgressCount = count($vas) - 1;
         unset($vasInProgress[$vasInProgressCount]);
         foreach ($vas as $va) {
             $result = User::findOrFail($va);
             $status = 0;
             if (in_array($va, $vasInProgress)) {
                 $status = 1;
             }
             $vaslist[] = array('cid' => $va, 'vaname' => $result->vaname, 'assignmentid' => $assignment->id, 'status' => $status);
         }
     }
     //Is our user an administrator?
     if (Auth::consoleuser()->get()->access > 0) {
         //Yes, ok let's query for all of the assignments other than their own
         $othersassignments = Assignment::where('auditors', 'not like', '%' . Auth::consoleuser()->get()->cid . ',%')->get();
     }
     //Pull a list of all of the categories
     $categories = Category::all();
     //Create an array of categories with the key as the cat id and the value the name
     $catnames = array();
     foreach ($categories as $category) {
         $catnames[$category->id] = $category->name;
     }
     //Pull all assignments
     $allassignments = Assignment::all();
     $categoriesPerAssignment = array();
     $auditorsPerAssignment = array();
     foreach ($allassignments as $allassignment) {
         //Create a list of other auditors per assignment
         $auditors = explode(',', $allassignment->auditors);
         //Get rid of the last empty value
         $auditorscount = count($auditors) - 1;
         unset($auditors[$auditorscount]);
         $auditorsPerAssignment[$allassignment->id] = '';
         foreach ($auditors as $auditor) {
             $auditorsPerAssignment[$allassignment->id] = $auditorsPerAssignment[$allassignment->id] . '<span class="label label-danger"><i class="fa fa-bookmark fa-fw"></i> ' . ConsoleUser::getName($auditor) . '</span> ';
         }
         $categoriesPerAssignment[$allassignment->id] = '';
         $cats = $allassignment->categories;
         $cats = explode(',', $cats);
         //Remove the last empty value
         $catscount = count($cats) - 1;
         unset($cats[$catscount]);
         foreach ($cats as $cat) {
             $categoriesPerAssignment[$allassignment->id] = $categoriesPerAssignment[$allassignment->id] . '<span class="label label-default">' . $catnames[$cat] . '</span> ';
         }
     }
     return View::make('console.assignments')->with(array('assignments' => $assignments, 'othersAssignments' => $othersassignments, 'categoriesPerAssignment' => $categoriesPerAssignment, 'auditorsPerAssignment' => $auditorsPerAssignment, 'vasList' => $vaslist));
 }