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


PHP Course::getId方法代码示例

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


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

示例1: getInsertData

 /**
  * converts an object to insert/update data
  *
  * @return a comma separated string e.g. "a=1,b=2"
  */
 public function getInsertData($doubleEscaped = false)
 {
     $values = '';
     if ($this->status != null) {
         $this->addInsertData($values, 'CS_status', DBJson::mysql_real_escape_string($this->status));
     }
     if ($this->course != null && $this->course->getId() != null) {
         $this->addInsertData($values, 'C_id', DBJson::mysql_real_escape_string($this->course->getId()));
     }
     if ($values != '') {
         $values = substr($values, 1);
     }
     return $doubleEscaped ? DBJson::mysql_real_escape_string($values) : $values;
 }
开发者ID:sawh,项目名称:ostepu-system,代码行数:19,代码来源:CourseStatus.php

示例2: Course

 function test_getId()
 {
     $name = "Math";
     $course_number = "662";
     $test_course = new Course($name, $course_number);
     $test_course->save();
     $result = $test_course->getId();
     $this->assertEquals(true, is_numeric($result));
 }
开发者ID:juliocesardiaz,项目名称:UniRegis,代码行数:9,代码来源:CourseTest.php

示例3: retrieveForCourseCriteria

 /**
  * This static method retrieves all the subjects for a course.
  *
  * @param Course $course
  * @return Criteria
  */
 public static function retrieveForCourseCriteria(Course $course)
 {
     $c = new Criteria();
     $c->add(CourseSubjectPeer::COURSE_ID, $course->getId());
     $c->addJoin(CourseSubjectPeer::CAREER_SUBJECT_SCHOOL_YEAR_ID, CareerSubjectSchoolYearPeer::ID, Criteria::INNER_JOIN);
     $c->addJoin(CareerSubjectSchoolYearPeer::CAREER_SUBJECT_ID, CareerSubjectPeer::ID, Criteria::INNER_JOIN);
     $c->addJoin(CareerSubjectPeer::SUBJECT_ID, self::ID, Criteria::INNER_JOIN);
     $c->setDistinct();
     return $c;
 }
开发者ID:nvidela,项目名称:kimkelen,代码行数:16,代码来源:SubjectPeer.php

示例4: Course

 function test_getId()
 {
     //Arrange
     $course_name = "Monster Literature";
     $course_number = "ENG304";
     $id = 1;
     $test_course = new Course($course_name, $course_number, $id);
     //Act
     $result = $test_course->getId();
     //Assert
     $this->assertEquals($id, $result);
 }
开发者ID:kellimargaret,项目名称:University_Registrar,代码行数:12,代码来源:CourseTest.php

示例5: unSubscribe

 /**
  * Remove a course subscription
  *
  * @param User $user
  * @param Course $course
  * @return boolean
  */
 public function unSubscribe($user, $course)
 {
     try {
         $em = $this->getEntityManager();
         $subscription = $em->getRepository('R4FSiteBundle:Subscription')->findOneBy(array('user' => $user->getId(), 'course' => $course->getId()));
         $em->remove($subscription);
         $em->flush();
         return true;
     } catch (Exception $e) {
         return false;
     }
 }
开发者ID:nonoscred,项目名称:Run4Fun,代码行数:19,代码来源:SubscriptionRepository.php

示例6: testFind

 function testFind()
 {
     $name = "History";
     $course_number = "HIST100";
     $test_course = new Course($name, $course_number);
     $test_course->save();
     $name2 = "Math";
     $course_number2 = "MATH100";
     $test_course2 = new Course($name, $course_number);
     $test_course2->save();
     $result = Course::find($test_course->getId());
     $this->assertEquals($test_course, $result);
 }
开发者ID:julianstewart,项目名称:university_registrar2,代码行数:13,代码来源:CourseTest.php

示例7: Course

 function test_find()
 {
     $course_name = "History";
     $course_number = "HIST 101";
     $test_course = new Course($course_name, $course_number);
     $test_course->save();
     $course_name2 = "Biology";
     $course_number2 = "BIO 101";
     $test_course2 = new Course($course_name2, $course_number2);
     $test_course2->save();
     $result = Course::find($test_course->getId());
     $this->assertEquals($test_course, $result);
 }
开发者ID:CharlesAMoss,项目名称:epic_Registrar_part2,代码行数:13,代码来源:CourseTest.php

示例8: Department

 function test_find()
 {
     //Arrange
     $test_department = new Department("Biology", "346 Stupid Avenue");
     $test_department->save();
     $name = "History 0001";
     $code = "HS001";
     $test_course = new Course($name, $code, $test_department->getId());
     $test_course->save();
     $name2 = "Dogs 101";
     $code2 = "DW101";
     $test_course2 = new Course($name2, $code2, $test_department->getId());
     $test_course2->save();
     //Act
     $result = Course::find($test_course->getId());
     //Assert
     $this->assertEquals($test_course, $result);
 }
开发者ID:ashlinaronin,项目名称:back2school_fam,代码行数:18,代码来源:CourseTest.php

示例9: Course

 function test_find()
 {
     //Arrange
     $course_name = "MTH101";
     $crn = 1234;
     $id = null;
     $test_course = new Course($course_name, $crn, $id);
     $test_course->save();
     $course_name2 = "HST202";
     $crn2 = 5678;
     $test_course2 = new Course($course_name2, $crn2, $id);
     $test_course2->save();
     //Act
     $id = $test_course->getId();
     $result = Course::find($id);
     //Assert
     $this->assertEquals($test_course, $result);
 }
开发者ID:kennygrage,项目名称:epicUniversityFromPartners,代码行数:18,代码来源:CourseTest.php

示例10: Course

 function test_find()
 {
     //Arrange
     $name = "High Times";
     $code = "CHEM420";
     $test_course = new Course($name, $code);
     $test_course->save();
     $name2 = "Gavanese Jamelan";
     $code2 = "MUSC69";
     $test_course2 = new Course($name2, $code2);
     $test_course2->save();
     //Act
     $result = Course::find($test_course->getId());
     //Assert
     $this->assertEquals($test_course, $result);
 }
开发者ID:umamiMike,项目名称:registar_epic,代码行数:16,代码来源:CourseTest.php

示例11: saveToDatabase

 public function saveToDatabase()
 {
     if (isset($this->_infoArr) && isset($this->_mappingArr)) {
         $err = "";
         $conn = Propel::getConnection();
         $dt = date("Y-m-d, H:i:s");
         $len = count($this->_infoArr);
         for ($i = 0; $i < $len; $i++) {
             $course = CoursePeer::retrieveByPK($this->_infoArr[$i]["courseCode"]);
             if (!isset($course)) {
                 // new course found, save to db
                 $course = new Course();
                 $course->setDescr($this->_infoArr[$i]["courseName"]);
                 $course->setIsEng(1);
                 $course->setDeptId(substr($this->_infoArr[$i]["courseCode"], 0, 3));
                 $course->setId($this->_infoArr[$i]["courseCode"]);
                 $course->save($conn);
             } elseif ($course->getDescr() == $course->getId()) {
                 // exam importer registers course description as course id
                 // if we encounter this situation, amend it with the proper description
                 $course->setDescr($this->_infoArr[$i]["courseName"]);
                 $course->save($conn);
             }
             try {
                 $instr = InstructorPeer::findInstructorByName($this->_infoArr[$i]["instrFirstName"], $this->_infoArr[$i]["instrLastName"], $conn);
             } catch (Exception $e) {
                 if ($e->getCode() == 1) {
                     // no instructor found
                     $instr = new Instructor();
                     $instr->setFirstName($this->_infoArr[$i]["instrFirstName"]);
                     $instr->setLastName($this->_infoArr[$i]["instrLastName"]);
                     $instr->setDeptId($course->getDeptId());
                     $instr->save($conn);
                 } else {
                     // TODO: big problem, duplicate instructors found
                     // log error and move on
                     continue;
                 }
             }
             // create CourseInstructorAssociation if it doesn't exist
             try {
                 $assoc = CourseInstructorAssociationPeer::findForYearAndInstructorIdAndCourseId($this->_year, $course->getId(), $instr->getId(), $conn);
             } catch (Exception $e) {
                 if ($e->getCode() == 1) {
                     // create new object
                     $assoc = new CourseInstructorAssociation();
                     $assoc->setYear($this->_year);
                     $assoc->setCourseId($course->getId());
                     $assoc->setInstructorId($instr->getId());
                     $assoc->save($conn);
                 } else {
                     // TODO: big problem, duplicate assocs found
                     // log error and move on
                     continue;
                 }
             }
             // we can now save the real rating data
             $ratingArr = $this->_ratingArr[$i];
             foreach ($ratingArr as $fieldId => $data) {
                 foreach ($data as $rating => $number) {
                     $ratingObj = new AutoCourseRating();
                     $ratingObj->setFieldId($fieldId);
                     $ratingObj->setRating($rating);
                     $ratingObj->setNumber($number);
                     $ratingObj->setImportDt($dt);
                     $ratingObj->setCourseInsId($assoc->getId());
                     $ratingObj->save();
                 }
             }
         }
     } else {
         throw new Exception("readCsv method has not been called.");
     }
 }
