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


PHP required_param_array函数代码示例

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


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

示例1: die

 * @license http://www.gnu.org/copyleft/gpl.html GNU Public License
 *
 * @usecase add
 * @usecase delete
 * @usecase save
 * @usecase import
 * @usecase doimport
 */
/* @var $OUTPUT core_renderer */
if (!defined('MOODLE_INTERNAL')) {
    die("Illegal direct access to this screen");
}
/* * ****************************** Delete a set of records **************************** */
if ($action == 'delete') {
    if (!isset($items)) {
        $items = required_param_array('items', PARAM_INT);
    }
    foreach ($items as $item) {
        $card = $DB->get_record('flashcard_deckdata', array('id' => $item));
        flashcard_delete_attached_files($cm, $flashcard, $card);
        if (!$DB->delete_records('flashcard_deckdata', array('id' => $item))) {
            print_error('errordeletecard', 'flashcard');
        }
        if (!$DB->delete_records('flashcard_card', array('entryid' => $item))) {
            print_error('errordeletecard', 'flashcard');
        }
    }
}
/* * ****************************** Prepare import **************************** */
if ($action == 'import') {
    include 'import_form.php';
开发者ID:gabrielrosset,项目名称:moodle-mod_flashcard,代码行数:31,代码来源:manageview.controller.php

示例2: test_required_param_array

    function test_required_param_array() {
        global $CFG;

        $_POST['username'] = array('a'=>'post_user');
        $_GET['username'] = array('a'=>'get_user');
        $this->assertSame(required_param_array('username', PARAM_RAW), $_POST['username']);

        unset($_POST['username']);
        $this->assertSame(required_param_array('username', PARAM_RAW), $_GET['username']);

        // make sure exception is triggered when some params are missing, hide error notices here - new in 2.2
        $_POST['username'] = array('a'=>'post_user');
        try {
            required_param_array('username', null);
            $this->fail('coding_exception expected');
        } catch (coding_exception $ex) {
            $this->assertTrue(true);
        }
        try {
            @required_param_array('username');
            $this->fail('coding_exception expected');
        } catch (coding_exception $ex) {
            $this->assertTrue(true);
        }
        try {
            required_param_array('', PARAM_RAW);
            $this->fail('coding_exception expected');
        } catch (coding_exception $ex) {
            $this->assertTrue(true);
        }

        // do not allow nested arrays
        try {
            $_POST['username'] = array('a'=>array('b'=>'post_user'));
            required_param_array('username', PARAM_RAW);
            $this->fail('coding_exception expected');
        } catch (coding_exception $ex) {
            $this->assertTrue(true);
        }

        // do not allow non-arrays
        try {
            $_POST['username'] = 'post_user';
            required_param_array('username', PARAM_RAW);
            $this->fail('moodle_exception expected');
        } catch (moodle_exception $ex) {
            $this->assertTrue(true);
        }

        // do not allow non-arrays
        $debugging = isset($CFG->debug) ? $CFG->debug : null;
        $debugdisplay = isset($CFG->debugdisplay) ? $CFG->debugdisplay : null;
        $CFG->debug = DEBUG_DEVELOPER;
        $CFG->debugdisplay = true;

        // make sure array keys are sanitised
        ob_start();
        $_POST['username'] = array('abc123_;-/*-+ '=>'arrggh', 'a1_-'=>'post_user');
        $this->assertSame(required_param_array('username', PARAM_RAW), array('a1_-'=>'post_user'));
        $d = ob_end_clean();
        $this->assertTrue($d !== '');

        if ($debugging !== null) {
            $CFG->debug = $debugging;
        } else {
            unset($CFG->debug);
        }
        if ($debugdisplay !== null) {
            $CFG->debugdisplay = $debugdisplay;
        } else {
            unset($CFG->debugdisplay);
        }
    }
开发者ID:netspotau,项目名称:moodle-mod_assign,代码行数:73,代码来源:moodlelib_test.php

示例3: view_import

 /**
  * view import-tab
  */
 public function view_import()
 {
     global $PAGE, $OUTPUT;
     require_capability('mod/grouptool:register_students', $this->context);
     $id = $this->cm->id;
     $form = new \mod_grouptool\import_form(null, array('id' => $id));
     if (optional_param('confirm', 0, PARAM_BOOL)) {
         $group = required_param_array('group', PARAM_INT);
         $data = required_param('data', PARAM_RAW);
         $includedeleted = optional_param('includedeleted', 0, PARAM_BOOL);
         $forceregistration = optional_param('forceregistration', 0, PARAM_BOOL);
         if (!empty($data)) {
             $data = unserialize($data);
         }
         list($error, $message) = $this->import($group, $data, $forceregistration, $includedeleted);
         if (!empty($error)) {
             $message = $OUTPUT->notification(get_string('ignored_not_found_users', 'grouptool'), 'notifyproblem') . html_writer::empty_tag('br') . $message;
         }
         echo html_writer::tag('div', $message, array('class' => 'centered'));
     }
     if ($fromform = $form->get_data()) {
         // Display confirm message - so we "try" only!
         list($error, $confirmmessage) = $this->import($fromform->group, $fromform->data, $fromform->forceregistration, $fromform->includedeleted, true);
         $attr = array('confirm' => '1', 'data' => serialize($fromform->data), 'forceregistration' => $fromform->forceregistration, 'includedeleted' => $fromform->includedeleted);
         foreach ($fromform->group as $group) {
             $attr['group[' . $group . ']'] = $group;
         }
         $continue = new moodle_url($PAGE->url, $attr);
         $cancel = new moodle_url($PAGE->url);
         if ($error) {
             $confirmmessage = $OUTPUT->notification(get_string('ignoring_not_found_users', 'grouptool'), 'notifyproblem') . html_writer::empty_tag('br') . $confirmmessage;
         }
         echo $OUTPUT->heading(get_string('preview', 'grouptool'), 2, 'centered') . $confirmmessage . $this->confirm('', $continue, $cancel);
     } else {
         $form->display();
     }
 }
开发者ID:rimacher,项目名称:moodle-mod_grouptool,代码行数:40,代码来源:locallib.php

示例4: array_merge

        $params = array_merge($att->pageparams->get_significant_params(), array('confirm' => 1));
        echo $OUTPUT->header();
        echo $OUTPUT->heading(get_string('attendanceforthecourse', 'local_attendance').' :: ' .$course->fullname);
        echo $OUTPUT->confirm($message, $att->url_preferences($params), $att->url_preferences());
        echo $OUTPUT->footer();
        exit;
    case local_att_preferences_page_params::ACTION_HIDE:
        $att->update_status($att->pageparams->statusid, null, null, null, 0);
        break;
    case local_att_preferences_page_params::ACTION_SHOW:
        $att->update_status($att->pageparams->statusid, null, null, null, 1);
        break;
    case local_att_preferences_page_params::ACTION_SAVE:
        $acronym        = required_param_array('acronym', PARAM_MULTILANG);
        $description    = required_param_array('description', PARAM_MULTILANG);
        $grade          = required_param_array('grade', PARAM_INT);

        foreach ($acronym as $id => $v) {
            $att->update_status($id, $acronym[$id], $description[$id], $grade[$id], null);
        }
        if ($att->grade > 0) {
            local_att_update_all_users_grades($att->id, $att->semesterinfo, $att->context, $att->classinfo, $att);
        }
        break;
}

