/** * Return staff user, owner of this ticket. * * Result is cached until the end of script. * * @param bool $reload True to reload data from server. False to use the cached value (if present). * @return kyStaff */ public function getOwnerStaff($reload = false) { if ($this->owner_staff !== null && !$reload) { return $this->owner_staff; } if ($this->owner_staff_id === null) { return null; } $this->owner_staff = kyStaff::get($this->owner_staff_id); return $this->owner_staff; }
/** * Returns the creator of this comment. * * Result is cached until the end of script. * * @param bool $reload True to reload data from server. False to use the cached value (if present). * @return kyUser|kyStaff * @filterBy */ public function getCreator($reload = false) { switch ($this->creator_type) { case self::CREATOR_TYPE_STAFF: if ($this->creator_staff !== null && !$reload) { return $this->creator_staff; } if ($this->creator_id === null) { return null; } $this->creator_staff = kyStaff::get($this->creator_id); return $this->creator_staff; case self::CREATOR_TYPE_USER: if ($this->creator_user !== null && !$reload) { return $this->creator_user; } if ($this->creator_id === null) { return null; } $this->creator_user = kyUser::get($this->creator_id); return $this->creator_user; } return null; }
/** * Returns staff user that creates the time track. * Result is cached until the end of script. * * @param bool $reload True to reload data from server. False to use the cached value (if present). * @return kyStaff */ public function getCreatorStaff($reload = false) { if ($this->creator_staff !== null && !$reload) { return $this->creator_staff; } if ($this->creator_staff_id === null || $this->creator_staff_id <= 0) { return null; } $this->creator_staff = kyStaff::get($this->creator_staff_id); return $this->creator_staff; }
/** * Gets the staff user, the creator of this knowledgebase article. * * @param bool $reload True to reload data from server. False to use the cached value (if present). * @return kyStaff */ public function getStaff($reload = false) { if ($this->creator !== null && !$reload) { return $this->creator; } if ($this->creator_id === null) { return null; } $this->creator = kyStaff::get($this->creator_id); return $this->creator; }
foreach ($tickets as $ticket) { if ($ticket->getOwnerStaff() != null) { $email_tickets[$ticket->getOwnerStaff()->getEmail()][] = $ticket->getDisplayId() . " [" . $ticket->getDepartment()->getTitle() . "] - " . $ticket->getSubject(); } } } foreach ($email_tickets as $email => $messages) { $body = "You are receiving this message becasue the following tickets are still assigned to the General Department category. Please review them and set them to the proper department<br/><br/>"; $return = send_mail($email, "General Department Tickets", $body . implode("<br/>", $messages)); if (!$return["success"]) { echo $return["message"]; } } }); $klein->respond('GET', '/staff/[i:id]', function ($request, $response) { echo kyStaff::get($request->id); }); $klein->respond('GET', '/staff/[:username]', function ($request, $response) { echo get_staff_member_by_user($request->username); }); $klein->respond('POST', '/ticket/', function ($request, $response) { $raw_text = $request->param("text"); $params = explode(" ", $raw_text); $response->header("content-type", "application/json"); if (count($params) == 2) { $ticket = get_ticket($params[0]); $staff = get_staff_member_by_user($params[1]); assign_ticket($ticket, $staff); $response->json($data = array("response_type" => "in_channel", "attachments" => array(array("title" => $ticket->getDisplayId() . " - " . $ticket->getSubject(), "fallback" => "Assigned ticket", "title_link" => "http://prosoftxp.com/support/staff/index.php?/Tickets/Ticket/View/" . $ticket->getDisplayId(), "text" => "This ticket has been assigned to " . $params[1])))); $response->send(); } else {