當前位置: 首頁>>代碼示例>>PHP>>正文


PHP sfPropelPager::getLastPage方法代碼示例

本文整理匯總了PHP中sfPropelPager::getLastPage方法的典型用法代碼示例。如果您正苦於以下問題:PHP sfPropelPager::getLastPage方法的具體用法?PHP sfPropelPager::getLastPage怎麽用?PHP sfPropelPager::getLastPage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在sfPropelPager的用法示例。


在下文中一共展示了sfPropelPager::getLastPage方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: createLastYearDivisions

 public function createLastYearDivisions()
 {
     $last_year_school_year = SchoolYearPeer::retrieveLastYearSchoolYear($this->getSchoolYear());
     $last_year_career_school_year = CareerSchoolYearPeer::retrieveByCareerAndSchoolYear($this->getCareer(), $last_year_school_year);
     SchoolYearPeer::clearInstancePool();
     CareerSchoolYearPeer::clearInstancePool();
     $con = Propel::getConnection();
     try {
         $con->beginTransaction();
         $criteria = new Criteria();
         $criteria->add(DivisionPeer::CAREER_SCHOOL_YEAR_ID, $last_year_career_school_year->getId());
         $pager = new sfPropelPager('Division', 10);
         $pager->setCriteria($criteria);
         $pager->init();
         $last_page = $pager->getLastPage();
         for ($i = 1; $i <= $last_page; $i++) {
             $pager->setPage($i);
             $pager->init();
             $divisions = $pager->getResults();
             //This creates all the divisions, courses and courses subjects of the last year.
             foreach ($divisions as $division) {
                 $division->createCopyForSchoolYear($con, $this);
                 $division->clearAllReferences(true);
                 unset($division);
             }
             DivisionPeer::clearInstancePool();
         }
         unset($criteria);
         $con->commit();
     } catch (PropelException $e) {
         $con->rollback();
         throw $e;
     }
 }
開發者ID:nvidela,項目名稱:kimkelen,代碼行數:34,代碼來源:CareerSchoolYear.php

示例2: closeSchoolYear

 /**
  * This method check if the students pass the year or not
  *
  * @param SchoolYear $school_year
  * @param PropelPDO $con
  */
 public function closeSchoolYear(SchoolYear $school_year, PropelPDO $con = null)
 {
     $criteria = SchoolYearStudentPeer::retrieveStudentsForSchoolYearCriteria($school_year);
     $pager = new sfPropelPager('Student', 100);
     $pager->setCriteria($criteria);
     $pager->init();
     $last_page = $pager->getLastPage();
     for ($i = 1; $i <= $last_page; $i++) {
         $pager->setPage($i);
         $pager->init();
         $students = $pager->getResults();
         foreach ($students as $student) {
             if ($student->getLastStudentCareerSchoolYear()->getStatus() != StudentCareerSchoolYearStatus::WITHDRAWN_WITH_RESERVE) {
                 $this->stepToNextYear($student, $school_year, $con);
             }
         }
         $school_year->setIsClosed(true);
         $school_year->save($con);
         StudentPeer::clearInstancePool();
     }
 }
開發者ID:nvidela,項目名稱:kimkelen,代碼行數:27,代碼來源:BaseEvaluatorBehaviour.class.php


注:本文中的sfPropelPager::getLastPage方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。