$output = $PAGE->get_renderer('local_attendance');
$tabs = new local_attendance_tabs($att, local_attendance_tabs::TAB_PREFERENCES);
$prefdata = new local_attendance_preferences_data($att);

// Output starts here.
开发者ID:anilch,项目名称:Personel,代码行数:31,代码来源:preferences.php

示例5: required_param

/**
 * Returns a particular value for the named variable, taken from
 * POST or GET.  If the parameter doesn't exist then an error is
 * thrown because we require this variable.
 *
 * This function should be used to initialise all required values
 * in a script that are based on parameters.  Usually it will be
 * used like this:
 *    $id = required_param('id', PARAM_INT);
 *
 * Please note the $type parameter is now required and the value can not be array.
 *
 * @param string $parname the name of the page parameter we want
 * @param string $type expected type of parameter
 * @return mixed
 * @throws coding_exception
 */
function required_param($parname, $type)
{
    if (func_num_args() != 2 or empty($parname) or empty($type)) {
        throw new coding_exception('required_param() requires $parname and $type to be specified (parameter: ' . $parname . ')');
    }
    // POST has precedence.
    if (isset($_POST[$parname])) {
        $param = $_POST[$parname];
    } else {
        if (isset($_GET[$parname])) {
            $param = $_GET[$parname];
        } else {
            print_error('missingparam', '', '', $parname);
        }
    }
    if (is_array($param)) {
        debugging('Invalid array parameter detected in required_param(): ' . $parname);
        // TODO: switch to fatal error in Moodle 2.3.
        return required_param_array($parname, $type);
    }
    return clean_param($param, $type);
}
开发者ID:lucaboesch,项目名称:moodle,代码行数:39,代码来源:moodlelib.php

