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

PHP get_records_select_menu函数代码示例

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

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



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

示例1: get_selection_data

function get_selection_data($ufiltering)
{
    global $SESSION;
    // get the SQL filter
    $guest = get_guest();
    $sqlwhere = $ufiltering->get_sql_filter("id<>{$guest->id} AND deleted <> 1");
    $total = count_records_select('user', "id<>{$guest->id} AND deleted <> 1");
    $acount = count_records_select('user', $sqlwhere);
    $scount = count($SESSION->bulk_users);
    $userlist = array('acount' => $acount, 'scount' => $scount, 'ausers' => false, 'susers' => false, 'total' => $total);
    $userlist['ausers'] = get_records_select_menu('user', $sqlwhere, 'fullname', 'id,' . sql_fullname() . ' AS fullname', 0, MAX_BULK_USERS);
    if ($scount) {
        if ($scount < MAX_BULK_USERS) {
            $in = implode(',', $SESSION->bulk_users);
        } else {
            $bulkusers = array_slice($SESSION->bulk_users, 0, MAX_BULK_USERS, true);
            $in = implode(',', $bulkusers);
        }
        $userlist['susers'] = get_records_select_menu('user', "id IN ({$in})", 'fullname', 'id,' . sql_fullname() . ' AS fullname');
    }
    return $userlist;
}
开发者ID:JackCanada,项目名称:moodle-hacks,代码行数:22,代码来源:lib.php


示例2: profile_list_categories

/**
 * Retrieve a list of categories and ids suitable for use in a form
 * @return   array
 */
function profile_list_categories()
{
    if (!($categories = get_records_select_menu('user_info_category', '', 'sortorder ASC', 'id, name'))) {
        $categories = array();
    }
    return $categories;
}
开发者ID:JackCanada,项目名称:moodle-hacks,代码行数:11,代码来源:definelib.php


示例3: xmldb_attforblock_upgrade


//.........这里部分代码省略.........
        $field = new XMLDBField('timemodified');
        $field->setAttributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, null, null, null, null, null, 'lasttaken');
        $result = $result && change_field_unsigned($table, $field);
        $table = new XMLDBTable('attendance_log');
        $field = new XMLDBField('attsid');
        $field->setAttributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'id');
        $result = $result && change_field_unsigned($table, $field);
        $field = new XMLDBField('studentid');
        $field->setAttributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'attsid');
        $result = $result && change_field_unsigned($table, $field);
        $field = new XMLDBField('statusid');
        $field->setAttributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'status');
        $result = $result && add_field($table, $field);
        $field = new XMLDBField('statusset');
        $field->setAttributes(XMLDB_TYPE_CHAR, '100', null, null, null, null, null, null, 'statusid');
        $result = $result && add_field($table, $field);
        $field = new XMLDBField('timetaken');
        $field->setAttributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'statusid');
        $result = $result && add_field($table, $field);
        $field = new XMLDBField('takenby');
        $field->setAttributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'timetaken');
        $result = $result && add_field($table, $field);
        //Indexes
        $index = new XMLDBIndex('statusid');
        $index->setAttributes(XMLDB_INDEX_NOTUNIQUE, array('statusid'));
        $result = $result && add_index($table, $index);
        $index = new XMLDBIndex('attsid');
        $index->setAttributes(XMLDB_INDEX_NOTUNIQUE, array('attsid'));
        $result = $result && drop_index($table, $index);
        $field = new XMLDBField('attsid');
        //Rename field
        $field->setAttributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'id');
        $result = $result && rename_field($table, $field, 'sessionid');
        $index = new XMLDBIndex('sessionid');
        $index->setAttributes(XMLDB_INDEX_NOTUNIQUE, array('sessionid'));
        $result = $result && add_index($table, $index);
        $table = new XMLDBTable('attendance_settings');
        $field = new XMLDBField('courseid');
        $field->setAttributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'id');
        $result = $result && change_field_unsigned($table, $field);
        $field = new XMLDBField('visible');
        $field->setAttributes(XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '1', 'grade');
        $result = $result && add_field($table, $field);
        $field = new XMLDBField('deleted');
        $field->setAttributes(XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'visible');
        $result = $result && add_field($table, $field);
        //Indexes
        $index = new XMLDBIndex('visible');
        $index->setAttributes(XMLDB_INDEX_NOTUNIQUE, array('visible'));
        $result = $result && add_index($table, $index);
        $index = new XMLDBIndex('deleted');
        $index->setAttributes(XMLDB_INDEX_NOTUNIQUE, array('deleted'));
        $result = $result && add_index($table, $index);
        $result = $result && rename_table($table, 'attendance_statuses');
    }
    if ($oldversion < 2008102406 and $result) {
        if ($courses = get_records_sql("SELECT courseid FROM {$CFG->prefix}attendance_sessions GROUP BY courseid")) {
            foreach ($courses as $c) {
                //Adding own status for course (now it must have own)
                if (!count_records('attendance_statuses', 'courseid', $c->courseid)) {
                    $statuses = get_records('attendance_statuses', 'courseid', 0);
                    foreach ($statuses as $stat) {
                        $rec = $stat;
                        $rec->courseid = $c->courseid;
                        insert_record('attendance_statuses', $rec);
                    }
                }
                $statuses = get_records('attendance_statuses', 'courseid', $c->courseid);
                $statlist = implode(',', array_keys($statuses));
                $sess = get_records_select_menu('attendance_sessions', "courseid = {$c->courseid} AND lasttakenby > 0");
                $sesslist = implode(',', array_keys($sess));
                foreach ($statuses as $stat) {
                    execute_sql("UPDATE {$CFG->prefix}attendance_log\n\t\t\t\t\t\t\t\t\t\tSET statusid = {$stat->id}, statusset = '{$statlist}'\n\t\t\t\t\t\t\t\t\t  WHERE sessionid IN ({$sesslist}) AND status = '{$stat->status}'");
                }
                $sessions = get_records_list('attendance_sessions', 'id', $sesslist);
                foreach ($sessions as $sess) {
                    execute_sql("UPDATE {$CFG->prefix}attendance_log\n\t\t\t\t\t\t\t\t\t\tSET timetaken = {$sess->lasttaken}, \n\t\t\t\t\t\t\t\t\t\t\ttakenby = {$sess->lasttakenby}\n\t\t\t\t\t\t\t\t\t  WHERE sessionid = {$sess->id}");
                }
            }
        }
    }
    if ($oldversion < 2008102409 and $result) {
        $table = new XMLDBTable('attendance_statuses');
        $field = new XMLDBField('status');
        $result = $result && drop_field($table, $field);
        $index = new XMLDBIndex('status');
        $index->setAttributes(XMLDB_INDEX_NOTUNIQUE, array('status'));
        $result = $result && drop_index($table, $index);
        $table = new XMLDBTable('attendance_log');
        $field = new XMLDBField('status');
        $result = $result && drop_field($table, $field);
        $index = new XMLDBIndex('status');
        $index->setAttributes(XMLDB_INDEX_NOTUNIQUE, array('status'));
        $result = $result && drop_index($table, $index);
        $table = new XMLDBTable('attendance_sessions');
        $field = new XMLDBField('creator');
        $result = $result && drop_field($table, $field);
    }
    return $result;
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:101,代码来源:upgrade.php


