public function show() { if ($this->permission) { $system = System::getInstance(); $message = ""; switch ($this->operation) { case 'delete_workunit': $workunit = new Workunit(); if ($workunit->getPermission()) { $result = $workunit->deleteWorkUnit($this->id_workunit); unset($workunit); if ($result) { $this->id_workunit = -1; $message = "<h2 class='suc'>" . __('Successfully deleted') . "</h2>"; } else { $message = "<h2 class='error'>" . __('An error ocurred while deleting the workunit') . "</h2>"; } $this->showWorkUnits($message); } else { $this->showNoPermission(); } break; default: $this->showWorkUnits(); } } else { $this->showNoPermission(); } }
$user->logout(); $user->showLogin(); break; default: $page = $system->getRequest('page'); switch ($page) { case 'home': $home = new Home(); $home->show(); break; case 'workunits': $workunits = new Workunits(); $workunits->show(); break; case 'workunit': $workunit = new Workunit(); $workunit->show(); break; case 'workorders': $workorders = new Workorders(); $workorders->show(); break; case 'workorder': $workorder = new Workorder(); $workorder->show(); break; case 'incidents': $incidents = new Incidents(); $incidents->show(); break; case 'incident':
public function show() { if ($this->permission) { $system = System::getInstance(); $message = ""; switch ($this->operation) { case 'insert_incident': $result = $this->insertIncident($this->title, $this->description, $this->group_id, $this->id_creator, $this->status, $this->priority, $this->resolution, $this->id_task, $this->sla_disabled, $this->id_incident_type, $this->email_copy, $this->email_notify, $this->id_parent, $this->epilog); if ($result) { $this->id_incident = $result; // Insert file if exist $status = $this->getFileUploadStatus('file'); $message = $this->translateFileUploadStatus($message); if ($message === true) { $this->insertIncidentFile('file'); } $message = "<h2 class='suc'>" . __('Successfully created') . "</h2>"; } else { $message = "<h2 class='error'>" . __('An error ocurred while creating the ticket') . "</h2>"; } $incidents = new Incidents(); $incidents->show($message); break; case 'insert_workunit': if ($this->id_incident > 0) { $date_workunit = (string) $system->getRequest('date_workunit', date("Y-m-d")); $duration_workunit = (double) $system->getRequest('duration_workunit', $system->getConfig('iwu_defaultime')); $description_workunit = (string) $system->getRequest('description_workunit', ""); $workunit = new Workunit(); $result = $workunit->insertWorkUnit($system->getConfig('id_user'), $date_workunit, $duration_workunit, $description_workunit, false, $this->id_incident); unset($workunit); if ($result) { $message = "<h2 class='suc'>" . __('Successfully created') . "</h2>"; } else { $message = "<h2 class='error'>" . __('An error ocurred while adding the workunit') . "</h2>"; } $this->showIncident($this->tab, $message); } break; case 'insert_file': if ($this->id_incident > 0) { $status = $this->getFileUploadStatus('file'); $message = $this->translateFileUploadStatus($message); if ($message === true) { $result = $this->insertIncidentFile('file'); if ($result) { $message = "<h2 class='suc'>" . __('File added') . "</h2>"; } else { $message = "<h2 class='error'>" . __('An error ocurred while uploading the file') . "</h2>"; } } $this->showIncident($this->tab, $message); } break; case 'update_incident': $this->showIncidentSimpleForm(); break; case 'quick_update_incident': if ($this->id_incident > 0) { $quick_update_type = $system->getRequest('quick_update_type', ""); $quick_update_value = $system->getRequest('quick_update_value', ""); if ($quick_update_type && $quick_update_value) { $result = $this->quickIncidentUpdate($this->id_incident, $quick_update_type, $quick_update_value); if ($result) { switch ($quick_update_type) { case 'priority': $this->priority = $quick_update_value; break; case 'owner': $this->id_owner = $quick_update_value; break; case 'resolution': $this->priority = $quick_update_value; break; case 'status': $this->status = $quick_update_value; break; } $message = "<h2 class='suc'>" . __('Successfully updated') . "</h2>"; } else { $message = "<h2 class='error'>" . __('An error ocurred while updating the incident') . "</h2>"; } } $this->showIncident($this->tab, $message); } break; case 'update_workunit': if ($this->id_incident > 0) { $id_workunit = (int) $system->getRequest('id_workunit', -1); $date_workunit = (string) $system->getRequest('date_workunit', date("Y-m-d")); $duration_workunit = (double) $system->getRequest('duration_workunit', $system->getConfig('iwu_defaultime')); $description_workunit = (string) $system->getRequest('description_workunit', ""); $workunit = new Workunit(); $result = $workunit->updateWorkUnit($id_workunit, $system->getConfig('id_user'), $date_workunit, $duration_workunit, $description_workunit, false, $this->id_incident); unset($workunit); if ($result) { $message = "<h2 class='suc'>" . __('Successfully updated') . "</h2>"; } else { $message = "<h2 class='error'>" . __('An error ocurred while updating the workunit') . "</h2>"; } $this->showIncident($this->tab, $message); } break; case 'delete_incident': $result = $this->deleteIncident($this->id_incident); if ($result) { $this->id_incident = -1; $message = "<h2 class='suc'>" . __('Successfully deleted') . "</h2>"; } else { $message = "<h2 class='error'>" . __('An error ocurred while deleting the ticket') . "</h2>"; } $this->showIncidentSimpleForm($message); break; case 'delete_file': $this->showIncident($this->tab, $message); break; default: if ($this->id_incident > 0) { $this->showIncident($this->tab); } else { $this->showIncidentSimpleForm(); } } } else { $this->showNoPermission(); } }