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


PHP Database::get_main_table方法代码示例

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


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

示例1: get_class_data

/**
 * Get the classes to display on the current page.
 */
function get_class_data($from, $number_of_items, $column, $direction)
{
    $class_table = Database::get_main_table(TABLE_MAIN_CLASS);
    $class_user_table = Database::get_main_table(TABLE_MAIN_CLASS_USER);
    $courseId = api_get_course_int_id();
    $em = Database::getManager();
    $res = $em->getRepository('ChamiloCoreBundle:CourseRelClass')->findBy(['courseId' => $courseId]);
    $subscribed_classes = array();
    foreach ($res as $obj) {
        $subscribed_classes[] = $obj->getClassId();
    }
    $sql = "SELECT\n                c.id AS col0,\n                c.name   AS col1,\n                COUNT(cu.user_id) AS col2,\n                c.id AS col3\n            FROM {$class_table} c ";
    $sql .= " LEFT JOIN {$class_user_table} cu ON cu.class_id = c.id";
    $sql .= " WHERE 1 = 1";
    if (isset($_GET['keyword'])) {
        $keyword = Database::escape_string(trim($_GET['keyword']));
        $sql .= " AND (c.name LIKE '%" . $keyword . "%')";
    }
    if (count($subscribed_classes) > 0) {
        $sql .= " AND c.id NOT IN ('" . implode("','", $subscribed_classes) . "')";
    }
    $sql .= " GROUP BY c.id, c.name ";
    $sql .= " ORDER BY col{$column} {$direction} ";
    $sql .= " LIMIT {$from},{$number_of_items}";
    $res = Database::query($sql);
    $classes = array();
    while ($class = Database::fetch_row($res)) {
        $classes[] = $class;
    }
    return $classes;
}
开发者ID:jloguercio,项目名称:chamilo-lms,代码行数:34,代码来源:subscribe_class.php

示例2: search_users

 /**
  * Search users by username, firstname or lastname, based on the given
  * search string
  * @param string Search string
  * @param int Deprecated param
  * @return string Xajax response block
  * @assert () === false
  */
 function search_users($needle, $id)
 {
     $tbl_user = Database::get_main_table(TABLE_MAIN_USER);
     $xajax_response = new xajaxResponse();
     $return = '';
     if (!empty($needle)) {
         // xajax send utf8 datas... datas in db can be non-utf8 datas
         $charset = api_get_system_encoding();
         $needle = api_convert_encoding($needle, $charset, 'utf-8');
         $needle = Database::escape_string($needle);
         // search users where username or firstname or lastname begins likes $needle
         $order_clause = api_sort_by_first_name() ? ' ORDER BY firstname, lastname, username' : ' ORDER BY lastname, firstname, username';
         $sql = 'SELECT u.user_id, username, lastname, firstname FROM ' . $tbl_user . ' u ' . ' WHERE (username LIKE "' . $needle . '%" ' . ' OR firstname LIKE "' . $needle . '%" ' . ' OR lastname LIKE "' . $needle . '%") ' . $order_clause . ' LIMIT 11';
         $rs = Database::query($sql);
         $i = 0;
         while ($user = Database::fetch_array($rs)) {
             $i++;
             if ($i <= 10) {
                 $return .= '<a href="javascript: void(0);" onclick="javascript: add_user_to_url(\'' . addslashes($user['user_id']) . '\',\'' . api_get_person_name(addslashes($user['firstname']), addslashes($user['lastname'])) . ' (' . addslashes($user['username']) . ')' . '\')">' . api_get_person_name($user['firstname'], $user['lastname']) . ' (' . $user['username'] . ')</a><br />';
             } else {
                 $return .= '...<br />';
             }
         }
     }
     $xajax_response->addAssign('ajax_list_users', 'innerHTML', api_utf8_encode($return));
     return $xajax_response;
 }
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:35,代码来源:access_url_edit_users_to_url_functions.lib.php

