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

PHP get_records_list函数代码示例

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

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



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

示例1: 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}&page={$page->id}";
        } else {
            $baseurl = "{$CFG->wwwroot}/course/view.php?id={$COURSE->id}&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


示例2: get_content


//.........这里部分代码省略.........
                             $thisname = '<a href="' . $CFG->wwwroot . '/course/group.php?group=' . $groupid . '&amp;id=' . $courseid . '">' . $groupgrades[$groupid]['group'] . '</a>';
                             break;
                     }
                     $this->content->text .= '<tr><td>' . ++$rank . '.</td><td>' . $thisname . '</td><td>';
                     switch ($gradeformat) {
                         case B_QUIZRESULTS_GRADE_FORMAT_FRA:
                             $this->content->text .= format_float($averagegrade, $quiz->decimalpoints) . '/' . $quiz->grade;
                             break;
                         case B_QUIZRESULTS_GRADE_FORMAT_ABS:
                             $this->content->text .= format_float($averagegrade, $quiz->decimalpoints);
                             break;
                         default:
                         case B_QUIZRESULTS_GRADE_FORMAT_PCT:
                             $this->content->text .= round((double) $averagegrade / (double) $quiz->grade * 100) . '%';
                             break;
                     }
                     $this->content->text .= '</td></tr>';
                 }
                 $this->content->text .= '</tbody></table>';
             }
             break;
         case SEPARATEGROUPS:
             // This is going to be just like no-groups mode, only we 'll filter
             // out the grades from people not in our group.
             if (empty($USER) || empty($USER->id)) {
                 // Not logged in, so show nothing
                 return $this->content;
             }
             $mygroups = groups_get_all_groups($courseid, $USER->id);
             if (empty($mygroups)) {
                 // Not member of a group, show nothing
                 return $this->content;
             }
             $mygroupsusers = get_records_list('groups_members', 'groupid', implode(',', array_keys($mygroups)), '', 'userid, id');
             // There should be at least one user there, ourselves. So no more tests.
             // Just filter out the grades belonging to other users, and proceed as if there were no groups
             $strallowedusers = implode(',', array_keys($mygroupsusers));
             $grades = array_filter($grades, create_function('$el', '$allowed = explode(",", "' . $strallowedusers . '"); return in_array($el->userid, $allowed);'));
             // NO break; HERE, JUST GO AHEAD
         // NO break; HERE, JUST GO AHEAD
         default:
         case NOGROUPS:
             // Single user mode
             $numbest = empty($this->config->showbest) ? 0 : min($this->config->showbest, count($grades));
             $numworst = empty($this->config->showworst) ? 0 : min($this->config->showworst, count($grades) - $numbest);
             // Collect all the usernames we are going to need
             $remaining = $numbest;
             $grade = end($grades);
             while ($remaining--) {
                 $best[$grade->userid] = $grade->id;
                 $grade = prev($grades);
             }
             $remaining = $numworst;
             $grade = reset($grades);
             while ($remaining--) {
                 $worst[$grade->userid] = $grade->id;
                 $grade = next($grades);
             }
             if (empty($best) && empty($worst)) {
                 // Nothing to show, for some reason...
                 return $this->content;
             }
             // Now grab all the users from the database
             $userids = array_merge(array_keys($best), array_keys($worst));
             $users = get_records_list('user', 'id', implode(',', $userids), '', 'id, firstname, lastname, idnumber');
             // Ready for output!
开发者ID:r007,项目名称:PMoodle,代码行数:67,代码来源:block_quiz_results.php


示例3: decode_content_links_caller

 /**
  * Decode links in question type specific tables.
  * @return bool success or failure.
  */
 function decode_content_links_caller($questionids, $restore, &$i)
 {
     $status = true;
     // Decode links in the question_multichoice table.
     if ($multichoices = get_records_list('question_multichoice', 'question', implode(',', $questionids), '', 'id, correctfeedback, partiallycorrectfeedback, incorrectfeedback')) {
         foreach ($multichoices as $multichoice) {
             $correctfeedback = restore_decode_content_links_worker($multichoice->correctfeedback, $restore);
             $partiallycorrectfeedback = restore_decode_content_links_worker($multichoice->partiallycorrectfeedback, $restore);
             $incorrectfeedback = restore_decode_content_links_worker($multichoice->incorrectfeedback, $restore);
             if ($correctfeedback != $multichoice->correctfeedback || $partiallycorrectfeedback != $multichoice->partiallycorrectfeedback || $incorrectfeedback != $multichoice->incorrectfeedback) {
                 $subquestion->correctfeedback = addslashes($correctfeedback);
                 $subquestion->partiallycorrectfeedback = addslashes($partiallycorrectfeedback);
                 $subquestion->incorrectfeedback = addslashes($incorrectfeedback);
                 if (!update_record('question_multichoice', $multichoice)) {
                     $status = false;
                 }
             }
             // Do some output.
             if (++$i % 5 == 0 && !defined('RESTORE_SILENTLY')) {
                 echo ".";
                 if ($i % 100 == 0) {
                     echo "<br />";
                 }
                 backup_flush(300);
             }
         }
     }
     return $status;
 }
