Пример #1
0
// (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/>.
/**
 * User evidence (evidence of prior learning).
 *
 * @package    tool_lp
 * @copyright  2015 Frédéric Massart - FMCorz.net
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */
require_once __DIR__ . '/../../../config.php';
require_login(null, false);
if (isguestuser()) {
    throw new require_login_exception('Guests are not allowed here.');
}
\core_competency\api::require_enabled();
$userid = optional_param('userid', $USER->id, PARAM_INT);
$url = new moodle_url('/admin/tool/lp/user_evidence_list.php', array('userid' => $userid));
list($title, $subtitle) = \tool_lp\page_helper::setup_for_user_evidence($userid, $url);
$output = $PAGE->get_renderer('tool_lp');
echo $output->header();
echo $output->heading($title);
$page = new \tool_lp\output\user_evidence_list_page($userid);
echo $output->render($page);
echo $output->footer();
Пример #2
0
// (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/>.
/**
 * User evidence (evidence of prior learning).
 *
 * @package    tool_lp
 * @copyright  2015 Frédéric Massart - FMCorz.net
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */
require_once __DIR__ . '/../../../config.php';
require_login(null, false);
if (isguestuser()) {
    throw new require_login_exception('Guests are not allowed here.');
}
\core_competency\api::require_enabled();
$id = required_param('id', PARAM_INT);
$userevidence = \core_competency\api::read_user_evidence($id);
$url = new moodle_url('/admin/tool/lp/user_evidence.php', array('id' => $id));
list($title, $subtitle) = \tool_lp\page_helper::setup_for_user_evidence($userevidence->get_userid(), $url, $userevidence);
$output = $PAGE->get_renderer('tool_lp');
echo $output->header();
$page = new \tool_lp\output\user_evidence_page($userevidence);
echo $output->render($page);
echo $output->footer();
Пример #3
0
$userid = optional_param('userid', $USER->id, PARAM_INT);
$id = optional_param('id', null, PARAM_INT);
$returntype = optional_param('return', null, PARAM_ALPHA);
$url = new moodle_url('/admin/tool/lp/user_evidence_edit.php', array('id' => $id, 'userid' => $userid, 'return' => $returntype));
$userevidence = null;
if (empty($id)) {
    $pagetitle = get_string('addnewuserevidence', 'tool_lp');
    list($title, $subtitle, $returnurl) = \tool_lp\page_helper::setup_for_user_evidence($userid, $url, null, $pagetitle, $returntype);
} else {
    $userevidence = \core_competency\api::read_user_evidence($id);
    // The userid parameter must be the same as the owner of the evidence.
    if ($userid != $userevidence->get_userid()) {
        throw new coding_exception('Inconsistency between the userid parameter and the userid of the plan.');
    }
    $pagetitle = get_string('edituserevidence', 'tool_lp');
    list($title, $subtitle, $returnurl) = \tool_lp\page_helper::setup_for_user_evidence($userid, $url, $userevidence, $pagetitle, $returntype);
}
// The context has been set to the user context in the page_helper.
$context = $PAGE->context;
$fileareaoptions = array('subdirs' => false);
$customdata = array('fileareaoptions' => $fileareaoptions, 'persistent' => $userevidence, 'userid' => $userid);
// Check if user has permissions to manage user evidence.
if ($userevidence != null) {
    if (!$userevidence->can_manage()) {
        throw new required_capability_exception($context, 'moodle/competency:userevidencemanage', 'nopermissions', '');
    }
    $customdata['evidence'] = $userevidence;
} else {
    if (!\core_competency\user_evidence::can_manage_user($userid)) {
        throw new required_capability_exception($context, 'moodle/competency:userevidencemanage', 'nopermissions', '');
    }