Example #1
0
$filemanageropts = array('subdirs' => 0, 'maxbytes' => '0', 'maxfiles' => 50, 'context' => $context);
$customdata = array('filemanageropts' => $filemanageropts);
$mform = new simplehtml_form(null, $customdata);
// CONFIGURE FILE MANAGER
// From http://docs.moodle.org/dev/Using_the_File_API_in_Moodle_forms#filemanager
$itemid = 0;
// This is used to distinguish between multiple file areas, e.g. different student's assignment submissions, or attachments to different forum posts, in this case we use '0' as there is no relevant id to use
$draftitemid = file_get_submitted_draft_itemid('attachments');
// Copy all the files from the 'real' area, into the draft area
file_prepare_draft_area($draftitemid, $context->id, 'local_filemanager', 'attachment', $itemid, $filemanageropts);
// Prepare the data to pass into the form - normally we would load this from a database, but, here, we have no 'real' record to load
$entry = new stdClass();
$entry->attachments = $draftitemid;
// Add the draftitemid to the form, so that 'file_get_submitted_draft_itemid' can retrieve it
// Set form data
$mform->set_data($entry);
// ===============
//
//
// PAGE OUTPUT
//
//
// ===============
echo $OUTPUT->header();
// ----------
// Form Submit Status
// ----------
if ($mform->is_cancelled()) {
    // CANCELLED
    echo '<h1>Cancelled</h1>';
    echo '<p>Handle form cancel operation, if cancel button is present on form<p>';
Example #2
0
require_once '../../config.php';
require_once 'formdesign.php';
global $DB;
global $USER;
$PAGE->set_pagelayout('admin');
$mform = new simplehtml_form();
if ($mform->is_cancelled()) {
} else {
    if ($fromform = $mform->get_data()) {
        $record = new stdClass();
        $record->id = '';
        $record->name = $fromform->name;
        $record->text = $fromform->text['text'];
        $record->format = $fromform->text['format'];
        //		print_object($record);
        $DB->insert_record('form', $record, true, false);
        //		$mform->display();
        echo "Changes have been made.";
        echo $OUTPUT->header();
    } else {
        echo $OUTPUT->header();
        $result = $_SESSION['admission'];
        print_object($result);
        //		print_object($USER->id);
        //		$mform->set_data(array ($result=>name,$result=>text) );
        $mform->set_data($result);
        //		$mform-> getElement ('text') -> SetValue (array ('text' => $result[text]));
        $mform->display();
        echo $OUTPUT->footer();
    }
}
Example #3
0
$id = optional_param('id', 0, PARAM_INT);
$component = required_param('component', PARAM_RAW);
if (!($course = $DB->get_record('course', array('id' => $courseid)))) {
    print_error('invalidcourse', 'block_simplehtml', $courseid);
}
require_login($course);
$PAGE->set_url('/blocks/simplehtml/view.php', array('id' => $courseid));
$PAGE->set_pagelayout('standard');
$PAGE->set_heading(get_string('edithtml', 'block_simplehtml'));
$PAGE->set_title('Nuevo Rea');
$simplehtml = new simplehtml_form();
$toform['blockid'] = $blockid;
$toform['courseid'] = $courseid;
$toform['component'] = $component;
$toform['id'] = $id;
$simplehtml->set_data($toform);
$settingsnode = $PAGE->settingsnav->add(get_string('simplehtmlsettings', 'block_simplehtml'));
$editurl = new moodle_url('/blocks/simplehtml/view.php', array('id' => $id, 'courseid' => $courseid, 'blockid' => $blockid, 'component' => $component));
$editnode = $settingsnode->add(get_string('editpage', 'block_simplehtml'), $editurl);
$editnode->make_active();
$url = new moodle_url('/course/view.php', array('id' => $courseid));
if ($simplehtml->is_cancelled()) {
    redirect($url);
} else {
    if ($simplehtml->get_data()) {
        $fromform = $simplehtml->get_data();
        if ($fromform->id != 0) {
            if (!$DB->update_record('block_simplehtml', $fromform)) {
                print_error('updateerror', 'block_simplehtml');
            }
        } else {
Example #4
0
            echo "</pre>";
            */
            $table = new html_table();
            $table->head = $hd;
            $table->data = $Adt;
        }
        /**/
        /**********************************************************************************************/
        //$options = array('subdirs'=>1, 'maxbytes'=>$CFG->userquota, 'maxfiles'=>-1, 'accepted_types'=>'*', 'return_types'=>FILE_INTERNAL);
        //$toform = file_postupdate_standard_filemanager($toform, 'files', $options, $context, 'user', 'private', 0);
        //$DB->insert_record('systems_jobs', $toform);
    } else {
        // this branch is executed if the form is submitted but the data doesn't validate and the form should be redisplayed
        // or on the first display of the form.
        //Set default data (if any)
        $mform->set_data();
        //displays the form
    }
}
echo $OUTPUT->header();
/*******************************************************************************************************************/
$quiz_reordertool = optional_param('link', '', PARAM_TEXT);
// optional_param('link', -1, PARAM_BOOL);
// Print the tabs to switch mode.
switch ($quiz_reordertool) {
    case "B":
        $currenttab = 'B';
        break;
    default:
        $currenttab = 'M';
        break;