public static function doCountJoinAllExceptAcademicCalendar(Criteria $criteria, $distinct = false, $con = null)
 {
     $criteria = clone $criteria;
     $criteria->clearSelectColumns()->clearOrderByColumns();
     if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
         $criteria->addSelectColumn(CourseSchedulePeer::COUNT_DISTINCT);
     } else {
         $criteria->addSelectColumn(CourseSchedulePeer::COUNT);
     }
     foreach ($criteria->getGroupByColumns() as $column) {
         $criteria->addSelectColumn($column);
     }
     $criteria->addJoin(CourseSchedulePeer::SUBJECT_ACCAL_ID, SubjectAccalPeer::ID);
     $criteria->addJoin(CourseSchedulePeer::SUBJECT_CURR_ID, SubjectCurrPeer::ID);
     $criteria->addJoin(CourseSchedulePeer::EMPLOYEE_ID, EmployeePeer::ID);
     $criteria->addJoin(CourseSchedulePeer::CLASS_GROUP_ID, ClassGroupPeer::ID);
     $criteria->addJoin(CourseSchedulePeer::LOCATION_ID, LocationPeer::ID);
     $criteria->addJoin(CourseSchedulePeer::CLASS_SESSION_ID, ClassSessionPeer::ID);
     $rs = CourseSchedulePeer::doSelectRS($criteria, $con);
     if ($rs->next()) {
         return $rs->getInt(1);
     } else {
         return 0;
     }
 }