/** * Adds a comment to a thread * * @return array of comments [ cid, timestamp, uid ] */ public function execute() { $this->checkDefaultApp($this->aid); $ret = Api_Bo_Comments::createComment($this->xid, $this->aid, $this->uid, $this->text); $response = array(); $response['result'] = $ret !== false ? '1' : '0'; return $response; }
/** * Deletes a comment from a thread. * * @return 0/1 in ['result'] */ public function execute() { $this->checkDefaultApp($this->aid); $ret = Api_Bo_Comments::deleteComment($this->cid, $this->xid, $this->aid); $response = array(); $response['result'] = $ret > 0 ? '1' : '0'; return $response; }
/** * Get the count of comments for a given thread. * * @return count of comments for a thread */ public function execute() { $this->checkDefaultApp($this->aid); $response = array(); $count = Api_Bo_Comments::getCommentCount($this->xid, $this->aid); $response['result'] = "{$count}"; return $response; }
/** * Reads comments from a thread * * @return array of comments [ cid, timestamp, uid ] */ public function execute() { $this->checkDefaultApp($this->aid); $response = array(); $result = Api_Bo_Comments::getComments($this->xid, $this->aid, $this->first, $this->count); if (empty($result)) { $response['result'] = ''; } else { $response['comments'] = $result; } return $response; }