示例3: uninstall

 public function uninstall()
 {
     $t_settings = Database::get_main_table(TABLE_MAIN_SETTINGS_CURRENT);
     $t_options = Database::get_main_table(TABLE_MAIN_SETTINGS_OPTIONS);
     $t_tool = Database::get_course_table(TABLE_TOOL_LIST);
     //New settings
     $sql = "DELETE FROM {$t_settings} WHERE variable = 'openmeetings_tool_enable'";
     Database::query($sql);
     $sql = "DELETE FROM {$t_settings} WHERE variable = 'openmeetings_pass'";
     Database::query($sql);
     $sql = "DELETE FROM {$t_settings} WHERE variable = 'openmeetings_user'";
     Database::query($sql);
     $sql = "DELETE FROM {$t_settings} WHERE variable = 'openmeetings_host'";
     Database::query($sql);
     //Old settings deleting just in case
     $sql = "DELETE FROM {$t_settings} WHERE variable = 'openmeetings_plugin'";
     Database::query($sql);
     $sql = "DELETE FROM {$t_options} WHERE variable  = 'openmeetings_plugin'";
     Database::query($sql);
     //        $sql = "DELETE FROM $t_settings WHERE variable = 'openmeetings_plugin_host'";
     //        Database::query($sql);
     //        $sql = "DELETE FROM $t_settings WHERE variable = 'openmeetings_plugin_salt'";
     //        Database::query($sql);
     //hack to get rid of Database::query warning (please add c_id...)
     $sql = "DELETE FROM {$t_tool} WHERE name = 'openmeetings' AND c_id = c_id";
     Database::query($sql);
     $sql = "DROP TABLE IF EXISTS plugin_openmeetings";
     Database::query($sql);
     //Deleting course settings
     $this->uninstall_course_fields_in_all_courses();
 }
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:31,代码来源:openmeetings_plugin.class.php

示例4: search_sessions

 /**
  * Search sessions by name, based on a search string
  * @param string Search string
  * @param int Deprecated param
  * @return string Xajax response block
  * @assert () === false
  */
 function search_sessions($needle, $id)
 {
     $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
     $xajax_response = new xajaxResponse();
     $return = '';
     if (!empty($needle)) {
         // xajax send utf8 datas... datas in db can be non-utf8 datas
         $charset = api_get_system_encoding();
         $needle = api_convert_encoding($needle, $charset, 'utf-8');
         $needle = Database::escape_string($needle);
         // search sessiones where username or firstname or lastname begins likes $needle
         $sql = 'SELECT id, name FROM ' . $tbl_session . ' u
                 WHERE (name LIKE "' . $needle . '%")
                 ORDER BY name, id
                 LIMIT 11';
         $rs = Database::query($sql);
         $i = 0;
         while ($session = Database::fetch_array($rs)) {
             $i++;
             if ($i <= 10) {
                 $return .= '<a href="#" onclick="add_user_to_url(\'' . addslashes($session['id']) . '\',\'' . addslashes($session['name']) . ' (' . addslashes($session['id']) . ')' . '\')">' . $session['name'] . ' </a><br />';
             } else {
                 $return .= '...<br />';
             }
         }
     }
     $xajax_response->addAssign('ajax_list_courses', 'innerHTML', api_utf8_encode($return));
     return $xajax_response;
 }
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:36,代码来源:access_url_edit_sessions_to_url_functions.lib.php

