예제 #1
0
$instance = $vpl->get_instance();
$vpl->print_header(get_string('submission', VPL));
$vpl->print_view_tabs(basename(__FILE__));
$mform = new mod_vpl_submission_form('submission.php', $vpl);
if ($mform->is_cancelled()) {
    vpl_inmediate_redirect(vpl_mod_href('view.php', 'id', $id));
    die;
}
if ($fromform = $mform->get_data()) {
    $raw_POST_size = strlen(file_get_contents("php://input"));
    if ($_SERVER['CONTENT_LENGTH'] != $raw_POST_size) {
        $error = "NOT SAVED (Http POST error: CONTENT_LENGTH expected " . $_SERVER['CONTENT_LENGTH'] . " found {$raw_POST_size})";
        notice($error, vpl_mod_href('forms/submission.php', 'id', $id, 'userid', $userid), $vpl->get_course());
        die;
    }
    $rfn = $vpl->get_required_fgm();
    $minfiles = count($rfn->getFilelist());
    $files = array();
    for ($i = 0; $i < $instance->maxfiles; $i++) {
        $attribute = 'file' . $i;
        $name = $mform->get_new_filename($attribute);
        $data = $mform->get_file_content($attribute);
        if ($data !== false && $name !== false) {
            //autodetect data file encode
            $encode = mb_detect_encoding($data, 'UNICODE, UTF-16, UTF-8, ISO-8859-1', true);
            if ($encode > '') {
                //If code detected
                $data = iconv($encode, 'UTF-8', $data);
            }
            $files[] = array('name' => $name, 'data' => $data);
        } else {
예제 #2
0
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// VPL for 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 VPL for Moodle.  If not, see <http://www.gnu.org/licenses/>.
/**
 * Download required files in ZIP format
 * @package mod_vpl
 * @copyright 2012 Juan Carlos Rodríguez-del-Pino
 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 * @author Juan Carlos Rodríguez-del-Pino <*****@*****.**>
 */
require_once dirname(__FILE__) . '/../../../config.php';
require_once dirname(__FILE__) . '/../locallib.php';
require_once dirname(__FILE__) . '/../vpl.class.php';
require_login();
$id = required_param('id', PARAM_INT);
$vpl = new mod_vpl($id);
$vpl->password_check();
$vpl->network_check();
if (!$vpl->is_visible()) {
    notice(get_string('notavailable'));
}
$filegroup = $vpl->get_required_fgm();
$filegroup->download_files($vpl->get_printable_name());
die;
예제 #3
0
 * @copyright    2012 Juan Carlos Rodríguez-del-Pino
 * @license        http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 * @author        Juan Carlos Rodríguez-del-Pino <*****@*****.**>
 */
require_once dirname(__FILE__) . '/../../../config.php';
require_once dirname(__FILE__) . '/../locallib.php';
require_once dirname(__FILE__) . '/../vpl.class.php';
require_once dirname(__FILE__) . '/../editor/editor_utility.php';
vpl_editor_util::generate_requires();
require_login();
$id = required_param('id', PARAM_INT);
$vpl = new mod_vpl($id);
$instance = $vpl->get_instance();
$vpl->prepare_page('forms/requiredfiles.php', array('id' => $id));
$vpl->require_capability(VPL_MANAGE_CAPABILITY);
$fgp = $vpl->get_required_fgm();
$vpl->print_header(get_string('requestedfiles', VPL));
$vpl->print_heading_with_help('requestedfiles');
$vpl->print_configure_tabs(basename(__FILE__));
//TODO download in zip file
$options = array();
$options['restrictededitor'] = false;
$options['save'] = true;
$options['run'] = false;
$options['debug'] = false;
$options['evaluate'] = false;
$options['ajaxurl'] = "requiredfiles.json.php?id={$id}&action=";
$options['download'] = "../views/downloadrequiredfiles.php?id={$id}";
$options['resetfiles'] = false;
$options['minfiles'] = 0;
$options['maxfiles'] = $instance->maxfiles;
예제 #4
0
$vpl = new mod_vpl($id);
$vpl->prepare_page('similarity/user_similarity.php', array('id' => $id, 'userid' => $userid));
$vpl->require_capability(VPL_SIMILARITY_CAPABILITY);
\mod_vpl\event\vpl_user_similarity_report_viewed::log(array('objectid' => $vpl->get_instance()->id, 'context' => context_module::instance($id), 'relateduserid' => $userid));
//Print header
$PAGE->requires->css(new moodle_url('/mod/vpl/css/similarity.css'));
$vpl->print_header(get_string('listsimilarity', VPL));
$subinstance = $vpl->last_user_submission($userid);
if ($subinstance === false) {
    //No user submission
    $vpl->print_footer();
    die;
}
$submission = new mod_vpl_submission($vpl, $subinstance);
//Get required filenames
$filelist = $vpl->get_required_fgm()->getFileList();
foreach ($filelist as $filename) {
    $filesselected[$filename] = true;
}
//prepare table head
$firstname = get_string('firstname');
$lastname = get_string('lastname');
if ($CFG->fullnamedisplay == 'lastname firstname') {
    $name = $lastname . ' / ' . $firstname;
} else {
    $name = $firstname . ' / ' . $lastname;
}
$with = get_string('similarto', VPL);
$head = array('#', $name, '', $with);
$align = array('right', 'left', 'center', 'left');
$size = array('', '60', '60', '');