本文整理汇总了PHP中get_recordset_sql函数的典型用法代码示例。如果您正苦于以下问题:PHP get_recordset_sql函数的具体用法?PHP get_recordset_sql怎么用?PHP get_recordset_sql使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_recordset_sql函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: init
/**
* Initialise the iterator
* @return boolean success
*/
function init()
{
global $CFG;
$this->close();
grade_regrade_final_grades($this->course->id);
$course_item = grade_item::fetch_course_item($this->course->id);
if ($course_item->needsupdate) {
// can not calculate all final grades - sorry
return false;
}
if (strpos($CFG->gradebookroles, ',') !== false) {
$gradebookroles = " = {$CFG->gradebookroles}";
} else {
$gradebookroles = " IN ({$CFG->gradebookroles})";
}
$relatedcontexts = get_related_contexts_string(get_context_instance(CONTEXT_COURSE, $this->course->id));
if ($this->groupid) {
$groupsql = "INNER JOIN {$CFG->prefix}groups_members gm ON gm.userid = u.id";
$groupwheresql = "AND gm.groupid = {$this->groupid}";
} else {
$groupsql = "";
$groupwheresql = "";
}
$users_sql = "SELECT u.*\n FROM {$CFG->prefix}user u\n INNER JOIN {$CFG->prefix}role_assignments ra ON u.id = ra.userid\n {$groupsql}\n WHERE ra.roleid {$gradebookroles}\n AND ra.contextid {$relatedcontexts}\n {$groupwheresql}\n ORDER BY u.id ASC";
$this->users_rs = get_recordset_sql($users_sql);
if (!empty($this->grade_items)) {
$itemids = array_keys($this->grade_items);
$itemids = implode(',', $itemids);
$grades_sql = "SELECT g.*\n FROM {$CFG->prefix}grade_grades g\n INNER JOIN {$CFG->prefix}user u ON g.userid = u.id\n INNER JOIN {$CFG->prefix}role_assignments ra ON u.id = ra.userid\n {$groupsql}\n WHERE ra.roleid {$gradebookroles}\n AND ra.contextid {$relatedcontexts}\n AND g.itemid IN ({$itemids})\n {$groupwheresql}\n ORDER BY g.userid ASC, g.itemid ASC";
$this->grades_rs = get_recordset_sql($grades_sql);
}
return true;
}
开发者ID:BackupTheBerlios,项目名称:samouk-svn,代码行数:37,代码来源:lib.php
示例2: webquestscorm_update_grades
/**
* Update grades by firing grade_updated event
*
* @param object $assignment null means all assignments
* @param int $userid specific user only, 0 mean all
*/
function webquestscorm_update_grades($webquestscorm = null, $userid = 0, $nullifnone = true)
{
global $CFG;
if (!function_exists('grade_update')) {
//workaround for buggy PHP versions
require_once $CFG->libdir . '/gradelib.php';
}
if ($webquestscorm != null) {
if ($grades = webquestscorm_get_user_grades($webquestscorm, $userid)) {
foreach ($grades as $k => $v) {
if ($v->rawgrade == -1) {
$grades[$k]->rawgrade = null;
}
}
webquestscorm_grade_item_update($webquestscorm, $grades);
} else {
webquestscorm_grade_item_update($webquestscorm);
}
} else {
$sql = "SELECT a.*, cm.idnumber as cmidnumber, a.course as courseid\n FROM {$CFG->prefix}webquestscorm a, {$CFG->prefix}course_modules cm, {$CFG->prefix}modules m\n WHERE m.name='webquestscorm' AND m.id=cm.module AND cm.instance=a.id";
if ($rs = get_recordset_sql($sql)) {
while ($webquestscorm = rs_fetch_next_record($rs)) {
if ($webquestscorm->grade != 0) {
webquestscorm_update_grades($webquestscorm);
} else {
webquestscorm_grade_item_update($webquestscorm);
}
}
rs_close($rs);
}
}
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:38,代码来源:lib.php
示例3: print_filter
function print_filter(&$mform, $data)
{
global $CFG, $db;
$columns = $db->MetaColumns($CFG->prefix . 'course');
$filteroptions = array();
$filteroptions[''] = get_string('choose');
$coursecolumns = array();
foreach ($columns as $c) {
$coursecolumns[$c->name] = $c->name;
}
if (!isset($coursecolumns[$data->field])) {
print_error('nosuchcolumn');
}
$reportclassname = 'report_' . $this->report->type;
$reportclass = new $reportclassname($this->report);
$components = cr_unserialize($this->report->components);
$conditions = $components['conditions'];
$courselist = $reportclass->elements_by_conditions($conditions);
if (!empty($courselist)) {
if ($rs = get_recordset_sql('SELECT DISTINCT(' . $data->field . ') as ufield FROM ' . $CFG->prefix . 'course WHERE ' . $data->field . ' <> "" ORDER BY ufield ASC')) {
while ($u = rs_fetch_next_record($rs)) {
$filteroptions[base64_encode($u->ufield)] = $u->ufield;
}
}
}
$mform->addElement('select', 'filter_fcoursefield_' . $data->field, get_string($data->field), $filteroptions);
$mform->setType('filter_courses', PARAM_INT);
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:28,代码来源:plugin.class.php
示例4: 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
示例5: block_openshare_updategroup
function block_openshare_updategroup($courseid, $groupid)
{
$sql = 'SELECT u.id FROM mdl_user u
JOIN mdl_role_assignments ra ON ra.userid = u.id
JOIN mdl_role r ON ra.roleid = r.id
JOIN mdl_context con ON ra.contextid = con.id
JOIN mdl_course c ON c.id = con.instanceid AND con.contextlevel = 50 WHERE (r.shortname = \'student\' OR r.shortname = \'teacher\' OR r.shortname = \'editingteacher\' OR r.shortname = \'coursecreator\') AND c.id = ' . $courseid;
$rs = get_recordset_sql($sql);
if (!empty($rs)) {
while ($rec = rs_fetch_next_record($rs)) {
//prep dataobject for door
$groupenroll = new object();
$groupenroll->timeadded = time();
$groupenroll->groupid = $groupid;
$groupenroll->userid = $rec->id;
$ingroup = get_record("groups_members", "groupid", $groupid, "userid", $rec->id);
if (empty($ingroup)) {
insert_record("groups_members", $groupenroll);
print 'updated' . $groupenroll->groupid . $groupenroll->userid . '<br/>';
}
}
} else {
print_error("No users in this course!");
}
// Close the recordset to save memory
rs_close($rs);
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:27,代码来源:locallib.php
示例6: folio_control_page_edit_move
function folio_control_page_edit_move($page)
{
// Find the security information for the page.
global $CFG;
$url = url;
$page_ident = intval($page->page_ident);
$parentpage_ident = intval($page->parentpage_ident);
// Check to see if we're on the homepage.
if (folio_page_is_homepage($page)) {
// Don't allow moving a homepage.
$run_result = '<input type="hidden" name="parentpage_ident" value="' . $page->parentpage_ident . '" />';
} elseif (!isloggedin()) {
// Have to be logged in to move a page.
// mark control as disabled & don't bother loading all of the pages.
$run_result = "\t\t\t<SELECT NAME=\"parentpage_ident\" DISABLED>";
// Get parentpage title
$pages = recordset_to_array(get_recordset_sql('select page_ident, title from ' . $CFG->prefix . 'folio_page ' . 'WHERE newest = 1 and user_ident = ' . $page->user_ident . ' AND page_ident = ' . $page->parentpage_ident));
// build
if ($pages) {
// Iterate
foreach ($pages as $potentialpage) {
// Selected
$run_result .= '<OPTION VALUE=' . $potentialpage->page_ident . " SELECTED=true>" . $potentialpage->title . "\n";
}
$run_result .= "</SELECT><br/>\n" . "<input type='hidden' name='parentpage_ident' value='{$potentialpage->page_ident}' />\n";
} else {
// No pages. Show control set to homepage & disabled.
$run_result = "\t\t\t<SELECT NAME=\"parentpage_ident\" disabled=TRUE>" . '<OPTION VALUE="' . $page->parentpage_ident . '" SELECTED=true>Homepage' . "</SELECT><br/>\n" . "<input type='hidden' name='parentpage_ident' value='{$potentialpage->page_ident}' />\n";
}
$run_result = templates_draw(array('context' => 'databoxvertical', 'name' => 'Parent Page', 'contents' => $run_result));
} else {
// Ok conditions, build the control.
$run_result = "\t\t\t<SELECT NAME=\"parentpage_ident\">";
// Get all titles for active pages belonging to the current user
$pages = recordset_to_array(get_recordset_sql('select page_ident, title from ' . $CFG->prefix . 'folio_page ' . 'WHERE newest = 1 and user_ident = ' . $page->user_ident . ' AND page_ident <> ' . $page->page_ident . ' AND parentpage_ident <> ' . $page->page_ident . ' order by title'));
// build
if ($pages) {
// Iterate
foreach ($pages as $potentialpage) {
if ($page->parentpage_ident == $potentialpage->page_ident) {
// Selected
$run_result .= '<OPTION VALUE=' . $potentialpage->page_ident . " SELECTED=true>" . $potentialpage->title . "\n";
} else {
// !Selected
$run_result .= '<OPTION VALUE=' . $potentialpage->page_ident . " >" . $potentialpage->title . "\n";
}
}
$run_result .= "</SELECT><br/>\n";
} else {
// No pages. Show control set to homepage & disabled.
$run_result = "\t\t\t<SELECT NAME=\"parentpage_ident\" disabled=TRUE>" . '<OPTION VALUE="' . $page->parentpage_ident . '" SELECTED=true>Homepage' . "</SELECT><br/>\n";
}
$run_result = templates_draw(array('context' => 'databoxvertical', 'name' => 'Parent Page', 'contents' => $run_result));
}
return $run_result;
}
开发者ID:pzingg,项目名称:saugus_elgg,代码行数:56,代码来源:page_edit_move.php
示例7: xmldb_forum_upgrade
function xmldb_forum_upgrade($oldversion = 0)
{
global $CFG, $THEME, $db;
$result = true;
/// And upgrade begins here. For each one, you'll need one
/// block of code similar to the next one. Please, delete
/// this comment lines once this file start handling proper
/// upgrade code.
/// if ($result && $oldversion < YYYYMMDD00) { //New version in version.php
/// $result = result of "/lib/ddllib.php" function calls
/// }
if ($result && $oldversion < 2007101000) {
/// Define field timemodified to be added to forum_queue
$table = new XMLDBTable('forum_queue');
$field = new XMLDBField('timemodified');
$field->setAttributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'postid');
/// Launch add field timemodified
$result = $result && add_field($table, $field);
}
//===== 1.9.0 upgrade line ======//
if ($result and $oldversion < 2007101511) {
notify('Processing forum grades, this may take a while if there are many forums...', 'notifysuccess');
//MDL-13866 - send forum ratins to gradebook again
require_once $CFG->dirroot . '/mod/forum/lib.php';
// too much debug output
$db->debug = false;
forum_update_grades();
$db->debug = true;
}
if ($result && $oldversion < 2007101512) {
/// Cleanup the forum subscriptions
notify('Removing stale forum subscriptions', 'notifysuccess');
$roles = get_roles_with_capability('moodle/course:view', CAP_ALLOW);
$roles = array_keys($roles);
$roles = implode(',', $roles);
$sql = "SELECT fs.userid, f.id AS forumid\n FROM {$CFG->prefix}forum f\n JOIN {$CFG->prefix}course c ON c.id = f.course\n JOIN {$CFG->prefix}context ctx ON (ctx.instanceid = c.id AND ctx.contextlevel = " . CONTEXT_COURSE . ")\n JOIN {$CFG->prefix}forum_subscriptions fs ON fs.forum = f.id\n LEFT JOIN {$CFG->prefix}role_assignments ra ON (ra.contextid = ctx.id AND ra.userid = fs.userid AND ra.roleid IN ({$roles}))\n WHERE ra.id IS NULL";
if ($rs = get_recordset_sql($sql)) {
$db->debug = false;
while ($remove = rs_fetch_next_record($rs)) {
delete_records('forum_subscriptions', 'userid', $remove->userid, 'forum', $remove->forumid);
echo '.';
}
$db->debug = true;
rs_close($rs);
}
}
if ($result && $oldversion < 2007101513) {
delete_records('forum_ratings', 'post', 0);
/// Clean existing wrong rates. MDL-18227
}
return $result;
}
开发者ID:nadavkav,项目名称:MoodleTAO,代码行数:52,代码来源:upgrade.php
示例8: display_search_field
function display_search_field($value = '')
{
global $CFG;
$varcharlat = sql_compare_text('content');
$varcharlong = sql_compare_text('content1');
$latlongsrs = get_recordset_sql("SELECT DISTINCT {$varcharlat} AS la, {$varcharlong} AS lo\n FROM {$CFG->prefix}data_content\n WHERE fieldid = {$this->field->id}\n ORDER BY {$varcharlat}, {$varcharlong}");
$options = array();
while ($latlong = rs_fetch_next_record($latlongsrs)) {
$options[$latlong->la . ',' . $latlong->lo] = $latlong->la . ',' . $latlong->lo;
}
rs_close($latlongsrs);
return choose_from_menu($options, 'f_' . $this->field->id, $value, 'choose', '', 0, true);
}
开发者ID:edwinphillips,项目名称:moodle-485cb39,代码行数:13,代码来源:field.class.php
示例9: query_drafts
/**
* Queries for draft posts, including necessary joins with other fields.
* @param string $where Text of WHERE clause e.g. 'fdr.id=14'. May refer
* to aliases fdr (drafts), fd (discussions), fp (posts; post being
* replied to), fpfirst (first post in discussion), and u (user being
* replied to)
* @return array Array of forum_draft objects (empty if none)
*/
static function query_drafts($where)
{
global $CFG;
$result = array();
$rs = get_recordset_sql("\nSELECT\n fdr.*, fd.id AS discussionid, fpfirst.subject AS discussionsubject, \n f.course AS courseid,\n " . forum_utils::select_username_fields('u', false) . "\nFROM\n {$CFG->prefix}forumng_drafts fdr\n LEFT JOIN {$CFG->prefix}forumng_posts fp ON fdr.parentpostid = fp.id\n LEFT JOIN {$CFG->prefix}forumng_discussions fd ON fp.discussionid = fd.id\n LEFT JOIN {$CFG->prefix}forumng_posts fpfirst ON fd.postid = fpfirst.id\n LEFT JOIN {$CFG->prefix}user u ON fp.userid = u.id\n INNER JOIN {$CFG->prefix}forumng f ON fdr.forumid = f.id\nWHERE\n {$where}\nORDER BY\n fdr.saved DESC\n ");
if (!$rs) {
throw new forum_exception("Failed to query for draft posts");
}
while ($rec = rs_fetch_next_record($rs)) {
$result[] = new forum_draft($rec);
}
rs_close($rs);
return $result;
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:22,代码来源:forum_draft.php
示例10: sermon_alphabetical_get_one_node
function sermon_alphabetical_get_one_node($letterstartnumber)
{
global $CFG, $COURSE, $alphabet;
if (empty($letterstartnumber)) {
return '';
}
$extrawhere = array();
for ($x = 0; $x < NUMBER_OF_PARTION_LETTERS; $x++) {
$extrawhere[] = "name LIKE '{$alphabet[$letterstartnumber + $x]}%' ";
}
//get the relavant sermons for this sermon series
$sql = "SELECT r.*, rs.datedelivered, rs.seriesname, rs.book, rs.beginchapter, cm.id as `cmid`,\n rs.guestspeaker, rs.guestspeakername, rs.hitcounter, rs.lastaccess \n FROM {$CFG->prefix}resource r \n JOIN {$CFG->prefix}resource_sermon rs ON rs.resourceid = r.id\n JOIN {$CFG->prefix}course_modules cm ON cm.instance = r.id \n WHERE r.type = 'sermon' AND r.course = {$COURSE->id} AND name != '' ";
$sql .= !empty($extrawhere) ? ' AND (' . implode(' OR ', $extrawhere) . ')' : '';
$sql .= " ORDER BY r.name ASC";
$sermons = get_recordset_sql($sql);
//loop through and make them into an array of objecst compatible for a json_encode
$letters = array();
while (($sermon = rs_fetch_next_record($sermons)) !== false) {
if (empty($sermon->seriesname)) {
$sermon->seriesname = 'no name';
}
$sermon->datedelivered = date('m-d-Y', $sermon->datedelivered);
$sermonnode = new stdClass();
$sermonnode->attributes = new stdClass();
$sermonnode->attributes->id = $sermon->cmid . '~' . sermon_block_make_name_safe_for_id($sermon->seriesname);
$sermonnode->attributes->class = 'leaf sermon';
if (!empty($sermon->reference)) {
$sermonnode->attributes->class .= ' mp3 ';
} else {
if (!empty($sermon->referencesermontext)) {
$sermonnode->attributes->class .= ' text ';
} else {
if (!empty($sermon->referencelesson)) {
$sermonnode->attributes->class .= ' lesson ';
}
}
}
$sermonnode->attributes->class .= rs_fetch_record($sermons) === false ? ' last ' : '';
$sermonnode->data = get_string('sermonleaf', 'resource', $sermon);
$letters[] = $sermonnode;
}
$letters = array_values($letters);
if (empty($letters)) {
return '';
}
return $letters;
}
开发者ID:NextEinstein,项目名称:riverhills,代码行数:47,代码来源:lib.php
示例11: question_multianswer_fix_subquestion_parents_and_categories
/**
* Due to MDL-14750, subquestions of multianswer questions restored from backup will
* have the wrong parent, and due to MDL-10899 subquestions of multianswer questions
* that have been moved between categories will be in the wrong category, This code fixes these up.
*/
function question_multianswer_fix_subquestion_parents_and_categories()
{
global $CFG;
$result = true;
$rs = get_recordset_sql('SELECT q.id, q.category, qma.sequence FROM ' . $CFG->prefix . 'question q JOIN ' . $CFG->prefix . 'question_multianswer qma ON q.id = qma.question');
if ($rs) {
while ($q = rs_fetch_next_record($rs)) {
if (!empty($q->sequence)) {
$result = $result && execute_sql('UPDATE ' . $CFG->prefix . 'question' . ' SET parent = ' . $q->id . ', category = ' . $q->category . ' WHERE id IN (' . $q->sequence . ') AND parent <> 0');
}
}
rs_close($rs);
} else {
$result = false;
}
return $result;
}
开发者ID:JackCanada,项目名称:moodle-hacks,代码行数:22,代码来源:upgrade.php
示例12: folio_getVersion
/**
* Get the current version, or -1 if the table isn't present
* @return Integer
**/
function folio_getVersion()
{
global $CFG;
// Find.
$versions = recordset_to_array(get_recordset_sql("SELECT version as v, version FROM " . $CFG->prefix . "folio_version"));
if ($versions) {
$i = -1;
foreach ($versions as $version) {
if ($i < $version->version) {
$i = $version->version;
}
}
return $version->version;
} else {
// Table not found. Folios probably aren't installed yet.
return -1;
}
}
开发者ID:pzingg,项目名称:saugus_elgg,代码行数:22,代码来源:setupdb.php
示例13: sermon_series_get_one_node
function sermon_series_get_one_node($seriesname)
{
global $CFG, $COURSE;
if (empty($seriesname)) {
return '';
}
//get the relavant sermons for this sermon series
$sql = "SELECT r.*, rs.datedelivered, rs.seriesname, rs.book, rs.beginchapter, cm.id as `cmid`,\n rs.guestspeaker, rs.guestspeakername, rs.hitcounter, rs.lastaccess \n FROM {$CFG->prefix}resource r \n JOIN {$CFG->prefix}resource_sermon rs ON rs.resourceid = r.id\n JOIN {$CFG->prefix}course_modules cm ON cm.instance = r.id \n WHERE r.type = 'sermon' AND r.course = {$COURSE->id} AND name != '' AND rs.seriesname = '{$seriesname}'\n ORDER BY rs.seriesname ASC, rs.datedelivered DESC";
$sermons = get_recordset_sql($sql);
//loop through and make them into an array of objecst compatible for a json_encode
$series = array();
while (($sermon = rs_fetch_next_record($sermons)) !== false) {
if (empty($sermon->seriesname)) {
$sermon->seriesname = 'no name';
}
//clean up some variable
// $sermon->seriesname = stripslashes($sermon->seriesname);
// $sermon->name = stripslashes($sermon->name);
$sermon->datedelivered = date('m-d-Y', $sermon->datedelivered);
$sermonnode = new stdClass();
$sermonnode->attributes = new stdClass();
$sermonnode->attributes->id = $sermon->cmid . '~' . sermon_block_make_name_safe_for_id($sermon->seriesname);
$sermonnode->attributes->class = 'leaf sermon';
if (!empty($sermon->reference)) {
$sermonnode->attributes->class .= ' mp3 ';
} else {
if (!empty($sermon->referencesermontext)) {
$sermonnode->attributes->class .= ' text ';
} else {
if (!empty($sermon->referencelesson)) {
$sermonnode->attributes->class .= ' lesson ';
}
}
}
$sermonnode->attributes->class .= rs_fetch_record($sermons) === false ? ' last ' : '';
$sermonnode->data = get_string('sermonleaf', 'resource', $sermon);
$series[] = $sermonnode;
}
$series = array_values($series);
if (empty($series)) {
return '';
}
return $series;
}
开发者ID:NextEinstein,项目名称:riverhills,代码行数:44,代码来源:lib.php
示例14: __construct
/**
* Creates the mail queue and runs query to obtain list of posts that should
* be mailed.
* @param bool $tracetimes True if it should call mtrace to display
* performance information
*/
function __construct($tracetimes)
{
global $CFG;
$this->time = time();
$this->forum = null;
$this->discussion = null;
$this->storedrecord = null;
$this->postcount = 0;
// Check if an earlier run got aborted. In that case we mark all
// messages as mailed anyway because it's better to skip some than
// to send out double-posts.
if ($pending = get_config('forumng', $this->get_pending_flag_name())) {
$this->mark_mailed($pending);
}
// Note that we are mid-run
set_config($this->get_pending_flag_name(), $this->time, 'forumng');
$querychunk = $this->get_query_chunk($this->time);
if (!($this->rs = get_recordset_sql($sql = "\nSELECT\n " . forum_utils::select_forum_fields('f') . ",\n " . forum_utils::select_discussion_fields('fd') . ",\n " . forum_utils::select_post_fields('discussionpost') . ",\n " . forum_utils::select_post_fields('fp') . ",\n " . forum_utils::select_post_fields('reply') . ",\n " . forum_utils::select_course_module_fields('cm') . ",\n " . forum_utils::select_context_fields('x') . ",\n " . forum_utils::select_username_fields('u', true) . ",\n " . forum_utils::select_username_fields('eu') . ",\n " . forum_utils::select_username_fields('replyu') . ",\n " . forum_utils::select_username_fields('replyeu') . ",\n " . forum_utils::select_course_fields('c') . ",\n clonecm.id AS cloneid\n{$querychunk}\nORDER BY\n clonecm.course, f.id, fd.id, fp.id"))) {
throw new forum_exception("Mail queue query failed");
}
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:27,代码来源:forum_mail_list.php
示例15: folio_page_delete
/**
* Delete a single wiki page. Assumes that permission check has already been run.
* Looks to see if there are any child pages, if so, doesn't allow deleting until those are
* removed as well.
*
* @package folio
* @param array $page The mysql page record.
* @param string $page_title The passed in title used to access the page. Assumes that it has already
* been decoded by the function in lib.php away from the URL form & into the normal presentation form.
* @param string $username The username of the page owner. Used to create post link
* to the finished page.
* @returns HTML code to delete a folio page.
**/
function folio_page_delete($page, $page_title, $username)
{
global $CFG;
global $profile_id;
global $language;
global $page_owner;
global $metatags;
// Set url var
$url = url;
// Error, need a page record.
if (!$page) {
error('Sorry, but you can not delete a page that has not yet been created.');
}
// Get children records.
$pages = recordset_to_array(get_recordset_sql('SELECT * FROM ' . $CFG->prefix . 'folio_page p ' . "WHERE parentpage_ident = {$page->page_ident} AND newest = 1"));
// Build results
if ($pages) {
// don't offer to delete pages with children. link to titles
$run_result = 'Sorry, but you can not delete a page that has child pages under it. Delete each' . ' of the child pages, and then come back and delete this page.<br/>' . '<ul>';
foreach ($pages as $page) {
$run_result .= "<li><a href=\"{$url}{$username}/page/" . folio_page_encodetitle($page->title) . "\">{$page->title}</a>";
}
$run_result .= "</ul>";
} else {
$run_result = <<<END
<form method="post" name="elggform" action="{$url}_folio/action_redirection.php">
\t<h2>{$page_title}</h2>
\t<p>
Click the 'delete' button to completely remove this page. You will not be able to undo this process.<br/>
\t\t<input type="hidden" name="action" value="folio:page:delete" />
\t\t<input type="hidden" name="page_ident" value="{$page->page_ident}" />
\t\t<input type="submit" value="Delete" />
\t</p>
END;
}
return $run_result;
}
开发者ID:pzingg,项目名称:saugus_elgg,代码行数:51,代码来源:page_delete.php
示例16: folio_control_childpagelist
function folio_control_childpagelist($username, $page, $profile_id)
{
global $CFG;
$url = url;
if (!$page) {
// No pages passed. Can't show sub-pages of a page that doesnt' exist.
return '';
} else {
// Grab matching records.
$pages = recordset_to_array(get_recordset_sql("SELECT DISTINCT w.* FROM " . $CFG->prefix . "folio_page w " . "INNER JOIN " . $CFG->prefix . "folio_page_security p ON w.security_ident = p.security_ident " . 'WHERE w.parentpage_ident = ' . $page->page_ident . ' AND w.page_ident <> ' . $page->page_ident . ' AND w.newest = 1 AND ' . folio_page_security_where('p', 'w', 'read', $profile_id) . ' ORDER BY title '));
$html = '<a href="' . $url . $username . '/page/' . folio_page_encodetitle($page->title) . '/addpage">Add a new page under this one</a><br/>';
if ($pages) {
// Build html
$html .= '<ul>';
foreach ($pages as $childpage) {
// Load values.
$html .= "<li><a href=\"{$url}" . $username . '/page/' . folio_page_encodetitle($childpage->title) . '">' . $childpage->title . "</a>\n";
}
$html .= '</ul>';
}
}
return $html;
}
开发者ID:pzingg,项目名称:saugus_elgg,代码行数:23,代码来源:pagelist.php
示例17: grade_cron
/**
* Grading cron job
*/
function grade_cron()
{
global $CFG;
$now = time();
$sql = "SELECT i.*\n FROM {$CFG->prefix}grade_items i\n WHERE i.locked = 0 AND i.locktime > 0 AND i.locktime < {$now} AND EXISTS (\n SELECT 'x' FROM {$CFG->prefix}grade_items c WHERE c.itemtype='course' AND c.needsupdate=0 AND c.courseid=i.courseid)";
// go through all courses that have proper final grades and lock them if needed
if ($rs = get_recordset_sql($sql)) {
if ($rs->RecordCount() > 0) {
while ($item = rs_fetch_next_record($rs)) {
$grade_item = new grade_item($item, false);
$grade_item->locked = $now;
$grade_item->update('locktime');
}
}
rs_close($rs);
}
$grade_inst = new grade_grade();
$fields = 'g.' . implode(',g.', $grade_inst->required_fields);
$sql = "SELECT {$fields}\n FROM {$CFG->prefix}grade_grades g, {$CFG->prefix}grade_items i\n WHERE g.locked = 0 AND g.locktime > 0 AND g.locktime < {$now} AND g.itemid=i.id AND EXISTS (\n SELECT 'x' FROM {$CFG->prefix}grade_items c WHERE c.itemtype='course' AND c.needsupdate=0 AND c.courseid=i.courseid)";
// go through all courses that have proper final grades and lock them if needed
if ($rs = get_recordset_sql($sql)) {
if ($rs->RecordCount() > 0) {
while ($grade = rs_fetch_next_record($rs)) {
$grade_grade = new grade_grade($grade, false);
$grade_grade->locked = $now;
$grade_grade->update('locktime');
}
}
rs_close($rs);
}
}
开发者ID:BackupTheBerlios,项目名称:samouk-svn,代码行数:34,代码来源:gradelib.php
示例18: buildWhere
/**
* Based off of the incoming parameters, build a SQL where condition
**/
function buildWhere($purpose, $reader_ident, $user_ident, $types, $types_avoid)
{
global $CFG;
if ($purpose == 'activity') {
// FIND FRIENDS AND JOINED COMMUNITIES.
// Find key values for friends.
$friendlist = array();
$friends = recordset_to_array(get_recordset_sql("SELECT DISTINCT friend as i, friend FROM " . $CFG->prefix . "friends where owner = {$user_ident}"));
if ($friends) {
foreach ($friends as $friend) {
$friendlist[] = $friend->friend;
}
}
// Find key values for owned communities
$friends = recordset_to_array(get_recordset_sql("SELECT DISTINCT ident as i, ident FROM " . $CFG->prefix . "users where owner = {$user_ident}"));
if ($friends) {
foreach ($friends as $friend) {
$friendlist[] = $friend->ident;
}
}
// Transform array into a where clause.
if (count($friendlist) > 0) {
$friendlist = implode(',', $friendlist);
$where = 'owner_ident in (' . $friendlist . ')';
} else {
// If a person has no friends or communities, then they have no activity.
$where = ' false ';
}
} elseif ($purpose == 'subscribe') {
// Subscribe to a person's feed.
$where = "owner_ident = {$user_ident}";
} else {
die('unknown purpose passed to feeds.php');
}
// Add permissions
$where .= ' AND access in ("' . implode('","', rss_permissionlist($reader_ident)) . '")';
// Add type filter
$where .= rss_buildwhere('type', $types, $types_avoid);
return $where;
}
开发者ID:pzingg,项目名称:saugus_elgg,代码行数:43,代码来源:feeds.php
示例19: survey_print_recent_activity
function survey_print_recent_activity($course, $viewfullnames, $timestart)
{
global $CFG;
$modinfo = get_fast_modinfo($course);
$ids = array();
foreach ($modinfo->cms as $cm) {
if ($cm->modname != 'survey') {
continue;
}
if (!$cm->uservisible) {
continue;
}
$ids[$cm->instance] = $cm->instance;
}
if (!$ids) {
return false;
}
$slist = implode(',', $ids);
// there should not be hundreds of glossaries in one course, right?
if (!($rs = get_recordset_sql("SELECT sa.userid, sa.survey, MAX(sa.time) AS time,\n u.firstname, u.lastname, u.email, u.picture\n FROM {$CFG->prefix}survey_answers sa\n JOIN {$CFG->prefix}user u ON u.id = sa.userid\n WHERE sa.survey IN ({$slist}) AND sa.time > {$timestart}\n GROUP BY sa.userid, sa.survey, u.firstname, u.lastname, u.email, u.picture\n ORDER BY time ASC"))) {
return false;
}
$surveys = array();
while ($survey = rs_fetch_next_record($rs)) {
$cm = $modinfo->instances['survey'][$survey->survey];
$survey->name = $cm->name;
$survey->cmid = $cm->id;
$surveys[] = $survey;
}
rs_close($rs);
if (!$surveys) {
return false;
}
print_headline(get_string('newsurveyresponses', 'survey') . ':');
foreach ($surveys as $survey) {
$url = $CFG->wwwroot . '/mod/survey/view.php?id=' . $survey->cmid;
print_recent_activity_note($survey->time, $survey, $survey->name, $url, false, $viewfullnames);
}
return true;
}
开发者ID:JackCanada,项目名称:moodle-hacks,代码行数:40,代码来源:lib.php
示例20: array_merge
$exclude = array_merge(array_keys($mnetenrolledusers), array_keys($remtenrolledusers));
$exclude[] = 0;
$select = 'AND u.username!=\'guest\' AND u.id NOT IN (' . join(',', $exclude) . ') ';
unset($exclude);
$searchtext = trim($searchtext);
if ($searchtext !== '') {
// Search for a subset of remaining users
$LIKE = sql_ilike();
$FULLNAME = sql_fullname();
$select .= " AND ({$FULLNAME} {$LIKE} '%{$searchtext}%' OR email {$LIKE} '%{$searchtext}%') ";
}
$sql = 'SELECT id, firstname, lastname, email
FROM ' . $CFG->prefix . 'user u
WHERE deleted = 0 AND confirmed = 1
AND mnethostid = ' . $CFG->mnet_localhost_id . ' ' . $select . 'ORDER BY lastname ASC, firstname ASC';
$availableusers = get_recordset_sql($sql, 0, MAX_USERS_PER_PAGE);
/// Print the page
/// get language strings
$str = get_strings(array('enrolmentplugins', 'configuration', 'users', 'administration'));
/// Get some language strings
$strpotentialusers = get_string('potentialusers', 'role');
$strexistingusers = get_string('existingusers', 'role');
$straction = get_string('assignroles', 'role');
$strroletoassign = get_string('roletoassign', 'role');
$strcurrentcontext = get_string('currentcontext', 'role');
$strsearch = get_string('search');
$strshowall = get_string('showall');
$strparticipants = get_string('participants');
$strsearchresults = get_string('searchresults');
admin_externalpage_print_header();
print_box('<strong>' . s($mnet_peer->name) . ' : ' . format_string($course->shortname) . ' ' . format_string($course->fullname) . '</strong><br />' . get_string("enrolcourseenrol_desc", "mnet"
|
请发表评论