--- /dev/null
+<?php
+require_once("HTML/QuickForm/static.php");
+
+/**
+ * HTML class for a text type element
+ *
+ * @author Jamie Pratt
+ * @access public
+ */
+class MoodleQuickForm_warning extends HTML_QuickForm_static{
+ var $_elementTemplateType='warning';
+ /**
+ * html for help button, if empty then no help
+ *
+ * @var string
+ */
+ var $_helpbutton='';
+
+ function MoodleQuickForm_warning($elementName=null, $elementLabel=null, $text=null) {
+ parent::HTML_QuickForm_static($elementName, $elementLabel, $text);
+ $this->_type = 'warning';
+ }
+
+ /**
+ * set html for help button
+ *
+ * @access public
+ * @param array $help array of arguments to make a help button
+ * @param string $function function name to call to get html
+ */
+ function setHelpButton($helpbuttonargs, $function='helpbutton'){
+ if (!is_array($helpbuttonargs)){
+ $helpbuttonargs=array($helpbuttonargs);
+ }else{
+ $helpbuttonargs=$helpbuttonargs;
+ }
+ //we do this to to return html instead of printing it
+ //without having to specify it in every call to make a button.
+ if ('helpbutton' == $function){
+ $defaultargs=array('', '', 'moodle', true, false, '', true);
+ $helpbuttonargs=$helpbuttonargs + $defaultargs ;
+ }
+ $this->_helpbutton=call_user_func_array($function, $helpbuttonargs);
+ }
+
+ function toHtml() {
+ return notify($this->_text, 'formwarning', 'center', true);
+ }
+
+ /**
+ * get html for help button
+ *
+ * @access public
+ * @return string html for help button
+ */
+ function getHelpButton(){
+ return $this->_helpbutton;
+ }
+
+ function getElementTemplateType(){
+ return $this->_elementTemplateType;
+ }
+}
+?>
* @param int $newuserid - new userid if required
* @return mixed stored_file object or false if error; may throw exception if duplicate found
*/
- function save_stored_file($elname, $newcontextid, $newfilearea, $newitemid, $newfilepath,
+ function save_stored_file($elname, $newcontextid, $newfilearea, $newitemid, $newfilepath,
$newfilename=null, $override=false, $newuserid=null) {
global $USER;
return $fs->create_file_from_pathname($file_record, $_FILES[$elname]['tmp_name']);
} else if (isset($this->exportValues[$elname])) { // Submitted data contains itemid in user's draft_area
-
+
$itemid = $this->exportValues[$elname];
if (!$context = get_context_instance(CONTEXT_USER, $USER->id)) {
}
$file = array_pop($files); // Get the one and only item out of the array
-
+
$params = $file->get_params();
$fs = get_file_storage();
'static'=>"\n\t\t".'<div class="fitem {advanced}"><div class="fitemtitle"><div class="fstaticlabel"><label>{label}<!-- BEGIN required -->{req}<!-- END required -->{advancedimg} {help}</label></div></div><div class="felement fstatic <!-- BEGIN error --> error<!-- END error -->"><!-- BEGIN error --><span class="error">{error}</span><br /><!-- END error -->{element} </div></div>',
+'warning'=>"\n\t\t".'<div class="fitem {advanced}">{element}</div>',
+
'nodisplay'=>'');
parent::HTML_QuickForm_Renderer_Tableless();
//check if this is a group element first
if (($this->_inGroup) and !empty($this->_groupElementTemplate)) {
// so it gets substitutions for *each* element
- $html = $this->_groupTemplates[$element->getName()];
+ $html = $this->_groupTemplates[$element->getName()];
}
elseif (method_exists($element, 'getElementTemplateType')){
$html = $this->_elementTemplates[$element->getElementTemplateType()];
MoodleQuickForm::registerElementType('questioncategory', "$CFG->libdir/form/questioncategory.php", 'MoodleQuickForm_questioncategory');
MoodleQuickForm::registerElementType('advcheckbox', "$CFG->libdir/form/advcheckbox.php", 'MoodleQuickForm_advcheckbox');
MoodleQuickForm::registerElementType('recaptcha', "$CFG->libdir/form/recaptcha.php", 'MoodleQuickForm_recaptcha');
+MoodleQuickForm::registerElementType('warning', "$CFG->libdir/form/warning.php", 'MoodleQuickForm_warning');
?>
/* .content should match the body background, sides are white. */
#course-view .weeks .content ,
-#course-view .topics .content,
+#course-view .topics .content,
#course-view .weeks .section,
#course-view .topics .section {
background: #FAFAFA;
}
.grade-report-grader table#user-grades td.cell span.gradepass {
- background-color: #C2EBBD;
+ background-color: #C2EBBD;
}
.grade-report-grader table#user-grades td.cell span.gradefail {
- background-color: #EBC4BD;
+ background-color: #EBC4BD;
}
/* grade edit */
}
form.mform .required .fgroup span label {
color:#000;
-}
\ No newline at end of file
+}
+
+form.mform .formwarning {
+ background-color: red;
+ color: yellow;
+ margin-top: 15px;
+ padding: 10px 0px 10px 0px;
+ font-size: 110%;
+ font-weight: bold;
+}