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


PHP get_record函数代码示例

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


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


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