本文整理汇总了PHP中get_max_upload_file_size函数 的典型用法代码示例。如果您正苦于以下问题:PHP get_max_upload_file_size函数的具体用法?PHP get_max_upload_file_size怎么用?PHP get_max_upload_file_size使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_max_upload_file_size函数 的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: definition
public function definition()
{
global $CFG, $OUTPUT, $COURSE;
$accepted_types = '.pdf';
if ($CFG->emarking_enabledigitizedzipfile) {
$accepted_types .= ',.zip';
}
// Options for uploading the zip file within the form.
$options = array('subdirs' => 0, 'maxbytes' => get_max_upload_file_size($CFG->maxbytes, $COURSE->maxbytes, $COURSE->maxbytes), 'maxfiles' => 1, 'accepted_types' => $accepted_types, 'return_types' => FILE_INTERNAL);
$mform = $this->_form;
$instance = $this->_customdata;
// Header.
$mform->addElement('header', 'digitizedfilepdf', get_string('uploadanswers', 'mod_emarking'));
$mform->addHelpButton('digitizedfilepdf', 'digitizedfile', 'mod_emarking');
// The course module id.
$mform->addElement('hidden', 'id', $instance['coursemoduleid']);
$mform->setType('id', PARAM_INT);
// The activity id.
$mform->addElement('hidden', 'emarkingid', $instance['emarkingid']);
$mform->setType('emarkingid', PARAM_INT);
// File picker for the digitized answers.
$mform->addElement('filepicker', 'assignment_file', get_string('uploadexamfile', 'mod_emarking'), null, $options);
$mform->setType('assignment_file', PARAM_FILE);
$mform->addHelpButton('assignment_file', 'filerequiredpdf', 'mod_emarking');
$mform->addRule('assignment_file', get_string('filerequiredpdf', 'mod_emarking'), 'required');
// Header.
$mform->addElement('static', 'qrprocessing_help', '', $OUTPUT->heading(get_string('usedigitizedzipfile', 'mod_emarking'), 4));
$mform->setAdvanced('qrprocessing_help');
// Link to desktop tool.
$desktoplink = html_writer::link(new moodle_url('/mod/emarking/emarkingdesktop.zip'), get_string('qrprocessing', 'mod_emarking'));
$mform->addElement('static', 'qrprocessing', '', $desktoplink);
$mform->setAdvanced('qrprocessing');
// Action buttons.
$this->add_action_buttons(true, get_string('processtitle', 'mod_emarking'));
}
开发者ID:hansnok, 项目名称:emarking, 代码行数:35, 代码来源:upload_form.php
示例2: definition
function definition()
{
global $USER, $CFG, $COURSE;
$mform =& $this->_form;
$mform->addElement('text', 'name', get_string('groupname', 'group'), 'maxlength="254" size="50"');
$mform->addRule('name', get_string('required'), 'required', null, 'client');
$mform->setType('name', PARAM_MULTILANG);
$mform->addElement('htmleditor', 'description', get_string('groupdescription', 'group'), array('rows' => '15', 'course' => $COURSE->id, 'cols' => '45'));
$mform->setType('description', PARAM_RAW);
$mform->addElement('passwordunmask', 'enrolmentkey', get_string('enrolmentkey', 'group'), 'maxlength="254" size="24"', get_string('enrolmentkey'));
$mform->setHelpButton('enrolmentkey', array('groupenrolmentkey', get_string('enrolmentkey', 'group')), true);
$mform->setType('enrolmentkey', PARAM_RAW);
$maxbytes = get_max_upload_file_size($CFG->maxbytes, $COURSE->maxbytes);
if (!empty($CFG->gdversion) and $maxbytes) {
$options = array(get_string('no'), get_string('yes'));
$mform->addElement('select', 'hidepicture', get_string('hidepicture'), $options);
$this->set_upload_manager(new upload_manager('imagefile', false, false, null, false, 0, true, true, false));
$mform->addElement('file', 'imagefile', get_string('newpicture', 'group'));
$mform->setHelpButton('imagefile', array('picture', get_string('helppicture')), true);
}
$mform->addElement('hidden', 'id');
$mform->setType('id', PARAM_INT);
$mform->addElement('hidden', 'courseid');
$mform->setType('courseid', PARAM_INT);
$this->add_action_buttons();
}
开发者ID:JackCanada, 项目名称:moodle-hacks, 代码行数:26, 代码来源:group_form.php
示例3: definition
/**
* Form definition
*/
public function definition()
{
$mform = $this->_form;
$data = (object) $this->_customdata;
$mform->addElement('hidden', 'returnurl');
$mform->setType('returnurl', PARAM_URL);
$mform->addElement('header', 'cohortfileuploadform', get_string('uploadafile'));
$filepickeroptions = array();
$filepickeroptions['filetypes'] = '*';
$filepickeroptions['maxbytes'] = get_max_upload_file_size();
$mform->addElement('filepicker', 'cohortfile', get_string('file'), null, $filepickeroptions);
$choices = csv_import_reader::get_delimiter_list();
$mform->addElement('select', 'delimiter', get_string('csvdelimiter', 'tool_uploadcourse'), $choices);
if (array_key_exists('cfg', $choices)) {
$mform->setDefault('delimiter', 'cfg');
} else {
if (get_string('listsep', 'langconfig') == ';') {
$mform->setDefault('delimiter', 'semicolon');
} else {
$mform->setDefault('delimiter', 'comma');
}
}
$mform->addHelpButton('delimiter', 'csvdelimiter', 'tool_uploadcourse');
$choices = core_text::get_encodings();
$mform->addElement('select', 'encoding', get_string('encoding', 'tool_uploadcourse'), $choices);
$mform->setDefault('encoding', 'UTF-8');
$mform->addHelpButton('encoding', 'encoding', 'tool_uploadcourse');
$options = $this->get_context_options();
$mform->addElement('select', 'contextid', get_string('defaultcontext', 'cohort'), $options);
$this->add_cohort_upload_buttons(true);
$this->set_data($data);
}
开发者ID:evltuma, 项目名称:moodle, 代码行数:35, 代码来源:upload_form.php
示例4: definition
/**
* Called from Moodle to define this form
*
* @return void
*/
function definition()
{
global $CFG;
$mform =& $this->_form;
/*$stringman = get_string_manager();
$ejsapp_strings = $stringman->load_component_strings('ejsapp', current_language());*/
// Adding atto_ejsapp settings by adding more fieldsets
$mform->addElement('header', 'conf_parameters', get_string('jar_file', 'ejsapp'));
$mform->addElement('hidden', 'class_file', null);
$mform->setType('class_file', PARAM_TEXT);
$mform->setDefault('class_file', 'null');
$mform->addElement('hidden', 'codebase', null);
$mform->setType('codebase', PARAM_TEXT);
$mform->setDefault('codebase', 'null');
$mform->addElement('hidden', 'mainframe', null);
$mform->setType('mainframe', PARAM_TEXT);
$mform->setDefault('mainframe', 'null');
$mform->addElement('hidden', 'is_collaborative', null);
$mform->setType('is_collaborative', PARAM_TEXT);
$mform->setDefault('is_collaborative', 0);
$mform->addElement('hidden', 'manifest', null);
$mform->setType('manifest', PARAM_TEXT);
$mform->setDefault('manifest', '');
$mform->addElement('hidden', 'applet_name', null);
$mform->setType('applet_name', PARAM_TEXT);
$mform->setDefault('applet_name', '');
$maxbytes = get_max_upload_file_size($CFG->maxbytes);
$mform->addElement('filemanager', 'appletfile', get_string('file'), null, array('subdirs' => 0, 'maxbytes' => $maxbytes, 'maxfiles' => 1, 'accepted_types' => array('application/java-archive', 'application/zip')));
$mform->addRule('appletfile', get_string('appletfile_required', 'ejsapp'), 'required');
$mform->addHelpButton('appletfile', 'appletfile', 'ejsapp');
$mform->addElement('header', 'size_header', get_string('size_header', 'atto_ejsapp'));
$mform->setExpanded('size_header', false);
$mform->addElement('select', 'applet_size_conf', get_string('applet_size_conf', 'ejsapp'), array(get_string('preserve_applet_size', 'ejsapp'), get_string('moodle_resize', 'ejsapp'), get_string('user_resize', 'ejsapp')));
$mform->addHelpButton('applet_size_conf', 'applet_size_conf', 'ejsapp');
$mform->addElement('selectyesno', 'preserve_aspect_ratio', get_string('preserve_aspect_ratio', 'ejsapp'));
$mform->addHelpButton('preserve_aspect_ratio', 'preserve_aspect_ratio', 'ejsapp');
$mform->disabledIf('preserve_aspect_ratio', 'applet_size_conf', 'neq', 2);
$mform->addElement('text', 'custom_width', get_string('custom_width', 'ejsapp'), array('size' => '3'));
$mform->setType('custom_width', PARAM_INT);
$mform->disabledIf('custom_width', 'applet_size_conf', 'neq', 2);
$mform->addElement('text', 'custom_height', get_string('custom_height', 'ejsapp'), array('size' => '3'));
$mform->setType('custom_height', PARAM_INT);
$mform->disabledIf('custom_height', 'applet_size_conf', 'neq', 2);
$mform->disabledIf('custom_height', 'preserve_aspect_ratio', 'eq', 1);
$mform->addElement('header', 'state_file', get_string('state_file', 'ejsapp'));
$mform->setExpanded('state_file', false);
$mform->addElement('filemanager', 'statefile', get_string('file'), null, array('subdirs' => 0, 'maxbytes' => $maxbytes, 'maxfiles' => 1, 'accepted_types' => array('application/xml', 'application/json')));
$mform->addHelpButton('statefile', 'statefile', 'ejsapp');
$mform->addElement('header', 'controller_file', get_string('controller_file', 'ejsapp'));
$mform->setExpanded('controller_file', false);
$mform->addElement('filemanager', 'controllerfile', get_string('file'), null, array('subdirs' => 0, 'maxbytes' => $maxbytes, 'maxfiles' => 1, 'accepted_types' => '.cnt'));
$mform->addHelpButton('controllerfile', 'controllerfile', 'ejsapp');
$mform->addElement('header', 'recording_file', get_string('recording_file', 'ejsapp'));
$mform->setExpanded('recording_file', false);
$mform->addElement('filemanager', 'recordingfile', get_string('file'), null, array('subdirs' => 0, 'maxbytes' => $maxbytes, 'maxfiles' => 1, 'accepted_types' => '.rec'));
$mform->addHelpButton('recordingfile', 'recordingfile', 'ejsapp');
$this->add_action_buttons();
}
开发者ID:UNEDLabs, 项目名称:moodle-atto_ejsapp, 代码行数:63, 代码来源:ejsappdialog_form.php
示例5: MoodleQuickForm_filepicker
function MoodleQuickForm_filepicker($elementName=null, $elementLabel=null, $attributes=null, $options=null) {
global $CFG;
$options = (array)$options;
foreach ($options as $name=>$value) {
if (array_key_exists($name, $this->_options)) {
$this->_options[$name] = $value;
}
}
if (!empty($options['maxbytes'])) {
$this->_options['maxbytes'] = get_max_upload_file_size($CFG->maxbytes, $options['maxbytes']);
}
parent::HTML_QuickForm_input($elementName, $elementLabel, $attributes);
}
开发者ID:nottmoo, 项目名称:moodle, 代码行数:14, 代码来源:filepicker.php
示例6: definition
/**
* Form definition
*/
function definition()
{
$mform =& $this->_form;
$data = $this->_customdata;
//fill in the data depending on page params
//later using set_data
$mform->addElement('header', 'general');
$filepickeroptions = array();
$filepickeroptions['filetypes'] = '*';
$filepickeroptions['maxbytes'] = get_max_upload_file_size();
$mform->addElement('filepicker', 'userfile', get_string('import'), null, $filepickeroptions);
$mform->addElement('hidden', 'id');
$this->add_action_buttons(true, get_string('importgroups', 'core_group'));
$this->set_data($data);
}
开发者ID:JP-Git, 项目名称:moodle, 代码行数:18, 代码来源:import_form.php
示例7: saveSimulationFilesToDraft
/**
* Saves the simulation file into the draft area
* @return boolean
*/
public function saveSimulationFilesToDraft($CFG, $context, $draftitemid_applet)
{
$result = false;
$this->maxbytes = get_max_upload_file_size($CFG->maxbytes);
//Obtains the folder number to store the file
while (file_exists($this->folderpath . $this->incremental)) {
$this->incremental++;
}
//Saves the file in draft area
if ($draftitemid_applet) {
file_save_draft_area_files($draftitemid_applet, $context->id, 'atto_ejsapp', 'jarfiles', $this->incremental, array('subdirs' => 0, 'maxbytes' => $this->maxbytes, 'maxfiles' => 1, 'accepted_types' => array('application/java-archive', 'application/zip')));
$result = true;
}
return $result;
}
开发者ID:UNEDLabs, 项目名称:moodle-atto_ejsapp, 代码行数:19, 代码来源:atto_ejss_simulation.php
示例8: upload_manager
/**
* Constructor, sets up configuration stuff so we know how to act.
*
* Note: destination not taken as parameter as some modules want to use the insertid in the path and we need to check the other stuff first.
*
* @uses $CFG
* @param string $inputname If this is given the upload manager will only process the file in $_FILES with this name.
* @param boolean $deleteothers Whether to delete other files in the destination directory (optional, defaults to false)
* @param boolean $handlecollisions Whether to use {@link handle_filename_collision()} or not. (optional, defaults to false)
* @param boolean $recoverifmultiple If we come across a virus, or if a file doesn't validate or whatever, do we continue? optional, defaults to true.
* @param int $maxbytes max bytes for this file {@link get_max_upload_file_size()}.
* @param boolean $silent Whether to notify errors or not.
* @param boolean $allownull Whether we care if there's no file when we've set the input name.
* @param boolean $allownullmultiple Whether we care if there's no files AT ALL when we've got multiples. This won't complain if we have file 1 and file 3 but not file 2, only for NO FILES AT ALL.
*/
function upload_manager($inputname = '', $deleteothers = false, $handlecollisions = false, $recoverifmultiple = false, $maxbytes = 0, $silent = false, $allownull = false, $allownullmultiple = true)
{
global $CFG;
$this->config->deleteothers = $deleteothers;
$this->config->handlecollisions = $handlecollisions;
$this->config->recoverifmultiple = $recoverifmultiple;
$this->config->maxbytes = get_max_upload_file_size($maxbytes);
$this->config->silent = $silent;
$this->config->allownull = $allownull;
$this->files = array();
$this->status = false;
$this->inputname = $inputname;
if (empty($this->inputname)) {
$this->config->allownull = $allownullmultiple;
}
}
开发者ID:BackupTheBerlios, 项目名称:yupana, 代码行数:31, 代码来源:uploadlib.php
示例9: get_content
function get_content()
{
global $PAGE, $CFG, $OUTPUT, $COURSE;
if ($this->content !== NULL) {
return $this->content;
}
if (!$PAGE->user_is_editing()) {
return NULL;
}
$this->content = new stdClass();
$this->content->footer = null;
$this->content->text = '<div id="dndupload-status"><noscript>' . get_string('noscript', 'block_dndupload') . '</noscript></div>';
$context = get_context_instance(CONTEXT_COURSE, $COURSE->id);
if (!has_capability('moodle/course:managefiles', $context)) {
$this->content->text = '<div id="dndupload-status">' . get_string('nopermission', 'block_dndupload') . '</div>';
return $this->content;
}
$jsmodule = array('name' => 'block_dndupload', 'fullpath' => new moodle_url('/blocks/dndupload/dndupload.js'), 'strings' => array(array('addhere', 'block_dndupload'), array('addlinkhere', 'block_dndupload'), array('addwebpagehere', 'block_dndupload'), array('dndworking', 'block_dndupload'), array('filetoolarge', 'block_dndupload'), array('nameforlink', 'block_dndupload'), array('nameforwebpage', 'block_dndupload'), array('nofilereader', 'block_dndupload'), array('noajax', 'block_dndupload')));
$vars = array(sesskey(), $CFG->wwwroot . '/blocks/dndupload', $COURSE->id, $OUTPUT->pix_url('i/ajaxloader') . '', get_max_upload_file_size($CFG->maxbytes, $COURSE->maxbytes), $OUTPUT->pix_url('t/addfile') . '');
$PAGE->requires->js_init_call('M.blocks_dndupload.init', $vars, true, $jsmodule);
return $this->content;
}
开发者ID:rlorenzo, 项目名称:moodle-block_dndupload, 代码行数:22, 代码来源:block_dndupload.php
示例10: upload_manager
/**
* Constructor, sets up configuration stuff so we know how to act.
*
* Note: destination not taken as parameter as some modules want to use the insertid in the path and we need to check the other stuff first.
*
* @uses $CFG
* @param string $inputname If this is given the upload manager will only process the file in $_FILES with this name.
* @param boolean $deleteothers Whether to delete other files in the destination directory (optional, defaults to false)
* @param boolean $handlecollisions Whether to use {@link handle_filename_collision()} or not. (optional, defaults to false)
* @param course $course The course the files are being uploaded for (for logging and virus notifications) {@link $COURSE}
* @param boolean $recoverifmultiple If we come across a virus, or if a file doesn't validate or whatever, do we continue? optional, defaults to true.
* @param int $modbytes Max bytes for this module - this and $course->maxbytes are used to get the maxbytes from {@link get_max_upload_file_size()}.
* @param boolean $silent Whether to notify errors or not.
* @param boolean $allownull Whether we care if there's no file when we've set the input name.
* @param boolean $allownullmultiple Whether we care if there's no files AT ALL when we've got multiples. This won't complain if we have file 1 and file 3 but not file 2, only for NO FILES AT ALL.
*/
function upload_manager($inputname = '', $deleteothers = false, $handlecollisions = false, $course = null, $recoverifmultiple = false, $modbytes = 0, $silent = false, $allownull = false, $allownullmultiple = true)
{
global $CFG, $SITE;
if (empty($course->id)) {
$course = $SITE;
}
$this->config = new stdClass();
// instantiate $this->config explicitely
$this->config->deleteothers = $deleteothers;
$this->config->handlecollisions = $handlecollisions;
$this->config->recoverifmultiple = $recoverifmultiple;
$this->config->maxbytes = get_max_upload_file_size($CFG->maxbytes, $course->maxbytes, $modbytes);
$this->config->silent = $silent;
$this->config->allownull = $allownull;
$this->files = array();
$this->status = false;
$this->course = $course;
$this->inputname = $inputname;
if (empty($this->inputname)) {
$this->config->allownull = $allownullmultiple;
}
}
开发者ID:r007, 项目名称:PMoodle, 代码行数:38, 代码来源:uploadlib.php
示例11: MoodleQuickForm_filepicker
/**
* Constructor
*
* @param string $elementName (optional) name of the filepicker
* @param string $elementLabel (optional) filepicker label
* @param array $attributes (optional) Either a typical HTML attribute string
* or an associative array
* @param array $options set of options to initalize filepicker
*/
function MoodleQuickForm_filepicker($elementName = null, $elementLabel = null, $attributes = null, $options = null)
{
global $CFG, $PAGE;
$options = (array) $options;
foreach ($options as $name => $value) {
if (array_key_exists($name, $this->_options)) {
$this->_options[$name] = $value;
}
}
if (empty($options['return_types'])) {
$this->_options['return_types'] = FILE_INTERNAL;
}
$fpmaxbytes = 0;
if (!empty($options['maxbytes'])) {
$fpmaxbytes = $options['maxbytes'];
}
$coursemaxbytes = 0;
if (!empty($PAGE->course)) {
$coursemaxbytes = $PAGE->course->maxbytes;
}
$this->_options['maxbytes'] = get_max_upload_file_size($CFG->maxbytes, $coursemaxbytes, $fpmaxbytes);
$this->_type = 'filepicker';
parent::HTML_QuickForm_input($elementName, $elementLabel, $attributes);
}
开发者ID:nicusX, 项目名称:moodle, 代码行数:33, 代码来源:filepicker.php
示例12: require_once
if ($repository = $DB->get_record_sql($sql, array($repo_id))) {
$type = $repository->type;
if (file_exists($CFG->dirroot.'/repository/'.$type.'/lib.php')) {
require_once($CFG->dirroot.'/repository/'.$type.'/lib.php');
$classname = 'repository_' . $type;
try {
$repo = new $classname($repo_id, $contextid, array('ajax'=>false, 'name'=>$repository->name, 'type'=>$type));
} catch (repository_exception $e){
print_error('pluginerror', 'repository');
}
} else {
print_error('invalidplugin', 'repository');
}
}
$moodle_maxbytes = get_max_upload_file_size();
// to prevent maxbytes greater than moodle maxbytes setting
if ($maxbytes == 0 || $maxbytes>=$moodle_maxbytes) {
$maxbytes = $moodle_maxbytes;
}
$params = array('ctx_id' => $contextid, 'itemid' => $itemid, 'env' => $env, 'course'=>$courseid, 'maxbytes'=>$maxbytes, 'maxfiles'=>$maxfiles, 'subdirs'=>$subdirs, 'sesskey'=>sesskey());
$params['action'] = 'browse';
$params['draftpath'] = $draftpath;
$home_url = new moodle_url('/repository/draftfiles_manager.php', $params);
$params['savepath'] = $savepath;
$params['repo_id'] = $repo_id;
$url = new moodle_url($CFG->httpswwwroot."/repository/filepicker.php", $params);
$PAGE->set_url('/repository/filepicker.php', $params);
开发者ID:nicusX, 项目名称:moodle, 代码行数:30, 代码来源:filepicker.php
示例13: moodle_exception
throw new moodle_exception('upload_error_no_tmp_dir', 'repository_upload');
break;
case UPLOAD_ERR_CANT_WRITE:
throw new moodle_exception('upload_error_cant_write', 'repository_upload');
break;
case UPLOAD_ERR_EXTENSION:
throw new moodle_exception('upload_error_extension', 'repository_upload');
break;
default:
throw new moodle_exception('nofile');
}
}
$file = new stdClass();
$file->filename = clean_param($_FILES[$fieldname]['name'], PARAM_FILE);
// check system maxbytes setting
if (($_FILES[$fieldname]['size'] > get_max_upload_file_size($CFG->maxbytes))) {
// oversize file will be ignored, error added to array to notify
// web service client
$file->errortype = 'fileoversized';
$file->error = get_string('maxbytes', 'error');
} else {
$file->filepath = $_FILES[$fieldname]['tmp_name'];
// calculate total size of upload
$totalsize += $_FILES[$fieldname]['size'];
}
$files[] = $file;
}
$fs = get_file_storage();
$usedspace = 0;
开发者ID:raymondAntonio, 项目名称:moodle, 代码行数:31, 代码来源:upload.php
示例14: unset
$return = $SESSION->returnpage;
unset($SESSION->returnpage);
redirect($return);
} else {
redirect(new moodle_url('/mod/referentiel/activite.php', array('id' => $cm->id, 'userid' => $userid, 'activite_id' => $activite_id, 'mailnow' => $mailnow, 'mode' => 'listactivityall', 'filtre_auteur' => $data_filtre->filtre_auteur, 'filtre_validation' => $data_filtre->filtre_validation, 'filtre_referent' => $data_filtre->filtre_referent, 'filtre_date_modif' => $data_filtre->filtre_date_modif, 'filtre_date_modif_student' => $data_filtre->filtre_date_modif_student)));
}
}
$PAGE->set_url($url);
$PAGE->set_context($context);
$title = strip_tags($course->fullname . ': ' . get_string('modulename', 'referentiel') . ': ' . format_string($referentiel->name, true));
$PAGE->set_title($title);
$PAGE->set_heading($title);
// DEBUG
// echo "<br />upload_Mooddle2.php :: 151 :: activite_id:: $activite_id\n";
// exit;
$options = array('subdirs' => 0, 'maxbytes' => get_max_upload_file_size($CFG->maxbytes, $course->maxbytes, $maxbytes), 'maxfiles' => 1, 'accepted_types' => '*', 'return_types' => FILE_INTERNAL);
$mform = new mod_referentiel_upload_form(null, array('d' => $referentiel->id, 'contextid' => $context->id, 'userid' => $USER->id, 'activiteid' => $activite_id, 'filearea' => 'document', 'msg' => get_string('document_associe', 'referentiel'), 'mailnow' => $mailnow, 'options' => $options));
if ($mform->is_cancelled()) {
redirect(new moodle_url('/mod/referentiel/activite.php', array('id' => $cm->id, 'userid' => $USER->id, 'activite_id' => $activite_id, 'mailnow' => $mailnow, 'mode' => 'listactivityall', 'filtre_auteur' => $data_filtre->filtre_auteur, 'filtre_validation' => $data_filtre->filtre_validation, 'filtre_referent' => $data_filtre->filtre_referent, 'filtre_date_modif' => $data_filtre->filtre_date_modif, 'filtre_date_modif_student' => $data_filtre->filtre_date_modif_student)));
} else {
if ($mform->get_data()) {
// A TERMINER
referentiel_upload_document($mform, $referentiel->id);
die;
// redirect(new moodle_url('/mod/referentiel/view.php', array('id'=>$cm->id)));
}
}
echo $OUTPUT->header();
echo $OUTPUT->box_start('generalbox');
$mform->display();
echo $OUTPUT->box_end();
开发者ID:OctaveBabel, 项目名称:moodle-itop, 代码行数:31, 代码来源:upload_moodle2.php
示例15: test_get_max_upload_sizes
public function test_get_max_upload_sizes()
{
// Test with very low limits so we are not affected by php upload limits.
// Test activity limit smallest.
$sitebytes = 102400;
$coursebytes = 51200;
$modulebytes = 10240;
$result = get_max_upload_sizes($sitebytes, $coursebytes, $modulebytes);
$this->assertSame('Activity upload limit (10KB)', $result['0']);
$this->assertCount(2, $result);
// Test course limit smallest.
$sitebytes = 102400;
$coursebytes = 10240;
$modulebytes = 51200;
$result = get_max_upload_sizes($sitebytes, $coursebytes, $modulebytes);
$this->assertSame('Course upload limit (10KB)', $result['0']);
$this->assertCount(2, $result);
// Test site limit smallest.
$sitebytes = 10240;
$coursebytes = 102400;
$modulebytes = 51200;
$result = get_max_upload_sizes($sitebytes, $coursebytes, $modulebytes);
$this->assertSame('Site upload limit (10KB)', $result['0']);
$this->assertCount(2, $result);
// Test site limit not set.
$sitebytes = 0;
$coursebytes = 102400;
$modulebytes = 51200;
$result = get_max_upload_sizes($sitebytes, $coursebytes, $modulebytes);
$this->assertSame('Activity upload limit (50KB)', $result['0']);
$this->assertCount(3, $result);
$sitebytes = 0;
$coursebytes = 51200;
$modulebytes = 102400;
$result = get_max_upload_sizes($sitebytes, $coursebytes, $modulebytes);
$this->assertSame('Course upload limit (50KB)', $result['0']);
$this->assertCount(3, $result);
// Test custom bytes in range.
$sitebytes = 102400;
$coursebytes = 51200;
$modulebytes = 51200;
$custombytes = 10240;
$result = get_max_upload_sizes($sitebytes, $coursebytes, $modulebytes, $custombytes);
$this->assertCount(3, $result);
// Test custom bytes in range but non-standard.
$sitebytes = 102400;
$coursebytes = 51200;
$modulebytes = 51200;
$custombytes = 25600;
$result = get_max_upload_sizes($sitebytes, $coursebytes, $modulebytes, $custombytes);
$this->assertCount(4, $result);
// Test custom bytes out of range.
$sitebytes = 102400;
$coursebytes = 51200;
$modulebytes = 51200;
$custombytes = 102400;
$result = get_max_upload_sizes($sitebytes, $coursebytes, $modulebytes, $custombytes);
$this->assertCount(3, $result);
// Test custom bytes out of range and non-standard.
$sitebytes = 102400;
$coursebytes = 51200;
$modulebytes = 51200;
$custombytes = 256000;
$result = get_max_upload_sizes($sitebytes, $coursebytes, $modulebytes, $custombytes);
$this->assertCount(3, $result);
// Test site limit only.
$sitebytes = 51200;
$result = get_max_upload_sizes($sitebytes);
$this->assertSame('Site upload limit (50KB)', $result['0']);
$this->assertSame('50KB', $result['51200']);
$this->assertSame('10KB', $result['10240']);
$this->assertCount(3, $result);
// Test no limit.
$result = get_max_upload_sizes();
$this->assertArrayHasKey('0', $result);
$this->assertArrayHasKey(get_max_upload_file_size(), $result);
}
开发者ID:miguelangelUvirtual, 项目名称:uEducon, 代码行数:77, 代码来源:moodlelib_test.php
示例16: definition
function definition()
{
global $CFG, $COURSE, $OUTPUT;
$cfg_scorm = get_config('scorm');
$mform = $this->_form;
if (!$CFG->slasharguments) {
$mform->addElement('static', '', '', $OUTPUT->notification(get_string('slashargs', 'scorm'), 'notifyproblem'));
}
$zlib = ini_get('zlib.output_compression');
//check for zlib compression - if used, throw error because of IE bug. - SEE MDL-16185
if (isset($zlib) && $zlib) {
$mform->addElement('static', '', '', $OUTPUT->notification(get_string('zlibwarning', 'scorm'), 'notifyproblem'));
}
//-------------------------------------------------------------------------------
$mform->addElement('header', 'general', get_string('general', 'form'));
// Name
$mform->addElement('text', 'name', get_string('name'));
if (!empty($CFG->formatstringstriptags)) {
$mform->setType('name', PARAM_TEXT);
} else {
$mform->setType('name', PARAM_CLEAN);
}
$mform->addRule('name', null, 'required', null, 'client');
// Summary
$this->add_intro_editor(true);
// Scorm types
$options = array(SCORM_TYPE_LOCAL => get_string('typelocal', 'scorm'));
if ($cfg_scorm->allowtypeexternal) {
$options[SCORM_TYPE_EXTERNAL] = get_string('typeexternal', 'scorm');
}
if ($cfg_scorm->allowtypelocalsync) {
$options[SCORM_TYPE_LOCALSYNC] = get_string('typelocalsync', 'scorm');
}
if (!empty($CFG->repositoryactivate) and $cfg_scorm->allowtypeimsrepository) {
$options[SCORM_TYPE_IMSREPOSITORY] = get_string('typeimsrepository', 'scorm');
}
$mform->addElement('select', 'scormtype', get_string('scormtype', 'scorm'), $options);
// Reference
if (count($options) > 1) {
$mform->addElement('text', 'packageurl', get_string('url', 'scorm'), array('size' => 60));
$mform->setType('packageurl', PARAM_RAW);
$mform->setHelpButton('packageurl', array('packagefile', get_string('package', 'scorm'), 'scorm'));
$mform->disabledIf('packageurl', 'scormtype', 'eq', SCORM_TYPE_LOCAL);
}
// New local package upload
$maxbytes = get_max_upload_file_size($CFG->maxbytes, $COURSE->maxbytes);
$mform->setMaxFileSize($maxbytes);
$mform->addElement('file', 'packagefile', get_string('package', 'scorm'));
$mform->disabledIf('packagefile', 'scormtype', 'noteq', SCORM_TYPE_LOCAL);
//-------------------------------------------------------------------------------
// Time restrictions
$mform->addElement('header', 'timerestricthdr', get_string('timerestrict', 'scorm'));
$mform->addElement('checkbox', 'timerestrict', get_string('timerestrict', 'scorm'));
$mform->setHelpButton('timerestrict', array("timerestrict", get_string("timerestrict", "scorm"), "scorm"));
$mform->addElement('date_time_selector', 'timeopen', get_string("scormopen", "scorm"));
$mform->disabledIf('timeopen', 'timerestrict');
$mform->addElement('date_time_selector', 'timeclose', get_string("scormclose", "scorm"));
$mform->disabledIf('timeclose', 'timerestrict');
//-------------------------------------------------------------------------------
// Other Settings
$mform->addElement('header', 'advanced', get_string('othersettings', 'form'));
// Grade Method
$mform->addElement('select', 'grademethod', get_string('grademethod', 'scorm'), scorm_get_grade_method_array());
$mform->setHelpButton('grademethod', array('grademethod', get_string('grademethod', 'scorm'), 'scorm'));
$mform->setDefault('grademethod', $cfg_scorm->grademethod);
// Maximum Grade
for ($i = 0; $i <= 100; $i++) {
$grades[$i] = "{$i}";
}
$mform->addElement('select', 'maxgrade', get_string('maximumgrade'), $grades);
$mform->setDefault('maxgrade', $cfg_scorm->maxgrade);
$mform->disabledIf('maxgrade', 'grademethod', 'eq', GRADESCOES);
// Attempts
$mform->addElement('static', '', '', '<hr />');
// Max Attempts
$mform->addElement('select', 'maxattempt', get_string('maximumattempts', 'scorm'), scorm_get_attempts_array());
$mform->setHelpButton('maxattempt', array('maxattempt', get_string('maximumattempts', 'scorm'), 'scorm'));
$mform->setDefault('maxattempt', $cfg_scorm->maxattempts);
// Display attempt status
$mform->addElement('selectyesno', 'displayattemptstatus', get_string('displayattemptstatus', 'scorm'));
$mform->setHelpButton('displayattemptstatus', array('displayattemptstatus', get_string('displayattemptstatus', 'scorm'), 'scorm'));
$mform->setDefault('displayattemptstatus', $cfg_scorm->displayattemptstatus);
// Display course structure
$mform->addElement('selectyesno', 'displaycoursestructure', get_string('displaycoursestructure', 'scorm'));
$mform->setHelpButton('displaycoursestructure', array('displaycoursestructure', get_string('displaycoursestructure', 'scorm'), 'scorm'));
$mform->setDefault('displaycoursestructure', $cfg_scorm->displaycoursestructure);
// Force completed
$mform->addElement('selectyesno', 'forcecompleted', get_string('forcecompleted', 'scorm'));
$mform->setHelpButton('forcecompleted', array('forcecompleted', get_string('forcecompleted', 'scorm'), 'scorm'));
$mform->setDefault('forcecompleted', $cfg_scorm->forcecompleted);
$mform->setAdvanced('forcecompleted');
// Force new attempt
$mform->addElement('selectyesno', 'forcenewattempt', get_string('forcenewattempt', 'scorm'));
$mform->setHelpButton('forcenewattempt', array('forcenewattempt', get_string('forcenewattempt', 'scorm'), 'scorm'));
$mform->setDefault('forcenewattempt', $cfg_scorm->forcenewattempt);
$mform->setAdvanced('forcenewattempt');
// Last attempt lock - lock the enter button after the last available attempt has been made
$mform->addElement('selectyesno', 'lastattemptlock', get_string('lastattemptlock', 'scorm'));
$mform->setHelpButton('lastattemptlock', array('lastattemptlock', get_string('lastattemptlock', 'scorm'), 'scorm'));
$mform->setDefault('lastattemptlock', $cfg_scorm->lastattemptlock);
//.........这里部分代码省略.........
开发者ID:ajv, 项目名称:Offline-Caching, 代码行数:101, 代码来源:mod_form.php
示例17: render_file_picker
/**
* Internal implementation of file picker rendering.
*
* @param file_picker $fp
* @return string
*/
public function render_file_picker(file_picker $fp) {
global $CFG, $OUTPUT, $USER;
$options = $fp->options;
$client_id = $options->client_id;
$strsaved = get_string('filesaved', 'repository');
$straddfile = get_string('openpicker', 'repository');
$strloading = get_string('loading', 'repository');
$strdndenabled = get_string('dndenabled_inbox', 'moodle');
$strdroptoupload = get_string('droptoupload', 'moodle');
$icon_progress = $OUTPUT->pix_icon('i/loading_small', $strloading).'';
$currentfile = $options->currentfile;
if (empty($currentfile)) {
$currentfile = '';
} else {
$currentfile .= ' - ';
}
if ($options->maxbytes) {
$size = $options->maxbytes;
} else {
$size = get_max_upload_file_size();
}
if ($size == -1) {
$maxsize = '';
} else {
$maxsize = get_string('maxfilesize', 'moodle', display_size($size));
}
if ($options->buttonname) {
$buttonname = ' name="' . $options->buttonname . '"';
} else {
$buttonname = '';
}
$html = <<<EOD
<div class="filemanager-loading mdl-align" id='filepicker-loading-{$client_id}'>
$icon_progress
</div>
<div id="filepicker-wrapper-{$client_id}" class="mdl-left" style="display:none">
<div>
<input type="button" class="fp-btn-choose" id="filepicker-button-{$client_id}" value="{$straddfile}"{$buttonname}/>
<span> $maxsize </span>
</div>
EOD;
if ($options->env != 'url') {
$html .= <<<EOD
<div id="file_info_{$client_id}" class="mdl-left filepicker-filelist" style="position: relative">
<div class="filepicker-filename">
<div class="filepicker-container">$currentfile<div class="dndupload-message">$strdndenabled <br/><div class="dndupload-arrow"></div></div></div>
<div class="dndupload-progressbars"></div>
</div>
<div><div class="dndupload-target">{$strdroptoupload}<br/><div class="dndupload-arrow"></div></div></div>
</div>
EOD;
}
$html .= '</div>';
return $html;
}
开发者ID:afgal, 项目名称:moodle-1, 代码行数:62, 代码来源:outputrenderers.php
示例18: handle_file_upload
/**
* Handle uploads containing files - create the course module, ask the upload repository
* to process the file, ask the mod to set itself up, then return the result to the browser
*/
protected function handle_file_upload()
{
global $CFG;
// Add the file to a draft file area.
$draftitemid = file_get_unused_draft_itemid();
$maxbytes = get_max_upload_file_size($CFG->maxbytes, $this->course->maxbytes);
$types = $this->dnduploadhandler->get_handled_file_types($this->module->name);
$repo = repository::get_instances(array('type' => 'upload'));
if (empty($repo)) {
throw new moodle_exception('errornouploadrepo', 'moodle');
}
$repo = reset($repo);
// Get the first (and only) upload repo.
$details = $repo->process_upload(null, $maxbytes, $types, '/', $draftitemid);
if (empty($this->displayname)) {
$this->displayname = $this->display_name_from_file($details['file']);
}
// Create a course module to hold the new instance.
$this->create_course_module();
// Ask the module to set itself up.
$moduledata = $this->prepare_module_data($draftitemid);
$instanceid = plugin_callback('mod', $this->module->name, 'dndupload', 'handle', array($moduledata), 'invalidfunction');
if ($instanceid === 'invalidfunction') {
throw new coding_exception("{$this->module->name} does not support drag and drop upload (missing {$this->module->name}_dndupload_handle function");
}
// Finish setting up the course module.
$this->finish_setup_course_module($instanceid);
}
开发者ID:vinoth4891, 项目名称:clinique, 代码行数:32, 代码来源:dnduploadlib.php
示例19: get_max_upload_sizes
librespeed/speedtest: Self-hosted Speedtest for HTML5 and more. Easy setup, exam
阅读:1298| 2022-08-30
旧的模板消息将在 2020 年 1 月 10 号全面下架,也就是今天,不过貌似现在还可以用!
阅读:731| 2022-07-18
avehtari/BDA_m_demos: Bayesian Data Analysis demos for Matlab/Octave
阅读:1209| 2022-08-17
女人怀孕后,为了有一个健康聪明的宝宝,经历各种体检、筛查。其实这些体检和筛查中的
阅读:1009| 2022-11-06
The component mcontrol.action in RISCV ISA Sim commit ac466a21df442c59962589ba29
阅读:746| 2022-07-29
medfreeman/markdown-it-toc-and-anchor: markdown-it plugin to add a toc and ancho
阅读:1412| 2022-08-18
A vulnerability, which was classified as problematic, has been found in SourceCo
阅读:644| 2022-07-29
openshift/osin: Golang OAuth2 server library
阅读:993| 2022-08-15
sydney0zq/covid-19-detection: The implementation of A Weakly-supervised Framewor
阅读:519| 2022-08-16
离中国最远的国家是阿根廷。从太平洋直线计算,即往东线走,北京到阿根廷的布宜诺斯艾
阅读:672| 2022-11-06
请发表评论