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

PHP get_field_select函数代码示例

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

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



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

示例1: wikibook_page_content

function wikibook_page_content($pagename)
{
    global $WS;
    $select = "dfwiki = {$WS->dfwiki->id} AND pagename = '{$pagename}' " . "AND groupid = {$WS->groupmember->groupid}";
    if ($WS->dfwiki->studentmode != '0' || $WS->cm->groupmode == '0') {
        $select .= " AND ownerid = {$WS->member->id}";
    }
    if ($version = get_field_select('wiki_pages', 'MAX(version)', $select)) {
        if ($record = get_record_select('wiki_pages', $select . " AND version = {$version}")) {
            return $record->content;
        }
    }
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:13,代码来源:wikibook.php


示例2: game_bottomtext_onupdate

function game_bottomtext_onupdate()
{
    global $CFG;
    $update = $_POST['update'];
    $sesskey = $_POST['sesskey'];
    $top = $_POST['top'];
    $field = $top ? 'toptext' : 'bottomtext';
    $gameid = get_field_select("course_modules", "instance", "id={$update}");
    $game->id = $gameid;
    $game->{$field} = $_POST[$field];
    if (!update_record('game', $game)) {
        error("game_bottomtext_onupdate: Can't update game id={$game->id}");
    }
    redirect("{$CFG->wwwroot}/course/mod.php?update={$update}&sesskey={$sesskey}&sr=1");
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:15,代码来源:bottomtext.php


示例3: process_form

 function process_form()
 {
     $tag = optional_param('tag', '', PARAM_TEXT);
     $delete = optional_param('delete', 0, PARAM_INT);
     if (!empty($tag)) {
         $record = new object();
         $record->gallery = $this->gallery->id;
         $record->image = $this->image;
         $record->metatype = 'tag';
         $record->description = strtolower($tag);
         insert_record('lightboxgallery_image_meta', $record);
     } else {
         if ($delete) {
             $select = "metatype = 'tag' AND id = {$delete} AND gallery = {$this->gallery->id} AND image = '{$this->image}'";
             if ($id = get_field_select('lightboxgallery_image_meta', 'id', $select)) {
                 delete_records('lightboxgallery_image_meta', 'id', $id);
             }
         }
     }
 }
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:20,代码来源:tag.class.php


示例4: game_sudoku_check_last

function game_sudoku_check_last($id, $game, $attempt, $sudoku, $finishattempt)
{
    global $CFG;
    $correct = get_field_select('game_queries', 'COUNT(*) AS c', "attemptid={$attempt->id} AND score > 0.9");
    $all = get_field_select('game_queries', 'COUNT(*) AS c', "attemptid={$attempt->id}");
    if ($all) {
        $grade = $correct / $all;
    } else {
        $grade = 0;
    }
    game_updateattempts($game, $attempt, $grade, $finishattempt);
    redirect("{$CFG->wwwroot}/mod/game/attempt.php?id={$id}", '', 0);
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:13,代码来源:play.php


示例5: wiki_info_content


//.........这里部分代码省略.........
        $prop->header = "true";
        $prop->valign = "top";
        $prop->class = "nwikileftnow header c2";
        wiki_change_column($prop);
        echo get_string('lastmodified');
        if (wiki_grade_got_permission($WS)) {
            $prop = null;
            $prop->header = "true";
            $prop->valign = "top";
            $prop->class = "nwikileftnow header c3";
            wiki_change_column($prop);
            echo get_string('eval_editions_quality', 'wiki');
        }
        $prop = null;
        $prop->header = "true";
        //print content
        $i = 0;
        foreach ($vers as $ver) {
            if ($ver->highlight) {
                $class = "textcenter nwikihighlight";
            } else {
                $class = "textcenter nwikibargroundblanco";
            }
            if (isset($prop->header)) {
                $prop->class = $class;
                wiki_change_row($prop);
            } else {
                $prop = null;
                $prop->class = $class;
                wiki_change_row($prop);
            }
            // input types for history diff
            if ($countver > 1) {
                $style = 'style="visibility:hidden" ';
                $checked = 'checked="checked"';
                if ($i == 0) {
                    echo '<input type="radio" value="' . $ver->version . '" name="oldid" ' . $style . ' />';
                    echo '<input type="radio" value="' . $ver->version . '" name="diff" ' . $checked . ' />';
                } elseif ($i == 1) {
                    echo '<input type="radio" value="' . $ver->version . '" name="oldid" ' . $checked . ' />';
                    echo '<input type="radio" value="' . $ver->version . '" name="diff" ' . $style . ' />';
                } else {
                    echo '<input type="radio" value="' . $ver->version . '" name="oldid" />';
                    echo '<input type="radio" value="' . $ver->version . '" name="diff" ' . $style . ' />';
                }
                $prop = null;
                $prop->class = $class;
                wiki_change_column($prop);
            }
            if ($ver->version == $WS->pagedata->version) {
                echo $ver->version;
            } else {
                $prop = null;
                $prop->href = "javascript:document.forms['formu" . $i . "'].submit()";
                $out = wiki_a($ver->version, $prop, true);
                $prop = null;
                $prop->name = "dfcontent";
                $prop->value = "11";
                $out .= wiki_input_hidden($prop, true);
                $out2 = wiki_div($out, '', true);
                $prop = null;
                $prop->id = "formu{$i}";
                $prop->action = "view.php?id={$WS->linkid}&amp;page=" . urlencode("oldversion/{$ver->pagename}") . "&amp;ver={$ver->version}&amp;gid={$WS->groupmember->groupid}&amp;uid={$WS->member->id}";
                $prop->method = "post";
                wiki_form($out2, $prop);
            }
            $prop = null;
            $prop->class = $class;
            wiki_change_column($prop);
            $author = wiki_get_user_info($ver->author);
            echo $author;
            $prop = null;
            $prop->class = $class;
            wiki_change_column($prop);
            $modified = strftime('%A, %d %B %Y %H:%M', $ver->lastmodified);
            echo $modified;
            if (wiki_grade_got_permission($WS)) {
                $prop = null;
                $prop->class = $class;
                wiki_change_column($prop);
                $scale = array(1 => "+", 2 => "=", 3 => "-");
                $gradevalue = get_field_select('wiki_evaluation_edition', 'valoration', 'wiki_pageid=' . $ver->id);
                if ($gradevalue) {
                    echo wiki_grade_translate($gradevalue, $scale);
                } else {
                    echo get_string('eval_notset', 'wiki');
                }
            }
            $i++;
        }
        wiki_table_end();
        if ($countver > 1) {
            echo '<br/>';
            echo '<input type="submit" name="' . get_string('compareversions', 'wiki') . '" value="' . get_string('compareversions', 'wiki') . '"/>';
        }
        echo '</form>';
    } else {
        print_string('noversion', 'wiki');
    }
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:101,代码来源:locallib.php


示例6: get_field_select

 function get_field_select($table, $return, $select)
 {
     global $CFG;
     $CFG->prefix = $this->prefix;
     $records = get_field_select($table, $return, $select);
     $CFG->prefix = $this->newmoodleprefix;
     return $records;
 }
开发者ID:remotelearner,项目名称:elis.cm,代码行数:8,代码来源:data.class.php


示例7: game_hiddenpicture_check_questions

function game_hiddenpicture_check_questions($id, $game, &$attempt, &$hiddenpicture, $finishattempt)
{
    global $QTYPES, $CFG;
    $responses = data_submitted();
    $offsetquestions = game_sudoku_compute_offsetquestions($game->sourcemodule, $attempt, $numbers, $correctquestions);
    $questionlist = game_sudoku_getquestionlist($offsetquestions);
    $questions = game_sudoku_getquestions($questionlist);
    $actions = question_extract_responses($questions, $responses, QUESTION_EVENTSUBMIT);
    $correct = $wrong = 0;
    foreach ($questions as $question) {
        if (!array_key_exists($question->id, $actions)) {
            //no answered
            continue;
        }
        unset($state);
        unset($cmoptions);
        $question->maxgrade = 100;
        $state->responses = $actions[$question->id]->responses;
        $state->event = QUESTION_EVENTGRADE;
        $cmoptions = array();
        $QTYPES[$question->qtype]->grade_responses($question, $state, $cmoptions);
        unset($query);
        $select = "attemptid={$attempt->id}";
        $select .= " AND questionid={$question->id}";
        if (($query->id = get_field_select('game_queries', 'id', $select)) == 0) {
            die("problem game_hiddenpicture_check_questions (select={$select})");
            continue;
        }
        $answertext = $state->responses[''];
        if ($answertext != '') {
            $grade = $state->raw_grade;
            if ($grade < 50) {
                //wrong answer
                game_update_queries($game, $attempt, $query, $grade / 100, $answertext);
                $wrong++;
            } else {
                //correct answer
                game_update_queries($game, $attempt, $query, 1, $answertext);
                $correct++;
            }
        }
    }
    $hiddenpicture->correct += $correct;
    $hiddenpicture->wrong += $wrong;
    if (!update_record('game_hiddenpicture', $hiddenpicture)) {
        error('game_hiddenpicture_check_questions: error updating in game_hiddenpicture');
    }
    $attempt->score = game_hidden_picture_computescore($game, $hiddenpicture);
    if (!update_record('game_attempts', $attempt)) {
        error('game_hiddenpicture_check_questions: error updating in game_attempt');
    }
    game_sudoku_check_last($id, $game, $attempt, $hiddenpicture, $finishattempt);
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:53,代码来源:play.php


示例8: insert

 /**
  * In addition to perform parent::insert(), calls force_regrading() method too.
  * @param string $source from where was the object inserted (mod/forum, manual, etc.)
  * @return int PK ID if successful, false otherwise
  */
 function insert($source = null)
 {
     global $CFG;
     if (empty($this->courseid)) {
         error('Can not insert grade item without course id!');
     }
     // load scale if needed
     $this->load_scale();
     // add parent category if needed
     if (empty($this->categoryid) and !$this->is_course_item() and !$this->is_category_item()) {
         $course_category = grade_category::fetch_course_category($this->courseid);
         $this->categoryid = $course_category->id;
     }
     // always place the new items at the end, move them after insert if needed
     $last_sortorder = get_field_select('grade_items', 'MAX(sortorder)', "courseid = {$this->courseid}");
     if (!empty($last_sortorder)) {
         $this->sortorder = $last_sortorder + 1;
     } else {
         $this->sortorder = 1;
     }
     // add proper item numbers to manual items
     if ($this->itemtype == 'manual') {
         if (empty($this->itemnumber)) {
             $this->itemnumber = 0;
         }
     }
     // make sure there is not 0 in outcomeid
     if (empty($this->outcomeid)) {
         $this->outcomeid = null;
     }
     $this->timecreated = $this->timemodified = time();
     if (parent::insert($source)) {
         // force regrading of items if needed
         $this->force_regrading();
         return $this->id;
     } else {
         debugging("Could not insert this grade_item in the database!");
         return false;
     }
 }
开发者ID:r007,项目名称:PMoodle,代码行数:45,代码来源:grade_item.php


示例9: user_activity_task_process

/**
 * Process a chunk of the task
 *
 * @param array $state the task state
 */
function user_activity_task_process(&$state)
{
    global $CFG;
    $sessiontimeout = $state['sessiontimeout'];
    $sessiontail = $state['sessiontail'];
    $starttime = $state['starttime'];
    // find the record ID corresponding to our start time
    $startrec = get_field_select('log', 'MIN(id)', "time >= {$starttime}");
    $startrec = empty($startrec) ? 0 : $startrec;
    // find the last record that's close to our chunk size, without
    // splitting a second between runs
    $endtime = get_field_select('log', 'MIN(time)', 'id >= ' . ($startrec + USERACT_RECORD_CHUNK));
    if (!$endtime) {
        $endtime = time();
    }
    // Get the logs between the last time we ran, and the current time.  Sort
    // by userid (so all records for a given user are together), and then by
    // time (so that we process a user's logs sequentially).
    $recstarttime = max(0, $starttime - $state['sessiontimeout']);
    $rs = get_recordset_select('log', "time >= {$recstarttime} AND time < {$endtime} AND userid != 0", 'userid, time');
    if ($CFG->debug >= DEBUG_ALL) {
        mtrace("* processing records from time:{$starttime} to time:{$endtime}");
    }
    $curuser = -1;
    $session_start = 0;
    $last_course = -1;
    $module_session_start = 0;
    $last_module = -1;
    $last_time = 0;
    if ($rs) {
        while ($rec = rs_fetch_next_record($rs)) {
            if ($rec->userid != $curuser) {
                // end of user's record
                if ($curuser > 0 && $session_start > 0) {
                    // flush current session data
                    if ($last_time > $endtime - $sessiontimeout) {
                        /* Last record is within the session timeout of our end
                         * time for this run.  Just use our last logged time as
                         * the session end time, and the rest will be picked up
                         * by the next run of the sessionizer. */
                        $session_end = $last_time;
                    } else {
                        /* Last record is not within the session timeout of our
                         * end time for this run, so do our normal session
                         * ending. */
                        $session_end = $last_time + $sessiontail;
                    }
                    user_activity_add_session($curuser, $last_course, $session_start, $session_end);
                    if ($last_module > 0) {
                        user_module_activity_add_session($curuser, $last_course, $last_module, $module_session_start, $session_end);
                    }
                }
                $curuser = $rec->userid;
                $session_start = 0;
                $last_course = -1;
                $module_session_start = 0;
                $last_module = -1;
                $last_time = 0;
            }
            if ($rec->time < $starttime) {
                // Find the last log for the user before our start time, that's
                // within the session timeout, and start the session with that
                // record.
                $session_start = $rec->time;
                $last_time = $rec->time;
                $last_course = $rec->course;
                $module_session_start = $rec->time;
                $last_module = $rec->cmid;
            } elseif ($rec->time > $last_time + $sessiontimeout) {
                if ($last_course >= 0) {
                    // session timed out -- add record
                    if (defined('ETLUA_EXTRA_DEBUG') && $CFG->debug >= DEBUG_DEVELOPER) {
                        mtrace('** session timed out');
                    }
                    $session_end = $last_time + $sessiontail;
                    user_activity_add_session($curuser, $last_course, $session_start, $session_end);
                    if ($last_module > 0) {
                        user_module_activity_add_session($curuser, $last_course, $last_module, $module_session_start, $session_end);
                    }
                }
                // start a new session with the current record
                $session_start = $rec->time;
                $last_course = $rec->course;
                $module_session_start = $rec->time;
                $last_module = $rec->cmid;
            } elseif ($rec->action === 'logout') {
                // user logged out -- add record
                if (defined('ETLUA_EXTRA_DEBUG') && $CFG->debug >= DEBUG_DEVELOPER) {
                    mtrace('** user logged out');
                }
                $session_end = $rec->time;
                user_activity_add_session($curuser, $last_course, $session_start, $session_end);
                if ($last_module > 0) {
                    user_module_activity_add_session($curuser, $last_course, $last_module, $module_session_start, $session_end);
                }
//.........这里部分代码省略.........
开发者ID:remotelearner,项目名称:elis.cm,代码行数:101,代码来源:etl.php


示例10: test_get_field_select

 function test_get_field_select()
 {
     $this->assertEqual(get_field_select($this->table, 'numberfield', 'id = 1'), 101);
 }
开发者ID:r007,项目名称:PMoodle,代码行数:4,代码来源:testdmllib.php


示例11: tracker_submitanissue

/**
* submits an issue in the current tracker
* @uses $CFG
* @param int $trackerid the current tracker
*/
function tracker_submitanissue(&$tracker)
{
    global $CFG;
    $issue->datereported = required_param('datereported', PARAM_INT);
    $issue->summary = required_param('summary', PARAM_TEXT);
    $issue->description = addslashes(required_param('description', PARAM_CLEANHTML));
    $issue->format = addslashes(required_param('format', PARAM_CLEANHTML));
    $issue->assignedto = 0;
    $issue->bywhomid = 0;
    $issue->trackerid = $tracker->id;
    $issue->status = POSTED;
    $issue->reportedby = required_param('reportedby', PARAM_INT);
    // fetch max actual priority
    $maxpriority = get_field_select('tracker_issue', 'MAX(resolutionpriority)', " trackerid = {$tracker->id} GROUP BY trackerid ");
    $issue->resolutionpriority = $maxpriority + 1;
    $issue->id = insert_record('tracker_issue', $issue, true);
    if ($issue->id) {
        tracker_recordelements($issue);
        // if not CCed, the assignee should be
        tracker_register_cc($tracker, $issue, $issue->reportedby);
        return $issue;
    } else {
        error("Could not submit issue");
    }
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:30,代码来源:locallib.php


示例12: ouwiki_save_new_version


//.........这里部分代码省略.........
    if (!($versionid = insert_record('ouwiki_versions', $version))) {
        $tw->rollback();
        ouwiki_dberror();
    }
    // Update latest version
    if (!set_field('ouwiki_pages', 'currentversionid', $versionid, 'id', $pageversion->pageid)) {
        $tw->rollback();
        ouwiki_dberror();
    }
    // Analyse for links
    $wikilinks = array();
    $externallinks = array();
    // Wiki links: ordinary [[links]]
    $matches = array();
    preg_match_all(OUWIKI_LINKS_SQUAREBRACKETS, $content, $matches, PREG_PATTERN_ORDER);
    foreach ($matches[1] as $match) {
        // Convert to page name (this also removes HTML tags etc)
        $wikilinks[] = ouwiki_get_wiki_link_details($match)->page;
    }
    // Note that we used to support CamelCase links but have removed support because:
    // 1. Confusing: students type JavaScript or MySpace and don't expect it to become a link
    // 2. Not accessible: screenreaders cannot cope with run-together words, and
    //    dyslexic students can have difficulty reading them
    // External links
    preg_match_all('/<a [^>]*href=(?:(?:\'(.*?)\')|(?:"(.*?))")/', $content, $matches, PREG_PATTERN_ORDER);
    foreach ($matches[1] as $match) {
        if ($match) {
            $externallinks[] = html_entity_decode($match);
        }
    }
    foreach ($matches[2] as $match) {
        if ($match) {
            $externallinks[] = html_entity_decode($match);
        }
    }
    // Add link records
    $link = new StdClass();
    $link->fromversionid = $versionid;
    foreach ($wikilinks as $targetpage) {
        if (!empty($targetpage)) {
            $pagerecord = get_record_select('ouwiki_pages', "subwikiid='{$subwiki->id}' AND UPPER(title)=UPPER('" . addslashes($targetpage) . "')");
            if ($pagerecord) {
                $pageid = $pagerecord->id;
            } else {
                $pageid = false;
            }
        } else {
            $pageid = get_field_select('ouwiki_pages', 'id', "subwikiid={$subwiki->id} AND title IS NULL");
        }
        if ($pageid) {
            $link->topageid = $pageid;
            $link->tomissingpage = null;
        } else {
            $link->topageid = null;
            $link->tomissingpage = addslashes(strtoupper($targetpage));
        }
        if (!($link->id = insert_record('ouwiki_links', $link))) {
            $tw->rollback();
            ouwiki_dberror();
        }
    }
    $link->topageid = null;
    $link->tomissingpage = null;
    $tl = textlib_get_instance();
    foreach ($externallinks as $url) {
        // Restrict length of URL
        if ($tl->strlen($url) > 255) {
            $url = $tl->substr($url, 0, 255);
        }
        $link->tourl = addslashes($url);
        if (!($link->id = insert_record('ouwiki_links', $link))) {
            $tw->rollback();
            ouwiki_dberror();
        }
    }
    // Inform search, if installed
    if (ouwiki_search_installed()) {
        $doc = new ousearch_document();
        $doc->init_module_instance('ouwiki', $cm);
        if ($subwiki->groupid) {
            $doc->set_group_id($subwiki->groupid);
        }
        $doc->set_string_ref($pageversion->title === '' ? null : $pageversion->title);
        if ($subwiki->userid) {
            $doc->set_user_id($subwiki->userid);
        }
        $title = is_null($pageversion->title) ? '' : $pageversion->title;
        if (!$doc->update($title, $content)) {
            $tw->rollback();
            ouwiki_dberror();
        }
    }
    // Inform completion system, if available
    if (class_exists('ouflags')) {
        if (completion_is_enabled($course, $cm) && ($ouwiki->completionedits || $ouwiki->completionpages)) {
            completion_update_state($course, $cm, COMPLETION_COMPLETE);
        }
    }
    $tw->commit();
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:101,代码来源:ouwiki.php


示例13: increment_page_hits

 /**
  * Increment the hits of a page.
  *
  * @param   int     $wikiid
  * @param   string  $pagename
  * @param   int     $version
  * @param   int     $groupid
  * @param   int     $ownerid
  */
 function increment_page_hits($wikiid, $pagename, $version, $groupid, $ownerid)
 {
     $select = "dfwiki={$wikiid} AND pagename='" . addslashes($pagename) . "' AND version={$version}";
     if (isset($groupid)) {
         $select .= " AND groupid={$groupid}";
     }
     if (isset($ownerid)) {
         $select .= " AND ownerid={$ownerid}";
     }
     // return set_field_select('wiki_pages', 'hits', 'hits+1', $select);
     $hits = get_field_select('wiki_pages', 'hits', $select);
     return set_field_select('wiki_pages', 'hits', $hits + 1, $select);
 }
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:22,代码来源:wiki_persistor.php


示例14: game_snakes_check_questions

function game_snakes_check_questions($id, $game, $attempt, $snakes)
{
    global $QTYPES, $CFG;
    $responses = data_submitted();
    if ($responses->queryid != $snakes->queryid) {
        game_snakes_play($id, $game, $attempt, $snakes);
        return;
    }
    $questionlist = get_field('game_queries', 'questionid', 'id', $responses->queryid);
    $questions = game_sudoku_getquestions($questionlist);
    $actions = question_extract_responses($questions, $responses, QUESTION_EVENTSUBMIT);
    $correct = false;
    $query = '';
    foreach ($questions as $question) {
        if (!array_key_exists($question->id, $actions)) {
            //no answered
            continue;
        }
        unset($state);
        unset($cmoptions);
        $question->maxgrade = 100;
        $state->responses = $actions[$question->id]->responses;
        $state->event = QUESTION_EVENTGRADE;
        $state->responses[''] = game_upper($state->responses['']);
        $cmoptions = array();
        $QTYPES[$question->qtype]->grade_responses($question, $state, $cmoptions);
        unset($query);
        $select = "attemptid={$attempt->id} ";
        $select .= " AND questionid={$question->id}";
        if (($query->id = get_field_select('game_queries', 'id', $select)) == 0) {
            die("problem game_sudoku_check_questions (select={$select})");
            continue;
        }
        $grade = $state->raw_grade;
        if ($grade < 50) {
            //wrong answer
            game_update_queries($game, $attempt, $query, 0, '');
            continue;
        }
        //correct answer
        $correct = true;
        game_update_queries($game, $attempt, $query, 1, '');
    }
    //set the grade of the whole game
    game_snakes_position($id, $game, $attempt, $snakes, $correct, $query);
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:46,代码来源:play.php


示例15: scheduler_get_last_location

/**
* get the last considered location in this scheduler
* @param reference $scheduler
* @uses $USER
* @return the last known location for the current user (teacher)
*/
function scheduler_get_last_location(&$scheduler)
{
    global $USER;
    // we could have made an embedded query in Mysql 5.0
    $lastlocation = '';
    $maxtime = get_field_select('scheduler_slots', 'MAX(timemodified)', "schedulerid = {$scheduler->id} AND teacherid = {$USER->id} GROUP BY timemodified");
    if ($maxtime) {
        $maxid = get_field_select('scheduler_slots', 'MAX(timemodified)', "schedulerid = {$scheduler->id} AND timemodified = {$maxtime} AND teacherid = {$USER->id} GROUP BY timemodified");
        $lastlocation = get_field('scheduler_slots', 'appointmentlocation', 'id', $maxid);
    }
    return $lastlocation;
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:18,代码来源:locallib.php


示例16: get_string

    $element->optionlistview($cm);
    $caption = get_string('addanoption', 'tracker');
    print_heading($caption . helpbutton('options', get_string('description'), 'tracker', true, false, false, true));
    include "{$CFG->dirroot}/mod/tracker/classes/trackercategorytype/editoptionform.html";
    return -1;
}
/********************************** add an element to be used ***************************/
if ($action == 'addelement') {
    $elementid = required_param('elementid', PARAM_INT);
    if (!tracker_iselementused($tracker->id, $elementid)) {
        /// Add element to element used table;
        $used->elementid = $elementid;
        $used->trackerid = $tracker->id;
        $used->canbemodifiedby = $USER->id;
        /// get last sort order
        $sortorder = 0 + get_field_select('tracker_elementused', 'MAX(sortorder)', "trackerid = {$tracker->id} GROUP BY trackerid");
        $used->sortorder = $sortorder + 1;
        if (!insert_record('tracker_elementused', $used)) {
            error("Cannot add element to list of elements to use for this tracker");
        }
    } else {
        //Feedback message that element is already in uses
        error('Element already in use', "view.php?id={$cm->id}&amp;what=manageelements");
    }
}
/****************************** remove an element from usable list **********************/
if ($action == 'removeelement') {
    $usedid = required_param('usedid', PARAM_INT);
    if (!delete_records('tracker_elementused', 'elementid', $usedid, 'trackerid', $tracker->id)) {
        error("Cannot delete element from list of elements to use for this tracker");
    }
开发者ID:nadavkav,项目名称:MoodleTAO,代码行数:31,代码来源:admin.controller.php


示例17: game_recode_questioncategoryid

function game_recode_questioncategoryid(&$game, $map_question_categories)
{
    $stamp = $map_question_categories[$game->questioncategoryid];
    $game->questioncategoryid = get_field_select('question_categories', 'id', "stamp='{$stamp}'");
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:5,代码来源:restorelib.php


示例18: required_param

        }
        // discard empty field names
        $valuevalue = required_param("item_value{$keyid}", PARAM_CLEANHTML);
        $multiple->{$keyvalue} = $valuevalue;
    }
    if (isset($multiple)) {
        $maprecord->brainstormid = $brainstorm->id;
        $maprecord->userid = $USER->id;
        $maprecord->groupid = $currentgroup;
        $maprecord->operatorid = 'map';
        $maprecord->itemsource = $form->itemsource;
        $maprecord->itemdest = $form->itemdest;
        $maprecord->blobvalue = serialize($multiple);
        $maprecord->timemodified = time();
        $select = "\r\n            brainstormid = {$brainstorm->id} AND\r\n            userid = {$USER->id} AND\r\n            itemsource = {$maprecord->itemsource} AND\r\n            itemdest = {$maprecord->itemdest}\r\n        ";
        if ($oldid = get_field_select('brainstorm_operatordata', 'id', $select)) {
            $maprecord->id = $oldid;
            if (!update_record('brainstorm_operatordata', $maprecord)) {
                error("Could not update map record");
            }
        } else {
            if (!insert_record('brainstorm_operatordata', $maprecord)) {
                error("Could not insert map record");
            }
        }
    }
}
if ($action == 'deletemultiple') {
    $form->itemsource = required_param('source', PARAM_INT);
    $form->itemdest = required_param('dest', PARAM_INT);
    $select = "\r\n        brainstormid = {$brainstorm->id} AND\r\n        userid = {$USER->id} AND\r\n        itemsource = {$form->itemsource} AND\r\n        itemdest = {$form->itemdest}\r\n    ";
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:31,代码来源:organize.controller.php


示例19: xmldb_block_exabis_eportfolio_upgrade

function xmldb_block_exabis_eportfolio_upgrade($oldversion = 0, $tmp)
{
    global $CFG, $db;
    $result = true;
    //     if (empty($db)) {
    //         return false;
    //     }
    if ($oldversion < 2008090100 && !empty($db)) {
        // old tables
        $tables = array('block_exabeporpers', 'block_exabeporexte', 'block_exabeporcate', 'block_exabeporbooklink', 'block_exabeporcommlink', 'block_exabeporsharlink', 'block_exabeporbookfile', 'block_exabeporcommfile', 'block_exabeporsharfile', 'block_exabepornote', 'block_exabeporcommnote', 'block_exabeporsharnote');
        $tableNames = array();
        // rename tables to old_*
        foreach ($tables as $table) {
            $tableNames[$table] = 'old_' . $oldversion . '_' . $table;
            $xmltable = new XMLDBTable($table);
            rename_table($xmltable, $tableNames[$table]);
        }
        // add new tables
        install_from_xmldb_file(dirname(__FILE__) . '/install.xml');
        // import data from old tables
        $insert_type = 'REPLACE';
        $db->Execute($insert_type . ' INTO ' . $CFG->prefix . 'block_exabeporuser (id, user_id, persinfo_timemodified, description, user_hash)' . ' SELECT u.id, u.userid, u.timemodified, u.description, e.user_hash FROM ' . $CFG->prefix . $tableNames['block_exabeporpers'] . ' AS u LEFT JOIN ' . $CFG->prefix . $tableNames['block_exabeporexte'] . ' AS e ON u.userid = e.user_id');
        $db->Execute($insert_type . ' INTO ' . $CFG->prefix . 'block_exabeporcate (id, pid, userid, name, timemodified, courseid)' . ' SELECT id, pid, userid, name, timemodified, course FROM ' . $CFG->prefix . $tableNames['block_exabeporcate']);
        $file_id_start = 0;
        $note_id_start = get_field_select($tableNames['block_exabepornote'], 'MAX(id)', null) + 100;
        $link_id_start = get_field_select($tableNames['block_exabeporbooklink'], 'MAX(id)', null) + $note_id_start + 100;
        // combine item table
        $db->Execute($insert_type . ' INTO ' . $CFG->prefix . 'block_exabeporitem' . ' (id, userid, type, categoryid, name, url, intro, attachment, timemodified, courseid, shareall, externaccess, externcomment)' . ' SELECT id+' . $file_id_start . ', userid, "file", category, name, url, intro, attachment, timemodified, course, shareall, externaccess, externcomment' . ' FROM ' . $CFG->prefix . $tableNames['block_exabeporbookfile']);
        $db->Execute($insert_type . ' INTO ' . $CFG->prefix . 'block_exabeporitem' . ' (id, userid, type, categoryid, name, url, intro, attachment, timemodified, courseid, shareall, externaccess, externcomment)' . ' SELECT id+' . $note_id_start . ', userid, "note", category, name, url, intro, attachment, timemodified, course, shareall, externaccess, externcomment' . ' FROM ' . $CFG->prefix . $tableNames['block_exabepornote']);
        $db->Execute($insert_type . ' INTO ' . $CFG->prefix . 'block_exabeporitem' . ' (id, userid, type, categoryid, name, url, intro, attachment, timemodified, courseid, shareall, externaccess, externcomment)' . ' SELECT id+' . $link_id_start . ', userid, "link", category, name, url, intro, attachment, timemodified, course, shareall, externaccess, externcomment' . ' FROM ' . $CFG->prefix . $tableNames['block_exabeporbooklink']);
        // combine comment table
        $db->Execute($insert_type . ' INTO ' . $CFG->prefix . 'block_exabeporitemcomm' . ' (id, itemid, userid, entry, timemodified)' . ' SELECT id, bookmarkid+' . $file_id_start . ', userid, entry, timemodified' . ' FROM ' . $CFG->prefix . $tableNames['block_exabeporcommfile']);
        $db->Execute($insert_type . ' INTO ' . $CFG->prefix . 'block_exabeporitemcomm' . ' (id, itemid, userid, entry, timemodified)' . ' SELECT id, bookmarkid+' . $note_id_start . ', userid, entry, timemodified' . ' FROM ' . $CFG->prefix . $tableNames['block_exabeporcommnote']);
        $db->Execute($insert_type . ' INTO ' . $CFG->prefix . 'block_exabeporitemcomm' . ' (id, itemid, userid, entry, timemodified)' . ' SELECT id, bookmarkid+' . $link_id_start . ', userid, entry, timemodified' . ' FROM ' . $CFG->prefix . $tableNames['block_exabeporcommlink']);
        // combine share table
        $ret = $db->Execute($insert_type . ' INTO ' . $CFG->prefix . 'block_exabeporitemshar' . ' (id, itemid, userid, original, courseid)' . ' SELECT id, bookid+' . $file_id_start . ', userid, original, course' . ' FROM ' . $CFG->prefix . $tableNames['block_exabeporsharfile']);
        $db->Execute($insert_type . ' INTO ' . $CFG->prefix . 'block_exabeporitemshar' . ' (id, itemid, userid, original, courseid)' . ' SELECT id, bookid+' . $note_id_start . ', userid, original, course' . ' FROM ' . $CFG->prefix . $tableNames['block_exabeporsharnote']);
        $db->Execute($insert_type . ' INTO ' . $CFG->prefix . 'block_exabeporitemshar' . ' (id, itemid, userid, original, courseid)' . ' SELECT id, bookid+' . $link_id_start . ', userid, original, course' . ' FROM ' . $CFG->prefix . $tableNames['block_exabeporsharlink']);
        $result = true;
    }
    if ($result && $oldversion < 2009010104) {
        // Add THEME support (nadavkav)
        //$result = execute_sql("ALTER TABLE `{$CFG->prefix}_block_exabeporview` ADD `theme` TEXT NULL DEFAULT NULL AFTER `description`");
        $table = new XMLDBTable('block_exabeporview');
        /// Adding fields to table block_exabeporview
        //$table->addFieldInfo('theme', XMLDB_TYPE_TEXT, 'medium', null, XMLDB_NOTNULL, null, null, null, null);
        $field = new XMLDBField('theme');
        $field->setAttributes(XMLDB_TYPE_CHAR, '25', null, null, null, null, null, null, 'description');
        /// Launch update table for block_exabeporview
        $result = $result && add_field($table, $field);
    }
    if ($result && $oldversion < 2009010105) {
        // Add THEME support (nadavkav)
        //$result = execute_sql("ALTER TABLE `{$CFG->prefix}_block_exabeporuser` ADD `emailnotification` TEXT NULL DEFAULT NULL AFTER `description`");
        $table = new XMLDBTable('block_exabeporuser');
        /// Adding fields to table block_exabeporview
        //$table->addFieldInfo('theme', XMLDB_TYPE_TEXT, 'medium', null, XMLDB_NOTNULL, null, null, null, null);
        $field = new XMLDBField('emailnotification');
        $field->setAttributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, null, null, null, null, null, 'user_hash');
        /// Launch update table for block_exabeporview
        $result = $result && add_field($table, $field);
    }
    return $result;
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:64,代码来源:upgrade.php


示例20: get_records_sql


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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