We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 10597
    • 31 Posts
    I'm trying to modify migxCalendar to add a couple columns to the database and be able to edit those settings with the CMP. I'm not having much luck.

    I've added these into the table migxCalendarDates
    <field key="national" dbtype="int" phptype="integer" null="true" default="0"/>
    <field key="local_tag" dbtype="varchar" precision="12" phptype="string" null="true" default=""/>   
    


    I'm having trouble figuring out where to add them in the MigX CMP config to get it to save correctly.
    Can anyone point me in the right direction here?

      Using ModX Revolution
      • 10597
      • 31 Posts
      OK, so after much digging into migx and migxCalendar, going through every config example I could find. I have managed to get this done. I was able to load values from another table into a local_tag listbox (which is an amazing feature of MigX) so that users cannot mess up the local_tag string.

      With migxCalendar I needed to be able:

      1. Show an upcoming events bar on the national page and on the local page that displayed the next event only for either the national events or for the specific local events pages. The snippet migxLoopCollection was the power behind that. (without any modification of the snippet, only by how it was called)
      2. Show an events calendar on the national site with only national events
      3. Show an events calendar on the local sites (148 of them all with separate events to show) that did not show the national events unless it also belonged to that specific local site
      4. (a very small modification had to be made to migxcalGetEvents to be able to use additional where statements in xpdo for the above 2 items)

      I am down to one final piece, the Event Details page, this is an area I can see that I will need more data for it than what has already been coded.

      migxCalendar is definitely ready to use. Although it does have some holes that need filled. Event location data is the biggest one I see and I will have to work on that to be able to get the final piece I need done for the event details page.

      Code example for Upcoming Events bar:
              [[!migxLoopCollection? 
      &packageName=`migxcalendars`
      &classname=`migxCalendarDates`
      &where=`[{"published":1,"national":1}]`
      &sortConfig=`[{"sortby":"startdate","sortdir":"ASC"}]`
      &tpl=`mfm-main-event-bar`
      &limit=`1`
      ]]


      So moving on the biggest part I am going to have to figure out is how to make sure when the new event is added that the location_id in table migxcalendars_events matches the newly created id in migxcalendars_locations.

      Anyone know how or have an example MigX CMP config that does this?

      Thanks!
        Using ModX Revolution
        • 10597
        • 31 Posts
        BTW: ModX 2.3.1, MigX 2.8.1 and migxCalendar 0.9.2

        This site is using 3 contexts (national, local and inactive local site). It switches context based on the subdomain, checks subdomain to see if its a valid subdomain and active local site. Based on that information it switches to the necessary context.

        MigX has no issues with this setup so I am very pleased with it!
          Using ModX Revolution
          • 10597
          • 31 Posts
          Start of a Locations Manager CMP:

          {
            "formtabs":[
              {
                "MIGX_id":16,
                "caption":"Location",
                "print_before_tabs":"0",
                "fields":[
                  {
                    "MIGX_id":77,
                    "field":"name",
                    "caption":"Location Name",
                    "description":"",
                    "description_is_code":"0",
                    "inputTV":"",
                    "inputTVtype":"text",
                    "validation":"",
                    "configs":"",
                    "restrictive_condition":"",
                    "display":"",
                    "sourceFrom":"config",
                    "sources":"",
                    "inputOptionValues":"",
                    "default":"",
                    "pos":1
                  },
                  {
                    "MIGX_id":79,
                    "field":"description",
                    "caption":"Description of location",
                    "description":"",
                    "description_is_code":"0",
                    "inputTV":"",
                    "inputTVtype":"textarea",
                    "validation":"",
                    "configs":"",
                    "restrictive_condition":"",
                    "display":"",
                    "sourceFrom":"config",
                    "sources":"",
                    "inputOptionValues":"",
                    "default":"",
                    "pos":2
                  },
                  {
                    "MIGX_id":80,
                    "field":"address",
                    "caption":"Address",
                    "description":"",
                    "description_is_code":"0",
                    "inputTV":"",
                    "inputTVtype":"textarea",
                    "validation":"",
                    "configs":"",
                    "restrictive_condition":"",
                    "display":"",
                    "sourceFrom":"config",
                    "sources":"",
                    "inputOptionValues":"",
                    "default":"",
                    "pos":3
                  },
                  {
                    "MIGX_id":81,
                    "field":"city",
                    "caption":"City",
                    "description":"",
                    "description_is_code":"0",
                    "inputTV":"",
                    "inputTVtype":"text",
                    "validation":"",
                    "configs":"",
                    "restrictive_condition":"",
                    "display":"",
                    "sourceFrom":"config",
                    "sources":"",
                    "inputOptionValues":"",
                    "default":"",
                    "pos":4
                  },
                  {
                    "MIGX_id":82,
                    "field":"state",
                    "caption":"State",
                    "description":"",
                    "description_is_code":"0",
                    "inputTV":"",
                    "inputTVtype":"text",
                    "validation":"",
                    "configs":"",
                    "restrictive_condition":"",
                    "display":"",
                    "sourceFrom":"config",
                    "sources":"",
                    "inputOptionValues":"",
                    "default":"",
                    "pos":5
                  },
                  {
                    "MIGX_id":83,
                    "field":"zip",
                    "caption":"Zipcode",
                    "description":"",
                    "description_is_code":"0",
                    "inputTV":"",
                    "inputTVtype":"text",
                    "validation":"",
                    "configs":"",
                    "restrictive_condition":"",
                    "display":"",
                    "sourceFrom":"config",
                    "sources":"",
                    "inputOptionValues":"",
                    "default":"",
                    "pos":6
                  },
                  {
                    "MIGX_id":84,
                    "field":"country",
                    "caption":"Country",
                    "description":"",
                    "description_is_code":"0",
                    "inputTV":"",
                    "inputTVtype":"text",
                    "validation":"",
                    "configs":"",
                    "restrictive_condition":"",
                    "display":"",
                    "sourceFrom":"config",
                    "sources":"",
                    "inputOptionValues":"",
                    "default":"",
                    "pos":7
                  },
                  {
                    "MIGX_id":85,
                    "field":"longitude",
                    "caption":"Longitude",
                    "description":"",
                    "description_is_code":"0",
                    "inputTV":"",
                    "inputTVtype":"text",
                    "validation":"",
                    "configs":"",
                    "restrictive_condition":"",
                    "display":"",
                    "sourceFrom":"config",
                    "sources":"",
                    "inputOptionValues":"",
                    "default":"",
                    "pos":8
                  },
                  {
                    "MIGX_id":86,
                    "field":"latitude",
                    "caption":"Latitude",
                    "description":"",
                    "description_is_code":"0",
                    "inputTV":"",
                    "inputTVtype":"text",
                    "validation":"",
                    "configs":"",
                    "restrictive_condition":"",
                    "display":"",
                    "sourceFrom":"config",
                    "sources":"",
                    "inputOptionValues":"",
                    "default":"",
                    "pos":9
                  }
                ],
                "pos":1
              }
            ],
            "contextmenus":"update||publish||unpublish||recall_remove_delete",
            "actionbuttons":"addItem||bulk||import_from_package",
            "columnbuttons":"",
            "filters":"",
            "extended":{
              "migx_add":"Add Location",
              "disable_add_item":"",
              "formcaption":"Locations",
              "update_win_title":"Locations",
              "win_id":"migxcalendar_locations",
              "maxRecords":"",
              "addNewItemAt":"bottom",
              "multiple_formtabs":"",
              "actionbuttonsperrow":4,
              "winbuttonslist":"",
              "extrahandlers":"",
              "filtersperrow":4,
              "packageName":"migxcalendars",
              "classname":"migxCalendarLocation",
              "task":"",
              "getlistsort":"",
              "getlistsortdir":"",
              "sortconfig":"",
              "gridpagesize":"",
              "use_custom_prefix":"0",
              "prefix":"",
              "grid":"",
              "gridload_mode":1,
              "check_resid":1,
              "check_resid_TV":"",
              "join_alias":"",
              "has_jointable":"yes",
              "getlistwhere":"",
              "joins":"",
              "cmpmaincaption":"",
              "cmptabcaption":"Locations",
              "cmptabdescription":"Manage Locations here",
              "cmptabcontroller":"",
              "winbuttons":"",
              "onsubmitsuccess":"",
              "submitparams":""
            },
            "columns":[
              {
                "MIGX_id":1,
                "header":"ID",
                "dataIndex":"id",
                "width":"",
                "sortable":"false",
                "show_in_grid":1,
                "renderer":"",
                "clickaction":"",
                "selectorconfig":"",
                "renderchunktpl":"",
                "renderoptions":""
              },
              {
                "MIGX_id":2,
                "header":"Name",
                "dataIndex":"name",
                "width":"",
                "sortable":true,
                "show_in_grid":1,
                "renderer":"",
                "clickaction":"",
                "selectorconfig":"",
                "renderchunktpl":"",
                "renderoptions":""
              },
              {
                "MIGX_id":3,
                "header":"City",
                "dataIndex":"city",
                "width":"",
                "sortable":true,
                "show_in_grid":1,
                "renderer":"",
                "clickaction":"",
                "selectorconfig":"",
                "renderchunktpl":"",
                "renderoptions":""
              },
              {
                "MIGX_id":4,
                "header":"State",
                "dataIndex":"state",
                "width":"",
                "sortable":true,
                "show_in_grid":1,
                "renderer":"",
                "clickaction":"",
                "selectorconfig":"",
                "renderchunktpl":"",
                "renderoptions":""
              }
            ]
          }
            Using ModX Revolution
            • 10597
            • 31 Posts
            Bruno,

            It seems to me that location_id should be in the table migxcalendars_dates and not migxcalendars_events. As in my setup, every event can have multiple dates and each date could have a different location. It's not a likely scenario, but it is possible. From my understanding of the current setup, each event, whether repeating or single are locked to only 1 location.

            Is this something you agree with? What are your thoughts on this?

            Thanks
              Using ModX Revolution
              • 4172
              • 5,888 Posts
              geeble,

              sorry for coming a bit late here.



              Quote from: geeble at Aug 18, 2014, 04:26 PM
              Bruno,

              It seems to me that location_id should be in the table migxcalendars_dates and not migxcalendars_events. As in my setup, every event can have multiple dates and each date could have a different location. It's not a likely scenario, but it is possible. From my understanding of the current setup, each event, whether repeating or single are locked to only 1 location.

              Is this something you agree with? What are your thoughts on this?

              Thanks

              I think you're right and migxcalendars_dates should have a location_id - field, too, for scenarios like your's.
              I will add that field with the next version of migxcalendars to that table.
                -------------------------------

                you can buy me a beer, if you like MIGX

                http://webcmsolutions.de/migx.html

                Thanks!
                • 10597
                • 31 Posts
                I am starting from scratch tonight. I encountered an error in my modifications that didn't surface until much later and having trouble tracking it down.
                I have most of the location cmp done including setting the location for each date. I will then tackle eventimages. After I have that, I will have everything I need for my setup. It's possible I may need the eventpeople section done but should be simple once I get to that point. I will add my changes to github after testing for you to look at.

                Steep learning curve but I'm picking it up fast.
                  Using ModX Revolution
                  • 25803 ☆ A M B ☆
                  • 721 Posts
                  How do you get MIGX Calendar to work in 2.3? I upgraded a 2.2.15 site and the menu item is gone and can be found nowhere.
                    • 25803 ☆ A M B ☆
                    • 721 Posts
                    Actually, I got the menu item to show up but get a fatal error:

                    Class 'IndexManagerController' not found in /home/whatever/public_html/core/model/modx/modmanagerresponse.class.php on line 185
                      • 4172
                      • 5,888 Posts
                      go to the menu - settings

                      put there:
                      action: index
                      namespace: migx
                        -------------------------------

                        you can buy me a beer, if you like MIGX

                        http://webcmsolutions.de/migx.html

                        Thanks!