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

PHP get_record_select函数代码示例

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

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



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

示例1: game_cryptex_check

function game_cryptex_check($id, $game, $attempt, $cryptexrec, $q, $answer)
{
    if ($attempt === false) {
        game_cryptex_continue($id, $game, $attempt, $cryptexrec);
        return;
    }
    $crossm = get_record_select('game_cross', "id={$attempt->id}");
    $query = get_record_select('game_queries', "id={$q}");
    $answer1 = trim(game_upper($query->answertext));
    $answer2 = trim(game_upper($answer));
    $textlib = textlib_get_instance();
    $len1 = $textlib->strlen($answer1);
    $len2 = $textlib->strlen($answer2);
    $equal = $len1 == $len2;
    if ($equal) {
        for ($i = 0; $i < $len1; $i++) {
            if ($textlib->substr($answer1, $i, 1) != $textlib->substr($answer2, $i, 1)) {
                $equal = true;
                break;
            }
        }
    }
    if ($equal == false) {
        game_update_queries($game, $attempt, $query, 0, $answer2);
        game_cryptex_play($id, $game, $attempt, $cryptexrec, $crossm, true);
        return;
    }
    game_update_queries($game, $attempt, $query, 1, $answer2);
    game_cryptex_play($id, $game, $attempt, $cryptexrec, $crossm, true);
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:30,代码来源:play.php


示例2: get_instance_title

 /**
  * Optional method. If exists, allows this class to decide the title for
  * all blockinstances of this type
  */
 public static function get_instance_title(BlockInstance $bi)
 {
     $configdata = $bi->get('configdata');
     if (!empty($configdata['collection'])) {
         require_once 'collection.php';
         $data = get_record_select('collection', 'id = ?', array($configdata['collection']));
         $collection = new Collection($configdata['collection'], (array) $data);
         $title = $collection->get('name');
         return $title;
     }
     return '';
 }
开发者ID:richardmansfield,项目名称:richardms-mahara,代码行数:16,代码来源:lib.php


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


示例4: tracker_rpc_check

/**
* checks an user has local identity and comes from a known host
* @param string $username the user's login
* @param string $remotehostroot the host he comes from
* @return a failure report if unchecked, null elsewhere.
*
*/
function tracker_rpc_check($username, $remotehostroot, &$localuser)
{
    // get local identity for user
    if (!($remotehost = get_record('mnet_host', 'wwwroot', $remotehostroot))) {
        $response->status = RPC_FAILURE;
        $response->error = "Calling host is not registered. Check MNET configuration";
        return json_encode($response);
    }
    if (!($localuser = get_record_select('user', "username = '" . addslashes($username) . "' AND mnethostid = {$remotehost->id} AND deleted = 0"))) {
        $response->status = RPC_FAILURE_USER;
        $response->error = "Calling user has no local account. Register remote user first";
        return json_encode($response);
    }
    return null;
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:22,代码来源:rpclib.php


示例5: ondeleteattempt

function ondeleteattempt($cm, $return, $attemptid, $update, $sesskey)
{
    global $CFG;
    $attempt = get_record_select('game_attempts', 'id=' . $attemptid);
    $game = get_record_select('game', 'id=' . $attempt->gameid);
    switch ($game->gamekind) {
        case 'bookquiz':
            delete_records('game_bookquiz_chapters', 'attemptid', $attemptid);
            break;
    }
    delete_records('game_queries', 'attemptid', $attemptid);
    delete_records('game_attempts', 'id', $attemptid);
    $url = $CFG->wwwroot . "/course/mod.php?update={$update}";
    $url .= "&return=true";
    $url .= "&sesskey={$sesskey}";
    redirect($url);
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:17,代码来源:updategame.php


示例6: notrude_form

/**
 * Returns a form to mark a view as unobjectionable,
 * if the user is allowed to do that.
 *
 * @returns array Form elements.
 */
function notrude_form()
{
    global $USER, $view, $artefact;
    $owner = $view->get('owner');
    if (!($owner && ($USER->get('admin') || $USER->is_admin_for_user($owner)) || $view->get('group') && $USER->get('admin') || $view->get('group') && group_user_access($view->get('group'), $USER->get('id')) == 'admin')) {
        return;
    }
    if ($artefact) {
        $params = array('artefact', $artefact->get('id'));
    } else {
        $params = array('view', $view->get('id'));
    }
    $isrude = get_record_select('objectionable', 'objecttype = ? AND objectid = ? AND resolvedby IS NULL LIMIT 1', $params);
    if (!$isrude) {
        return;
    }
    return array('name' => 'notrude_form', 'class' => 'form-inline', 'method' => 'post', 'elements' => array('objection' => array('type' => 'hidden', 'value' => $isrude->id), 'text' => array('type' => 'html', 'class' => 'pbm', 'value' => get_string('viewobjectionableunmark', 'view')), 'submit' => array('type' => 'button', 'usebuttontag' => true, 'class' => 'btn-default', 'value' => '<span class="icon icon-lg icon-times text-danger prs"></span> ' . get_string('notobjectionable'))));
}
开发者ID:rboyatt,项目名称:mahara,代码行数:24,代码来源:objectionable.php


示例7: notrude_form

/**
 * Returns a form to mark a view as unobjectionable,
 * if the user is allowed to do that.
 *
 * @returns array Form elements.
 */
function notrude_form()
{
    global $USER, $view, $artefact;
    $owner = $view->get('owner');
    if (!($owner && ($USER->get('admin') || $USER->is_admin_for_user($owner)) || $view->get('group') && $USER->get('admin'))) {
        return;
    }
    if ($artefact) {
        $params = array('artefact', $artefact->get('id'));
    } else {
        $params = array('view', $view->get('id'));
    }
    $isrude = get_record_select('objectionable', 'objecttype = ? AND objectid = ? AND resolvedby IS NULL LIMIT 1', $params);
    if (!$isrude) {
        return;
    }
    return array('name' => 'notrude_form', 'method' => 'post', 'elements' => array('objection' => array('type' => 'hidden', 'value' => $isrude->id), 'text' => array('type' => 'html', 'value' => get_string('viewobjectionableunmark', 'view')), 'submit' => array('type' => 'submit', 'value' => get_string('notobjectionable'))));
}
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:24,代码来源:objectionable.php


示例8: print_classhour_delete_form

function print_classhour_delete_form($courseid, $sesskey, $timetableid, $validhour, $i, $group, $weekend)
{
    $selectclause = "starthour='" . $validhour->starthour . "' AND endhour='" . $validhour->endhour . "' AND weekday='" . $i . "' AND groupid = " . $group->id . "";
    $c = get_record_select('timetable_hourtable', $selectclause);
    // or die(mysql_error());
    $classroom = get_record('timetable_classroom', 'id', $c->classroomid);
    global $USER;
    echo '<form action = "../controller/ttcontroller.php?viewrequired=editinghourtable" method = "POST">';
    echo '<input type="hidden" name="sesskey" value="' . $USER->sesskey . '" >';
    echo '<input type="hidden" name="courseid" value="' . $courseid . '" >';
    echo '<input type="hidden" name="timetableid" value="' . $timetableid . '" >';
    echo '<input type="hidden" name="groupid" value="' . $group->id . '" >';
    echo '<input type="hidden" name="actionparam" value="action" >';
    echo '<input type="hidden" name="actiontype" value="edithourtable" >';
    echo '<input type="hidden" name="actionedithourtable" value="delete" >';
    echo '<input type="hidden" name="starthour" value="' . $validhour->starthour . '" >';
    echo '<input type="hidden" name="endhour" value="' . $validhour->endhour . '" >';
    echo '<input type="hidden" name="weekday" value="' . $i . '" >';
    echo '<input type="hidden" name="classroomid" value="' . $c->classroomid . '" >';
    echo '<FONT';
    if ($classroom->capacity < $group->studentsnumber || $weekend) {
        $title = '';
        if ($weekend) {
            $title = $title . get_string('classhouraddedinweekendday', 'block_timetable');
        }
        if ($classroom->capacity < $group->studentsnumber) {
            if ($title != '') {
                $title = $title . ' and ';
            }
            $title = $title . get_string('expectedstudentsnumberlessthancapacity', 'block_timetable');
        }
        echo ' COLOR="BLUE" title="' . $title . '">';
    } else {
        echo '>';
    }
    echo '<font size="-2">' . $classroom->name . '</font><BR>';
    echo '</FONT>';
    echo '<input type="image" name="boton" src="../icons/action_stop.gif" width="16" height="16" title="' . get_string('deleteclassroom', 'block_timetable') . '" >';
    echo '</form>';
}
开发者ID:jmtalarn,项目名称:moodle-timetable-block,代码行数:40,代码来源:lib.php


示例9: mnet_generate_keypair

/**
 * Generate public/private keys and store in the config table
 *
 * Use the distinguished name provided to create a CSR, and then sign that CSR
 * with the same credentials. Store the keypair you create in the config table.
 * If a distinguished name is not provided, create one using the fullname of
 * 'the course with ID 1' as your organization name, and your hostname (as
 * detailed in $CFG->wwwroot).
 *
 * @param   array  $dn  The distinguished name of the server
 * @return  string      The signature over that text
 */
function mnet_generate_keypair($dn = null, $days = 28)
{
    global $CFG, $USER;
    // check if lifetime has been overriden
    if (!empty($CFG->mnetkeylifetime)) {
        $days = $CFG->mnetkeylifetime;
    }
    $host = strtolower($CFG->wwwroot);
    $host = ereg_replace("^http(s)?://", '', $host);
    $break = strpos($host . '/', '/');
    $host = substr($host, 0, $break);
    if ($result = get_record_select('course', " id ='" . SITEID . "' ")) {
        $organization = $result->fullname;
    } else {
        $organization = 'None';
    }
    $keypair = array();
    $country = 'NZ';
    $province = 'Wellington';
    $locality = 'Wellington';
    $email = $CFG->noreplyaddress;
    if (!empty($USER->country)) {
        $country = $USER->country;
    }
    if (!empty($USER->city)) {
        $province = $USER->city;
        $locality = $USER->city;
    }
    if (!empty($USER->email)) {
        $email = $USER->email;
    }
    if (is_null($dn)) {
        $dn = array("countryName" => $country, "stateOrProvinceName" => $province, "localityName" => $locality, "organizationName" => $organization, "organizationalUnitName" => 'Moodle', "commonName" => $CFG->wwwroot, "emailAddress" => $email);
    }
    $dnlimits = array('countryName' => 2, 'stateOrProvinceName' => 128, 'localityName' => 128, 'organizationName' => 64, 'organizationalUnitName' => 64, 'commonName' => 64, 'emailAddress' => 128);
    foreach ($dnlimits as $key => $length) {
        $dn[$key] = substr($dn[$key], 0, $length);
    }
    // ensure we remove trailing slashes
    $dn["commonName"] = preg_replace(':/$:', '', $dn["commonName"]);
    if (!empty($CFG->opensslcnf)) {
        //allow specification of openssl.cnf especially for Windows installs
        $new_key = openssl_pkey_new(array("config" => $CFG->opensslcnf));
        $csr_rsc = openssl_csr_new($dn, $new_key, array("config" => $CFG->opensslcnf));
        $selfSignedCert = openssl_csr_sign($csr_rsc, null, $new_key, $days, array("config" => $CFG->opensslcnf));
    } else {
        $new_key = openssl_pkey_new();
        $csr_rsc = openssl_csr_new($dn, $new_key, array('private_key_bits', 2048));
        $selfSignedCert = openssl_csr_sign($csr_rsc, null, $new_key, $days);
    }
    unset($csr_rsc);
    // Free up the resource
    // We export our self-signed certificate to a string.
    openssl_x509_export($selfSignedCert, $keypair['certificate']);
    openssl_x509_free($selfSignedCert);
    // Export your public/private key pair as a PEM encoded string. You
    // can protect it with an optional passphrase if you wish.
    if (!empty($CFG->opensslcnf)) {
        //allow specification of openssl.cnf especially for Windows installs
        $export = openssl_pkey_export($new_key, $keypair['keypair_PEM'], null, array("config" => $CFG->opensslcnf));
    } else {
        $export = openssl_pkey_export($new_key, $keypair['keypair_PEM']);
    }
    openssl_pkey_free($new_key);
    unset($new_key);
    // Free up the resource
    return $keypair;
}
开发者ID:JackCanada,项目名称:moodle-hacks,代码行数:80,代码来源:lib.php


示例10: update_user_record

 /**
  * will update a local user record from an external source.
  * is a lighter version of the one in moodlelib -- won't do
  * expensive ops such as enrolment
  *
  * If you don't pass $updatekeys, there is a performance hit and
  * values removed from DB won't be removed from moodle.
  *
  * @param string $username username (with system magic quotes)
  */
 function update_user_record($username, $updatekeys = false)
 {
     global $CFG;
     //just in case check text case
     $username = trim(moodle_strtolower($username));
     // get the current user record
     $user = get_record('user', 'username', $username, 'mnethostid', $CFG->mnet_localhost_id);
     if (empty($user)) {
         // trouble
         error_log("Cannot update non-existent user: {$username}");
         print_error('auth_dbusernotexist', 'auth', $username);
         die;
     }
     // Ensure userid is not overwritten
     $userid = $user->id;
     if ($newinfo = $this->get_userinfo($username)) {
         $newinfo = truncate_userinfo($newinfo);
         if (empty($updatekeys)) {
             // all keys? this does not support removing values
             $updatekeys = array_keys($newinfo);
         }
         foreach ($updatekeys as $key) {
             if (isset($newinfo[$key])) {
                 $value = $newinfo[$key];
             } else {
                 $value = '';
             }
             if (!empty($this->config->{'field_updatelocal_' . $key})) {
                 if ($user->{$key} != $value) {
                     // only update if it's changed
                     set_field('user', $key, addslashes($value), 'id', $userid);
                 }
             }
         }
     }
     return get_record_select('user', "id = {$userid} AND deleted = 0");
 }
开发者ID:BackupTheBerlios,项目名称:samouk-svn,代码行数:47,代码来源:auth.php


示例11: print_box_end

<?php 
            print_box_end();
            print_footer('empty');
            exit;
        }
    }
}
if (!empty($quiz->delay1) or !empty($quiz->delay2)) {
    //quiz enforced time delay
    if ($attempts = quiz_get_user_attempts($quiz->id, $USER->id)) {
        $numattempts = count($attempts);
    } else {
        $numattempts = 0;
    }
    $timenow = time();
    $lastattempt_obj = get_record_select('quiz_attempts', "quiz = {$quiz->id} AND attempt = {$numattempts} AND userid = {$USER->id}", 'timefinish, timestart');
    if ($lastattempt_obj) {
        $lastattempt = $lastattempt_obj->timefinish;
        if ($quiz->timelimit > 0) {
            $lastattempt = min($lastattempt, $lastattempt_obj->timestart + $quiz->timelimit * 60);
        }
    }
    if ($numattempts == 1 && !empty($quiz->delay1)) {
        if ($timenow - $quiz->delay1 < $lastattempt) {
            print_error('timedelay', 'quiz', 'view.php?q=' . $quiz->id);
        }
    } else {
        if ($numattempts > 1 && !empty($quiz->delay2)) {
            if ($timenow - $quiz->delay2 < $lastattempt) {
                print_error('timedelay', 'quiz', 'view.php?q=' . $quiz->id);
            }
开发者ID:edwinphillips,项目名称:moodle-485cb39,代码行数:31,代码来源:attempt.php


示例12: get_friend_request

/**
 * has there been a request between these two users?
 *
 * @param int $userid1
 * @param int $userid2
 */
function get_friend_request($userid1, $userid2)
{
    return get_record_select('usr_friend_request', '("owner" = ? AND requester = ?) OR (requester = ? AND "owner" = ?)', array($userid1, $userid2, $userid1, $userid2));
}
开发者ID:richardmansfield,项目名称:richardms-mahara,代码行数:10,代码来源:user.php


示例13: restore_create_events

function restore_create_events($restore, $xml_file)
{
    global $CFG, $db;
    $status = true;
    //Check it exists
    if (!file_exists($xml_file)) {
        $status = false;
    }
    //Get info from xml
    if ($status) {
        //events will contain the old_id of every event
        //in backup_ids->info will be the real info (serialized)
        $events = restore_read_xml_events($restore, $xml_file);
    }
    //Get admin->id for later use
    $admin = get_admin();
    $adminid = $admin->id;
    //Now, if we have anything in events, we have to restore that
    //events
    if ($events) {
        if ($events !== true) {
            //Iterate over each event
            foreach ($events as $event) {
                //Get record from backup_ids
                $data = backup_getid($restore->backup_unique_code, "event", $event->id);
                //Init variables
                $create_event = false;
                if ($data) {
                    //Now get completed xmlized object
                    $info = $data->info;
                    //traverse_xmlize($info);                                                                     //Debug
                    //print_object ($GLOBALS['traverse_array']);                                                  //Debug
                    //$GLOBALS['traverse_array']="";                                                              //Debug
                    //if necessary, write to restorelog and adjust date/time fields
                    if ($restore->course_startdateoffset) {
                        restore_log_date_changes('Events', $restore, $info['EVENT']['#'], array('TIMESTART'));
                    }
                    //Now build the EVENT record structure
                    $eve->name = backup_todb($info['EVENT']['#']['NAME']['0']['#']);
                    $eve->description = backup_todb($info['EVENT']['#']['DESCRIPTION']['0']['#']);
                    $eve->format = backup_todb($info['EVENT']['#']['FORMAT']['0']['#']);
                    $eve->courseid = $restore->course_id;
                    $eve->groupid = backup_todb($info['EVENT']['#']['GROUPID']['0']['#']);
                    $eve->userid = backup_todb($info['EVENT']['#']['USERID']['0']['#']);
                    $eve->repeatid = backup_todb($info['EVENT']['#']['REPEATID']['0']['#']);
                    $eve->modulename = "";
                    if (!empty($info['EVENT']['#']['MODULENAME'])) {
                        $eve->modulename = backup_todb($info['EVENT']['#']['MODULENAME']['0']['#']);
                    }
                    $eve->instance = 0;
                    $eve->eventtype = backup_todb($info['EVENT']['#']['EVENTTYPE']['0']['#']);
                    $eve->timestart = backup_todb($info['EVENT']['#']['TIMESTART']['0']['#']);
                    $eve->timeduration = backup_todb($info['EVENT']['#']['TIMEDURATION']['0']['#']);
                    $eve->visible = backup_todb($info['EVENT']['#']['VISIBLE']['0']['#']);
                    $eve->timemodified = backup_todb($info['EVENT']['#']['TIMEMODIFIED']['0']['#']);
                    //Now search if that event exists (by name, description, timestart fields) in
                    //restore->course_id course
                    //Going to compare LOB columns so, use the cross-db sql_compare_text() in both sides.
                    $compare_description_clause = sql_compare_text('description') . "=" . sql_compare_text("'" . $eve->description . "'");
                    $eve_db = get_record_select("event", "courseid={$eve->courseid} AND name='{$eve->name}' AND {$compare_description_clause} AND timestart={$eve->timestart}");
                    //If it doesn't exist, create
                    if (!$eve_db) {
                        $create_event = true;
                    }
                    //If we must create the event
                    if ($create_event) {
                        //We must recode the userid
                        $user = backup_getid($restore->backup_unique_code, "user", $eve->userid);
                        if ($user) {
                            $eve->userid = $user->new_id;
                        } else {
                            //Assign it to admin
                            $eve->userid = $adminid;
                        }
                        //We have to recode the groupid field
                        $group = backup_getid($restore->backup_unique_code, "groups", $eve->groupid);
                        if ($group) {
                            $eve->groupid = $group->new_id;
                        } else {
                            //Assign it to group 0
                            $eve->groupid = 0;
                        }
                        //The structure is equal to the db, so insert the event
                        $newid = insert_record("event", $eve);
                        //We must recode the repeatid if the event has it
                        //The repeatid now refers to the id of the original event. (see Bug#5956)
                        if ($newid && !empty($eve->repeatid)) {
                            $repeat_rec = backup_getid($restore->backup_unique_code, "event_repeatid", $eve->repeatid);
                            if ($repeat_rec) {
                                //Exists, so use it...
                                $eve->repeatid = $repeat_rec->new_id;
                            } else {
                                //Doesn't exists, calculate the next and save it
                                $oldrepeatid = $eve->repeatid;
                                $eve->repeatid = $newid;
                                backup_putid($restore->backup_unique_code, "event_repeatid", $oldrepeatid, $eve->repeatid);
                            }
                            $eve->id = $newid;
                            // update the record to contain the correct repeatid
                            update_record('event', $eve);
//.........这里部分代码省略.........
开发者ID:kai707,项目名称:ITSA-backup,代码行数:101,代码来源:restorelib.php


示例14: feedback_delete_completed

/** 
 *  deletes a completed given by completedid.
 *  all related data such values or tracking data also will be deleted
 *  @param int $completedid
 *  @return boolean
 */
function feedback_delete_completed($completedid)
{
    if (!($completed = get_record('feedback_completed', 'id', $completedid))) {
        return false;
    }
    //first we delete all related values
    @delete_records('feedback_value', 'completed', $completed->id);
    //now we delete all tracking data
    if ($tracking = get_record_select('feedback_tracking', " completed = " . $completed->id . " AND feedback = " . $completed->feedback . " ")) {
        @delete_records('feedback_tracking', 'completed', $completed->id);
    }
    //last we delete the completed-record
    return delete_records('feedback_completed', 'id', $completed->id);
}
开发者ID:nadavkav,项目名称:MoodleTAO,代码行数:20,代码来源:lib.php


示例15: moodle_process_email

function moodle_process_email($modargs, $body)
{
    // the first char should be an unencoded letter. We'll take this as an action
    switch ($modargs[0]) {
        case 'B':
            // bounce
            list(, $userid) = unpack('V', base64_decode(substr($modargs, 1, 8)));
            if ($user = get_record_select("user", "id={$userid}", "id,email")) {
                // check the half md5 of their email
                $md5check = substr(md5($user->email), 0, 16);
                if ($md5check == substr($modargs, -16)) {
                    set_bounce_count($user);
                }
                // else maybe they've already changed it?
            }
            break;
            // maybe more later?
    }
}
开发者ID:nadavkav,项目名称:rtlMoodle,代码行数:19,代码来源:moodlelib.php


示例16: get_invisible_token

 /**
  * Retrieve the invisible key for this view, if there is one. (A view can only have one
  * invisible key, because it can only be submitted to one place at a time.)
  * @param int $viewid
  * @return mixed Returns a boolean FALSE if there is no invisible token, a data object if there is one
  */
 public static function get_invisible_token($viewid)
 {
     return get_record_select('view_access', 'view = ? AND token IS NOT NULL AND visible = 0', array($viewid), 'view, visible, token, ctime');
 }
开发者ID:sarahjcotton,项目名称:mahara,代码行数:10,代码来源:view.php


示例17: activity_locate_typerecord

function activity_locate_typerecord($activitytype, $plugintype = null, $pluginname = null)
{
    if (is_object($activitytype)) {
        return $activitytype;
    }
    if (is_numeric($activitytype)) {
        $at = get_record('activity_type', 'id', $activitytype);
    } else {
        if (empty($plugintype) && empty($pluginname)) {
            $at = get_record_select('activity_type', 'name = ? AND plugintype IS NULL AND pluginname IS NULL', array($activitytype));
        } else {
            $at = get_record('activity_type', 'name', $activitytype, 'plugintype', $plugintype, 'pluginname', $pluginname);
        }
    }
    if (empty($at)) {
        throw new SystemException("Invalid activity type {$activitytype}");
    }
    return $at;
}
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:19,代码来源:activity.php


示例18: importprocess

 function importprocess($filename, $lesson, $pageid)
 {
     /// Processes a given file.  There's probably little need to change this
     $timenow = time();
     if (!($lines = $this->readdata($filename))) {
         notify("File could not be read, or was empty");
         return false;
     }
     if (!($questions = $this->readquestions($lines))) {
         // Extract all the questions
         notify("There are no questions in this file!");
         return false;
     }
     notify(get_string('importcount', 'lesson', sizeof($questions)));
     $count = 0;
     foreach ($questions as $question) {
         // Process and store each question
         switch ($question->qtype) {
             // the good ones
             case SHORTANSWER:
             case NUMERICAL:
             case TRUEFALSE:
             case MULTICHOICE:
             case MATCH:
                 $count++;
                 echo "<hr><p><b>{$count}</b>. " . stripslashes($question->questiontext) . "</p>";
                 $newpage = new stdClass();
                 $newpage->lessonid = $lesson->id;
                 $newpage->qtype = $this->qtypeconvert[$question->qtype];
                 switch ($question->qtype) {
                     case SHORTANSWER:
                         if (isset($question->usecase)) {
                             $newpage->qoption = $question->usecase;
                         }
                         break;
                     case MULTICHOICE:
                         if (isset($question->single)) {
                             $newpage->qoption = !$question->single;
                         }
                         break;
                 }
                 $newpage->timecreated = $timenow;
                 if ($question->name != $question->questiontext) {
                     $newpage->title = $question->name;
                 } else {
                     $newpage->title = "Page {$count}";
                 }
                 $newpage->contents = $question->questiontext;
                 // set up page links
                 if ($pageid) {
                     // the new page follows on from this page
                     if (!($page = get_record("lesson_pages", "id", $pageid))) {
                         error("Format: Page {$pageid} not found");
                     }
                     $newpage->prevpageid = $pageid;
                     $newpage->nextpageid = $page->nextpageid;
                     // insert the page and reset $pageid
                     if (!($newpageid = insert_record("lesson_pages", $newpage))) {
                         error("Format: Could not insert new page!");
                     }
                     // update the linked list
                     if (!set_field("lesson_pages", "nextpageid", $newpageid, "id", $pageid)) {
                         error("Format: unable to update link");
                     }
                 } else {
                     // new page is the first page
                     // get the existing (first) page (if any)
                     if (!($page = get_record_select("lesson_pages", "lessonid = {$lesson->id} AND prevpageid = 0"))) {
                         // there are no existing pages
                         $newpage->prevpageid = 0;
                         // this is a first page
                         $newpage->nextpageid = 0;
                         // this is the only page
                         $newpageid = insert_record("lesson_pages", $newpage);
                         if (!$newpageid) {
                             error("Insert page: new first page not inserted");
                         }
                     } else {
                         // there are existing pages put this at the start
                         $newpage->prevpageid = 0;
                         // this is a first page
                         $newpage->nextpageid = $page->id;
                         $newpageid = insert_record("lesson_pages", $newpage);
                         if (!$newpageid) {
                             error("Insert page: first page not inserted");
                         }
                         // update the linked list
                         if (!set_field("lesson_pages", "prevpageid", $newpageid, "id", $page->id)) {
                             error("Insert page: unable to update link");
                         }
                     }
                 }
                 // reset $pageid and put the page ID in $question, used in save_question_option()
                 $pageid = $newpageid;
                 $question->id = $newpageid;
                 $this->questionids[] = $question->id;
                 // Now to save all the answers and type-specific options
                 $question->lessonid = $lesson->id;
                 // needed for foreign key
                 $question->qtype = $this->qtypeconvert[$question->qtype];
//.........这里部分代码省略.........
开发者ID:JackCanada,项目名称:moodle-hacks,代码行数:101,代码来源:format.php


示例19: delete_feedback_completed

function delete_feedback_completed($completedid)
{
    if (!($completed = get_record('feedback_completed', 'id', $completedid))) {
        return false;
    }
    //erst alle verknuepften Values loeschen
    @delete_records('feedback_value', 'completed', $completed->id);
    //tracking eintraege dekrementieren bzw. loeschen
    if ($tracking = get_record_select('feedback_tracking', " completed = " . $completed->id . " AND feedback = " . $completed->feedback . " ")) {
        @delete_records('feedback_tracking', 'completed', $completed->id);
    }
    //den completed-datensatz loeschen
    return delete_records('feedback_completed', 'id', $completed->id);
}
开发者ID:kai707,项目名称:ITSA-backup,代码行数:14,代码来源:lib.php


示例20: define

 *
 */
define('INTERNAL', 1);
define('INSTITUTIONALADMIN', 1);
require dirname(dirname(dirname(__FILE__))) . '/init.php';
define('SECTION_PLUGINTYPE', 'core');
define('SECTION_PLUGINNAME', 'admin');
define('SECTION_PAGE', 'actionregistration');
require_once 'pieforms/pieform.php';
require_once 'institution.php';
$id = param_integer('r');
$action = param_alpha('action');
if (!is_logged_in()) {
    throw new AccessDeniedException();
}
if (!($registration = get_record_select('usr_registration', '"id" = ? AND pending = 1', array($id)))) {
    die_info(get_string('registrationnosuchid', 'auth.internal'));
}
if (!($inst = get_record('institution', 'name', $registration->institution))) {
    die_info(get_string('nosuchinstitution', 'admin'));
}
if ($action == 'approve') {
    $message = get_string('approveregistrationmessage', 'admin', $inst->displayname);
    $submitbtn = get_string('approve', 'admin');
    define('TITLE', get_string('approveregistrationfor2', 'admin', $registration->firstname, $registration->lastname, $registration->email));
    if ($registration->institution != 'mahara') {
        $elements['institutionstaff'] = array('type' => 'switchbox', 'title' => get_string('institutionstaff', 'admin'), 'description' => get_string('makeuserinstitutionstaff', 'admin'), 'defaultvalue' => 0);
    }
} else {
    $message = get_string('denyregistrationmessage', 'admin');
    $submitbtn = get_string('deny', 'admin');
开发者ID:kienv,项目名称:mahara,代码行数:31,代码来源:actionregistration.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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