/**
  * Подія: редагувати торент
  * @return bool|void
  */
 protected function onEditTorrent()
 {
     $this->clearError();
     $torrent = new TorrentUrlFile($this->url);
     if (!$torrent->validate()) {
         $this->addError(null, 'Ви вказали не посилання на торент файл');
         return;
     }
     $torrent = $torrent->getTorrent();
     $torrentData = new TorrentData();
     $torrentData->setTorrent($torrent);
     $this->torrentModel = $torrentData;
     return true;
 }
 /**
  * Подія: завантажити файл
  * @return bool
  */
 protected function onEditTorrent()
 {
     if (!isset($_FILES['file'])) {
         $this->addError(null, 'Не вірний формат файла');
         return false;
     }
     $torrent = file_get_contents($_FILES['file']['tmp_name']);
     $torrent = new TorrentBinaryFile($torrent);
     $torrent = $torrent->getTorrent();
     $torrentData = new TorrentData();
     $torrentData->setTorrent($torrent);
     $this->torrentModel = $torrentData;
     return true;
 }
 /**
  * Завантажити файл
  * @param $id
  */
 public function downloadAction($id)
 {
     $torrent = TorrentData::getFile($id);
     if ($torrent) {
         FileHelper::downloadFile($torrent);
     } else {
         $this->render('errorNotFile');
     }
 }