/** * Deletes vwvc clip * * @param array $params * @return array */ public function ajaxDeleteClip($params) { $clipId = $params['clipId']; $ownerId = $this->clipService->findClipOwner($clipId); $isOwner = OW::getUser()->isAuthorized('vwvc', 'add', $ownerId); $isModerator = OW::getUser()->isAuthorized('vwvc'); if (!$isOwner && !$isModerator) { throw new Redirect404Exception(); return; } $delResult = $this->clipService->deleteClip($clipId); if ($delResult) { $return = array('result' => true, 'msg' => OW::getLanguage()->text('vwvc', 'clip_deleted'), 'url' => OW_Router::getInstance()->urlForRoute('vwvc_vwview_list')); } else { $return = array('result' => false, 'error' => OW::getLanguage()->text('vwvc', 'clip_not_deleted')); } return $return; }