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


PHP Database::fetch_row方法代码示例

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


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

示例1: UpdateSettings

function UpdateSettings($setting, $val, $type = '')
{
    global $server, $user, $pass, $database, $pre;
    if (empty($type)) {
        $type = 'admin';
    }
    //Connect to database
    require_once "sources/class.database.php";
    $db = new Database($server, $user, $pass, $database, $pre);
    $db->connect();
    //Check if setting is already in DB. If NO then insert, if YES then update.
    $data = $db->fetch_row("SELECT COUNT(*) FROM " . $pre . "misc WHERE type='" . $type . "' AND intitule = '" . $setting . "'");
    if ($data[0] == 0) {
        $db->query_insert("misc", array('valeur' => $val, 'type' => $type, 'intitule' => $setting));
        //in case of stats enabled, add the actual time
        if ($setting == 'send_stats') {
            $db->query_insert("misc", array('valeur' => time(), 'type' => $type, 'intitule' => $setting . '_time'));
        }
    } else {
        $db->query_update("misc", array('valeur' => $val), "type='" . $type . "' AND intitule = '" . $setting . "'");
        //in case of stats enabled, update the actual time
        if ($setting == 'send_stats') {
            //Check if previous time exists, if not them insert this value in DB
            $data_time = $db->fetch_row("SELECT COUNT(*) FROM " . $pre . "misc WHERE type='" . $type . "' AND intitule = '" . $setting . "_time'");
            if ($data_time[0] == 0) {
                $db->query_insert("misc", array('valeur' => 0, 'type' => $type, 'intitule' => $setting . '_time'));
            } else {
                $db->query_update("misc", array('valeur' => 0), "type='" . $type . "' AND intitule = '" . $setting . "_time'");
            }
        }
    }
    //save in variable
    if ($type == "admin") {
        $_SESSION['settings'][$setting] = $val;
    } else {
        if ($type == "settings") {
            $settings[$setting] = $val;
        }
    }
}
开发者ID:omusico,项目名称:isle-web-framework,代码行数:40,代码来源:admin.settings.php

示例2: get_view_url

 /**
  *
  * Returns the URL of a document
  * This function is loaded when using a gradebook as a tab (gradebook = -1) see issue #2705
  */
 public function get_view_url($stud_id)
 {
     // find a file uploaded by the given student,
     // with the same title as the evaluation name
     $eval = $this->get_evaluation();
     $sql = 'SELECT filename FROM ' . $this->get_dropbox_table() . ' WHERE c_id = ' . $this->course_id . ' AND uploader_id = ' . intval($stud_id) . " AND title = '" . Database::escape_string($eval->get_name()) . "'";
     $result = Database::query($sql);
     if ($fileurl = Database::fetch_row($result)) {
         return null;
     } else {
         return null;
     }
 }
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:18,代码来源:dropboxlink.class.php

示例3: get_request_data

/**
 * Get course data to display
 */
function get_request_data($from, $number_of_items, $column, $direction)
{
    global $keyword;
    $course_request_table = Database::get_main_table(TABLE_MAIN_COURSE_REQUEST);
    $sql = "SELECT id AS col0,\n                   code AS col1,\n                   title AS col2,\n                   category_code AS col3,\n                   tutor_name AS col4,\n                   request_date AS col5,\n                   id  AS col6\n                   FROM {$course_request_table}\n           WHERE status = " . COURSE_REQUEST_ACCEPTED;
    if ($keyword != '') {
        $sql .= " AND (title LIKE '%" . $keyword . "%' OR code LIKE '%" . $keyword . "%' OR visual_code LIKE '%" . $keyword . "%')";
    }
    $sql .= " ORDER BY col{$column} {$direction} ";
    $sql .= " LIMIT {$from},{$number_of_items}";
    $res = Database::query($sql);
    $course_requests = array();
    while ($course_request = Database::fetch_row($res)) {
        $course_request[5] = api_get_local_time($course_request[5]);
        $course_requests[] = $course_request;
    }
    return $course_requests;
}
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:21,代码来源:course_request_accepted.php

