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


PHP Database::store_result方法代码示例

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


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

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

示例2: get_surveys

 /**
  *
  * @param type $course_code
  * @param type $session_id
  * @return type
  * @assert ('') === false
  */
 public static function get_surveys($course_code, $session_id = 0)
 {
     $table_survey = Database::get_course_table(TABLE_SURVEY);
     if (empty($course_code)) {
         return false;
     }
     $course_info = api_get_course_info($course_code);
     $session_condition = api_get_session_condition($session_id, true, true);
     $sql = "SELECT * FROM {$table_survey} WHERE c_id = {$course_info['real_id']} {$session_condition} ";
     $result = Database::query($sql);
     $result = Database::store_result($result, 'ASSOC');
     return $result;
 }
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:20,代码来源:survey.lib.php

示例3: reports_template_courseTime_getSQL

function reports_template_courseTime_getSQL()
{
    // fetch columns
    $result = array();
    $query = 'select r.id as kid, c.title as course ' . '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 is null and r.child_id is null' . ' order by c.title';
    $columns = Database::query($query);
    if (Database::num_rows($columns) == 0) {
        die('<b>' . get_lang('no data found: ' . $query) . '</b>');
    }
    $columns = Database::store_result($columns);
    // fetch data
    $query = 'select u.lastname Name, u.firstname Firstname';
    foreach ($columns as $key => $column) {
        $query .= ', sec_to_time(k' . $key . '.report_time) as `' . $column['course'] . '` ';
    }
    $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 ';
    }
    return $query;
}
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:22,代码来源:courseTime.reports.php

示例4: listZombies

 /**
  * 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 listZombies($ceiling, $active_only = true, $count = 0, $from = 10, $column = 'user.firstname', $direction = 'desc')
 {
     if (empty($column)) {
         $column = 'user.firstname';
     }
     $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';
     if (api_is_multiple_url_enabled()) {
         $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.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';
     }
     $count = intval($count);
     $from = intval($from);
     $sql .= " ORDER BY {$column} {$direction}";
     $sql .= " LIMIT {$count}, {$from} ";
     $result = Database::query($sql);
     return Database::store_result($result, 'ASSOC');
 }
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:44,代码来源:zombie_manager.class.php

示例5: ON

        $sql = "SELECT u.user_id,lastname,firstname,username, official_code\n                FROM " . $tbl_user . " u\n                INNER JOIN {$tbl_user_rel_access_url} user_rel_url\n                ON (user_rel_url.user_id = u.user_id)\n                WHERE\n                    u.user_id<>2 AND\n                    access_url_id =  {$access_url_id} AND\n                    (" . $target_name . " LIKE '" . $first_letter_user . "%' )\n                    {$where_filter}\n                ORDER BY " . (count($users) > 0 ? "(u.user_id IN(" . implode(',', $users) . ")) DESC," : "") . " " . $orderBy;
    }
}
$result = Database::query($sql);
$db_users = Database::store_result($result);
unset($result);
$sql = "SELECT code,visual_code,title\n        FROM {$tbl_course}\n        WHERE visual_code LIKE '" . $first_letter_course . "%'\n        ORDER BY " . (count($courses) > 0 ? "(code IN('" . implode("','", $courses) . "')) DESC," : "") . " visual_code";
if (api_is_multiple_url_enabled()) {
    $tbl_course_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
    $access_url_id = api_get_current_access_url_id();
    if ($access_url_id != -1) {
        $sql = "SELECT code, visual_code, title\n                FROM {$tbl_course} as course\n                INNER JOIN {$tbl_course_rel_access_url} course_rel_url\n                ON (course_rel_url.course_code= course.code)\n                WHERE\n                    access_url_id =  {$access_url_id}  AND\n                    (visual_code LIKE '" . $first_letter_course . "%' )\n                ORDER BY " . (count($courses) > 0 ? "(code IN('" . implode("','", $courses) . "')) DESC," : "") . " visual_code";
    }
}
$result = Database::query($sql);
$db_courses = Database::store_result($result);
unset($result);
if (api_is_multiple_url_enabled()) {
    $tbl_course_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
    $tbl_course_user = Database::get_main_table(TABLE_MAIN_COURSE_USER);
    $access_url_id = api_get_current_access_url_id();
    if ($access_url_id != -1) {
        $sqlNbCours = "\tSELECT course_rel_user.course_code, course.title\n            FROM {$tbl_course_user} as course_rel_user\n            INNER JOIN {$tbl_course} as course\n            ON course.code = course_rel_user.course_code\n            INNER JOIN {$tbl_course_rel_access_url} course_rel_url\n            ON (course_rel_url.course_code= course.code)\n            WHERE\n                access_url_id =  {$access_url_id}  AND\n                course_rel_user.user_id='" . $_user['user_id'] . "' AND\n                course_rel_user.status='1'\n            ORDER BY course.title";
    }
}
?>
<form name="formulaire" method="post" action="<?php 
echo api_get_self();
?>
" style="margin:0px;">
<?php 
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:31,代码来源:subscribe_user2course.php

示例6: get_categories_by_keyword

 /**
  *
  * Get categories by title for json calls
  * @param string $tag
  * @return array
  * @assert() === false
  */
 public function get_categories_by_keyword($tag)
 {
     if (empty($tag)) {
         return false;
     }
     $table = Database::get_course_table(TABLE_QUIZ_CATEGORY);
     $sql = "SELECT iid, title, c_id FROM {$table} WHERE 1=1 ";
     $tag = Database::escape_string($tag);
     $where_condition = array();
     if (!empty($tag)) {
         $condition = ' LIKE "%' . $tag . '%"';
         $where_condition = array("title {$condition}");
         $where_condition = ' AND  (' . implode(' OR ', $where_condition) . ') ';
     }
     switch ($this->type) {
         case 'simple':
             $course_condition = " AND c_id = '" . api_get_course_int_id() . "' ";
             break;
         case 'global':
             $course_condition = " AND c_id = '0' ";
             break;
         case 'all':
             $course_condition = " AND c_id IN ('0', '" . api_get_course_int_id() . "')";
             break;
     }
     $where_condition .= $course_condition;
     $order_clause = " ORDER BY title";
     $sql .= $where_condition . $order_clause;
     $result = Database::query($sql);
     if (Database::num_rows($result)) {
         return Database::store_result($result, 'ASSOC');
     }
     return false;
 }
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:41,代码来源:testcategory.class.php

