Example #1
0
 function count_jobs_by($table_name, $attr, $print_total_count)
 {
     $db = DB::get_instance();
     $q = "SELECT `{$attr}` as val, COUNT(*) c FROM {$table_name} ?where? group by `{$attr}`";
     $q = $this->prepare_query($q);
     $rows = $db->prepare_execute_fetch_all($q);
     $cnt = 0;
     $counts = array();
     array_push($counts, "By {$attr}: ");
     foreach ($rows as $row) {
         array_push($counts, ax_a_href_title(sprintf("%s: %s, ", $row['val'] ? $row['val'] : '""', $row['c']), $this->make_url(1, array($attr => $row['val'])), "show only " . $row['val'] . " jobs"));
         $cnt += $row['c'];
     }
     array_push($counts, ax_raw("<br/>"));
     if ($print_total_count) {
         array_unshift($counts, ax_raw("Total: {$cnt} jobs found<br/>"));
     }
     $this->m->append(ax_fragment($counts));
 }
Example #2
0
 /**
  * \private
  *
  * Build a block level HTML element with the specified properties.
  *
  * \param $tag_name
  *   The name of the XHTML tag that should be created. Only a few
  *   block-level tags can be handled.
  *
  * \param $parsed_block
  *   A parsed block
  *
  * \return
  *   XHTML snippet as a string
  */
 function _build_html_block_element($tag_name, $parsed_block)
 {
     assert('is_string($tag_name); // tag name must be a string');
     assert('in_array($tag_name, explode(",", "p,h1,h2,h3,h4,h5,h6,div")); // invalid tag name');
     $attr = array();
     /* Class, id and language attributes can be copied. */
     foreach (array('class', 'id', 'lang') as $key) {
         if (!is_null($parsed_block[$key])) {
             $attr[$key] = $parsed_block[$key];
         }
     }
     /* The style attribute is a bit trickier, since the alignment and padding
      * specificiers must be incorporated as well. */
     $attr['style'] = '';
     if (!is_null($parsed_block['style'])) {
         $attr['style'] = $parsed_block['style'];
         /* Make sure the style declaration ends with a semicolon, so that we
          * can safely append other CSS snippets. */
         if (!str_has_suffix($attr['style'], ';')) {
             $attr['style'] .= ';';
         }
     }
     /* Alignment */
     if (!is_null($parsed_block['align'])) {
         $spec_to_value_mapping = array('<' => 'left', '>' => 'right', '=' => 'center', '<>' => 'justify');
         $attr['style'] .= sprintf(' text-align: %s;', $spec_to_value_mapping[$parsed_block['align']]);
     }
     /* Padding */
     if ($parsed_block['padding-left'] > 0) {
         $attr['style'] .= sprintf(' padding-left: %dem;', $parsed_block['padding-left']);
     }
     if ($parsed_block['padding-right'] > 0) {
         $attr['style'] .= sprintf(' padding-right: %dem;', $parsed_block['padding-right']);
     }
     /* Only include style attribute if needed */
     if (strlen($attr['style']) == 0) {
         array_unset_key($attr, 'style');
     }
     /* Generate the result */
     switch ($tag_name) {
         case 'p':
             $el = new AnewtXHTMLParagraph(null);
             break;
         case 'div':
             $el = new AnewtXHTMLDiv(null);
             break;
         case 'h1':
             $el = new AnewtXHTMLHeader1(null);
             break;
         case 'h2':
             $el = new AnewtXHTMLHeader2(null);
             break;
         case 'h3':
             $el = new AnewtXHTMLHeader3(null);
             break;
         case 'h4':
             $el = new AnewtXHTMLHeader4(null);
             break;
         case 'h5':
             $el = new AnewtXHTMLHeader5(null);
             break;
         case 'h6':
             $el = new AnewtXHTMLHeader6(null);
             break;
         default:
             assert('false; // unknown block tag name');
             break;
     }
     $el->append_child(ax_raw($parsed_block['markup']));
     $el->set_attributes($attr);
     return $el;
 }