开发者ID:JackCanada,项目名称:moodle-hacks,代码行数:33,代码来源:questiontype.php


示例4: tag_get_name

/** 
 * Get the name of a tag
 * 
 * @param mixed $tagids the id of the tag, or an array of ids
 * @return mixed string name of one tag, or id-indexed array of strings
 */
function tag_get_name($tagids)
{
    $return_a_string = false;
    if (!is_array($tagids)) {
        $return_a_string = true;
        $tagids = array($tagids);
    }
    $tag_names = array();
    foreach (get_records_list('tag', 'id', implode(',', $tagids)) as $tag) {
        $tag_names[$tag->id] = $tag->name;
    }
    if ($return_a_string) {
        return array_pop($tag_names);
    }
    return $tag_names;
}
开发者ID:r007,项目名称:PMoodle,代码行数:22,代码来源:lib.php


示例5: survey_print_multi

function survey_print_multi($question)
{
    global $USER, $db, $qnum, $checklist;
    $stripreferthat = get_string("ipreferthat", "survey");
    $strifoundthat = get_string("ifoundthat", "survey");
    $strdefault = get_string('default');
    $strresponses = get_string('responses', 'survey');
    print_heading($question->text, null, 3, 'questiontext');
    echo "\n<table width=\"90%\" cellpadding=\"4\" cellspacing=\"1\" border=\"0\">";
    $options = explode(",", $question->options);
    $numoptions = count($options);
    $oneanswer = $question->type == 1 || $question->type == 2 ? true : false;
    if ($question->type == 2) {
        $P = "P";
    } else {
        $P = "";
    }
    echo "<tr class=\"smalltext\"><th scope=\"row\">{$strresponses}</th>";
    while (list($key, $val) = each($options)) {
        echo "<th scope=\"col\" class=\"hresponse\">{$val}</th>\n";
    }
    echo "<th>&nbsp;</th></tr>\n";
    if ($oneanswer) {
        echo "<tr><th scope=\"col\" colspan=\"6\">{$question->intro}</th></tr>\n";
    } else {
        echo "<tr><th scope=\"col\" colspan=\"7\">{$question->intro}</th></tr>\n";
    }
    $subquestions = get_records_list("survey_questions", "id", $question->multi);
    foreach ($subquestions as $q) {
        $qnum++;
        $rowclass = survey_question_rowclass($qnum);
        if ($q->text) {
            $q->text = get_string($q->text, "survey");
        }
        echo "<tr class=\"{$rowclass} rblock\">";
        if ($oneanswer) {
            echo "<th scope=\"row\" class=\"optioncell\">";
            echo "<b class=\"qnumtopcell\">{$qnum}</b> &nbsp; ";
            echo $q->text . "</th>\n";
            for ($i = 1; $i <= $numoptions; $i++) {
                $hiddentext = get_accesshide($options[$i - 1]);
                $id = "q{$P}" . $q->id . "_{$i}";
                echo "<td><label for=\"{$id}\"><input type=\"radio\" name=\"q{$P}{$q->id}\" id=\"{$id}\" value=\"{$i}\" />{$hiddentext}</label></td>";
            }
            $default = get_accesshide($strdefault, 'label', '', "for=\"q{$P}{$q->id}\"");
            echo "<td class=\"whitecell\"><input type=\"radio\" name=\"q{$P}{$q->id}\" id=\"q{$P}" . $q->id . "_D\" value=\"0\" checked=\"checked\" />{$default}</td>";
            $checklist["q{$P}{$q->id}"] = $numoptions;
        } else {
            // yu : fix for MDL-7501, possibly need to use user flag as this is quite ugly.
            echo "<th scope=\"row\" class=\"optioncell\">";
            echo "<b class=\"qnumtopcell\">{$qnum}</b> &nbsp; ";
            $qnum++;
            echo "<span class=\"preferthat smalltext\">{$stripreferthat}</span> &nbsp; ";
            echo "<span class=\"option\">{$q->text}</span></th>\n";
            for ($i = 1; $i <= $numoptions; $i++) {
                $hiddentext = get_accesshide($options[$i - 1]);
                $id = "qP" . $q->id . "_{$i}";
                echo "<td><label for=\"{$id}\"><input type=\"radio\" name=\"qP{$q->id}\" id=\"{$id}\" value=\"{$i}\" />{$hiddentext}</label></td>";
            }
            $default = get_accesshide($strdefault, 'label', '', "for=\"qP{$q->id}\"");
            echo "<td><input type=\"radio\" name=\"qP{$q->id}\" id=\"qP{$q->id}\" value=\"0\" checked=\"checked\" />{$default}</td>";
            echo "</tr>";
            echo "<tr class=\"{$rowclass} rblock\">";
            echo "<th scope=\"row\" class=\"optioncell\">";
            echo "<b class=\"qnumtopcell\">{$qnum}</b> &nbsp; ";
            echo "<span class=\"foundthat smalltext\">{$strifoundthat}</span> &nbsp; ";
            echo "<span class=\"option\">{$q->text}</span></th>\n";
            for ($i = 1; $i <= $numoptions; $i++) {
                $hiddentext = get_accesshide($options[$i - 1]);
                $id = "q" . $q->id . "_{$i}";
                echo "<td><label for=\"{$id}\"><input type=\"radio\" name=\"q{$q->id}\" id=\"{$id}\" value=\"{$i}\" />{$hiddentext}</label></td>";
            }
            $default = get_accesshide($strdefault, 'label', '', "for=\"q{$q->id}\"");
            echo "<td class=\"buttoncell\"><input type=\"radio\" name=\"q{$q->id}\" id=\"q{$q->id}\" value=\"0\" checked=\"checked\" />{$default}</td>";
            $checklist["qP{$q->id}"] = $numoptions;
            $checklist["q{$q->id}"] = $numoptions;
        }
        echo "</tr>\n";
    }
    echo "</table>";
}
开发者ID:JackCanada,项目名称:moodle-hacks,代码行数:81,代码来源:lib.php