示例4: get_class_data

/**
 * Gets the information about some classes.
 * @param int $from
 * @param int $number_of_items
 * @param string $direction
 */
function get_class_data($from, $number_of_items, $column, $direction)
{
    $tbl_class_user = Database::get_main_table(TABLE_MAIN_CLASS_USER);
    $tbl_class = Database::get_main_table(TABLE_MAIN_CLASS);
    $from = Database::escape_string($from);
    $number_of_items = Database::escape_string($number_of_items);
    $column = Database::escape_string($column);
    $direction = Database::escape_string($direction);
    $sql = "SELECT \tid AS col0, name AS col1, COUNT(user_id) AS col2, id AS col3\n        FROM {$tbl_class}\n            LEFT JOIN {$tbl_class_user} ON id=class_id ";
    if (isset($_GET['keyword'])) {
        $sql .= " WHERE (name LIKE '%" . Database::escape_string(trim($_GET['keyword'])) . "%')";
    }
    $sql .= " GROUP BY id,name ORDER BY col{$column} {$direction} LIMIT {$from},{$number_of_items}";
    $res = Database::query($sql);
    $classes = array();
    while ($class = Database::fetch_row($res)) {
        $classes[] = $class;
    }
    return $classes;
}
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:26,代码来源:class_list.php

示例5: get_request_data

/**
 * Get course data to display
 */
function get_request_data($from, $number_of_items, $column, $direction)
{
    $keyword = isset($_GET['keyword']) ? Database::escape_string(trim($_GET['keyword'])) : null;
    $course_request_table = Database::get_main_table(TABLE_MAIN_COURSE_REQUEST);
    $from = intval($from);
    $number_of_items = intval($number_of_items);
    $column = intval($column);
    $direction = !in_array(strtolower(trim($direction)), ['asc', 'desc']) ? 'asc' : $direction;
    $sql = "SELECT\n                id AS col0,\n               code AS col1,\n               title AS col2,\n               category_code AS col3,\n               tutor_name AS col4,\n               request_date AS col5,\n               id  AS col6\n           FROM {$course_request_table}\n           WHERE status = " . COURSE_REQUEST_ACCEPTED;
    if ($keyword != '') {
        $sql .= " AND (\n                title LIKE '%" . $keyword . "%' OR\n                code LIKE '%" . $keyword . "%' OR\n                visual_code LIKE '%" . $keyword . "%'\n            )";
    }
    $sql .= " ORDER BY col{$column} {$direction} ";
    $sql .= " LIMIT {$from},{$number_of_items}";
    $res = Database::query($sql);
    $course_requests = array();
    while ($course_request = Database::fetch_row($res)) {
        $course_request[5] = api_get_local_time($course_request[5]);
        $course_requests[] = $course_request;
    }
    return $course_requests;
}
开发者ID:jloguercio,项目名称:chamilo-lms,代码行数:25,代码来源:course_request_accepted.php

示例6: browseCoursesInCategory

 /**
  * @param string $category_code
  * @param int $random_value
  * @param array $limit will be used if $random_value is not set.
  * This array should contains 'start' and 'length' keys
  * @return array
  */
 function browseCoursesInCategory($category_code, $random_value = null, $limit = array())
 {
     $tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
     $specialCourseList = CourseManager::get_special_course_list();
     $without_special_courses = '';
     if (!empty($specialCourseList)) {
         $without_special_courses = ' AND course.code NOT IN (' . implode(',', $specialCourseList) . ')';
     }
     $visibilityCondition = null;
     $hidePrivate = api_get_setting('platform.course_catalog_hide_private');
     if ($hidePrivate === 'true') {
         $courseInfo = api_get_course_info();
         $courseVisibility = $courseInfo['visibility'];
         $visibilityCondition = ' AND course.visibility <> 1';
     }
     if (!empty($random_value)) {
         $random_value = intval($random_value);
         $sql = "SELECT COUNT(*) FROM {$tbl_course}";
         $result = Database::query($sql);
         list($num_records) = Database::fetch_row($result);
         if (api_is_multiple_url_enabled()) {
             $url_access_id = api_get_current_access_url_id();
             $tbl_url_rel_course = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
             $sql = "SELECT COUNT(*) FROM {$tbl_course} course\n                        INNER JOIN {$tbl_url_rel_course} as url_rel_course\n                        ON (url_rel_course.c_id = course.id)\n                        WHERE access_url_id = {$url_access_id} ";
             $result = Database::query($sql);
             list($num_records) = Database::fetch_row($result);
             $sql = "SELECT course.id FROM {$tbl_course} course\n                        INNER JOIN {$tbl_url_rel_course} as url_rel_course\n                        ON (url_rel_course.c_id = course.id)\n                        WHERE\n                            access_url_id = {$url_access_id} AND\n                            RAND()*{$num_records}< {$random_value}\n                            {$without_special_courses} {$visibilityCondition}\n                        ORDER BY RAND()\n                        LIMIT 0, {$random_value}";
         } else {
             $sql = "SELECT id FROM {$tbl_course} course\n                        WHERE RAND()*{$num_records}< {$random_value} {$without_special_courses} {$visibilityCondition}\n                        ORDER BY RAND()\n                        LIMIT 0, {$random_value}";
         }
         $result = Database::query($sql);
         $id_in = null;
         while (list($id) = Database::fetch_row($result)) {
             if ($id_in) {
                 $id_in .= ",{$id}";
             } else {
                 $id_in = "{$id}";
             }
         }
         if ($id_in === null) {
             return array();
         }
         $sql = "SELECT * FROM {$tbl_course} WHERE id IN({$id_in})";
     } else {
         $limitFilter = self::getLimitFilterFromArray($limit);
         $category_code = Database::escape_string($category_code);
         if (empty($category_code) || $category_code == "ALL") {
             $sql = "SELECT * FROM {$tbl_course}\n                        WHERE\n                            1=1\n                            {$without_special_courses}\n                            {$visibilityCondition}\n                        ORDER BY title {$limitFilter} ";
         } else {
             if ($category_code == 'NONE') {
                 $category_code = '';
             }
             $sql = "SELECT * FROM {$tbl_course}\n                        WHERE\n                            category_code='{$category_code}'\n                            {$without_special_courses}\n                            {$visibilityCondition}\n                        ORDER BY title {$limitFilter} ";
         }
         //showing only the courses of the current Chamilo access_url_id
         if (api_is_multiple_url_enabled()) {
             $url_access_id = api_get_current_access_url_id();
             $tbl_url_rel_course = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
             if ($category_code != "ALL") {
                 $sql = "SELECT * FROM {$tbl_course} as course\n                            INNER JOIN {$tbl_url_rel_course} as url_rel_course\n                            ON (url_rel_course.c_id = course.id)\n                            WHERE\n                                access_url_id = {$url_access_id} AND\n                                category_code='{$category_code}'\n                                {$without_special_courses}\n                                {$visibilityCondition}\n                            ORDER BY title {$limitFilter}";
             } else {
                 $sql = "SELECT * FROM {$tbl_course} as course\n                            INNER JOIN {$tbl_url_rel_course} as url_rel_course\n                            ON (url_rel_course.c_id = course.id)\n                            WHERE\n                                access_url_id = {$url_access_id}\n                                {$without_special_courses}\n                                {$visibilityCondition}\n                            ORDER BY title {$limitFilter}";
             }
         }
     }
     $result = Database::query($sql);
     $courses = array();
     while ($row = Database::fetch_array($result)) {
         $row['registration_code'] = !empty($row['registration_code']);
         $count_users = CourseManager::get_users_count_in_course($row['code']);
         $count_connections_last_month = Tracking::get_course_connections_count($row['id'], 0, api_get_utc_datetime(time() - 30 * 86400));
         if ($row['tutor_name'] == '0') {
             $row['tutor_name'] = get_lang('NoManager');
         }
         $point_info = CourseManager::get_course_ranking($row['id'], 0);
         $courses[] = array('real_id' => $row['id'], 'point_info' => $point_info, 'code' => $row['code'], 'directory' => $row['directory'], 'visual_code' => $row['visual_code'], 'title' => $row['title'], 'tutor' => $row['tutor_name'], 'subscribe' => $row['subscribe'], 'unsubscribe' => $row['unsubscribe'], 'registration_code' => $row['registration_code'], 'creation_date' => $row['creation_date'], 'visibility' => $row['visibility'], 'count_users' => $count_users, 'count_connections' => $count_connections_last_month);
     }
     return $courses;
 }
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:86,代码来源:course_category.lib.php

示例7: put_link

 /**
  * CSV file import functions
  * @author René Haentjens , Ghent University
  */
 public static function put_link($url, $cat, $title, $description, $on_homepage, $hidden)
 {
     $tbl_link = Database::get_course_table(TABLE_LINK);
     $course_id = api_get_course_int_id();
     $urleq = "url='" . Database::escape_string($url) . "'";
     $cateq = "category_id=" . intval($cat);
     $result = Database::query("SELECT id FROM {$tbl_link}\n            WHERE c_id = {$course_id} AND " . $urleq . ' AND ' . $cateq);
     if (Database::num_rows($result) >= 1 && ($row = Database::fetch_array($result))) {
         Database::query("UPDATE {$tbl_link} set title='" . Database::escape_string($title) . "', description='" . Database::escape_string($description) . "'\n                WHERE c_id = {$course_id} AND  id='" . Database::escape_string($row['id']) . "'");
         $ipu = 'LinkUpdated';
         $rv = 1;
         // 1 = upd
     } else {
         // Add new link
         $result = Database::query("SELECT MAX(display_order) FROM  {$tbl_link}\n                WHERE c_id = {$course_id} AND category_id='" . intval($cat) . "'");
         list($max_order) = Database::fetch_row($result);
         Database::query("INSERT INTO {$tbl_link} (c_id, url, title, description, category_id, display_order, on_homepage)\n                VALUES (" . api_get_course_int_id() . ",\n                '" . Database::escape_string($url) . "',\n                '" . Database::escape_string($title) . "',\n                '" . Database::escape_string($description) . "',\n                '" . intval($cat) . "','" . (intval($max_order) + 1) . "',\n                '" . intval($on_homepage) . "')");
         $id = Database::insert_id();
         $ipu = 'LinkAdded';
         $rv = 2;
         // 2 = new
     }
     global $_course, $nameTools, $_user;
     api_item_property_update($_course, TOOL_LINK, $id, $ipu, $_user['user_id']);
     if ($hidden && $ipu == 'LinkAdded') {
         api_item_property_update($_course, TOOL_LINK, $id, 'invisible', $_user['user_id']);
     }
     return $rv;
 }
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:33,代码来源:link.lib.php

示例8: api_strtotime

 $sql = 'SELECT start_date, exe_date, exe_result, exe_weighting, exe_exo_id
         FROM ' . $TBL_TRACK_EXERCICES . '
         WHERE exe_id = ' . $safe_exe_id;
 $res = Database::query($sql);
 $row_dates = Database::fetch_array($res);
 $time_start_date = api_strtotime($row_dates['start_date'], 'UTC');
 $time_exe_date = api_strtotime($row_dates['exe_date'], 'UTC');
 $mytime = (int) $time_exe_date - (int) $time_start_date;
 $score = (double) $row_dates['exe_result'];
 $max_score = (double) $row_dates['exe_weighting'];
 $sql = "UPDATE {$TBL_LP_ITEM} SET\n                    max_score = '{$max_score}'\n                WHERE c_id = {$course_id} AND id = '" . $safe_item_id . "'";
 Database::query($sql);
 $sql = "SELECT id FROM {$TBL_LP_ITEM_VIEW}\n                WHERE\n                    c_id = {$course_id} AND\n                    lp_item_id = '{$safe_item_id}' AND\n                    lp_view_id = '" . $learnPath->lp_view_id . "'\n                ORDER BY id DESC\n                LIMIT 1";
 $res_last_attempt = Database::query($sql);
 if (Database::num_rows($res_last_attempt) && !api_is_invitee()) {
     $row_last_attempt = Database::fetch_row($res_last_attempt);
     $lp_item_view_id = $row_last_attempt[0];
     $exercise = new Exercise(api_get_course_int_id());
     $exercise->read($row_dates['exe_exo_id']);
     $status = 'completed';
     if (!empty($exercise->pass_percentage)) {
         $status = 'failed';
         $success = ExerciseLib::is_success_exercise_result($score, $max_score, $exercise->pass_percentage);
         if ($success) {
             $status = 'passed';
         }
     }
     $sql = "UPDATE {$TBL_LP_ITEM_VIEW} SET\n                        status = '{$status}',\n                        score = {$score},\n                        total_time = {$mytime}\n                    WHERE id='" . $lp_item_view_id . "' AND c_id = {$course_id} ";
     if ($debug) {
         error_log($sql);
     }
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:31,代码来源:lp_view.php

示例9: ucfirst

 $extraFieldInfo = $extraField->get_handler_field_info_by_field_variable($field_variable);
 if ($extraFieldInfo['visible'] != 1) {
     continue;
 }
 if (is_array($data)) {
     $extra_information_value .= '<dt>' . ucfirst($extraFieldInfo['display_text']) . '</dt>' . '<dd> ' . implode(',', $data) . '</dd>';
 } else {
     switch ($extraFieldInfo['field_type']) {
         case ExtraField::FIELD_TYPE_DOUBLE_SELECT:
             $id_options = explode(';', $data);
             $value_options = array();
             // get option display text from user_field_options table
             foreach ($id_options as $id_option) {
                 $sql = "SELECT display_text FROM {$t_ufo} WHERE id = '{$id_option}'";
                 $res_options = Database::query($sql);
                 $row_options = Database::fetch_row($res_options);
                 $value_options[] = $row_options[0];
             }
             $extra_information_value .= '<dt>' . ucfirst($extraFieldInfo['display_text']) . ':</dt>' . '<dd>' . implode(' ', $value_options) . '</dd>';
             break;
         case ExtraField::FIELD_TYPE_TAG:
             $user_tags = UserManager::get_user_tags($user_id, $extraFieldInfo['id']);
             $tag_tmp = array();
             foreach ($user_tags as $tags) {
                 $tag_tmp[] = '<a class="label label_tag"' . ' href="' . api_get_path(WEB_PATH) . 'main/social/search.php?q=' . $tags['tag'] . '">' . $tags['tag'] . '</a>';
             }
             if (is_array($user_tags) && count($user_tags) > 0) {
                 $extra_information_value .= '<dt>' . ucfirst($extraFieldInfo['display_text']) . ':</dt>' . '<dd>' . implode('', $tag_tmp) . '</dd>';
             }
             break;
         case ExtraField::FIELD_TYPE_SOCIAL_PROFILE:
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:31,代码来源:profile.php

示例10: is_valid_link

 /**
  * Check if this still links to a learnpath
  */
 public function is_valid_link()
 {
     $sql = 'SELECT count(id) FROM ' . $this->get_learnpath_table() . ' 
             WHERE c_id = ' . $this->course_id . ' AND id = ' . $this->get_ref_id() . ' ';
     $result = Database::query($sql);
     $number = Database::fetch_row($result, 'NUM');
     return $number[0] != 0;
 }
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:11,代码来源:learnpathlink.class.php

示例11: WSUnsuscribeCoursesFromSession

function WSUnsuscribeCoursesFromSession($params)
{
    if (!WSHelperVerifyKey($params)) {
        return return_error(WS_ERROR_SECRET_KEY);
    }
    // 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_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 courses list from row_original_course_id_values
        $course_list = array();
        $courseIdList = [];
        foreach ($original_course_id_values as $row_original_course_list) {
            $course_code = Database::escape_string($row_original_course_list['course_code']);
            // Check whether exits $x_course_code into user_field_values table.
            $courseInfo = CourseManager::getCourseInfoFromOriginalId($row_original_course_list['course_code'], $original_course_id_name);
            if (empty($courseInfo) || isset($courseInfo) && $courseInfo['visibility'] == 0) {
                continue;
                // Course_code doesn't exist'
            }
            $course_list[] = $courseInfo['code'];
            $courseIdList[] = $courseInfo['real_id'];
        }
        if (empty($course_list)) {
            $results[] = 0;
            continue;
        }
        $orig_course_id_value[] = implode(',', $course_list);
        foreach ($courseIdList as $courseId) {
            $courseId = intval($courseId);
            Database::query("DELETE FROM {$tbl_session_rel_course}\n                            WHERE c_id ='{$courseId}' AND session_id='{$id_session}'");
            $result = Database::query("DELETE FROM {$tbl_session_rel_course_rel_user} WHERE c_id='{$courseId}' AND session_id = '{$id_session}'");
            Event::addEvent(LOG_SESSION_DELETE_COURSE, LOG_COURSE_ID, $courseId, api_get_utc_datetime(), api_get_user_id(), $courseId, $id_session);
            $return = Database::affected_rows($result);
        }
        $nbr_courses = 0;
        $sql = "SELECT nbr_courses FROM {$tbl_session} WHERE id = '{$id_session}'";
        $res_nbr_courses = Database::query($sql);
        $row_nbr_courses = Database::fetch_row($res_nbr_courses);
        if (Database::num_rows($res_nbr_courses) > 0) {
            $nbr_users = $row_nbr_courses[0] - $return;
        }
        // Update number of users in the session.
        $update_sql = "UPDATE {$tbl_session} SET nbr_courses= {$nbr_courses} WHERE id='{$id_session}' ";
        Database::query($update_sql);
        $results[] = 1;
        continue;
    }
    $count_results = count($results);
    $output = array();
    for ($i = 0; $i < $count_results; $i++) {
        $output[] = array('original_course_id_values' => $orig_course_id_value[$i], 'original_session_id_value' => $orig_session_id_value[$i], 'result' => $results[$i]);
    }
    return $output;
}
开发者ID:secuencia24,项目名称:chamilo-lms,代码行数:71,代码来源:registration.soap.php

示例12: api_block_anonymous_users

api_block_anonymous_users();
GradebookUtils::block_students();
$interbreadcrumb[] = array('url' => $_SESSION['gradebook_dest'] . '?', 'name' => get_lang('Gradebook'));
$interbreadcrumb[] = array('url' => $_SESSION['gradebook_dest'] . '?selectcat=' . Security::remove_XSS($_GET['selectcat']), 'name' => get_lang('Details'));
$interbreadcrumb[] = array('url' => 'gradebook_showlog_eval.php?visiblelog=' . Security::remove_XSS($_GET['visiblelog']) . '&amp;selectcat=' . Security::remove_XSS($_GET['selectcat']), 'name' => get_lang('GradebookQualifyLog'));
$this_section = SECTION_COURSES;
Display::display_header('');
echo Display::page_header(get_lang('GradebookQualifyLog'));
$t_linkeval_log = Database::get_main_table(TABLE_MAIN_GRADEBOOK_LINKEVAL_LOG);
$t_user = Database::get_main_table(TABLE_MAIN_USER);
$visible_log = Security::remove_XSS($_GET['visiblelog']);
$evaledit = Evaluation::load($visible_log);
$sql = "SELECT le.name,le.description,le.weight,le.visible,le.type,le.created_at,us.username FROM " . $t_linkeval_log . " le INNER JOIN " . $t_user . " us\n      ON le.user_id_log=us.user_id where id_linkeval_log=" . $evaledit[0]->get_id() . " and type='evaluation';";
$result = Database::query($sql);
$list_info = array();
while ($row = Database::fetch_row($result)) {
    $list_info[] = $row;
}
foreach ($list_info as $key => $info_log) {
    $list_info[$key][5] = $info_log[5] ? api_convert_and_format_date($info_log[5]) : 'N/A';
    $list_info[$key][3] = $info_log[3] == 1 ? get_lang('GradebookVisible') : get_lang('GradebookInvisible');
}
$parameters = array('visiblelog' => $visible_log, 'selectcat' => intval($_GET['selectcat']));
$table = new SortableTableFromArrayConfig($list_info, 1, 20, 'gradebookeval');
$table->set_additional_parameters($parameters);
$table->set_header(0, get_lang('GradebookNameLog'));
$table->set_header(1, get_lang('GradebookDescriptionLog'));
$table->set_header(2, get_lang('GradebookPreviousWeight'));
$table->set_header(3, get_lang('GradebookVisibilityLog'));
$table->set_header(4, get_lang('ResourceType'));
$table->set_header(5, get_lang('Date'));
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:31,代码来源:gradebook_showlog_eval.php

示例13: get_ip_from_user_event

 /**
  * Gets the IP of a given user, using the last login before the given date
  * @param int User ID
  * @param string Datetime
  * @param bool Whether to return the IP as a link or just as an IP
  * @param string If defined and return_as_link if true, will be used as the text to be shown as the link
  * @return string IP address (or false on error)
  * @assert (0,0) === false
  */
 public static function get_ip_from_user_event($user_id, $event_date, $return_as_link = false, $body_replace = null)
 {
     if (empty($user_id) or empty($event_date)) {
         return false;
     }
     $user_id = intval($user_id);
     $event_date = Database::escape_string($event_date);
     $table_login = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN);
     $sql_ip = "SELECT login_date, user_ip FROM {$table_login}\n                   WHERE login_user_id = {$user_id} AND login_date < '{$event_date}'\n                   ORDER BY login_date DESC LIMIT 1";
     $ip = '';
     $res_ip = Database::query($sql_ip);
     if ($res_ip !== false && Database::num_rows($res_ip) > 0) {
         $row_ip = Database::fetch_row($res_ip);
         if ($return_as_link) {
             $ip = Display::url(empty($body_replace) ? $row_ip[1] : $body_replace, 'http://www.whatsmyip.org/ip-geo-location/?ip=' . $row_ip[1], array('title' => get_lang('TraceIP'), 'target' => '_blank'));
         } else {
             $ip = $row_ip[1];
         }
     }
     return $ip;
 }
开发者ID:feroli1000,项目名称:chamilo-lms,代码行数:30,代码来源:tracking.lib.php

示例14: intval

     $sortDirection = "DESC";
 }
 if (!empty($_GET['up'])) {
     $thisAnnouncementId = intval($_GET['up']);
     $sortDirection = "ASC";
 }
 if (!empty($sortDirection)) {
     if (!in_array(trim(strtoupper($sortDirection)), array('ASC', 'DESC'))) {
         $sortDirection = 'ASC';
     }
     $announcementInfo = AnnouncementManager::get_by_id($course_id, $thisAnnouncementId);
     $sql = "SELECT DISTINCT announcement.id, announcement.display_order\n                FROM {$tbl_announcement} announcement,\n\t\t\t\t{$tbl_item_property} itemproperty\n\t\t\t\tWHERE\n\t\t\t\t    announcement.c_id =  {$course_id} AND\n\t\t\t\t    itemproperty.c_id =  {$course_id} AND\n\t\t\t\t\titemproperty.ref = announcement.id AND\n                    itemproperty.tool = '" . TOOL_ANNOUNCEMENT . "'  AND\n                    itemproperty.visibility <> 2\n                ORDER BY display_order {$sortDirection}";
     $result = Database::query($sql);
     $thisAnnouncementOrderFound = false;
     $thisAnnouncementOrder = null;
     while (list($announcementId, $announcementOrder) = Database::fetch_row($result)) {
         if ($thisAnnouncementOrderFound) {
             $nextAnnouncementId = $announcementId;
             $nextAnnouncementOrder = $announcementOrder;
             $sql = "UPDATE {$tbl_announcement} SET display_order = '{$nextAnnouncementOrder}'\n                            WHERE c_id = {$course_id} AND id = {$thisAnnouncementId}";
             Database::query($sql);
             $sql = "UPDATE {$tbl_announcement}  SET display_order = '{$thisAnnouncementOrder}'\n                            WHERE c_id = {$course_id} AND id =  {$nextAnnouncementId}";
             Database::query($sql);
             break;
         }
         // STEP 1 : FIND THE ORDER OF THE ANNOUNCEMENT
         if ($announcementId == $thisAnnouncementId) {
             $thisAnnouncementOrder = $announcementOrder;
             $thisAnnouncementOrderFound = true;
         }
     }
开发者ID:jloguercio,项目名称:chamilo-lms,代码行数:31,代码来源:announcements.php

示例15: display_blog_list

 /**
  * Blog admin | Returns table with blogs in this course
  */
 public static function display_blog_list()
 {
     global $charset;
     $_user = api_get_user_info();
     $course_id = api_get_course_int_id();
     // Init
     $counter = 0;
     $tbl_blogs = Database::get_course_table(TABLE_BLOGS);
     //condition for the session
     $session_id = api_get_session_id();
     $condition_session = api_get_session_condition($session_id, false);
     $sql = "SELECT blog_name, blog_subtitle, visibility, blog_id, session_id\n\t\t\t\tFROM {$tbl_blogs} WHERE c_id = {$course_id}\n\t\t\t\tORDER BY date_creation DESC";
     $result = Database::query($sql);
     $list_info = array();
     if (Database::num_rows($result)) {
         while ($row_project = Database::fetch_row($result)) {
             $list_info[] = $row_project;
         }
     }
     $list_content_blog = array();
     $list_body_blog = array();
     $_user = api_get_user_info();
     if (is_array($list_info)) {
         foreach ($list_info as $key => $info_log) {
             // Validation when belongs to a session
             $session_img = api_get_session_image($info_log[4], $_user['status']);
             $url_start_blog = 'blog.php' . "?" . "blog_id=" . $info_log[3] . "&" . api_get_cidreq();
             $title = $info_log[0];
             $image = '<img src="../img/blog.gif" border="0" align="absmiddle" alt="' . $title . '">';
             $list_name = '<div style="float: left; width: 35px; height: 22px;"><a href="' . $url_start_blog . '">' . $image . '</a></div><a href="' . $url_start_blog . '">' . $title . '</a>' . $session_img;
             $list_body_blog[] = $list_name;
             $list_body_blog[] = $info_log[1];
             $visibility_icon = $info_log[2] == 0 ? 'invisible' : 'visible';
             $visibility_info = $info_log[2] == 0 ? 'Visible' : 'Invisible';
             $my_image = '<a href="' . api_get_self() . '?action=edit&blog_id=' . $info_log[3] . '">';
             $my_image .= '<img src="../img/edit.gif" border="0" title="' . get_lang('EditBlog') . '" />';
             $my_image .= "</a>\n";
             $my_image .= '<a href="' . api_get_self() . '?action=delete&blog_id=' . $info_log[3] . '" ';
             $my_image .= 'onclick="javascript:if(!confirm(\'' . addslashes(api_htmlentities(get_lang("ConfirmYourChoice"), ENT_QUOTES, $charset)) . '\')) return false;" >';
             $my_image .= '<img src="../img/delete.gif" border="0" title="' . get_lang('DeleteBlog') . '" />';
             $my_image .= "</a>\n";
             $my_image .= '<a href="' . api_get_self() . '?action=visibility&blog_id=' . $info_log[3] . '">';
             $my_image .= '<img src="../img/' . $visibility_icon . '.gif" border="0" title="' . get_lang($visibility_info) . '" />';
             $my_image .= "</a>\n";
             $list_body_blog[] = $my_image;
             $list_content_blog[] = $list_body_blog;
             $list_body_blog = array();
         }
         $parameters = '';
         //$parameters=array('action'=>Security::remove_XSS($_GET['action']));
         $table = new SortableTableFromArrayConfig($list_content_blog, 1, 20, 'project');
         //$table->set_additional_parameters($parameters);
         $table->set_header(0, get_lang('Title'));
         $table->set_header(1, get_lang('SubTitle'));
         $table->set_header(2, get_lang('Modify'));
         $table->display();
     }
 }
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:61,代码来源:blog.lib.php


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