Example #3
0
/**
 * Format a text node using a format specifier and supplied values.
 *
 * This method acts like sprintf(), but supports DOM nodes and takes care of XML
 * escaping. This function formats its arguments into a (raw) DOM node instead
 * of a string. The supplied values may regular values such as strings and
 * numbers, but may be XML nodes as well. This means you can pass XML node
 * instances created by the functions in the xhtml module as values. The format
 * specifier will be escaped for XML, and XML nodes will be rendered into
 * escaped strings before substitution into the format specifier.
 *
 * This example results in a valid XHTML paragraph:
 *
 * <code>
 * ax_p(ax_sprintf('%s & %s', ax_span_class('Sugar', 'sweet'), 'Spice'));
 * </code>
 *
 * \param $format
 *   A format specifier in sprintf syntax.
 *
 * \param $values
 *   One or more values to be substituted into the format string.
 *
 * \return
 *   An AnewtXHTMLRaw instance that can be added to a DOM tree (or page).
 */
function ax_sprintf($format, $values)
{
    /* Accept multiple parameters, just like sprintf */
    $values = func_get_args();
    /* First parameter is the format */
    $format = array_shift($values);
    if ($format instanceof AnewtXMLDomNode) {
        $format = to_string($format);
    } else {
        assert('is_string($format)');
        $format = htmlspecialchars($format);
    }
    /* Render DOM nodes into strings. The $values array is modified in-place. */
    foreach (array_keys($values) as $key) {
        if (is_string($values[$key])) {
            $values[$key] = htmlspecialchars($values[$key]);
        } elseif ($values[$key] instanceof AnewtXMLDomNode) {
            $values[$key] = to_string($values[$key]);
        }
    }
    /* Everything is already escaped, so return a raw node */
    return ax_raw(vsprintf($format, $values));
}
Example #4
0
    }
    if (str_has_prefix($arg, '--')) {
        continue;
    }
    $fd = fopen($arg, 'r');
    $title = $arg;
    break;
}
/* Input */
$input_chunks = array();
while (!feof($fd)) {
    $input_chunks[] = fread($fd, 16384);
}
$input = join('', $input_chunks);
fclose($fd);
/* Output */
$output = TextFormatter::format($input, 'textile');
$output = trim($output);
if ($use_page) {
    anewt_include('page');
    $page = new AnewtPage();
    $page->enable_dublin_core = false;
    $page->content_type = 'application/xhtml+xml';
    $page->charset = 'UTF-8';
    $page->title = $title;
    $page->add_stylesheet_href_media('style.css', 'screen');
    $page->append(ax_raw($output));
    echo to_string($page), NL;
} else {
    echo $output, NL;
}
Example #5
0
 function display_jobs($jobs, $row)
 {
     $id = $row['item'];
     $jobs = ax_a_href_title(ax_raw("log&rarr;"), $this->make_url(0, array('show' => 'jobLogs', 'type' => 'LIKE:comments', 'args' => "LIKE:% {$id} %", 'interval' => '7 DAY')), "show job logs for comments of item {$id}");
     return $jobs;
 }
Example #6
0
 function display_tags($tags, &$row)
 {
     if ($tags != $this->last_displayed_tags) {
         $row['css_class'] .= " first-row-in-group";
     }
     $this->last_displayed_tags = $tags;
     $f = ax_fragment();
     $tags = split(",", $tags);
     for ($i = 0; $i < count($tags); $i++) {
         $f->append_child(ax_a_href_title($tags[$i], $this->make_url(1, array('tags' => "HAS:" . $tags[$i])), "Only show rows with tag " . $tags[$i]));
         if ($i < count($tags) - 1) {
             $f->append_child(ax_raw(","));
         }
     }
     return $f;
 }
