コード例 #1
0
 /**
  * Count lesson users based on the specified constraints
  * @param array $constraints The constraints for the query
  * @return array An array of EfrontUser objects
  * @since 3.6.3
  * @access public
  */
 public function countLessonUsers($constraints = array())
 {
     !empty($constraints) or $constraints = array('archive' => false, 'active' => true);
     list($where, $limit, $orderby) = EfrontUser::convertUserConstraintsToSqlParameters($constraints);
     $where[] = "u.login=ul.users_LOGIN and ul.lessons_ID='" . $this->lesson['id'] . "' and ul.archive=0";
     $from = EfrontLesson::appendTableFiltersUserConstraints("users u JOIN users_to_lessons ul ON u.login=ul.users_LOGIN", $constraints);
     $result = eF_countTableData($from, "distinct(u.login)", implode(" and ", $where));
     return $result[0]['count'];
 }