Jump to:

10994 Posts in 2728 Topics by 1819 members

All other Modules

SilverStripe Forums » All other Modules » Event Calendar + File Download

Discuss all other Modules here.

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

Page: 1
Go to End
Author Topic: 749 Views
  • sav_ss
    Community Member
    11 Posts

    Event Calendar + File Download Link to this post

    Hi All,

    I have the event calendar module installed, I like it very much and I would like to extend it a bit so that I can allow a file download associated with a calendar event (eg. Download a registration form). I have made the following changes and I need some help figuring out why they didn't work:


    static $has_many = array (
    'Resources' => 'Resource'

    My resource class is exactly as found at http://doc.silverstripe.org/modules:dataobjectmanager (excepting I included different categories).

    public function getCMSFields()
    $f = parent::getCMSFields();
    $manager = new FileDataObjectManager(
    'Name' => 'Name',
    'Description' => 'Description',
    'Category' => 'Category'
    return $f;


    When I log onto the CMS the extra 'Files' tab is there for a calendar event as expected, I can go about choosing a file to upload and in list or grid view I can see the file once it's uploaded. The problem I have is (and this might be related to why I cant get the file to show up on the website) when I click on the file a new popup-type window shows with the darkened background but it displays a Silverstripe error:

    [User Error] Couldn't run query: SELECT "Resource"."ClassName", "Resource"."Created", "Resource"."LastEdited", "Resource"."Name", "Resource"."Description", "Resource"."Category", "Resource"."AttachmentID", "Resource"."ResourcePageID", "Resource"."ID", CASE WHEN "Resource"."ClassName" IS NOT NULL THEN "Resource"."ClassName" ELSE 'Resource' END AS "RecordClassName" FROM "Resource" WHERE ("ParentID" = '97') Unknown column 'ParentID' in 'where clause'

    It's got me buggered.
    I'm hoping I can display the file download on the website by modifying CalendarEvent.ss with:

    <% if Resources %>
    <% control Resources %>
    <li>$Name</li> // Need to know how to hyperlink here. $Attachment.URL ??
    <% end_control %>
    <% else %>
    <p>This calendar event has no attachments.</p>
    <% end_if %>

    I'm new at php and not entirely sure if that's the correct usage of a control block. I'm wondering,

    <% control Resources %>

    should fetch me an array of Resource objects? How can I find out what member attributes of Resource I can access?

    That's a rather long-winded description of the problem, I hope it's clear. Help at this stage would be much appreciated.


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.