Ejemplo n.º 1
0
 public function getCurriculumPeriod($cperiod_id = null)
 {
     return Models_CurriculumPeriod::fetchRowByID($cperiod_id);
 }
                 echo json_encode(array("status" => "error", "data" => array("No course audience found.")));
             }
         } else {
             echo json_encode(array("status" => "error", "data" => array("Invalid curriculum period id provided.")));
         }
     } else {
         echo json_encode(array("status" => "error", "data" => array("Invalid course identifier provided.")));
     }
     break;
 case "sync_date":
     if (isset($course_id)) {
         if (isset($cperiod_id)) {
             $audience = new Models_Course_Audience();
             $a = $audience->fetchRowByCourseIDCperiodID($course_id, $cperiod_id);
             $ldap_sync_date = false;
             $period = Models_CurriculumPeriod::fetchRowByID($cperiod_id);
             if ($a) {
                 $ldap_sync_date = $a->getLdapSyncDate();
                 if ($ldap_sync_date) {
                     echo json_encode(array("status" => "success", "data" => array("ldap_sync_date" => "Successfully synchronized enrolment <strong>" . date("Y-m-d H:i", $ldap_sync_date) . "</strong>")));
                 } else {
                     if ($period) {
                         echo json_encode(array("status" => "success", "data" => array("ldap_sync_date" => "Enrolment will be synchronized on <strong>" . date("Y-m-d", strtotime("-2 weeks", $period->getStartDate()) . "</strong>."))));
                     } else {
                         echo json_encode(array("status" => "error", "data" => array("Invalid curriculum period id provided.")));
                     }
                 }
             } else {
                 echo json_encode(array("status" => "error", "data" => array("No audience found.")));
             }
         } else {