Exemplo n.º 1
0
 /**
  * Class constructor
  *
  * @param int $exclude 
  * @param int $itemsNum
  */
 public function __construct(array $params)
 {
     parent::__construct();
     $exclude = $params['exclude'];
     $itemsNum = $params['itemsNum'];
     $this->clipService = VWVC_BOL_ClipService::getInstance();
     $userId = $this->clipService->findClipOwner($exclude);
     if (!$userId) {
         $this->setVisible(false);
     } else {
         $clips = $this->clipService->findUserClipsList($userId, 1, $itemsNum, $exclude);
         if (!$clips) {
             $this->setVisible(false);
         }
         $this->assign('clips', $clips);
     }
 }
Exemplo n.º 2
0
 /**
  * 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;
 }