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


PHP rs_fetch_next_record函数代码示例

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


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

示例1: webquestscorm_update_grades

/**
 * Update grades by firing grade_updated event
 *
 * @param object $assignment null means all assignments
 * @param int $userid specific user only, 0 mean all
 */
function webquestscorm_update_grades($webquestscorm = null, $userid = 0, $nullifnone = true)
{
    global $CFG;
    if (!function_exists('grade_update')) {
        //workaround for buggy PHP versions
        require_once $CFG->libdir . '/gradelib.php';
    }
    if ($webquestscorm != null) {
        if ($grades = webquestscorm_get_user_grades($webquestscorm, $userid)) {
            foreach ($grades as $k => $v) {
                if ($v->rawgrade == -1) {
                    $grades[$k]->rawgrade = null;
                }
            }
            webquestscorm_grade_item_update($webquestscorm, $grades);
        } else {
            webquestscorm_grade_item_update($webquestscorm);
        }
    } else {
        $sql = "SELECT a.*, cm.idnumber as cmidnumber, a.course as courseid\n                  FROM {$CFG->prefix}webquestscorm a, {$CFG->prefix}course_modules cm, {$CFG->prefix}modules m\n                 WHERE m.name='webquestscorm' AND m.id=cm.module AND cm.instance=a.id";
        if ($rs = get_recordset_sql($sql)) {
            while ($webquestscorm = rs_fetch_next_record($rs)) {
                if ($webquestscorm->grade != 0) {
                    webquestscorm_update_grades($webquestscorm);
                } else {
                    webquestscorm_grade_item_update($webquestscorm);
                }
            }
            rs_close($rs);
        }
    }
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:38,代码来源:lib.php

示例2: get_filters

 /**
  * Specifies available report filters
  * (empty by default but can be implemented by child class)
  *
  * @param   boolean  $init_data  If true, signal the report to load the
  *                               actual content of the filter objects
  *
  * @return  array                The list of available filters
  */
 function get_filters($init_data = true)
 {
     global $CURMAN;
     //Get allowed curriculum list by capability
     $cms = array();
     $contexts = get_contexts_by_capability_for_user('curriculum', $this->access_capability, $this->userid);
     $cms_objects = curriculum_get_listing_recordset('name', 'ASC', 0, 0, '', '', $contexts);
     if (!empty($cms_objects)) {
         while ($curriculum = rs_fetch_next_record($cms_objects)) {
             $cms[$curriculum->id] = $curriculum->name;
         }
     }
     $curricula_options = array('choices' => $cms, 'numeric' => false);
     //Create optional icon checkbox elements
     // 15 character name max length - with a 2 character field name - this is for any checkboxes filter
     $option_choices = array('tot_assignments' => get_string('option_tot_assignments', 'rlreport_course_usage_summary'), 'tot_crs_rscs' => get_string('option_tot_crs_rscs', 'rlreport_course_usage_summary'), 'tot_disc_posts' => get_string('option_tot_disc_posts', 'rlreport_course_usage_summary'), 'tot_quizzes' => get_string('option_tot_quizzes', 'rlreport_course_usage_summary'), 'avg_crs_grd' => get_string('option_avg_crs_grd', 'rlreport_course_usage_summary'), 'avg_hours_crs' => get_string('option_avg_hours_crs', 'rlreport_course_usage_summary'), 'avg_pretest' => get_string('option_avg_pretest', 'rlreport_course_usage_summary'), 'avg_posttest' => get_string('option_avg_posttest', 'rlreport_course_usage_summary'));
     $option_defaults = array('tot_assignments', 'tot_crs_rscs', 'tot_disc_posts', 'tot_quizzes', 'avg_crs_grd', 'avg_hours_crs', 'avg_pretest', 'avg_posttest');
     $option_options = array('choices' => $option_choices, 'checked' => $option_defaults, 'heading' => get_string('filter_options_header', 'rlreport_course_usage_summary'), 'footer' => '');
     $filter_entries = array();
     $filter_entries[] = new generalized_filter_entry('cc', 'cc', 'id', get_string('filter_curricula', 'rlreport_course_usage_summary'), false, 'selectany', $curricula_options);
     $this->checkboxes_filter = new generalized_filter_entry('oe', 'oe', 'id', '', false, 'config_checkboxes', $option_options);
     $filter_entries[] = $this->checkboxes_filter;
     $filter_entries[] = new generalized_filter_entry('enrol', 'enrol', 'enrolmenttime', get_string('filter_course_date', 'rlreport_course_progress_summary'), false, 'date');
     $filter_entries[] = new generalized_filter_entry('enrol', 'enrol', 'enrolmenttime', get_string('filter_course_date', 'rlreport_course_progress_summary'), false, 'date');
     return $filter_entries;
 }
开发者ID:remotelearner,项目名称:elis.reporting,代码行数:35,代码来源:course_usage_summary_report.class.php

示例3: block_openshare_updategroup

function block_openshare_updategroup($courseid, $groupid)
{
    $sql = 'SELECT u.id FROM mdl_user u 
	JOIN mdl_role_assignments ra ON ra.userid = u.id 
	JOIN mdl_role r ON ra.roleid = r.id 
	JOIN mdl_context con ON ra.contextid = con.id 
	JOIN mdl_course c ON c.id = con.instanceid AND con.contextlevel = 50 WHERE (r.shortname = \'student\' OR r.shortname = \'teacher\' OR r.shortname = \'editingteacher\' OR r.shortname = \'coursecreator\') AND c.id = ' . $courseid;
    $rs = get_recordset_sql($sql);
    if (!empty($rs)) {
        while ($rec = rs_fetch_next_record($rs)) {
            //prep dataobject for door
            $groupenroll = new object();
            $groupenroll->timeadded = time();
            $groupenroll->groupid = $groupid;
            $groupenroll->userid = $rec->id;
            $ingroup = get_record("groups_members", "groupid", $groupid, "userid", $rec->id);
            if (empty($ingroup)) {
                insert_record("groups_members", $groupenroll);
                print 'updated' . $groupenroll->groupid . $groupenroll->userid . '<br/>';
            }
        }
    } else {
        print_error("No users in this course!");
    }
    // Close the recordset to save memory
    rs_close($rs);
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:27,代码来源:locallib.php

示例4: print_filter

 function print_filter(&$mform, $data)
 {
     global $CFG, $db;
     $columns = $db->MetaColumns($CFG->prefix . 'course');
     $filteroptions = array();
     $filteroptions[''] = get_string('choose');
     $coursecolumns = array();
     foreach ($columns as $c) {
         $coursecolumns[$c->name] = $c->name;
     }
     if (!isset($coursecolumns[$data->field])) {
         print_error('nosuchcolumn');
     }
     $reportclassname = 'report_' . $this->report->type;
     $reportclass = new $reportclassname($this->report);
     $components = cr_unserialize($this->report->components);
     $conditions = $components['conditions'];
     $courselist = $reportclass->elements_by_conditions($conditions);
     if (!empty($courselist)) {
         if ($rs = get_recordset_sql('SELECT DISTINCT(' . $data->field . ') as ufield FROM ' . $CFG->prefix . 'course WHERE ' . $data->field . ' <> "" ORDER BY ufield ASC')) {
             while ($u = rs_fetch_next_record($rs)) {
                 $filteroptions[base64_encode($u->ufield)] = $u->ufield;
             }
         }
     }
     $mform->addElement('select', 'filter_fcoursefield_' . $data->field, get_string($data->field), $filteroptions);
     $mform->setType('filter_courses', PARAM_INT);
 }
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:28,代码来源:plugin.class.php

示例5: definition

 function definition()
 {
     global $CFG;
     $mform =& $this->_form;
     $report = $this->_customdata['report'];
     $options = array();
     if ($report->type != 'sql') {
         $components = cr_unserialize($this->_customdata['report']->components);
         if (is_array($components) && !empty($components['columns']['elements'])) {
             $columns = $components['columns']['elements'];
             foreach ($columns as $c) {
                 $options[] = $c['summary'];
             }
         }
     } else {
         require_once $CFG->dirroot . '/blocks/configurable_reports/report.class.php';
         require_once $CFG->dirroot . '/blocks/configurable_reports/reports/' . $report->type . '/report.class.php';
         $reportclassname = 'report_' . $report->type;
         $reportclass = new $reportclassname($report);
         $components = cr_unserialize($report->components);
         $config = isset($components['customsql']['config']) ? $components['customsql']['config'] : new stdclass();
         if (isset($config->querysql)) {
             $sql = $config->querysql;
             $sql = $reportclass->prepare_sql($sql);
             if ($rs = $reportclass->execute_query($sql)) {
                 $row = rs_fetch_next_record($rs);
                 $i = 0;
                 foreach ($row as $colname => $value) {
                     $options[$i] = str_replace('_', ' ', $colname);
                     $i++;
                 }
             }
         }
     }
     $optionsenabled = array(0 => get_string('disabled', 'block_configurable_reports'), 1 => get_string('enabled', 'block_configurable_reports'));
     $mform->addElement('select', 'enabled', get_string('template', 'block_configurable_reports'), $optionsenabled);
     $mform->setDefault('enabled', 0);
     $mform->addElement('htmleditor', 'header', get_string('header', 'block_configurable_reports'));
     $mform->disabledIf('header', 'enabled', 'eq', 0);
     $mform->setHelpButton('header', array('template_marks', get_string('conditionexpr'), 'block_configurable_reports'));
     $availablemarksrec = '';
     if ($options) {
         foreach ($options as $o) {
             $availablemarksrec .= "[[{$o}]] => {$o} <br />";
         }
     }
     $mform->addElement('static', 'statictext', get_string('availablemarks', 'block_configurable_reports'), $availablemarksrec);
     $mform->addElement('htmleditor', 'record', get_string('templaterecord', 'block_configurable_reports'));
     $mform->disabledIf('record', 'enabled', 'eq', 0);
     $mform->addElement('htmleditor', 'footer', get_string('footer', 'block_configurable_reports'));
     $mform->disabledIf('footer', 'enabled', 'eq', 0);
     $mform->setHelpButton('footer', array('template_marks', get_string('conditionexpr'), 'block_configurable_reports'));
     //$mform->addRule('record', get_string('required'), 'required', null, 'client');
     $mform->setType('header', PARAM_RAW);
     $mform->setType('record', PARAM_RAW);
     $mform->setType('footer', PARAM_RAW);
     $this->add_action_buttons();
 }
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:58,代码来源:form.php

示例6: elis_cron

/**
 * Run scheduled tasks according to a cron spec.
 */
function elis_cron()
{
    global $CFG;
    require $CFG->dirroot . '/elis/core/lib/tasklib.php';
    $timenow = time();
    // get all tasks that are (over-)due
    $tasks = get_recordset_select('elis_scheduled_tasks', 'nextruntime <= ' . $timenow, 'nextruntime ASC');
    if (empty($tasks)) {
        return;
    }
    while ($task = rs_fetch_next_record($tasks)) {
        $starttime = microtime();
        mtrace("Running {$task->callfunction}({$task->taskname}) from {$task->plugin}...");
        if ($task->enddate !== null && $task->enddate < $timenow) {
            mtrace('* Cancelling task: past end date');
            delete_records('elis_scheduled_tasks', 'id', $task->id);
            continue;
        }
        // FIXME: check for blocking tasks
        // FIXME: check if task is locked
        // See if some other cron has already run the function while we were
        // doing something else -- if so, skip it.
        $nextrun = get_field('elis_scheduled_tasks', 'nextruntime', 'id', $task->id);
        if ($nextrun > $timenow) {
            mtrace('* Skipped (someone else already ran it)');
            continue;
        }
        // calculate the next run time
        $newtask = new stdClass();
        $newtask->id = $task->id;
        $newtask->lastruntime = time();
        $newtask->nextruntime = cron_next_run_time($newtask->lastruntime, (array) $task);
        // see if we have any runs left
        if ($task->runsremaining !== null) {
            $newtask->runsremaining = $task->runsremaining - 1;
            if ($newtask->runsremaining <= 0) {
                mtrace('* Cancelling task: no runs left');
                delete_records('elis_scheduled_tasks', 'id', $task->id);
            } else {
                update_record('elis_scheduled_tasks', $newtask);
            }
        } else {
            update_record('elis_scheduled_tasks', $newtask);
        }
        // load the file and call the function
        if ($task->callfile) {
            $callfile = $CFG->dirroot . $task->callfile;
            if (!is_readable($callfile)) {
                mtrace('* Skipped (file not found)');
                continue;
            }
            require_once $callfile;
        }
        call_user_func(unserialize($task->callfunction), $task->taskname);
        $difftime = microtime_diff($starttime, microtime());
        mtrace("* {$difftime} seconds");
    }
}
开发者ID:benavidesrobert,项目名称:elis.base,代码行数:61,代码来源:cron.php

示例7: get_all_elements

 function get_all_elements()
 {
     $elements = array();
     $rs = get_recordset('course_categories', '', '', '', 'id');
     while ($course = rs_fetch_next_record($rs)) {
         $elements[] = $course->id;
     }
     return $elements;
 }
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:9,代码来源:report.class.php

示例8: xmldb_forum_upgrade

function xmldb_forum_upgrade($oldversion = 0)
{
    global $CFG, $THEME, $db;
    $result = true;
    /// And upgrade begins here. For each one, you'll need one
    /// block of code similar to the next one. Please, delete
    /// this comment lines once this file start handling proper
    /// upgrade code.
    /// if ($result && $oldversion < YYYYMMDD00) { //New version in version.php
    ///     $result = result of "/lib/ddllib.php" function calls
    /// }
    if ($result && $oldversion < 2007101000) {
        /// Define field timemodified to be added to forum_queue
        $table = new XMLDBTable('forum_queue');
        $field = new XMLDBField('timemodified');
        $field->setAttributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'postid');
        /// Launch add field timemodified
        $result = $result && add_field($table, $field);
    }
    //===== 1.9.0 upgrade line ======//
    if ($result and $oldversion < 2007101511) {
        notify('Processing forum grades, this may take a while if there are many forums...', 'notifysuccess');
        //MDL-13866 - send forum ratins to gradebook again
        require_once $CFG->dirroot . '/mod/forum/lib.php';
        // too much debug output
        $db->debug = false;
        forum_update_grades();
        $db->debug = true;
    }
    if ($result && $oldversion < 2007101512) {
        /// Cleanup the forum subscriptions
        notify('Removing stale forum subscriptions', 'notifysuccess');
        $roles = get_roles_with_capability('moodle/course:view', CAP_ALLOW);
        $roles = array_keys($roles);
        $roles = implode(',', $roles);
        $sql = "SELECT fs.userid, f.id AS forumid\n                  FROM {$CFG->prefix}forum f\n                       JOIN {$CFG->prefix}course c                 ON c.id = f.course\n                       JOIN {$CFG->prefix}context ctx              ON (ctx.instanceid = c.id AND ctx.contextlevel = " . CONTEXT_COURSE . ")\n                       JOIN {$CFG->prefix}forum_subscriptions fs   ON fs.forum = f.id\n                       LEFT JOIN {$CFG->prefix}role_assignments ra ON (ra.contextid = ctx.id AND ra.userid = fs.userid AND ra.roleid IN ({$roles}))\n                 WHERE ra.id IS NULL";
        if ($rs = get_recordset_sql($sql)) {
            $db->debug = false;
            while ($remove = rs_fetch_next_record($rs)) {
                delete_records('forum_subscriptions', 'userid', $remove->userid, 'forum', $remove->forumid);
                echo '.';
            }
            $db->debug = true;
            rs_close($rs);
        }
    }
    if ($result && $oldversion < 2007101513) {
        delete_records('forum_ratings', 'post', 0);
        /// Clean existing wrong rates. MDL-18227
    }
    return $result;
}
开发者ID:nadavkav,项目名称:MoodleTAO,代码行数:52,代码来源:upgrade.php

示例9: get_group_list

/**
 * Return a list of groups the user belongs to that apply to this forum (same grouping)
 * @param int $userid
 * @param int $forumid
 * @return an array of group lists or an empty array
 */
function get_group_list($userid, $forumid)
{
    global $CFG;
    //$courseid = forum::get_from_id($forumng->id, forum::CLONE_DIRECT)->get_course_id();
    $sql_group = "\nSELECT\n    g.id AS groupid\nFROM\n    {$CFG->prefix}forumng f\n    INNER JOIN {$CFG->prefix}course_modules cm on f.id = cm.instance \n    INNER JOIN {$CFG->prefix}modules m on cm.module = m.id \n    INNER JOIN {$CFG->prefix}groups_members gm ON gm.userid = {$userid} \n    INNER JOIN {$CFG->prefix}groups g ON gm.groupid = g.id AND g.courseid = cm.course \n    LEFT JOIN {$CFG->prefix}groupings_groups gg ON gg.groupid = g.id AND cm.groupingid = gg.groupingid \nWHERE\n    f.id = {$forumid}\n    AND m.name = 'forumng'\n    AND (cm.groupingid = 0 or gg.id IS NOT NULL)";
    $rs = forum_utils::get_recordset_sql($sql_group);
    $results = array();
    while ($rec = rs_fetch_next_record($rs)) {
        $results[] = $rec->groupid;
    }
    rs_close($rs);
    return $results;
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:19,代码来源:subscribe.php

示例10: display_search_field

 function display_search_field($value = '')
 {
     global $CFG;
     $varcharlat = sql_compare_text('content');
     $varcharlong = sql_compare_text('content1');
     $latlongsrs = get_recordset_sql("SELECT DISTINCT {$varcharlat} AS la, {$varcharlong} AS lo\n              FROM {$CFG->prefix}data_content\n             WHERE fieldid = {$this->field->id}\n             ORDER BY {$varcharlat}, {$varcharlong}");
     $options = array();
     while ($latlong = rs_fetch_next_record($latlongsrs)) {
         $options[$latlong->la . ',' . $latlong->lo] = $latlong->la . ',' . $latlong->lo;
     }
     rs_close($latlongsrs);
     return choose_from_menu($options, 'f_' . $this->field->id, $value, 'choose', '', 0, true);
 }
开发者ID:edwinphillips,项目名称:moodle-485cb39,代码行数:13,代码来源:field.class.php

示例11: query_drafts

 /**
  * Queries for draft posts, including necessary joins with other fields.
  * @param string $where Text of WHERE clause e.g. 'fdr.id=14'. May refer
  *   to aliases fdr (drafts), fd (discussions), fp (posts; post being 
  *   replied to), fpfirst (first post in discussion), and u (user being
  *   replied to)
  * @return array Array of forum_draft objects (empty if none)
  */
 static function query_drafts($where)
 {
     global $CFG;
     $result = array();
     $rs = get_recordset_sql("\nSELECT\n    fdr.*, fd.id AS discussionid, fpfirst.subject AS discussionsubject, \n    f.course AS courseid,\n    " . forum_utils::select_username_fields('u', false) . "\nFROM\n    {$CFG->prefix}forumng_drafts fdr\n    LEFT JOIN {$CFG->prefix}forumng_posts fp ON fdr.parentpostid = fp.id\n    LEFT JOIN {$CFG->prefix}forumng_discussions fd ON fp.discussionid = fd.id\n    LEFT JOIN {$CFG->prefix}forumng_posts fpfirst ON fd.postid = fpfirst.id\n    LEFT JOIN {$CFG->prefix}user u ON fp.userid = u.id\n    INNER JOIN {$CFG->prefix}forumng f ON fdr.forumid = f.id\nWHERE\n    {$where}\nORDER BY\n    fdr.saved DESC\n    ");
     if (!$rs) {
         throw new forum_exception("Failed to query for draft posts");
     }
     while ($rec = rs_fetch_next_record($rs)) {
         $result[] = new forum_draft($rec);
     }
     rs_close($rs);
     return $result;
 }
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:22,代码来源:forum_draft.php

示例12: add_selection_all

function add_selection_all($ufiltering)
{
    global $SESSION;
    $guest = get_guest();
    $sqlwhere = $ufiltering->get_sql_filter("id<>{$guest->id} AND deleted <> 1");
    if ($rs = get_recordset_select('user', $sqlwhere, 'fullname', 'id,' . sql_fullname() . ' AS fullname')) {
        while ($user = rs_fetch_next_record($rs)) {
            if (!isset($SESSION->bulk_users[$user->id])) {
                $SESSION->bulk_users[$user->id] = $user->id;
            }
        }
        rs_close($rs);
    }
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:14,代码来源:lib.php

示例13: create_report

 function create_report()
 {
     global $CFG;
     $components = cr_unserialize($this->config->components);
     $filters = isset($components['filters']['elements']) ? $components['filters']['elements'] : array();
     $calcs = isset($components['calcs']['elements']) ? $components['calcs']['elements'] : array();
     $tablehead = array();
     $finalcalcs = array();
     $finaltable = array();
     $tablehead = array();
     $components = cr_unserialize($this->config->components);
     $config = isset($components['customsql']['config']) ? $components['customsql']['config'] : new stdclass();
     if (isset($config->querysql)) {
         // FILTERS
         $sql = $config->querysql;
         if (!empty($filters)) {
             foreach ($filters as $f) {
                 require_once $CFG->dirroot . '/blocks/configurable_reports/components/filters/' . $f['pluginname'] . '/plugin.class.php';
                 $classname = 'plugin_' . $f['pluginname'];
                 $class = new $classname($this->config);
                 $sql = $class->execute($sql, $f['formdata']);
             }
         }
         $sql = $this->prepare_sql($sql);
         if ($rs = $this->execute_query($sql)) {
             while ($row = rs_fetch_next_record($rs)) {
                 if (empty($finaltable)) {
                     foreach ($row as $colname => $value) {
                         $tablehead[] = str_replace('_', ' ', $colname);
                     }
                 }
                 $finaltable[] = array_values((array) $row);
             }
         }
     }
     // Calcs
     $finalcalcs = $this->get_calcs($finaltable, $tablehead);
     $table = new stdclass();
     $table->id = 'reporttable';
     $table->data = $finaltable;
     $table->head = $tablehead;
     $calcs = new stdclass();
     $calcs->data = array($finalcalcs);
     $calcs->head = $tablehead;
     $this->finalreport->table = $table;
     $this->finalreport->calcs = $calcs;
     return true;
 }
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:48,代码来源:report.class.php

示例14: sermon_alphabetical_get_one_node

function sermon_alphabetical_get_one_node($letterstartnumber)
{
    global $CFG, $COURSE, $alphabet;
    if (empty($letterstartnumber)) {
        return '';
    }
    $extrawhere = array();
    for ($x = 0; $x < NUMBER_OF_PARTION_LETTERS; $x++) {
        $extrawhere[] = "name LIKE '{$alphabet[$letterstartnumber + $x]}%' ";
    }
    //get the relavant sermons for this sermon series
    $sql = "SELECT r.*, rs.datedelivered, rs.seriesname, rs.book, rs.beginchapter, cm.id as `cmid`,\n                rs.guestspeaker, rs.guestspeakername, rs.hitcounter, rs.lastaccess \n            FROM {$CFG->prefix}resource r \n                JOIN {$CFG->prefix}resource_sermon rs ON rs.resourceid = r.id\n                JOIN {$CFG->prefix}course_modules cm ON cm.instance = r.id \n            WHERE r.type = 'sermon' AND r.course = {$COURSE->id} AND name != '' ";
    $sql .= !empty($extrawhere) ? ' AND (' . implode(' OR ', $extrawhere) . ')' : '';
    $sql .= " ORDER BY r.name ASC";
    $sermons = get_recordset_sql($sql);
    //loop through and make them into an array of objecst compatible for a json_encode
    $letters = array();
    while (($sermon = rs_fetch_next_record($sermons)) !== false) {
        if (empty($sermon->seriesname)) {
            $sermon->seriesname = 'no name';
        }
        $sermon->datedelivered = date('m-d-Y', $sermon->datedelivered);
        $sermonnode = new stdClass();
        $sermonnode->attributes = new stdClass();
        $sermonnode->attributes->id = $sermon->cmid . '~' . sermon_block_make_name_safe_for_id($sermon->seriesname);
        $sermonnode->attributes->class = 'leaf sermon';
        if (!empty($sermon->reference)) {
            $sermonnode->attributes->class .= ' mp3 ';
        } else {
            if (!empty($sermon->referencesermontext)) {
                $sermonnode->attributes->class .= ' text ';
            } else {
                if (!empty($sermon->referencelesson)) {
                    $sermonnode->attributes->class .= ' lesson ';
                }
            }
        }
        $sermonnode->attributes->class .= rs_fetch_record($sermons) === false ? ' last ' : '';
        $sermonnode->data = get_string('sermonleaf', 'resource', $sermon);
        $letters[] = $sermonnode;
    }
    $letters = array_values($letters);
    if (empty($letters)) {
        return '';
    }
    return $letters;
}
开发者ID:NextEinstein,项目名称:riverhills,代码行数:47,代码来源:lib.php

示例15: add_form_elements

 function add_form_elements(&$mform, $fullform)
 {
     global $CFG, $db;
     $components = cr_unserialize($fullform->_customdata['report']->components);
     $options = array();
     if ($this->config->type != 'sql') {
         if (!is_array($components) || empty($components['columns']['elements'])) {
             print_error('nocolumns');
         }
         $columns = $components['columns']['elements'];
         $calcs = isset($components['calcs']['elements']) ? $components['calcs']['elements'] : array();
         $columnsused = array();
         if ($calcs) {
             foreach ($calcs as $c) {
                 $columnsused[] = $c['formdata']->column;
             }
         }
         $i = 0;
         foreach ($columns as $c) {
             if (!in_array($i, $columnsused)) {
                 $options[$i] = $c['summary'];
             }
             $i++;
         }
     } else {
         require_once $CFG->dirroot . '/blocks/configurable_reports/report.class.php';
         require_once $CFG->dirroot . '/blocks/configurable_reports/reports/' . $this->config->type . '/report.class.php';
         $reportclassname = 'report_' . $this->config->type;
         $reportclass = new $reportclassname($this->config);
         $components = cr_unserialize($this->config->components);
         $config = isset($components['customsql']['config']) ? $components['customsql']['config'] : new stdclass();
         if (isset($config->querysql)) {
             $sql = $config->querysql;
             $sql = $reportclass->prepare_sql($sql);
             if ($rs = $reportclass->execute_query($sql)) {
                 $row = rs_fetch_next_record($rs);
                 $i = 0;
                 foreach ($row as $colname => $value) {
                     $options[$i] = str_replace('_', ' ', $colname);
                     $i++;
                 }
             }
         }
     }
     $mform->addElement('header', '', get_string('coursefield', 'block_configurable_reports'), '');
     $mform->addElement('select', 'column', get_string('column', 'block_configurable_reports'), $options);
 }
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:47,代码来源:component.class.php


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