本文整理汇总了PHP中assign类的典型用法代码示例。如果您正苦于以下问题:PHP assign类的具体用法?PHP assign怎么用?PHP assign使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了assign类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: initiate
public function initiate()
{
$assign = new assign($this->application);
if ($assign->host()->dir($this->configuration)) {
$module = new module();
$module->loader();
if (module::request(support\configuration::class)->configuration()) {
$rewrite = avail::configuration($this->rewrite)->request('rewrite');
if ($assign->rewrite($rewrite)) {
if ($route = $module->route()) {
module::request(support\validation::class)->extension('ASV');
module::request(support\authorization::class)->extension('ASA');
module::request(support\mail::class)->extension('ASM');
$ase = $module->environment();
if ($ase) {
if (isset($ase['database'])) {
if ($assign->database(array_merge(avail::$database, $ase['database']))) {
return true;
} else {
unset($ase['database']);
}
}
avail::configuration($ase)->merge();
}
avail::authorization()->subscribe();
avail::directory()->set(avail::configuration($this->directory)->request('directory'));
new verse();
$verso = new verso($route->page);
$verso->set();
$verso->execute();
}
}
}
}
}
开发者ID:letid,项目名称:framework,代码行数:35,代码来源:request.php
示例2: assignsubmission_comments_comment_permissions
/**
* Permission control method for submission plugin ---- required method for AJAXmoodle based comment API
*
* @param stdClass $options
* @return array
*/
function assignsubmission_comments_comment_permissions(stdClass $options) {
global $USER, $CFG, $DB;
if ($options->commentarea != 'submission_comments' &&
$options->commentarea != 'submission_comments_upgrade') {
throw new comment_exception('invalidcommentarea');
}
if (!$submission = $DB->get_record('assign_submission', array('id'=>$options->itemid))) {
throw new comment_exception('invalidcommentitemid');
}
$context = $options->context;
require_once($CFG->dirroot . '/mod/assign/locallib.php');
$assignment = new assign($context, null, null);
if ($assignment->get_instance()->id != $submission->assignment) {
throw new comment_exception('invalidcontext');
}
if (!has_capability('mod/assign:grade', $context)) {
if (!has_capability('mod/assign:submit', $context)) {
return array('post' => false, 'view' => false);
} else if ($submission->userid != $USER->id) {
return array('post' => false, 'view' => false);
}
}
return array('post' => true, 'view' => true);
}
开发者ID:ncsu-delta,项目名称:moodle,代码行数:34,代码来源:lib.php
示例3: __construct
public function __construct(\mod_mediagallery\collection $collection, array $galleries)
{
global $CFG, $DB;
$this->collection = $collection;
$this->galleries = $galleries;
if ($collection->user_can_add_children()) {
$this->maxreached = false;
}
if ($this->isassessable = $collection->is_assessable()) {
$this->hassubmitted = $collection->has_submitted();
if ($this->linkedassigncmid = $collection->get_linked_assignid()) {
require_once $CFG->dirroot . '/mod/assign/locallib.php';
$context = \context_module::instance($this->linkedassigncmid);
$cm = get_coursemodule_from_id('assign', $this->linkedassigncmid, 0, false, MUST_EXIST);
$course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
$assign = new \assign($context, $cm, $course);
$this->submissionsopen = $assign->submissions_open();
}
}
$this->readonly = $collection->is_read_only();
$this->tags = $collection->get_tags();
$mygalleries = $collection->get_my_galleries();
$this->userorgrouphasgallery = !empty($mygalleries);
foreach (array('id', 'mode', 'thumbnailsperrow', 'thumbnailsperpage') as $opt) {
if (isset($collection->{$opt})) {
$this->{$opt} = $collection->{$opt};
}
}
}
开发者ID:eSrem,项目名称:moodle-mod_mediagallery,代码行数:29,代码来源:renderable.php
示例4: create_from_submission
/**
* Create instance of event.
*
* @param \assign $assign
* @param \stdClass $submission
* @return submission_viewed
*/
public static function create_from_submission(\assign $assign, \stdClass $submission)
{
$data = array('objectid' => $submission->id, 'relateduserid' => $submission->userid, 'context' => $assign->get_context(), 'other' => array('assignid' => $assign->get_instance()->id));
/** @var submission_viewed $event */
$event = self::create($data);
$event->set_assign($assign);
$event->add_record_snapshot('assign_submission', $submission);
return $event;
}
开发者ID:sumitnegi933,项目名称:Moodle_lms_New,代码行数:16,代码来源:submission_viewed.php
示例5: create_from_assign
/**
* Create instance of event.
*
* @param \assign $assign
* @return batch_set_marker_allocation_viewed
*/
public static function create_from_assign(\assign $assign)
{
$data = array('context' => $assign->get_context(), 'other' => array('assignid' => $assign->get_instance()->id));
self::$preventcreatecall = false;
/** @var batch_set_marker_allocation_viewed $event */
$event = self::create($data);
self::$preventcreatecall = true;
$event->set_assign($assign);
return $event;
}
开发者ID:evltuma,项目名称:moodle,代码行数:16,代码来源:batch_set_marker_allocation_viewed.php
示例6: __construct
/**
* Constructor for this renderable.
*
* @param int $userid The user we will open the grading app too.
* @param int $groupid If groups are enabled this is the current course group.
* @param assign $assignment The assignment class
*/
public function __construct($userid, $groupid, $assignment)
{
$this->userid = $userid;
$this->groupid = $groupid;
$this->assignment = $assignment;
$this->participants = $assignment->list_participants_with_filter_status_and_group($groupid);
if (!$this->userid && count($this->participants)) {
$this->userid = reset($this->participants)->id;
}
}
开发者ID:evltuma,项目名称:moodle,代码行数:17,代码来源:grading_app.php
示例7: set_assign
/**
* Set assign instance for this event.
* @param \assign $assign
* @throws \coding_exception
*/
public function set_assign(\assign $assign)
{
if ($this->is_triggered()) {
throw new \coding_exception('set_assign() must be done before triggerring of event');
}
if ($assign->get_context()->id != $this->get_context()->id) {
throw new \coding_exception('Invalid assign isntance supplied!');
}
$this->assign = $assign;
}
开发者ID:evltuma,项目名称:moodle,代码行数:15,代码来源:base.php
示例8: create_from_assign
/**
* Create instance of event.
*
* @since Moodle 2.7
*
* @param \assign $assign
* @return all_submissions_downloaded
*/
public static function create_from_assign(\assign $assign)
{
$data = array('context' => $assign->get_context(), 'objectid' => $assign->get_instance()->id);
self::$preventcreatecall = false;
/** @var submission_graded $event */
$event = self::create($data);
self::$preventcreatecall = true;
$event->set_assign($assign);
return $event;
}
开发者ID:evltuma,项目名称:moodle,代码行数:18,代码来源:all_submissions_downloaded.php
示例9: create_from_grade
/**
* Create instance of event.
*
* @since Moodle 2.7
*
* @param \assign $assign
* @param \stdClass $grade
* @return submission_graded
*/
public static function create_from_grade(\assign $assign, \stdClass $grade)
{
$data = array('context' => $assign->get_context(), 'objectid' => $grade->id, 'relateduserid' => $grade->userid);
self::$preventcreatecall = false;
/** @var submission_graded $event */
$event = self::create($data);
self::$preventcreatecall = true;
$event->set_assign($assign);
$event->add_record_snapshot('assign_grades', $grade);
return $event;
}
开发者ID:sumitnegi933,项目名称:Moodle_lms_New,代码行数:20,代码来源:submission_graded.php
示例10: create_from_user
/**
* Create instance of event.
*
* @since Moodle 2.7
*
* @param \assign $assign
* @param \stdClass $user
* @return submission_locked
*/
public static function create_from_user(\assign $assign, \stdClass $user)
{
$data = array('context' => $assign->get_context(), 'objectid' => $assign->get_instance()->id, 'relateduserid' => $user->id);
self::$preventcreatecall = false;
/** @var submission_locked $event */
$event = self::create($data);
self::$preventcreatecall = true;
$event->set_assign($assign);
$event->add_record_snapshot('user', $user);
return $event;
}
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:20,代码来源:submission_locked.php
示例11: create_from_submission
/**
* Create instance of event.
*
* @since Moodle 2.7
*
* @param \assign $assign
* @param \stdClass $submission
* @return statement_accepted
*/
public static function create_from_submission(\assign $assign, \stdClass $submission)
{
$data = array('context' => $assign->get_context(), 'objectid' => $submission->id);
self::$preventcreatecall = false;
/** @var statement_accepted $event */
$event = self::create($data);
self::$preventcreatecall = true;
$event->set_assign($assign);
$event->add_record_snapshot('assign_submission', $submission);
return $event;
}
开发者ID:pzhu2004,项目名称:moodle,代码行数:20,代码来源:statement_accepted.php
示例12: annotate_plugin_config_files
/**
* Annotate files from plugin configuration
* @param backup_nested_element $assign the backup structure of the activity
* @param string $subtype the plugin type to handle
* @return void
*/
protected function annotate_plugin_config_files(backup_nested_element $assign, $subtype)
{
$dummyassign = new assign(null, null, null);
$plugins = $dummyassign->load_plugins($subtype);
foreach ($plugins as $plugin) {
$component = $plugin->get_subtype() . '_' . $plugin->get_type();
$areas = $plugin->get_config_file_areas();
foreach ($areas as $area) {
$assign->annotate_files($component, $area, null);
}
}
}
开发者ID:gabrielrosset,项目名称:moodle,代码行数:18,代码来源:backup_assign_stepslib.php
示例13: create_from_submission
/**
* Create instance of event.
*
* @since Moodle 2.7
*
* @param \assign $assign
* @param \stdClass $submission
* @param bool $editable
* @return assessable_submitted
*/
public static function create_from_submission(\assign $assign, \stdClass $submission, $editable)
{
global $USER;
$data = array('context' => $assign->get_context(), 'objectid' => $submission->id, 'other' => array('submission_editable' => $editable));
if (!empty($submission->userid) && $submission->userid != $USER->id) {
$data['relateduserid'] = $submission->userid;
}
/** @var assessable_submitted $event */
$event = self::create($data);
$event->set_assign($assign);
$event->add_record_snapshot('assign_submission', $submission);
return $event;
}
开发者ID:evltuma,项目名称:moodle,代码行数:23,代码来源:assessable_submitted.php
示例14: save_dates
public function save_dates(cm_info $cm, array $dates)
{
global $DB, $COURSE;
$update = new stdClass();
$update->id = $cm->instance;
$update->duedate = $dates['duedate'];
$update->allowsubmissionsfromdate = $dates['allowsubmissionsfromdate'];
$update->cutoffdate = $dates['cutoffdate'];
$result = $DB->update_record('assign', $update);
$module = new assign(context_module::instance($cm->id), null, null);
// Update the calendar and grades.
$module->update_calendar($cm->id);
$module->update_gradebook(false, $cm->id);
}
开发者ID:merrill-oakland,项目名称:moodle-report_editdates,代码行数:14,代码来源:assigndates.php
示例15: get_file_info
/**
* Default implementation of file_get_info for plugins.
* This is used by the filebrowser to browse a plugins file areas.
*
* This implementation should work for most plugins but can be overridden if required.
* @param file_browser $browser
* @param string $filearea
* @param int $itemid
* @param string $filepath
* @param string $filename
* @return file_info_stored
*/
public function get_file_info($browser, $filearea, $itemid, $filepath, $filename)
{
global $CFG, $DB, $USER;
$urlbase = $CFG->wwwroot . '/pluginfile.php';
// Permission check on the itemid.
if ($this->get_subtype() == 'assignsubmission') {
if ($itemid) {
$record = $DB->get_record('assign_submission', array('id' => $itemid), 'userid', IGNORE_MISSING);
if (!$record) {
return null;
}
if (!$this->assignment->can_view_submission($record->userid)) {
return null;
}
}
} else {
// Not supported for feedback plugins.
return null;
}
$fs = get_file_storage();
$filepath = is_null($filepath) ? '/' : $filepath;
$filename = is_null($filename) ? '.' : $filename;
if (!($storedfile = $fs->get_file($this->assignment->get_context()->id, $this->get_subtype() . '_' . $this->get_type(), $filearea, $itemid, $filepath, $filename))) {
return null;
}
return new file_info_stored($browser, $this->assignment->get_context(), $storedfile, $urlbase, $filearea, $itemid, true, true, false);
}
开发者ID:EmmanuelYupit,项目名称:educursos,代码行数:39,代码来源:assignmentplugin.php
示例16: execute
public function execute()
{
$Id = $this->executeArrange();
$versoObject = $Id[avail::$config['APC']];
$versoMethod = $Id[avail::$config['APM']];
if ($Obj = module::request($versoObject)->map()) {
if (method_exists($Obj, $versoMethod) && is_callable(array($Obj, $versoMethod))) {
avail::$contextId = call_user_func(array($Obj, $versoMethod));
avail::$contextResponse = avail::$contextType;
$currentSupport = array($Obj, $versoMethod . avail::$config['AHS']);
if (is_callable($currentSupport)) {
call_user_func($currentSupport);
}
$finalSupport = array($Obj, avail::$config['AHF'] . avail::$config['AHS']);
if (is_callable($finalSupport)) {
call_user_func($finalSupport);
}
} else {
// avail::assist(14)->log('is_not_callable');
assign::template('method')->error(array('class' => avail::$config['ARO'] . avail::$config['ASP'] . avail::SlA . $versoObject, 'method' => $versoMethod));
}
} else {
// TODO: disable initial()->error() on live application
// avail::assist(14)->log('is_not_callable');
assign::template('class')->error(array('class' => $versoObject, 'root' => avail::$config['ARO'] . avail::$config['ASP'] . avail::SlA));
}
}
开发者ID:letid,项目名称:framework,代码行数:27,代码来源:verso.php
示例17: get_sort_columns
/**
* Always return a valid sort - even if the userid column is missing.
* @return array column name => SORT_... constant.
*/
public function get_sort_columns()
{
$result = parent::get_sort_columns();
$assignment = $this->assignment->get_instance();
if (empty($assignment->blindmarking)) {
$result = array_merge($result, array('userid' => SORT_ASC));
} else {
$result = array_merge($result, ['COALESCE(s.timecreated, ' . time() . ')' => SORT_ASC, 'COALESCE(s.id, ' . PHP_INT_MAX . ')' => SORT_ASC, 'um.id' => SORT_ASC]);
}
return $result;
}
开发者ID:lucaboesch,项目名称:moodle,代码行数:15,代码来源:gradingtable.php
示例18: test_grade_edit_tree_column_range_get_item_cell
public function test_grade_edit_tree_column_range_get_item_cell()
{
global $DB, $CFG;
$this->resetAfterTest(true);
// Make some things we need.
$scale = $this->getDataGenerator()->create_scale();
$course = $this->getDataGenerator()->create_course();
$assign = $this->getDataGenerator()->create_module('assign', array('course' => $course->id));
$modulecontext = context_module::instance($assign->id);
// The generator returns a dummy object, lets get the real assign object.
$assign = new assign($modulecontext, false, false);
$cm = $assign->get_course_module();
// Get range column.
$column = grade_edit_tree_column::factory('range');
$gradeitemparams = array('itemtype' => 'mod', 'itemmodule' => $cm->modname, 'iteminstance' => $cm->instance, 'courseid' => $cm->course, 'itemnumber' => 0);
// Lets set the grade to something we know.
$instance = $assign->get_instance();
$instance->grade = 70;
$instance->instance = $instance->id;
$assign->update_instance($instance);
$gradeitem = grade_item::fetch($gradeitemparams);
$cell = $column->get_item_cell($gradeitem, array());
$this->assertEquals(GRADE_TYPE_VALUE, $gradeitem->gradetype);
$this->assertEquals(null, $gradeitem->scaleid);
$this->assertEquals(70.0, (double) $cell->text, "Grade text is 70", 0.01);
// Now change it to a scale.
$instance = $assign->get_instance();
$instance->grade = -$scale->id;
$instance->instance = $instance->id;
$assign->update_instance($instance);
$gradeitem = grade_item::fetch($gradeitemparams);
$cell = $column->get_item_cell($gradeitem, array());
// Make the expected scale text.
$scaleitems = null;
$scaleitems = explode(',', $scale->scale);
$scalestring = end($scaleitems) . ' (' . count($scaleitems) . ')';
$this->assertEquals(GRADE_TYPE_SCALE, $gradeitem->gradetype);
$this->assertEquals($scale->id, $gradeitem->scaleid);
$this->assertEquals($scalestring, $cell->text, "Grade text matches scale");
// Now change it to no grade.
$instance = $assign->get_instance();
$instance->grade = 0;
$instance->instance = $instance->id;
$assign->update_instance($instance);
$gradeitem = grade_item::fetch($gradeitemparams);
$cell = $column->get_item_cell($gradeitem, array());
$this->assertEquals(GRADE_TYPE_TEXT, $gradeitem->gradetype);
$this->assertEquals(null, $gradeitem->scaleid);
$this->assertEquals(' - ', $cell->text, 'Grade text matches empty value of " - "');
}
开发者ID:covex-nn,项目名称:moodle,代码行数:50,代码来源:edittreelib_test.php
示例19: assignsubmission_onenote_pluginfile
/**
* Serves assignment submissions and other files.
*
* @param mixed $course course or id of the course
* @param mixed $cm course module or id of the course module
* @param context $context
* @param string $filearea
* @param array $args
* @param bool $forcedownload
* @return bool false if file not found, does not return if found - just send the file
*/
function assignsubmission_onenote_pluginfile($course, $cm, context $context, $filearea, $args, $forcedownload)
{
global $DB, $CFG;
if ($context->contextlevel != CONTEXT_MODULE) {
return false;
}
require_login($course, false, $cm);
$itemid = (int) array_shift($args);
$record = $DB->get_record('assign_submission', array('id' => $itemid), 'userid, assignment, groupid', MUST_EXIST);
$userid = $record->userid;
$groupid = $record->groupid;
require_once $CFG->dirroot . '/mod/assign/locallib.php';
$assign = new assign($context, $cm, $course);
if ($assign->get_instance()->id != $record->assignment) {
return false;
}
if ($assign->get_instance()->teamsubmission && !$assign->can_view_group_submission($groupid)) {
return false;
}
if (!$assign->get_instance()->teamsubmission && !$assign->can_view_submission($userid)) {
return false;
}
$relativepath = implode('/', $args);
$fullpath = "/{$context->id}/assignsubmission_onenote/{$filearea}/{$itemid}/{$relativepath}";
$fs = get_file_storage();
if (!($file = $fs->get_file_by_hash(sha1($fullpath))) || $file->is_directory()) {
return false;
}
// Download MUST be forced - security!
send_stored_file($file, 0, 0, true);
}
开发者ID:eugeneventer,项目名称:o365-moodle,代码行数:42,代码来源:lib.php
示例20: can_upgrade_assignment
/**
* This function is a static wrapper around can_upgrade
*
* @param string $type The plugin type
* @param int $version The plugin version
* @return bool
*/
public static function can_upgrade_assignment($type, $version) {
$assignment = new assign(null, null, null);
return $assignment->can_upgrade($type, $version);
}
开发者ID:netspotau,项目名称:moodle-mod_assign,代码行数:11,代码来源:locallib.php
注:本文中的assign类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论