MDL-28283-master Completion Future dates can now be set as completion criteria
authorAnita Viglinoe <10.demma@gmail.com>
Fri, 3 Feb 2012 06:54:05 +0000 (12:24 +0530)
committerAnkit Agarwal <ankit@moodle.com>
Mon, 13 Feb 2012 03:35:10 +0000 (09:05 +0530)
lib/completion/completion_criteria_date.php

index 9bd66a2..dfe1717 100644 (file)
@@ -53,7 +53,7 @@ class completion_criteria_date extends completion_criteria {
     public function config_form_display(&$mform, $data = null)
     {
         $mform->addElement('checkbox', 'criteria_date', get_string('enable'));
     public function config_form_display(&$mform, $data = null)
     {
         $mform->addElement('checkbox', 'criteria_date', get_string('enable'));
-        $mform->addElement('date', 'criteria_date_value', get_string('afterspecifieddate', 'completion'));
+        $mform->addElement('date_selector', 'criteria_date_value', get_string('afterspecifieddate', 'completion'));
 
         // If instance of criteria exists
         if ($this->id) {
 
         // If instance of criteria exists
         if ($this->id) {
@@ -74,8 +74,7 @@ class completion_criteria_date extends completion_criteria {
 
         if (!empty($data->criteria_date)) {
             $this->course = $data->id;
 
         if (!empty($data->criteria_date)) {
             $this->course = $data->id;
-            $date = $data->criteria_date_value;
-            $this->timeend = strtotime($date['Y'].'-'.$date['M'].'-'.$date['d']);
+            $this->timeend = $data->criteria_date_value;
             $this->insert();
         }
     }
             $this->insert();
         }
     }