moodle/mod/data/mod.html
moodler 3d4b223a85 NEW MODULE FROM MOODLE.COM - DATABASE !
Finally, we have an early version good enough for everyone to
start banging on to help us polish it up and find bugs.

Please take a look and file bugs in the bug tracker under "Database module".

We urgently need
    - new icons for existing field types
    - testing on PostgreSQL install


Coming soon (?):

    - Many more field types:  calculation, checkbox, relation, date, datetime,
                              time, email, group, list, user, number, richtext
      (Please let us know if you are interested in developing any of these)

    - A way to save and restore "presets", which are field/template sets

    - Backup/Restore support

    - Groups Support

    - RSS support

Many thanks to Yu for all the hard work under my whip.
2005-12-02 07:50:26 +00:00

248 lines
9.5 KiB
HTML

<?php // $Id$
require_once($CFG->dirroot.'/mod/data/lib.php');
if (!isset($form->name)) {
$form->name = '';
}
if (!isset($form->intro)) {
$form->intro = '';
}
if (!isset($form->keepdays)) {
$form->keepdays = 30;
}
if (!isset($form->studentlogs)) {
$form->studentlogs = 0;
}
if (!isset($form->timeavailablefrom)) {
$form->timeavailablefrom = 0;
}
if (!isset($form->timeavailableto)) {
$form->timeavailableto = 0;
}
if (!isset($form->timeviewfrom)) {
$form->timeviewfrom = 0;
}
if (!isset($form->timeviewto)) {
$form->timeviewto = 0;
}
if (!isset($form->schedule)) {
$form->schedule = 0;
}
if (!isset($form->participants)) {
$form->participants = PARTICIPANTS_TS;
}
if (!isset($form->requiredentries)) {
$form->requiredentries = 0;
}
if (!isset($form->requiredentriestoview)) {
$form->requiredentriestoview = 0;
}
if (!isset($form->maxentries)) {
$form->maxentries = 0;
}
if (!isset($form->rssarticles)) {
$form->rssarticles = 0;
}
if (!isset($form->comments)) {
$form->comments = 0;
}
if (!isset($form->ratings)) {
$form->ratings = 0;
}
?>
<script type="text/javascript" language="javascript">
var availablefromitems = ['availablefromday','availablefrommonth','availablefromyear','availablefromhour', 'availablefromminute'];
var availabletoitems = ['availabletoday','availabletomonth','availabletoyear','availabletohour', 'availabletominute'];
var viewfromitems = ['viewfromday','viewfrommonth','viewfromyear','viewfromhour', 'viewfromminute'];
var viewtoitems = ['viewtoday','viewtomonth','viewtoyear','viewtohour', 'viewtominute'];
</script>
<form name="form" method="post" action="mod.php">
<table cellpadding="5">
<tr valign="top">
<td align="right"><?php print_string('name')?>:</b></td>
<td>
<input type="text" name="name" size="30" value="<?php p($form->name) ?>" alt="<?php print_string('name') ?>" />
</td>
</tr>
<tr valign="top">
<td align="right"><?php print_string('intro', 'data')?>:</b><br /><br />
<?php
helpbutton('writing', get_string('helpwriting'), 'moodle', true, true);
echo '<br />';
helpbutton('questions', get_string('helpquestions'), 'moodle', true, true);
echo '<br />';
emoticonhelpbutton('form', 'intro');
echo '<br />';
?>
</td>
<td>
<?php print_textarea($usehtmleditor, 20, 50, 680, 400, 'intro', $form->intro); ?>
</td>
</tr>
<tr valign="top">
<td align="right"><b><?php print_string('availablefromdate','data') ?>:</b></td>
<td>
<input name="availablefromenable" type="checkbox" value="1" alt="<?php print_string('availablefromdate', 'data') ?>" onclick="return lockoptions('form', 'availablefromenable', availablefromitems)" <?php if ($form->timeavailablefrom) echo 'checked="checked"' ?> />
<?php
print_date_selector("availablefromday", "availablefrommonth", "availablefromyear", $form->timeavailablefrom);
echo "&nbsp;-&nbsp;";
print_time_selector("availablefromhour", "availablefromminute", $form->timeavailablefrom);
?>
<input type="hidden" name="havailablefromday" value="0" />
<input type="hidden" name="havailablefrommonth" value="0" />
<input type="hidden" name="havailablefromyear" value="0" />
<input type="hidden" name="havailablefromhour" value="0" />
<input type="hidden" name="havailablefromminute" value="0" />
</td>
</tr>
<tr valign="top">
<td align="right"><b><?php print_string('availabletodate','data') ?>:</b></td>
<td>
<input name="availabletoenable" type="checkbox" value="1" alt="<?php print_string('availabletodate', 'data') ?>" onclick="return lockoptions('form', 'availabletoenable', availabletoitems)" <?php if ($form->timeavailableto) echo 'checked="checked"' ?> />
<?php
print_date_selector("availabletoday", "availabletomonth", "availabletoyear", $form->timeavailableto);
echo "&nbsp;-&nbsp;";
print_time_selector("availabletohour", "availabletominute", $form->timeavailableto);
?>
<input type="hidden" name="havailabletoday" value="0" />
<input type="hidden" name="havailabletomonth" value="0" />
<input type="hidden" name="havailabletoyear" value="0" />
<input type="hidden" name="havailabletohour" value="0" />
<input type="hidden" name="havailabletominute" value="0" />
</td>
</tr>
<tr valign="top">
<td align="right"><b><?php print_string('viewfromdate','data') ?>:</b></td>
<td>
<input name="viewfromenable" type="checkbox" value="1" alt="<?php print_string('viewfromdate', 'data') ?>" onclick="return lockoptions('form', 'viewfromenable', viewfromitems)" <?php if ($form->timeviewfrom) echo 'checked="checked"' ?> />
<?php
print_date_selector("viewfromday", "viewfrommonth", "viewfromyear", $form->timeviewfrom);
echo "&nbsp;-&nbsp;";
print_time_selector("viewfromhour", "viewfromminute", $form->timeviewfrom);
?>
<input type="hidden" name="hviewfromday" value="0" />
<input type="hidden" name="hviewfrommonth" value="0" />
<input type="hidden" name="hviewfromyear" value="0" />
<input type="hidden" name="hviewfromhour" value="0" />
<input type="hidden" name="hviewfromminute" value="0" />
</td>
</tr>
<tr valign="top">
<td align="right"><b><?php print_string('viewtodate','data') ?>:</b></td>
<td>
<input name="viewtoenable" type="checkbox" value="1" alt="<?php print_string('viewtodate', 'data') ?>" onclick="return lockoptions('form', 'viewtoenable', viewtoitems)" <?php if ($form->timeviewto) echo 'checked="checked"' ?> />
<?php
print_date_selector("viewtoday", "viewtomonth", "viewtoyear", $form->timeviewto);
echo "&nbsp;-&nbsp;";
print_time_selector("viewtohour", "viewtominute", $form->timeviewto);
?>
<input type="hidden" name="hviewtoday" value="0" />
<input type="hidden" name="hviewtomonth" value="0" />
<input type="hidden" name="hviewtoyear" value="0" />
<input type="hidden" name="hviewtohour" value="0" />
<input type="hidden" name="hviewtominute" value="0" />
</td>
</tr>
<tr valign="top">
<td align="right"><b><?php print_string('participants', 'data') ?>:</b></td>
<td>
<?php
$a->teachers = $course->teachers;
$a->students = $course->students;
$options = array(PARTICIPANTS_T => $a->teachers,
PARTICIPANTS_S => $a->students,
PARTICIPANTS_TS => get_string('teachersandstudents', 'data', $a));
choose_from_menu($options, 'participants', $form->participants, '');
?>
</td>
</tr>
<tr valign="top">
<td align="right"><b><?php print_string('requiredentries', 'data') ?>:</b></td>
<td>
<?php
$countoptions = array();
for($count=1;$count<=DATAMAXENTRIES;$count++) $countoptions[$count] = $count;
choose_from_menu($countoptions, 'requiredentries', $form->requiredentries, get_string('none'));
?>
</td>
</tr>
<tr valign="top">
<td>&nbsp;</td>
<td><b><?php print_string('requiredentriestoview', 'data') ?>: </b>
<?php choose_from_menu($countoptions, 'requiredentriestoview', $form->requiredentriestoview, get_string('none')) ?>
</td>
</tr>
<tr valign="top">
<td align="right"><b><?php print_string('maxentries', 'data') ?>:</b></td>
<td><?php choose_from_menu($countoptions, 'maxentries', $form->maxentries, get_string('nomaximum', 'data')) ?>
</td>
</tr>
<tr valign="top">
<td align="right"><b><?php print_string('comments', 'data') ?>:</b></td>
<td>
<?php
$ynoptions = array( 0 => get_string('no'), 1 => get_string('yes'));
choose_from_menu($ynoptions, 'comments', $form->comments, '');
?>
</td>
</tr>
<?php if (!empty($CFG->data_enablerssfeeds) and !empty($CFG->enablerssfeeds)) { ?>
<tr valign="top">
<td align="right"><b><?php print_string('numberrssarticles', 'data') ?>:</b></td>
<td><?php choose_from_menu($countoptions, 'rssarticles', $form->rssarticles, get_string('none')) ?>
</td>
</tr>
<?php } ?>
<?php print_standard_coursemodule_settings($form); ?>
</table>
<center>
<input type="hidden" name="course" value="<?php p($form->course) ?>" />
<input type="hidden" name="sesskey" value="<?php p($form->sesskey) ?>" />
<input type="hidden" name="coursemodule" value="<?php p($form->coursemodule) ?>" />
<input type="hidden" name="section" value="<?php p($form->section) ?>" />
<input type="hidden" name="module" value="<?php p($form->module) ?>" />
<input type="hidden" name="modulename" value="<?php p($form->modulename) ?>" />
<input type="hidden" name="instance" value="<?php p($form->instance) ?>" />
<input type="hidden" name="mode" value="<?php p($form->mode) ?>" />
<input type="submit" value="<?php print_string('savechanges') ?>" />
<input type="submit" name="cancel" value="<?php print_string('cancel') ?>" />
</center>
</form>
<script type="text/javascript">
<?php
if (!$form->timeavailablefrom) echo "lockoptions('form','availablefromenable', availablefromitems);";
if (!$form->timeavailableto) echo "lockoptions('form','availabletoenable', availabletoitems);";
if (!$form->timeviewfrom) echo "lockoptions('form','viewfromenable', viewfromitems);";
if (!$form->timeviewto) echo "lockoptions('form','viewtoenable', viewtoitems);";
?>
</script>