示例6: required_param_array

                        echo $OUTPUT->footer($course);
                        exit;
                    }
                }
                if (!$exist_flag) {
                    if (empty($classids)) {
                        $classids = required_param_array('classids', PARAM_INTEGER);
                    }
                    if (empty($classnames)) {
                        $classnames = required_param_array('classnames', PARAM_TEXT);
                    }
                    if (empty($classdels)) {
                        $classdels = optional_param_array('classdels', array(), PARAM_INTEGER);
                    }
                    autoattend_update_session_classes($classids, $classnames, $classdels);
                }
            } else {
                if (isset($formdata->submit_delete) and $confirm) {
                    $classids = required_param_array('classids', PARAM_INTEGER);
                    $classnames = required_param_array('classnames', PARAM_TEXT);
                    $classdels = optional_param_array('classdels', array(), PARAM_INTEGER);
                    autoattend_update_session_classes($classids, $classnames, $classdels);
                }
            }
        }
    }
    //
    $classes = autoattend_get_session_classes($course->id);
    include 'html/class_settings.html';
}
echo $OUTPUT->footer($course);
开发者ID:educakanchay,项目名称:campus,代码行数:31,代码来源:class_settings.php

示例7: offlinequiz_check_scanned_page

     if (!$overwrite) {
         $scannedpage = offlinequiz_check_scanned_page($offlinequiz, $scanner, $scannedpage, $USER->id, $coursecontext);
         if ($scannedpage->status == 'error' && $scannedpage->error == 'resultexists') {
             // Already process the answers but don't submit them.
             $scannedpage = offlinequiz_process_scanned_page($offlinequiz, $scanner, $scannedpage, $USER->id, $questionsperpage, $coursecontext, false);
             // Compare the old and the new result wrt. the choices.
             $scannedpage = offlinequiz_check_different_result($scannedpage);
         }
     }
     $userkey = $scannedpage->userkey;
     $usernumber = substr($userkey, strlen($offlinequizconfig->ID_prefix), $offlinequizconfig->ID_digits);
     $groupnumber = intval($scannedpage->groupnumber);
     $pagenumber = intval($scannedpage->pagenumber);
     $DB->update_record('offlinequiz_scanned_pages', $scannedpage);
     // The updated item information (crosses), will be processed later.
     $rawitemdata = required_param_array('item', PARAM_RAW);
     // O=============================================.
     // O Action rotate.
     // O=============================================.
 } else {
     if ($action == 'rotate') {
         if (!confirm_sesskey()) {
             print_error('invalidsesskey');
             echo "<input class=\"imagebutton\" type=\"submit\" value=\"" . get_string('cancel') . "\" name=\"submitbutton4\"\nonClick=\"self.close(); return false;\"><br />";
             die;
         }
         if ($newfile = $scanner->rotate_180()) {
             // Maybe old errors have been fixed.
             $scannedpage->status = 'ok';
             $scannedpage->error = '';
             $scannedpage->userkey = null;
开发者ID:frankkoch,项目名称:moodle-mod_offlinequiz,代码行数:31,代码来源:correct.php

示例8: moodle_url

     if ($DB->get_field('grouptool_agrps', 'active', array('groupid' => $groupid, 'grouptoolid' => $cm->instance)) == 1) {
         $result->error = "Couldn't deactivate group " . $groupid . " in grouptool " . $cm->instance . "!";
     } else {
         $result->message = "Deactivated group " . $groupid . " in grouptool " . $cm->instance . "!";
     }
     if ($filter == mod_grouptool::FILTER_ACTIVE && !$DB->count_records('grouptool_agrps', array('grouptoolid' => $cm->instance, 'active' => 1))) {
         $url = new moodle_url($PAGE->url, array('id' => $cm->instance, 'tab' => 'group_admin', 'filter' => mod_grouptool::FILTER_ALL));
         $message = get_string('nogroupsactive', 'grouptool') . ' ' . html_writer::link($url, get_string('nogroupschoose', 'grouptool'));
         $result->noentriesmessage = $OUTPUT->box($coreoutput->notification($message, 'notifymessage'), 'generalbox', 'nogroupsinfo');
     } else {
         $result->noentriesmessage = '';
     }
     break;
 case 'reorder':
     // Reorder groups...
     $data = required_param_array('order', PARAM_INT);
     $failed = array();
     $missing = array();
     foreach ($data as $groupid => $order) {
         if (!$DB->record_exists('grouptool_agrps', array('groupid' => $groupid, 'grouptoolid' => $cm->instance))) {
             // Insert missing record!
             $newrecord = new stdClass();
             $newrecord->groupid = $groupid;
             $newrecord->grouptoolid = $cm->instance;
             $newrecord->active = 0;
             $newrecord->sort_order = $order;
             $DB->insert_record('grouptool_agrps', $newrecord);
             $missing[] = "groupid " . $groupid;
         } else {
             $DB->set_field('grouptool_agrps', 'sort_order', $order, array('groupid' => $groupid, 'grouptoolid' => $cm->instance));
             if (!$DB->record_exists('grouptool_agrps', array('groupid' => $groupid, 'grouptoolid' => $cm->instance, 'sort_order' => $order))) {
开发者ID:rimacher,项目名称:moodle-mod_grouptool,代码行数:31,代码来源:editgroup_ajax.php

示例9: define

<?php

// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
/**
 * Save course order in course_overview block
 *
 * @package    block_course_overview
 * @copyright  2012 Adam Olley <adam.olley@netspot.com.au>
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */
define('AJAX_SCRIPT', true);
require_once dirname(__FILE__) . '/../../config.php';
require_once dirname(__FILE__) . '/locallib.php';
require_sesskey();
require_login();
$sortorder = required_param_array('sortorder', PARAM_INT);
block_course_overview_update_myorder($sortorder);
开发者ID:alanaipe2015,项目名称:moodle,代码行数:30,代码来源:save.php

示例10: optional_param

     echo $OUTPUT->heading(get_string('attendanceforthecourse', 'attendance') . ' :: ' . $course->fullname);
     echo $OUTPUT->confirm($message, $att->url_sessions($params), $att->url_manage());
     echo $OUTPUT->footer();
     exit;
 case att_sessions_page_params::ACTION_DELETE_SELECTED:
     $confirm = optional_param('confirm', null, PARAM_INT);
     if (isset($confirm) && confirm_sesskey()) {
         $sessionsids = required_param('sessionsids', PARAM_ALPHANUMEXT);
         $sessionsids = explode('_', $sessionsids);
         $att->delete_sessions($sessionsids);
         if ($att->grade > 0) {
             att_update_all_users_grades($att->id, $att->course, $att->context, $cm);
         }
         redirect($att->url_manage(), get_string('sessiondeleted', 'attendance'));
     }
     $sessid = required_param_array('sessid', PARAM_SEQUENCE);
     $sessionsinfo = $att->get_sessions_info($sessid);
     $message = get_string('deletecheckfull', '', get_string('session', 'attendance'));
     $message .= html_writer::empty_tag('br');
     foreach ($sessionsinfo as $sessinfo) {
         $message .= html_writer::empty_tag('br');
         $message .= userdate($sessinfo->sessdate, get_string('strftimedmyhm', 'attendance'));
         $message .= html_writer::empty_tag('br');
         $message .= $sessinfo->description;
     }
     $sessionsids = implode('_', $sessid);
     $params = array('action' => $att->pageparams->action, 'sessionsids' => $sessionsids, 'confirm' => 1, 'sesskey' => sesskey());
     echo $OUTPUT->header();
     echo $OUTPUT->heading(get_string('attendanceforthecourse', 'attendance') . ' :: ' . $course->fullname);
     echo $OUTPUT->confirm($message, $att->url_sessions($params), $att->url_manage());
     echo $OUTPUT->footer();
开发者ID:ralferlebach,项目名称:moodle-mod_attendance,代码行数:31,代码来源:sessions.php

示例11: array

$book = $DB->get_record('rcommon_books', array('id' => $rcontent->bookid));
if ($book) {
    $bookname = $book->name;
} else {
    $bookname = $rcontent->bookid;
}
$baseurl = $CFG->wwwroot . "/mod/rcontent/report.php?id={$id}";
if (!empty($user)) {
    $userdata = rcontent_get_user_data($user);
    $navurl = "{$baseurl}&user={$user}&attempt={$attempt}";
    $PAGE->navbar->add(fullname($userdata), new moodle_url($navurl), null, navigation_node::TYPE_CUSTOM, null);
}
echo $OUTPUT->header();
echo $OUTPUT->heading(format_string($rcontent->name) . ' (' . $bookname . ')');
if ($candeleteresponses && $action == 'delete') {
    $attemptids = required_param_array('attemptid', PARAM_RAW);
    // Get array of responses to delete.
    if (rcontent_delete_responses($attemptids, $rcontent->id)) {
        // Delete responses.
        echo $OUTPUT->notification(get_string('responsedeleted', 'rcontent'), 'notifysuccess');
    }
}
// In case that the user is a student in course context load from db just his registries
$userrol = array_values(get_user_roles($contextmodule));
if (empty($user)) {
    // Filter by status, get parameter with the filterby
    $filterby = optional_param('filterby', '', PARAM_RAW);
    $optionsparam = !empty($filterby) ? $filterby : "";
    $menu = array();
    $menu[''] = get_string('all');
    $menu['NO_INICIADO'] = get_string('NO_INICIADO', 'rcontent');
开发者ID:kevin-bruton,项目名称:marsupial,代码行数:31,代码来源:report.php

示例12: offlinequiz_participants_scanner

     $urx = $upperright->x;
     $ury = $upperright->y;
     $llx = $lowerleft->x;
     $lly = $lowerleft->y;
     $lrx = $lowerright->x;
     $lry = $lowerright->y;
     // Initialise a new page scanner.
     $scanner = new offlinequiz_participants_scanner($offlinequiz, $context->id, 0, 0);
     $sheetloaded = $scanner->load_stored_image($scannedpage->filename, array($upperleft, $upperright, $lowerleft, $lowerright));
     // The following calibrates the scanner.
     $scanner->get_list();
     $OUTPUT->heading(get_string('participantslist', 'offlinequiz'));
     $listid = required_param('listid', PARAM_INT);
     // Get the values chosen by the user.
     $newparticipants = required_param_array('participants', PARAM_RAW);
     $userid = required_param_array('userid', PARAM_RAW);
     // Maybe old errors have been fixed.
     $scannedpage->status = 'ok';
     $scannedpage->error = '';
     if ($list = $DB->get_record('offlinequiz_p_lists', array('id' => $listid))) {
         $scannedpage->listnumber = intval($list->number);
     }
     // -------------------------------------------------------------
     //       Action setlist
     // -------------------------------------------------------------
 } else {
     if ($action == 'setlist') {
         $upperleft = new oq_point(required_param('c-0-x', PARAM_INT) + 8, required_param('c-0-y', PARAM_INT) + 8);
         $upperright = new oq_point(required_param('c-1-x', PARAM_INT) + 8, required_param('c-1-y', PARAM_INT) + 8);
         $lowerleft = new oq_point(required_param('c-2-x', PARAM_INT) + 8, required_param('c-2-y', PARAM_INT) + 8);
         $lowerright = new oq_point(required_param('c-3-x', PARAM_INT) + 8, required_param('c-3-y', PARAM_INT) + 8);
开发者ID:frankkoch,项目名称:moodle-mod_offlinequiz,代码行数:31,代码来源:participants_correct.php

示例13: required_param

$numcolumns = required_param('numcolumns', PARAM_INT);
$url1 = "labels.php?a={$blended->id}";
//Comprobación de que el numero de filas y columnas no supera los valores máximos
if ($numrows > 30 || $numrows < 1 || $numcolumns < 1 || $numcolumns > 10) {
    notice('Los tamaños elegidos no son valores permitidos', $url1);
} else {
    list($studentids, $nonstudentids, $activeids, $users) = blended_get_users_by_type($context_course);
    switch ($whatstudents) {
        case 'active':
            $userids = $activeids;
            break;
        case 'all':
            $userids = $studentids;
            break;
        case 'list':
            $userListcode = required_param_array('users', PARAM_RAW);
            // compose a page with this users
            $total = $numcolumns * $numrows;
            $num = count($userListcode);
            $numpages = ceil($num / $total);
            $repeat = $numpages * $total / $num;
            $userids = array();
            foreach ($userListcode as $uid) {
                for ($i = 0; $i < $repeat; $i++) {
                    $userids[] = $uid;
                    if (count($userids) == $total) {
                        break;
                    }
                }
            }
            break;
开发者ID:juacas,项目名称:moodle-mod_blended,代码行数:31,代码来源:printCourseLabels.php

示例14: define

 * @package mod
 * @subpackage emarking
 * @copyright 2012 Jorge Villalon <villalon@gmail.com>
 * @copyright 2014 Nicolas Perez <niperez@alumnos.uai.cl>
 * @copyright 2014 Carlos Villarroel <cavillarroel@alumnos.uai.cl>
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */
define('NO_OUTPUT_BUFFERING', true);
require_once dirname(dirname(dirname(__FILE__))) . '/config.php';
require_once "{$CFG->dirroot}/lib/weblib.php";
require_once $CFG->dirroot . '/repository/lib.php';
require_once $CFG->dirroot . '/mod/emarking/locallib.php';
//cambiar
global $DB, $CFG, $USER;
$cmid = required_param('id', PARAM_INT);
$submissions = required_param_array('publish', PARAM_INTEGER);
// Validate course module
if (!($cm = get_coursemodule_from_id('emarking', $cmid))) {
    print_error(get_string('invalidcoursemodule', 'mod_emarking'));
}
// Validate emarking activity
if (!($emarking = $DB->get_record('emarking', array('id' => $cm->instance)))) {
    print_error(get_string('invalidemarkingid', 'mod_emarking') . ':' . $emarkingid);
}
// Validate course
if (!($course = $DB->get_record('course', array('id' => $emarking->course)))) {
    print_error(get_string('invalidcourseid', 'mod_emarking') . ': ' . $emarking->course);
}
// Get context for module
$context = context_module::instance($cm->id);
// Validate user is logged in and is not guest
开发者ID:jorgecabane93,项目名称:eMarkingWeb,代码行数:31,代码来源:publish.php

示例15: respond_bulklist_modify

 /**
  * Responds to a request to modify the bulklist.
  *
  * Required $_REQUEST parameters:
  *     string $sesskey The CSRF-protection 'sesskey' variable.
  *     string $modify  Either "add" or "remove" - determines what to do with the $ids input.
  *     array  $ids     An array of IDs to add or remove.
  *
  * Outputs XSSI-safe-JSON containing 'result', 'page_results', and 'total_results', outlined below:
  *     string  result              'success' to indicate we successfully completed the request.
  *     array   page_results_ids    An array of IDs for the current page of results in the same order as page_results_values.
  *     array   page_results_values An array of labels for the current page of results, in the same order as page_results_ids.
  *     int     total_results       The total number of results in the dataset.
  */
 protected function respond_bulklist_modify()
 {
     require_sesskey();
     $mode = required_param('modify', PARAM_CLEAN);
     if ($mode !== 'add' && $mode != 'remove') {
         throw new Exception('Did not understand request');
     }
     $ids = required_param_array('ids', PARAM_CLEAN);
     if ($mode === 'add') {
         $this->bulklist_modify($ids);
     } else {
         if ($mode === 'remove') {
             $this->bulklist_modify(array(), $ids);
         }
     }
     list($pageresults, $totalresults) = $this->bulklist_get_display(1);
     echo safe_json_encode(array('result' => 'success', 'page_results_ids' => array_keys($pageresults), 'page_results_values' => array_values($pageresults), 'total_results' => $totalresults));
 }
开发者ID:jamesmcq,项目名称:elis,代码行数:32,代码来源:lib.php


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