/** * Toggle the is_internal field for a Workitem/Job * * The user must be internal in order to perform this action, therefore * we pass the session user to the method */ public function toggleInternal($job_id) { $workitem = new WorkItem($job_id); $resp = $workitem->toggleInternal($_SESSION['userid']); $this->view = null; echo json_encode(array('success' => true, 'message' => 'Internal toggled: ' . $resp)); }