示例7: WSSuscribeCoursesToSession

function WSSuscribeCoursesToSession($params)
{
    global $debug;
    if (!WSHelperVerifyKey($params)) {
        return return_error(WS_ERROR_SECRET_KEY);
    }
    if ($debug) {
        error_log('WSSuscribeCoursesToSession: ' . print_r($params, 1));
    }
    // initialisation
    $tbl_session_rel_course_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
    $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
    $tbl_session_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_USER);
    $tbl_session_rel_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
    $tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
    $coursessessions_params = $params['coursessessions'];
    $results = array();
    $orig_course_id_value = array();
    $orig_session_id_value = array();
    foreach ($coursessessions_params as $coursesession_param) {
        $original_session_id_value = $coursesession_param['original_session_id_value'];
        $original_session_id_name = $coursesession_param['original_session_id_name'];
        $original_course_id_name = $coursesession_param['original_course_id_name'];
        $original_course_id_values = $coursesession_param['original_course_id_values'];
        $orig_session_id_value[] = $original_session_id_value;
        $id_session = SessionManager::getSessionIdFromOriginalId($original_session_id_value, $original_session_id_name);
        if (empty($id_session)) {
            $results[] = 0;
            continue;
        }
        // Get course list from row_original_course_id_values
        $course_list = [];
        $courseCodeList = [];
        foreach ($original_course_id_values as $row_original_course_list) {
            $course_code = Database::escape_string($row_original_course_list['course_code']);
            $courseInfo = api_get_course_info($course_code);
            $courseId = $courseInfo['real_id'];
            $courseInfo = CourseManager::getCourseInfoFromOriginalId($course_code, $original_course_id_name);
            if (empty($courseInfo) || isset($courseInfo) && $courseInfo['visibility'] == 0) {
                $results[] = 0;
                continue;
                // Original_course_id_value doesn't exist.
            }
            $courseCodeList[] = $courseInfo['code'];
            $course_list[] = $courseInfo['real_id'];
        }
        if (empty($course_list)) {
            $results[] = 0;
            continue;
        }
        $orig_course_id_value[] = implode(',', $courseCodeList);
        // Get general coach ID
        $sql = "SELECT id_coach FROM {$tbl_session} WHERE id='{$id_session}'";
        $id_coach = Database::query($sql);
        $id_coach = Database::fetch_array($id_coach);
        $id_coach = $id_coach[0];
        // get list of courses subscribed to this session
        $sql = "SELECT c_id FROM {$tbl_session_rel_course} WHERE session_id ='{$id_session}'";
        $rs = Database::query($sql);
        $existingCourses = Database::store_result($rs);
        $nbr_courses = count($existingCourses);
        // get list of users subscribed to this session
        $sql = "SELECT user_id FROM {$tbl_session_rel_user}\n               WHERE session_id = '{$id_session}' AND relation_type<>" . SESSION_RELATION_TYPE_RRHH . "";
        $result = Database::query($sql);
        $user_list = Database::store_result($result);
        $course_directory = array();
        // Pass through the courses list we want to add to the session.
        foreach ($course_list as $enreg_course) {
            $enreg_course = Database::escape_string($enreg_course);
            $exists = false;
            // Check if the course we want to add is already subscribed.
            foreach ($existingCourses as $existingCourse) {
                if ($enreg_course == $existingCourse['c_id']) {
                    $exists = true;
                }
            }
            if (!$exists) {
                // if the course isn't subscribed yet
                $sql = "INSERT INTO {$tbl_session_rel_course} (session_id, c_id)\n                        VALUES ('{$id_session}','{$enreg_course}')";
                Database::query($sql);
                Event::addEvent(LOG_SESSION_ADD_COURSE, LOG_COURSE_ID, $enreg_course, api_get_utc_datetime(), api_get_user_id(), $enreg_course, $id_session);
                // We add the current course in the existing courses array,
                // to avoid adding another time the current course
                $existingCourses[] = array('c_id' => $enreg_course);
                $nbr_courses++;
                // subscribe all the users from the session to this course inside the session
                $nbr_users = 0;
                foreach ($user_list as $enreg_user) {
                    $enreg_user_id = Database::escape_string($enreg_user['user_id']);
                    $sql = "INSERT IGNORE INTO {$tbl_session_rel_course_rel_user} (session_id, c_id, user_id)\n                            VALUES ('{$id_session}','{$enreg_course}','{$enreg_user_id}')";
                    Event::addEvent(LOG_SESSION_ADD_USER_COURSE, LOG_USER_ID, $enreg_user_id, api_get_utc_datetime(), api_get_user_id(), $enreg_course, $id_session);
                    $result = Database::query($sql);
                    if (Database::affected_rows($result)) {
                        $nbr_users++;
                    }
                }
                $sql = "UPDATE {$tbl_session_rel_course} SET\n                            nbr_users = {$nbr_users}\n                        WHERE session_id='{$id_session}' AND c_id='{$enreg_course}'";
                Database::query($sql);
                $sql_directory = "SELECT directory FROM {$tbl_course} WHERE id = '{$enreg_course}'";
                $res_directory = Database::query($sql_directory);
//.........这里部分代码省略.........
开发者ID:secuencia24,项目名称:chamilo-lms,代码行数:101,代码来源:registration.soap.php

示例8: getAllValuesByItemAndFieldAndValue

 /**
  * @param int $itemId
  * @param int $fieldId
  * @param string $fieldValue
  * @return array|bool
  */
 public function getAllValuesByItemAndFieldAndValue($itemId, $fieldId, $fieldValue)
 {
     $fieldId = intval($fieldId);
     $itemId = intval($itemId);
     $extraFieldType = $this->getExtraField()->getExtraFieldType();
     $fieldValue = Database::escape_string($fieldValue);
     $sql = "SELECT s.* FROM {$this->table} s\n                INNER JOIN {$this->table_handler_field} sf\n                ON (s.field_id = sf.id)\n                WHERE\n                    field_id = '{$fieldId}' AND\n                    item_id = '{$itemId}' AND\n                    value = '{$fieldValue}' AND\n                    sf.extra_field_type = {$extraFieldType}\n                ORDER BY value";
     $result = Database::query($sql);
     if (Database::num_rows($result)) {
         return Database::store_result($result, 'ASSOC');
     }
     return false;
 }
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:19,代码来源:extra_field_value.lib.php

示例9: getGroupListFilterByName

 /**
  * @param int $courseId
  * @param int $categoryId
  * @param string $name
  * @return array
  */
 public static function getGroupListFilterByName($name, $categoryId, $courseId)
 {
     $name = trim($name);
     if (empty($name)) {
         return array();
     }
     $name = Database::escape_string($name);
     $courseId = intval($courseId);
     $table_group = Database::get_course_table(TABLE_GROUP);
     $sql = "SELECT * FROM {$table_group}\n                WHERE c_id = {$courseId} AND name LIKE '%{$name}%'";
     if (!empty($categoryId)) {
         $categoryId = intval($categoryId);
         $sql .= " AND category_id = {$categoryId}";
     }
     $sql .= " ORDER BY name";
     $result = Database::query($sql);
     return Database::store_result($result, 'ASSOC');
 }
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:24,代码来源:groupmanager.lib.php

示例10: searchCategoryById

 /**
  * @param array $list
  * @return array
  */
 function searchCategoryById($list)
 {
     if (empty($list)) {
         return array();
     } else {
         $list = array_map('intval', $list);
         $list = implode("','", $list);
     }
     $tableCategory = Database::get_main_table(TABLE_MAIN_CATEGORY);
     $conditions = null;
     $whereCondition = null;
     if (self::isMultipleUrlSupport()) {
         $table = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE_CATEGORY);
         $conditions = " INNER JOIN {$table} a ON (c.id = a.course_category_id)";
         $whereCondition = " AND a.access_url_id = " . api_get_current_access_url_id();
     }
     $sql = "SELECT c.*, c.name as text FROM {$tableCategory} c {$conditions}\n                WHERE c.id IN {$list} {$whereCondition}";
     $result = Database::query($sql);
     return Database::store_result($result, 'ASSOC');
 }
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:24,代码来源:course_category.lib.php

示例11: clean_results

 /**
  * Cleans the student's results only for the Exercise tool (Not from the LP)
  * The LP results are NOT deleted by default, otherwise put $cleanLpTests = true
  * Works with exercises in sessions
  * @param bool $cleanLpTests
  * @param string $cleanResultBeforeDate
  *
  * @return int quantity of user's exercises deleted
  */
 public function clean_results($cleanLpTests = false, $cleanResultBeforeDate = null)
 {
     $table_track_e_exercises = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES);
     $table_track_e_attempt = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
     $sql_where = '  AND
                     orig_lp_id = 0 AND
                     orig_lp_item_id = 0';
     // if we want to delete results from LP too
     if ($cleanLpTests) {
         $sql_where = "";
     }
     // if we want to delete attempts before date $cleanResultBeforeDate
     // $cleanResultBeforeDate must be a valid UTC-0 date yyyy-mm-dd
     if (!empty($cleanResultBeforeDate)) {
         $cleanResultBeforeDate = Database::escape_string($cleanResultBeforeDate);
         if (api_is_valid_date($cleanResultBeforeDate)) {
             $sql_where .= "  AND exe_date <= '{$cleanResultBeforeDate}' ";
         } else {
             return 0;
         }
     }
     $sql = "SELECT exe_id\n                FROM {$table_track_e_exercises}\n                WHERE\n                    c_id = " . api_get_course_int_id() . " AND\n                    exe_exo_id = " . $this->id . " AND\n                    session_id = " . api_get_session_id() . " " . $sql_where;
     $result = Database::query($sql);
     $exe_list = Database::store_result($result);
     // deleting TRACK_E_ATTEMPT table
     // check if exe in learning path or not
     $i = 0;
     if (is_array($exe_list) && count($exe_list) > 0) {
         foreach ($exe_list as $item) {
             $sql = "DELETE FROM {$table_track_e_attempt}\n                        WHERE exe_id = '" . $item['exe_id'] . "'";
             Database::query($sql);
             $i++;
         }
     }
     $session_id = api_get_session_id();
     // delete TRACK_E_EXERCISES table
     $sql = "DELETE FROM {$table_track_e_exercises}\n                WHERE c_id = " . api_get_course_int_id() . "\n                AND exe_exo_id = " . $this->id . "\n                {$sql_where}\n                AND session_id = " . $session_id . "";
     Database::query($sql);
     Event::addEvent(LOG_EXERCISE_RESULT_DELETE, LOG_EXERCISE_ID, $this->id, null, null, api_get_course_int_id(), $session_id);
     return $i;
 }
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:50,代码来源:exercise.class.php

示例12: list

 $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
 $tbl_session_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
 $tbl_user = Database::get_main_table(TABLE_MAIN_USER);
 $tbl_chat_connected = Database::get_course_table(TABLE_CHAT_CONNECTED);
 $query = "SELECT username FROM {$tbl_user} WHERE user_id='" . $user_id . "'";
 $result = Database::query($query);
 list($pseudo_user) = Database::fetch_array($result);
 $isAllowed = !(empty($pseudo_user) || !$_cid);
 $isMaster = api_is_course_admin();
 $date_inter = api_get_utc_datetime(time() - 120);
 $users = array();
 $course_id = api_get_course_int_id();
 if (empty($session_id)) {
     $sql = "SELECT DISTINCT\n\t\t            t1.user_id,\n\t\t            username,\n\t\t            firstname,\n\t\t            lastname,\n\t\t            picture_uri,\n\t\t            email,\n\t\t            t3.status\n                FROM {$tbl_user} t1, {$tbl_chat_connected} t2, {$tbl_course_user} t3\n                WHERE\n                    t2.c_id = {$course_id} AND\n                    t1.user_id=t2.user_id AND\n                    t3.user_id=t2.user_id AND\n                    t3.relation_type<>" . COURSE_RELATION_TYPE_RRHH . " AND\n                    t3.c_id = '" . $courseInfo['real_id'] . "' AND\n                    t2.last_connection>'" . $date_inter . "' {$extra_condition}\n                ORDER BY username";
     $result = Database::query($sql);
     $users = Database::store_result($result);
 } else {
     $session_condition = api_get_session_condition($session_id, true, false, 't3.session_id');
     // select learners
     $query = "SELECT DISTINCT t1.user_id,username,firstname,lastname,picture_uri,email\n                  FROM {$tbl_user} t1, {$tbl_chat_connected} t2, {$tbl_session_course_user} t3\n\t\t          WHERE\n\t\t          t2.c_id = {$course_id} AND\n\t\t          t1.user_id=t2.user_id AND t3.user_id=t2.user_id AND\n\t\t          t3.session_id = '" . $session_id . "' AND\n\t\t          t3.c_id = '" . $courseInfo['real_id'] . "' AND\n\t\t          t2.last_connection>'" . $date_inter . "' {$session_condition}\n\t\t          ORDER BY username";
     $result = Database::query($query);
     while ($learner = Database::fetch_array($result)) {
         $users[$learner['user_id']] = $learner;
     }
     // select session coach
     $query = "SELECT DISTINCT t1.user_id,username,firstname,lastname,picture_uri,email\n\t\t          FROM {$tbl_user} t1,{$tbl_chat_connected} t2,{$tbl_session} t3\n\t\t          WHERE\n\t\t\t\t\tt2.c_id = {$course_id} AND\n\t\t\t\t\tt1.user_id=t2.user_id AND\n\t\t\t\t\tt3.id_coach=t2.user_id AND\n\t\t\t\t\tt3.id = '" . $session_id . "' AND\n\t\t\t\t\tt2.last_connection > '" . $date_inter . "'\n\t\t\t\t\t{$extra_condition}\n\t\t\t\t  ORDER BY username";
     $result = Database::query($query);
     if ($coach = Database::fetch_array($result)) {
         $users[$coach['user_id']] = $coach;
     }
     // select session course coach
开发者ID:secuencia24,项目名称:chamilo-lms,代码行数:31,代码来源:chat_whoisonline.php

示例13: trim

    if (isset($_POST['link'][$row['id']])) {
        //$new_weight = trim($_POST['link'][$row['id']]*$original_total/$masked_total);
        $new_weight = trim($_POST['link'][$row['id']]);
        GradebookUtils::updateLinkWeight($row['id'], $resource_name, $new_weight);
        $item_weight = $new_weight;
    }
    $output .= '<tr><td>' . GradebookUtils::build_type_icon_tag($row['type']) . '</td>
               <td> ' . $resource_name . ' ' . Display::label($table_evaluated[$row['type']][3], 'info') . ' </td>';
    $output .= '<td>
                    <input type="hidden" name="link_' . $row['id'] . '" value="' . $resource_name . '" />
                    <input size="10" type="text" name="link[' . $row['id'] . ']" value="' . $item_weight . '"/>
               </td></tr>';
}
$sql = 'SELECT * FROM ' . $table_evaluation . ' WHERE category_id = ' . $my_selectcat;
$result = Database::query($sql);
$evaluations = Database::store_result($result);
foreach ($evaluations as $evaluationRow) {
    $item_weight = $evaluationRow['weight'];
    //$item_weight = $masked_total*$item_weight/$original_total;
    //update only if value changed
    if (isset($_POST['evaluation'][$evaluationRow['id']])) {
        //$new_weight = trim($_POST['evaluation'][$evaluationRow['id']]*$original_total/$masked_total);
        $new_weight = trim($_POST['evaluation'][$evaluationRow['id']]);
        GradebookUtils::updateEvaluationWeight($evaluationRow['id'], $new_weight);
        $item_weight = $new_weight;
    }
    $output .= '<tr>
                <td>' . GradebookUtils::build_type_icon_tag('evalnotempty') . '</td>
                <td>' . $evaluationRow['name'] . ' ' . Display::label(get_lang('Evaluation')) . '</td>';
    $output .= '<td>
                    <input type="hidden" name="eval_' . $evaluationRow['id'] . '" value="' . $evaluationRow['name'] . '" />
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:31,代码来源:gradebook_edit_all.php

示例14: init_course


//.........这里部分代码省略.........
             //Check if user is subscribed in a course
             $course_user_table = Database::get_main_table(TABLE_MAIN_COURSE_USER);
             $sql = "SELECT * FROM {$course_user_table}\n                       WHERE\n                        user_id  = '" . $user_id . "' AND\n                        relation_type <> " . COURSE_RELATION_TYPE_RRHH . " AND\n                        course_code = '{$course_id}'";
             $result = Database::query($sql);
             $cuData = null;
             if (Database::num_rows($result) > 0) {
                 // this  user have a recorded state for this course
                 $cuData = Database::fetch_array($result, 'ASSOC');
                 $is_courseAdmin = (bool) $cuData['status'] == 1;
                 $is_courseTutor = (bool) $cuData['is_tutor'] == 1;
                 $is_courseMember = true;
                 // Checking if the user filled the course legal agreement
                 if ($_course['activate_legal'] == 1 && !api_is_platform_admin()) {
                     $user_is_subscribed = CourseManager::is_user_accepted_legal($user_id, $_course['id'], $session_id);
                     if (!$user_is_subscribed) {
                         $url = api_get_path(WEB_CODE_PATH) . 'course_info/legal.php?course_code=' . $_course['code'] . '&session_id=' . $session_id;
                         header('Location: ' . $url);
                         exit;
                     }
                 }
             }
             //We are in a session course? Check session permissions
             if (!empty($session_id)) {
                 //I'm not the teacher of the course
                 if ($is_courseAdmin == false) {
                     // this user has no status related to this course
                     // The user is subscribed in a session? The user is a Session coach a Session admin ?
                     $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
                     $tbl_session_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
                     $tbl_session_course_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
                     //Session coach, session admin, course coach admin
                     $sql = "SELECT session.id_coach, session_admin_id, session_rcru.user_id\n                                FROM {$tbl_session} session, {$tbl_session_course_user} session_rcru\n                                WHERE\n                                   session_rcru.session_id = session.id AND\n                                   session_rcru.c_id = '{$_real_cid}' AND\n                                   session_rcru.user_id = '{$user_id}' AND\n                                   session_rcru.session_id  = {$session_id} AND\n                                   session_rcru.status = 2";
                     $result = Database::query($sql);
                     $row = Database::store_result($result);
                     //I'm a session admin?
                     if (isset($row) && isset($row[0]) && $row[0]['session_admin_id'] == $user_id) {
                         $is_courseMember = false;
                         $is_courseTutor = false;
                         $is_courseAdmin = false;
                         $is_courseCoach = false;
                         $is_sessionAdmin = true;
                     } else {
                         //Im a coach or a student?
                         $sql = "SELECT user_id, status\n                                    FROM " . $tbl_session_course_user . "\n                                    WHERE\n                                        c_id = '{$_cid}' AND\n                                        user_id = '" . $user_id . "' AND\n                                        session_id = '" . $session_id . "'\n                                    LIMIT 1";
                         $result = Database::query($sql);
                         if (Database::num_rows($result)) {
                             $row = Database::fetch_array($result, 'ASSOC');
                             $session_course_status = $row['status'];
                             switch ($session_course_status) {
                                 case '2':
                                     // coach - teacher
                                     $is_courseMember = true;
                                     $is_courseTutor = true;
                                     $is_courseCoach = true;
                                     $is_sessionAdmin = false;
                                     if (api_get_setting('extend_rights_for_coach') == 'true') {
                                         $is_courseAdmin = true;
                                     } else {
                                         $is_courseAdmin = false;
                                     }
                                     break;
                                 case '0':
                                     //student
                                     $is_courseMember = true;
                                     $is_courseTutor = false;
                                     $is_courseAdmin = false;
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:67,代码来源:login.lib.php

示例15: api_get_user_info

if (!empty($_GET['msg'])) {
    Display::display_normal_message(urldecode($_GET['msg']));
}
// the form header
$session_info = SessionManager::fetch($id_session);
$user_info = api_get_user_info($id_user);
echo '<legend>' . $tool_name . ': ' . $session_info['name'] . ' - ' . $user_info['complete_name'] . '</legend>';
$nosessionCourses = $sessionCourses = array();
// actual user
$sql = "SELECT course.id, course.code, title, visual_code, srcru.id_session\n        FROM {$tbl_course} course INNER JOIN {$tbl_session_rel_course_rel_user} as srcru\n        ON course.id = srcru.c_id\n        WHERE srcru.id_user = {$id_user} AND id_session = {$id_session}";
//all
$sql_all = "SELECT course.id, code, title, visual_code, src.id_session " . "FROM {$tbl_course} course INNER JOIN {$tbl_session_rel_course}  as src  " . "ON course.id = src.c_id AND id_session = {$id_session}";
$result = Database::query($sql);
$Courses = Database::store_result($result);
$result = Database::query($sql_all);
$CoursesAll = Database::store_result($result);
$course_temp = array();
foreach ($Courses as $course) {
    $course_temp[] = $course['id'];
}
foreach ($CoursesAll as $course) {
    if (in_array($course['id'], $course_temp)) {
        $nosessionCourses[$course['id']] = $course;
    } else {
        $sessionCourses[$course['id']] = $course;
    }
}
unset($Courses);
?>

<form name="formulaire" method="post" action="<?php 
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:31,代码来源:session_course_user.php


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