sproctor / php-calendar

PHP-Calendar
http://www.php-calendar.org/
Apache License 2.0
138 stars 66 forks source link

Importing events from prior calendar #169

Closed bobatwhidbey closed 3 years ago

bobatwhidbey commented 3 years ago

I really like this calendar. It was easy to install and works well going forward. I want to import events from a prior calendar. This seemed straight forward, but isn't working.

When I add events with my keypad, it appears that only the Events table is being affected, so here's what I did. I created a CSV file that mimics the Events table (eid, cid, owner,....mtime) then using phpMyAdmin at my host, I imported the CSV file. All appears good in the Event table with phpMyAdmin's browse function but those events don't show up in my calendar.

Can you tell me how to import prior events? Thank you. bob@uselessbay.us

sproctor commented 3 years ago

You also need the occurrences table. Events stores stuff like the name, etc, occurrences stores when the events actually happen.

bobatwhidbey commented 3 years ago

Using phpMyAdmin on my host I've added Events and Occurrences using the Import feature, but none of my events appear on the calendar. Can you see my problem? occurrences1 event1

bobatwhidbey commented 3 years ago

The events added via phpMyAdmin DO appear when the Search feature of the calendar is used, even though they don't appear on the calendar.

sproctor commented 3 years ago

There's a dropdown selector on the title to pick the calendar. Make sure you're looking at the correct calendar. Make sure the max events displayed per day is greater than 0. I'm not sure what else it could be.

bobatwhidbey commented 3 years ago

Success, although I'm not 100% sure I know what did it. On Events I switched start_date & end_date with start_ts & end_ts. I think that was the problem. I also increase the maximum subject length from 50 to 250, since I do have some long subjects.

It would be good to know what 'start_date", catid, ctime, and mtime mean. What purpose?

sproctor commented 3 years ago

ctime and mtime are create/modify times. catid is the category id, for adding colors, etc. start_date and end_date exist because the date is timezone agnostic. start_ts and end_ts are timestamps.

bobatwhidbey commented 3 years ago

Thanks Sean

bobatwhidbey commented 3 years ago

Is there a way to utilize a SQLite3 DB rather than MySQL

sproctor commented 3 years ago

Currently, no. SQLite has it's uses, I'm not sure it's the best DB for the task though. I don't think it has good support for concurrent access. What makes you want to use it instead of MySQL ?

bobatwhidbey commented 3 years ago

I can see the benefits of MySQL over SQLite. Here's a problem I'm having: So many of my repeating events do not fall within the choices that are available. Daily/weekly/monthly rarely handles the situation. I need Every other week in one situation but mostly my events seemed to be tied to the nth day of every month, as in "2nd Monday of the month", or "2nd and 4th Thursdays". Is there some hope those types of repeating events can be accomodated in the future?

sproctor commented 3 years ago

The UI here could use some real improvements. It shouldn't be too hard to add a feature to have multiple recurring event types in the UI.

One of the big flaws is that it was designed to work Javascript disabled. The original version is from 2001 when Javascript wasn't something you could assume a browser would support. Creating multiple occurrence types without using Javascript is ugly, but I don't think supporting browsers without Javascript is something anyone cares about anymore.

We could add another type that lets you select the Nth occurrence of a day of the week in a month and have a way to add more occurrence entries. I'm not sure how motivated I am for this project. When I get time to devote here, I want to re-write the front-end in React and create a REST API for the backend. This is more work than I have time for currently.

bobatwhidbey commented 3 years ago

I was thinking of adding two more check-box lists, to the right of the Repeats list. 1st 2nd 3rd 4th

and a second list: Sun. Mon. . . Sat.

The user would need to check one from each column

bobatwhidbey commented 3 years ago

To go along with your current approach you might add one more option to the Repeats dropdown (Nth of the month). When that option is chosen, the phrase to the right would be : "Repeats on what Thursday of each month". You would get the actual day of the week (Thursday in this example) from the "From Date" on the form.

bobatwhidbey commented 3 years ago

One of the features I need for the calendar is the ability to add a recurring event that occurs the N-th Day of selected months. [Book club meets the 2nd Thursday of every month except July and August] I've pretty much accomplished that. See the attached pictures. I haven't figured out how to add a list of check boxes side-by-side, horizontally. Only one on top of each other, vertically, and that won't really work. I'd like 2 rows of 6, or maybe 1 of 12. Can you please suggest some changes to my PHP additions to your code that will accomplish that. Event form PHP Event don't know how to add

sproctor commented 3 years ago

You could make the columns in CSS. I don't know what your compatibility requirements are. You can create a group for the month checkboxes and set a custom class on it. Then in CSS, create a grid. My PHP skills are pretty rusty, if this isn't valid PHP, please forgive me.

$month_group = new FormGroup(class = "month-grid");
for ($i = 1; $i <= 12; $i++) {
    $month_question = new FormCheckboxQuestion("month$i", false, month_names[$i]);
    $month_group->add_part($month_question);
}
$nthly_group->add_part($month_group);

then the CSS something like:

.month-grid {
  display: grid;
  grid-template-columns: auto auto;
}

.month-grid .form-checkbox-question {
  // style for the children
}

I don't think you actually need more style, but maybe you'll want something to make it look nice.

Good luck and sorry for the awkward custom form stuff. It's a lot easier to read than what I used to have, if that's any consolation.