Ejemplo n.º 1
0
 /**
  * Creates individual Entry objects of the appropriate type and
  * stores them in the $_entry array based upon DOM data.
  *
  * @param DOMNode $child The DOMNode to process
  */
 protected function takeChildFromDOM($child)
 {
     $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
     switch ($absoluteNodeName) {
         case $this->lookupNamespace('media') . ':' . 'content':
             $content = new MediaContent();
             $content->transferFromDOM($child);
             $this->_content[] = $content;
             break;
         case $this->lookupNamespace('media') . ':' . 'category':
             $category = new MediaCategory();
             $category->transferFromDOM($child);
             $this->_category[] = $category;
             break;
         case $this->lookupNamespace('media') . ':' . 'copyright':
             $copyright = new MediaCopyright();
             $copyright->transferFromDOM($child);
             $this->_copyright = $copyright;
             break;
         case $this->lookupNamespace('media') . ':' . 'credit':
             $credit = new MediaCredit();
             $credit->transferFromDOM($child);
             $this->_credit[] = $credit;
             break;
         case $this->lookupNamespace('media') . ':' . 'description':
             $description = new MediaDescription();
             $description->transferFromDOM($child);
             $this->_description = $description;
             break;
         case $this->lookupNamespace('media') . ':' . 'hash':
             $hash = new MediaHash();
             $hash->transferFromDOM($child);
             $this->_hash[] = $hash;
             break;
         case $this->lookupNamespace('media') . ':' . 'keywords':
             $keywords = new MediaKeywords();
             $keywords->transferFromDOM($child);
             $this->_keywords = $keywords;
             break;
         case $this->lookupNamespace('media') . ':' . 'player':
             $player = new MediaPlayer();
             $player->transferFromDOM($child);
             $this->_player[] = $player;
             break;
         case $this->lookupNamespace('media') . ':' . 'rating':
             $rating = new MediaRating();
             $rating->transferFromDOM($child);
             $this->_rating[] = $rating;
             break;
         case $this->lookupNamespace('media') . ':' . 'restriction':
             $restriction = new MediaRestriction();
             $restriction->transferFromDOM($child);
             $this->_restriction[] = $restriction;
             break;
         case $this->lookupNamespace('media') . ':' . 'text':
             $text = new MediaText();
             $text->transferFromDOM($child);
             $this->_mediaText[] = $text;
             break;
         case $this->lookupNamespace('media') . ':' . 'thumbnail':
             $thumbnail = new MediaThumbnail();
             $thumbnail->transferFromDOM($child);
             $this->_thumbnail[] = $thumbnail;
             break;
         case $this->lookupNamespace('media') . ':' . 'title':
             $title = new MediaTitle();
             $title->transferFromDOM($child);
             $this->_title = $title;
             break;
         default:
             parent::takeChildFromDOM($child);
             break;
     }
 }
Ejemplo n.º 2
0
 public function postSavemedia()
 {
     //      error_log(print_r(Input::all() ,true));
     $title_id = Input::get("title_id");
     // Gets this from a hidden input
     if (Input::has('billboard_filename')) {
         $billboard_filename = Input::get("billboard_filename");
         try {
             $billboard_imagefile = new Media(array('file' => $billboard_filename, 'mediatype_id' => 5, 'status_id' => 0, 'mediatarget_id' => 3, 'additional' => 0));
             Title::find($title_id)->media()->save($billboard_imagefile);
         } catch (Exception $e) {
             //                 error_log( $e->getMessage() );
         }
     }
     if (Input::has('gallery_filename')) {
         $gallery_filename = Input::get("gallery_filename");
         try {
             $gallery_imagefile = new Media(array('file' => $gallery_filename, 'mediatype_id' => 1, 'status_id' => 0, 'mediatarget_id' => 3, 'additional' => 0));
             Title::find($title_id)->media()->save($gallery_imagefile);
         } catch (Exception $e) {
             //                 error_log( $e->getMessage() );
         }
     }
     if (Input::has('video_filename0')) {
         $video_filename = Input::get("video_filename0");
         try {
             $video_imagefile = new Media(array('file' => $video_filename, 'mediatype_id' => 6, 'status_id' => 4, 'mediatarget_id' => 3, 'additional' => 0));
             Title::find($title_id)->media()->save($video_imagefile);
         } catch (Exception $e) {
             //                 error_log( $e->getMessage() );
         }
     }
     if (Input::has('video_filename1')) {
         $video_filename = Input::get("video_filename1");
         //            error_log($video_filename);
         try {
             $video_imagefile = new Media(array('file' => $video_filename, 'mediatype_id' => 6, 'status_id' => 4, 'mediatarget_id' => 3, 'additional' => 0));
             Title::find($title_id)->media()->save($video_imagefile);
         } catch (Exception $e) {
             //                 error_log( $e->getMessage() );
         }
     }
     if (Input::has('video_filename2')) {
         $video_filename = Input::get("video_filename2");
         //            error_log($video_filename);
         try {
             $video_imagefile = new Media(array('file' => $video_filename, 'mediatype_id' => 6, 'status_id' => 4, 'mediatarget_id' => 3, 'additional' => 0));
             Title::find($title_id)->media()->save($video_imagefile);
         } catch (Exception $e) {
             //                 error_log( $e->getMessage() );
         }
     }
     if (Input::has('video_filename3')) {
         $video_filename = Input::get("video_filename3");
         try {
             $video_imagefile = new Media(array('file' => $video_filename, 'mediatype_id' => 6, 'status_id' => 4, 'mediatarget_id' => 3, 'additional' => 0));
             Title::find($title_id)->media()->save($video_imagefile);
         } catch (Exception $e) {
             //                 error_log( $e->getMessage() );
         }
     }
     if (Input::has('video_filename4')) {
         $video_filename = Input::get("video_filename4");
         try {
             $video_imagefile = new Media(array('file' => $video_filename, 'mediatype_id' => 6, 'status_id' => 4, 'mediatarget_id' => 3, 'additional' => 0));
             Title::find($title_id)->media()->save($video_imagefile);
         } catch (Exception $e) {
             //                 error_log( $e->getMessage() );
         }
     }
     if (Input::has('video_add')) {
         $video_add_list = Input::get('video_add');
         if (is_array($video_add_list)) {
             foreach ($video_add_list as $video_id) {
                 $media_title_rec = new MediaTitle();
                 $media_title_rec->media_id = $video_id;
                 $media_title_rec->title_id = $title_id;
                 $media_title_rec->save();
             }
         }
     }
     if (Input::has('video_delete')) {
         $video_delete_list = Input::get('video_delete');
         if (is_array($video_delete_list)) {
             foreach ($video_delete_list as $video_id) {
                 $rec = MediaTitle::where('media_id', '=', $video_id)->where('title_id', '=', $title_id);
                 if ($rec) {
                     $rec->delete();
                 }
             }
         }
     }
     if (Input::has('preview_publish')) {
         return Redirect::to('/title/previewtitle/' . $title_id);
     } else {
         return Redirect::to('/title/list');
     }
 }