public function newAction()
 {
     $userInfo = Zend_Auth::getInstance()->getStorage()->read();
     if (!$this->isAuthorized(-1)) {
         // TODO: this header call does not actually print any error message
         header("Status: 401 Not Authorized");
         return;
     }
     $webstream = new CcWebstream();
     //we're not saving this primary key in the DB so it's OK to be -1
     $webstream->setDbId(-1);
     $webstream->setDbName(_("Untitled Webstream"));
     $webstream->setDbDescription("");
     $webstream->setDbUrl("http://");
     $webstream->setDbLength("00:30:00");
     $webstream->setDbName(_("Untitled Webstream"));
     $webstream->setDbCreatorId($userInfo->id);
     $webstream->setDbUtime(new DateTime("now", new DateTimeZone('UTC')));
     $webstream->setDbMtime(new DateTime("now", new DateTimeZone('UTC')));
     //clear the session in case an old playlist was open: CC-4196
     Application_Model_Library::changePlaylist(null, null);
     $this->view->obj = new Application_Model_Webstream($webstream);
     $this->view->action = "new";
     $this->view->html = $this->view->render('webstream/webstream.phtml');
 }
Пример #2
0
 public static function save($parameters, $mime, $mediaUrl, $di)
 {
     $userInfo = Zend_Auth::getInstance()->getStorage()->read();
     $id = $parameters['id'];
     if ($id != -1) {
         $webstream = CcWebstreamQuery::create()->findPK($id);
     } else {
         $webstream = new CcWebstream();
     }
     $webstream->setDbName($parameters["name"]);
     $webstream->setDbDescription($parameters["description"]);
     $webstream->setDbUrl($mediaUrl);
     $dblength = $di->format("%H:%I");
     $webstream->setDbLength($dblength);
     $webstream->setDbCreatorId($userInfo->id);
     $webstream->setDbUtime(new DateTime("now", new DateTimeZone('UTC')));
     $webstream->setDbMtime(new DateTime("now", new DateTimeZone('UTC')));
     $ws = new Application_Model_Webstream($webstream);
     $webstream->setDbMime($mime);
     $webstream->save();
     return $webstream->getDbId();
 }