示例5: __construct

 /**
  *
  * Constructor (generates a connection to the API and the Chamilo settings
  * required for the connection to the video conference server)
  * @param string $host
  * @param string $salt
  */
 public function __construct($host = null, $salt = null)
 {
     // Initialize video server settings from global settings
     $plugin = BBBPlugin::create();
     $bbb_plugin = $plugin->get('tool_enable');
     if (empty($host)) {
         $bbb_host = $plugin->get('host');
     } else {
         $bbb_host = $host;
     }
     if (empty($salt)) {
         $bbb_salt = $plugin->get('salt');
     } else {
         $bbb_salt = $salt;
     }
     $this->logout_url = api_get_path(WEB_PLUGIN_PATH) . 'bbb/listing.php?' . api_get_cidreq();
     $this->table = Database::get_main_table('plugin_bbb_meeting');
     if ($bbb_plugin == true) {
         $userInfo = api_get_user_info();
         $this->user_complete_name = $userInfo['complete_name'];
         $this->salt = $bbb_salt;
         $info = parse_url($bbb_host);
         $this->url = $bbb_host . '/bigbluebutton/';
         if (isset($info['scheme'])) {
             $this->protocol = $info['scheme'] . '://';
             $this->url = str_replace($this->protocol, '', $this->url);
         }
         // Setting BBB api
         define('CONFIG_SECURITY_SALT', $this->salt);
         define('CONFIG_SERVER_BASE_URL', $this->url);
         $this->api = new BigBlueButtonBN();
         $this->plugin_enabled = true;
     }
 }
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:41,代码来源:bbb.lib.php

示例6: isValidUser

    /**
     * Check whether the username and password are valid
     * @param string $username The username
     * @param string $password the password
     * @return boolean Whether the password belongs to the username return true. Otherwise return false
     */
    public static function isValidUser($username, $password)
    {
        if (empty($username) || empty($password)) {
            return false;
        }

        $userTable = Database::get_main_table(TABLE_MAIN_USER);

        $whereConditions = array(
            "username = '?' " => $username,
            "AND password = '?'" => sha1($password)
        );

        $conditions = array(
            'where' => $whereConditions
        );

        $table = Database::select('count(1) as qty', $userTable, $conditions);

        if ($table != false) {
            $row = current($table);

            if ($row['qty'] > 0) {
                return true;
            }
        }

        return false;
    }
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:35,代码来源:WebService.class.php

示例7: reports_template_exercicesMultiCourses_getSQL

function reports_template_exercicesMultiCourses_getSQL()
{
    // foreach quiz
    $result = array();
    $columns = Database::query('select r.id as kid, c.title as course, ' . 'r.child_name as test from ' . Database::get_main_table(TABLE_MAIN_REPORTS_KEYS) . ' r, ' . Database::get_main_table(TABLE_MAIN_COURSE) . ' c ' . 'where r.course_id=c.id and r.tool_id=' . reports_getToolId(TOOL_QUIZ) . ' order by r.course_id, r.child_name');
    if (Database::num_rows($columns) == 0) {
        die('<b>' . get_lang('no data found') . '</b>');
    }
    $query = 'select u.lastname Name, u.firstname Firstname';
    $columns = Database::store_result($columns);
    if ($_REQUEST['tattempt'] == 'min' || $_REQUEST['tattempt'] == 'max') {
        $function = $_REQUEST['tattempt'];
    } else {
        $function = 'avg';
    }
    foreach ($columns as $key => $column) {
        $query .= ', ' . $function . '(k' . $key . '.score) as `' . $column['course'] . ' - ' . $column['test'] . '` ';
    }
    $query .= ' from ' . Database::get_main_table(TABLE_MAIN_USER) . ' u ';
    foreach ($columns as $key => $column) {
        // fixme sessions
        $query .= 'left outer join ' . Database::get_main_table(TABLE_MAIN_REPORTS_VALUES) . ' k' . $key . ' on k' . $key . '.key_id = ' . $column['kid'] . ' and k' . $key . '.user_id = u.user_id ';
    }
    $query .= ' group by ';
    foreach ($columns as $key => $column) {
        // grouping attempt
        $query .= 'k' . $key . '.attempt, ';
    }
    $query = substr($query, 0, -2);
    // removing last ', ';
    return $query;
}
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:32,代码来源:exercicesMultiCourses.reports.php

