Jump to:

7935 Posts in 1536 Topics by 943 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » drag and drop feature of sorting in video page

Discuss the DataObjectManager module, and the related ImageGallery module.

Moderators: martimiz, UncleCheese, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 740 Views
  • Rishi
    Avatar
    Community Member
    97 Posts

    drag and drop feature of sorting in video page Link to this post

    hello
    i have a video page working fine on my site , thanks to UC, i would like to have an option of drag and drop sorting option in the admin panel,the code is

    Video.php
    <?php

    class Video extends DataObject
    {
       static $db = array (
          'Title' => 'Varchar(100)',
          'Description' => 'Text'
       );
       
       static $has_one = array (
          // Make sure this comes first
          'VideoPage' => 'VideoPage',
    /**
    * This relationship could be as simple as 'Video' => 'File' provided
    * FileDataObjectManager::$upgrade_video is true (defaults to true).
    * However, if we know the page will only contain videos, we can simplify things by
    * using a direct relationship to FLV. This will give us the benefit of not having
    * to worry about the allowed_file_types setting.
    *
    * To make this an audio resource, set the relationship to the MP3 class, e.g.
    * 'AudioFile' => 'MP3'. Audio files are also subject to automatic upgrades, however,
    * based on FileDataObjectManager::$upgrade_audio. (true by default).
    *
    */
          'Video' => 'FLV'
       );
       
    }
    ?>

    VideoPage.php

    <?php
    /**
    * Before getting started, be sure to test your FFMPEG installtion by adding:
    * FLV::echo_ffmpeg_test();
    * to your _config.php!
    *
    */

    class VideoPage extends Page
    {
       static $has_many = array (
          'Videos' => 'Video'
       );
       
       public function getCMSFields()
       {
          $fields = parent::getCMSFields();
          $fields->addFieldToTab("Root.Content.Videos", new FileDataObjectManager(
             $this,
             'Videos',
             'Video',
             'Video',
             array('Title' => 'Title', 'Description' => 'Description'),
             new FieldSet(
                new TextField('Title'),
                new TextareaField('Description')
             )
          ));
          return $fields;
       }
    }

    class VideoPage_Controller extends Page_Controller
    {

    }

    ?>

    VideoPAge.ss

       <% control Videos %>
          <div class="link">
             <div class="description">
                <h3>$Title</h3>
                <p>$Description</p>
             </div>
             <div class="resource">
             
    $Video
                

                
             </div>
          </div>
       <% end_control %>

    thank you in advance

    740 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.