public function onDelete(OW_Event $event)
 {
     $params = $event->getParams();
     if ($params["entityType"] != self::ENTITY_TYPE) {
         return;
     }
     foreach ($params["entityIds"] as $entityId) {
         $this->service->deleteClip($entityId);
     }
 }
Beispiel #2
0
 /**
  * Deletes video clip
  *
  * @param array $params
  * @throws Redirect404Exception
  * @return array
  */
 public function ajaxDeleteClip($params)
 {
     $clipId = $params['clipId'];
     $ownerId = $this->clipService->findClipOwner($clipId);
     $isOwner = OW::getUser()->isAuthorized('video', 'add', $ownerId);
     $isModerator = OW::getUser()->isAuthorized('video');
     if (!$isOwner && !$isModerator) {
         throw new Redirect404Exception();
     }
     $delResult = $this->clipService->deleteClip($clipId);
     if ($delResult) {
         $return = array('result' => true, 'msg' => OW::getLanguage()->text('video', 'clip_deleted'), 'url' => OW_Router::getInstance()->urlForRoute('video_view_list'));
     } else {
         $return = array('result' => false, 'error' => OW::getLanguage()->text('video', 'clip_not_deleted'));
     }
     return $return;
 }