| Conditions | 2 |
| Paths | 2 |
| Total Lines | 21 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 37 | public function loadComments() |
||
| 38 | { |
||
| 39 | $commentOffset = (int)$this->request->getData("commentOffset"); |
||
| 40 | $postId = (int)$this->request->getData("postId"); |
||
| 41 | |||
| 42 | $result = array(); |
||
| 43 | $result["success"]=false; |
||
| 44 | |||
| 45 | $data["comments"] = $this->commentModel->getCommentsListOnPost($postId, $commentOffset); |
||
|
|
|||
| 46 | if($data["comments"]) |
||
| 47 | { |
||
| 48 | $result["success"]=true; |
||
| 49 | $twig = $this->container->getTemplate(); |
||
| 50 | $html = $twig->render('Includes/LoadComments.twig', $data); |
||
| 51 | |||
| 52 | $result["html"] = $html; |
||
| 53 | $result["commentOffset"] = $commentOffset + count($data["comments"]); |
||
| 54 | } |
||
| 55 | |||
| 56 | |||
| 57 | echo json_encode($result); |
||
| 58 | } |
||
| 60 | } |