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

PHP get_records函数代码示例

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

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



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

示例1: specialization

 /**
  * Make sure that several settings are set
  * for the rest of the class to use.
  *
  * Items that are set:
  *   course
  *   title
  *   config->taskorder
  *   config->display
  *   baseurl
  *   tasks
  *
  * @uses $CFG
  * @return void
  **/
 function specialization()
 {
     global $CFG, $COURSE;
     // Set the course
     $this->course = $COURSE;
     // Set title
     if (isset($this->config->title)) {
         $this->title = format_text($this->config->title, FORMAT_HTML);
     } else {
         if (isset($CFG->block_task_list_title)) {
             $this->title = format_text($CFG->block_task_list_title, FORMAT_HTML);
         }
     }
     if (!isset($this->config->taskorder)) {
         $this->config->taskorder = '';
     }
     if (!isset($this->config->categorywordwrap)) {
         $this->config->categorywordwrap = 45;
     }
     if (!isset($this->config->display) or $this->course->format != 'page') {
         $this->config->display = 'normal';
     }
     // Get the tasks
     if (!($this->tasks = get_records('block_task_list', 'instanceid', $this->instance->id))) {
         $this->tasks = array();
     }
 }
开发者ID:nadavkav,项目名称:MoodleTAO,代码行数:42,代码来源:block_task_list.php


示例2: question_cwqpfs_to_update

function question_cwqpfs_to_update($categories = null)
{
    global $CFG;
    $tofix = array();
    $result = true;
    //any cats with questions picking from subcats?
    if (!($cwqpfs = get_records_sql_menu("SELECT DISTINCT qc.id, 1 " . "FROM {$CFG->prefix}question q, {$CFG->prefix}question_categories qc " . "WHERE q.qtype='random' AND qc.id = q.category AND " . sql_compare_text('q.questiontext') . " = '1'"))) {
        return array();
    } else {
        if ($categories === null) {
            $categories = get_records('question_categories');
        }
        $categorychildparents = array();
        foreach ($categories as $id => $category) {
            $categorychildparents[$category->course][$id] = $category->parent;
        }
        foreach ($categories as $id => $category) {
            if (FALSE !== array_key_exists($category->parent, $categorychildparents[$category->course])) {
                //this is not a top level cat
                continue;
                //go to next category
            } else {
                $tofix += question_cwqpfs_check_children($id, $categories, $categorychildparents[$category->course], $cwqpfs);
            }
        }
    }
    return $tofix;
}
开发者ID:veritech,项目名称:pare-project,代码行数:28,代码来源:upgrade.php


示例3: choice_get_response_data

 function choice_get_response_data($choice, $cm, $groupmode)
 {
     global $CFG, $USER;
     $context = get_context_instance(CONTEXT_MODULE, $cm->id);
     /// Get the current group
     if ($groupmode > 0) {
         $currentgroup = groups_get_activity_group($cm);
     } else {
         $currentgroup = 0;
     }
     /// Initialise the returned array, which is a matrix:  $allresponses[responseid][userid] = responseobject
     $allresponses = array();
     /// First get all the users who have access here
     /// To start with we assume they are all "unanswered" then move them later
     $allresponses[0] = get_users_by_capability($context, 'mod/choice:choose', 'u.id, u.picture, u.firstname, u.lastname, u.idnumber', 'u.firstname ASC', '', '', $currentgroup, '', false, true);
     /// Get all the recorded responses for this choice
     $rawresponses = get_records('choice_answers', 'choiceid', $choice->id);
     /// Use the responses to move users into the correct column
     if ($rawresponses) {
         foreach ($rawresponses as $response) {
             if (isset($allresponses[0][$response->userid])) {
                 // This person is enrolled and in correct group
                 $allresponses[0][$response->userid]->timemodified = $response->timemodified;
                 $allresponses[$response->optionid][$response->userid] = clone $allresponses[0][$response->userid];
                 unset($allresponses[0][$response->userid]);
                 // Remove from unanswered column
             }
         }
     }
     return $allresponses;
 }
开发者ID:nagyistoce,项目名称:moodle-Teach-Pilot,代码行数:31,代码来源:linker.php


示例4: webquest_upgrade

function webquest_upgrade($oldversion)
{
    /// This function does anything necessary to upgrade
    /// older versions to match current functionality
    $status = true;
    global $CFG;
    if ($oldversion < 2007081222) {
        require_once $CFG->dirroot . '/backup/lib.php';
        //make the change into each course
        $courses = get_records("course");
        foreach ($courses as $course) {
            $newdir = "{$course->id}/{$CFG->moddata}/webquest";
            if (make_upload_directory($newdir)) {
                $olddir = "{$CFG->dataroot}/{$course->id}/{$CFG->moddata}/webquest/submissions";
                //chec k if the old directory exists
                if (is_dir($olddir)) {
                    $status = backup_copy_file($olddir, $CFG->dataroot . "/" . $newdir);
                }
                if ($status) {
                    fulldelete($olddir);
                }
            }
        }
    }
    return $status;
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:26,代码来源:mysql.php


示例5: print_filter

 function print_filter(&$mform)
 {
     global $CFG;
     $filter_categories = optional_param('filter_categories', 0, PARAM_INT);
     $reportclassname = 'report_' . $this->report->type;
     $reportclass = new $reportclassname($this->report);
     if ($this->report->type != 'sql') {
         $components = cr_unserialize($this->report->components);
         $conditions = $components['conditions'];
         $categorieslist = $reportclass->elements_by_conditions($conditions);
     } else {
         $categorieslist = array_keys(get_records('course'));
     }
     $courseoptions = array();
     $courseoptions[0] = get_string('choose');
     if (!empty($categorieslist)) {
         $categories = get_records_select('course_categories', 'id in (' . implode(',', $categorieslist) . ')');
         foreach ($categories as $c) {
             $courseoptions[$c->id] = format_string($c->name);
         }
     }
     $select =& $mform->addElement('select', 'filter_categories', get_string('category'), $courseoptions);
     $select->setMultiple(true);
     $mform->setType('filter_categories', PARAM_INT);
 }
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:25,代码来源:plugin.class.php


示例6: scheduler_backup_one_mod

/**
 *
 */
function scheduler_backup_one_mod($bf, $preferences, $scheduler)
{
    global $CFG;
    if (is_numeric($scheduler)) {
        $scheduler = get_record('scheduler', 'id', $scheduler);
    }
    $status = true;
    //Start mod
    $status = $status && fwrite($bf, start_tag('MOD', 3, true));
    //Print scheduler data
    fwrite($bf, full_tag('ID', 4, false, $scheduler->id));
    fwrite($bf, full_tag('MODTYPE', 4, false, 'scheduler'));
    fwrite($bf, full_tag('NAME', 4, false, $scheduler->name));
    fwrite($bf, full_tag('DESCRIPTION', 4, false, $scheduler->description));
    fwrite($bf, full_tag('TEACHER', 4, false, $scheduler->teacher));
    fwrite($bf, full_tag('SCALE', 4, false, $scheduler->scale));
    fwrite($bf, full_tag('STAFFROLENAME', 4, false, $scheduler->staffrolename));
    fwrite($bf, full_tag('SCHEDULERMODE', 4, false, $scheduler->schedulermode));
    fwrite($bf, full_tag('REUSEGUARDTIME', 4, false, $scheduler->reuseguardtime));
    fwrite($bf, full_tag('DEFAULTSLOTDURATION', 4, false, $scheduler->defaultslotduration));
    fwrite($bf, full_tag('ALLOWNOTIFICATIONS', 4, false, $scheduler->allownotifications));
    fwrite($bf, full_tag('TIMEMODIFIED', 4, false, $scheduler->timemodified));
    //if we've selected to backup users info, then execute backup_scheduler_slots and appointments
    if ($preferences->mods['scheduler']->userinfo) {
        $scheduler_slots = get_records('scheduler_slots', 'schedulerid', $scheduler->id, 'id');
        $status = $status && backup_scheduler_slots($bf, $preferences, $scheduler->id, $scheduler_slots);
        $status = $status && backup_scheduler_appointments($bf, $preferences, $scheduler_slots);
    }
    //End mod
    $status = $status && fwrite($bf, end_tag('MOD', 3, true));
    return $status;
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:35,代码来源:backuplib.php


示例7: remote_connect

/**
* Create connection to an RQP server of required type if it does not already exist
*
* If the global array $remote_connections does not already have an entry for this
* server type then it randomly goes through the existing servers and tries to connect
* using rqp_connect(). The connection is then added to the $remote_connections array.
* If the function fails to connect to any server it returns false.
* @param string $typeid  The type of the RQP server
* @return boolean  Indicates success or failure
*
* @todo flag dead servers
*/
function remote_connect($typeid)
{
    global $remote_connections;
    if (!array_key_exists($typeid, $remote_connections)) {
        // get the available servers
        if (!($servers = get_records('question_rqp_servers', 'typeid', $typeid))) {
            // we don't have a server for this question type
            return false;
        }
        // put them in a random order
        shuffle($servers);
        // go through them and try to connect to each until we are successful
        foreach ($servers as $server) {
            if ($remote_connections[$typeid] = rqp_connect($server->url)) {
                break;
                // we have a connection
            } else {
                // We have a dead server here, should somehow flag that
            }
        }
    }
    // check that we did get a connection
    if (!$remote_connections[$typeid]) {
        unset($remote_connections[$typeid]);
        return false;
    }
    return true;
}
开发者ID:veritech,项目名称:pare-project,代码行数:40,代码来源:remote.php


示例8: validation

 function validation($data, $files)
 {
     global $db, $CFG;
     $errors = parent::validation($data, $files);
     if (!in_array($data['operator'], $this->allowedops)) {
         $errors['operator'] = get_string('error_operator', 'block_configurable_reports');
     }
     $columns = $db->MetaColumns($CFG->prefix . 'user');
     $usercolumns = array();
     foreach ($columns as $c) {
         $usercolumns[$c->name] = $c->name;
     }
     if ($profile = get_records('user_info_field')) {
         foreach ($profile as $p) {
             $usercolumns['profile_' . $p->shortname] = 'profile_' . $p->shortname;
         }
     }
     if (!in_array($data['field'], $usercolumns)) {
         $errors['field'] = get_string('error_field', 'block_configurable_reports');
     }
     if (!is_numeric($data['value']) && preg_match('/^(<|>)[^(<|>)]/i', $data['operator'])) {
         $errors['value'] = get_string('error_value_expected_integer', 'block_configurable_reports');
     }
     return $errors;
 }
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:25,代码来源:form.php


示例9: backup_slideshow_captions

function backup_slideshow_captions($bf, $preferences, $slideshow)
{
    global $CFG;
    $status = true;
    $slideshow_captions = get_records("slideshow_captions", "slideshow", $slideshow->instance);
    //If there is captions
    if ($slideshow_captions) {
        //Write start tag
        $status = fwrite($bf, start_tag("CAPTIONS", 4, true));
        //Iterate over each caption
        foreach ($slideshow_captions as $sli_cap) {
            //Start caption
            $status = fwrite($bf, start_tag("CAPTION", 5, true));
            //Print caption contents
            fwrite($bf, full_tag("ID", 6, false, $sli_cap->id));
            fwrite($bf, full_tag("SLIDESHOW", 6, false, $sli_cap->slideshow));
            fwrite($bf, full_tag("IMAGE", 6, false, $sli_cap->image));
            fwrite($bf, full_tag("TITLE", 6, false, $sli_cap->title));
            fwrite($bf, full_tag("CAPTION", 6, false, $sli_cap->caption));
            //End submission
            $status = fwrite($bf, end_tag("CAPTION", 5, true));
        }
        //Write end tag
        $status = fwrite($bf, end_tag("CAPTIONS", 4, true));
    }
    return $status;
}
开发者ID:kai707,项目名称:ITSA-backup,代码行数:27,代码来源:backuplib.php


示例10: backup_chat_messages

function backup_chat_messages($bf, $preferences, $chat)
{
    global $CFG;
    $status = true;
    $chat_messages = get_records("chat_messages", "chatid", $chat, "id");
    //If there is messages
    if ($chat_messages) {
        //Write start tag
        $status = fwrite($bf, start_tag("MESSAGES", 4, true));
        //Iterate over each message
        foreach ($chat_messages as $cha_mes) {
            //Start message
            $status = fwrite($bf, start_tag("MESSAGE", 5, true));
            //Print message contents
            fwrite($bf, full_tag("ID", 6, false, $cha_mes->id));
            fwrite($bf, full_tag("USERID", 6, false, $cha_mes->userid));
            fwrite($bf, full_tag("GROUPID", 6, false, $cha_mes->groupid));
            fwrite($bf, full_tag("SYSTEM", 6, false, $cha_mes->system));
            fwrite($bf, full_tag("MESSAGE_TEXT", 6, false, $cha_mes->message));
            fwrite($bf, full_tag("TIMESTAMP", 6, false, $cha_mes->timestamp));
            //End submission
            $status = fwrite($bf, end_tag("MESSAGE", 5, true));
        }
        //Write end tag
        $status = fwrite($bf, end_tag("MESSAGES", 4, true));
    }
    return $status;
}
开发者ID:edwinphillips,项目名称:moodle-485cb39,代码行数:28,代码来源:backuplib.php


示例11: backup_adobeconnect_meeting_groups

function backup_adobeconnect_meeting_groups($bf, $preferences, $adobeconnectid)
{
    global $CFG;
    // Set status to false because there must be at least one meeting instance
    $status = false;
    // Go through all of the meeting instances and backup each group's meeting
    if ($meetgroups = get_records("adobeconnect_meeting_groups", 'instanceid', $adobeconnectid)) {
        if ($meetgroups) {
            //Write start tag
            $status = fwrite($bf, start_tag("MEETINGGROUPS", 4, true));
            //Iterate over each meeting instance
            foreach ($meetgroups as $meetgroup) {
                //Start of meeting group instance
                $status = fwrite($bf, start_tag("MEETINGGROUP", 5, true));
                fwrite($bf, full_tag("ID", 6, false, $meetgroup->id));
                fwrite($bf, full_tag("INSTANCEID", 6, false, $meetgroup->instanceid));
                fwrite($bf, full_tag("MEETINGSCOID", 6, false, $meetgroup->meetingscoid));
                fwrite($bf, full_tag("GROUPID", 6, false, $meetgroup->groupid));
                //End of meeting group instance
                $status = fwrite($bf, end_tag("MEETINGGROUP", 5, true));
            }
            //Write end tag
            $status = fwrite($bf, end_tag("MEETINGGROUPS", 4, true));
        }
    }
    return $status;
}
开发者ID:nagyistoce,项目名称:moodle-Teach-Pilot,代码行数:27,代码来源:backuplib.php


示例12: backup_book_chapters

function backup_book_chapters($bf, $preferences, $book)
{
    global $CFG;
    $status = true;
    //Print book's chapters
    if ($chapters = get_records('book_chapters', 'bookid', $book->id, 'id')) {
        //Write start tag
        $status = fwrite($bf, start_tag('CHAPTERS', 4, true));
        foreach ($chapters as $ch) {
            //Start chapter
            fwrite($bf, start_tag('CHAPTER', 5, true));
            //Print chapter data
            fwrite($bf, full_tag('ID', 6, false, $ch->id));
            fwrite($bf, full_tag('PAGENUM', 6, false, $ch->pagenum));
            fwrite($bf, full_tag('SUBCHAPTER', 6, false, $ch->subchapter));
            fwrite($bf, full_tag('TITLE', 6, false, $ch->title));
            fwrite($bf, full_tag('CONTENT', 6, false, $ch->content));
            fwrite($bf, full_tag('HIDDEN', 6, false, $ch->hidden));
            fwrite($bf, full_tag('TIMECREATED', 6, false, $ch->timecreated));
            fwrite($bf, full_tag('TIMEMODIFIED', 6, false, $ch->timemodified));
            fwrite($bf, full_tag('IMPORTSRC', 6, false, $ch->importsrc));
            //End chapter
            $status = fwrite($bf, end_tag('CHAPTER', 5, true));
        }
        //Write end tag
        $status = fwrite($bf, end_tag('CHAPTERS', 4, true));
    }
    return $status;
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:29,代码来源:backuplib.php


示例13: backup_map_locations

function backup_map_locations($bf, $preferences, $map)
{
    global $CFG;
    $status = true;
    $map_locations = get_records("map_locations", "mapid", $map, "id");
    //If there is locations
    if ($map_locations) {
        //Write start tag
        $status = fwrite($bf, start_tag("LOCATIONS", 4, true));
        //Iterate over each answer
        foreach ($map_locations as $map_location) {
            //Start answer
            $status = fwrite($bf, start_tag("LOCATION", 5, true));
            //Print location contents
            fwrite($bf, full_tag("ID", 6, false, $map_location->id));
            fwrite($bf, full_tag("USERID", 6, false, $map_location->userid));
            fwrite($bf, full_tag("TITLE", 6, false, $map_location->title));
            fwrite($bf, full_tag("SHOWCODE", 6, false, $map_location->showcode));
            fwrite($bf, full_tag("LATITUDE", 6, false, $map_location->latitude));
            fwrite($bf, full_tag("LONGITUDE", 6, false, $map_location->longitude));
            fwrite($bf, full_tag("ADDRESS", 6, false, $map_location->address));
            fwrite($bf, full_tag("CITY", 6, false, $map_location->city));
            fwrite($bf, full_tag("STATE", 6, false, $map_location->state));
            fwrite($bf, full_tag("COUNTRY", 6, false, $map_location->country));
            fwrite($bf, full_tag("TEXT", 6, false, $map_location->text));
            fwrite($bf, full_tag("TIMEMODIFIED", 6, false, $map_location->timemodified));
            //End answer
            $status = fwrite($bf, end_tag("LOCATION", 5, true));
        }
        //Write end tag
        $status = fwrite($bf, end_tag("LOCATIONS", 4, true));
    }
    return $status;
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:34,代码来源:backuplib.php


示例14: block_exabis_eportfolio_print_extcomments

function block_exabis_eportfolio_print_extcomments($itemid)
{
    $stredit = get_string('edit');
    $strdelete = get_string('delete');
    $comments = get_records("block_exabeporitemcomm", "itemid", $itemid, 'timemodified DESC');
    if (!$comments) {
        return;
    }
    foreach ($comments as $comment) {
        $user = get_record('user', 'id', $comment->userid);
        echo '<table cellspacing="0" class="forumpost blogpost blog" width="100%">';
        echo '<tr class="header"><td class="picture left">';
        print_user_picture($comment->userid, SITEID, $user->picture);
        echo '</td>';
        echo '<td class="topic starter"><div class="author">';
        $fullname = fullname($user, $comment->userid);
        $by = new object();
        $by->name = $fullname;
        $by->date = userdate($comment->timemodified);
        print_string('bynameondate', 'forum', $by);
        echo '</div></td></tr>';
        echo '<tr><td class="left side">';
        echo '</td><td class="content">' . "\n";
        echo format_text($comment->entry);
        echo '</td></tr></table>' . "\n\n";
    }
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:27,代码来源:externlib.php


示例15: glossary_rss_feeds

function glossary_rss_feeds()
{
    global $CFG;
    $status = true;
    //Check CFG->enablerssfeeds
    if (empty($CFG->enablerssfeeds)) {
        debugging("DISABLED (admin variables)");
        //Check CFG->glossary_enablerssfeeds
    } else {
        if (empty($CFG->glossary_enablerssfeeds)) {
            debugging("DISABLED (module configuration)");
            //It's working so we start...
        } else {
            //Iterate over all glossaries
            if ($glossaries = get_records("glossary")) {
                foreach ($glossaries as $glossary) {
                    if (!empty($glossary->rsstype) && !empty($glossary->rssarticles) && $status) {
                        $filename = rss_file_name('glossary', $glossary);
                        // RSS file
                        //First let's make sure there is work to do by checking existing files
                        if (file_exists($filename)) {
                            if ($lastmodified = filemtime($filename)) {
                                if (!glossary_rss_newstuff($glossary, $lastmodified)) {
                                    continue;
                                }
                            }
                        }
                        //Ignore hidden forums
                        if (!instance_is_visible('glossary', $glossary)) {
                            if (file_exists($filename)) {
                                @unlink($filename);
                            }
                            continue;
                        }
                        mtrace("Updating RSS feed for " . format_string($glossary->name, true) . ", ID: {$glossary->id}");
                        //Get the XML contents
                        $result = glossary_rss_feed($glossary);
                        //Save the XML contents to file
                        if (!empty($result)) {
                            $status = rss_save_file("glossary", $glossary, $result);
                        }
                        //Some debug...
                        if (debugging()) {
                            if (empty($result)) {
                                echo "ID: {$glossary->id}-> (empty) ";
                            } else {
                                if (!empty($status)) {
                                    echo "ID: {$glossary->id}-> OK ";
                                } else {
                                    echo "ID: {$glossary->id}-> FAIL ";
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    return $status;
}
开发者ID:edwinphillips,项目名称:moodle-485cb39,代码行数:60,代码来源:rsslib.php


示例16: __construct

 /**
  * Constructor - basic setup
  *
  * @param int $pagemenuid Page menu instance ID
  * @param array $links Page menu link records that belong to this page menu
  * @param array $data Link data for the links
  * @param int $firstlinkid First link ID
  * @return void
  **/
 public function __construct($pagemenuid, $links = NULL, $data = NULL, $firstlinkid = false)
 {
     $this->pagemenuid = $pagemenuid;
     if ($links === NULL) {
         $links = get_records('pagemenu_links', 'pagemenuid', $this->pagemenuid);
     }
     if (!$firstlinkid) {
         $firstlinkid = pagemenu_get_first_linkid($this->pagemenuid);
     }
     if ($data === NULL) {
         if (!empty($links)) {
             $data = pagemenu_get_link_data($links);
         } else {
             $data = array();
         }
     }
     if (!empty($links) and !empty($firstlinkid)) {
         $linkid = $firstlinkid;
         while ($linkid) {
             if (array_key_exists($linkid, $data)) {
                 $datum = $data[$linkid];
             } else {
                 $datum = NULL;
             }
             $link = $links[$linkid];
             $linkid = $link->nextid;
             $this->links[$link->id] = mod_pagemenu_link::factory($link->type, $link, $datum);
         }
     }
     $this->init();
 }
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:40,代码来源:render.class.php


示例17: renumber

 /**
  *	Sharing Cart ブロック内でのアイテム表示順の通し番号を振りなおす
  */
 public static function renumber($user_id = NULL)
 {
     if (empty($user_id)) {
         $user_id = $GLOBALS['USER']->id;
     }
     if ($records = get_records('sharing_cart', 'user', $user_id)) {
         $tree = array();
         foreach ($records as $record) {
             if (!isset($tree[$record->tree])) {
                 $tree[$record->tree] = array();
             }
             $tree[$record->tree][] = $record;
         }
         foreach ($tree as $items) {
             usort($items, array(__CLASS__, 'renumber_cmp'));
             foreach ($items as $i => $item) {
                 $item->sort = $i;
                 $item->text = addslashes($item->text);
                 if (!update_record('sharing_cart', $item)) {
                     return FALSE;
                 }
             }
         }
     }
     return TRUE;
 }
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:29,代码来源:sharing_cart_table.php


示例18: validation

 function validation($data, $files)
 {
     $errors = parent::validation($data, $files);
     $foundcourses = null;
     $foundreqcourses = null;
     if (!empty($data['shortname'])) {
         $foundcourses = get_records('course', 'shortname', $data['shortname']);
         $foundreqcourses = get_records('course_request', 'shortname', $data['shortname']);
     }
     if (!empty($foundreqcourses)) {
         if (!empty($foundcourses)) {
             $foundcourses = array_merge($foundcourses, $foundreqcourses);
         } else {
             $foundcourses = $foundreqcourses;
         }
     }
     if (!empty($foundcourses)) {
         foreach ($foundcourses as $foundcourse) {
             if (!empty($foundcourse->requester)) {
                 $pending = 1;
                 $foundcoursenames[] = $foundcourse->fullname . ' [*]';
             } else {
                 $foundcoursenames[] = $foundcourse->fullname;
             }
         }
         $foundcoursenamestring = implode(',', $foundcoursenames);
         $errors['shortname'] = get_string('shortnametaken', '', $foundcoursenamestring);
         if (!empty($pending)) {
             $errors['shortname'] .= get_string('starpending');
         }
     }
     return $errors;
 }
开发者ID:kai707,项目名称:ITSA-backup,代码行数:33,代码来源:request_form.php


示例19: __construct

 function __construct($data)
 {
     global $COURSE;
     parent::__construct($data);
     $this->type = 'datarecord';
     $this->fields = array();
     // fields are only used for pointing a data record
     $datainstances = get_records('data', 'course', $COURSE->id, '', 'id,name');
     foreach ($datainstances as $data) {
         $dataopts[] = $data->name;
     }
     unset($field);
     $field->name = 'key';
     $field->type = 'list';
     $field->options = $datainstances;
     $field->admin = true;
     $this->fields['key'] = $field;
     unset($field);
     $field->name = 'key';
     $field->type = 'list';
     $field->options = 'list';
     $field->admin = true;
     $this->fields['key'] = $field;
     $this->datasource = array('USER/id', 'USER/login', 'COURSE/id', 'COURSE/shortname', 'COURSE/category');
     unset($field);
     $field->name = 'keysource';
     $field->type = 'list';
     $field->options = $sourceopts;
     $field->admin = true;
     $this->fields['keysource'] = $field;
 }
开发者ID:nadavkav,项目名称:MoodleTAO,代码行数:31,代码来源:customlabel.class.php


示例20: backup_journal_entries

function backup_journal_entries($bf, $preferences, $journal)
{
    global $CFG;
    $status = true;
    $journal_entries = get_records("journal_entries", "journal", $journal, "id");
    //If there is entries
    if ($journal_entries) {
        //Write start tag
        $status = fwrite($bf, start_tag("ENTRIES", 4, true));
        //Iterate over each entry
        foreach ($journal_entries as $jou_ent) {
            //Start entry
            $status = fwrite($bf, start_tag("ENTRY", 5, true));
            //Print journal_entries contents
            fwrite($bf, full_tag("ID", 6, false, $jou_ent->id));
            fwrite($bf, full_tag("USERID", 6, false, $jou_ent->userid));
            fwrite($bf, full_tag("MODIFIED", 6, false, $jou_ent->modified));
            fwrite($bf, full_tag("TEXT", 6, false, $jou_ent->text));
            fwrite($bf, full_tag("FORMAT", 6, false, $jou_ent->format));
            fwrite($bf, full_tag("RATING", 6, false, $jou_ent->rating));
            fwrite($bf, full_tag("ENTRYCOMMENT", 6, false, $jou_ent->entrycomment));
            fwrite($bf, full_tag("TEACHER", 6, false, $jou_ent->teacher));
            fwrite($bf, full_tag("TIMEMARKED", 6, false, $jou_ent->timemarked));
            fwrite($bf, full_tag("MAILED", 6, false, $jou_ent->mailed));
            //End entry
            $status = fwrite($bf, end_tag("ENTRY", 5, true));
        }
        //Write end tag
        $status = fwrite($bf, end_tag("ENTRIES", 4, true));
    }
    return $status;
}
开发者ID:edwinphillips,项目名称:moodle-485cb39,代码行数:32,代码来源:backuplib.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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