Example #7
0
 function display_comments($comments, $row)
 {
     $id = $row['id'];
     $comments = ax_a_href_title(ax_raw("comments&rarr;"), $this->make_url(0, array('show' => 'comments', 'item' => $id)), "show comments for item {$id}");
     return $comments;
 }
Example #8
0
 function display_jobs($value, $row)
 {
     return ax_a_href_title(ax_raw("&rarr;"), $this->make_url(0, array('show' => 'jobLogs', 'task' => $row['id'])), "Show job logs for task " . $row['id']);
 }
Example #9
0
<?php

// This will result in <a href="#">...</a> showing up in your browser:
$p = ax_p('This should be a <a href="#">hyperlink</a>, but it is not.');
// This will result in a functioning hyperlink:
$p = ax_p(ax_raw('This is a real <a href="#">hyperlink</a>.'));
// This is the same as the previous line of code:
$p = new AnewtXHTMLParagraph(new AnewtXHTMLRaw('This is a real <a href="#">hyperlink</a>.'));
Example #10
0
$fragment->append_child(new AnewtXHTMLHeader2('Forms'));
$form = new AnewtXHTMLForm(null, array('method' => 'GET'));
$input_fragment = new AnewtXHTMLFragment();
$input_fragment->append_child(new AnewtXHTMLLabel('Label: ', array('for' => 'test')));
$input_fragment->append_child(new AnewtXHTMLInput(null, array('name' => 'test', 'id' => 'test', 'type' => 'text')));
$form->append_child(new AnewtXHTMLParagraph($input_fragment));
$select = new AnewtXHTMLSelect(null, array('name' => 'select'));
$select->append_child(new AnewtXHTMLOption('First', array('value' => 'first')));
$select->append_child(new AnewtXHTMLOption('Second', array('value' => 'second')));
$select->append_child(new AnewtXHTMLOption('Third', array('value' => 'third')));
$form->append_child(new AnewtXHTMLParagraph($select));
$fragment->append_child($form);
$form->append_child(new AnewtXHTMLParagraph(new AnewtXHTMLInput(null, array('type' => 'submit'))));
/* Convenience API */
$r = array();
$r[] = ax_h2('Convenience API');
$r[] = ax_p('Test with some <& special characters.', array('style' => 'color: #ccc;'));
$r[] = ax_p_class(ax_raw('This is <strong>strong</strong>'), 'someclass');
$r[] = ax_p(ax_abbr('ICE', 'InterCity Express'));
$r[] = ax_p(array('Test', ax_br(), 'after the break'));
$p = ax_p(array('testje', array('1', '2'), ax_strong('blablabla')));
$p->set_attribute('id', 'paragraph-id');
$p->set_class('foo bar baz');
$p->remove_class('bar');
$p->add_class('quux');
$p->append_child(ax_a_href('name', '/url/'));
$r[] = $p;
$r[] = ax_p(ax_sprintf('%s & %s', ax_span_class('Sugar', 'sweet'), 'Spice'));
$fragment->append_child(ax_fragment($r, ax_p('final paragraph')));
/* Final output */
echo to_string($fragment), NL;
Example #11
0
<?php

require_once dirname(__FILE__) . '/../anewt.lib.php';
define('ANEWT_TEXTILE_DEVELOPMENT', 1);
anewt_include('page');
$p = new AnewtPage();
$p->set('title', 'Textile formatting test');
if (AnewtRequest::get_bool('debug')) {
    header('Content-type: text/plain');
    $p->set('content_type', 'text/plain');
} else {
    list($base_url, $params) = AnewtUrl::parse(AnewtRequest::url());
    $params['debug'] = '1';
    $debug_url = AnewtUrl::build(array($base_url), $params);
    $p->append(ax_p(ax_a_href('(Page source for debugging)', $debug_url)));
}
anewt_include('textformatting');
anewt_include('textile');
$text = file_get_contents(dirname(__FILE__) . '/sample-text.txt');
$formatted_text = TextFormatter::format($text, 'textile');
$p->append(ax_raw($formatted_text));
$p->flush();
Example #12
0
/**
 * Join array elements with a string or DOM node.
 *
 * This is an XHTML-aware version of the built-in join() function.
 * 
 * \param $glue
 *   The glue string (or DOM node) to insert between each subsequent pair of
 *   values.
 *
 * \param $values
 *   The values to join together. These can be strings or DOM nodes.
 *
 * \return
 *   A DOM node instance containing the joined values.
 */
