Ejemplo n.º 1
0
 protected function getObject()
 {
     $this->title = $this->object->title;
     $this->crumbName = $this->object->title;
     $this->addCrumb();
     if (null !== ($tag = $this->request->consume())) {
         $obj = null;
         if (null !== ($uuid = UUID::isUUID($tag))) {
             $rs = $this->model->query(array('uuid' => $uuid, 'parent' => $this->object->uuid));
             $obj = $rs->next();
         } else {
             $rs = $this->model->query(array('tag' => $tag, 'parent' => $this->object->uuid));
             $obj = $rs->next();
         }
         if (!$obj) {
             return $this->error(Error::OBJECT_NOT_FOUND);
         }
         switch ($obj->kind) {
             case 'episode':
                 require_once dirname(__FILE__) . '/browse-episode.php';
                 $inst = new MediaBrowseEpisode();
                 $inst->object = $obj;
                 $inst->process($this->request);
                 return false;
         }
         print_r($obj);
         die('-- unhandled object --');
     }
     $this->object->merge();
     $this->episodes = $this->model->query(array('kind' => 'episode', 'parent' => $this->object->uuid));
     if ($this->episodes->EOF) {
         $this->episodes = null;
     }
     return true;
 }
Ejemplo n.º 2
0
 protected function getObject()
 {
     if (null === ($tag = $this->request->consume())) {
         return true;
     }
     if ($uuid = UUID::isUUID($tag)) {
         $this->object = $this->model->objectForUUID($uuid);
     } else {
         $this->object = $this->model->locateObject($tag);
     }
     if ($this->object) {
         if ($this->object instanceof Episode) {
             if (isset($this->object->series) || isset($this->object->show)) {
                 $this->request->redirect($this->request->base . $this->object->relativeURI);
                 return false;
             }
             require_once dirname(__FILE__) . '/browse-episode.php';
             $inst = new MediaBrowseEpisode();
             $inst->object = $this->object;
             $inst->process($this->request);
             return false;
         }
         if ($this->object instanceof Show) {
             if ($this->object->kind == 'series') {
                 $this->request->redirect($this->request->base . $this->object->relativeURI);
             }
             require_once dirname(__FILE__) . '/browse-show.php';
             $inst = new MediaBrowseShow();
             $inst->object = $this->object;
             $inst->process($this->request);
             return false;
         }
         if ($this->object instanceof Scheme) {
             require_once dirname(__FILE__) . '/browse-classes.php';
             $inst = new MediaBrowseClasses();
             $inst->object = $this->object;
             $inst->process($this->request);
             return false;
         }
         print_r($this->object);
         die;
     }
     return $this->error(Error::OBJECT_NOT_FOUND);
 }
Ejemplo n.º 3
0
 protected function getObject()
 {
     $this->title = $this->object->title;
     $this->crumbName = $this->object->title;
     $this->addCrumb();
     if (null !== ($tag = $this->request->consume())) {
         $obj = $this->model->locateObject($tag, $this->object->uuid);
         if (!$obj) {
             return $this->error(Error::OBJECT_NOT_FOUND);
         }
         switch ($obj->kind) {
             case 'episode':
                 if (isset($obj->series)) {
                     $this->request->redirect($this->request->base . $obj->relativeURI);
                     return false;
                 }
                 require_once dirname(__FILE__) . '/browse-episode.php';
                 $inst = new MediaBrowseEpisode();
                 $inst->object = $obj;
                 $inst->process($this->request);
                 return false;
             case 'series':
                 require_once dirname(__FILE__) . '/browse-series.php';
                 $inst = new MediaBrowseSeries();
                 $inst->object = $obj;
                 $inst->process($this->request);
                 return false;
         }
         print_r($obj);
         die('-- unhandled object --');
     }
     $this->series = $this->model->query(array('kind' => 'series', 'parent' => $this->object->uuid));
     if ($this->series->EOF) {
         $this->series = null;
     }
     $this->episodes = $this->model->query(array('kind' => 'episode', 'parent' => $this->object->uuid));
     if ($this->episodes->EOF) {
         $this->episodes = null;
     }
     return true;
 }