本文整理汇总了PHP中Course::validateId方法的典型用法代码示例。如果您正苦于以下问题:PHP Course::validateId方法的具体用法?PHP Course::validateId怎么用?PHP Course::validateId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Course
的用法示例。
在下文中一共展示了Course::validateId方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addCourse
public static function addCourse($tutorId, $teachingCoursesId, $termId)
{
foreach ($teachingCoursesId as $courseId) {
Course::validateId($courseId);
if (Tutor::teachesCourseWithIdOnTerm($courseId, $tutorId, $termId)) {
throw new Exception("Tutor already teaches a course with id {$courseId}");
}
}
Term::validateId($termId);
Tutor_has_course_has_schedule::addCourses($tutorId, $teachingCoursesId, $termId);
}
示例2: validateCoursesId
public static function validateCoursesId($coursesId)
{
foreach ($coursesId as $courseId) {
Course::validateId($courseId);
}
}
示例3: getTutorsOnTermOnCourse
public static function getTutorsOnTermOnCourse($courseId, $termId)
{
Course::validateId($courseId);
Term::validateId($termId);
return ScheduleFetcher::retrieveTutorsOnTermOnCourse($courseId, $termId);
}
示例4: getPendingAppointmentsWithCourseAndTutor
public static function getPendingAppointmentsWithCourseAndTutor($tutorId, $courseId, $termId)
{
Course::validateId($courseId);
Term::validateId($termId);
$appointmentHours = AppointmentFetcher::getPendingAppointmentsWithCourseAndTutor($tutorId, $courseId, $termId);
$appointmentHoursJSON = [];
foreach ($appointmentHours as $appointmentHour) {
$appointmentTitle = $appointmentHour[CourseFetcher::DB_COLUMN_CODE] . " - " . $appointmentHour[UserFetcher::DB_COLUMN_FIRST_NAME] . " " . $appointmentHour[UserFetcher::DB_COLUMN_LAST_NAME];
$students = AppointmentHasStudentFetcher::retrieveStudentsWithAppointment($appointmentHour[AppointmentFetcher::DB_COLUMN_ID]);
$appointmentTitle .= " - ";
foreach ($students as $student) {
$appointmentTitle .= $student[StudentFetcher::DB_TABLE . "_" . StudentFetcher::DB_COLUMN_FIRST_NAME] . " " . $student[StudentFetcher::DB_TABLE . "_" . StudentFetcher::DB_COLUMN_LAST_NAME] . ", ";
}
$appointmentTitle = rtrim($appointmentTitle, ", ");
$startDate = new DateTime($appointmentHour[AppointmentFetcher::DB_COLUMN_START_TIME]);
$endDate = new DateTime($appointmentHour[AppointmentFetcher::DB_COLUMN_END_TIME]);
$appointmentUrl = App::getDomainName() . "/appointments/" . $appointmentHour[UserFetcher::DB_COLUMN_ID];
switch ($appointmentHour[AppointmentFetcher::DB_COLUMN_LABEL_COLOR]) {
case Appointment::LABEL_COLOR_PENDING:
$color = '#888888';
break;
case Appointment::LABEL_COLOR_CANCELED:
$color = '#e5412d';
break;
case Appointment::LABEL_COLOR_SUCCESS:
$color = '#3fa67a';
break;
case Appointment::LABEL_COLOR_WARNING:
$color = '#f0ad4e';
break;
default:
$color = '#444';
break;
}
$appointmentHoursJSON[] = ['title' => $appointmentTitle, 'start' => $startDate->format('Y-m-d H:i:s'), 'end' => $endDate->format('Y-m-d H:i:s'), 'allDay' => false, 'url' => $appointmentUrl, 'color' => $color];
}
return json_encode($appointmentHoursJSON);
}