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


PHP get_records_select函数代码示例

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


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

示例1: 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

示例2: report_customsql_cron

/**
 * Cron that runs any automatically scheduled reports weekly or monthly.
 */
function report_customsql_cron()
{
    global $CFG;
    $timenow = time();
    if (!empty($CFG->reportcustomsqlmaxruntime)) {
        $timestop = $timenow + $CFG->reportcustomsqlmaxruntime;
    } else {
        $timestop = $timenow + 180;
        // Three minutes.
    }
    list($startofthisweek, $startoflastweek) = report_customsql_get_week_starts($timenow);
    list($startofthismonth) = report_customsql_get_month_starts($timenow);
    mtrace("... Looking for old temp CSV files to delete.");
    $numdeleted = report_customsql_delete_old_temp_files($startoflastweek);
    if ($numdeleted) {
        mtrace("... {$numdeleted} files deleted.");
    }
    $reportstorun = get_records_select('report_customsql_queries', "(runable = 'weekly' AND lastrun < {$startofthisweek}) OR\n            (runable = 'monthly' AND lastrun < {$startofthismonth})", 'lastrun');
    if (empty($reportstorun)) {
        return;
    }
    while (!empty($reportstorun) && time() < $timestop) {
        $report = array_shift($reportstorun);
        mtrace("... Running report " . strip_tags($report->displayname));
        try {
            report_customsql_generate_csv($report, $timenow);
        } catch (Exception $e) {
            mtrace("... REPORT FAILED " . $e->getMessage());
        }
    }
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:34,代码来源:cron.php

示例3: ownedusers_pagesetup

function ownedusers_pagesetup()
{
    // register links --
    global $profile_id;
    global $PAGE;
    global $CFG;
    global $USER;
    $page_owner = $profile_id;
    if ($CFG->owned_users) {
        if (defined("context") && context == "network") {
            if (run("users:type:get", $page_owner) == "person") {
                $PAGE->menu_sub[] = array('name' => 'ownedusers:requests', 'html' => '<a href="' . $CFG->wwwroot . '_ownedusers/owned.php?owner=' . $page_owner . '">' . gettext("Owned " . $CFG->owned_users_caption) . '</a>');
            }
        }
        if (defined("context") && context == "weblog") {
            if (run("users:type:get", $page_owner) == "person") {
                if ($result = get_records_select('users', "owner = ? AND user_type = ?", array($page_owner, 'person'))) {
                    $PAGE->menu_sub[] = array('name' => 'ownedusers:requests', 'html' => '<a href="' . $CFG->wwwroot . $USER->username . '/weblog/ownedusers/' . '">' . gettext($CFG->owned_users_caption . "' blogs") . '</a>');
                }
            }
        }
        if (defined("context") && context == "profile" && logged_on && !run("users:flags:get", array("admin", $USER->ident))) {
            if ($result = get_records_select('users', "ident = ? and owner = ? AND user_type = ?", array($page_owner, $USER->ident, 'person'))) {
                $PAGE->menu_sub[] = array('name' => 'profile:edit', 'html' => '<a href="' . $CFG->wwwroot . 'profile/edit.php?profile_id=' . $page_owner . '">' . gettext("Edit this profile") . '</a>');
                if (run("permissions:check", "profile")) {
                    $PAGE->menu_sub[] = array('name' => 'owneduser:pic', 'html' => a_hrefg("{$CFG->wwwroot}_icons/?context=profile&amp;profile_id={$page_owner}", gettext("Change site picture")));
                    $PAGE->menu_sub[] = array('name' => 'profile:help', 'html' => '<a href="' . $CFG->wwwroot . 'help/profile_help.php">' . gettext("Page help") . '</a>');
                }
            }
        }
    }
}
开发者ID:pzingg,项目名称:saugus_elgg,代码行数:32,代码来源:lib.php

示例4: viewfolder

function viewfolder($folderid, $userid, $level, $selected = -1)
{
    $prefix = "";
    for ($i = 0; $i < $level; $i++) {
        $prefix .= "&gt;";
    }
    $fileprefix = $prefix . "&gt;";
    $folders = get_records_select('file_folders', "files_owner = ? AND parent = ?", array($userid, $folderid));
    if ($folderid == -1) {
        $body = "<option value=\"-1\" ";
        if ($selected == -1) {
            $body .= "selected = \"selected\"";
        }
        $root = __gettext("Root");
        $body .= ">{$root}</option>";
    } else {
        $current_folder = get_record('file_folders', 'files_owner', $userid, 'ident', $folderid);
        $name = stripslashes($current_folder->name);
        $ident = $current_folder->ident;
        if ($ident == $selected) {
            $selectstring = "selected=\"selected\"";
        } else {
            $selectstring = "";
        }
        $body = <<<END
            <option value="{$ident}" {$selectstring} >{$prefix} {$name} </option>
END;
    }
    if (!empty($folders)) {
        foreach ($folders as $folder) {
            $body .= viewfolder($folder->ident, $userid, $level + 1, $selected);
        }
    }
    return $body;
}
开发者ID:BackupTheBerlios,项目名称:tulipan-svn,代码行数:35,代码来源:select_folder.php

示例5: mail_delete_instance

function mail_delete_instance($id)
{
    /// Given an ID of an instance of this module,
    /// this function will permanently delete the instance
    /// and any data that depends on it.
    global $CFG;
    if (!($mail = get_record("mail", "id", "{$id}"))) {
        return false;
    }
    $result = true;
    if (!delete_records("mail", "id", "{$mail->id}")) {
        $result = false;
    }
    if (!delete_records("mail_folder", "mailid", "{$mail->id}")) {
        $result = false;
    }
    if ($messages = get_records_select("mail_messages", "mailid = {$mail->id}")) {
        foreach ($messages as $message) {
            delete_records("mail_to_messages", "messageid", "{$message->id}");
            delete_records("mail_messages", "id", "{$message->id}");
        }
    }
    if ($groups = get_records_select("mail_groups", "mailid = {$mail->id}")) {
        foreach ($groups as $group) {
            delete_records("mail_members_groups", "groupid", "{$group->id}");
            delete_records("mail_groups", "id", "{$group->id}");
        }
    }
    if (!delete_records("mail_statistics", "course", "{$mail->course}")) {
        $result = false;
    }
    //$dir = $CFG->dataroot.'/'.$portafolio->course.'/moddata/portafolio/'.$portafolio->id;
    //$result = fulldelete($dir);
    return $result;
}
开发者ID:henriquecrang,项目名称:e-UNI,代码行数:35,代码来源:lib.php

示例6: 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

示例7: game_backup_one_mod

function game_backup_one_mod($bf, $preferences, $game)
{
    global $CFG;
    $status = true;
    if (is_numeric($game)) {
        $game = get_record('game', 'id', $game);
    }
    //Start mod
    fwrite($bf, start_tag("MOD", 3, true));
    //Print game data
    $game->modtype = 'game';
    game_backup_record($bf, $game, 4);
    $recs = get_records_select('game_snakes_database');
    game_backup_table($bf, $recs, 'GAME_SNAKES_DATABASE', 5, 'GAME_SNAKES_DATABASE_RECORD', 6);
    $recs = get_records_select('game_bookquiz_questions', "gameid={$game->id}");
    game_backup_table($bf, $recs, 'GAME_BOOKQUIZ_QUESTIONS', 5, 'GAME_BOOKQUIZ_QUESTION', 6);
    $recs = get_records_select('game_grades', "gameid={$game->id}");
    game_backup_table($bf, $recs, 'GAME_GRADES', 5, 'GAME_GRADE', 6);
    $sql = "SELECT DISTINCT g.questioncategoryid as id,qc.stamp FROM " . " {$CFG->prefix}game g,{$CFG->prefix}question_categories qc " . " WHERE g.questioncategoryid = qc.id";
    $recs = get_records_sql($sql);
    game_backup_table($bf, $recs, 'QUESTION_CATEGORIES', 5, 'QUESTION_CATEGORY', 6);
    game_backup_attempts($bf, $preferences, $game->id);
    //End mod
    $status = fwrite($bf, end_tag("MOD", 3, true));
    return $status;
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:26,代码来源:backuplib.php

示例8: groups_get_grouping_by_name

/**
 * Returns the groupingid of a grouping with the name specified for the course.
 * Grouping names should be unique in course
 * @param int $courseid The id of the course
 * @param string $name name of group (without magic quotes)
 * @return int $groupid
 */
function groups_get_grouping_by_name($courseid, $name)
{
    if ($groupings = get_records_select('groupings', "courseid={$courseid} AND name='" . addslashes($name) . "'")) {
        return key($groupings);
    }
    return false;
}
开发者ID:edwinphillips,项目名称:moodle-485cb39,代码行数:14,代码来源:grouplib.php

示例9: inviteKnownUser

 /**
  * Invite known user
  * @param int $id Id of known Moodle user
  * @param bool $inviteeUnknown True if user was invited, false otherwise
  * @return Mediabird user ID
  */
 function inviteKnownUser($moodleid, &$inviteeUnknown)
 {
     global $helper;
     $mbuser = false;
     if ($records = get_records_select('user', "id={$moodleid}", '', 'id,username,firstname,lastname,email')) {
         $record = $records[$moodleid];
         $email = $record->email;
         $fullname = $record->firstname . ' ' . $record->lastname;
         if (strlen(trim($fullname)) == 0) {
             $fullname = $record->username;
         }
         if ($account_link = get_record("studynotes_account_links", "system", "moodle", "external_id", $moodleid)) {
             $mbuser = $account_link->internal_id;
             $inviteeUnknown = false;
         } else {
             if ($mbuser = $helper->registerUser($fullname, 1, $email)) {
                 $account_link = (object) null;
                 $account_link->external_id = $moodleid;
                 $account_link->internal_id = $mbuser;
                 $account_link->system = "moodle";
                 insert_record("studynotes_account_links", $account_link, false);
                 $inviteeUnknown = true;
             }
         }
     }
     return $mbuser;
 }
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:33,代码来源:moodle_auth.php

示例10: execute

 function execute($finalelements, $data)
 {
     $filter_fuserfield = optional_param('filter_fuserfield_' . $data->field, 0, PARAM_RAW);
     if ($filter_fuserfield) {
         // addslashes is done in clean param
         $filter = clean_param(base64_decode($filter_fuserfield), PARAM_CLEAN);
         if (strpos($data->field, 'profile_') === 0) {
             if ($fieldid = get_field('user_info_field', 'id', 'shortname', str_replace('profile_', '', $data->field))) {
                 $sql = "fieldid = {$fieldid} AND data = '{$filter}' AND userid IN(" . implode(',', $finalelements) . ")";
                 if ($infodata = get_records_select('user_info_data', $sql)) {
                     $finalusersid = array();
                     foreach ($infodata as $d) {
                         $finalusersid[] = $d->userid;
                     }
                     return $finalusersid;
                 }
             }
         } else {
             $sql = "{$data->field} = '{$filter}' AND id IN(" . implode(',', $finalelements) . ")";
             if ($elements = get_records_select('user', $sql)) {
                 $finalelements = array_keys($elements);
             }
         }
     }
     return $finalelements;
 }
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:26,代码来源:plugin.class.php

示例11: sloodle_display_config_form

function sloodle_display_config_form($sloodleauthid, $auth_obj)
{
    //--------------------------------------------------------
    // SETUP
    // Determine which course is being accessed
    $courseid = $auth_obj->course->get_course_id();
    // We need to fetch a list of visible choices on the course
    // Get the ID of the choice type
    $rec = get_record('modules', 'name', 'choice');
    if (!$rec) {
        sloodle_debug("Failed to get choice module type.");
        exit;
    }
    $choicemoduleid = $rec->id;
    // Get all visible choices in the current course
    $recs = get_records_select('course_modules', "course = {$courseid} AND module = {$choicemoduleid} AND visible = 1");
    if (!$recs) {
        error(get_string('nochoices', 'sloodle'));
        exit;
    }
    $choices = array();
    foreach ($recs as $cm) {
        // Fetch the choice instance
        $inst = get_record('choice', 'id', $cm->instance);
        if (!$inst) {
            continue;
        }
        // Store the choice details
        $choices[$cm->id] = $inst->name;
    }
    // Sort the list by name
    natcasesort($choices);
    //--------------------------------------------------------
    // FORM
    // Get the current object configuration
    $settings = SloodleController::get_object_configuration($sloodleauthid);
    // Setup our default values
    $sloodlemoduleid = (int) sloodle_get_value($settings, 'sloodlemoduleid', 0);
    $sloodlerefreshtime = (int) sloodle_get_value($settings, 'sloodlerefreshtime', 600);
    $sloodlerelative = (int) sloodle_get_value($settings, 'sloodlerelative', 0);
    ///// GENERAL CONFIGURATION /////
    print_box_start('generalbox boxaligncenter');
    echo '<h3>' . get_string('generalconfiguration', 'sloodle') . '</h3>';
    // Ask the user to select a choice
    echo get_string('selectchoice', 'sloodle') . ': ';
    choose_from_menu($choices, 'sloodlemoduleid', $sloodlemoduleid, '');
    echo "<br><br>\n";
    // Ask the user for a refresh period (# seconds between automatic updates)
    echo get_string('refreshtimeseconds', 'sloodle') . ': ';
    echo '<input type="text" name="sloodlerefreshtime" value="' . $sloodlerefreshtime . '" size="8" maxlength="8" />';
    echo "<br><br>\n";
    // Show relative results
    echo get_string('relativeresults', 'sloodle') . ': ';
    choose_from_menu_yesno('sloodlerelative', $sloodlerelative);
    echo "<br>\n";
    print_box_end();
    ///// ACCESS LEVELS /////
    sloodle_print_access_level_options($settings, true, false, true);
}
开发者ID:nagyistoce,项目名称:moodle-Teach-Pilot,代码行数:59,代码来源:object_config.php

示例12: merge_get_customentries

/**
*
* @uses CFG, USER
* @param int $brainstormid
* @param int $slotid
* @param int $userid
* @param int $groupid
* @param boolean $excludemyself
*/
function merge_get_customentries($brainstormid, $slotid, $userid = null, $groupid = 0, $excludemyself = false)
{
    global $CFG;
    $accessClause = brainstorm_get_accessclauses($userid, $groupid, $excludemyself);
    $select = "\r\n        brainstormid = {$brainstormid} AND\r\n        operatorid = 'merge' AND\r\n        intvalue = {$slotid} AND\r\n        itemsource = 0\r\n        {$accessClause}\r\n    ";
    $records = get_records_select('brainstorm_operatordata AS od', $select);
    return $records;
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:17,代码来源:locallib.php

示例13: get_rows

 function get_rows($elements, $sqlorder = '')
 {
     global $CFG;
     $finalelements = array();
     if (!empty($elements)) {
         return get_records_select('course_categories', 'id IN (' . implode(',', $elements) . ')', $sqlorder);
     }
     return $finalelements;
 }
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:9,代码来源:report.class.php

示例14: remove_friend

function remove_friend($username, $friendusername)
{
    if (!($userids = get_records_select('user', "username = '" . addslashes($username) . "' OR username = '" . addslashes($friendusername) . "'", '', 'username,id'))) {
        return;
    }
    $userid = $userids[$username]->id;
    $friendid = $userids[$friendusername]->id;
    delete_records_select('user_friend', "(userid = {$userid} AND friendid = {$friendid}) OR (userid = {$friendid} AND friendid = {$userid})");
}
开发者ID:nadavkav,项目名称:MoodleTAO,代码行数:9,代码来源:rpclib.php

示例15: resource_upgrade

function resource_upgrade($oldversion)
{
    // This function does anything necessary to upgrade
    // older versions to match current functionality
    global $CFG;
    if ($oldversion < 2004013101) {
        modify_database("", "INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('resource', 'update', 'resource', 'name');");
        modify_database("", "INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('resource', 'add', 'resource', 'name');");
    }
    if ($oldversion < 2004071000) {
        table_column("resource", "", "popup", "text", "", "", "", "", "alltext");
        if ($resources = get_records_select("resource", "type='3' OR type='5'", "", "id, alltext")) {
            foreach ($resources as $resource) {
                $resource->popup = addslashes($resource->alltext);
                $resource->alltext = "";
                if (!update_record("resource", $resource)) {
                    notify("Error updating popup field for resource id = {$resource->id}");
                }
            }
        }
        require_once "{$CFG->dirroot}/course/lib.php";
        rebuild_course_cache();
    }
    if ($oldversion < 2004071300) {
        table_column("resource", "", "options", "varchar", "255", "", "", "", "popup");
    }
    if ($oldversion < 2004071303) {
        table_column("resource", "type", "type", "varchar", "30", "", "", "", "");
        modify_database("", "UPDATE prefix_resource SET type='reference' WHERE type='1';");
        modify_database("", "UPDATE prefix_resource SET type='file', options='frame' WHERE type='2';");
        modify_database("", "UPDATE prefix_resource SET type='file' WHERE type='3';");
        modify_database("", "UPDATE prefix_resource SET type='text', options='0' WHERE type='4';");
        modify_database("", "UPDATE prefix_resource SET type='file' WHERE type='5';");
        modify_database("", "UPDATE prefix_resource SET type='html' WHERE type='6';");
        modify_database("", "UPDATE prefix_resource SET type='file' WHERE type='7';");
        modify_database("", "UPDATE prefix_resource SET type='text', options='3' WHERE type='8';");
        modify_database("", "UPDATE prefix_resource SET type='directory' WHERE type='9';");
    }
    if ($oldversion < 2004080801) {
        modify_database("", "UPDATE prefix_resource SET alltext=reference,type='html' WHERE type='reference';");
        rebuild_course_cache();
    }
    if ($oldversion < 2004111200) {
        //drop first to avoid conflicts when upgrading
        execute_sql("DROP INDEX {$CFG->prefix}resource_course_idx;", false);
        modify_database('', 'CREATE INDEX prefix_resource_course_idx ON prefix_resource (course);');
    }
    if ($oldversion < 2005041100) {
        // replace wiki-like with markdown
        include_once "{$CFG->dirroot}/lib/wiki_to_markdown.php";
        $wtm = new WikiToMarkdown();
        $wtm->update('resource', 'alltext', 'options');
    }
    //////  DO NOT ADD NEW THINGS HERE!!  USE upgrade.php and the lib/ddllib.php functions.
    return true;
}
开发者ID:edwinphillips,项目名称:moodle-485cb39,代码行数:56,代码来源:postgres7.php


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