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


PHP Query::select_object方法代码示例

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


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

示例1: fetch

 static function fetch($id)
 {
     $q = new Query('CourseOffering');
     $q->select_object('CourseOffering')->where_eq(CourseOffering::id, $id);
     return $q->executeFetchScalar();
 }
开发者ID:mattmaynes2,项目名称:Coursinator,代码行数:6,代码来源:CourseOffering.php

示例2: Query

     $q = new Query('course_offerings');
     $q->select_object('CourseOffering');
     $q->where("term=? \n\t\t\t\t\t\tAND year=?\n\t\t\t\t\t\tAND course_code = ?\n\t\t\t\t\t\tAND section = ?", [$term, $year, $course_code, $section_id]);
     $result = $q->executeFetchAll();
     if (count($result) < 1) {
         echo '<p style="color:red">Could not find section ' . $sectioncode . '</p>';
         continue;
     }
     if ($result[0][0]->getcapacity() - $result[0][0]->getenrolled() > 0 or $result[0][0]->getcapacity() == 0) {
         $sql = "UPDATE course_offerings\n\t\t\t\t\t\tSET enrolled=enrolled+1\n\t\t\t\t\t\tWHERE \n\t\t\t\t\t\tterm=?\n\t\t\t\t\t\tAND year=?\n\t\t\t\t\t\tAND course_code=?\n\t\t\t\t\t\tAND section=?\n\t\t\t\t\t\tAND (enrolled < capacity OR capacity=0)";
         $result = db_exec($sql, [$term, $year, $course_code, $section_id]);
         if ($result->rowCount() == 0) {
             echo '<p style="color:red">Section ' . $sectioncode . ' is now full. Continued registration in remaining courses</p>';
         } else {
             $q = new Query('course_offerings');
             $q->select_object('CourseOffering');
             $q->where("term=? \n\t\t\t\t\t\tAND year=?\n\t\t\t\t\t\tAND course_code = ?\n\t\t\t\t\t\tAND section = ?", [$term, $year, $course_code, $section_id]);
             $result = $q->executeFetchAll();
             if (isset($result[0])) {
                 if ($result[0][0]->getcapacity() != 0) {
                     echo '<p>Registered in ' . $sectioncode . ' Seats remaining:' . ($result[0][0]->getcapacity() - $result[0][0]->getenrolled()) . '</p>';
                 } else {
                     echo '<p>Registered in ' . $sectioncode . '</p>';
                 }
             }
         }
     } else {
         echo '<p style="color:red">Section ' . $sectioncode . ' is now full. Continued registration in remaining courses</p>';
     }
 }
 echo '<h2>Registration completed</h2>';
开发者ID:mattmaynes2,项目名称:Coursinator,代码行数:31,代码来源:register.php

示例3: fetch

 static function fetch($code)
 {
     $q = new Query('Course');
     $q->select_object('Course')->where_eq(Course::code, $code);
     return $q->executeFetchScalar();
 }
开发者ID:mattmaynes2,项目名称:Coursinator,代码行数:6,代码来源:Course.php

示例4: getOfferingInfo

    function getOfferingInfo($course_code)
    {
        $offerings = array();
        //Get all the lecture sections for a particular course
        $q = new Query("course_offerings");
        $q->select_object("CourseOffering");
        $q->where('course_code=?
							AND term=?
							AND year=?
							AND (capacity - enrolled) > 0 
							AND type=0', [$course_code, $this->term, $this->year]);
        $rows = $q->executeFetchAll();
        //For each lecture section get the available lab/tutorial sections
        foreach ($rows as $row) {
            $sub = new Query("course_offerings");
            $sub->select_object('CourseOffering');
            $sub->where("course_code=?\n\t\t\t\t\t\t\t\t AND (section LIKE CONCAT(?,'%')\n\t\t\t\t\t\t\t\t OR section LIKE ('L%'))\n\t\t\t\t\t\t\t\t AND (((capacity-enrolled) > 0) OR (capacity=0))\n\t\t\t\t\t\t\t\t AND term=?\n\t\t\t\t\t\t\t\t AND year=?\n\t\t\t\t\t\t\t\t AND type <> 0", [$course_code, $row[0]->getsection(), $term, $year]);
            array_push($offerings, ['labs' => $sub->executeFetchAll(), 'lecture' => $row[0]]);
        }
        return $offerings;
    }
开发者ID:mattmaynes2,项目名称:Coursinator,代码行数:21,代码来源:scheduler.php

示例5: Query

  *         /api/courses.php?qualified&completed[]=SYSC1005&completed[]=ECOR1010&taking[]=SYSC2006
  * - completed: An array of completed courses. Ignored if
  *              `qualified` not set
  * - taking: An array of courses that are being taken in the same
  *           term. Ignored if `qualified` not set.
  *
  * Returns:
  *     <response e="0">
  *       <courses>
  *         <!-- One course element per course in the result. -->
  *         <course>...</course>
  *       </courses>
  *     </response>
  */
 $q = new Query('Course');
 $q->select_object('Course');
 // Filter based on course code (or prefix thereof)
 if (isset($_GET['code'])) {
     $q->where_startswith(Course::code, strtoupper($_GET['code']));
 }
 // Filter where dependancies are satisfied.
 if (isset($_GET['qualified'])) {
     $completed = isset($_GET['completed']) ? $_GET['completed'] : [];
     $taking = isset($_GET['taking']) ? $_GET['taking'] : [];
     foreach ($completed as &$c) {
         $c = strtoupper($c);
     }
     foreach ($taking as &$c) {
         $c = strtoupper($c);
     }
     $preqquery = Course::query_prerequisites(Course::code, $completed, $taking);
开发者ID:mattmaynes2,项目名称:Coursinator,代码行数:31,代码来源:courses.php

示例6: fetch

 static function fetch($code)
 {
     $q = new Query('Program');
     $q->select_object('Program')->where_eq(Program::id, $code);
     return $q->executeFetchScalar();
 }
开发者ID:mattmaynes2,项目名称:Coursinator,代码行数:6,代码来源:Program.php


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