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


PHP ResultSet::create方法代码示例

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


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

示例1: list_zombies

 /**
  * Returns users whose last login is prior from $ceiling
  *
  * @param int|string $ceiling last login date
  * @param bool $active_only if true returns only active users. Otherwise returns all users.
  * @return ResultSet
  */
 static function list_zombies($ceiling, $active_only = true)
 {
     $ceiling = is_numeric($ceiling) ? (int) $ceiling : strtotime($ceiling);
     $ceiling = date('Y-m-d H:i:s', $ceiling);
     $user_table = Database::get_main_table(TABLE_MAIN_USER);
     $login_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN);
     $sql = 'SELECT
                 user.user_id,
                 user.firstname,
                 user.lastname,
                 user.username,
                 user.auth_source,
                 user.email,
                 user.status,
                 user.registration_date,
                 user.active,
                 access.login_date';
     global $_configuration;
     if ($_configuration['multiple_access_urls']) {
         $access_url_rel_user_table = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
         $current_url_id = api_get_current_access_url_id();
         $sql .= " FROM {$user_table} as user, {$login_table} as access, {$access_url_rel_user_table} as url\n                      WHERE\n                        access.login_date = (SELECT MAX(a.login_date)\n                                             FROM {$login_table} as a\n                                             WHERE a.login_user_id = user.user_id\n                                             ) AND\n                        access.login_date <= '{$ceiling}' AND\n                        user.user_id = access.login_user_id AND\n                        url.login_user_id = user.user_id AND url.access_url_id={$current_url_id}";
     } else {
         $sql .= " FROM {$user_table} as user, {$login_table} as access\n                      WHERE\n                        access.login_date = (SELECT MAX(a.login_date)\n                                             FROM {$login_table} as a\n                                             WHERE a.login_user_id = user.user_id\n                                             ) AND\n                        access.login_date <= '{$ceiling}' AND\n                        user.user_id = access.login_user_id";
     }
     if ($active_only) {
         $sql .= ' AND user.active = 1';
     }
     return ResultSet::create($sql);
 }
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:37,代码来源:zombie_manager.class.php

示例2: is_active

 /**
  * Returns true if the gradebook is active and visible in a course, false
  * otherwise.
  *
  * @param int $c_id Course integer id, defaults to the current course
  * @return boolean
  */
 public static function is_active($c_id = null)
 {
     $name = 'gradebook';
     $table = Database::get_main_table(TABLE_MAIN_SETTINGS_CURRENT);
     $sql = "SELECT * from {$table} WHERE variable='course_hide_tools' AND subkey='{$name}'";
     $setting = ResultSet::create($sql)->first();
     $setting = $setting ? $setting : array();
     $inactive = isset($setting['selected_value']) && $setting['selected_value'] == 'true';
     if ($inactive) {
         return false;
     }
     $c_id = $c_id ? intval($c_id) : api_get_course_int_id();
     $table = Database::get_course_table(TABLE_TOOL_LIST);
     $sql = "SELECT * from {$table} WHERE c_id = {$c_id} and name='{$name}'";
     $item = ResultSet::create($sql)->first();
     if (empty($item)) {
         return true;
     }
     return $item['visibility'] == '1';
 }
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:27,代码来源:gradebook.lib.php

示例3: list_inactive_courses

 /**
  *
  * @return ResultSet
  */
 static function list_inactive_courses($ceiling, $visibility_level = COURSE_VISIBILITY_REGISTERED)
 {
     $ceiling = is_numeric($ceiling) ? (int) $ceiling : strtotime($ceiling);
     $ceiling = date('Y-m-d H:i:s', $ceiling);
     $visibility_level = $visibility_level ? $visibility_level : '0';
     $table_course = Database::get_main_table(TABLE_MAIN_COURSE);
     $table_category = Database::get_main_table(TABLE_MAIN_CATEGORY);
     $sql = "SELECT\n                    c.*,\n                    cat.name AS category\n                FROM\n                    {$table_course} AS c\n                LEFT JOIN\n                    {$table_category} AS cat\n                ON\n                    c.category_code = cat.code\n                WHERE\n                    c.visibility >= {$visibility_level} AND\n                    c.last_visit<='{$ceiling}'\n        ";
     return ResultSet::create($sql);
 }
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:14,代码来源:course.lib.php


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