示例6: attforblock_backup_attendance_log

function attforblock_backup_attendance_log($bf, $preferences, $attforblock)
{
    global $CFG;
    $status = true;
    $sessions = get_records_menu('attendance_sessions', 'courseid', $attforblock->course);
    $sesslist = implode(',', array_keys($sessions));
    $datas = get_records_list('attendance_log', 'sessionid', $sesslist);
    //If there is levels
    if ($datas) {
        //Write start tag
        $status = fwrite($bf, start_tag('LOGS', 4, true));
        //Iterate over each log
        foreach ($datas as $item) {
            //Start log
            $status = fwrite($bf, start_tag('LOG', 5, true));
            //Print log contents
            fwrite($bf, full_tag('ID', 6, false, $item->id));
            fwrite($bf, full_tag('SESSIONID', 6, false, $item->sessionid));
            fwrite($bf, full_tag('STUDENTID', 6, false, $item->studentid));
            fwrite($bf, full_tag('STATUSID', 6, false, $item->statusid));
            fwrite($bf, full_tag('TIMETAKEN', 6, false, $item->timetaken));
            fwrite($bf, full_tag('TAKENBY', 6, false, $item->takenby));
            fwrite($bf, full_tag('STATUSSET', 6, false, $item->statusset));
            fwrite($bf, full_tag('REMARKS', 6, false, $item->remarks));
            //End submission
            $status = fwrite($bf, end_tag('LOG', 5, true));
        }
        //Write end tag
        $status = fwrite($bf, end_tag('LOGS', 4, true));
    }
    return $status;
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:32,代码来源:backuplib.php


示例7: get_nearest_item

 /**
  * When called on a loaded scale object (with a valid id) and given a float grade between
  * the grademin and grademax, this method returns the scale item that falls closest to the
  * float given (which is usually an average of several grades on a scale). If the float falls
  * below 1 but above 0, it will be rounded up to 1.
  * @param float $grade
  * @return string
  */
 function get_nearest_item($grade)
 {
     // Obtain nearest scale item from average
     $scales_array = get_records_list('scale', 'id', $this->id);
     $scale = $scales_array[$this->id];
     $scales = explode(",", $scale->scale);
     // this could be a 0 when summed and rounded, e.g, 1, no grade, no grade, no grade
     if ($grade < 1) {
         $grade = 1;
     }
     return $scales[$grade - 1];
 }
开发者ID:edwinphillips,项目名称:moodle-485cb39,代码行数:20,代码来源:grade_scale.php


示例8: quiz_upgrade


//.........这里部分代码省略.........
        $success = $success && modify_database('', 'UPDATE prefix_quiz_numerical SET answers = answer');
        $success = $success && table_column('quiz_questions', '', 'parent', 'integer', '10', 'unsigned', '0', 'not null', 'category');
        $success = $success && modify_database('', "UPDATE prefix_quiz_questions SET parent = id WHERE qtype ='" . RANDOM . "';");
        // convert multianswer questions to the new model
        if ($multianswers = get_records_sql("SELECT m.id, q.category, q.id AS parent,\n                                        q.name, q.questiontextformat, m.norm AS\n                                        defaultgrade, m.answertype AS qtype,\n                                        q.version, q.hidden, m.answers,\n                                        m.positionkey\n                                        FROM {$CFG->prefix}quiz_questions q,\n                                             {$CFG->prefix}quiz_multianswers m\n                                        WHERE q.qtype = '" . MULTIANSWER . "'\n                                        AND   q.id = m.question\n                                        ORDER BY q.id ASC, m.positionkey ASC")) {
            $multianswers = array_values($multianswers);
            $n = count($multianswers);
            $parent = $multianswers[0]->parent;
            $sequence = array();
            // turn reporting off temporarily to avoid one line output per set_field
            $olddebug = $db->debug;
            $db->debug = false;
            for ($i = 0; $i < $n; $i++) {
                $answers = $multianswers[$i]->answers;
                unset($multianswers[$i]->answers);
                $pos = $multianswers[$i]->positionkey;
                unset($multianswers[$i]->positionkey);
                // create questions for all the multianswer victims
                unset($multianswers[$i]->id);
                $multianswers[$i]->length = 0;
                $multianswers[$i]->questiontext = '';
                $multianswers[$i]->stamp = make_unique_id_code();
                $id = insert_record('quiz_questions', $multianswers[$i]);
                $success = $success && $id;
                $sequence[$pos] = $id;
                // update the answers table to point to these new questions
                $success = $success && modify_database('', "UPDATE prefix_quiz_answers SET question = '{$id}' WHERE id IN ({$answers});");
                // update the questiontype tables to point to these new questions
                if (SHORTANSWER == $multianswers[$i]->qtype) {
                    $success = $success && modify_database('', "UPDATE prefix_quiz_shortanswer SET question = '{$id}' WHERE answers = '{$answers}';");
                } else {
                    if (NUMERICAL == $multianswers[$i]->qtype) {
                        if (strpos($answers, ',')) {
                            $numerical = get_records_list('quiz_numerical', 'answer', $answers);
                            // Get the biggest tolerance value
                            $tolerance = 0;
                            foreach ($numerical as $num) {
                                $tolerance = $tolerance < $num->tolerance ? $num->tolerance : $tolerance;
                            }
                            $success = $success && delete_records_select('quiz_numerical', "answer IN ({$answers})");
                            $new = new stdClass();
                            $new->question = $id;
                            $new->tolerance = $tolerance;
                            $new->answers = $answers;
                            $success = $success && insert_record('quiz_numerical', $new);
                            unset($numerical, $new, $tolerance);
                        } else {
                            $success = $success && modify_database('', "UPDATE prefix_quiz_numerical SET question = '{$id}', answers = '{$answers}' WHERE answer IN ({$answers});");
                        }
                    } else {
                        if (MULTICHOICE == $multianswers[$i]->qtype) {
                            $success = $success && modify_database('', "UPDATE prefix_quiz_multichoice SET question = '{$id}' WHERE answers = '{$answers}';");
                        }
                    }
                }
                if (!isset($multianswers[$i + 1]) || $parent != $multianswers[$i + 1]->parent) {
                    $success = $success && delete_records('quiz_multianswers', 'question', $parent);
                    $multi = new stdClass();
                    $multi->question = $parent;
                    $multi->sequence = implode(',', $sequence);
                    $success = $success && insert_record('quiz_multianswers', $multi);
                    if (isset($multianswers[$i + 1])) {
                        $parent = $multianswers[$i + 1]->parent;
                        $sequence = array();
                    }
                }
开发者ID:BackupTheBerlios,项目名称:samouk-svn,代码行数:67,代码来源:postgres7.php


示例9: get_studentshtml

 /**
  * Builds and return the HTML rows of the table (grades headed by student).
  * @return string HTML
  */
 function get_studentshtml()
 {
     global $CFG, $USER;
     $studentshtml = '';
     $strfeedback = $this->get_lang_string("feedback");
     $strgrade = $this->get_lang_string('grade');
     $gradetabindex = 1;
     $numusers = count($this->users);
     $showuserimage = $this->get_pref('showuserimage');
     $showuseridnumber = $this->get_pref('showuseridnumber');
     $fixedstudents = $this->is_fixed_students();
     // Preload scale objects for items with a scaleid
     $scales_list = '';
     $tabindices = array();
     foreach ($this->gtree->items as $item) {
         if (!empty($item->scaleid)) {
             $scales_list .= "{$item->scaleid},";
         }
         $tabindices[$item->id]['grade'] = $gradetabindex;
         $tabindices[$item->id]['feedback'] = $gradetabindex + $numusers;
         $gradetabindex += $numusers * 2;
     }
     $scales_array = array();
     if (!empty($scales_list)) {
         $scales_list = substr($scales_list, 0, -1);
         $scales_array = get_records_list('scale', 'id', $scales_list);
     }
     $row_classes = array(' even ', ' odd ');
     $row_classes = array(' even ', ' odd ');
     foreach ($this->users as $userid => $user) {
         if ($this->canviewhidden) {
             $altered = array();
             $unknown = array();
         } else {
             $hiding_affected = grade_grade::get_hiding_affected($this->grades[$userid], $this->gtree->items);
             $altered = $hiding_affected['altered'];
             $unknown = $hiding_affected['unknown'];
             unset($hiding_affected);
         }
         $columncount = 0;
         if ($fixedstudents) {
             $studentshtml .= '<tr class="r' . $this->rowcount++ . $row_classes[$this->rowcount % 2] . '">';
         } else {
             // Student name and link
             $user_pic = null;
             if ($showuserimage) {
                 $user_pic = '<div class="userpic">' . print_user_picture($user, $this->courseid, null, 0, true) . '</div>';
             }
             $studentshtml .= '<tr class="r' . $this->rowcount++ . $row_classes[$this->rowcount % 2] . '">' . '<th class="c' . $columncount++ . ' user" scope="row" onclick="set_row(this.parentNode.rowIndex);">' . $user_pic . '<a href="' . $CFG->wwwroot . '/user/view.php?id=' . $user->id . '&amp;course=' . $this->course->id . '">' . fullname($user) . '</a></th>';
             if ($showuseridnumber) {
                 $studentshtml .= '<th class="c' . $columncount++ . ' useridnumber" onclick="set_row(this.parentNode.rowIndex);">' . $user->idnumber . '</th>';
             }
         }
         foreach ($this->gtree->items as $itemid => $unused) {
             $item =& $this->gtree->items[$itemid];
             $grade = $this->grades[$userid][$item->id];
             // Get the decimal points preference for this item
             $decimalpoints = $item->get_decimals();
             if (in_array($itemid, $unknown)) {
                 $gradeval = null;
             } else {
                 if (array_key_exists($itemid, $altered)) {
                     $gradeval = $altered[$itemid];
                 } else {
                     $gradeval = $grade->finalgrade;
                 }
             }
             // MDL-11274
             // Hide grades in the grader report if the current grader doesn't have 'moodle/grade:viewhidden'
             if (!$this->canviewhidden and $grade->is_hidden()) {
                 if (!empty($CFG->grade_hiddenasdate) and $grade->get_datesubmitted() and !$item->is_category_item() and !$item->is_course_item()) {
                     // the problem here is that we do not have the time when grade value was modified, 'timemodified' is general modification date for grade_grades records
                     $studentshtml .= '<td class="cell c' . $columncount++ . '"><span class="datesubmitted">' . userdate($grade->get_datesubmitted(), get_string('strftimedatetimeshort')) . '</span></td>';
                 } else {
                     $studentshtml .= '<td class="cell c' . $columncount++ . '">-</td>';
                 }
                 continue;
             }
             // emulate grade element
             $eid = $this->gtree->get_grade_eid($grade);
             $element = array('eid' => $eid, 'object' => $grade, 'type' => 'grade');
             $cellclasses = 'grade cell c' . $columncount++;
             if ($item->is_category_item()) {
                 $cellclasses .= ' cat';
             }
             if ($item->is_course_item()) {
                 $cellclasses .= ' course';
             }
             if ($grade->is_overridden()) {
                 $cellclasses .= ' overridden';
             }
             if ($grade->is_excluded()) {
                 // $cellclasses .= ' excluded';
             }
             $grade_title = '<div class="fullname">' . fullname($user) . '</div>';
             $grade_title .= '<div class="itemname">' . $item->get_name(true) . '</div>';
//.........这里部分代码省略.........
开发者ID:kai707,项目名称:ITSA-backup,代码行数:101,代码来源:lib.php


示例10: get_records_list

    if ($question->multi) {
        $addlist = $question->multi;
    } else {
        $addlist = $qid;
    }
    if ($virtualscales && $question->type < 0) {
        // only use them
        $fullorderlist .= $addlist;
    } else {
        if (!$virtualscales && $question->type >= 0) {
            // ignore them
            $fullorderlist .= $addlist;
        }
    }
}
$fullquestions = get_records_list("survey_questions", "id", $fullorderlist);
//  Question type of multi-questions overrides the type of single questions
foreach ($order as $key => $qid) {
    $question = $questions[$qid];
    if ($question->multi) {
        $subs = explode(",", $question->multi);
        while (list($skey, $sqid) = each($subs)) {
            $fullquestions["{$sqid}"]->type = $question->type;
        }
    }
}
$order = explode(",", $fullorderlist);
$questions = $fullquestions;
//  Translate all the question texts
foreach ($questions as $key => $question) {
    $questions[$key]->text = get_string($question->text, "survey");
开发者ID:JackCanada,项目名称:moodle-hacks,代码行数:31,代码来源:download.php


示例11: tracker_printsearchfields

/**
* prints the human understandable search query form
* @param array $fields
*/
function tracker_printsearchfields($fields)
{
    foreach ($fields as $key => $value) {
        switch (trim($key)) {
            case 'datereported':
                if (!function_exists('trk_userdate')) {
                    function trk_userdate(&$a)
                    {
                        $a = userdate($a);
                        $a = preg_replace("/, \\d\\d:\\d\\d/", '', $a);
                    }
                }
                array_walk($value, 'trk_userdate');
                $strs[] = get_string($key, 'tracker') . ' ' . get_string('IN', 'tracker') . " ('" . implode("','", $value) . "')";
                break;
            case 'summary':
                $strs[] = "('" . implode("','", $value) . "') " . get_string('IN', 'tracker') . ' ' . get_string('summary', 'tracker');
                break;
            case 'description':
                $strs[] = "('" . implode("','", $value) . "') " . get_string('IN', 'tracker') . ' ' . get_string('description');
                break;
            case 'reportedby':
                $users = get_records_list('user', 'id', implode(',', $value), 'lastname', 'id,firstname,lastname');
                $reporters = array();
                if ($users) {
                    foreach ($users as $user) {
                        $reporters[] = fullname($user);
                    }
                }
                $reporterlist = implode("', '", $reporters);
                $strs[] = get_string('reportedby', 'tracker') . ' ' . get_string('IN', 'tracker') . " ('" . $reporterlist . "')";
                break;
            default:
                $strs[] = get_string($key, 'tracker') . ' ' . get_string('IN', 'tracker') . " ('" . implode("','", $value) . "')";
        }
    }
    return implode(' ' . get_string('AND', 'tracker') . ' ', $strs);
}
开发者ID:nadavkav,项目名称:MoodleTAO,代码行数:42,代码来源:locallib.php


示例12: foreach

    foreach ($teachers as $teacher) {
        //if ($teacher->id != $course->id && $teacher->id != SITEID){
        if ($teacher->id != SITEID) {
            $tcourseids .= $teacher->id . ',';
        }
    }
}
print_heading(get_string("importsection", 'format_project'));
// quick forms
include_once 'import_form.php';
if (!$fromcourse) {
    // 私が担当したコース
    $taught_courses = array();
    if (!empty($tcourseids)) {
        $tcourseids = substr($tcourseids, 0, -1);
        $taught_courses = get_records_list('course', 'id', $tcourseids);
    }
    if (!empty($creator)) {
        $cat_courses = get_courses($course->category);
    } else {
        $cat_courses = array();
    }
    $options = array();
    foreach ($taught_courses as $tcourse) {
        //if ($tcourse->id != $course->id && $tcourse->id != SITEID){
        if ($tcourse->format == 'project') {
            $options[$tcourse->id] = format_string($tcourse->fullname);
        }
    }
    if (empty($options) && empty($creator)) {
        notify(get_string('courseimportnotaught'));
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:31,代码来源:import.php


示例13: getForumsForHierarchy

 public function getForumsForHierarchy($parentDataItemId)
 {
     global $CFG;
     global $SynchContentHierarchy;
     // Have the modules been loaded for the parent section? if not load them
     if (!$SynchContentHierarchy->hasModulesLoaded($parentDataItemId)) {
         $this->getAndAppendModulesToSection($parentDataItemId);
     }
     $parentId = SynchContentHierarchy::getIdFromDataItemId($parentDataItemId);
     $sectionId = $parentId;
     $forumIds = $this->getInstanceIdsFromModulesByModuleType($parentDataItemId, '1010000006');
     if (!is_array($forumIds)) {
         return null;
     }
     $records = get_records_list("forum", "id", implode(',', $forumIds), null, "id, course, type, name, intro");
     if (!$records || !count($records)) {
         return null;
     }
     $contentItems = array();
     $contentItem = null;
     $record = null;
     foreach ($records as $record) {
         $contentItem = new SynchContentItem(array('id' => $record->id, 'name' => $record->name, 'description' => $record->intro));
         $contentItems[$record->id] = $contentItem;
     }
     return $contentItems;
 }
开发者ID:r007,项目名称:PMoodle,代码行数:27,代码来源:synch_view_controller.php


示例14: quiz_restore_pre15_multianswer

function quiz_restore_pre15_multianswer($old_question_id, $new_question_id, $info, $restore)
{
    global $CFG;
    $status = true;
    //We need some question fields here so we get the full record from DB
    $parentquestion = get_record('question', 'id', $new_question_id);
    //We need to store all the positions with their created questions
    //to be able to calculate the sequence field
    $createdquestions = array();
    //Under 1.5, every multianswer record becomes a question itself
    //with its parent set to the cloze question. And there is only
    //ONE multianswer record with the sequence of questions used.
    //Get the multianswers array
    $multianswers_array = $info['#']['MULTIANSWERS']['0']['#']['MULTIANSWER'];
    //Iterate over multianswers_array
    for ($i = 0; $i < sizeof($multianswers_array); $i++) {
        $mul_info = $multianswers_array[$i];
        //traverse_xmlize($mul_info);                                                                 //Debug
        //print_object ($GLOBALS['traverse_array']);                                                  //Debug
        //$GLOBALS['traverse_array']="";                                                              //Debug
        //We need this later
        $oldid = backup_todb($mul_info['#']['ID']['0']['#']);
        //Now, build the question_multianswer record structure
        $multianswer->question = $new_question_id;
        $multianswer->answers = backup_todb($mul_info['#']['ANSWERS']['0']['#']);
        $multianswer->positionkey = backup_todb($mul_info['#']['POSITIONKEY']['0']['#']);
        $multianswer->answertype = backup_todb($mul_info['#']['ANSWERTYPE']['0']['#']);
        $multianswer->norm = backup_todb($mul_info['#']['NORM']['0']['#']);
        //Saving multianswer and positionkey to use them later restoring states
        backup_putid($restore->backup_unique_code, 'multianswer-pos', $oldid, $multianswer->positionkey);
        //We have to recode all the answers to their new ids
        $ansarr = explode(",", $multianswer->answers);
        foreach ($ansarr as $key => $value) {
            //Get the answer from backup_ids
            $answer = backup_getid($restore->backup_unique_code, 'question_answers', $value);
            $ansarr[$key] = $answer->new_id;
        }
        $multianswer->answers = implode(",", $ansarr);
        //Build the new question structure
        $question = new object();
        $question->category = $parentquestion->category;
        $question->parent = $parentquestion->id;
        $question->name = $parentquestion->name;
        $question->questiontextformat = $parentquestion->questiontextformat;
        $question->defaultgrade = $multianswer->norm;
        $question->penalty = $parentquestion->penalty;
        $question->qtype = $multianswer->answertype;
        $question->version = $parentquestion->version;
        $question->hidden = $parentquestion->hidden;
        $question->length = 0;
        $question->questiontext = '';
        $question->stamp = make_unique_id_code();
        //Save the new question to DB
        $newid = insert_record('question', $question);
        if ($newid) {
            $createdquestions[$multianswer->positionkey] = $newid;
        }
        //Do some output
        if (($i + 1) % 50 == 0) {
            if (!defined('RESTORE_SILENTLY')) {
                echo ".";
                if (($i + 1) % 1000 == 0) {
                    echo "<br />";
                }
            }
            backup_flush(300);
        }
        //Remap question_answers records from the original multianswer question
        //to their newly created question
        if ($newid) {
            $answersdb = get_records_list('question_answers', 'id', $multianswer->answers);
            foreach ($answersdb as $answerdb) {
                set_field('question_answers', 'question', $newid, 'id', $answerdb->id);
            }
        }
        //If we have created the question record, now, depending of the
        //answertype, delegate the restore to every qtype function
        if ($newid) {
            if ($multianswer->answertype == "1") {
                $status = quiz_restore_pre15_shortanswer($old_question_id, $newid, $mul_info, $restore, $multianswer->answers);
            } else {
                if ($multianswer->answertype == "3") {
                    $status = quiz_restore_pre15_multichoice($old_question_id, $newid, $mul_info, $restore, $multianswer->answers);
                } else {
                    if ($multianswer->answertype == "8") {
                        $status = quiz_restore_pre15_numerical($old_question_id, $newid, $mul_info, $restore, $multianswer->answers);
                    }
                }
            }
        } else {
            $status = false;
        }
    }
    //Everything is created, just going to create the multianswer record
    if ($status) {
        ksort($createdquestions);
        $multianswerdb = new object();
        $multianswerdb->question = $parentquestion->id;
        $multianswerdb->sequence = implode(",", $createdquestions);
        $mid = insert_record('question_multianswer', $multianswerdb);
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:samouk-svn,代码行数:101,代码来源:restorelibpre15.php


示例15: get_record

         }
     }
     $graph->parameter['y_max_left'] = $numoptions - 1;
     $graph->parameter['y_axis_gridlines'] = $numoptions;
     $graph->parameter['y_resolution_left'] = 1;
     $graph->parameter['y_decimal_left'] = 1;
     $graph->parameter['x_axis_angle'] = 20;
     $graph->draw();
     break;
 case "studentmultiquestion.png":
     $question = get_record("survey_questions", "id", $qid);
     $question->text = get_string($question->text, "survey");
     $question->options = get_string($question->options, "survey");
     $options = explode(",", $question->options);
     $questionorder = explode(",", $question->multi);
     $qqq = get_records_list("survey_questions", "id", $question->multi);
     foreach ($questionorder as $i => $val) {
         $names[$i] = get_string($qqq[$val]->shorttext, "survey");
         $buckets1[$i] = 0;
         $buckets2[$i] = 0;
         $count1[$i] = 0;
         $count2[$i] = 0;
         $indexof[$val] = $i;
         $studbuckets1[$i] = 0.0;
         $studbuckets2[$i] = 0.0;
         $studcount1[$i] = 0;
         $studcount2[$i] = 0;
         $stdev1[$i] = 0.0;
         $stdev2[$i] = 0.0;
     }
     $aaa = get_records_select("survey_answers", "((survey = {$cm->instance}) AND (question in ({$question->multi})))");
开发者ID:veritech,项目名称:pare-project,代码行数:31,代码来源:graph.php


示例16: get_string

if (has_capability('moodle/course:create', $syscontext)) {
    $creator = true;
}
$strimport = get_string("importdata");
$tcourseids = '';
if ($teachers = get_user_capability_course('moodle/course:update')) {
    foreach ($teachers as $teacher) {
        if ($teacher->id != $course->id && $teacher->id != SITEID) {
            $tcourseids .= $teacher->id . ',';
        }
    }
}
$taught_courses = array();
if (!empty($tcourseids)) {
    $tcourseids = substr($tcourseids, 0, -1);
    $taught_courses = get_records_list('course', 'id', $tcourseids, 'sortorder');
}
if (!empty($creator)) {
    $cat_courses = get_courses($course->category, $sort = "c.sortorder ASC", $fields = "c.id, c.fullname");
} else {
    $cat_courses = array();
}
print_heading(get_string("importactivities"));
$options = array();
foreach ($taught_c 

鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP get_records_menu函数代码示例发布时间:2022-05-15
下一篇:
PHP get_records_csv函数代码示例发布时间: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