mirror of
https://github.com/opensupports/opensupports.git
synced 2025-07-26 23:34:56 +02:00
[Ivan Diaz] - Ticket comment WIP [skip ci]
This commit is contained in:
parent
e039162025
commit
ea65ea35d1
@ -1,9 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
include 'ticket/create.php';
|
include 'ticket/create.php';
|
||||||
|
include 'ticket/comment.php';
|
||||||
|
|
||||||
$ticketControllers = new ControllerGroup();
|
$ticketControllers = new ControllerGroup();
|
||||||
$ticketControllers->setGroupPath('/ticket');
|
$ticketControllers->setGroupPath('/ticket');
|
||||||
|
|
||||||
$ticketControllers->addController(new CreateController);
|
$ticketControllers->addController(new CreateController);
|
||||||
|
$ticketControllers->addController(new CommentController);
|
||||||
|
|
||||||
$ticketControllers->finalize();
|
$ticketControllers->finalize();
|
45
server/controllers/ticket/comment.php
Normal file
45
server/controllers/ticket/comment.php
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
<?php
|
||||||
|
use RedBeanPHP\Facade as RedBean;
|
||||||
|
|
||||||
|
class CommentController extends Controller {
|
||||||
|
const PATH = '/comment';
|
||||||
|
|
||||||
|
private $ticketId;
|
||||||
|
private $content;
|
||||||
|
|
||||||
|
public function handler() {
|
||||||
|
/*
|
||||||
|
//$this->storeComment();
|
||||||
|
$ticket = RedBean::load('tickets', Controller::request('ticketId'));
|
||||||
|
$comment = RedBean::dispense('comments');
|
||||||
|
$comment->content = Controller::request('content');
|
||||||
|
|
||||||
|
$ticket->ownCommentsList[] = $comment;
|
||||||
|
|
||||||
|
RedBean::store($ticket);
|
||||||
|
$ticket = RedBean::load('tickets', Controller::request('ticketId'));
|
||||||
|
|
||||||
|
$string = "";
|
||||||
|
$string += count($ticket->ownCommentsList);
|
||||||
|
|
||||||
|
foreach( $ticket->ownCommentsList as $comment2 ) {
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
|
||||||
|
private function storeComment() {
|
||||||
|
$this->ticketId = Controller::request('ticketId');
|
||||||
|
$this->content = Controller::request('content');
|
||||||
|
$ticket = Ticket::getTicket($this->ticketId);
|
||||||
|
|
||||||
|
$comment = new Comment();
|
||||||
|
$comment->setProperties(array(
|
||||||
|
'content' => $this->content
|
||||||
|
//'ticket' => $ticket->getBeanInstance()
|
||||||
|
));
|
||||||
|
|
||||||
|
$ticket->getBeanInstance()->ownCommentsList = [$comment->getBeanInstance()];
|
||||||
|
$ticket->store();
|
||||||
|
$ticket = Ticket::getTicket($this->ticketId);
|
||||||
|
Response::respondError(count($ticket->ownCommentsList));
|
||||||
|
}
|
||||||
|
}
|
@ -1,9 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
|
use RedBeanPHP\Facade as RedBean;
|
||||||
|
|
||||||
class CreateController extends Controller {
|
class CreateController extends Controller {
|
||||||
const PATH = '/create';
|
const PATH = '/create';
|
||||||
|
|
||||||
private $title ;
|
private $title;
|
||||||
private $content;
|
private $content;
|
||||||
private $departmentId;
|
private $departmentId;
|
||||||
private $language;
|
private $language;
|
||||||
|
@ -20,6 +20,10 @@ class Ticket extends DataStore {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function getTicket($value, $property = 'id') {
|
||||||
|
return parent::getDataStore($value, $property);
|
||||||
|
}
|
||||||
|
|
||||||
protected function getDefaultProps() {
|
protected function getDefaultProps() {
|
||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user