示例8: __construct

 /**
  * Constructor (generates a connection to the API)
  * @param   string  Clockworksms API key required to use the plugin
  * @return  void
  */
 public function __construct($apiKey = null)
 {
     $plugin = ClockworksmsPlugin::create();
     $clockWorkSMSPlugin = $plugin->get('tool_enable');
     if (empty($apiKey)) {
         $clockWorkSMSApiKey = $plugin->get('api_key');
     } else {
         $clockWorkSMSApiKey = $apiKey;
     }
     $this->table = Database::get_main_table('user_field_values');
     if ($clockWorkSMSPlugin == true) {
         $this->apiKey = $clockWorkSMSApiKey;
         // Setting Clockworksms api
         if (!defined('CONFIG_SECURITY_API_KEY')) {
             define('CONFIG_SECURITY_API_KEY', $this->apiKey);
         }
         $trimmedApiKey = trim(CONFIG_SECURITY_API_KEY);
         if (!empty($trimmedApiKey)) {
             $this->api = new Clockwork(CONFIG_SECURITY_API_KEY);
         } else {
             $this->api = new Clockwork(' ');
             $recipient_name = api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname'), null, PERSON_NAME_EMAIL_ADDRESS);
             $email_form = api_get_setting('emailAdministrator');
             $emailsubject = 'Clockworksms error';
             $emailbody = 'Key cannot be blank';
             $sender_name = $recipient_name;
             $email_admin = $email_form;
             api_mail_html($recipient_name, $email_form, $emailsubject, $emailbody, $sender_name, $email_admin);
         }
         $this->plugin_enabled = true;
     }
 }
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:37,代码来源:clockworksms.lib.php

示例9: uninstall

 function uninstall()
 {
     $t_settings = Database::get_main_table(TABLE_MAIN_SETTINGS_CURRENT);
     $t_options = Database::get_main_table(TABLE_MAIN_SETTINGS_OPTIONS);
     $t_tool = Database::get_course_table(TABLE_TOOL_LIST);
     //Delete settings
     $sql = "DELETE FROM {$t_settings} WHERE variable = 'ticket_tool_enable'";
     Database::query($sql);
     $sql = "DROP TABLE IF EXISTS ticket_ticket";
     Database::query($sql);
     $sql = "DROP TABLE IF EXISTS ticket_status";
     Database::query($sql);
     $sql = "DROP TABLE IF EXISTS ticket_project";
     Database::query($sql);
     $sql = "DROP TABLE IF EXISTS ticket_priority";
     Database::query($sql);
     $sql = "DROP TABLE IF EXISTS ticket_message_attch";
     Database::query($sql);
     $sql = "DROP TABLE IF EXISTS ticket_message";
     Database::query($sql);
     $sql = "DROP TABLE IF EXISTS ticket_category";
     Database::query($sql);
     $sql = "DROP TABLE IF EXISTS ticket_assigned_log";
     Database::query($sql);
     $sql = "DROP TABLE IF EXISTS ticket_ticket";
     Database::query($sql);
     //Deleting course settings
     $this->uninstall_course_fields_in_all_courses();
 }
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:29,代码来源:ticket_plugin.class.php

示例10: get_course_usage

/**
 *
 */
