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


PHP assign::get_useridlist_key_id方法代码示例

本文整理汇总了PHP中assign::get_useridlist_key_id方法的典型用法代码示例。如果您正苦于以下问题:PHP assign::get_useridlist_key_id方法的具体用法?PHP assign::get_useridlist_key_id怎么用?PHP assign::get_useridlist_key_id使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在assign的用法示例。


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

示例1: col_userid

    /**
     * Format a column of data for display.
     *
     * @param stdClass $row
     * @return string
     */
    public function col_userid(stdClass $row) {
        global $USER;

        $edit = '';

        $actions = array();

        $urlparams = array('id'=>$this->assignment->get_course_module()->id,
                           'rownum'=>$this->rownum,
                           'action' => 'grade',
                           'useridlistid' => $this->assignment->get_useridlist_key_id());
        $url = new moodle_url('/mod/assign/view.php', $urlparams);
        $noimage = null;

        if (!$row->grade) {
            $description = get_string('grade');
        } else {
            $description = get_string('updategrade', 'assign');
        }
        $actions['grade'] = new action_menu_link_secondary(
            $url,
            $noimage,
            $description
        );

        // Everything we need is in the row.
        $submission = $row;
        $flags = $row;
        if ($this->assignment->get_instance()->teamsubmission) {
            // Use the cache for this.
            $submission = false;
            $group = false;
            $this->get_group_and_submission($row->id, $group, $submission, -1);
        }

        $submissionsopen = $this->assignment->submissions_open($row->id,
                                                               true,
                                                               $submission,
                                                               $flags,
                                                               $this->gradinginfo);
        $caneditsubmission = $this->assignment->can_edit_submission($row->id, $USER->id);

        // Hide for offline assignments.
        if ($this->assignment->is_any_submission_plugin_enabled()) {
            if (!$row->status ||
                    $row->status == ASSIGN_SUBMISSION_STATUS_DRAFT ||
                    !$this->assignment->get_instance()->submissiondrafts) {

                if (!$row->locked) {
                    $urlparams = array('id' => $this->assignment->get_course_module()->id,
                                       'userid'=>$row->id,
                                       'action'=>'lock',
                                       'sesskey'=>sesskey(),
                                       'page'=>$this->currpage);
                    $url = new moodle_url('/mod/assign/view.php', $urlparams);

                    $description = get_string('preventsubmissionsshort', 'assign');
                    $actions['lock'] = new action_menu_link_secondary(
                        $url,
                        $noimage,
                        $description
                    );
                } else {
                    $urlparams = array('id' => $this->assignment->get_course_module()->id,
                                       'userid'=>$row->id,
                                       'action'=>'unlock',
                                       'sesskey'=>sesskey(),
                                       'page'=>$this->currpage);
                    $url = new moodle_url('/mod/assign/view.php', $urlparams);
                    $description = get_string('allowsubmissionsshort', 'assign');
                    $actions['unlock'] = new action_menu_link_secondary(
                        $url,
                        $noimage,
                        $description
                    );
                }
            }

            if ($submissionsopen &&
                    $USER->id != $row->id &&
                    $caneditsubmission) {
                $urlparams = array('id' => $this->assignment->get_course_module()->id,
                                   'userid'=>$row->id,
                                   'action'=>'editsubmission',
                                   'sesskey'=>sesskey(),
                                   'page'=>$this->currpage);
                $url = new moodle_url('/mod/assign/view.php', $urlparams);
                $description = get_string('editsubmission', 'assign');
                $actions['editsubmission'] = new action_menu_link_secondary(
                    $url,
                    $noimage,
                    $description
                );
            }
//.........这里部分代码省略.........
开发者ID:kinnay1,项目名称:MoodleTest,代码行数:101,代码来源:gradingtable.php

示例2: assign

// 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/>.
/**
 * This file is the entry point to the assign module. All pages are rendered from here
 *
 * @package   mod_assign
 * @copyright 2012 NetSpot {@link http://www.netspot.com.au}
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */
require_once '../../config.php';
require_once $CFG->dirroot . '/mod/assign/locallib.php';
$id = required_param('id', PARAM_INT);
list($course, $cm) = get_course_and_cm_from_cmid($id, 'assign');
require_login($course, true, $cm);
$context = context_module::instance($cm->id);
require_capability('mod/assign:view', $context);
$assign = new assign($context, $cm, $course);
$urlparams = array('id' => $id, 'action' => optional_param('action', '', PARAM_TEXT), 'rownum' => optional_param('rownum', 0, PARAM_INT), 'useridlistid' => optional_param('useridlistid', $assign->get_useridlist_key_id(), PARAM_ALPHANUM));
$url = new moodle_url('/mod/assign/view.php', $urlparams);
$PAGE->set_url($url);
// Update module completion status.
$assign->set_module_viewed();
// Apply overrides.
$assign->update_effective_access($USER->id);
// Get the assign class to
// render the page.
echo $assign->view(optional_param('action', '', PARAM_TEXT));
开发者ID:lucaboesch,项目名称:moodle,代码行数:31,代码来源:view.php

示例3: test_useridlist_cache

 /**
  * Test that the useridlist cache will retive the correct values
  * when using assign::get_useridlist_key and assign::get_useridlist_key_id.
  */
 public function test_useridlist_cache()
 {
     // Create an assignment object, we will use this to test the key generation functions.
     $course = self::getDataGenerator()->create_course();
     $assign = self::getDataGenerator()->create_module('assign', array('course' => $course->id));
     list($courserecord, $cm) = get_course_and_cm_from_instance($assign->id, 'assign');
     $context = context_module::instance($cm->id);
     $assign = new assign($context, $cm, $courserecord);
     // Create the cache.
     $cache = cache::make_from_params(cache_store::MODE_SESSION, 'mod_assign', 'useridlist');
     // Create an entry that we will insert into the cache.
     $entry = array(0 => '5', 1 => '6325', 2 => '67783');
     // Insert the value into the cache.
     $cache->set($assign->get_useridlist_key(), $entry);
     // Now test we can retrive the entry.
     $this->assertEquals($entry, $cache->get($assign->get_useridlist_key()));
     $useridlistid = clean_param($assign->get_useridlist_key_id(), PARAM_ALPHANUM);
     $this->assertEquals($entry, $cache->get($assign->get_useridlist_key($useridlistid)));
     // Check it will not retrive anything on an invalid key.
     $this->assertFalse($cache->get($assign->get_useridlist_key('notvalid')));
 }
开发者ID:pzhu2004,项目名称:moodle,代码行数:25,代码来源:locallib_test.php


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