Exemple #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 = VWLS_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);
     }
 }
Exemple #2
0
 /**
  * Deletes vwls clip
  *
  * @param array $params
  * @return array
  */
 public function ajaxDeleteClip($params)
 {
     $clipId = $params['clipId'];
     $ownerId = $this->clipService->findClipOwner($clipId);
     $isOwner = OW::getUser()->isAuthorized('vwls', 'add', $ownerId);
     $isModerator = OW::getUser()->isAuthorized('vwls');
     if (!$isOwner && !$isModerator) {
         throw new Redirect404Exception();
         return;
     }
     $delResult = $this->clipService->deleteClip($clipId);
     if ($delResult) {
         $return = array('result' => true, 'msg' => OW::getLanguage()->text('vwls', 'clip_deleted'), 'url' => OW_Router::getInstance()->urlForRoute('vwls_vwview_list_ls'));
     } else {
         $return = array('result' => false, 'error' => OW::getLanguage()->text('vwls', 'clip_not_deleted'));
     }
     return $return;
 }