calendar MDL-24378 set better defaults when constructing a calendar object.
authorSam Hemelryk <sam@moodle.com>
Tue, 28 Sep 2010 02:02:04 +0000 (02:02 +0000)
committerSam Hemelryk <sam@moodle.com>
Tue, 28 Sep 2010 02:02:04 +0000 (02:02 +0000)
calendar/lib.php

index 74051f4..c5116af 100644 (file)
@@ -2428,7 +2428,22 @@ class calendar_information {
      * @param int $month
      * @param int $year
      */
-    public function __construct($day, $month, $year) {
+    public function __construct($day=0, $month=0, $year=0) {
+
+        $date = usergetdate(time());
+
+        if (empty($day)) {
+            $day = $date['mday'];
+        }
+
+        if (empty($month)) {
+            $month = $date['mon'];
+        }
+
+        if (empty($year)) {
+            $year =  $date['year'];
+        }
+
         $this->day = $day;
         $this->month = $month;
         $this->year = $year;