Jump to:

7762 Posts in 1289 Topics by 886 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » Upcoming data based on date field and dataobjectmanager

Discuss the DataObjectManager module, and the related ImageGallery module.

Moderators: martimiz, UncleCheese, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba

Page: 1
Go to End
Author Topic: 102 Views
  • shrike
    Avatar
    Community Member
    14 Posts

    Upcoming data based on date field and dataobjectmanager Link to this post

    Hi!

    I'm trying to get data from DOM based on date field and would like to display all todays and upcoming data in one page, but no old events anymore. Sort of a event list. I still need the old data for history graphs for later usage.

    Template SS

    <% if SoccerGameTips %>
    <% control SoccerGameTips %>
    <ul id="resourceId">
    <li>$Date.Nice &raquo; <span class="bold">$TeamHome VS $TeamVisitor</span> &raquo; <span class="color1 bold">$Tip</span></li>
    <li>"$Description"</li>
    <li><span class="legals">$GamePercentages</span></li>
    </ul>
    <% end_control %>
    <% end_if %>

    And this is my SoccerGameTipPage.php

    <?php

       class SoccerGameTipsPage extends Page
       {
          static $has_many = array (
             'SoccerGameTips' => 'SoccerGameDetails'
          );

          public function getCMSFields()
          {
             $f = parent::getCMSFields();
             $f->addFieldToTab("Root.Content.SoccerGameTips", new DataObjectManager(
                $this,
                'SoccerGameTips',
                'SoccerGameDetails',
                array(
                   'Date' => 'Date',
                   'TeamHome'=>'TeamHome',
                   'TeamVisitor' => 'TeamVisitor',
                   'GamePercentages' => 'GamePercentages',
                   'Tip' => 'Tip',
                   'Description' => 'Description',
                   'GameResult' => 'GameResult',
                   'Won' => 'Won'
                ),
                'getCMSFields_forPopup'

             ));

             return $f;
          }

       }

       class SoccerGameTipsPage_Controller extends Page_Controller
       {
       }
    ?>

    How should I limit the printing of data to only todays and upcoming data?

    102 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.