public function getAudience($cperiod_id = null) { $audience = new Models_Course_Audience(); return $audience->fetchAllByCourseIDCperiodID($this->getID(), $cperiod_id); }
$title = $tmp_input; } else { add_error("To search for learning events, begin typing the title of the event you wish to find in the search box."); } if (isset(${$request_var}["course_id"]) && ($tmp_input = clean_input(${$request_var}["course_id"], array("trim", "int")))) { $course_id = $tmp_input; } else { add_error("No course ID provided."); } if (isset(${$request_var}["audience"]) && ($tmp_input = clean_input(${$request_var}["audience"], array("trim", "int")))) { $audience = $tmp_input; } else { add_error("No audience ID provided."); } if (!$ERROR) { $ca = new Models_Course_Audience(); $course_audience = $ca->fetchRowByCourseIDAudienceTypeAudienceValue($course_id, "group_id", $audience); if ($course_audience) { $curriculum_period = $course_audience->getCurriculumPeriod($course_audience->getCperiodID()); } $e = new Models_Event(); if ($curriculum_period) { $events = $e->fetchAllByCourseIdTitleDates($course_id, $title, $curriculum_period->getStartDate(), $curriculum_period->getFinishDate()); } else { $events = $e->fetchAllByCourseIdTitle($course_id, $title); } if ($events) { $events_array = array(); foreach ($events as $event) { $events_array[] = array("event_id" => $event->getID(), "event_title" => $event->getEventTitle(), "event_start" => date("D M d/y g:ia", $event->getEventStart())); }
$ldap_sync_date = $a->getLdapSyncDate(); echo json_encode(array("status" => "success", "data" => array("sync_date" => "Successfully synchronized enrolment <strong>" . date("Y-m-d H:i", $ldap_sync_date) . "</strong>"))); } else { 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 {