示例4: get_keypair

 /**
  * Get the keypair. If it doesn't exist, create it. If it's out of date, 
  * archive it and create a fresh pair.
  *
  * @param  bool      True if you want to force fresh keys to be generated
  * @return bool     
  * @access private
  */
 public function get_keypair($regenerate = null)
 {
     $this->keypair = array();
     $records = null;
     if ($records = get_records_select_menu('config', "field IN ('openssl_keypair', 'openssl_keypair_expires')", 'field', 'field, value')) {
         list($this->keypair['certificate'], $this->keypair['keypair_PEM']) = explode('@@@@@@@@', $records['openssl_keypair']);
         $this->keypair['expires'] = $records['openssl_keypair_expires'];
         if (empty($regenerate) && $this->keypair['expires'] > time()) {
             return true;
         }
     }
     // Save out the old key
     $openssl_history = $this->get_history();
     array_unshift($openssl_history, $this->keypair);
     $this->save_history($openssl_history);
     // Initialize a new set of SSL keys
     $this->keypair = array();
     $this->generate_keypair();
     // A record for the keys
     $keyrecord = new stdClass();
     $keyrecord->field = 'openssl_keypair';
     $keyrecord->value = implode('@@@@@@@@', $this->keypair);
     // A convenience record for the keys' expire time (UNIX timestamp)
     $expiresrecord = new stdClass();
     $expiresrecord->field = 'openssl_keypair_expires';
     // Getting the expire timestamp is convoluted, but required:
     $credentials = openssl_x509_parse($this->keypair['certificate']);
     if (is_array($credentials) && isset($credentials['validTo_time_t'])) {
         $expiresrecord->value = $credentials['validTo_time_t'];
         $this->keypair['expires'] = $credentials['validTo_time_t'];
     }
     if (empty($records)) {
         db_begin();
         insert_record('config', $keyrecord);
         insert_record('config', $expiresrecord);
         db_commit();
     } else {
         db_begin();
         update_record('config', $keyrecord, array('field' => 'openssl_keypair'));
         update_record('config', $expiresrecord, array('field' => 'openssl_keypair_expires'));
         db_commit();
     }
     log_info("New public key has been generated. It expires " . date('Y/m/d h:i:s', $credentials['validTo_time_t']));
     return true;
 }
开发者ID:richardmansfield,项目名称:richardms-mahara,代码行数:53,代码来源:lib.php


示例5: move_questions

 function move_questions($oldcat, $newcat)
 {
     $questionids = get_records_select_menu('question', "category = {$oldcat} AND (parent = 0 OR parent = id)", '', 'id,1');
     if (!question_move_questions_to_category(implode(',', array_keys($questionids)), $newcat)) {
         print_error('errormovingquestions', 'question', $returnurl, $ids);
     }
 }
开发者ID:kai707,项目名称:ITSA-backup,代码行数:7,代码来源:category_class.php


示例6: definition

 function definition()
 {
     global $CFG, $COURSE, $ESPCONFIG, $questionnaire, $QUESTIONNAIRE_REALMS, $SESSION;
     $mform =& $this->_form;
     $mform->addElement('html', '<div class="qcontainer">');
     //-------------------------------------------------------------------------------
     $mform->addElement('header', 'questionhdr', get_string('questions', 'questionnaire'));
     $mform->setHelpButton('questionhdr', array('questiontypes', get_string('questiontypes', 'questionnaire'), 'questionnaire'));
     $stredit = get_string('edit', 'questionnaire');
     $strremove = get_string('remove', 'questionnaire');
     $stryes = get_string('yes');
     $strno = get_string('no');
     /// Set up question positions.
     if (!isset($questionnaire->questions)) {
         $questionnaire->questions = array();
     }
     $quespos = array();
     $max = count($questionnaire->questions);
     $sec = 0;
     for ($i = 1; $i <= $max; $i++) {
         $quespos[$i] = "{$i}";
     }
     $pos = 0;
     $numq = count($questionnaire->questions);
     $attributes = 'onChange="this.form.submit()"';
     $select = '';
     if (!($qtypes = get_records_select_menu('questionnaire_question_type', $select, '', 'typeid,type'))) {
         $qtypes = array();
     }
     // needed for non-English languages JR
     foreach ($qtypes as $key => $qtype) {
         $qtypes[$key] = questionnaire_get_type($key);
     }
     natsort($qtypes);
     $addqgroup = array();
     $addqgroup[] =& $mform->createElement('select', 'type_id', '', $qtypes);
     // 'sticky' type_id value for further new questions
     if (isset($SESSION->questionnaire->type_id)) {
         $mform->setDefault('type_id', $SESSION->questionnaire->type_id);
     }
     $addqgroup[] =& $mform->createElement('submit', 'addqbutton', get_string('addselqtype', 'questionnaire'));
     $mform->addGroup($addqgroup, 'addqgroup', '', '', false);
     $mform->addElement('html', '<div class="qheader">');
     $quesgroup = array();
     $quesgroup[] =& $mform->createElement('static', 'opentagt', '', '<div class="qicons">' . get_string('action', 'questionnaire') . '</div>');
     $quesgroup[] =& $mform->createElement('static', 'qnamet', '', '<div class="qtype">' . get_string('questiontypes', 'questionnaire') . '</div>');
     $quesgroup[] =& $mform->createElement('static', 'qreqt', '', '<div class="qreq">' . get_string('required') . '</div>');
     $quesgroup[] =& $mform->createElement('static', 'qtypet', '', '<div class="qname">' . get_string('optionalname', 'questionnaire') . '</div>');
     $mform->addGroup($quesgroup, 'questgroupt', '', '', false);
     $mform->addElement('html', '</div>');
     foreach ($questionnaire->questions as $question) {
         /// Skip displaying this question if we are moving this question.
         if ($this->moveq && $this->moveq == $question->id) {
             continue;
         }
         $required = '';
         $qid = $question->id;
         $tid = $question->type_id;
         $qtype = $question->type;
         $required = $question->required;
         $pos = $question->position;
         // needed for non-English languages JR
         $qtype = '[' . questionnaire_get_type($tid) . ']';
         $content = '';
         if ($tid == 99) {
             $sec++;
             $content .= '<b>' . get_string('sectionbreak', 'questionnaire') . '</b>';
         } else {
             $content = $question->content;
         }
         $quesgroup = 'quesgroup_' . $pos;
         ${$quesgroup} = array();
         //            ${$quesgroup}[] =& $mform->createElement('select', 'pos['.$question->id.']', '', $quespos, $attributes);
         //            $mform->setDefault('pos['.$question->id.']', $pos);
         //            if ($question->type_id == QUESPAGEBREAK) {
         //                ${$quesgroup}[] =& $mform->createElement('submit', 'editbutton['.$question->id.']', $stredit, array('disabled' => 'disabled'));
         //            } else {
         //                ${$quesgroup}[] =& $mform->createElement('submit', 'editbutton['.$question->id.']', $stredit);
         //            }
         //            ${$quesgroup}[] =& $mform->createElement('submit', 'removebutton['.$question->id.']', $strremove);
         $butclass = array('class' => 'questionnaire_qbut');
         if (!$this->moveq) {
             $uextra = array('value' => $question->id, 'alt' => get_string('moveup', 'questionnaire'), 'title' => get_string('moveup', 'questionnaire')) + $butclass;
             $dextra = array('value' => $question->id, 'alt' => get_string('movedn', 'questionnaire'), 'title' => get_string('movedn', 'questionnaire')) + $butclass;
             $mextra = array('value' => $question->id, 'alt' => get_string('move', 'questionnaire'), 'title' => get_string('move', 'questionnaire')) + $butclass;
             $eextra = array('value' => $question->id, 'alt' => get_string('edit', 'questionnaire'), 'title' => get_string('edit', 'questionnaire')) + $butclass;
             $rextra = array('value' => $question->id, 'alt' => get_string('remove', 'questionnaire'), 'title' => get_string('remove', 'questionnaire')) + $butclass;
             if ($pos == 1) {
                 $usrc = $CFG->wwwroot . '/mod/questionnaire/images/upd.gif';
                 $uextra += array('disabled' => 'disabled');
             } else {
                 $usrc = $CFG->wwwroot . '/mod/questionnaire/images/up.gif';
             }
             if ($pos == $numq) {
                 $dsrc = $CFG->wwwroot . '/mod/questionnaire/images/downd.gif';
                 $dextra += array('disabled' => 'disabled');
             } else {
                 $dsrc = $CFG->wwwroot . '/mod/questionnaire/images/down.gif';
             }
             if ($question->type_id == QUESPAGEBREAK) {
//.........这里部分代码省略.........
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:101,代码来源:questions_form.php


示例7: getUserData

 /**
  * Returns information about the users.
  * @param string $sqlwhere filter for the users
  */
 function getUserData($sqlwhere)
 {
     return get_records_select_menu('user', $sqlwhere, 'fullname', 'id,' . sql_fullname() . ' AS fullname');
 }
开发者ID:BackupTheBerlios,项目名称:samouk-svn,代码行数:8,代码来源:user_bulk_form.php


示例8: question_delete_course_category

/**
 * Category is about to be deleted,
 * 1/ All question categories and their questions are deleted for this course category.
 * 2/ All questions are moved to new category
 *
 * @param object $category course category object
 * @param object $newcategory empty means everything deleted, otherwise id of category where content moved
 * @param boolean $feedback to specify if the process must output a summary of its work
 * @return boolean
 */
function question_delete_course_category($category, $newcategory, $feedback = true)
{
    $context = get_context_instance(CONTEXT_COURSECAT, $category->id);
    if (empty($newcategory)) {
        $feedbackdata = array();
        // To store feedback to be showed at the end of the process
        $rescueqcategory = null;
        // See the code around the call to question_save_from_deletion.
        $strcatdeleted = get_string('unusedcategorydeleted', 'quiz');
        // Loop over question categories.
        if ($categories = get_records('question_categories', 'contextid', $context->id, 'parent', 'id, parent, name')) {
            foreach ($categories as $category) {
                // Deal with any questions in the category.
                if ($questions = get_records('question', 'category', $category->id)) {
                    // Try to delete each question.
                    foreach ($questions as $question) {
                        delete_question($question->id);
                    }
                    // Check to see if there were any questions that were kept because they are
                    // still in use somehow, even though quizzes in courses in this category will
                    // already have been deteted. This could happen, for example, if questions are
                    // added to a course, and then that course is moved to another category (MDL-14802).
                    $questionids = get_records_select_menu('question', 'category = ' . $category->id, '', 'id,1');
                    if (!empty($questionids)) {
                        if (!($rescueqcategory = question_save_from_deletion(implode(',', array_keys($questionids)), get_parent_contextid($context), print_context_name($context), $rescueqcategory))) {
                            return false;
                        }
                        $feedbackdata[] = array($category->name, get_string('questionsmovedto', 'question', $rescueqcategory->name));
                    }
                }
                // Now delete the category.
                if (!delete_records('question_categories', 'id', $category->id)) {
                    return false;
                }
                $feedbackdata[] = array($category->name, $strcatdeleted);
            }
            // End loop over categories.
        }
        // Output feedback if requested.
        if ($feedback and $feedbackdata) {
            $table = new stdClass();
            $table->head = array(get_string('questioncategory', 'question'), get_string('action'));
            $table->data = $feedbackdata;
            print_table($table);
        }
    } else {
        // Move question categories ot the new context.
        if (!($newcontext = get_context_instance(CONTEXT_COURSECAT, $newcategory->id))) {
            return false;
        }
        if (!set_field('question_categories', 'contextid', $newcontext->id, 'contextid', $context->id)) {
            return false;
        }
        if ($feedback) {
            $a = new stdClass();
            $a->oldplace = print_context_name($context);
            $a->newplace = print_context_name($newcontext);
            notify(get_string('movedquestionsandcategories', 'question', $a), 'notifysuccess');
        }
    }
    return true;
}
开发者ID:e-rasvet,项目名称:reader,代码行数:72,代码来源:questionlib.php


示例9: load_current_permissions

 protected function load_current_permissions()
 {
     /// Load the overrides/definition in this context.
     if ($this->roleid) {
         $this->permissions = get_records_select_menu('role_capabilities', "roleid = {$this->roleid} AND contextid = " . $this->context->id, '', 'capability,permission');
     } else {
         $this->permissions = array();
     }
 }
开发者ID:nadavkav,项目名称:MoodleTAO,代码行数:9,代码来源:lib.php


示例10: redirect

    }
    redirect($return, ' Finished successfully :-) ', 5);
}
$msgform = new user_courselist_form('user_bulk_enroll.php');
if ($msgform->is_cancelled()) {
    redirect($return);
} else {
    if ($formdata = $msgform->get_data(false)) {
        $options = new object();
        $options->para = false;
        $options->newlines = true;
        $options->smiley = false;
        $inu = implode(',', $SESSION->bulk_users);
        $userlist = get_records_select_menu('user', "id IN ({$inu})", 'fullname', 'id,' . sql_fullname() . ' AS fullname');
        $inc = implode(',', $formdata->courses);
        $courselist = get_records_select_menu('course', "id IN ({$inc})", 'shortname', 'id,shortname');
        $optionsyes = array();
        $optionsyes['confirm'] = 1;
        $optionsyes['sesskey'] = sesskey();
        //$optionsyes['msg']     = $msg;
        $optionsyes['courses'] = implode(',', $formdata->courses);
        $optionsyes['roleid'] = $formdata->role;
        admin_externalpage_print_header();
        print_heading(get_string('confirmation', 'admin'));
        print_box('רישום המשתמשים:<br/>' . implode(',', $userlist) . '<br/><br/>בתפקיד "' . $allroles[$formdata->role] . '"<br/><br/> לקורסים הבאים:<br/>' . implode(',', $courselist), 'boxwidthnarrow boxaligncenter generalbox', 'preview');
        notice_yesno('האם אתם מאשרים?', 'user_bulk_enroll.php', 'user_bulk.php', $optionsyes, NULL, 'post', 'get');
        admin_externalpage_print_footer();
        die;
    }
}
admin_externalpage_print_header();
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:31,代码来源:user_bulk_enroll.php


示例11: instance_config_print

 function instance_config_print()
 {
     global $CFG;
     if (!isset($this->config)) {
         // ... teacher has not yet configured the block, let's put some default values here to explain things
         $this->config->title = get_string('blockname', 'block_glossary_random');
         $this->config->refresh = 0;
         $this->config->showconcept = 1;
         $this->config->cache = get_string('notyetconfigured', 'block_glossary_random');
         $this->config->addentry = get_string('addentry', 'block_glossary_random');
         $this->config->viewglossary = get_string('viewglossary', 'block_glossary_random');
         $this->config->invisible = get_string('invisible', 'block_glossary_random');
     }
     // select glossaries to put in dropdown box ...
     $glossaries = get_records_select_menu('glossary', 'course=' . $this->course->id, 'name', 'id,name');
     //format menu texts to avoid html and to filter multilang values
     if (!empty($glossaries)) {
         foreach ($glossaries as $key => $value) {
             $glossaries[$key] = strip_tags(format_string($value, true));
         }
     }
     // and select quotetypes to put in dropdown box
     $type[0] = get_string('random', 'block_glossary_random');
     $type[1] = get_string('lastmodified', 'block_glossary_random');
     $type[2] = get_string('nextone', 'block_glossary_random');
     $this->config->nexttime = usergetmidnight(time()) + DAYSECS * $this->config->refresh;
     // display the form
     if (is_file($CFG->dirroot . '/blocks/' . $this->name() . '/config_instance.html')) {
         print_simple_box_start('center', '', '', 5, 'blockconfigglobal');
         include $CFG->dirroot . '/blocks/' . $this->name() . '/config_instance.html';
         print_simple_box_end();
     } else {
         notice(get_string('blockconfigbad'), str_replace('blockaction=', 'dummy=', qualified_me()));
     }
     return true;
 }
开发者ID:BackupTheBerlios,项目名称:samouk-svn,代码行数:36,代码来源:block_glossary_random.php


示例12: upgrade_to_new_roles_ui

function upgrade_to_new_roles_ui()
{
    global $CFG;
    /// New table for storing which roles can be assigned in which contexts.
    /// Define table role_context_levels to be created
    $table = new XMLDBTable('role_context_levels');
    /// Adding fields to table role_context_levels
    $table->addFieldInfo('id', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE, null, null, null);
    $table->addFieldInfo('roleid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, null);
    $table->addFieldInfo('contextlevel', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, null);
    /// Adding keys to table role_context_levels
    $table->addKeyInfo('primary', XMLDB_KEY_PRIMARY, array('id'));
    $table->addKeyInfo('contextlevel-roleid', XMLDB_KEY_UNIQUE, array('contextlevel', 'roleid'));
    $table->addKeyInfo('roleid', XMLDB_KEY_FOREIGN, array('roleid'), 'role', array('id'));
    /// Conditionally launch create table for role_context_levels
    if (!table_exists($table)) {
        create_table($table);
    }
    /// Now populate the role_context_levels table with the defaults that match
    /// moodle_install_roles, and any other combinations that exist in this system.
    $roleids = get_records_menu('role', '', '', '', 'shortname,id');
    /// Defaults, should match moodle_install_roles.
    $rolecontextlevels = array();
    if (isset($roleids['admin'])) {
        $rolecontextlevels[$roleids['admin']] = get_default_contextlevels('admin');
    }
    if (isset($roleids['coursecreator'])) {
        $rolecontextlevels[$roleids['coursecreator']] = get_default_contextlevels('coursecreator');
    }
    if (isset($roleids['editingteacher'])) {
        $rolecontextlevels[$roleids['editingteacher']] = get_default_contextlevels('editingteacher');
    }
    if (isset($roleids['teacher'])) {
        $rolecontextlevels[$roleids['teacher']] = get_default_contextlevels('teacher');
    }
    if (isset($roleids['student'])) {
        $rolecontextlevels[$roleids['student']] = get_default_contextlevels('student');
    }
    if (isset($roleids['guest'])) {
        $rolecontextlevels[$roleids['guest']] = get_default_contextlevels('guest');
    }
    if (isset($roleids['user'])) {
        $rolecontextlevels[$roleids['user']] = get_default_contextlevels('user');
    }
    /// See what other role assignments are in this database, extend the allowed
    /// lists to allow them too.
    $existingrolecontextlevels = get_recordset_sql('SELECT DISTINCT ra.roleid, con.contextlevel FROM
            {role_assignments} ra JOIN {context} con ON ra.contextid = con.id');
    foreach ($existingrolecontextlevels as $rcl) {
        $rcl = (object) $rcl;
        if (!isset($rolecontextlevels[$rcl->roleid])) {
            $rolecontextlevels[$rcl->roleid] = array($rcl->contextlevel);
        } else {
            if (!in_array($rcl->contextlevel, $rolecontextlevels[$rcl->roleid])) {
                $rolecontextlevels[$rcl->roleid][] = $rcl->contextlevel;
            }
        }
    }
    /// Put the data into the database.
    foreach ($rolecontextlevels as $roleid => $contextlevels) {
        set_role_contextlevels($roleid, $contextlevels);
    }
    /// Remove any role overrides for moodle/site:doanything, or any permissions
    /// for it in a role without legacy:admin.
    $systemcontext = get_context_instance(CONTEXT_SYSTEM);
    // Remove all overrides.
    delete_records_select('role_capabilities', "capability = 'moodle/site:doanything'\n        AND contextid <> {$systemcontext->id}");
    $roletest = '';
    // Get the ids of all the roles that are moodle/legacy:admin.
    if ($adminroleids = get_records_select_menu('role_capabilities', "capability = 'moodle/legacy:admin' AND permission = 1 AND contextid = {$systemcontext->id}", '', 'id, roleid')) {
        $roletest = 'IN ( ' . implode(',', $adminroleids) . ')';
    } else {
        $adminroleids = array();
    }
    delete_records_select('role_capabilities', "roleid NOT {$roletest}\n        AND capability = 'moodle/site:doanything'AND contextid = {$systemcontext->id}");
    set_field_select('role_capabilities', 'permission', 1, "roleid {$roletest} AND capability = 'moodle/site:doanything' AND contextid = {$systemcontext->id}");
    // And for any admin-y roles where moodle/site:doanything is not set, set it.
    $doanythingroleids = get_records_select_menu('role_capabilities', "capability = 'moodle/site:doanything' AND permission = 1 AND contextid = {$systemcontext->id}", '', 'id, roleid');
    foreach ($adminroleids as $roleid) {
        if (!in_array($roleid, $doanythingroleids)) {
            $rc = new stdClass();
            $rc->contextid = $systemcontext->id;
            $rc->roleid = $roleid;
            $rc->capability = 'moodle/site:doanything';
            $rc->permission = 1;
            $rc->timemodified = time();
            insert_record('role_capabilities', $rc);
        }
    }
    set_config('roles_ui_backport_upgraded', 1);
}
开发者ID:nadavkav,项目名称:MoodleTAO,代码行数:91,代码来源:newui.php


示例13: questionnaire_get_active_surveys_menu

function questionnaire_get_active_surveys_menu()
{
    global $QUESTIONNAIRE_ACTIVE1;
    global $QUESTIONNAIRE_ACTIVE2;
    $select = "status in ({$QUESTIONNAIRE_ACTIVE1},{$QUESTIONNAIRE_ACTIVE2})";
    return get_records_select_menu('questionnaire_survey', $select);
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:7,代码来源:lib.php


示例14: array_unique

             case QUESTION_FILEMOVELINKSONLY:
                 $url = $flipurls[$key];
                 $questionids = array_unique($urls[$url]);
                 foreach ($questionids as $questionid) {
                     $question = $questions[$questionid];
                     $QTYPES[$question->qtype]->replace_file_links($question, $fromcoursefilesid, $tocoursefilesid, $url, $destination);
                 }
                 break;
             case QUESTION_FILEDONOTHING:
             default:
                 break;
         }
     }
 }
 //adjust sortorder before we make the cat a peer of it's new peers
 $peers = get_records_select_menu('question_categories', "contextid = {$toparent->contextid} AND parent = {$toparent->id}", 'sortorder ASC', 'id, 1');
 $peers = array_keys($peers);
 if ($totop) {
     array_unshift($peers, $cattomove->id);
 } else {
     $peers[] = $cattomove->id;
 }
 $sortorder = 0;
 foreach ($peers as $peer) {
     if (!set_field('question_categories', "sortorder", $sortorder, "id", $peer)) {
         print_error('listupdatefail', '', $onerrorurl);
     }
     $sortorder++;
 }
 //now move category
 $cat = new object();
开发者ID:JackCanada,项目名称:moodle-hacks,代码行数:31,代码来源:contextmove.php


示例15: redirect

$return = $CFG->wwwroot . '/' . $CFG->admin . '/user/user_bulk.php';
if (empty($SESSION->bulk_users)) {
    redirect($return);
}
admin_externalpage_print_header();
//TODO: add support for large number of users
if ($confirm and confirm_sesskey()) {
    $primaryadmin = get_admin();
    $in = implode(',', $SESSION->bulk_users);
    if ($rs = get_recordset_select('user', "id IN ({$in})")) {
        while ($user = rs_fetch_next_record($rs)) {
            if ($primaryadmin->id != $user->id and $USER->id != $user->id and delete_user($user)) {
                unset($SESSION->bulk_users[$user->id]);
            } else {
                notify(get_string('deletednot', '', fullname($user, true)));
            }
        }
        rs_close($rs);
    }
    redirect($return, get_string('changessaved'));
} else {
    $in = implode(',', $SESSION->bulk_users);
    $userlist = get_records_select_menu('user', "id IN ({$in})", 'fullname', 'id,' . sql_fullname() . ' AS fullname');
    $usernames = implode(', ', $userlist);
    $optionsyes = array();
    $optionsyes['confirm'] = 1;
    $optionsyes['sesskey'] = sesskey();
    print_heading(get_string('confirmation', 'admin'));
    notice_yesno(get_string('deletecheckfull', '', $usernames), 'user_bulk_delete.php', 'user_bulk.php', $optionsyes, NULL, 'post', 'get');
}
admin_externalpage_print_footer();
开发者ID:edwinphillips,项目名称:moodle-485cb39,代码行数:31,代码来源:user_bulk_delete.php


示例16: feedback_is_already_submitted

/** 
 *  check for multiple_submit = false.
 *  if the feedback is global so the courseid must be given
 *  @param int $feedbackid
 *  @param int $courseid
 *  @return boolean true if the feedback already is submitted otherwise false
 */
function feedback_is_already_submitted($feedbackid, $courseid = false)
{
    global $USER;
    $select = 'userid = ' . $USER->id . ' AND feedback = ' . $feedbackid;
    if (!($trackings = get_records_select_menu('feedback_tracking', $select, '', 'id, completed'))) {
        return false;
    }
    if ($courseid) {
        $select = 'completed IN (' . implode(',', $trackings) . ') AND course_id = ' . $courseid;
        if (!($values = get_records_select('feedback_value', $select))) {
            return false;
        }
    }
    return true;
}
开发者ID:nadavkav,项目名称:MoodleTAO,代码行数:22,代码来源:lib.php


示例17: xmldb_format_page_upgrade

/**
 * Format Upgrade Path
 *
 * @version $Id: upgrade.php,v 1.1 2009/12/21 01:00:29 michaelpenne Exp $
 * @package format_page
 **/
function xmldb_format_page_upgrade($oldversion = 0)
{
    global $CFG, $db;
    include_once $CFG->dirroot . '/course/format/page/lib.php';
    $result = true;
    if ($result && $oldversion < 2007041202) {
        /// Define field id to be added to block_course_menu
        $table = new XMLDBTable('format_page');
        /// Add field showbuttons
        $field = new XMLDBField('showbuttons');
        $field->setAttributes(XMLDB_TYPE_INTEGER, '4', XMLDB_UNSIGNED, null, null, null, null, 0, 'template');
        $result = $result && add_field($table, $field);
    }
    if ($result && $oldversion < 2007042500) {
        // update showbuttons settings to allow for indedependent bitwise previous & next
        if (defined('BUTTON_BOTH')) {
            $result = set_field('format_page', 'showbuttons', BUTTON_BOTH, 'showbuttons', 1);
        } else {
            $result = false;
            notify('BUTTON_BOTH constant not set', 'notifyfailure');
        }
    }
    if ($result && $oldversion < 2007042503) {
        /// Define index index (not unique) to be added to format_page
        $table = new XMLDBTable('format_page');
        $index = new XMLDBIndex('parentpageindex');
        $index->setAttributes(XMLDB_INDEX_NOTUNIQUE, array('parent'));
        if (!index_exists($table, $index)) {
            $result = $result && add_index($table, $index);
        }
        $index = new XMLDBIndex('sortorderpageindex');
        $index->setAttributes(XMLDB_INDEX_NOTUNIQUE, array('sortorder'));
        if (!index_exists($table, $index)) {
            $result = $result && add_index($table, $index);
        }
        // now add indexes for format_page_items tables
        $table = new XMLDBTable('format_page_items');
        $index = new XMLDBIndex('format_page_items_sortorder_index');
        $index->setAttributes(XMLDB_INDEX_NOTUNIQUE, array('sortorder'));
        if (!index_exists($table, $index)) {
            $result = $result && add_index($table, $index);
        }
        $index = new XMLDBIndex('format_page_items_pageid_index');
        $index->setAttributes(XMLDB_INDEX_NOTUNIQUE, array('pageid'));
        if (!index_exists($table, $index)) {
            $result = $result && add_index($table, $index);
        }
    }
    if ($result && $oldversion < 2007071800) {
        $validcourses = get_records_menu('course', '', '', '', 'id, shortname');
        if (!empty($validcourses)) {
            $keys = array_keys($validcourses);
            $invalidpages = get_records_select_menu('format_page', 'courseid NOT IN(' . implode(', ', $keys) . ')', '', 'id, nameone');
            if (!empty($invalidpages)) {
                $pagekeys = array_keys($invalidpages);
                delete_records_select('format_page_items', 'pageid IN (' . implode(', ', $pagekeys) . ')');
                delete_records_select('format_page', 'id IN (' . implode(', ', $pagekeys) . ')');
            }
        } else {
            delete_records('format_page');
            delete_records('format_page_items');
        }
    }
    if ($result && $oldversion < 2007071801) {
        /// Define field width to be dropped from format_page_items
        $table = new XMLDBTable('format_page_items');
        $field = new XMLDBField('width');
        /// Launch drop field width
        $result = $result && drop_field($table, $field);
    }
    if ($result && $oldversion < 2007071802) {
        /// Changing logic for sortorder field to more closely resemble block weight
        // This could be huge, do not output everything
        $olddebug = $db->debug;
        $db->debug = false;
        // Setup some values
        $result = true;
        $i = 0;
        if ($rs = get_recordset('format_page', '1', '1', '', 'id')) {
            if ($rs->RecordCount() > 0) {
                echo 'Processing page item sortorder field....';
                while ($page = rs_fetch_next_record($rs)) {
                    if ($pageitems = get_records('format_page_items', 'pageid', $page->id, 'sortorder', 'id, position')) {
                        // Organize by position
                        $organized = array('l' => array(), 'c' => array(), 'r' => array());
                        foreach ($pageitems as $pageitem) {
                            $organized[$pageitem->position][] = $pageitem->id;
                        }
                        // Now - reset sortorder value
                        foreach ($organized as $position => $pageitemids) {
                            $sortorder = 0;
                            foreach ($pageitemids as $pageitemid) {
                                $result = $result and set_field('format_page_items', 'sortorder', $sortorder, 'id', $pageitemid);
                                $sortorder++;
//.........这里部分代码省略.........
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:101,代码来源:upgrade.php


示例18: scorm_view_display

function scorm_view_display($user, $scorm, $action, $cm, $boxwidth = '')
{
    global $CFG;
    if ($scorm->updatefreq == UPDATE_EVERYTIME 

鲜花

握手

雷人

路过

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

请发表评论

全部评论

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