We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 39498
    • 169 Posts
    I already used an eventlist builded after the MIGXdb.Manage+Events-Resources tutorial. I now have a very special usecase which I'd like to discuss what the best preparation would be.
    I have events (movie screenings) over 3-5 days, some with on day of (e.g. day 1 2 3 and 5, so the dates are not continuous), and each screening date has a different location / room. I want to handle them as one event with several individual dates. The problem is that there are more dates to handle than a start and end date.
    1. would it be smart, to work with a migx date tv, to add individual number of dates
    2. how to handle then the frontend and cmp listing / sorting by primal date
    3. for the frontend I need an evaluation, if todays date is in the event dates list
    What would be the best tv structure for this?
      • 4172
      • 5,888 Posts
      I think I would create a custom-table for the dates with
      resource_id, start, end, location and use another Event-screenings-MIGXdb-TV inside the Events-MIGXdb-TV.
      Then its easy to sort and filter by this dates.
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 39498
        • 169 Posts
        thought about that, too. But was wondering what for I would need the start and enddate. For chronological sorting the events, right? The Event-Screenings-MIGXdb-TV could not be taken for sorting the eventlist, just for sorting the screening dates?
          • 4172
          • 5,888 Posts
          the event-resources itself doesn't need a start and enddate,
          sorting would be done by the event-screenings.

          you can use migxLoopCollection or something like that to list the screenings, joined with its resources.
          if you only want the first screening-date in the list for each event, you can do it with a groupby=resource_id

            -------------------------------

            you can buy me a beer, if you like MIGX

            http://webcmsolutions.de/migx.html

            Thanks!
            • 39498
            • 169 Posts
            Can not realy find a lot of information about the use of migxLoopCollection. So I can not realy estimate if it is all done with some adaption to the existing solution or if it will turn out in a redesign of an new package. Could be done the frontend listing or also the cmp listing with migxLoopCollection?
              • 39498
              • 169 Posts
              I builded up a testcase. With
              [[!migxLoopCollection? &packageName=`migxresourceevents2` &classname=`modResource` &where=`{"published":"1","parent":"14"}` 
              &tpl=`@CODE:<p>title:[[+pagetitle]]</p>`
              ]]

              I do get the right resources. But how to do it to get the screeningtvs. Tried without sucess:
              [[!migxLoopCollection? &packageName=`migxresourceevents2` &classname=`modResource` &where=`{"published":"1","parent":"14"}` &joins=`[
              {"alias":"Resource","selectfields":"pagetitle"},
              {"alias":"screeningdatetime","classname":"modTemplateVarResource","on":"screeningdatetime.contentid = Resource.id }]`
              ]` 
              &tpl=`@CODE:<p>title:[[+pagetitle]]</p><p>dates:[[+screeningdatetime]]</p>`
              ]]
                • 39498
                • 169 Posts
                the easiest way seems to stick with start and end date populated by updateprocessor

                        if (empty($data['screeningdatetime'])) {
                            $updateerror = true;
                            $errormsg = 'Sie müssen ein Screening Datum setzen';
                            return;
                        } else {
                            $myScreenings = json_decode($data['screeningdatetime']);
                            foreach ($myScreenings as $key => $value) {
                                   $myScreeningstime[$key] = $value->screeningdatetime;
                            }
                            sort($myScreeningstime);
                            $data['eventstart'] = $myScreeningstime[0];
                            $data['eventend'] = array_pop(array_values($myScreeningstime));
                            $data['unpub_date'] = array_pop(array_values($myScreeningstime));
                        };