/** * Get Info * * @param int $uid * @param string $tablenames * @param string $as output variable * @return array info */ public function render($uid, $tablenames, $as = NULL) { $info = []; $filter['uid_foreign'] = $uid; $filter['tablenames'] = $tablenames; $filter['confirmed'] = true; // get items $items = $this->commentRepository->findByFilter($filter, NULL, NULL, NULL, "all"); $info['count'] = $items->count(); if (TRUE === empty($as)) { return $info; } else { $this->templateVariableContainer->add($as, $info); } }
/** * action delete * * @param int $uid uid * @param string $hash hash * @param bool $ajax is ajax request? * @param string $settings settings * @return void */ public function deleteAction($uid = 0, $hash = "", $ajax = FALSE, $settings = NULL) { if ($uid > 0) { $item = $this->commentRepository->findByUid($uid); if (is_object($item)) { if ($hash == $item->getHash()) { $redirectUri = $item->getUrlForeign() . "#commentform"; // remove item from database $this->commentRepository->remove($item); $this->persistenceManager->persistAll(); // add message $messages[] = ["icon" => '<span class="glyphicon glyphicon-ok icon-alert" aria-hidden="true"></span>', "title" => LocalizationUtility::translate(self::LLPATH . 'pi1.action_delete', $this->extensionName), "text" => LocalizationUtility::translate(self::LLPATH . 'pi1.action_delete.success', $this->extensionName), "type" => FlashMessage::OK]; // set flash messages $this->helperService->setFlashMessages($this, $messages); // end request if (!$ajax) { // redirect to target url $this->redirectToUri($redirectUri); } } } else { $this->view = NULL; } } else { $this->view = NULL; } }