本文整理汇总了PHP中assign::update_effective_access方法的典型用法代码示例。如果您正苦于以下问题:PHP assign::update_effective_access方法的具体用法?PHP assign::update_effective_access怎么用?PHP assign::update_effective_access使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类assign
的用法示例。
在下文中一共展示了assign::update_effective_access方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_assignments
//.........这里部分代码省略.........
'm.teamsubmissiongroupingid, ' .
'm.blindmarking, ' .
'm.revealidentities, ' .
'm.attemptreopenmethod, '.
'm.maxattempts, ' .
'm.markingworkflow, ' .
'm.markingallocation, ' .
'm.requiresubmissionstatement, '.
'm.preventsubmissionnotingroup, '.
'm.intro, '.
'm.introformat';
$coursearray = array();
foreach ($courses as $id => $course) {
$assignmentarray = array();
// Get a list of assignments for the course.
if ($modules = get_coursemodules_in_course('assign', $courses[$id]->id, $extrafields)) {
foreach ($modules as $module) {
$context = context_module::instance($module->id);
try {
self::validate_context($context);
require_capability('mod/assign:view', $context);
} catch (Exception $e) {
$warnings[] = array(
'item' => 'module',
'itemid' => $module->id,
'warningcode' => '1',
'message' => 'No access rights in module context'
);
continue;
}
$assign = new assign($context, null, null);
// Update assign with override information.
$assign->update_effective_access($USER->id);
// Get configurations for only enabled plugins.
$plugins = $assign->get_submission_plugins();
$plugins = array_merge($plugins, $assign->get_feedback_plugins());
$configarray = array();
foreach ($plugins as $plugin) {
if ($plugin->is_enabled() && $plugin->is_visible()) {
$configrecords = $plugin->get_config_for_external();
foreach ($configrecords as $name => $value) {
$configarray[] = array(
'plugin' => $plugin->get_type(),
'subtype' => $plugin->get_subtype(),
'name' => $name,
'value' => $value
);
}
}
}
$assignment = array(
'id' => $module->assignmentid,
'cmid' => $module->id,
'course' => $module->course,
'name' => $module->name,
'nosubmissions' => $module->nosubmissions,
'submissiondrafts' => $module->submissiondrafts,
'sendnotifications' => $module->sendnotifications,
'sendlatenotifications' => $module->sendlatenotifications,
'sendstudentnotifications' => $module->sendstudentnotifications,
'duedate' => $assign->get_instance()->duedate,
'allowsubmissionsfromdate' => $assign->get_instance()->allowsubmissionsfromdate,
示例2: view_course_index
/**
* View a summary listing of all assignments in the current course.
*
* @return string
*/
private function view_course_index() {
global $USER;
$o = '';
$course = $this->get_course();
$strplural = get_string('modulenameplural', 'assign');
if (!$cms = get_coursemodules_in_course('assign', $course->id, 'm.duedate')) {
$o .= $this->get_renderer()->notification(get_string('thereareno', 'moodle', $strplural));
$o .= $this->get_renderer()->continue_button(new moodle_url('/course/view.php', array('id' => $course->id)));
return $o;
}
$strsectionname = '';
$usesections = course_format_uses_sections($course->format);
$modinfo = get_fast_modinfo($course);
if ($usesections) {
$strsectionname = get_string('sectionname', 'format_'.$course->format);
$sections = $modinfo->get_section_info_all();
}
$courseindexsummary = new assign_course_index_summary($usesections, $strsectionname);
$timenow = time();
$currentsection = '';
foreach ($modinfo->instances['assign'] as $cm) {
if (!$cm->uservisible) {
continue;
}
$timedue = $cms[$cm->id]->duedate;
$sectionname = '';
if ($usesections && $cm->sectionnum) {
$sectionname = get_section_name($course, $sections[$cm->sectionnum]);
}
$submitted = '';
$context = context_module::instance($cm->id);
$assignment = new assign($context, $cm, $course);
// Apply overrides.
$assignment->update_effective_access($USER->id);
$timedue = $assignment->get_instance()->duedate;
if (has_capability('mod/assign:grade', $context)) {
$submitted = $assignment->count_submissions_with_status(ASSIGN_SUBMISSION_STATUS_SUBMITTED);
} else if (has_capability('mod/assign:submit', $context)) {
$usersubmission = $assignment->get_user_submission($USER->id, false);
if (!empty($usersubmission->status)) {
$submitted = get_string('submissionstatus_' . $usersubmission->status, 'assign');
} else {
$submitted = get_string('submissionstatus_', 'assign');
}
}
$gradinginfo = grade_get_grades($course->id, 'mod', 'assign', $cm->instance, $USER->id);
if (isset($gradinginfo->items[0]->grades[$USER->id]) &&
!$gradinginfo->items[0]->grades[$USER->id]->hidden ) {
$grade = $gradinginfo->items[0]->grades[$USER->id]->str_grade;
} else {
$grade = '-';
}
$courseindexsummary->add_assign_info($cm->id, $cm->get_formatted_name(), $sectionname, $timedue, $submitted, $grade);
}
$o .= $this->get_renderer()->render($courseindexsummary);
$o .= $this->view_footer();
return $o;
}
示例3: 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));