示例#1
0
文件: index.php 项目: pzhu2004/moodle
// You should have received a copy of the GNU General Public License
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
/**
 * Displays information about all the assignment modules in the requested course
 *
 * @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';
// For this type of page this is the course id.
$id = required_param('id', PARAM_INT);
$course = $DB->get_record('course', array('id' => $id), '*', MUST_EXIST);
require_login($course);
$PAGE->set_url('/mod/assign/index.php', array('id' => $id));
$PAGE->set_pagelayout('incourse');
\mod_assign\event\course_module_instance_list_viewed::create_from_course($course)->trigger();
// Print the header.
$strplural = get_string("modulenameplural", "assign");
$PAGE->navbar->add($strplural);
$PAGE->set_title($strplural);
$PAGE->set_heading($course->fullname);
echo $OUTPUT->header();
echo $OUTPUT->heading(format_string($strplural));
$context = context_course::instance($course->id);
require_capability('mod/assign:view', $context);
$assign = new assign($context, null, $course);
// Get the assign to render the page.
echo $assign->view('viewcourseindex');
示例#2
0
文件: lib.php 项目: dg711/moodle
/**
 * Serve the grading panel as a fragment.
 *
 * @param array $args List of named arguments for the fragment loader.
 * @return string
 */
function mod_assign_output_fragment_gradingpanel($args)
{
    global $CFG;
    $context = $args['context'];
    if ($context->contextlevel != CONTEXT_MODULE) {
        return null;
    }
    require_once $CFG->dirroot . '/mod/assign/locallib.php';
    $assign = new assign($context, null, null);
    $userid = clean_param($args['userid'], PARAM_INT);
    $attemptnumber = clean_param($args['attemptnumber'], PARAM_INT);
    $formdata = array();
    if (!empty($args['jsonformdata'])) {
        $serialiseddata = json_decode($args['jsonformdata']);
        parse_str($serialiseddata, $formdata);
    }
    $viewargs = array('userid' => $userid, 'attemptnumber' => $attemptnumber, 'formdata' => $formdata);
    return $assign->view('gradingpanel', $viewargs);
}
示例#3
0
// 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));