当前位置: 首页>>代码示例>>PHP>>正文


PHP Term::validateId方法代码示例

本文整理汇总了PHP中Term::validateId方法的典型用法代码示例。如果您正苦于以下问题:PHP Term::validateId方法的具体用法?PHP Term::validateId怎么用?PHP Term::validateId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Term的用法示例。


在下文中一共展示了Term::validateId方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: addCourses

 public static function addCourses($id, $coursesIds, $termId)
 {
     self::validateCoursesId($coursesIds);
     Term::validateId($termId);
     Tutor_has_course_has_termFetcher::insertMany($id, $coursesIds, $termId);
 }
开发者ID:sass-team,项目名称:sass-app,代码行数:6,代码来源:TutorHasCourseHasTerm.class.php

示例2: getTutors

 public static function getTutors($courseId, $termId)
 {
     self::validateId($courseId);
     Term::validateId($termId);
     return CourseFetcher::retrieveTutors($courseId, $termId);
 }
开发者ID:sass-team,项目名称:sass-app,代码行数:6,代码来源:Course.class.php

示例3: exportAppointments

 /**
  * @param $termId
  * @return array
  * @throws Exception
  * @throws PHPExcel_Exception
  */
 private static function exportAppointments($termId)
 {
     Term::validateId($termId);
     require_once ROOT_PATH . 'plugins/PHPExcel_1.8.0_doc/Classes/PHPExcel.php';
     date_default_timezone_set('Europe/Athens');
     $allAppointments = AppointmentFetcher::retrieveForTerm($termId);
     $appointmentsHaveStudents = AppointmentHasStudentFetcher::retrieveForTerm($termId);
     $primaryFocusOfConferences = PrimaryFocusOfConferenceFetcher::retrieveForTerm($termId);
     $termData = TermFetcher::retrieveSingle($termId);
     $termStart = new DateTime($termData[TermFetcher::DB_COLUMN_START_DATE]);
     $termEnd = new DateTime($termData[TermFetcher::DB_COLUMN_END_DATE]);
     $termName = $termData[TermFetcher::DB_COLUMN_NAME];
     $objPHPExcel = new PHPExcel();
     $objPHPExcel->getProperties()->setCreator(App::getName())->setLastModifiedBy(App::getName())->setTitle(self::TITLE_VISIT_LOG . " - " . $termName)->setSubject("Appointments")->setDescription("List of appointments for {$termName}.")->setKeywords("office sass appointments php")->setCategory("Appointments");
     $sheetIndex = 0;
     for ($workingDateTime = $termStart; $workingDateTime <= $termEnd; $workingDateTime->modify('+1 week')) {
         $curWeek = $workingDateTime->format('W');
         $appointmentsWeekly = self::getAppointments($allAppointments, $curWeek);
         $startWeekDate = self::getWorkingDates($workingDateTime->format('Y'), $workingDateTime->format('W'));
         $endWeekDate = self::getWorkingDates($workingDateTime->format('Y'), $workingDateTime->format('W'), false);
         $periodTime = date("d M", strtotime($startWeekDate)) . "-" . date("d M, o", strtotime('-1 day', strtotime($endWeekDate)));
         $objPHPExcel->createSheet($sheetIndex);
         $objPHPExcel->setActiveSheetIndex($sheetIndex)->setCellValue('A1', 'Day')->setCellValue('B1', 'Date')->setCellValue('C1', 'Month')->setCellValue('D1', 'Year')->setCellValue('E1', 'Time')->setCellValue('F1', 'LF Lname')->setCellValue('G1', 'Stud Lname')->setCellValue('H1', 'Stud Fname')->setCellValue('I1', 'Stud ID')->setCellValue('J1', 'Major')->setCellValue('K1', 'Mobile')->setCellValue('L1', 'e-mail')->setCellValue('M1', 'Course Code')->setCellValue('N1', 'Course Instructor')->setCellValue('O1', '# of Students')->setCellValue('P1', 'Outcome')->setCellValue('Q1', 'Actual Duration')->setCellValue('R1', 'Purpose');
         $sheetIndex++;
         $objPHPExcel->getActiveSheet()->getStyle('A1:R1')->applyFromArray(self::$styleVisitLogHeader);
         $objPHPExcel->getActiveSheet()->getRowDimension('1')->setRowHeight(24);
         $objPHPExcel->getActiveSheet()->setTitle($periodTime);
         $row = 2;
         foreach ($appointmentsWeekly as $appointment) {
             $appointmentStartDateTime = new DateTime($appointment[AppointmentFetcher::DB_COLUMN_START_TIME]);
             $appointmentEndDateTime = new DateTime($appointment[AppointmentFetcher::DB_COLUMN_END_TIME]);
             $appointmentId = $appointment[AppointmentFetcher::DB_COLUMN_ID];
             $students = self::getStudentsForAppointment($appointmentsHaveStudents, $appointmentId);
             $numOfStudents = sizeof($students);
             // TODO: REMOVE autosize from loop
             $col = 0;
             // day
             $day = $appointmentStartDateTime->format('l');
             $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($col, $row, $day);
             $col++;
             // date
             $date = $appointmentStartDateTime->format('d');
             $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($col, $row, $date);
             $col++;
             // month
             $month = $appointmentStartDateTime->format('M');
             $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($col, $row, $month);
             $col++;
             // year
             $year = $appointmentStartDateTime->format('Y');
             $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($col, $row, $year);
             $col++;
             // time
             $time = $appointmentStartDateTime->format('H:i');
             $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($col, $row, $time);
             $col++;
             // tutor last name
             $tutorLastName = $appointment[UserFetcher::DB_COLUMN_LAST_NAME];
             $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($col, $row, $tutorLastName);
             // TODO: add student that first requested the appointment.
             $col++;
             // student last name
             $studentLastName = $students[0][StudentFetcher::DB_COLUMN_LAST_NAME];
             $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($col, $row, $studentLastName);
             $col++;
             // student first name
             $studentFirstName = $students[0][StudentFetcher::DB_COLUMN_FIRST_NAME];
             $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($col, $row, $studentFirstName);
             $col++;
             // student ID
             $studentId = $students[0][StudentFetcher::DB_COLUMN_STUDENT_ID];
             $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($col, $row, $studentId);
             $col++;
             // student major
             $majorCode = $students[0][MajorFetcher::DB_COLUMN_CODE];
             $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($col, $row, $majorCode);
             $col++;
             // student mobile
             $mobile = $students[0][StudentFetcher::DB_COLUMN_MOBILE];
             $objPHPExcel->getActiveSheet()->setCellValueExplicitByColumnAndRow($col, $row, $mobile);
             $col++;
             // student email
             $email = $students[0][StudentFetcher::DB_COLUMN_EMAIL];
             $objPHPExcel->getActiveSheet()->setCellValueExplicitByColumnAndRow($col, $row, $email);
             $col++;
             // course code
             $courseCode = $appointment[CourseFetcher::DB_COLUMN_CODE];
             $objPHPExcel->getActiveSheet()->setCellValueExplicitByColumnAndRow($col, $row, $courseCode);
             $col++;
             // instructor for first student
             $instructorLastName = $students[0][InstructorFetcher::DB_COLUMN_LAST_NAME];
             $objPHPExcel->getActiveSheet()->setCellValueExplicitByColumnAndRow($col, $row, $instructorLastName);
             $col++;
             // instructor for first student
//.........这里部分代码省略.........
开发者ID:sass-team,项目名称:sass-app,代码行数:101,代码来源:Excel.class.php

示例4: getTutorsOnTermOnCourse

 public static function getTutorsOnTermOnCourse($courseId, $termId)
 {
     Course::validateId($courseId);
     Term::validateId($termId);
     return ScheduleFetcher::retrieveTutorsOnTermOnCourse($courseId, $termId);
 }
开发者ID:sass-team,项目名称:sass-app,代码行数:6,代码来源:Schedule.class.php

示例5: updateTeachingCourse

 public static function updateTeachingCourse($id, $newCourseId, $oldCourseId, $termId)
 {
     if (!preg_match('/^[0-9]+$/', $newCourseId) || !preg_match('/^[0-9]+$/', $oldCourseId) || strcmp($newCourseId, $oldCourseId) === 0) {
         throw new Exception("Data has been tempered. Aborting process.");
     }
     Term::validateId($termId);
     if (self::teachesCourseWithIdOnTerm($newCourseId, $id, $termId)) {
         throw new Exception("Data has been tempered. Aborting process.");
     }
     try {
         $query = "UPDATE `" . App::getDbName() . "`.`" . self::DB_TABLE_TUTOR_HAS_COURSE_HAS_TERM . "` SET `course_id`= :newCourseId WHERE `tutor_user_id`= :tutorId and`course_id`= :oldCourseId";
         $dbConnection = DatabaseManager::getConnection();
         $query = $dbConnection->prepare($query);
         $query->bindParam(':newCourseId', $newCourseId, PDO::PARAM_INT);
         $query->bindParam(':tutorId', $id, PDO::PARAM_INT);
         $query->bindParam(':oldCourseId', $oldCourseId, PDO::PARAM_INT);
         $query->execute();
     } catch (Exception $e) {
         throw new Exception("Could not replace teaching courses data into database.");
     }
 }
开发者ID:sass-team,项目名称:sass-app,代码行数:21,代码来源:Tutor.class.php

示例6: getAppointmentsForCourseAndTutor

 public static function getAppointmentsForCourseAndTutor($tutorId, $courseId, $termId)
 {
     Tutor::validateId($tutorId);
     Term::validateId($termId);
     $appointmentHours = AppointmentFetcher::getAppointmentsForTutorAndCourse($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);
 }
开发者ID:sass-team,项目名称:sass-app,代码行数:38,代码来源:Appointment.class.php


注:本文中的Term::validateId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。