本文整理汇总了PHP中file_area_contains_subdirs函数的典型用法代码示例。如果您正苦于以下问题:PHP file_area_contains_subdirs函数的具体用法?PHP file_area_contains_subdirs怎么用?PHP file_area_contains_subdirs使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了file_area_contains_subdirs函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: editor_options
/**
* Returns the options array to use in twf text editor
*
* @param context_module $context
* @param int $postid post id, use null when adding new post
* @return array
*/
public static function editor_options(context_module $context, $postid)
{
global $COURSE, $PAGE, $CFG;
// TODO: add max files and max size support
$maxbytes = get_user_max_upload_file_size($PAGE->context, $CFG->maxbytes, $COURSE->maxbytes);
return array('maxfiles' => EDITOR_UNLIMITED_FILES, 'maxbytes' => $maxbytes, 'trusttext' => true, 'return_types' => FILE_INTERNAL | FILE_EXTERNAL, 'subdirs' => file_area_contains_subdirs($context, 'mod_twf', 'post', $postid));
}
示例2: foreach
if ($CFG->useblogassociations && ($blogassociations = $DB->get_records('blog_association', array('blogid' => $entry->id)))) {
foreach ($blogassociations as $assocrec) {
$context = context::instance_by_id($assocrec->contextid);
switch ($context->contextlevel) {
case CONTEXT_COURSE:
$entry->courseassoc = $assocrec->contextid;
break;
case CONTEXT_MODULE:
$entry->modassoc = $assocrec->contextid;
break;
}
}
}
}
require_once 'edit_form.php';
$summaryoptions = array('maxfiles' => 99, 'maxbytes' => $CFG->maxbytes, 'trusttext' => true, 'context' => $sitecontext, 'subdirs' => file_area_contains_subdirs($sitecontext, 'blog', 'post', $entry->id));
$attachmentoptions = array('subdirs' => false, 'maxfiles' => 99, 'maxbytes' => $CFG->maxbytes);
$blogeditform = new blog_edit_form(null, compact('entry', 'summaryoptions', 'attachmentoptions', 'sitecontext', 'courseid', 'modid'));
$entry = file_prepare_standard_editor($entry, 'summary', $summaryoptions, $sitecontext, 'blog', 'post', $entry->id);
$entry = file_prepare_standard_filemanager($entry, 'attachment', $attachmentoptions, $sitecontext, 'blog', 'attachment', $entry->id);
if (!empty($CFG->usetags) && !empty($entry->id)) {
include_once $CFG->dirroot . '/tag/lib.php';
$entry->tags = tag_get_tags_array('post', $entry->id);
}
$entry->action = $action;
// set defaults
$blogeditform->set_data($entry);
if ($blogeditform->is_cancelled()) {
redirect($returnurl);
} else {
if ($data = $blogeditform->get_data()) {
示例3: array
$PAGE->set_url('/tag/index.php', array('id' => $tag->id));
$PAGE->set_subpage($tag->id);
$PAGE->set_context($systemcontext);
$PAGE->set_blocks_editing_capability('moodle/tag:editblocks');
$PAGE->set_pagelayout('base');
$tagname = tag_display_name($tag);
// set the relatedtags field of the $tag object that will be passed to the form
$tag->relatedtags = tag_get_related_tags_csv(tag_get_related_tags($tag->id, TAG_RELATED_MANUAL), TAG_RETURN_TEXT);
$options = new stdClass();
$options->smiley = false;
$options->filter = false;
// convert and remove any XSS
$tag->description = format_text($tag->description, $tag->descriptionformat, $options);
$tag->descriptionformat = FORMAT_HTML;
$errorstring = '';
$editoroptions = array('maxfiles' => EDITOR_UNLIMITED_FILES, 'maxbytes' => $CFG->maxbytes, 'trusttext' => false, 'context' => $systemcontext, 'subdirs' => file_area_contains_subdirs($systemcontext, 'tag', 'description', $tag->id));
$tag = file_prepare_standard_editor($tag, 'description', $editoroptions, $systemcontext, 'tag', 'description', $tag->id);
$tagform = new tag_edit_form(null, compact('editoroptions'));
if ($tag->tagtype == 'official') {
$tag->tagtype = '1';
} else {
$tag->tagtype = '0';
}
$tagform->set_data($tag);
// If new data has been sent, update the tag record
if ($tagnew = $tagform->get_data()) {
if (has_capability('moodle/tag:manage', $systemcontext)) {
if ($tag->tagtype != 'default' && (!isset($tagnew->tagtype) || $tagnew->tagtype != '1')) {
tag_type_set($tag->id, 'default');
} elseif ($tag->tagtype != 'official' && $tagnew->tagtype == '1') {
tag_type_set($tag->id, 'official');
示例4: require_login
$scale_rec->standard = 1;
$scale_rec->courseid = 0;
require_login();
require_capability('moodle/course:managescales', $systemcontext);
}
}
if (!$courseid) {
require_once $CFG->libdir . '/adminlib.php';
admin_externalpage_setup('scales');
}
// default return url
$gpr = new grade_plugin_return();
$returnurl = $gpr->get_return_url('index.php?id=' . $courseid);
$editoroptions = array('maxfiles' => EDITOR_UNLIMITED_FILES, 'maxbytes' => $CFG->maxbytes, 'trusttext' => false, 'noclean' => true, 'context' => $systemcontext);
if (!empty($scale_rec->id)) {
$editoroptions['subdirs'] = file_area_contains_subdirs($systemcontext, 'grade', 'scale', $scale_rec->id);
$scale_rec = file_prepare_standard_editor($scale_rec, 'description', $editoroptions, $systemcontext, 'grade', 'scale', $scale_rec->id);
} else {
$editoroptions['subdirs'] = false;
$scale_rec = file_prepare_standard_editor($scale_rec, 'description', $editoroptions, $systemcontext, 'grade', 'scale', null);
}
$mform = new edit_scale_form(null, compact('gpr', 'editoroptions'));
$mform->set_data($scale_rec);
if ($mform->is_cancelled()) {
redirect($returnurl);
} else {
if ($data = $mform->get_data()) {
$scale = new grade_scale(array('id' => $id));
$data->userid = $USER->id;
if (empty($scale->id)) {
$data->description = $data->description_editor['text'];
示例5: glossary_get_editor_and_attachment_options
/**
* Return the editor and attachment options when editing a glossary entry
*
* @param stdClass $course course object
* @param stdClass $context context object
* @param stdClass $entry entry object
* @return array array containing the editor and attachment options
* @since Moodle 3.2
*/
function glossary_get_editor_and_attachment_options($course, $context, $entry) {
$maxfiles = 99; // TODO: add some setting.
$maxbytes = $course->maxbytes; // TODO: add some setting.
$definitionoptions = array('trusttext' => true, 'maxfiles' => $maxfiles, 'maxbytes' => $maxbytes, 'context' => $context,
'subdirs' => file_area_contains_subdirs($context, 'mod_glossary', 'entry', $entry->id));
$attachmentoptions = array('subdirs' => false, 'maxfiles' => $maxfiles, 'maxbytes' => $maxbytes);
return array($definitionoptions, $attachmentoptions);
}
示例6: array
$category = $DB->get_record('course_categories', array('id' => $categoryid), '*', MUST_EXIST);
$catcontext = context_coursecat::instance($category->id);
require_capability('moodle/course:create', $catcontext);
$PAGE->set_context($catcontext);
} else {
require_login();
print_error('needcoursecategroyid');
}
}
// Prepare course and the editor.
$editoroptions = array('maxfiles' => EDITOR_UNLIMITED_FILES, 'maxbytes' => $CFG->maxbytes, 'trusttext' => false, 'noclean' => true);
$overviewfilesoptions = course_overviewfiles_options($course);
if (!empty($course)) {
// Add context for editor.
$editoroptions['context'] = $coursecontext;
$editoroptions['subdirs'] = file_area_contains_subdirs($coursecontext, 'course', 'summary', 0);
$course = file_prepare_standard_editor($course, 'summary', $editoroptions, $coursecontext, 'course', 'summary', 0);
if ($overviewfilesoptions) {
file_prepare_standard_filemanager($course, 'overviewfiles', $overviewfilesoptions, $coursecontext, 'course', 'overviewfiles', 0);
}
// Inject current aliases.
$aliases = $DB->get_records('role_names', array('contextid' => $coursecontext->id));
foreach ($aliases as $alias) {
$course->{'role_' . $alias->roleid} = $alias->name;
}
// Populate course tags.
$course->tags = core_tag_tag::get_item_tags_array('core', 'course', $course->id);
} else {
// Editor should respect category context if course context is not set.
$editoroptions['context'] = $catcontext;
$editoroptions['subdirs'] = 0;
示例7: array_values
if ($categoriesarr = $DB->get_records_menu("glossary_entries_categories", array('entryid' => $id), '', 'id, categoryid')) {
// TODO: this fetches cats from both main and secondary glossary :-(
$entry->categories = array_values($categoriesarr);
}
} else {
// new entry
require_capability('mod/glossary:write', $context);
// note: guest user does not have any write capability
$entry = new stdClass();
$entry->id = null;
}
$maxfiles = 99;
// TODO: add some setting
$maxbytes = $course->maxbytes;
// TODO: add some setting
$definitionoptions = array('trusttext' => true, 'maxfiles' => $maxfiles, 'maxbytes' => $maxbytes, 'context' => $context, 'subdirs' => file_area_contains_subdirs($context, 'mod_glossary', 'entry', $entry->id));
$attachmentoptions = array('subdirs' => false, 'maxfiles' => $maxfiles, 'maxbytes' => $maxbytes);
$entry = file_prepare_standard_editor($entry, 'definition', $definitionoptions, $context, 'mod_glossary', 'entry', $entry->id);
$entry = file_prepare_standard_filemanager($entry, 'attachment', $attachmentoptions, $context, 'mod_glossary', 'attachment', $entry->id);
$entry->cmid = $cm->id;
// create form and set initial data
$mform = new mod_glossary_entry_form(null, array('current' => $entry, 'cm' => $cm, 'glossary' => $glossary, 'definitionoptions' => $definitionoptions, 'attachmentoptions' => $attachmentoptions));
if ($mform->is_cancelled()) {
if ($id) {
redirect("view.php?id={$cm->id}&mode=entry&hook={$id}");
} else {
redirect("view.php?id={$cm->id}");
}
} else {
if ($entry = $mform->get_data()) {
$timenow = time();
示例8: array
} else {
$PAGE->set_url('/group/group.php', array('courseid' => $courseid));
}
require_login($course);
$context = context_course::instance($course->id);
require_capability('moodle/course:managegroups', $context);
$strgroups = get_string('groups');
$PAGE->set_title($strgroups);
$PAGE->set_heading($course->fullname . ': ' . $strgroups);
$PAGE->set_pagelayout('admin');
navigation_node::override_active_url(new moodle_url('/group/index.php', array('id' => $course->id)));
$returnurl = $CFG->wwwroot . '/group/index.php?id=' . $course->id . '&group=' . $id;
// Prepare the description editor: We do support files for group descriptions
$editoroptions = array('maxfiles' => EDITOR_UNLIMITED_FILES, 'maxbytes' => $course->maxbytes, 'trust' => false, 'context' => $context, 'noclean' => true);
if (!empty($group->id)) {
$editoroptions['subdirs'] = file_area_contains_subdirs($context, 'group', 'description', $group->id);
$group = file_prepare_standard_editor($group, 'description', $editoroptions, $context, 'group', 'description', $group->id);
} else {
$editoroptions['subdirs'] = false;
$group = file_prepare_standard_editor($group, 'description', $editoroptions, $context, 'group', 'description', null);
}
/// First create the form
$editform = new group_form(null, array('editoroptions' => $editoroptions));
$editform->set_data($group);
if ($editform->is_cancelled()) {
redirect($returnurl);
} elseif ($data = $editform->get_data()) {
if (!has_capability('moodle/course:changeidnumber', $context)) {
// Remove the idnumber if the user doesn't have permission to modify it
unset($data->idnumber);
}
示例9: array
$isadding = false;
if ($templateid) {
$templaterecord = $DB->get_record('email_template', array('id' => $templateid), '*', MUST_EXIST);
iomad::require_capability('local/email:edit', $context);
} else {
$isadding = true;
$templateid = 0;
$templaterecord = (object) $email[$templatename];
$templaterecord->name = $templatename;
iomad::require_capability('local/email:add', $context);
}
// GWL :
$templaterecord->emailbody = $templaterecord->body;
// Editor should respect category context if course context is not set.
$editoroptions['context'] = $context;
$editoroptions['subdirs'] = file_area_contains_subdirs($context, 'email_template', 'message_body', 0);
$templaterecord->emailbodyformat = FORMAT_HTML;
$messagebody = file_prepare_standard_editor($templaterecord, 'emailbody', $editoroptions, $context, 'local_email', 'message_body_image', $templaterecord->id);
/* if ($overviewfilesoptions) {
file_prepare_standard_filemanager($course, 'overviewfiles', $overviewfilesoptions, null, 'course', 'overviewfiles', 0);
} */
// Code end
} else {
$isadding = true;
$templateid = 0;
$templaterecord = (object) $email[$templatename];
$templaterecord->name = $templatename;
iomad::require_capability('local/email:add', $context);
// GWL
$editoroptions['context'] = $context;
$editoroptions['subdirs'] = 0;
示例10: stdClass
$options = new stdClass();
$options->smiley = false;
$options->filter = false;
// convert and remove any XSS
$tag->description = format_text($tag->description, $tag->descriptionformat, $options);
$tag->descriptionformat = FORMAT_HTML;
$errorstring = '';
$editoroptions = array(
'maxfiles' => EDITOR_UNLIMITED_FILES,
'maxbytes' => $CFG->maxbytes,
'trusttext' => false,
'context' => $systemcontext,
'subdirs' => file_area_contains_subdirs($systemcontext, 'tag', 'description', $tag->id),
);
$tag = file_prepare_standard_editor($tag, 'description', $editoroptions, $systemcontext, 'tag', 'description', $tag->id);
$tagform = new tag_edit_form(null, compact('editoroptions'));
if ( $tag->tagtype == 'official' ) {
$tag->tagtype = '1';
} else {
$tag->tagtype = '0';
}
$tag->returnurl = $returnurl;
$tagform->set_data($tag);
// If new data has been sent, update the tag record
if ($tagform->is_cancelled()) {
示例11: stdClass
}
$stage = new stdClass();
$stage->id = null;
$stage->roadid = $roadid;
}
if (!isset($stage->questiontext) || $stage->questiontext === '') {
$stage->addsimplequestion = optional_param('addsimplequestion', 0, PARAM_INT);
$stage->noanswers = optional_param('noanswers', 2, PARAM_INT);
if (!empty($addanswers)) {
$stage->noanswers += NUMBER_NEW_ANSWERS;
}
}
$stage->cmid = $cmid;
$returnurl = new moodle_url('/mod/treasurehunt/edit.php', array('id' => $cmid, 'roadid' => $stage->roadid));
$maxbytes = get_user_max_upload_file_size($PAGE->context, $CFG->maxbytes, $COURSE->maxbytes);
$editoroptions = array('trusttext' => true, 'maxfiles' => EDITOR_UNLIMITED_FILES, 'maxbytes' => $maxbytes, 'context' => $context, 'subdirs' => file_area_contains_subdirs($context, 'mod_treasurehunt', 'cluetext', $stage->id));
// List activities with Completion enabled
$completioninfo = new completion_info($course);
$completionactivities = $completioninfo->get_activities();
$mform = new stage_form(null, array('current' => $stage, 'context' => $context, 'editoroptions' => $editoroptions, 'completionactivities' => $completionactivities));
//name of the form you defined in file above.
if ($mform->is_reloaded()) {
// Si se ha recargado es porque hemos cambiado algo
} else {
if ($mform->is_cancelled()) {
// You need this section if you have a cancel button on your form
// here you tell php what to do if your user presses cancel
// probably a redirect is called for!
// PLEASE NOTE: is_cancelled() should be called before get_data().
redirect($returnurl);
} else {
示例12: get_description_editor_options
/**
* Returns the description editor options.
* @return array
*/
public function get_description_editor_options()
{
global $CFG;
$context = $this->_customdata['context'];
$itemid = $this->_customdata['itemid'];
return array('maxfiles' => EDITOR_UNLIMITED_FILES, 'maxbytes' => $CFG->maxbytes, 'trusttext' => true, 'context' => $context, 'subdirs' => file_area_contains_subdirs($context, 'coursecat', 'description', $itemid));
}
示例13: require_capability
require_capability('mod/project:view', $context);
$PAGE->set_url('/mod/project/task_edit.php', array('cmid' => $cmid));
$PAGE->set_title($course->shortname . ': ' . $project->name);
$PAGE->set_heading($course->fullname);
$PAGE->set_activity_record($project);
if ($taskid) {
$task = $DB->get_record('project_task', array('id' => $taskid), '*', MUST_EXIST);
} else {
$task = new stdClass();
$task->id = null;
}
$maxfiles = 99;
// TODO: add some setting
$maxbytes = $course->maxbytes;
// TODO: add some setting
$definitionoptions = array('trusttext' => true, 'maxfiles' => $maxfiles, 'maxbytes' => $maxbytes, 'context' => $context, 'subdirs' => file_area_contains_subdirs($context, 'mod_project', 'task', $task->id));
$attachmentoptions = array('subdirs' => false, 'maxfiles' => $maxfiles, 'maxbytes' => $maxbytes);
//$task = file_prepare_standard_editor($task, 'definition', $definitionoptions, $context, 'mod_project', 'task', $task->id);
$task = file_prepare_standard_filemanager($task, 'attachment', $attachmentoptions, $context, 'mod_project', 'attachment', $task->id);
$task->cmid = $cm->id;
$options = array('noclean' => true, 'subdirs' => true, 'maxfiles' => -1, 'maxbytes' => 0, 'context' => $context);
$mform = new task_view_form(null, array('task' => $task, 'project' => $project, 'members' => $members));
// If data submitted, then process and store.
if ($mform->is_cancelled()) {
if (empty($tasks->id)) {
redirect("view.php?id={$cm->id}");
} else {
redirect("view.php?id={$cm->id}&taskid={$task->id}");
}
} else {
if ($data = $mform->get_data()) {