function get_course_usage($course_code, $session_id = 0)
{
    $table = Database::get_main_table(TABLE_MAIN_COURSE);
    $course_code = Database::escape_string($course_code);
    $sql = "SELECT * FROM {$table} WHERE code='" . $course_code . "'";
    $res = Database::query($sql);
    $course = Database::fetch_object($res);
    // Learnpaths
    $table = Database::get_course_table(TABLE_LP_MAIN);
    $usage[] = array(get_lang(ucfirst(TOOL_LEARNPATH)), CourseManager::count_rows_course_table($table, $session_id, $course->id));
    // Forums
    $table = Database::get_course_table(TABLE_FORUM);
    $usage[] = array(get_lang('Forums'), CourseManager::count_rows_course_table($table, $session_id, $course->id));
    // Quizzes
    $table = Database::get_course_table(TABLE_QUIZ_TEST);
    $usage[] = array(get_lang(ucfirst(TOOL_QUIZ)), CourseManager::count_rows_course_table($table, $session_id, $course->id));
    // Documents
    $table = Database::get_course_table(TABLE_DOCUMENT);
    $usage[] = array(get_lang(ucfirst(TOOL_DOCUMENT)), CourseManager::count_rows_course_table($table, $session_id, $course->id));
    // Groups
    $table = Database::get_course_table(TABLE_GROUP);
    $usage[] = array(get_lang(ucfirst(TOOL_GROUP)), CourseManager::count_rows_course_table($table, $session_id, $course->id));
    // Calendar
    $table = Database::get_course_table(TABLE_AGENDA);
    $usage[] = array(get_lang(ucfirst(TOOL_CALENDAR_EVENT)), CourseManager::count_rows_course_table($table, $session_id, $course->id));
    // Link
    $table = Database::get_course_table(TABLE_LINK);
    $usage[] = array(get_lang(ucfirst(TOOL_LINK)), CourseManager::count_rows_course_table($table, $session_id, $course->id));
    // Announcements
    $table = Database::get_course_table(TABLE_ANNOUNCEMENT);
    $usage[] = array(get_lang(ucfirst(TOOL_ANNOUNCEMENT)), CourseManager::count_rows_course_table($table, $session_id, $course->id));
    return $usage;
}
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:36,代码来源:course_information.php

示例11: __construct

 /**
  * Sets the surveylist and the plainsurveylist
  */
 public function __construct()
 {
     // Database table definitions
     $table_survey = Database::get_course_table(TABLE_SURVEY);
     $table_survey_question = Database::get_course_table(TABLE_SURVEY_QUESTION);
     $table_user = Database::get_main_table(TABLE_MAIN_USER);
     // searching
     $search_restriction = SurveyUtil::survey_search_restriction();
     if ($search_restriction) {
         $search_restriction = ' AND ' . $search_restriction;
     }
     $course_id = api_get_course_int_id();
     $sql = "SELECT\n                    survey.survey_id,\n                    survey.parent_id,\n                    survey_version,\n                    survey.code as name\n\t\t\t\tFROM {$table_survey} survey\n\t\t\t\tLEFT JOIN {$table_survey_question}  survey_question\n\t\t\t\tON survey.survey_id = survey_question.survey_id , {$table_user} user\n\t\t\t\tWHERE\n\t\t\t\t\tsurvey.c_id \t\t\t=  {$course_id} AND\n\t\t\t\t\tsurvey_question.c_id \t=  {$course_id} AND\n\t\t\t\t\tsurvey.author \t\t\t= user.user_id\n\t\t\t\tGROUP BY survey.survey_id";
     $res = Database::query($sql);
     $surveys_parents = array();
     $refs = array();
     $list = array();
     $plain_array = array();
     while ($survey = Database::fetch_array($res, 'ASSOC')) {
         $plain_array[$survey['survey_id']] = $survey;
         $surveys_parents[] = $survey['survey_version'];
         $thisref =& $refs[$survey['survey_id']];
         $thisref['parent_id'] = $survey['parent_id'];
         $thisref['name'] = $survey['name'];
         $thisref['id'] = $survey['survey_id'];
         $thisref['survey_version'] = $survey['survey_version'];
         if ($survey['parent_id'] == 0) {
             $list[$survey['survey_id']] =& $thisref;
         } else {
             $refs[$survey['parent_id']]['children'][$survey['survey_id']] =& $thisref;
         }
     }
     $this->surveylist = $list;
     $this->plainsurveylist = $plain_array;
 }
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:38,代码来源:surveymanager.lib.php