function ax_join($glue, $values)
{
    assert('is_numeric_array($values);');
    /* Make sure the glue is escaped properly */
    if ($glue instanceof AnewtXMLDomNode) {
        $glue = to_string($glue);
    } else {
        assert('is_string($glue)');
        $glue = htmlspecialchars($glue);
    }
    /* Build a format string so that ax_vsprintf() can do the real work */
    $glue = str_replace('%', '%%', $glue);
    $format = join($glue, array_fill(0, count($values), '%s'));
    return ax_vsprintf(ax_raw($format), $values);
}
Example #13
0
<?php

$p = new AnewtPage();
$p->append(ax_p('This is a paragraph of text.'));
$p->append(ax_raw('<p>This is some <code>pre-formatted</code> text.</p>'));
$p->append('This string will be escaped: <, &, and > are no problem!');
$p->flush();
Example #14
0
 function TestForm()
 {
     parent::__construct();
     /* General form setup and test some properties */
     $this->setup('test-name', ANEWT_FORM_METHOD_POST, AnewtRequest::url(true));
     $this->set('error', 'This is a general form error.');
     $this->set('description', 'This is the form\'s description.');
     /* Test text entry controls */
     $text1 = new AnewtFormControlText('text1');
     $text1->set('label', 'Text field:');
     $text1->set('secondary-label', 'Secondary label');
     $text1->set('value', 'Short string with & spécial chars');
     $text1->set('help', 'You can type some text here.');
     $text1->set('description', 'Type at least 3 characters here.');
     $text1->add_validator(new AnewtValidatorLength(3, null), 'Too short (minimum number of characters is 3).');
     $this->add_control($text1);
     $text2 = new AnewtFormControlTextMultiline('text2');
     $this->add_control($text2);
     /* Set properties after adding to test references */
     $text2->set('description', 'You may enter some longer text here.');
     $text2->set('value', "Some readonly text\nwith multiple\nlines\nand some spécial characters\nlike &, ', < and >.");
     $text2->set('label', 'Multiline textfield:');
     $text2->set('readonly', true);
     $text3 = new AnewtFormControlTextMultiline('text3');
     $text3->set('value', "A larger control with a\nbit more space (4 lines!)\nto type some text, if only\nit wasn't disabled…");
     $text3->set('label', 'Larger multiline:');
     $text3->set('secondary-label', 'Secondary label');
     $text3->set('rows', 4);
     $text3->set('columns', 40);
     $text3->set('disabled', true);
     $text3->set('error', 'This is an error description.');
     $this->add_control($text3);
     $text4 = new AnewtFormControlTextMultiline('text4');
     $text4->set('value', 'Okay, this is multiline text you can edit yourself…');
     $text4->set('label', 'Another multiline:');
     $text4->set('rows', 2);
     $text4->set('columns', 50);
     $this->add_control($text4);
     /* Test adding custom nodes to the form */
     $this->add_node(ax_p('This is a normal paragraph inside the form.'));
     $this->add_node(ax_raw('<p><strong>Formatted text</strong> can be here as well.</p>'));
     /* Some more text controls with various property combinations */
     $text5 = new AnewtFormControlText('text5');
     $text5->set('label', 'A number between 1 and 10:');
     $text5->set('description', 'This should be 8 by default. You should not be able to type more than 2 characters into this field.');
     $text5->set('value', '7');
     // Set again to 8 later using set_control_value!
     $text5->set('help', 'Enter a number between 1 and 10 inclusive, please.');
     $text5->set('size', 2);
     $text5->set('maxlength', 2);
     $text5->add_validator(new AnewtValidatorInteger(1, 10), 'This number is not valid.');
     $this->add_control($text5);
     $text6 = new AnewtFormControlPassword('text6');
     $text6->set('label', 'Password:'******'description', 'This control can hold only 8 characters. This field is not required and will give a NULL value when left empty.');
     $text6->set('size', 8);
     $text6->set('maxlength', 8);
     $text6->set('value', 'not-shown');
     $text6->set('required', false);
     $text6->set('help', 'Enter a password, please.');
     $this->add_control($text6);
     $text7 = new AnewtFormControlPassword('text7');
     $text7->set('label', 'Echoed password:'******'description', 'This password is echoed back when the form is submitted.');
     $text7->set('value', 'shown');
     $text7->set('show-value', true);
     $this->add_control($text7);
     $text8 = new AnewtFormControlText('text8');
     $text8->set('label', 'Email:');
     $text8->set('value', '*****@*****.**');
     $text8->add_validator(new AnewtValidatorEmail(), 'This does not look like an email address.');
     $this->add_control($text8);
     /* Check box */
     $check1 = new AnewtFormControlCheckbox('check1');
     $check1->set('label', 'Checkbox:');
     $check1->set('secondary-label', 'Check me');
     $check1->set('help', 'Feel free to check me!');
     $this->add_control($check1);
     $check2 = new AnewtFormControlCheckbox('check2');
     $check2->set('label', 'Disabled checkbox:');
     $check2->set('disabled', true);
     $this->add_control($check2);
     $check3 = new AnewtFormControlCheckbox('check3');
     $check3->set('label', 'Another checkbox:');
     $check3->set('secondary-label', 'Check me too');
     $check3->set('value', true);
     $this->add_control($check3);
     /* Choice control, multiple same values */
     $choice_same_values = new AnewtFormControlChoice('choice-same-values');
     $choice_same_values->set('label', 'Choose:');
     $choice_same_values->set('description', 'Multiple options have the same value. Only the first should be selected.');
     $choice_same_values->add_option_value_label('same-value', 'Option 1 (same value as option 2');
     $choice_same_values->add_option_value_label('same-value', 'Option 2 (same value as option 1');
     $choice_same_values->add_option_value_label('other-value', 'Option 3');
     $choice_same_values->set('value', 'same-value');
     $this->add_control($choice_same_values);
     /* Choice control, single select */
     $single_choice_fieldset = new AnewtFormFieldset('single-choice');
     $single_choice_fieldset->set('label', 'Single select');
     $single_choice_fieldset->set('description', 'You can select a single value here. By default, the second option is selected in both cases, and the first option is disabled.');
     $choice1 = new AnewtFormControlChoice('choice1');
     $choice1->set('label', 'Make a choice:');
     $option = new AnewtFormOption('first', 'First option');
     $option->set('disabled', true);
     $choice1->add_option($option);
     unset($option);
     $choice1->add_option_value_label('second', 'Second option');
     $choice1->add_option_value_label('third', 'Third option');
     $choice1->add_option_value_label('fourth', 'Fourth option');
     $choice1->set('value', 'second');
     $single_choice_fieldset->add_control($choice1);
     $choice2 = new AnewtFormControlChoice('choice2');
     $choice2->set('threshold', 3);
     $choice2->set('label', 'Make a choice:');
     $option = new AnewtFormOption('first', 'First option');
     $option->set('disabled', true);
     $choice2->add_option($option);
     unset($option);
     $choice2->add_option_value_label('second', 'Second option');
     $choice2->add_option_value_label('third', 'Third option');
     $choice2->add_option_value_label('fourth', 'Fourth option');
     $choice2->set('value', 'second');
     $single_choice_fieldset->add_control($choice2);
     $choice3 = new AnewtFormControlChoice('choice3');
     $choice3->set('threshold', 3);
     $choice3->set('size', 4);
     $choice3->set('label', 'Make a choice:');
     $option = new AnewtFormOption('first', 'First option');
     $option->set('disabled', true);
     $choice3->add_option($option);
     unset($option);
     $choice3->add_option_value_label('second', 'Second option');
     $choice3->add_option_value_label('third', 'Third option');
     $choice3->add_option_value_label('fourth', 'Fourth option');
     $choice3->set('value', 'second');
     $single_choice_fieldset->add_control($choice3);
     $single_choice_fieldset->add_node(ax_p('This is a normal paragraph inside a fieldset.'));
     $this->add_fieldset($single_choice_fieldset);
     /* Choice control, multiple select */
     $multiple_choice_fieldset = new AnewtFormFieldset('multiple-choice');
     $multiple_choice_fieldset->set('label', 'Multiple select');
     $multiple_choice_fieldset->set('description', 'You can select multiple values here. By default, the second and third options are selected in both cases, and the first option is disabled.');
     $choice4 = new AnewtFormControlChoice('choice4');
     $choice4->set('multiple', true);
     $choice4->set('label', 'Make a choice:');
     $option = new AnewtFormOption('first', 'First option');
     $option->set('disabled', true);
     $choice4->add_option($option);
     unset($option);
     $choice4->add_option_value_label('second', 'Second option');
     $choice4->add_option_value_label('third', 'Third option');
     $choice4->add_option_value_label('fourth', 'Fourth option');
     /* Value is deliberately set twice to test unsetting of old values */
     $choice4->set('value', array('first', 'second'));
     $choice4->set('value', array('second', 'third'));
     $multiple_choice_fieldset->add_control($choice4);
     $choice5 = new AnewtFormControlChoice('choice5');
     $choice5->set('multiple', true);
     $choice5->set('threshold', 3);
     $choice5->set('label', 'Make a choice:');
     $option = new AnewtFormOption('first', 'First option');
     $option->set('disabled', true);
     $choice5->add_option($option);
     unset($option);
     $choice5->add_option_value_label('second', 'Second option');
     $choice5->add_option_value_label('third', 'Third option');
     $choice5->add_option_value_label('fourth', 'Fourth option');
     $choice5->set('value', array('second', 'third'));
     $multiple_choice_fieldset->add_control($choice5);
     $this->add_fieldset($multiple_choice_fieldset);
     /* Choice control, with option groups */
     $option_groups_fieldset = new AnewtFormFieldset('option-groups-fieldset');
     $option_groups_fieldset->set('label', 'Option groups');
     $option_groups_fieldset->set('description', 'Single and multiple select controls with option groups.');
     $choice6 = new AnewtFormControlChoice('choice6');
     $og = new AnewtFormOptionGroup('First group');
     $og->add_option_value_label('1a', 'A');
     $og->add_option_value_label('1b', 'B');
     $choice6->add_option_group($og);
     $og = new AnewtFormOptionGroup('Second group');
     $og->add_option_value_label('2a', 'A');
     $og->add_option_value_label('2b', 'B');
     $choice6->add_option_group($og);
     $choice6->set('label', 'Make a choice:');
     $choice6->set('description', 'Choice 2a selected by default.');
     $choice6->set('value', '2a');
     $option_groups_fieldset->add_control($choice6);
     $choice7 = new AnewtFormControlChoice('choice7');
     $choice7->add_option_value_label('o1', 'First option (not in a group)');
     $option_group_1 = new AnewtFormOptionGroup('First group');
     $option = new AnewtFormOption('g1o1', 'First disabled suboption in first group');
     $option->set('disabled', true);
     $option_group_1->add_option($option);
     $option_group_1->add_option_value_label('g1o2', 'Second suboption in first group');
     $option_group_1->add_option_value_label('g1o3', 'Third suboption in first group');
     $choice7->add_option_group($option_group_1);
     $option_group_2 = new AnewtFormOptionGroup('Second group');
     $option_group_2->add_option_value_label('g2o1', 'First suboption in second group');
     $option_group_2->add_option_value_label('g2o2', 'Second suboption in second group');
     $choice7->add_option_group($option_group_2);
     $choice7->add_option_value_label('o3', 'Third option (not in a group)');
     $option_group_3 = new AnewtFormOptionGroup('Third group (completely disabled)');
     $option_group_3->set('disabled', true);
     $option_group_3->add_option_value_label('g3o1', 'Only suboption in third group');
     $choice7->add_option_group($option_group_3);
     $choice7->add_option_value_label('04', 'Fourth option, not in a group');
     $choice7->set('label', 'Make multiple choices:');
     $choice7->set('description', 'Options 1 and group 2 option 1 are selected by default.');
     $choice7->set('multiple', true);
     $choice7->set('value', array('g2o1', 'o1'));
     $option_groups_fieldset->add_control($choice7);
     $choice8 = new AnewtFormControlChoice('choice8');
     $choice8->set('label', 'No selection here:');
     $choice8->set('description', 'This choice control only contains disabled options and disabled or empty option groups. The first one should be forcibly selected. Yes, this is a really nasty edge case.');
     $og = new AnewtFormOptionGroup('Empty group 1');
     $choice8->add_option_group($og);
     $og = new AnewtFormOptionGroup('Disabled group 2');
     $og->set('disabled', true);
     $og->add_option_value_label('none', '1a');
     $og->add_option_value_label('none', '1b');
     $choice8->add_option_group($og);
     $option = new AnewtFormOption('none', 'Disabled option');
     $option->set('disabled', true);
     $choice8->add_option($option);
     $choice8->set('value', 'too bad this is totally invalid');
     $option_groups_fieldset->add_control($choice8);
     $this->add_fieldset($option_groups_fieldset);
     /* Hidden controls */
     $hidden1 = new AnewtFormControlHidden('hidden1');
     $hidden1->set('value', 'sekr1t!');
     $this->add_control($hidden1);
     $this->add_hidden_control('hidden2', 'another && śèkŕ1t');
     /* Buttons */
     $button_fieldset = new AnewtFormFieldset('buttons');
     $button_fieldset->set('label', 'Button fieldset');
     $submit = new AnewtFormControlButtonSubmit('submit');
     $submit->set('label', 'Submit form');
     $submit->set('help', 'Press this button to submit this form');
     $button_fieldset->add_control($submit);
     $submit2 = new AnewtFormControlButtonSubmit('submit2');
     $submit2->set('label', 'Disabled submit button');
     $submit2->set('disabled', true);
     $button_fieldset->add_control($submit2);
     $submit = new AnewtFormControlButtonSubmit('submit3');
     $submit->set('label', 'Another submit button');
     $button_fieldset->add_control($submit);
     $reset = new AnewtFormControlButtonReset('reset');
     $reset->set('label', 'Reset to default values');
     $reset->set('help', 'Reset the values of the form fields to their original values');
     $button_fieldset->add_control($reset);
     $extra = new AnewtFormControlButton('extra-button');
     $extra->set('label', 'Extra button that does not do anything');
     $button_fieldset->add_control($extra);
     $this->add_fieldset($button_fieldset);
 }
Example #15
0
 function sum_method()
 {
     $methods_sh = array('id3' => 'id3', 'filename' => 'file', 'anchor' => 'anch', '' => '');
     $display_values = array();
     foreach ($this->method_counts as $method => $count) {
         $display_values[] = array(ax_raw("&sum; " . $methods_sh[$method] . "="), $count, ax_br());
     }
     return $display_values;
 }