FriendsOfPear /
Calendar
| 1 | <?php |
||
| 2 | /** |
||
| 3 | * Description: demonstrates using the Textual util |
||
| 4 | */ |
||
| 5 | |||
| 6 | if (!@include 'Calendar'.DIRECTORY_SEPARATOR.'Calendar.php') { |
||
| 7 | define('CALENDAR_ROOT', '../../'); |
||
| 8 | } |
||
| 9 | require_once CALENDAR_ROOT.'Day.php'; |
||
| 10 | require_once CALENDAR_ROOT.'Month'.DIRECTORY_SEPARATOR.'Weekdays.php'; |
||
| 11 | require_once CALENDAR_ROOT.'Util'.DIRECTORY_SEPARATOR.'Textual.php'; |
||
| 12 | |||
| 13 | // Could change language like this |
||
| 14 | // setlocale (LC_TIME, "de_DE"); // Unix based (probably) |
||
| 15 | // setlocale (LC_TIME, "ge"); // Windows |
||
| 16 | |||
| 17 | echo "<hr>Calling: Calendar_Util_Textual::monthNames('long');<pre>"; |
||
| 18 | print_r(Calendar_Util_Textual::monthNames('long')); |
||
|
0 ignored issues
–
show
|
|||
| 19 | echo '</pre>'; |
||
| 20 | |||
| 21 | echo "<hr>Calling: Calendar_Util_Textual::weekdayNames('two');<pre>"; |
||
| 22 | print_r(Calendar_Util_Textual::weekdayNames('two')); |
||
| 23 | echo '</pre>'; |
||
| 24 | |||
| 25 | echo "<hr>Creating: new Calendar_Day(date('Y'), date('n'), date('d'));<br />"; |
||
| 26 | $Calendar = new Calendar_Day(date('Y'), date('n'), date('d')); |
||
|
0 ignored issues
–
show
The type
Calendar_Day was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 27 | |||
| 28 | echo '<hr>Previous month is: '.Calendar_Util_Textual::prevMonthName($Calendar,'two').'<br />'; |
||
| 29 | echo 'This month is: '.Calendar_Util_Textual::thisMonthName($Calendar,'short').'<br />'; |
||
| 30 | echo 'Next month is: '.Calendar_Util_Textual::nextMonthName($Calendar).'<br /><hr />'; |
||
| 31 | echo 'Previous day is: '.Calendar_Util_Textual::prevDayName($Calendar).'<br />'; |
||
| 32 | echo 'This day is: '.Calendar_Util_Textual::thisDayName($Calendar,'short').'<br />'; |
||
| 33 | echo 'Next day is: '.Calendar_Util_Textual::nextDayName($Calendar,'one').'<br /><hr />'; |
||
| 34 | |||
| 35 | echo "Creating: new Calendar_Month_Weekdays(date('Y'), date('n'), 6); - Saturday is first day of week<br />"; |
||
| 36 | $Calendar = new Calendar_Month_Weekdays(date('Y'), date('n'), 6); |
||
|
0 ignored issues
–
show
The type
Calendar_Month_Weekdays was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 37 | |||
| 38 | ?> |
||
| 39 | <p>Rendering calendar....</p> |
||
| 40 | <table> |
||
| 41 | <caption><?php echo Calendar_Util_Textual::thisMonthName($Calendar).' '.$Calendar->thisYear(); ?></caption> |
||
| 42 | <tr> |
||
| 43 | <?php |
||
| 44 | $dayheaders = Calendar_Util_Textual::orderedWeekdays($Calendar,'short'); |
||
| 45 | foreach ($dayheaders as $dayheader) { |
||
| 46 | echo '<th>'.$dayheader.'</th>'; |
||
| 47 | } |
||
| 48 | ?> |
||
| 49 | </tr> |
||
| 50 | <?php |
||
| 51 | $Calendar->build(); |
||
| 52 | while ($Day = $Calendar->fetch()) { |
||
| 53 | if ($Day->isFirst()) { |
||
| 54 | echo "<tr>\n"; |
||
| 55 | } |
||
| 56 | if ($Day->isEmpty()) { |
||
| 57 | echo '<td> </td>'; |
||
| 58 | } else { |
||
| 59 | echo '<td>'.$Day->thisDay().'</td>'; |
||
| 60 | } |
||
| 61 | if ($Day->isLast()) { |
||
| 62 | echo "</tr>\n"; |
||
| 63 | } |
||
| 64 | } |
||
| 65 | ?> |
||
| 66 | </table> |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths