• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP get_records_sql函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中get_records_sql函数的典型用法代码示例。如果您正苦于以下问题:PHP get_records_sql函数的具体用法?PHP get_records_sql怎么用?PHP get_records_sql使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: doListAnnotations

 function doListAnnotations($url, $username, $block)
 {
     $query = new AnnotationSummaryQuery($url, $username, null, null);
     if ($query->error) {
         $this->httpError(400, 'Bad Request', 'Bad URL');
         return null;
     } elseif (isguest() && ANNOTATION_REQUIRE_USER) {
         $this->httpError(403, 'Forbidden', 'Anonymous listing not allowed');
         return null;
     } else {
         $querySql = $query->sql('section_type, section_name, quote_title');
         $annotationSet = get_records_sql($querySql);
         $annotations = array();
         if ($annotationSet) {
             $i = 0;
             foreach ($annotationSet as $r) {
                 $annotations[$i++] = AnnotationGlobals::recordToAnnotation($r);
             }
         }
         $format = $this->getQueryParam('format', 'atom');
         $logUrl = 'annotate.php?format=' . $format . ($username ? '&user=' . $username : '') . '&url=' . $url;
         add_to_log($query->handler->courseId, 'annotation', 'list', $logUrl);
         return $annotations;
     }
 }
开发者ID:njorth,项目名称:marginalia,代码行数:25,代码来源:annotate.php


示例2: get_all_gradable_items

 /**
  * gets all workshops for the config tree
  */
 function get_all_gradable_items()
 {
     global $CFG;
     $sql = "SELECT w.id, w.course, w.name, w.description as summary, c.id as cmid\n                  FROM {$CFG->prefix}workshop w\n            INNER JOIN {$CFG->prefix}course_modules c\n                    ON w.id = c.instance\n                 WHERE c.module = {$this->mainobject->modulesettings['workshop']->id}\n                   AND c.visible = 1\n                   AND w.course IN ({$this->mainobject->course_ids})\n              ORDER BY w.id";
     $workshops = get_records_sql($sql);
     $this->assessments = $workshops;
 }
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:10,代码来源:workshop_grading.php


示例3: map_get_cells

function map_get_cells($brainstormid, $userid = null, $groupid = 0, $configdata = null)
{
    global $CFG;
    $accessClause = brainstorm_get_accessclauses($userid, $groupid);
    $sql = "\r\n        SELECT\r\n            id,\r\n            itemsource,\r\n            itemdest,\r\n            intvalue,\r\n            floatvalue,\r\n            blobvalue\r\n         FROM\r\n            {$CFG->prefix}brainstorm_operatordata AS od\r\n         WHERE\r\n            brainstormid = {$brainstormid} AND\r\n            operatorid = 'map'\r\n            {$accessClause}\r\n    ";
    $map = array();
    if ($maprecords = get_records_sql($sql)) {
        foreach ($maprecords as $record) {
            if (!$configdata || !@$configdata->quantified) {
                $map[$record->itemsource][$record->itemdest] = 1;
            } else {
                switch ($configdata->quantifiertype) {
                    case 'integer':
                        $map[$record->itemsource][$record->itemdest] = $record->intvalue;
                        break;
                    case 'float':
                        $map[$record->itemsource][$record->itemdest] = $record->floatvalue;
                        break;
                    case 'multiple':
                        $map[$record->itemsource][$record->itemdest] = unserialize($record->blobvalue);
                        break;
                    default:
                }
            }
        }
    }
    return $map;
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:28,代码来源:locallib.php


示例4: ma_delete_execute

function ma_delete_execute($modids)
{
    global $CFG;
    $in_list = "(" . join(", ", $modids) . ")";
    $sql = "SELECT cm.id as coursemodule, cm.section, cm.course, mo.name as modulename, instance\n        FROM {$CFG->prefix}course_modules cm\n        LEFT JOIN {$CFG->prefix}modules mo on mo.id=cm.module\n        WHERE cm.id IN {$in_list}";
    $records = get_records_sql($sql);
    $courses = array();
    $message = '';
    if ($records) {
        foreach ($records as $id => $record) {
            $modlib = "{$CFG->dirroot}/mod/{$record->modulename}/lib.php";
            $courses[] = $record->course;
            if (file_exists($modlib)) {
                include_once $modlib;
            } else {
                $message .= "This module is missing important code! ({$modlib})  ";
                continue;
            }
            $deleteinstancefunction = $record->modulename . "_delete_instance";
            if (!$deleteinstancefunction($record->instance)) {
                $message .= "Could not delete the {$record->modulename} (instance)  ";
                continue;
            }
            if (!delete_course_module($record->coursemodule)) {
                $message .= "Could not delete the {$record->modulename} (coursemodule)  ";
                continue;
            }
            if (!delete_mod_from_section($record->coursemodule, "{$record->section}")) {
                $message .= "Could not delete the {$record->modulename} from that section  ";
                continue;
            }
        }
    }
    return $message;
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:35,代码来源:delete.php


示例5: resource_get_links

function resource_get_links(&$course, &$mod, $exclude_sitefile = true)
{
    global $CFG;
    $sql = "SELECT r.id, r.reference, r.name, r.summary, r.alltext, cm.id AS cmid\r\n             FROM {$CFG->prefix}resource r,\r\n                  {$CFG->prefix}course_modules cm,\r\n                  {$CFG->prefix}modules m\r\n             WHERE r.course    = '{$course->id}'\r\n               AND m.name      = 'resource'\r\n               AND cm.module   = m.id\r\n               AND cm.instance = r.id\r\n               AND cm.id = {$mod->id}";
    if ($resources = get_records_sql($sql)) {
        // 各テキストの取得
        $links = array();
        foreach ($resources as $resource) {
            preg_match_all('|/file.php/([^\\"]+)|', $resource->alltext, $matches);
            $links = array_merge($links, $matches[1]);
            preg_match_all('|/file.php/([^\\"]+)|', $resource->summary, $matches);
            $links = array_merge($links, $matches[1]);
            if (trim($resource->reference) && stristr($resource->reference, 'http://') === false || stristr($resources->reference, 'file.php/')) {
                $links[] = $course->id . '/' . $resource->reference;
            }
        }
        // 2008-10-29 暫定処置
        if ($exclude_sitefile) {
            $links = array_filter($links, 'is_not_sitefile');
        }
        return $links;
    } else {
        return null;
    }
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:25,代码来源:converter.php


示例6: get_content

 function get_content()
 {
     global $THEME, $CFG, $USER;
     // only for logged in users!
     if (!isloggedin() || isguest()) {
         return false;
     }
     // check for outgoing roaming permission first
     if (!has_capability('moodle/site:mnetlogintoremote', get_context_instance(CONTEXT_SYSTEM), NULL, false)) {
         return '';
     }
     if ($this->content !== NULL) {
         return $this->content;
     }
     // TODO: Test this query - it's appropriate? It works?
     // get the hosts and whether we are doing SSO with them
     $sql = "\n             SELECT DISTINCT \n                 h.id, \n                 h.name,\n                 h.wwwroot,\n                 a.name as application,\n                 a.display_name\n             FROM \n                 {$CFG->prefix}mnet_host h,\n                 {$CFG->prefix}mnet_application a,\n                 {$CFG->prefix}mnet_host2service h2s_IDP,\n                 {$CFG->prefix}mnet_service s_IDP,\n                 {$CFG->prefix}mnet_host2service h2s_SP,\n                 {$CFG->prefix}mnet_service s_SP\n             WHERE\n                 h.id != '{$CFG->mnet_localhost_id}' AND\n                 h.id = h2s_IDP.hostid AND\n                 h.applicationid = a.id AND\n                 h2s_IDP.serviceid = s_IDP.id AND\n                 s_IDP.name = 'sso_idp' AND\n                 h2s_IDP.publish = '1' AND\n                 h.id = h2s_SP.hostid AND\n                 h2s_SP.serviceid = s_SP.id AND\n                 s_SP.name = 'sso_idp' AND\n                 h2s_SP.publish = '1'\n             ORDER BY\n                 a.display_name,\n                 h.name";
     $hosts = get_records_sql($sql);
     $this->content = new stdClass();
     $this->content->items = array();
     $this->content->icons = array();
     $this->content->footer = '';
     if ($hosts) {
         foreach ($hosts as $host) {
             $icon = '<img src="' . $CFG->pixpath . '/i/' . $host->application . '_host.gif"' . ' class="icon" alt="' . get_string('server', 'block_mnet_hosts') . '" />';
             $this->content->icons[] = $icon;
             if ($host->id == $USER->mnethostid) {
                 $this->content->items[] = "<a title=\"" . s($host->name) . "\" href=\"{$host->wwwroot}\">" . s($host->name) . "</a>";
             } else {
                 $this->content->items[] = "<a title=\"" . s($host->name) . "\" href=\"{$CFG->wwwroot}/auth/mnet/jump.php?hostid={$host->id}\">" . s($host->name) . "</a>";
             }
         }
     }
     return $this->content;
 }
开发者ID:BackupTheBerlios,项目名称:samouk-svn,代码行数:35,代码来源:block_mnet_hosts.php


示例7: display_search_field

 function display_search_field($content = '')
 {
     global $CFG;
     $varcharcontent = sql_compare_text('content', 255);
     $sql = "SELECT DISTINCT {$varcharcontent} AS content\n                  FROM {$CFG->prefix}data_content\n                 WHERE fieldid={$this->field->id} AND content IS NOT NULL";
     $usedoptions = array();
     if ($used = get_records_sql($sql)) {
         foreach ($used as $data) {
             $value = $data->content;
             if ($value === '') {
                 continue;
             }
             $usedoptions[$value] = $value;
         }
     }
     $options = array();
     foreach (explode("\n", $this->field->param1) as $option) {
         $option = trim($option);
         if (!isset($usedoptions[$option])) {
             continue;
         }
         $options[$option] = $option;
     }
     if (!$options) {
         // oh, nothing to search for
         return '';
     }
     return choose_from_menu($options, 'f_' . $this->field->id, stripslashes($content), 'choose', '', 0, true);
 }
开发者ID:edwinphillips,项目名称:moodle-485cb39,代码行数:29,代码来源:field.class.php


示例8: question_dataset_dependent_items_form

 /**
  * Add question-type specific form fields.
  *
  * @param MoodleQuickForm $mform the form being built.
  */
 function question_dataset_dependent_items_form($submiturl, $question, $regenerate)
 {
     global $QTYPES, $SESSION, $CFG;
     $this->regenerate = $regenerate;
     $this->question = $question;
     $this->qtypeobj =& $QTYPES[$this->question->qtype];
     //get the dataset defintions for this question
     if (empty($question->id)) {
         $this->datasetdefs = $this->qtypeobj->get_dataset_definitions($question->id, $SESSION->datasetdependent->definitionform->dataset);
     } else {
         if (empty($question->options)) {
             $this->get_question_options($question);
         }
         $this->datasetdefs = $this->qtypeobj->get_dataset_definitions($question->id, array());
     }
     foreach ($this->datasetdefs as $datasetdef) {
         // Get maxnumber
         if ($this->maxnumber == -1 || $datasetdef->itemcount < $this->maxnumber) {
             $this->maxnumber = $datasetdef->itemcount;
         }
     }
     foreach ($this->datasetdefs as $defid => $datasetdef) {
         if (isset($datasetdef->id)) {
             $this->datasetdefs[$defid]->items = get_records_sql(" SELECT itemnumber, definition, id, value\n                          FROM {$CFG->prefix}question_dataset_items\n                          WHERE definition = {$datasetdef->id} ");
         }
     }
     parent::moodleform($submiturl);
 }
开发者ID:veritech,项目名称:pare-project,代码行数:33,代码来源:datasetitems_form.php


示例9: question_dataset_dependent_items_form

 /**
  * Add question-type specific form fields.
  *
  * @param MoodleQuickForm $mform the form being built.
  */
 function question_dataset_dependent_items_form($submiturl, $question, $regenerate)
 {
     global $QTYPES, $SESSION, $CFG;
     $this->regenerate = $regenerate;
     $this->question = $question;
     $this->qtypeobj =& $QTYPES[$this->question->qtype];
     // Validate the question category.
     if (!($category = get_record('question_categories', 'id', $question->category))) {
         print_error('categorydoesnotexist', 'question', $returnurl);
     }
     $this->category = $category;
     $this->categorycontext = get_context_instance_by_id($category->contextid);
     //get the dataset defintions for this question
     if (empty($question->id)) {
         $this->datasetdefs = $this->qtypeobj->get_dataset_definitions($question->id, $SESSION->datasetdependent->definitionform->dataset);
     } else {
         if (empty($question->options)) {
             $this->get_question_options($question);
         }
         $this->datasetdefs = $this->qtypeobj->get_dataset_definitions($question->id, array());
     }
     foreach ($this->datasetdefs as $datasetdef) {
         // Get maxnumber
         if ($this->maxnumber == -1 || $datasetdef->itemcount < $this->maxnumber) {
             $this->maxnumber = $datasetdef->itemcount;
         }
     }
     foreach ($this->datasetdefs as $defid => $datasetdef) {
         if (isset($datasetdef->id)) {
             $this->datasetdefs[$defid]->items = get_records_sql(" SELECT itemnumber, definition, id, value\n                          FROM {$CFG->prefix}question_dataset_items\n                          WHERE definition = {$datasetdef->id} ");
         }
     }
     parent::moodleform($submiturl);
 }
开发者ID:JackCanada,项目名称:moodle-hacks,代码行数:39,代码来源:datasetitems_form.php


示例10: data_filter

function data_filter($courseid, $text)
{
    global $CFG;
    static $nothingtodo;
    static $contentlist;
    if (!empty($nothingtodo)) {
        // We've been here in this page already
        return $text;
    }
    // if we don't have a courseid, we can't run the query, so
    if (empty($courseid)) {
        return $text;
    }
    // Create a list of all the resources to search for. It may be cached already.
    if (empty($contentlist)) {
        // We look for text field contents only, and only if the field has
        // autolink enabled (param1).
        $sql = 'SELECT dc.id AS contentid, ' . 'dr.id AS recordid, ' . 'dc.content AS content, ' . 'd.id AS dataid ' . 'FROM ' . $CFG->prefix . 'data d, ' . $CFG->prefix . 'data_fields df, ' . $CFG->prefix . 'data_records dr, ' . $CFG->prefix . 'data_content dc ' . "WHERE (d.course = '{$courseid}' or d.course = '" . SITEID . "')" . 'AND d.id = df.dataid ' . 'AND df.id = dc.fieldid ' . 'AND d.id = dr.dataid ' . 'AND dr.id = dc.recordid ' . "AND df.type = 'text' " . "AND " . sql_compare_text('df.param1', 1) . " = '1'";
        if (!($datacontents = get_records_sql($sql))) {
            return $text;
        }
        $contentlist = array();
        foreach ($datacontents as $datacontent) {
            $currentcontent = trim($datacontent->content);
            $strippedcontent = strip_tags($currentcontent);
            if (!empty($strippedcontent)) {
                $contentlist[] = new filterobject($currentcontent, '<a class="data autolink" title="' . $strippedcontent . '" href="' . $CFG->wwwroot . '/mod/data/view.php?d=' . $datacontent->dataid . '&amp;rid=' . $datacontent->recordid . '" ' . $CFG->frametarget . '>', '</a>', false, true);
            }
        }
        // End foreach
    }
    return filter_phrases($text, $contentlist);
    // Look for all these links in the text
}
开发者ID:edwinphillips,项目名称:moodle-485cb39,代码行数:34,代码来源:filter.php


示例11: quiz_report_load_questions

/**
 * Load the question data necessary in the reports.
 * - Remove description questions.
 * - Order questions in order that they are in the quiz
 * - Add question numbers.
 * - Add grade from quiz_questions_instance
 */
function quiz_report_load_questions($quiz)
{
    global $CFG;
    $questionlist = quiz_questions_in_quiz($quiz->questions);
    //In fact in most cases the id IN $questionlist below is redundant
    //since we are also doing a JOIN on the qqi table. But will leave it in
    //since this double check will probably do no harm.
    if (!($questions = get_records_sql("SELECT q.*, qqi.grade " . "FROM {$CFG->prefix}question q, " . "{$CFG->prefix}quiz_question_instances qqi " . "WHERE q.id IN ({$questionlist}) AND " . "qqi.question = q.id AND " . "qqi.quiz =" . $quiz->id))) {
        print_error('No questions found');
    }
    //Now we have an array of questions from a quiz we work out there question nos and remove
    //questions with zero length ie. description questions etc.
    //also put questions in order.
    $number = 1;
    $realquestions = array();
    $questionids = explode(',', $questionlist);
    foreach ($questionids as $id) {
        if ($questions[$id]->length) {
            // Ignore questions of zero length
            $realquestions[$id] = $questions[$id];
            $realquestions[$id]->number = $number;
            $number += $questions[$id]->length;
        }
    }
    return $realquestions;
}
开发者ID:JackCanada,项目名称:moodle-hacks,代码行数:33,代码来源:reportlib.php


示例12: get_question_options

 function get_question_options(&$question)
 {
     // Get the question answers and their respective tolerances
     // Note: question_numerical is an extension of the answer table rather than
     //       the question table as is usually the case for qtype
     //       specific tables.
     global $CFG;
     if (!($question->options->answers = get_records_sql("SELECT a.*, n.tolerance " . "FROM {$CFG->prefix}question_answers a, " . "     {$CFG->prefix}question_numerical n " . "WHERE a.question = {$question->id} " . "    AND   a.id = n.answer " . "ORDER BY a.id ASC"))) {
         notify('Error: Missing question answer!');
         return false;
     }
     $this->get_numerical_units($question);
     // If units are defined we strip off the default unit from the answer, if
     // it is present. (Required for compatibility with the old code and DB).
     if ($defaultunit = $this->get_default_numerical_unit($question)) {
         foreach ($question->options->answers as $key => $val) {
             $answer = trim($val->answer);
             $length = strlen($defaultunit->unit);
             if ($length && substr($answer, -$length) == $defaultunit->unit) {
                 $question->options->answers[$key]->answer = substr($answer, 0, strlen($answer) - $length);
             }
         }
     }
     return true;
 }
开发者ID:veritech,项目名称:pare-project,代码行数:25,代码来源:questiontype.php


示例13: get_content

 function get_content()
 {
     global $USER, $CFG;
     if ($this->content !== NULL) {
         return $this->content;
     }
     $this->content = new stdClass();
     $this->content->text = '';
     $this->content->footer = '';
     if (empty($this->instance) or empty($USER->id) or isguest() or empty($CFG->messaging)) {
         return $this->content;
     }
     $this->content->footer = '<a href="' . $CFG->wwwroot . '/message/index.php" onclick="this.target=\'message\'; return openpopup(\'/message/index.php\', \'message\', \'menubar=0,location=0,scrollbars,status,resizable,width=400,height=500\', 0);">' . get_string('messages', 'message') . '</a>...';
     $users = get_records_sql("SELECT m.useridfrom as id, COUNT(m.useridfrom) as count,\n                                         u.firstname, u.lastname, u.picture, u.lastaccess\n                                       FROM {$CFG->prefix}user u, \n                                            {$CFG->prefix}message m \n                                       WHERE m.useridto = '{$USER->id}' \n                                         AND u.id = m.useridfrom\n                                    GROUP BY m.useridfrom, u.firstname,u.lastname,u.picture,u.lastaccess");
     //Now, we have in users, the list of users to show
     //Because they are online
     if (!empty($users)) {
         $this->content->text .= '<ul class="list">';
         foreach ($users as $user) {
             $timeago = format_time(time() - $user->lastaccess);
             $this->content->text .= '<li class="listentry"><div class="user"><a href="' . $CFG->wwwroot . '/user/view.php?id=' . $user->id . '&amp;course=' . $this->instance->pageid . '" title="' . $timeago . '">';
             $this->content->text .= print_user_picture($user->id, $this->instance->pageid, $user->picture, 0, true, false, '', false);
             $this->content->text .= fullname($user) . '</a></div>';
             $this->content->text .= '<div class="message"><a href="' . $CFG->wwwroot . '/message/discussion.php?id=' . $user->id . '" onclick="this.target=\'message_' . $user->id . '\'; return openpopup(\'/message/discussion.php?id=' . $user->id . '\', \'message_' . $user->id . '\', \'menubar=0,location=0,scrollbars,status,resizable,width=400,height=500\', 0);"><img class="iconsmall" src="' . $CFG->pixpath . '/t/message.gif" alt="" />&nbsp;' . $user->count . '</a>';
             $this->content->text .= '</div></li>';
         }
         $this->content->text .= '</ul>';
     } else {
         $this->content->text .= '<div class="info">';
         $this->content->text .= get_string('nomessages', 'message');
         $this->content->text .= '</div>';
     }
     return $this->content;
 }
开发者ID:BackupTheBerlios,项目名称:samouk-svn,代码行数:34,代码来源:block_messages.php


示例14: commentwall_getwall

/**
 * Retrieve the wall for a given userid.
 *
 * @return mixed Array of comment objects, else returns false.
 * @param unknown_type $userid The user / wall we are retrieving
 * @param unknown_type $limit Limit on the search
 * @param unknown_type $offset Offset
 */
function commentwall_getwall($userid, $limit = 3, $offset = 0)
{
    global $CFG;
    $query = "SELECT * from {$CFG->prefix}commentwall where wallowner={$userid} order by posted desc limit {$offset},{$limit}";
    // echo $query;
    return get_records_sql($query);
}
开发者ID:BackupTheBerlios,项目名称:tulipan-svn,代码行数:15,代码来源:lib.php


示例15: doListAnnotations

 function doListAnnotations($url, $username, $block, $all)
 {
     $handler = annotation_summary_query::handler_for_url($url);
     $user = get_record('user', 'username', $username);
     $summary = new annotation_summary_query($url, $handler, null, $user, null, false, $all);
     if ($summary->error) {
         $this->httpError(400, 'Bad Request', 'Bad URL 1');
         return null;
     } elseif (!isloggedin() && ANNOTATION_REQUIRE_USER) {
         $this->httpError(403, 'Forbidden', 'Anonymous listing not allowed');
         return null;
     } else {
         $querysql = $summary->sql('section_type, section_name, quote_title, start_block, start_line, start_word, start_char, end_block, end_line, end_word, end_char');
         $annotation_set = get_records_sql($querysql);
         $annotations = array();
         if ($annotation_set) {
             $i = 0;
             foreach ($annotation_set as $r) {
                 $annotations[$i++] = annotation_globals::record_to_annotation($r);
             }
         }
         $format = $this->getQueryParam('format', 'atom');
         $logurl = 'annotate.php?format=' . $format . ($user ? '&user=' . $user->id : '') . '&url=' . $url;
         add_to_log($summary->handler->courseid, 'annotation', 'list', $logurl);
         return $annotations;
     }
 }
开发者ID:njorth,项目名称:marginalia,代码行数:27,代码来源:annotate.php


示例16: block_page_module_init

/**
 * External function for retrieving module data.
 *
 * Using external method so we can cache results
 * to improve performance for all page_module
 * instances.
 *
 * @param int $cmid Course Module ID
 * @return array
 **/
function block_page_module_init($cmid)
{
    global $COURSE, $CFG, $PAGE, $BLOCK_PAGE_MODULE;
    static $page = false, $baseurl = '';
    if (!$page) {
        if (!empty($PAGE) and get_class($PAGE) == 'format_page') {
            $page = $PAGE->get_formatpage();
        } else {
            require_once $CFG->dirroot . '/course/format/page/lib.php';
            if (!($page = page_get_current_page())) {
                $page = new stdClass();
                $page->id = 0;
            }
        }
        if ($COURSE->id == SITEID) {
            $baseurl = "{$CFG->wwwroot}/index.php?id={$COURSE->id}&amp;page={$page->id}";
        } else {
            $baseurl = "{$CFG->wwwroot}/course/view.php?id={$COURSE->id}&amp;page={$page->id}";
        }
        if (!empty($page->id)) {
            // Since we know what page will be printed, lets
            // get all of our records in bulk and cache the results
            if ($cms = get_records_sql("SELECT c.*\n                                           FROM {$CFG->prefix}course_modules c,\n                                                {$CFG->prefix}format_page p,\n                                                {$CFG->prefix}format_page_items i\n                                          WHERE i.cmid = c.id\n                                            AND p.id = i.pageid\n                                            AND p.id = {$page->id}")) {
                // Save for later
                $BLOCK_PAGE_MODULE['cms'] = $cms;
                if ($modules = get_records('modules')) {
                    // Save for later
                    $BLOCK_PAGE_MODULE['modules'] = $modules;
                    $mods = array();
                    foreach ($cms as $cm) {
                        $mods[$modules[$cm->module]->name][] = $cm->instance;
                    }
                    $instances = array();
                    foreach ($mods as $modname => $instanceids) {
                        if ($records = get_records_list($modname, 'id', implode(',', $instanceids))) {
                            $instances[$modname] = $records;
                        }
                    }
                    // Save for later
                    $BLOCK_PAGE_MODULE['instances'] = $instances;
                }
            }
        } else {
            // OK, we cannot do anything cool, make sure we dont break rest of the script
            $BLOCK_PAGE_MODULE = array('cms' => array(), 'modules' => array(), 'instances' => array());
        }
    }
    if (!($cm = block_page_module_get_cm($cmid, $page->id))) {
        return false;
    }
    if (!($module = block_page_module_get_module($cm->module))) {
        return false;
    }
    if (!($moduleinstance = block_page_module_get_instance($module->name, $cm->instance))) {
        return false;
    }
    return array($cm, $module, $moduleinstance, $COURSE, $page, $baseurl);
}
开发者ID:nadavkav,项目名称:MoodleTAO,代码行数:68,代码来源:lib.php


示例17: get_friends

function get_friends($username)
{
    global $CFG;
    $uname = addslashes($username);
    if ($data = get_records_sql("\n        SELECT\n            uf.userid || ':' || uf.friendid AS id,\n            uf.userid, u.username, uf.friendid, f.username AS friendusername, uf.approved\n        FROM\n            {$CFG->prefix}user_friend uf\n            JOIN {$CFG->prefix}user u ON uf.userid = u.id\n            JOIN {$CFG->prefix}user f ON uf.friendid = f.id\n        WHERE\n            u.username = '{$uname}'\n            OR (f.username = '{$uname}' AND uf.approved = 0)")) {
        return $data;
    }
    return array();
}
开发者ID:nadavkav,项目名称:MoodleTAO,代码行数:9,代码来源:rpclib.php


示例18: merge_get_merges

/**
*
* @uses CFG
* @param int $brainstormid
* @param int $userid
* @param int $groupid
* @param boolean $excludemyself
* @param object $configdata
*/
function merge_get_merges($brainstormid, $userid = null, $groupid = 0, $excludemyself = false, $configdata)
{
    global $CFG;
    $accessClause = brainstorm_get_accessclauses($userid, $groupid, $excludemyself);
    $sql = "\r\n        SELECT\r\n            r.*,\r\n            od.intvalue as slotid,\r\n            od.blobvalue as merged\r\n        FROM\r\n            {$CFG->prefix}brainstorm_responses as r,\r\n            {$CFG->prefix}brainstorm_operatordata as od\r\n        WHERE\r\n            r.id = od.itemsource AND\r\n            r.brainstormid = {$brainstormid} AND\r\n            od.operatorid = 'merge' AND\r\n            od.itemdest IS NOT NULL\r\n            {$accessClause}\r\n        ORDER BY\r\n            od.intvalue,\r\n            userid\r\n    ";
    if (!($merges = get_records_sql($sql))) {
        return array();
    }
    return $merges;
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:19,代码来源:locallib.php


示例19: order_get_ordering

/**
* get ordering on distinct contexts. Knows how to get an incomplete ordering.
* @param int $brainstormid
* @param int $userid
* @param int $groupid
* @param boolean $excludemyself
*/
function order_get_ordering($brainstormid, $userid = null, $groupid = 0, $excludemyself = false)
{
    global $CFG;
    $accessClause = brainstorm_get_accessclauses($userid, $groupid, $excludemyself);
    $sql = "\r\n        SELECT\r\n            r.id,\r\n            r.response,\r\n            od.intvalue,\r\n            od.userid,\r\n            od.groupid\r\n        FROM\r\n            {$CFG->prefix}brainstorm_responses as r\r\n        LEFT JOIN\r\n            {$CFG->prefix}brainstorm_operatordata as od\r\n        ON\r\n            r.id = od.itemsource AND\r\n            (od.operatorid = 'order'\r\n            {$accessClause})\r\n        WHERE\r\n            r.brainstormid = {$brainstormid}\r\n         ORDER BY\r\n            od.intvalue, \r\n            od.userid\r\n    ";
    if (!($records = get_records_sql($sql))) {
        return array();
    }
    return $records;
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:17,代码来源:locallib.php


示例20: filter_get_status

/**
*
* @uses CFG, USER
* @param int $brainstormid
* @param int $userid
* @param int $groupid 
* @param boolean $excludemyself
*/
function filter_get_status($brainstormid, $userid = null, $groupid = 0, $excludemyself = false)
{
    global $CFG;
    $accessClause = brainstorm_get_accessclauses($userid, $groupid, $excludemyself);
    $sql = "\r\n        SELECT\r\n            itemsource,\r\n            intvalue,\r\n            od.userid,\r\n            od.groupid,\r\n            response\r\n         FROM\r\n            {$CFG->prefix}brainstorm_operatordata AS od,\r\n            {$CFG->prefix}brainstorm_responses AS r\r\n         WHERE\r\n            od.brainstormid = {$brainstormid} AND\r\n            od.itemsource = r.id AND\r\n            operatorid = 'filter'\r\n            {$accessClause}\r\n    ";
    if (!($statusrecords = get_records_sql($sql))) {
        $statusrecords = array();
    }
    return $statusrecords;
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:18,代码来源:locallib.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP get_records_sql_array函数代码示例发布时间:2022-05-15
下一篇:
PHP get_records_select_menu函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap