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

PHP get_record函数代码示例

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

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



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

示例1: definition_after_data

 function definition_after_data()
 {
     global $CFG;
     parent::definition_after_data();
     $mform =& $this->_form;
     if ($association_id = $mform->getElementValue('association_id')) {
         if ($record = get_record(CLSTCURTABLE, 'id', $association_id)) {
             //cluster stuff
             if ($cluster_record = get_record(CLSTTABLE, 'id', $record->clusterid)) {
                 foreach ($this->cluster_fields as $id => $display) {
                     $element =& $mform->getElement('cluster' . $id);
                     $element->setValue($cluster_record->{$id});
                 }
             }
             //curriculum stuff
             $curriculum_sql = "SELECT cur.idnumber,\n                                          cur.name,\n                                          cur.description,\n                                          cur.reqcredits,\n                                   COUNT(curcrs.id) as numcourses\n                                   FROM {$CFG->prefix}crlm_curriculum cur\n                                   LEFT JOIN {$CFG->prefix}crlm_curriculum_course curcrs\n                                   ON curcrs.curriculumid = cur.id\n                                   WHERE cur.id = {$record->curriculumid}";
             if ($curriculum_record = get_record_sql($curriculum_sql)) {
                 foreach ($this->curriculum_fields as $id => $display) {
                     $element =& $mform->getElement('curriculum' . $id);
                     $element->setValue($curriculum_record->{$id});
                 }
             }
             //association stuff
             $autoenrol_element =& $mform->getElement('autoenrol');
             $autoenrol_element->setValue($record->autoenrol);
         }
     }
 }
开发者ID:remotelearner,项目名称:elis.cm,代码行数:28,代码来源:clustercurriculumeditform.class.php


示例2: getRecordDataById

 public static function getRecordDataById($type, $id)
 {
     $sql = 'SELECT c.id, c.name, c.ctime, c.description, cv.view AS viewid, c.owner
     FROM {collectio}n c
     LEFT OUTER JOIN {collection_view} cv ON cv.collection = c.id
     WHERE id = ? ORDER BY cv.displayorder asc LIMIT 1;';
     $record = get_record_sql($sql, array($id));
     if (!$record) {
         return false;
     }
     $record->name = str_replace(array("\r\n", "\n", "\r"), ' ', strip_tags($record->name));
     $record->description = str_replace(array("\r\n", "\n", "\r"), ' ', strip_tags($record->description));
     //  Created by
     if (intval($record->owner) > 0) {
         $record->createdby = get_record('usr', 'id', $record->owner);
         $record->createdbyname = display_name($record->createdby);
     }
     // Get all views included in that collection
     $sql = 'SELECT v.id, v.title
     FROM {view} v
     LEFT OUTER JOIN {collection_view} cv ON cv.view = v.id
     WHERE cv.collection = ?';
     $views = recordset_to_array(get_recordset_sql($sql, array($id)));
     if ($views) {
         $record_views = array();
         foreach ($views as $view) {
             if (isset($view->id)) {
                 $record_views[$view->id] = $view->title;
             }
         }
         $record->views = $record_views;
     }
     return $record;
 }
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:34,代码来源:ElasticsearchType_collection.php


示例3: migrate2utf8_netpublish_name

function migrate2utf8_netpublish_name($recordid)
{
    global $CFG, $globallang;
    /// Some trivial checks
    if (empty($recordid)) {
        log_the_problem_somewhere();
        return false;
    }
    if (!($netpublish = get_record('netpublish', 'id', $recordid))) {
        log_the_problem_somewhere();
        return false;
    }
    if ($globallang) {
        $fromenc = $globallang;
    } else {
        $sitelang = $CFG->lang;
        $courselang = get_course_lang($netpublish->course);
        //Non existing!
        $userlang = get_main_teacher_lang($netpublish->course);
        //N.E.!!
        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
    }
    /// We are going to use textlib facilities
    /// Convert the text
    if ($fromenc != 'utf-8' && $fromenc != 'UTF-8') {
        $result = utfconvert($netpublish->name, $fromenc);
        $newpublish = new object();
        $newpublish->id = $recordid;
        $newpublish->name = $result;
        migrate2utf8_update_record('netpublish', $newpublish);
    }
    /// And finally, just return the converted field
    return $result;
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:34,代码来源:migrate2utf8.php


示例4: viewfolder

function viewfolder($folderid, $userid, $level)
{
    $prefix = "";
    for ($i = 0; $i < $level; $i++) {
        $prefix .= "&gt;";
    }
    $fileprefix = $prefix . "&gt;";
    if ($folderid == -1) {
        $body = <<<END
                <option value="">ROOT</option>
END;
    } else {
        $current_folder = get_record('file_folders', 'owner', $userid, 'ident', $folderid);
        $name = strtoupper(stripslashes($current_folder->name));
        $body = <<<END
                    <option value="">{$prefix} {$name}</option>
END;
    }
    if ($files = get_records_select('files', "owner = ? AND folder = ?", array($userid, $folderid))) {
        foreach ($files as $file) {
            $filetitle = stripslashes($file->title);
            $body .= <<<END
                    
                    <option value="{$file->ident}">{$fileprefix} {$filetitle}</option>
END;
        }
    }
    if ($folders = get_records_select('file_folders', "owner = ? AND parent = ? ", array($userid, $folderid))) {
        foreach ($folders as $folder) {
            $body .= viewfolder($folder->ident, $userid, $level + 1);
        }
    }
    return $body;
}
开发者ID:pzingg,项目名称:saugus_elgg,代码行数:34,代码来源:weblogs_posts_add_fields.php


示例5: send_message

 /**
  * Processes the message (sends by email).
  * @param object $message the message to be sent
  */
 function send_message($message)
 {
     //send an email
     //if fails saved as read message
     //first try to get preference
     $usertoemail = get_user_preferences('message_processor_email_email', '', $message->useridto);
     //if fails use user profile default
     if ($usertoemail == NULL) {
         $userto = get_record('user', 'id', $message->useridto);
         $usertoemail = $userto->email;
     }
     $userfrom = get_record('user', 'id', $message->useridfrom);
     if (email_to_user($usertoemail, $userfrom->email, $message->subject, $message->fullmessage, $message->fullmessagehtml)) {
         /// Move the entry to the other table
         $message->timeread = time();
         $messageid = $message->id;
         unset($message->id);
         //if there is no more processor that want to process this can move message
         if (count_records('message_working', array('unreadmessageid' => $messageid)) == 0) {
             if (insert_record('message_read', $message)) {
                 delete_records('message', 'id', $messageid);
             }
         }
     } else {
         //delete what we've processed and check if can move message
         if (count_records('message_working', 'unreadmessageid', $messageid) == 0) {
             if (insert_record('message_read', $message)) {
                 delete_records('message', 'id', $messageid);
             }
         }
     }
     return true;
 }
开发者ID:remotelearner,项目名称:elis.cm,代码行数:37,代码来源:message_output_email.php


示例6: question_dataset_dependent_items_form

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


示例7: get_content

 function get_content()
 {
     global $CFG, $COURSE;
     if ($this->content !== NULL) {
         return $this->content;
     }
     $this->content = new stdClass();
     $this->content->items = array();
     $this->content->icons = array();
     $this->content->footer = '';
     if ($COURSE->id == $this->instance->pageid) {
         $course = $COURSE;
     } else {
         $course = get_record('course', 'id', $this->instance->pageid);
     }
     require_once $CFG->dirroot . '/course/lib.php';
     $modinfo = get_fast_modinfo($course);
     $modfullnames = array();
     foreach ($modinfo->cms as $cm) {
         if (!$cm->uservisible) {
             continue;
         }
         $modfullnames[$cm->modname] = $cm->modplural;
     }
     asort($modfullnames, SORT_LOCALE_STRING);
     foreach ($modfullnames as $modname => $modfullname) {
         if ($modname != 'label') {
             $this->content->items[] = '<a href="' . $CFG->wwwroot . '/mod/' . $modname . '/index.php?id=' . $this->instance->pageid . '">' . $modfullname . '</a>';
             $this->content->icons[] = '<img src="' . $CFG->modpixpath . '/' . $modname . '/icon.gif" class="icon" alt="" />';
         }
     }
     return $this->content;
 }
开发者ID:r007,项目名称:PMoodle,代码行数:33,代码来源:block_activity_modules.php


示例8: kaltura_backup_one_mod

function kaltura_backup_one_mod($bf, $preferences, $resource)
{
    global $CFG;
    if (is_numeric($resource)) {
        $kaltura_entry = get_record('kaltura_entries', 'id', $resource);
    } else {
        $kaltura_entry = get_record('kaltura_entries', 'id', $resource->id);
    }
    $status = true;
    //Start mod
    fwrite($bf, start_tag("MOD", 3, true));
    //Print assignment data
    fwrite($bf, full_tag("ID", 4, false, $kaltura_entry->id));
    fwrite($bf, full_tag("MODTYPE", 4, false, "kaltura"));
    fwrite($bf, full_tag("ENTRY_ID", 4, false, $kaltura_entry->entry_id));
    fwrite($bf, full_tag("DIMENSIONS", 4, false, $kaltura_entry->dimensions));
    fwrite($bf, full_tag("SIZE", 4, false, $kaltura_entry->size));
    fwrite($bf, full_tag("CUSTOM_WIDTH", 4, false, $kaltura_entry->custom_width));
    fwrite($bf, full_tag("DESIGN", 4, false, $kaltura_entry->design));
    fwrite($bf, full_tag("TITLE", 4, false, $kaltura_entry->title));
    fwrite($bf, full_tag("CONTEXT", 4, false, $kaltura_entry->context));
    fwrite($bf, full_tag("ENTRY_TYPE", 4, false, $kaltura_entry->entry_type));
    fwrite($bf, full_tag("MEDIA_TYPE", 4, false, $kaltura_entry->media_type));
    //End mod
    $status = fwrite($bf, end_tag("MOD", 3, true));
    return $status;
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:27,代码来源:backuplib.php


示例9: __construct

 public function __construct($id = 0, $data = null)
 {
     if (!empty($id)) {
         if (empty($data)) {
             if (!($data = get_record('interaction_instance', 'id', $id))) {
                 throw new InteractionInstanceNotFoundException(get_string('interactioninstancenotfound', 'error', $id));
             }
         }
         $this->id = $id;
     } else {
         $this->dirty = true;
     }
     if (empty($data)) {
         $data = array();
     }
     foreach ((array) $data as $field => $value) {
         if (property_exists($this, $field)) {
             $this->{$field} = $value;
         }
     }
     if (empty($this->id)) {
         $this->ctime = time();
     }
     $this->plugin = $this->get_plugin();
 }
开发者ID:richardmansfield,项目名称:richardms-mahara,代码行数:25,代码来源:lib.php


示例10: get_content

 function get_content()
 {
     global $USER;
     $isteacher = get_record('role_assignments', 'userid', $USER->id, 'roleid', '3');
     // Is the $USER assigned as Teacher, anywhere in the system?
     $iscoursecreator = get_record('role_assignments', 'userid', $USER->id, 'roleid', '2');
     // Is the $USER assigned as Course Creator, anywhere in the system?
     if ($this->content !== NULL) {
         return $this->content;
     }
     //echo "debug teacher=";print_r($isteacher);
     if (!isadmin($USER->id)) {
         if (empty($isteacher) and empty($iscoursecreator)) {
             return;
         }
     }
     if (!empty($this->instance->pinned) or $this->instance->pagetype === 'course-view') {
         // fancy html allowed only on course page and in pinned blocks for security reasons
         $filteropt = new stdClass();
         $filteropt->noclean = true;
     } else {
         $filteropt = null;
     }
     $this->content = new stdClass();
     $this->content->text = isset($this->config->text) ? format_text($this->config->text, FORMAT_HTML, $filteropt) : '';
     $this->content->footer = '';
     unset($filteropt);
     // memory footprint
     return $this->content;
 }
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:30,代码来源:block_html_teachers.php


示例11: imagegallery_backup_one_mod

function imagegallery_backup_one_mod($bf, $preferences, $imagegallery)
{
    global $CFG;
    if (is_numeric($imagegallery)) {
        $imagegallery = get_record('imagegallery', 'id', $imagegallery);
    }
    $status = true;
    //Start mod
    fwrite($bf, start_tag("MOD", 3, true));
    //Print imagegallery data
    fwrite($bf, full_tag("ID", 4, false, $imagegallery->id));
    fwrite($bf, full_tag("MODTYPE", 4, false, "imagegallery"));
    fwrite($bf, full_tag("NAME", 4, false, $imagegallery->name));
    fwrite($bf, full_tag("INTRO", 4, false, $imagegallery->intro));
    fwrite($bf, full_tag("MAXBYTES", 4, false, $imagegallery->maxbytes));
    fwrite($bf, full_tag("MAXWIDTH", 4, false, $imagegallery->maxwidth));
    fwrite($bf, full_tag("MAXHEIGHT", 4, false, $imagegallery->maxheight));
    fwrite($bf, full_tag("ALLOWSTUDENTUPLOAD", 4, false, $imagegallery->allowstudentupload));
    fwrite($bf, full_tag("IMAGESPERPAGE", 4, false, $imagegallery->imagesperpage));
    fwrite($bf, full_tag("TIMEMODIFIED", 4, false, $imagegallery->timemodified));
    fwrite($bf, full_tag("REQUIRELOGIN", 4, false, $imagegallery->requirelogin));
    fwrite($bf, full_tag("RESIZE", 4, false, $imagegallery->resize));
    fwrite($bf, full_tag("DEFAULTCATEGORY", 4, false, $imagegallery->defaultcategory));
    fwrite($bf, full_tag("SHADOW", 4, false, $imagegallery->shadow));
    //if we've selected to backup users info, then execute backup_imagegallery_categories
    if (backup_userdata_selected($preferences, 'imagegallery', $imagegallery->id)) {
        $status = backup_imagegallery_categories($bf, $preferences, $imagegallery->id);
    }
    if (backup_userdata_selected($preferences, 'imagegallery', $imagegallery->id)) {
        $status = backup_imagegallery_images($bf, $preferences, $imagegallery->id);
    }
    //End mod
    $status = fwrite($bf, end_tag("MOD", 3, true));
    return $status;
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:35,代码来源:backuplib.php


示例12: __construct

 protected function __construct($course_id, $section_i)
 {
     global $CFG;
     //error_reporting(E_ALL);
     require_login($course_id);
     // 権限チェック
     $this->requireCapabilities($course_id);
     // 必要な関数が使用可能かチェック
     backup_required_functions();
     // このタイミングで各モジュールのテーブルをアップグレード
     $return_to = $_SERVER['REQUEST_URI'];
     upgrade_backup_db($return_to);
     // 設定オブジェクトを生成
     $this->prefs =& $this->createPreferences();
     // ユニーク値をセット (Moodleコアはここにtime()が入っているのを期待しているのでそれに従う)
     $this->prefs->backup_unique_code = time();
     // コースを取得
     $this->course = get_record('course', 'id', $course_id);
     if (!$this->course) {
         throw new SharingCart_CourseException('Invalid ID');
     }
     // セクションを取得
     $this->section = get_record('course_sections', 'course', $course_id, 'section', $section_i);
     if (!$this->section) {
         throw new SharingCart_SectionException('Invalid ID');
     }
 }
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:27,代码来源:SharingCart_BackupRestoreBase.php


示例13: user_signup

 /**
  * Sign up a new user ready for confirmation.
  * Password is passed in plaintext.
  *
  * @param object $user new user object (with system magic quotes)
  * @param boolean $notify print notice with link and terminate
  */
 function user_signup($user, $notify = true)
 {
     global $CFG;
     require_once $CFG->dirroot . '/user/profile/lib.php';
     $user->password = hash_internal_user_password($user->password);
     if (!($user->id = insert_record('user', $user))) {
         print_error('auth_emailnoinsert', 'auth');
     }
     /// Save any custom profile field information
     profile_save_data($user);
     $user = get_record('user', 'id', $user->id);
     events_trigger('user_created', $user);
     if (!send_confirmation_email($user)) {
         print_error('auth_emailnoemail', 'auth');
     }
     if ($notify) {
         global $CFG;
         $emailconfirm = get_string('emailconfirm');
         $navlinks = array();
         $navlinks[] = array('name' => $emailconfirm, 'link' => null, 'type' => 'misc');
         $navigation = build_navigation($navlinks);
         print_header($emailconfirm, $emailconfirm, $navigation);
         notice(get_string('emailconfirmsent', '', $user->email), "{$CFG->wwwroot}/index.php");
     } else {
         return true;
     }
 }
开发者ID:JackCanada,项目名称:moodle-hacks,代码行数:34,代码来源:auth.php


示例14: definition_after_data

 function definition_after_data()
 {
     global $CFG;
     parent::definition_after_data();
     $mform =& $this->_form;
     if ($association_id = $mform->getElementValue('association_id')) {
         if ($record = get_record(CLSTTRKTABLE, 'id', $association_id)) {
             if ($cluster_record = get_record(CLSTTABLE, 'id', $record->clusterid)) {
                 foreach ($this->cluster_fields as $id => $display) {
                     $element =& $mform->getElement('cluster' . $id);
                     $element->setValue($cluster_record->{$id});
                 }
             }
             $track_sql = "SELECT trk.*,\n                                     cur.name AS parcur,\n                                     (SELECT COUNT(*)\n                                      FROM {$CFG->prefix}crlm_track_class\n                                      WHERE trackid = trk.id ) as class\n                              FROM {$CFG->prefix}crlm_track trk\n                              JOIN {$CFG->prefix}crlm_curriculum cur\n                              ON trk.curid = cur.id\n                              WHERE trk.defaulttrack = 0\n                              AND trk.id = {$record->trackid}";
             if ($track_record = get_record_sql($track_sql)) {
                 foreach ($this->track_fields as $id => $display) {
                     $element =& $mform->getElement('track' . $id);
                     $element->setValue($track_record->{$id});
                 }
             }
             $autoenrol_element =& $mform->getElement('autoenrol');
             $autoenrol_element->setValue($record->autoenrol);
         }
     }
 }
开发者ID:remotelearner,项目名称:elis.cm,代码行数:25,代码来源:clustertrackeditform.class.php


示例15: definition

 function definition()
 {
     global $CFG;
     $mform =& $this->_form;
     // this hack is needed for different settings of each subtype
     if (!empty($this->_instance)) {
         if ($res = get_record('resource', 'id', (int) $this->_instance)) {
             $type = $res->type;
         } else {
             error('incorrect assignment');
         }
     } else {
         $type = required_param('type', PARAM_ALPHA);
     }
     $mform->addElement('hidden', 'type', $type);
     $mform->setDefault('type', $type);
     require $CFG->dirroot . '/mod/resource/type/' . $type . '/resource.class.php';
     $resclass = 'resource_' . $type;
     $this->_resinstance = new $resclass();
     //-------------------------------------------------------------------------------
     $mform->addElement('header', 'general', get_string('general', 'form'));
     //        $mform->addElement('static', 'statictype', get_string('assignmenttype', 'assignment'), get_string('type'.$type,'assignment'));
     $mform->addElement('text', 'name', get_string('name'), array('size' => '48'));
     $mform->setType('name', PARAM_TEXT);
     $mform->addRule('name', null, 'required', null, 'client');
     $mform->addElement('htmleditor', 'summary', get_string('summary'));
     $mform->setType('summary', PARAM_RAW);
     $mform->setHelpButton('summary', array('summary', get_string('summary'), 'resource'));
     // summary should be optional again MDL-9485
     //$mform->addRule('summary', get_string('required'), 'required', null, 'client');
     $mform->addElement('header', 'typedesc', get_string('resourcetype' . $type, 'resource'));
     $this->_resinstance->setup_elements($mform);
     $this->standard_coursemodule_elements(array('groups' => false, 'groupmembersonly' => true, 'gradecat' => false));
     $this->add_action_buttons();
 }
开发者ID:r007,项目名称:PMoodle,代码行数:35,代码来源:mod_form.php


示例16: load

 /**
  * Loads data from the database.
  * Note: even if the function fails, it may still have overwritten some or all existing data in the object.
  * @param mixed $id The site-wide unique identifier for all modules. Type depends on VLE. On Moodle, it is an integer course module identifier ('id' field of 'course_modules' table)
  * @return bool True if successful, or false otherwise
  */
 function load($id)
 {
     // Make sure the ID is valid
     if (!is_int($id) || $id <= 0) {
         echo "<hr><pre>ID = ";
         print_r($id);
         echo "</pre><hr>";
         return false;
     }
     // Fetch the course module data
     if (!($this->cm = get_coursemodule_from_id('sloodle', $id))) {
         return false;
     }
     // Load from the primary table: Sloodle instance
     if (!($this->sloodle_module_instance = get_record('sloodle', 'id', $this->cm->instance))) {
         return false;
     }
     // Check that it is the correct type
     if ($this->sloodle_module_instance->type != SLOODLE_TYPE_CTRL) {
         return false;
     }
     // Load from the secondary table: Distributor instance
     if (!($this->sloodle_controller_instance = get_record('sloodle_controller', 'sloodleid', $this->cm->instance))) {
         return false;
     }
     return true;
 }
开发者ID:nagyistoce,项目名称:moodle-Teach-Pilot,代码行数:33,代码来源:module_controller.php


示例17: resource_base

 /**
  * Constructor for the base resource class
  *
  * Constructor for the base resource class.
  * If cmid is set create the cm, course, resource objects.
  * and do some checks to make sure people can be here, and so on.
  *
  * @param cmid   integer, the current course module id - not set for new resources
  */
 function resource_base($cmid = 0)
 {
     global $CFG, $COURSE;
     $this->navlinks = array();
     if ($cmid) {
         if (!($this->cm = get_coursemodule_from_id('resource', $cmid))) {
             error("Course Module ID was incorrect");
         }
         if (!($this->course = get_record("course", "id", $this->cm->course))) {
             error("Course is misconfigured");
         }
         if (!($this->resource = get_record("resource", "id", $this->cm->instance))) {
             error("Resource ID was incorrect");
         }
         $this->strresource = get_string("modulename", "resource");
         $this->strresources = get_string("modulenameplural", "resource");
         if (!$this->cm->visible and !has_capability('moodle/course:viewhiddenactivities', get_context_instance(CONTEXT_MODULE, $this->cm->id))) {
             $pagetitle = strip_tags($this->course->shortname . ': ' . $this->strresource);
             $navigation = build_navigation($this->navlinks, $this->cm);
             print_header($pagetitle, $this->course->fullname, $navigation, "", "", true, '', navmenu($this->course, $this->cm));
             notice(get_string("activityiscurrentlyhidden"), "{$CFG->wwwroot}/course/view.php?id={$this->course->id}");
         }
     } else {
         $this->course = $COURSE;
     }
 }
开发者ID:edwinphillips,项目名称:moodle-485cb39,代码行数:35,代码来源:lib.php


示例18: test_grade_outcome_delete

 function test_grade_outcome_delete()
 {
     $grade_outcome = new grade_outcome($this->grade_outcomes[0]);
     $this->assertTrue(method_exists($grade_outcome, 'delete'));
     $this->assertTrue($grade_outcome->delete());
     $this->assertFalse(get_record('grade_outcomes', 'id', $grade_outcome->id));
 }
开发者ID:edwinphillips,项目名称:moodle-485cb39,代码行数:7,代码来源:testgradeoutcome.php


示例19: process_data

 /**
  * TODO comment this
  */
 function process_data($data)
 {
     global $CFG, $USER;
     foreach ($data->unit as $idx => $v) {
         $qual = get_record('ilp_qual_units', 'UniqueReferenceNumber', $idx, 'courseid', $data->course_id);
         if (empty($qual)) {
             $course = get_record('course', 'id', $data->course_id);
             $qualificationunits = $this->db->return_table_values('ofqual_qualification_units', array('UniqueReferenceNumber' => array('=' => "'{$idx}'"), 'qualificationid' => array('=' => "'{$course->idnumber}'")));
             if (!empty($qualificationunits)) {
                 $qual = new stdClass();
                 $q = $qualificationunits[0];
                 $qual->courseid = $data->course_id;
                 //$qual->academic_year     =   $q['academic_year'];
                 $qual->qualificationid = $q['QualificationID'];
                 $qual->UniqueReferenceNumber = $q['UniqueReferenceNumber'];
                 $qual->title = $q['Title'];
                 $qual->unitownerreference = $q['UnitOwnerReference'];
                 $qual->selected = !empty($v) ? 1 : 0;
                 $qual->title = mysql_real_escape_string($qual->title);
                 $qual->title = str_replace("'", "", $qual->title);
                 insert_record('ilp_qual_units', $qual);
             }
         } else {
             $qual->title = mysql_real_escape_string($qual->title);
             $qual->title = str_replace("'", "", $qual->title);
             $qual->selected = !empty($v) ? 1 : 0;
             update_record('ilp_qual_units', $qual);
         }
     }
 }
开发者ID:nigeldaley,项目名称:hrc_ilp_qual_unit,代码行数:33,代码来源:unitselection_mform.php


示例20: survey_backup_one_mod

function survey_backup_one_mod($bf, $preferences, $survey)
{
    $status = true;
    if (is_numeric($survey)) {
        $survey = get_record('survey', 'id', $survey);
    }
    //Start mod
    fwrite($bf, start_tag("MOD", 3, true));
    //Print choice data
    fwrite($bf, full_tag("ID", 4, false, $survey->id));
    fwrite($bf, full_tag("MODTYPE", 4, false, "survey"));
    fwrite($bf, full_tag("TEMPLATE", 4, false, $survey->template));
    fwrite($bf, full_tag("DAYS", 4, false, $survey->days));
    fwrite($bf, full_tag("TIMECREATED", 4, false, $survey->timecreated));
    fwrite($bf, full_tag("TIMEMODIFIED", 4, false, $survey->timemodified));
    fwrite($bf, full_tag("NAME", 4, false, $survey->name));
    fwrite($bf, full_tag("INTRO", 4, false, $survey->intro));
    fwrite($bf, full_tag("QUESTIONS", 4, false, $survey->questions));
    //if we've selected to backup users info, then execute backup_survey_answers and
    //backup_survey_analysis
    if (backup_userdata_selected($preferences, 'survey', $survey->id)) {
        $status = backup_survey_answers($bf, $preferences, $survey->id);
        $status = backup_survey_analysis($bf, $preferences, $survey->id);
    }
    //End mod
    $status = fwrite($bf, end_tag("MOD", 3, true));
    return $status;
}
开发者ID:JackCanada,项目名称:moodle-hacks,代码行数:28,代码来源:backuplib.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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