Ejemplo n.º 1
0
 function toHtml()
 {
     $text = $this->_attributes['value'];
     $onmouseover = "window.status=\\'" . $text . "\\';";
     $onmouseout = "window.status=\\'\\';";
     return "<noscript><div>" . parent::toHtml() . '</div></noscript><script type="text/javascript">' . $this->_js . "\n" . 'document.write(\'<a href="#" onclick="' . $this->_onclick . '" onmouseover="' . $onmouseover . '" onmouseout="' . $onmouseout . '">' . $text . "</a>');\n</script>";
 }
Ejemplo n.º 2
0
 function onQuickFormEvent($event, $arg, &$caller)
 {
     switch ($event) {
         case 'createElement':
             $className = get_class($this);
             $this->{$className}($arg[0], $arg[1], $arg[2]);
             $caller->_registerCancelButton($this->getName());
             return true;
             break;
     }
     return parent::onQuickFormEvent($event, $arg, $caller);
 }
Ejemplo n.º 3
0
/**
 * Outputs the part form HTML
 * @param object $cm The moodle course module object for this instance
 * @param object $part The moodle course module object for this instance
 * @return string Return the part form HTML output
 */
function turnitintool_partform($cm, $part)
{
    global $CFG, $OUTPUT;
    $output = '<form name="partform" method="POST" action="' . $CFG->wwwroot . '/mod/turnitintool/view.php' . '?id=' . $cm->id . '&do=intro">' . PHP_EOL;
    $element = new MoodleQuickForm_hidden('submitted');
    $element->setValue($part->id);
    $output .= $element->toHTML() . PHP_EOL;
    $table = new stdClass();
    $table->width = '100%';
    $table->id = 'uploadtableid';
    $table->class = 'uploadtable';
    // Part Name Field
    unset($cells);
    $cells[0] = new stdClass();
    $cells[0]->data = get_string('partname', 'turnitintool');
    $cells[0]->class = 'cell c0';
    $attr = array('class' => "formwide");
    $element = new MoodleQuickForm_text('partname', null, $attr);
    $element->setValue($part->partname);
    $cells[1] = new stdClass();
    $cells[1]->data = $element->toHTML();
    $cells[1]->class = 'cell c1';
    $table->rows[0] = new stdClass();
    $table->rows[0]->cells = $cells;
    $dateoptions = array('startyear' => date('Y', strtotime('-6 years')), 'stopyear' => date('Y', strtotime('+6 years')), 'timezone' => 99, 'applydst' => true, 'step' => 1, 'optional' => false);
    // Part Start Date
    unset($cells);
    $cells[0] = new stdClass();
    $cells[0]->data = get_string('dtstart', 'turnitintool');
    $cells[0]->class = 'cell c0';
    $element = new MoodleQuickForm_date_time_selector('dtstart', null, $dateoptions);
    $date = array('hour' => userdate($part->dtstart, '%H'), 'minute' => userdate($part->dtstart, '%M'), 'day' => userdate($part->dtstart, '%d'), 'month' => userdate($part->dtstart, '%m'), 'year' => userdate($part->dtstart, '%Y'));
    $element->setValue($date);
    $cells[1] = new stdClass();
    $cells[1]->data = $element->toHTML();
    $cells[1]->class = 'cell c1';
    $table->rows[1] = new stdClass();
    $table->rows[1]->cells = $cells;
    // Part Due Date
    unset($cells);
    $cells[0] = new stdClass();
    $cells[0]->data = get_string('dtdue', 'turnitintool');
    $cells[0]->class = 'cell c0';
    $element = new MoodleQuickForm_date_time_selector('dtdue', null, $dateoptions);
    $date = array('hour' => userdate($part->dtdue, '%H'), 'minute' => userdate($part->dtdue, '%M'), 'day' => userdate($part->dtdue, '%d'), 'month' => userdate($part->dtdue, '%m'), 'year' => userdate($part->dtdue, '%Y'));
    $element->setValue($date);
    $cells[1] = new stdClass();
    $cells[1]->data = $element->toHTML();
    $cells[1]->class = 'cell c1';
    $table->rows[2] = new stdClass();
    $table->rows[2]->cells = $cells;
    // Part Post Date
    unset($cells);
    $cells[0] = new stdClass();
    $cells[0]->data = get_string('dtpost', 'turnitintool');
    $cells[0]->class = 'cell c0';
    $element = new MoodleQuickForm_date_time_selector('dtpost', null, $dateoptions);
    $date = array('hour' => userdate($part->dtpost, '%H'), 'minute' => userdate($part->dtpost, '%M'), 'day' => userdate($part->dtpost, '%d'), 'month' => userdate($part->dtpost, '%m'), 'year' => userdate($part->dtpost, '%Y'));
    $element->setValue($date);
    $cells[1] = new stdClass();
    $cells[1]->data = $element->toHTML();
    $cells[1]->class = 'cell c1';
    $table->rows[3] = new stdClass();
    $table->rows[3]->cells = $cells;
    // Part Max Marks
    unset($cells);
    $cells[0] = new stdClass();
    $cells[0]->data = get_string('maxmarks', 'turnitintool');
    $cells[0]->class = 'cell c0';
    $element = new MoodleQuickForm_text('maxmarks');
    $element->setValue($part->maxmarks);
    $cells[1] = new stdClass();
    $cells[1]->data = $element->toHTML();
    $cells[1]->class = 'cell c1';
    $table->rows[4] = new stdClass();
    $table->rows[4]->cells = $cells;
    // Submit / Cancel
    unset($cells);
    $cells[0] = new stdClass();
    $cells[0]->data = '&nbsp;';
    $cells[0]->class = 'cell c0';
    $attr = array('onclick' => "location.href='" . $CFG->wwwroot . "/mod/turnitintool/view.php?id=" . $cm->id . "';");
    $element = new MoodleQuickForm_button('cancel', 'Cancel', $attr);
    $cells[1] = new stdClass();
    $cells[1]->data = $element->toHTML();
    $element = new MoodleQuickForm_submit('submit', 'Submit');
    $cells[1]->data .= $element->toHTML();
    $cells[1]->class = 'cell c1';
    $table->rows[5] = new stdClass();
    $table->rows[5]->cells = $cells;
    $output .= turnitintool_print_table($table, true);
    $output .= '</form>' . PHP_EOL;
    return $output;
}
Ejemplo n.º 4
0
 /**
  * Returns HTML for submitlink form element.
  *
  * @return string
  */
 function toHtml()
 {
     $text = $this->_attributes['value'];
     return "<noscript><div>" . parent::toHtml() . '</div></noscript><script type="text/javascript">' . $this->_js . "\n" . 'document.write(\'<a href="#" onclick="' . $this->_onclick . '">' . $text . "</a>');\n</script>";
 }
Ejemplo n.º 5
0
 /**
  * Called by HTML_QuickForm whenever form event is made on this element
  *
  * @param string $event Name of event
  * @param mixed $arg event arguments
  * @param object $caller calling object
  * @return bool
  */
 function onQuickFormEvent($event, $arg, &$caller)
 {
     switch ($event) {
         case 'createElement':
             static::__construct($arg[0], $arg[1], $arg[2]);
             $caller->_registerCancelButton($this->getName());
             return true;
             break;
     }
     return parent::onQuickFormEvent($event, $arg, $caller);
 }