function display_add_field($recordid = 0) { if ($recordid) { $content = (int) get_field('data_content', 'content', 'fieldid', $this->field->id, 'recordid', $recordid); } else { $content = time(); } $str = '<div title="' . s($this->field->description) . '">'; $str .= print_date_selector('field_' . $this->field->id . '_day', 'field_' . $this->field->id . '_month', 'field_' . $this->field->id . '_year', $content, true); $str .= '</div>'; return $str; }
/** * @todo Document this function */ function forum_print_big_search_form($course) { global $CFG, $DB, $words, $subject, $phrase, $user, $userid, $fullwords, $notwords, $datefrom, $dateto; print_simple_box(get_string('searchforumintro', 'forum'), 'center', '', '', 'searchbox', 'intro'); print_simple_box_start("center"); echo "<script type=\"text/javascript\">\n"; echo "var timefromitems = ['fromday','frommonth','fromyear','fromhour', 'fromminute'];\n"; echo "var timetoitems = ['today','tomonth','toyear','tohour','tominute'];\n"; echo "</script>\n"; echo '<form id="searchform" action="search.php" method="get">'; echo '<table cellpadding="10" class="searchbox" id="form">'; echo '<tr>'; echo '<td class="c0"><label for="words">' . get_string('searchwords', 'forum') . '</label>'; echo '<input type="hidden" value="' . $course->id . '" name="id" alt="" /></td>'; echo '<td class="c1"><input type="text" size="35" name="words" id="words"value="' . s($words, true) . '" alt="" /></td>'; echo '</tr>'; echo '<tr>'; echo '<td class="c0"><label for="phrase">' . get_string('searchphrase', 'forum') . '</label></td>'; echo '<td class="c1"><input type="text" size="35" name="phrase" id="phrase" value="' . s($phrase, true) . '" alt="" /></td>'; echo '</tr>'; echo '<tr>'; echo '<td class="c0"><label for="notwords">' . get_string('searchnotwords', 'forum') . '</label></td>'; echo '<td class="c1"><input type="text" size="35" name="notwords" id="notwords" value="' . s($notwords, true) . '" alt="" /></td>'; echo '</tr>'; if ($DB->get_db_family() == 'mysql' || $DB->get_db_family() == 'postgres') { echo '<tr>'; echo '<td class="c0"><label for="fullwords">' . get_string('searchfullwords', 'forum') . '</label></td>'; echo '<td class="c1"><input type="text" size="35" name="fullwords" id="fullwords" value="' . s($fullwords, true) . '" alt="" /></td>'; echo '</tr>'; } echo '<tr>'; echo '<td class="c0">' . get_string('searchdatefrom', 'forum') . '</td>'; echo '<td class="c1">'; if (empty($datefrom)) { $datefromchecked = ''; $datefrom = make_timestamp(2000, 1, 1, 0, 0, 0); } else { $datefromchecked = 'checked="checked"'; } echo '<input name="timefromrestrict" type="checkbox" value="1" alt="' . get_string('searchdatefrom', 'forum') . '" onclick="return lockoptions(\'searchform\', \'timefromrestrict\', timefromitems)" ' . $datefromchecked . ' /> '; print_date_selector('fromday', 'frommonth', 'fromyear', $datefrom); print_time_selector('fromhour', 'fromminute', $datefrom); echo '<input type="hidden" name="hfromday" value="0" />'; echo '<input type="hidden" name="hfrommonth" value="0" />'; echo '<input type="hidden" name="hfromyear" value="0" />'; echo '<input type="hidden" name="hfromhour" value="0" />'; echo '<input type="hidden" name="hfromminute" value="0" />'; echo '</td>'; echo '</tr>'; echo '<tr>'; echo '<td class="c0">' . get_string('searchdateto', 'forum') . '</td>'; echo '<td class="c1">'; if (empty($dateto)) { $datetochecked = ''; $dateto = time() + 3600; } else { $datetochecked = 'checked="checked"'; } echo '<input name="timetorestrict" type="checkbox" value="1" alt="' . get_string('searchdateto', 'forum') . '" onclick="return lockoptions(\'searchform\', \'timetorestrict\', timetoitems)" ' . $datetochecked . ' /> '; print_date_selector('today', 'tomonth', 'toyear', $dateto); print_time_selector('tohour', 'tominute', $dateto); echo '<input type="hidden" name="htoday" value="0" />'; echo '<input type="hidden" name="htomonth" value="0" />'; echo '<input type="hidden" name="htoyear" value="0" />'; echo '<input type="hidden" name="htohour" value="0" />'; echo '<input type="hidden" name="htominute" value="0" />'; echo '</td>'; echo '</tr>'; echo '<tr>'; echo '<td class="c0"><label for="menuforumid">' . get_string('searchwhichforums', 'forum') . '</label></td>'; echo '<td class="c1">'; choose_from_menu(forum_menu_list($course), 'forumid', '', get_string('allforums', 'forum'), ''); echo '</td>'; echo '</tr>'; echo '<tr>'; echo '<td class="c0"><label for="subject">' . get_string('searchsubject', 'forum') . '</label></td>'; echo '<td class="c1"><input type="text" size="35" name="subject" id="subject" value="' . s($subject, true) . '" alt="" /></td>'; echo '</tr>'; echo '<tr>'; echo '<td class="c0"><label for="user">' . get_string('searchuser', 'forum') . '</label></td>'; echo '<td class="c1"><input type="text" size="35" name="user" id="user" value="' . s($user, true) . '" alt="" /></td>'; echo '</tr>'; echo '<tr>'; echo '<td class="submit" colspan="2" align="center">'; echo '<input type="submit" value="' . get_string('searchforums', 'forum') . '" alt="" /></td>'; echo '</tr>'; echo '</table>'; echo '</form>'; echo "<script type=\"text/javascript\">"; echo "lockoptions('searchform','timefromrestrict', timefromitems);"; echo "lockoptions('searchform','timetorestrict', timetoitems);"; echo "</script>\n"; print_simple_box_end(); }
function allmetadata_print_big_search_form($course) { global $CFG; global $words, $subject, $searchcourseid, $phrase, $user, $userid, $modname, $fullwords, $notwords, $datefrom, $dateto; print_simple_box(get_string('searchallmetadataintro', 'allmetadata'), 'center', '', '', 'searchbox', 'intro'); print_simple_box_start("center"); echo "<script type=\"text/javascript\" language=\"javascript\">\n"; echo "var timefromitems = ['fromday','frommonth','fromyear','fromhour', 'fromminute'];\n"; echo "var timetoitems = ['today','tomonth','toyear','tohour','tominute'];\n"; echo "</script>\n"; echo '<form name="search" action="search_allmetadata.php" method="get">'; echo '<input type="hidden" value="' . $course->id . '" name="id" alt="">'; echo '<table cellpadding="10" class="searchbox" id="form">'; echo '<tr>'; echo '<td class="c0">' . get_string('searchwords', 'allmetadata') . ':</td>'; echo '<td class="c1"><input type="text" size="35" name="words" value="' . s($words) . '" alt=""></td>'; echo '</tr>'; echo '<tr>'; echo '<td class="c0">' . get_string('searchphrase', 'allmetadata') . ':</td>'; echo '<td class="c1"><input type="text" size="35" name="phrase" value="' . s($phrase) . '" alt=""></td>'; echo '</tr>'; echo '<tr>'; echo '<td class="c0">' . get_string('searchnotwords', 'allmetadata') . ':</td>'; echo '<td class="c1"><input type="text" size="35" name="notwords" value="' . s($notwords) . '" alt=""></td>'; echo '</tr>'; echo '<tr>'; echo '<td class="c0">' . get_string('searchfullwords', 'allmetadata') . ':</td>'; echo '<td class="c1"><input type="text" size="35" name="fullwords" value="' . s($fullwords) . '" alt=""></td>'; echo '</tr>'; echo '<tr>'; echo '<td class="c0">' . get_string('searchdatefrom', 'allmetadata') . ':</td>'; echo '<td class="c1">'; echo '<input name="timefromrestrict" type="checkbox" value="1" alt="' . get_string('searchdatefrom', 'allmetadata') . '" onclick="return lockoptions(\'search\', \'timefromrestrict\', timefromitems)" /> '; if (empty($dateto)) { $datefrom = make_timestamp(2000, 1, 1, 0, 0, 0); } print_date_selector('fromday', 'frommonth', 'fromyear', $datefrom); print_time_selector('fromhour', 'fromminute', $datefrom); echo '<input type="hidden" name="hfromday" value="0" />'; echo '<input type="hidden" name="hfrommonth" value="0" />'; echo '<input type="hidden" name="hfromyear" value="0" />'; echo '<input type="hidden" name="hfromhour" value="0" />'; echo '<input type="hidden" name="hfromminute" value="0" />'; echo '</td>'; echo '</tr>'; echo '<tr>'; echo '<td class="c0">' . get_string('searchdateto', 'allmetadata') . ':</td>'; echo '<td class="c1">'; echo '<input name="timetorestrict" type="checkbox" value="1" alt="' . get_string('searchdateto', 'allmetadata') . '" onclick="return lockoptions(\'search\', \'timetorestrict\', timetoitems)" /> '; if (empty($dateto)) { $dateto = time() + 3600; } print_date_selector('today', 'tomonth', 'toyear', $dateto); print_time_selector('tohour', 'tominute', $dateto); echo '<input type="hidden" name="htoday" value="0" />'; echo '<input type="hidden" name="htomonth" value="0" />'; echo '<input type="hidden" name="htoyear" value="0" />'; echo '<input type="hidden" name="htohour" value="0" />'; echo '<input type="hidden" name="htominute" value="0" />'; echo '</td>'; echo '</tr>'; echo '<tr>'; echo '<td class="c0">' . get_string('searchsubject', 'allmetadata') . ':</td>'; echo '<td class="c1"><input type="text" size="35" name="subject" value="' . s($subject) . '" alt=""></td>'; echo '</tr>'; echo '<tr>'; echo '<td class="c0">' . get_string('searchuser', 'allmetadata') . ':</td>'; echo '<td class="c1"><input type="text" size="35" name="user" value="' . s($user) . '" alt=""></td>'; echo '</tr>'; echo '<tr>'; echo '<td class="c0">' . get_string('searchwhichmetadatas', 'allmetadata') . ':</td>'; echo '<td class="c1">'; //Metadata Modules available //function get_all_mods($courseid, &$mods, &$modnames, &$modnamesplural, &$modnamesused) $allmods = get_all_mods($course->id, &$mods, &$modnames, &$modnamesplural, &$modnamesused); $metamods = array(); if (array_key_exists("metadatadc", $modnamesplural)) { $metamods = array_merge(array("metadatadc" => get_string('modulenameplural', 'metadatadc')), $metamods); //array_unshift($metamods, get_string('modulenameplural', 'metadatadc')); } if (array_key_exists("metadatalom", $modnamesplural)) { $metamods = array_merge(array("metadatalom" => get_string('modulenameplural', 'metadatalom')), $metamods); //array_unshift($metamods, get_string('modulenameplural', 'metadatalom')); } if (count($metamods) == 1) { //choose_from_menu($options, $name, $selected='', $nothing='choose', $script='', $nothingvalue='0', $return=false, $disabled=false, $tabindex=0) choose_from_menu($metamods, 'metamodname', '', 'choose', ''); } elseif (count($metamods) > 1) { array_unshift($metamods, get_string('allmetadata', 'allmetadata')); choose_from_menu($metamods, 'metamodname', '', 'choose', ''); } else { echo '<strong>' . get_string('nometadata', 'allmetadata') . '</strong>'; } echo '</td>'; echo '</tr>'; echo '<tr>'; echo '<td class="c0">' . get_string('searchwhichcourse', 'allmetadata') . ':</td>'; echo '<td class="c1">'; //Courses available //get_courses($categoryid="all", $sort="c.sortorder ASC", $fields="c.*") $allcourses = array(); if ($allcs = get_courses("all", "c.id ASC", "c.id,c.fullname")) { foreach ($allcs as $allc) { $namec = $allc->fullname; $idc = $allc->id; $onecourse = array($idc => $namec); array_push_associative($allcourses, $onecourse); } } if (count($allcourses) == 1) { //choose_from_menu($options, $name, $selected='', $nothing='choose', $script='', $nothingvalue='0', $return=false, $disabled=false, $tabindex=0) choose_from_menu($allcourses, 'searchcourseid', '', get_string('allcourses', 'allmetadata'), ''); } elseif (count($allcourses) > 1) { //array_unshift($allcourses, get_string('allcourses', 'allmetadata')); //array_push($allcourses, get_string('mycourses', 'allmetadata')); $mycourse = array("9999" => get_string('mycourses', 'allmetadata')); array_push_associative($allcourses, $mycourse); choose_from_menu($allcourses, 'searchcourseid', '', get_string('allcourses', 'allmetadata'), ''); } else { echo '<strong>' . get_string('nocourses', 'allmetadata') . '</strong>'; } echo '</td>'; echo '</tr>'; echo '<tr>'; echo '<td class="c0">' . get_string('searchwhichmods', 'allmetadata') . ':</td>'; echo '<td class="c1">'; //Resources-Activities Modules available $modsmetadata = array("metadatadc" => get_string('modulenameplural', 'metadatadc'), "metadatalom" => get_string('modulenameplural', 'metadatalom')); $modsra = array(); //Don't show the metadatalom/metadatadc mods $modsra = array_diff($modnamesplural, $modsmetadata); if (count($modsra) == 1) { //choose_from_menu($options, $name, $selected='', $nothing='choose', $script='', $nothingvalue='0', $return=false, $disabled=false, $tabindex=0) choose_from_menu($modsra, 'modname', '', 'choose', ''); } elseif (count($modsra) > 1) { array_unshift($modsra, get_string('allmods', 'allmetadata')); choose_from_menu($modsra, 'modname', '', 'choose', ''); } else { echo '<strong>' . get_string('nomodules', 'allmetadata') . '</strong>'; } echo '</td>'; echo '</tr>'; echo '<tr>'; echo '<td class="submit" colspan="2" align="center">'; echo '<input type="submit" value="' . get_string('searchallmetadatas', 'allmetadata') . '" alt=""></td>'; echo '</tr>'; echo '</table>'; echo '</form>'; echo "<script type=\"text/javascript\">"; echo "lockoptions('search','timefromrestrict', timefromitems);"; echo "lockoptions('search','timetorestrict', timetoitems);"; echo "</script>\n"; print_simple_box_end(); }
echo '<form id="reset" action="reset.php" method="POST">'; print_heading(get_string('course'), 'left', 3); echo '<div class="courseinfo">'; echo $strremove . ':<br />'; print_checkbox('reset_teachers', 1, false, get_string('teachers'), '', ''); echo '<br />'; print_checkbox('reset_students', 1, true, get_string('students'), '', ''); echo '<br />'; print_checkbox('reset_events', 1, true, get_string('courseevents', 'calendar'), '', ''); echo '<br />'; print_checkbox('reset_logs', 1, true, get_string('logs'), '', ''); echo '<br />'; print_checkbox('reset_groups', 1, true, get_string('groups'), '', ''); echo '<br />'; print_checkbox('reset_start_date', 1, true, get_string('startdate'), '', ''); print_date_selector('startday', 'startmonth', 'startyear'); helpbutton('coursestartdate', get_string('startdate')); echo '</div>'; // Check each module and see if there is specific data to be removed if ($allmods = get_records('modules')) { foreach ($allmods as $mod) { $modname = $mod->name; $modfile = $CFG->dirroot . '/mod/' . $modname . '/lib.php'; $mod_reset_course_form = $modname . '_reset_course_form'; if (file_exists($modfile)) { @(include_once $modfile); if (function_exists($mod_reset_course_form)) { print_heading(get_string('modulenameplural', $modname), 'left', 3); echo '<div class="' . $modname . 'info">'; $mod_reset_course_form($course); echo '</div>';
echo "</tr>"; echo "<tr><td></td><td>Date (DD/MM/YYYY)</td><td>Time (HH:MM)</td></tr>"; echo "<tr>"; echo "<td>Start Time:</td>"; echo "<td>"; print_date_selector("sday", "smon", "syear", 0, false); echo "</td>"; echo "<td>"; print_time_selector("shour", "smin", 0, 5, false); echo "</td>"; echo "</tr>"; echo "<tr><td></td><td>Date (DD/MM/YYYY)</td><td>Time (HH:MM)</td></tr>"; echo "<tr>"; echo "<td>End Time:</td>"; echo "<td>"; print_date_selector("eday", "emon", "eyear", 0, false); echo "</td>"; echo "<td>"; print_time_selector("ehour", "emin", 0, 5, false); echo "</td>"; echo "</tr>"; echo "<tr>"; echo "<td colspan='3' align='right'>"; print_button('Create Entry', array('register' => 1, 'timeselect' => 1)); echo "</td>"; echo "</tr>"; echo "</table>"; print_form_end(); print_box_end(); } }