SimpleCalendar
- Comments:
- 27
- Tags:
SimpleCalendar is a very simple PHP calendar class written to be easy to use and flexible.
It includes basic event logic and is made to be modified to your particular needs.
Sample Usage
<?php
require_once('SimpleCalendar.php');
$calendar = new donatj\SimpleCalendar();
$calendar->setStartOfWeek('Sunday');
$calendar->addDailyHtml( 'Sample Event', 'today', 'tomorrow' );
$calendar->show(true);
Example Calendar
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
Sample Event | ||||||
Sample Event | ||||||
Click here for the Github repository.
Recent Activity
Test in PHP 8.4
Merge pull request #26 from donatj/php-version/8-3--users-jdonat-projects-donatj-simplecalendar--github-workflows-ci-yml
Update PHP to 8.3
Update PHP to 8.3
Jesse Donat (donatj)
Update PHP to 8.3Replace travis badge with GitHub Actions
Jesse Donat (donatj)
Use MakefileAdds helpful Makefile
Update autoloader syntax
Use correctly compatible versions
Updates README
Minor fixup
Drop pre-7.2’s
Run fixer
Add phpcs and php-cs-fixer
Fixup
Add phpstan.neon
Cleans up composer.json some
Correct backwards annotation
Remove unnecessary if
Min PHP 7.2
Fix http url
Bump actions/checkout from 3 to 4
Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v3...v4)
---
updated-dependencies:
- dependency-name: actions/checkout
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <support@github.com>
Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v3...v4)
---
updated-dependencies:
- dependency-name: actions/checkout
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <support@github.com>
Updates docs
Jesse Donat (donatj)
Resolve PHP 8.1+ deprecation noticeGitHub (web-flow)
Test in PHP 8.2Merge pull request #21 from donatj/dependabot/github_actions/actions/checkout-3
Bump actions/checkout from 2 to 3
Bump actions/checkout from 2 to 3
Bump actions/checkout from 2 to 3
Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 3.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v2...v3)
---
updated-dependencies:
- dependency-name: actions/checkout
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <support@github.com>
Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 3.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v2...v3)
---
updated-dependencies:
- dependency-name: actions/checkout
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <support@github.com>
Create dependabot.yml
Build | Date | Message |
---|---|---|
v0.6.0 Download | Simplified shrimp2ts work | |
v0.6.1 Download | gitignore updates | |
v0.6.2 Download | Merge branch 'keesiemeijer-master' | |
v0.7.0 Download | Updates docs | |
v0.8.0 Download | Replace travis badge with GitHub Actions |
Comment by: Greg Duckworth on
This is a fantastic little script, although I don't suppose you could add the ability to move forward and back in months ?
Comment by: Jesse G. Donat on
The constructor on Simple Calendar takes a date string (see strtotime()
) so an easy way is simply
$cal = new SimpleCalendar('+1 Month');
or
$cal = new SimpleCalendar('June 2012');
There is also a setDate method which allows you to change the date of the calendar after initial construction.
Comment by: HvToor on
It looks great but when I download v0.3.2 and upload it to my website it won't work. I already changed the paths of the files to the right folder.
Hope you can help with it,
Hope you can help with it,
Comment by: Jesse G. Donat on
Starting with .3.0 it is namespaced and requires PHP 5.3+, I'm sorry I did not update the documentation until just now. The example in the source code better illustrates this.
Comment by: Dirk on
As somebody already asked: Is there a simple way to make weeks start on mondays?
Thx in advance
Thx in advance
Comment by: Alberto on
i keep getting the following notice Undefined offset: 1 to 31
"Notice: Undefined offset: 1 in SimpleCalendar.php on line 150"
"Notice: Undefined offset: 1 in SimpleCalendar.php on line 150"
Comment by: murali on
I used this calendar script in my website. I need to have the extended dates of next month and previous month in the current month. Please help me to do it in this calendar script. I would appreciate any help on this.
Thanks.
Thanks.
Comment by: Guilherme on
NICE !!! VERY NICE CLASS !
To change the header,
Sun Mon Tue Wed Thu Fri Sat
To other languages ? what should i do ?
Thanks
Guilherme
To change the header,
Sun Mon Tue Wed Thu Fri Sat
To other languages ? what should i do ?
Thanks
Guilherme
Comment by: Brad Haizlett on
Is there any way to enable previous and next month functionality on it? That would be awesome if you had that, or at least a way to have that working.
Comment by: Jesse G. Donat on
Do you mean just rendering the next/previous month? That's as simple as:
$calendar = new donatj\SimpleCalendar();
$calendar->show(true);
$calendar->setDate('last month');
$calendar->show(true);
$calendar->setDate('next month');
$calendar->show(true);
If you mean button's for next/previous month, thats outside the scope. This is just a little widget to render a calendar. You can write JavaScript or PHP to do it yourself though without too much trouble.
Comment by: Peter on
Good class! Thank you.
One question, regarding this line:
$out .= "\n" . ($i != $count ? '' : '');
Why did you check ($i != $count?)
In this way, one TR - start is missed.
Br,
Peter
One question, regarding this line:
$out .= "\n" . ($i != $count ? '
Why did you check ($i != $count?)
In this way, one TR - start is missed.
Br,
Peter
Comment by: Anthony on
Concerning buttons for next/previous months. I understand you said its outside the scope but it would be really helpful if you could help out with it as its a bit cumbersome when trying to figure out the correct code to do it.
If you have update please put it out there.
If you have update please put it out there.
Comment by: kalle on
I also get this error when downloaded the latest version.
Parse error: syntax error, unexpected T_STRING in C:\wamp\www\calendar\donatj\SimpleCalendar.php on line 3
Parse error: syntax error, unexpected T_STRING in C:\wamp\www\calendar\donatj\SimpleCalendar.php on line 3
Comment by: Greg on
Any way to make it so you can click on a day and have it call a function to set an event for that day?
Comment by: Chris Yates on
Cracking little calendar nice & simple ...
I've incorporated this in a pretty complex ERP system and it works great and is easy to expand on
I've incorporated this in a pretty complex ERP system and it works great and is easy to expand on
Comment by: Jose Vivas on
Can you fill in the blanks with the dates of the previous month and the following month?
Comment by: Mesk on
Hi, nice work.
How can I make the rendering of events that are date ranges, not individual events, appear as a single event spanning from the first to the last day?
How can I make the rendering of events that are date ranges, not individual events, appear as a single event spanning from the first to the last day?
Comment by: Jesse G. Donat on
I'm sorry but that's not a feature of the calendar library.
It would require more a more complicated combination of HTML and CSS than this is designed to generate.
This outputs a reasonably simple table structure. Having events visually span multiple days would probably double if not triple the complexity of the library.
I'm sure there are other libraries that would better suit your needs.
It would require more a more complicated combination of HTML and CSS than this is designed to generate.
This outputs a reasonably simple table structure. Having events visually span multiple days would probably double if not triple the complexity of the library.
I'm sure there are other libraries that would better suit your needs.