示例12: get_not_created_links

    /**
     * Generate an array of attendances that a teacher hasn't created a link for.
     * @return array 2-dimensional array - every element contains 2 subelements (id, name)
     * @todo seems to be depracated
     */
    public function get_not_created_links()
    {
        return false;
        if (empty($this->course_code)) {
            die('Error in get_not_created_links() : course code not set');
        }
        $tbl_grade_links = Database::get_main_table(TABLE_MAIN_GRADEBOOK_LINK);
        $sql = 'SELECT att.id, att.name, att.attendance_qualify_title
				FROM ' . $this->get_attendance_table() . ' att
				WHERE
					att.c_id = ' . $this->course_id . ' AND
					att.id NOT IN (
						SELECT ref_id FROM ' . $tbl_grade_links . '
						WHERE
							type = ' . LINK_ATTENDANCE . ' AND
							course_code = "' . Database::escape_string($this->get_course_code()) . '"
					)
				AND att.session_id=' . api_get_session_id() . '';
        $result = Database::query($sql);
        $cats = array();
        while ($data = Database::fetch_array($result)) {
            if (isset($data['attendance_qualify_title']) && $data['attendance_qualify_title'] != '') {
                $cats[] = array($data['id'], $data['attendance_qualify_title']);
            } else {
                $cats[] = array($data['id'], $data['name']);
            }
        }
        return $cats;
    }
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:34,代码来源:attendancelink.class.php

示例13: get_class_data

/**
 * Get the classes to display on the current page.
 */
function get_class_data($from, $number_of_items, $column, $direction)
{
    $class_table = Database::get_main_table(TABLE_MAIN_CLASS);
    $course_class_table = Database::get_main_table(TABLE_MAIN_COURSE_CLASS);
    $class_user_table = Database::get_main_table(TABLE_MAIN_CLASS_USER);
    $sql = "SELECT * FROM {$course_class_table} WHERE course_code = '" . $_SESSION['_course']['id'] . "'";
    $res = Database::query($sql);
    $subscribed_classes = array();
    while ($obj = Database::fetch_object($res)) {
        $subscribed_classes[] = $obj->class_id;
    }
    $sql = "SELECT\n\t\t\t\t\t\t\tc.id AS col0,\n\t\t\t\t\t\t\tc.name   AS col1,\n\t\t\t\t\t\t\tCOUNT(cu.user_id) AS col2,\n\t\t\t\t\t\t\tc.id AS col3\n\t\t\t\t\t\tFROM {$class_table} c\n\t\t\t\t\t\t";
    $sql .= " LEFT JOIN {$class_user_table} cu ON cu.class_id = c.id";
    $sql .= " WHERE 1 = 1";
    if (isset($_GET['keyword'])) {
        $keyword = Database::escape_string(trim($_GET['keyword']));
        $sql .= " AND (c.name LIKE '%" . $keyword . "%')";
    }
    if (count($subscribed_classes) > 0) {
        $sql .= " AND c.id NOT IN ('" . implode("','", $subscribed_classes) . "')";
    }
    $sql .= " GROUP BY c.id, c.name ";
    $sql .= " ORDER BY col{$column} {$direction} ";
    $sql .= " LIMIT {$from},{$number_of_items}";
    $res = Database::query($sql);
    $classes = array();
    while ($class = Database::fetch_row($res)) {
        $classes[] = $class;
    }
    return $classes;
}
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:34,代码来源:subscribe_class.php

示例14: 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

示例15: getAllCategoriesAndUsers

/**
 * Get all categories and users ids from gradebook
 * @return array Categories and users ids
 */
function getAllCategoriesAndUsers()
{
    $table = Database::get_main_table(TABLE_MAIN_GRADEBOOK_RESULT);
    $jointable = Database::get_main_table(TABLE_MAIN_GRADEBOOK_EVALUATION);
    $joinStatement = ' JOIN ' . $jointable . ' ON ' . $table . '.evaluation_id = ' . $jointable . '.id';
    return Database::select('DISTINCT ' . $jointable . '.category_id,' . $table . '.user_id', $table . $joinStatement);
}
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:11,代码来源:add_gradebook_certificates.php


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