public function testCompileWithNumericValue() { $field = new Checkbox("test", "Test", array("test", "blue"), array("useNumericValue" => true)); $expected = "<label for=\"test\">Test</label><div class=\"elements\"><div class=\"element\"><input type=\"checkbox\" name=\"test[]\" value=\"0\" checked=\"checked\" /> <span>test</span></div><div class=\"element\"><input type=\"checkbox\" name=\"test[]\" value=\"1\" /> <span>blue</span></div></div>"; $value = $field->compile(0); $this->assertEquals($expected, $value); }
public function addOption($key, $value, $checked = false) { $element = new Checkbox($this->getName() . '[]', ['value' => $key, 'label' => $value]); if ($checked) { $element->setChecked(); } $this->options[] = $element; }
public function test__toString_WithProperties() { $this->checkbox->setIdentifier('SelectAll_checkbox'); $this->checkbox->setProperties(array('id' => 'chkSelAll', 'label' => 'Select All', 'name' => '_selectall', 'value' => 10)); $expectedAttributes = array('type="checkbox"', 'id="chkSelAll"', 'name="_selectall"', 'value="10"'); $html = $this->checkbox->__toString(); foreach ($expectedAttributes as $attribute) { $this->assertRegExp("/{$attribute}/", $html); } }
/** * zeigt die Radiobuttons an */ function show() { foreach ($this->OBJECTS as $text => $wert) { if (!$this->isHorizontal()) { $text = $text . "<br>"; } $rdb = new Checkbox($this->NAME, $text, $wert); $rdb->setSelected($this->isSelected()); $rdb->show(); } }
/** * Check for the entry */ public function validate() { parent::validate(); if (!is_array($this->varValue) || count($this->varValue) < 1) { $this->addError(sprintf($GLOBALS['TL_LANG']['tl_user']['chooseAtLeastOne'], $this->strLabel)); } }
/** * Adds a validation rule. * @param mixed rule type * @param string message to display for invalid data * @param mixed optional rule arguments * @return FormControl provides a fluent interface */ public function addRule($operation, $message = NULL, $arg = NULL) { if ($operation === ':filled' and is_null($message)) { $message = 'Check %label'; } return parent::addRule($operation, $message, $arg); }
public function __construct($name, $label, $model) { // parent::__construct($name, $label, $model); // $this->setStatus('Ativado', 'Desativado'); }
public function __construct($name, $value = null) { parent::__construct($name); if (is_null($value)) { $value = $name; } $this->setValue($value); }
/** * Constructor * * @param string $caption caption * @param string $name element name * @param mixed $value Pre-selected value (or array of them). * @param integer $size Number or rows. "1" makes a drop-down-list. * @param boolean $multiple Allow multiple selections? */ public function __construct($caption, $name, $value = null, $size = 1, $multiple = false) { parent::__construct($caption, $name, $value, true); //$this->columns = 3; $userGroups = \Xoops::getInstance()->getHandlerMember()->getGroupList(); foreach ($userGroups as $group_id => $group_name) { $this->addOption($group_id, $group_name); } }
protected function getText() { $text = parent::getText(); $appInfo = $this->getFormObj()->getAppInfo(); $link = $appInfo['APP_EULA']; $a_open = "<a href=\"{$link}\" target=\"_blank\">"; $a_close = "</a>"; $text = str_replace("[url]", $a_open, $text); $text = str_replace("[/url]", $a_close, $text); return $text; }
public function __construct($name) { parent::__construct($name); $this->setMulti(true); $categories = get_categories(); $options = array(); foreach ($categories as $category) { $options[] = array('label' => $category->name . '<br />', 'value' => $category->term_id); } $this->setOptions($options); }
/** * Constructor * * @param string|array $caption Caption or array of all attributes * @param string $name element name * @param mixed $value Pre-selected value (or array of them). */ public function __construct($caption, $name = null, $value = null) { if (is_array($caption)) { parent::__construct($caption); } else { parent::__construct([]); $this->setWithDefaults('caption', $caption, ''); $this->setWithDefaults('name', $name, 'name_error'); $this->set('value', $value); } $this->set(':inline'); $userGroups = \Xoops::getInstance()->getHandlerMember()->getGroupList(); $this->addOptionArray($userGroups); }
/** * init */ public function init() { $this->tool = $this->getConfig()->getLtiToolProvider(); // Create Table structure $ff = \Form\Factory::getInstance(); $tf = \Table\Factory::getInstance(); $this->table = $tf->createTable('Manager'); $this->table->addCell(Checkbox::create()); $this->table->addCell(NameCell::create('name'))->setKey()->setUrl(\Tk\Url::createHomeUrl('/consumer/edit.html')); $this->table->addCell(KeyCell::create('key')); $this->table->addCell($tf->createCellString('secret')); //$this->table->addCell($tf->createCellString('consumer_version'))->setLabel('Version'); $this->table->addCell($tf->createCellBoolean('enabled')); $this->table->addCell($tf->createCellBoolean('protected')); $this->table->addCell(DateCell::create('updated')); $this->table->addCell(DateCell::create('created')); $this->table->addAction(DeleteAction::create()); $this->addChild($tf->createTableRenderer($this->table), 'Manager'); }
if (is_object($data) && $data->count() > 0) { $rowCssClass = 'even'; foreach ($data as $object) { $rowCssClass = $rowCssClass === 'odd' ? 'even' : 'odd'; ?> <tr class="<?php echo $rowCssClass; ?> "> <?php if ($hasSelectableRows) { $idValue = $object instanceof sfOutputEscaperArrayDecorator ? $object[$idValueGetter] : $object->{$idValueGetter}(); if (in_array($idValue, $unselectableRowIds->getRawValue())) { $selectCellHtml = ' '; } else { $selectCheckobx = new Checkbox(); $selectCheckobx->setProperties(array('id' => "ohrmList_chkSelectRecord_{$idValue}", 'value' => $idValue, 'name' => 'chkSelectRow[]')); $selectCellHtml = $selectCheckobx->__toString(); } echo content_tag('td', $selectCellHtml); } foreach ($columns as $header) { $cellHtml = ''; $cellClass = ucfirst($header->getElementType()) . 'Cell'; $properties = $header->getElementProperty(); $cell = new $cellClass(); $cell->setProperties($properties); $cell->setDataObject($object); $cell->setHeader($header); if ($hasSummary && $header->getName() == $summary['summaryField']) { ohrmListSummaryHelper::collectValue($cell->toValue(), $summary['summaryFunction']);
function drawEpaonnistuneet($tyyppi, &$joukkue) { $tekijat =& $joukkue->epaonnisrankut; $this->p('Epäonnistuneet rangaistuslaukaukset'); if (count($tekijat) > 0) { ?> <table> <tr> <th> <?php $this->p('nro'); ?> </th> <th> <?php $this->p('aika'); ?> </th> <th> <?php $this->p('tekijä'); ?> </th> <th> <?php $this->p('av/yv/tasa'); ?> </th> <th> <?php $this->p('Siirretyn rangaistuksen aikana'); ?> <br> <?php $this->p('tyhjämaali'); ?> </th> </tr> <?php $tyypit = array('no' => $this->tm->getText('Normaali'), 'yv' => $this->tm->getText('Ylivoima'), 'av' => $this->tm->getText('Alivoima')); $i = 1; foreach ($tekijat as $k => $v) { print '<tr> <td>'; print $i; print ' </td> <td>'; $cb = new Input($tyyppi . 'ertapahtumisaika' . $i, $v['tapahtumisaika'], 'text', 5); $cb->draw(); print ' </td> <td>'; $kotim = $this->toiminto->tiedot['kotimaalit']; $cs = new Select($joukkue->select, $tyyppi . 'ertekija' . $i, $v['tekija']); $cs->draw(); ?> </td> <td> <?php $cs = new Radiobutton($tyypit, $tyyppi . 'ertyyppi' . $i, $v['tyyppi']); //$cs = new Input('tyyppi'.$i,$v['tyyppi'],'text',8); $cs->LINEBREAK = '<br>'; $cs->draw(); ?> </td> <td> <?php $s = (isset($v['tyhjamaali']) and $v['tyhjamaali'] == 't'); $cs = new Checkbox($tyyppi . "tyhjamaali{$i}", 't', 'Tyhjä maali', $s); $cs->draw(); ?> <br> <?php $s = (isset($v['siirrangaikana']) and $v['siirrangaikana'] == 't'); $cs = new Checkbox($tyyppi . "siirrangaikana{$i}", 't', 'siirretyn rangaistuksen aikana', $s); $cs->draw(); ?> </td> </tr> <?php $i++; } print '</table>'; } else { print '<br>'; $this->p('Ei merkintöjä.'); } print '<br>'; }
/** * Maske um Urhzeit incl. Bedingung (<>=) zu erzeugen */ private function getWochentagTermEditorMask() { $div = new Div("editWochentag"); $cboMo = new Checkbox("montag", "", "J", $this->TERM_ROW->getNamedAttribute("montag")); $cboDi = new Checkbox("dienstag", "", "J", $this->TERM_ROW->getNamedAttribute("dienstag")); $cboMi = new Checkbox("mittwoch", "", "J", $this->TERM_ROW->getNamedAttribute("mittwoch")); $cboDo = new Checkbox("donnerstag", "", "J", $this->TERM_ROW->getNamedAttribute("donnerstag")); $cboFr = new Checkbox("freitag", "", "J", $this->TERM_ROW->getNamedAttribute("freitag")); $cboSa = new Checkbox("samstag", "", "J", $this->TERM_ROW->getNamedAttribute("samstag")); $cboSo = new Checkbox("sonntag", "", "J", $this->TERM_ROW->getNamedAttribute("sonntag")); $triggerChb = new Checkbox("trigger_jn", "", "J", $this->TERM_ROW->getNamedAttribute("trigger_jn")); $triggerChb->setToolTip("Gibt an, ob Bedingung für Reverse-Schaltungen geprüft werden soll."); $t = new Table(array("Mo", "Di", "Mi", "Do", "Fr", "Sa", "So", "", "")); $t->setAlign("center"); $r = $t->createRow(); $r->setAttribute(0, "Montag"); $r->setAttribute(1, "Dienstag"); $r->setAttribute(2, "Mittwoch"); $r->setAttribute(3, "Donnerstag"); $r->setAttribute(4, "Freitag"); $r->setAttribute(5, "Samstag"); $r->setAttribute(6, "Sonntag"); $r->setAttribute(7, "Trigger?"); $r->setAttribute(8, ""); $t->addRow($r); $r = $t->createRow(); $r->setAttribute(0, $cboMo); $r->setAttribute(1, $cboDi); $r->setAttribute(2, $cboMi); $r->setAttribute(3, $cboDo); $r->setAttribute(4, $cboFr); $r->setAttribute(5, $cboSa); $r->setAttribute(6, $cboSo); $r->setAttribute(7, $triggerChb); $r->setAttribute(8, new Button("saveEditWochentagTerm", " Speichern ")); $t->addRow($r); $rH3 = $t->createRow(); $rH3->setSpawnAll(true); $rH3->setAttribute(0, new Hiddenfield("editTerm", $_REQUEST['editTerm'])); $t->addRow($rH3); $rH4 = $t->createRow(); $rH4->setSpawnAll(true); $rH4->setAttribute(0, new Hiddenfield("editWochentag", "ok")); $t->addRow($rH4); $div->add($t); return $div; }
function getSingleUpdateMask($rowId) { $tblAll = new Table(array("")); if ($rowId == null || $rowId == "") { return $tblAll; } $f1 = new FontType(); $f1->setFontSize(2); $f1->setBold(true); $f2 = new FontType(); $fts = array($f1, $f2); $table = new Table(array("", "")); $table->setHeadEnabled(false); $table->setBorder(0); $table->setFontTypes($fts); $table->setAlign($this->getAlign()); $table->setVAlign($this->getVAlign()); $table->setAlignments($this->getAlignments()); if ($this->WIDTH > 0) { $table->setWidth($this->WIDTH); } if ($this->HEIGHT > 0) { $table->setHeight($this->HEIGHT); } if ($this->BORDER != null && strlen($this->BORDER) > 0) { $table->setBorder($this->BORDER); } if ($this->PADDING >= 0) { $table->setPadding($this->PADDING); } if ($this->HEAD_ENABLED) { $table->setHeadEnabled($this->HEAD_ENABLED); } if ($this->SPACING >= 0) { $table->setSpacing($this->SPACING); } if ($this->XPOS > 0 && $this->YPOS > 0) { $table->setXPos($this->XPOS); $table->setYPos($this->YPOS); } $chk = 0; $stmnt = "SELECT "; foreach ($this->COLNAMES as $cn) { if ($stmnt != "SELECT ") { $stmnt .= ", "; } $stmnt .= $cn; $chk++; } $stmnt .= ", id as rowid "; $stmnt .= " FROM " . $this->TABLENAME . " where id = " . $rowId . " " . $this->ORDERBY . " LIMIT 1 "; $result = $this->DBCONNECT->executeQuery($stmnt); $rowEdit = mysql_fetch_array($result); for ($i = 0; $i < mysql_num_fields($result) - 1; $i++) { $fieldName = mysql_field_name($result, $i); $arrChk = array_search($fieldName, $this->NOUPDATECOLS); if (strlen($arrChk) == 0) { $r = $table->createRow(); $o = ""; $lookups = getLookupWerte($_SESSION['config']->DBCONNECT, $this->TABLENAME, $fieldName); // in der Datenbank für dieses Datenbankfeld // definierte Combobox laden (wenn vorhanden) $dbCombo = getDbComboArray($this->TABLENAME, $fieldName, $rowEdit); $val = ""; if (isset($rowEdit[$fieldName]) && strlen($rowEdit[$fieldName]) > 0) { $val = $rowEdit[$fieldName]; } if (mysql_num_rows($lookups) == 0 && !$this->isDbComboSet($this->TABLENAME, $fieldName)) { /*if (strpos(" " . $this->DEFAULTS, $fieldName) > 0) { $tmpval = substr($this->DEFAULTS, strpos($this->DEFAULTS, "=") + 1); $o = new HiddenField($fieldName, $tmpval); } else*/ if (strpos(mysql_field_flags($result, $i), "enum") > 0) { $ev = $this->getEnumValues($fieldName); if (count($ev) == 2 && (in_array('J', $ev) && in_array('N', $ev))) { $o = new Checkbox($fieldName . $rowId, "", "J"); if ($rowEdit[$fieldName] == "J") { $o->setSelected(true); } } else { $o = new ComboBox($fieldName . $rowId, $this->getComboboxEnumArray($fieldName)); } } else { if (mysql_field_type($result, $i) == "blob") { $o = new TextArea($fieldName . $rowId, $val, 80, 10); $o->setTextEditor($this->TEXTEDITOR_ENABLED); } else { if (mysql_field_type($result, $i) == "date") { $o = new DateTextfield($fieldName . $rowId, $val); $o->setToolTip("Bitte im Format: <b>YYYY-MM-TT</b> angeben"); } else { if (mysql_field_type($result, $i) == "int") { $o = new TextField($fieldName . $rowId, $val); } else { if (mysql_field_type($result, $i) == "timestamp") { $o = new TextField($fieldName . $rowId, $val); } else { $o = new TextField($fieldName . $rowId, $val); } } } } } } else { if (mysql_num_rows($lookups) > 0) { $o = new LookupCombo($_SESSION['config']->DBCONNECT, $fieldName . $rowId, $this->TABLENAME, $fieldName, $rowEdit[$fieldName]); } else { if (count($dbCombo) > 0) { if (!strpos(" " . $this->DEFAULTS, $fieldName) > 0) { $o = new ComboBox($fieldName . $rowId, $dbCombo, $val); } else { $o = new HiddenField($fieldName . $rowId, $val); } } } } if ($i < count($this->LABELS)) { $r->setAttribute(0, $this->LABELS[$i]); } else { $r->setAttribute(0, ""); } $arrChk = array_search($fieldName, $this->READONLYCOLS); if (strlen($arrChk) != 0) { $o->setReadOnly(true); } $r->setAttribute(1, $o); $table->addRow($r); } } foreach ($this->ADDITIONAL_UPDATE_FIELDS as $label => $field) { $r = $table->createRow(); $r->setAttribute(0, $label); $r->setAttribute(1, $field); $table->addRow($r); } $okButton = new Button("DbTableUpdate" . $this->TABLENAME, "Speichern"); $r = $table->createRow(); $r->setSpawnAll(true); $r->setAttribute(0, $okButton); $table->addRow($r); $rowAll1 = $tblAll->createRow(); $rowAll2 = $tblAll->createRow(); $rowAll1->setAttribute(0, $table); $tblAll->addRow($rowAll1); $tblAll->addRow($rowAll2); $f = new Form($_SERVER['SCRIPT_NAME']); $f->add($tblAll); $f->add(new Hiddenfield("SingleUpdateRowId", $rowId)); $f->add($this->DEFAULT_HIDDEN_FIELDS); return $f; }
/** * Bind form to element * * @param \Magelight\Webform\Blocks\Form $form * @return LabeledCheckbox */ public function bindForm(\Magelight\Webform\Blocks\Form $form = null) { $this->checkbox->bindForm($form); return $this; }
/** * Draw the control body */ function draw_body($parent = "0", $depth = 0) { $data = $this->getFunctionData($parent); for ($i = 0; $i < count($data); $i++) { echo "<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\">"; echo "<tr>"; echo "<td width=\"25\">" . drawSpacer(1, 1). "</td>"; echo "<td width=\"" . (250 - $depth * 25) . "\">" . drawSpacer(1, 1). "</td>"; echo "<td width=\"300\">" . drawSpacer(1, 1). "</td>"; echo "</tr>"; if ($depth == 0) { echo "<tr>"; echo "<td width=\"25\" style=\"border-bottom:1px solid black;\">" . drawSpacer(1, 1). "</td>"; echo "<td width=\"250\" style=\"border-bottom:1px solid black;\">" . drawSpacer(1, 1). "</td>"; echo "<td width=\"300\" style=\"border-bottom:1px solid black;\">" . drawSpacer(1, 1). "</td>"; echo "</tr>"; } echo "<tr>"; if (in_array($data[$i][ID], $this->configData)) { $checked = true; } else { $checked = false; } $chkbox = new Checkbox($data[$i][ID], "1", "embedded", $checked); $chkbox->draw(); $lbl = new Label("lbl", $data[$i][NAME], "bcopy"); $lbl->draw(); $lbl = new Label("lbl", $data[$i][DESC], "bcopy"); $lbl->draw(); echo "</tr>"; echo "<tr>"; echo "<td width=\"15\">" . drawSpacer(1, 1). "</td>"; echo "<td colspan=\"2\">" . drawSpacer(1, 1); $this->draw_body($data[$i][ID], ($depth + 1)); echo "</td>"; echo "</tr>"; echo "</table>"; } }
function drawJoukkeenPelaajat(&$joukkue) { print '<br>'; if (!$this->hasErrors) { $joukkue->sortPelaajat(); } $pelaajat = $joukkue->pelaajat; if (count($pelaajat) > 0) { ?> <table> <tr> <th><?php $this->p('pelaaja'); ?> </th> <th><?php $this->p('Numero'); ?> </th> <th><?php $this->p('Nimi'); ?> </th> <th><?php $this->p('Maalivahti'); ?> </th> <th><?php $this->p('kapteeni'); ?> </th> <th><?php $this->p('(+/-)'); ?> </th> <th><?php $this->p('Peliaika'); ?> </th> <th><?php $this->p('Lisätiedot'); ?> </th> </tr> <?php $toimih = array(); foreach ($pelaajat as $p) { $hid = $p['pelaaja']; print '<tr>'; print '<td>'; array_push($toimih, array($hid, $p['nimi'])); $kp = FALSE; if (isset($p['kokoonpanossa']) and $p['kokoonpanossa']) { $kp = TRUE; } $cb = new Checkbox($joukkue->tyyppi . 'pelaaja' . $hid, 'pelaaja', '', $kp); $cb->draw(); print '</td><td>'; $cb = new Input($joukkue->tyyppi . 'numero' . $hid, $p['numero'], 'text', 2); $cb->draw(); print '</td>'; print '<td>'; print $p['nimi']; ?> </td><td> <?php $cb = new Checkbox($joukkue->tyyppi . 'maalivahti' . $hid, 'maalivahti', '', $p['maalivahti'] == 't' and $kp); $cb->draw(); ?> </td><td> <?php $cb = new Checkbox($joukkue->tyyppi . 'kapteeni' . $hid, 'kapteeni', '', $p['kapteeni'] == 't' and $kp); $cb->draw(); print '</td>'; print '<td>'; $cb = new Input($joukkue->tyyppi . 'plusmiinus' . $hid, $p['plusmiinus'], 'text', 3); $cb->draw(); print '</td>'; print '<td>'; $cb = new Input($joukkue->tyyppi . 'peliaika' . $hid, $p['peliaika'], 'text', 5); $cb->draw(); print '</td>'; print '<td>'; $cb = new Input($joukkue->tyyppi . 'lisatieto' . $hid, $p['lisatieto'], 'text', 500); $cb->draw(); print '</td>'; print '</tr>'; } print '</table>'; print '<br><br>'; print '<table>'; $tar = array(array('', $this->tm->getText('Valitse toimihenkilö'))); usort($toimih, 'toimihenkSort'); $toimih = $tar + $toimih; $t = $joukkue->tyyppi == 'koti' ? 'a' : 'b'; for ($i = 1; $i < 6; $i++) { print '<tr><td>'; $this->p('Toimihenkilö'); print " {$i}"; print '</td><td>'; $cs = new Select($toimih, $t . 'toimihenkilo' . $i, $this->toiminto->tiedot[$t . 'toimihenkilo' . $i][0]->VALUE); $cs->draw(); //print_r($this->toiminto->tiedot[$t.'toimihenkilo'.$i][0]); print '</td></tr>'; } print '</table>'; } else { $this->p('Ei pelaajatietoja'); } print '<br>'; print '<br>'; }
/** * @covers Checkbox::toString */ public function testToString() { $actual = $this->checkbox->toString(); $excepted = '<input name="DateChoice" type="checkbox" value="1" disabled></input>'; $this->assertEquals($excepted, $actual); }
/** * @covers Xoops\Form\Checkbox::__construct * @covers Xoops\Form\Checkbox::render * @covers Xoops\Form\Checkbox::renderValidationJS */ public function test__construct() { $oldWay = new Checkbox('mycaption', 'myname', 'opt1'); $oldWay->addOption('opt1', 'optname1'); $oldWay->addOption('opt2', 'optname2'); $oldWay->setRequired(); $newWay = new Checkbox(['caption' => 'mycaption', 'name' => 'myname', 'value' => 'opt1', 'required' => null, 'option' => ['opt1' => 'optname1', 'opt2' => 'optname2']]); $this->assertEquals($oldWay->render(), $newWay->render()); $this->assertEquals($oldWay->renderValidationJS(), $newWay->renderValidationJS()); }
function toHTML() { if ($this->class) { $class = ' class="' . $this->class . '"'; } else { $class = ''; } if ($this->tabindex) { $tabindex = ' tabindex="' . $this->tabindex . '"'; } else { $tabindex = ''; } $ret = '<span class="fileInputCluster"> <span class="fileInputObject"> <input type="file" id="' . $this->name . '" name="' . $this->name . '"' . $class . $tabindex . ' /> </span> '; if ($this->existing_file) { $delete_check = new Checkbox('delete_' . $this->name, $this->class, 'true', new FormLabel('Delete')); if ($this->tabindex) { $delete_check->setTabindex($this->tabindex + 1); } $ret .= '<span class="' . $this->name . '_existingFile"> Currently: ' . $this->existing_file . ' </span> <span id="' . $this->name . '_existingFileObject" class="existingfileObject"> ' . $delete_check->toHTML() . ' </span> '; } $ret = ' </span>'; return $ret; }
public function testCheckbox() { $checkbox = new Checkbox(['name' => "name", 'checked' => 'checked']); $this->assertEquals($checkbox->render(), '<div><input name="name" type="checkbox" /></div>'); }
function __construct($name = null, $value = null) { parent::__construct($name, $value); $this->attributes['type'] = 'radio'; }
switch ($component) { case "checkbox": $cb = new Checkbox(); break; case "checkbox-off": $cb = new CheckboxOff(); break; case "checkbox-off-pressed": $cb = new CheckboxOffPress(); break; case "checkbox-on-pressed": $cb = new CheckboxOnPress(); break; case "checkbox-off-focus": $cb = new CheckboxOffFocus(); break; case "checkbox-on-focus": $cb = new CheckboxOnFocus(); break; case "checkbox-on-disabled-focus": $cb = new CheckboxDisabledOnFocus(); break; case "checkbox-off-disabled-focus": $cb = new CheckboxDisabledOffFocus(); break; default: $cb = new Checkbox(); break; } $cb->generate_image($color, $size, $holo, $kitkat); }
/** * Checkbox getter Function * @see checkbox() * @ignore */ function get_checkbox($name, $value, $label = FALSE, $args = array()) { $checkbox = new Checkbox($name, $value, $label, $args); return $checkbox->render(); }
/** * Maske um Urhzeit incl. Bedingung (<>=) zu erzeugen */ private function getWochentagTermCreatorMask() { $div = new Div("createWochentag"); $cboMo = new Checkbox("montag"); $cboDi = new Checkbox("dienstag"); $cboMi = new Checkbox("mittwoch"); $cboDo = new Checkbox("donnerstag"); $cboFr = new Checkbox("freitag"); $cboSa = new Checkbox("samstag"); $cboSo = new Checkbox("sonntag"); $triggerChb = new Checkbox("trigger_jn", "", "J"); $triggerChb->setToolTip("Gibt an, ob eine Änderung des Wertes einen Schaltvorgang aktiviert oder nur als Bedingung dient."); $t = new Table(array("Mo", "Di", "Mi", "Do", "Fr", "Sa", "So", "", "")); $t->setAlign("center"); $r = $t->createRow(); $r->setAttribute(0, "Montag"); $r->setAttribute(1, "Dienstag"); $r->setAttribute(2, "Mittwoch"); $r->setAttribute(3, "Donnerstag"); $r->setAttribute(4, "Freitag"); $r->setAttribute(5, "Samstag"); $r->setAttribute(6, "Sonntag"); $r->setAttribute(7, "Trigger?"); $t->addRow($r); $r = $t->createRow(); $r->setAttribute(0, $cboMo); $r->setAttribute(1, $cboDi); $r->setAttribute(2, $cboMi); $r->setAttribute(3, $cboDo); $r->setAttribute(4, $cboFr); $r->setAttribute(5, $cboSa); $r->setAttribute(6, $cboSo); $r->setAttribute(7, $triggerChb); $r->setAttribute(8, new Button("saveCreateWochentagTerm", "Bedingung hinzufuegen")); $t->addRow($r); $rH = $t->createRow(); $rH->setSpawnAll(true); $rH->setAttribute(0, new Hiddenfield("dbTableNewhomecontrol_term", "Neuen Eintrag")); $t->addRow($rH); $rH2 = $t->createRow(); $rH2->setSpawnAll(true); $rH2->setAttribute(0, new Hiddenfield("createWochentag", "ok")); $t->addRow($rH2); $div->add($t); return $div; }
/** * @param string $name * @param string $label * @param int $required * @return Checkbox */ public function addCheckBox($name, $label, $required = Field::FIELD_OPTIONAL) { $checkbox = new Checkbox($name, $required); $checkbox->setLabel($label); $this->fields[$name] = $checkbox; return $checkbox; }
/** * @covers Xoops\Form\Checkbox::renderValidationJS */ public function testRenderValidationJS() { $value = $this->object->renderValidationJS(); $this->assertTrue(is_string($value)); }