Jump to:

7940 Posts in 1543 Topics by 946 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » [Notice] Undefined offset: 0

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: 639 Views
  • otherjohn
    Avatar
    Community Member
    125 Posts

    [Notice] Undefined offset: 0 Link to this post

    Ok, using the newest version of uploadify AND DataObjectManager.

    I am uploading MP3s using S3Upload which it seems to upload just fine but when I hit continue to enter in the data on the file I just uploaded I get:

    [Notice] Undefined offset: 0
    POST /admin/EditForm/field/Sermons/UploadifyForm?SecurityID=02336c564f122add303e0731cc4d3a55244d788d&ctf[Sermons][start]=0&ctf[Sermons][per_page]=10&ctf[Sermons][showall]=0&ctf[Sermons][sort]=&ctf[Sermons][sort_dir]=&ctf[Sermons][search]=&ctf[Sermons][filter]=&ctf[Sermons][view]=

    Line 530 in /home/..blah../public_html/dataobject_manager/code/FileDataObjectManager.php

    Source

    521       $fields->removeByName($this->fileFieldName);
    522       $total = isset($_POST['totalsize']) ? $_POST['totalsize'] : sizeof($_POST['uploaded_files']);
    523       $index = isset($_POST['index']) ? $_POST['index'] + 1 : 1;
    524       $fields->push(new HiddenField('totalsize','',$total));
    525       $fields->push(new HiddenField('index','',$index));
    526       if(isset($_POST['uploaded_files']) && is_array($_POST['uploaded_files'])) {
    527          $remaining_files = $_POST['uploaded_files'];
    528          var_dump($_POST['uploaded_files']);
    529          //die;
    530          $current = $remaining_files[0];
    531          $dataObject = DataObject::get_by_id($this->sourceClass(), $current);
    532          $fileObject = $dataObject->obj($this->fileFieldName);
    533          $fields->push(new HiddenField('current','',$current));
    534          unset($remaining_files[0]);
    535          if(!$fields->loaded) {
    536             foreach($remaining_files as $id)
    Trace

    FileDataObjectManager->EditUploadedForm()
    Line 462 of FileDataObjectManager.php
    FileDataObjectManager->saveUploadifyForm(Array,FileDataObjectManager_Popup,SS_HTTPRequest)
    Line 329 of Form.php
    Form->httpSubmission(SS_HTTPRequest)
    Line 143 of RequestHandler.php
    RequestHandler->handleRequest(SS_HTTPRequest)
    Line 161 of RequestHandler.php
    RequestHandler->handleRequest(SS_HTTPRequest)
    Line 161 of RequestHandler.php
    RequestHandler->handleRequest(SS_HTTPRequest)
    Line 161 of RequestHandler.php
    RequestHandler->handleRequest(SS_HTTPRequest)
    Line 147 of Controller.php
    Controller->handleRequest(SS_HTTPRequest)
    Line 282 of Director.php
    Director::handleRequest(SS_HTTPRequest,Session)
    Line 125 of Director.php
    Director::direct(/admin/EditForm/field/Sermons/UploadifyForm)
    Line 127 of main.php

    public function getCMSFields()
       {
          $f = parent::getCMSFields();
          
          $manager = new FileDataObjectManager(
             $this, // Controller
             'Sermons',
             'SermonCastSermon', // Source class
             'Attachment', // File name on DataObject
             array(
                 'SermonDate'=>'Date',
                 'Title' => 'Title',
                 'Speaker' => 'Speaker'
             ), // Headings
             'getCMSFields_forPopup' // Detail fields (function name or FieldSet object)
             // Filter clause
             // Sort clause
             // Join clause
          );
          $manager->setDefaultView("list");
          //$manager->setUploadFolder('/Sermons/');
          $manager->uploadifyField = "S3MultipleUploadField";
          
          $f->fieldByName('Root.Content')->insertBefore(new Tab('Sermons'), 'Main');
          $f->fieldByName('Root.Content')->insertBefore(new Tab('SermonCastDetails'), 'Main');
          
          $f->addFieldToTab("Root.Content.SermonCastDetails", new LiteralField('Explaination','<h2>Podcast Details</h2><p>These details are used in the RSS feed for the podcast - the RSS feed is compatible with iTunes.</p>'));
          $f->addFieldToTab("Root.Content.SermonCastDetails", new TextField('SermonTitle','Sermon Title'));
          $f->addFieldToTab("Root.Content.SermonCastDetails", new TextField('Author','Sermon Author'));
          $f->addFieldToTab("Root.Content.SermonCastDetails", new TextField('OwnerEmail','Sermon Owner Contact Email'));
          $f->addFieldToTab("Root.Content.SermonCastDetails", new TextAreaField('Summary','Sermon Summary'));
          $f->addFieldToTab("Root.Content.SermonCastDetails", new S3UploadField('Image', 'Sermon Image'));
          
          $f->addFieldToTab("Root.Content.Sermons", $manager);
    //      if(!Permission::check('ADMIN')) $f->removeFieldFromTab("Root.Content", "Main");

          
          return $f;
             
       }

    This started happening right when we were going to launch the site!
    Please help!

  • otherjohn
    Avatar
    Community Member
    125 Posts

    Re: [Notice] Undefined offset: 0 Link to this post

    ignore
    528 var_dump($_POST['uploaded_files']);

    I was trying to debug.

    I don't know if this is relevent, but Uploadify returns an input field called "UploadedFiles[]" with a number value attached to it. I wonder if that field is the same as "uploaded_files"?

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