Editing Event in ProEvents add-on causes selected calendar to default back to first calendar on the dropdown in multiple calendar scenarios

Permalink
I have a website in development that relies haevily on the proevents package: different calendars for different users. Creating an event works fine but when I click to edit an event in for example "Calendar 4", the dropdown select box for which calendar defaults to "Calendar 1" (or the first one). This requires that the correct calendar be selected each time an event is edited. Handing this over to a client in this form may cause them to believe the event has disappeared if they forget to reset to the correct calendar since it will have been moved to the 'default' (or first) calendar.

THis is similar to the issues I posted in the ProBlog support where editing a blog would cause it to revert to the first blog in the select box.

This was submitted to support but was wondering if anyone else came across this bug.
Thanks
C

 
Chrouglas replied on at Permalink Reply
Also, Is there a way to show ALL events (including past)? I see the custom template name recognition thing but the default "filterByAllDates()" filters to include only future events. I only made this work by commenting out the "andWhere()" line but of course that will get overwritten upon upgrade. Maybe there could be a similar name recognition thing for "ALL".

If there is a simple setting that I am missing I apologize.
Chrouglas replied on at Permalink Reply
Haven't heard on this so I dug in a little to try to find the problem myself and perhaps make it easier for someone to find the issue.
So this is where the issue is...
proevents/elements/tools/add_event.php
<div class="col-xs-12 col-sm-6">
           <?php 
         echo 'test = ' . $cParentID . $eventTitle; 
         ?>
            <div class="form-group">
                <label class="control-label"><?php   echo $form->label('cParentID', t('Calendar')) ?></label>
                <div class="input">
                    <?php   if (count($sections) == 0) { ?>
                        <div><?php   echo t(
                                'No sections defined. Please create a page with the attribute "calendar" set to true.'
                            ) ?></div>
                    <?php   } else { ?>
                        <div><?php   echo $form->select('cParentID', $sections, $cParentID) ?></div>
                    <?php   } ?>
                </div>

you'll notice that i put in a line to show two variables... the title shows but the parentid does not. I know it should be getting picked up from here...
proevents/controllers/tools/add_event.php
if (is_object($this->event)) {
            $eventTitle = $this->event->getCollectionName();
            $eventDescription = $this->event->getCollectionDescription();
            $eventDate = $this->event->getCollectionDatePublic();
            $cParentID = $this->event->getCollectionParentID();
         echo 'test2 = ' . $cParentID;
            $this->set('cParentID', $cParentID);
            $ctID = $this->event->getCollectionTypeID();
            $eventBody = '';
            $eb = $this->event->getBlocks('Main');
            foreach ($eb as $b) {
                if ($b->getBlockTypeHandle() == 'content') {
                    $eventBody = $b->getInstance()->getContent();
                }
            }

you'll notice i added an echo here too to display the parent ID and in this context it works. I've tried "$this->set" and that did not work.

Any ideas why the parent ID is not being passed to the page?
mnakalay replied on at Permalink Reply
mnakalay
Hello,
in your code you have this
$this->set('cParentID', $cParentID);

But you are trying to use the $cParentID in an element so most likely the element is not getting the variable that way. That would work if it was a view related to the controller where the variable is set.

When you call an element, you usually use an inc() function.
So in your case you probably have something like this somewhere
$this->inc('elements/tools/add_event.php'); ?>

To send a varibale to that element you would do this
$this->inc('elements/tools/add_event.php', array('cParentID' => $cParentID)); ?>

Then the variable $cParentID will be available in the element
Chrouglas replied on at Permalink Reply
Ahhh haaaa!

I found the issue...
public function render()
    {
        $request = \Request::getInstance();
        if ($request->get('eID')) {
            $eID = Loader::helper('security')->sanitizeInt($request->get('eID'));
            $eventify = new \Concrete\Package\Proevents\Controller\Helpers\Eventify;
            $event =  $eventify->getEvent($eID);
            $this->event = Event::getByID($event['eventID']);
        }
        if (is_object($this->event)) {
            $eventTitle = $this->event->getCollectionName();
            $eventDescription = $this->event->getCollectionDescription();
            $eventDate = $this->event->getCollectionDatePublic();
            $cParentID = $this->event->getCollectionParentID();
            $ctID = $this->event->getCollectionTypeID();

In the loader toward the bottom the cParentID was absent from the rest of the variables set above.

Thanks for your response regardless. Its nice to know there are still people on this thing :)