开发者ID:jasonkouoft,项目名称:SkuleCourses,代码行数:74,代码来源:importLogicRatings.class.php

示例12: setCourse

 /**
  * Declares an association between this object and a Course object.
  *
  * @param      Course $v
  * @return     CourseComment The current object (for fluent API support)
  * @throws     PropelException
  */
 public function setCourse(Course $v = null)
 {
     if ($v === null) {
         $this->setCourseId(NULL);
     } else {
         $this->setCourseId($v->getId());
     }
     $this->aCourse = $v;
     // Add binding for other direction of this n:n relationship.
     // If this object has already been added to the Course object, it will not be re-added.
     if ($v !== null) {
         $v->addCourseComment($this);
     }
     return $this;
 }
开发者ID:rafd,项目名称:SkuleCourses,代码行数:22,代码来源:BaseCourseComment.php

示例13: testDelete

 function testDelete()
 {
     $name = "Math";
     $date = '0000-00-00';
     $id = null;
     $test_course = new Course($name, $id);
     $test_course->save();
     $student_name = "Student1";
     $course_id = $test_course->getId();
     $test_student = new Student($student_name, $id, $date, $course_id);
     $test_student->save();
     $test_student->addCourse($test_course);
     $test_student->delete();
     $this->assertEquals([], $test_course->getStudents());
 }
开发者ID:JordanNavratil,项目名称:University_Registrar2,代码行数:15,代码来源:StudentTest.php

示例14: testGetUnits

 function testGetUnits()
 {
     $name = "John Doe";
     $password = "password";
     $email = "johndoe@osa.biz";
     $signed_in = 0;
     $test_user = new User($name, $password, $email, $signed_in);
     $test_user->save();
     $course_title = "Literature";
     $subject = "English";
     $course_description = "Deconstructing English literature.";
     $user_id = $test_user->getId();
     $test_course = new Course($course_title, $subject, $course_description, $user_id);
     $test_course->save();
     $title2 = "Algebra";
     $subject2 = "Math";
     $description2 = "Introduction to algebraic equations.";
     $test_course2 = new Course($title2, $subject2, $description2, $user_id);
     $test_course2->save();
     $unit_title = "Into the Wild";
     $unit_description = "The life and death of Chris McCandless.";
     $course_id = $test_course->getId();
     $test_unit = new Unit($unit_title, $unit_description, $course_id);
     $test_unit->save();
     $result = $test_course->getUnits();
     $this->assertEquals($test_unit, $result[0]);
 }
开发者ID:kylepratuch,项目名称:EdBuilder,代码行数:27,代码来源:CourseTest.php

示例15: testUpdate

 function testUpdate()
 {
     $course_name = "History";
     $course_code = "HIST100";
     $test_course = new Course($course_name, $course_code);
     $test_course->save();
     //Creatin a course with values of History, HIST100, and id from database
     $new_course_name = "Math";
     $new_course_code = "MATH100";
     $new_course = new Course($new_course_name, $new_course_code, $test_course->getId());
     //creating a new course with values of Math, MATH100, and id that matches test_course
     $test_course->update($new_course_name, $new_course_code);
     $this->assertEquals($test_course, $new_course);
 }
开发者ID:julianstewart,项目名称:university_registrar,代码行数:14,代码来源:CourseTest.php


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