/** * @covers Xoops\Form\ColorPicker::__construct * @covers Xoops\Form\ColorPicker::render */ public function test__construct() { $oldWay = new ColorPicker('mycaption', 'myname'); $newWay = new ColorPicker(['caption' => 'mycaption', 'type' => 'text', 'name' => 'myname']); $this->assertEquals(substr($oldWay->render(), 0, 18), substr($newWay->render(), 0, 18)); $this->assertEquals(substr($oldWay->render(), -40), substr($newWay->render(), -40)); $this->assertEquals(strlen($oldWay->render()), strlen($newWay->render())); }
public static function getColorPicker() { if (!self::$colorPicker) { self::$colorPicker = new ColorPicker(); } return self::$colorPicker; }
/** * FormHandler::colorPicker() * * Creates a colorpicker on the form * * @param string $title: The title of the field * @param string $name: The name of the field * @param string $validator: The validator which should be used to validate the value of the field * @param int $size: The size of the field * @param int $maxlength: The allowed max input of the field * @param string $extra: CSS, Javascript or other which are inserted into the HTML tag * @return void * @access public * @author Johan Wiegel * @since 23-10-2008 */ function colorPicker($title, $name, $validator = null, $size = null, $maxlength = null, $extra = null) { require_once FH_INCLUDE_DIR . 'fields/class.ColorPicker.php'; // create the field $fld = new ColorPicker($this, $name); if (!empty($validator)) { $fld->setValidator($validator); } if (!empty($size)) { $fld->setSize($size); } if (!empty($maxlength)) { $fld->setMaxlength($maxlength); } if (!empty($extra)) { $fld->setExtra($extra); } // register the field $this->_registerField($name, $fld, $title . $fld->sTitleAdd); }
/** * @covers Xoops\Form\ColorPicker::renderValidationJS */ public function testRenderValidationJS() { $value = $this->object->renderValidationJS(); $this->assertTrue(is_string($value)); }
$entry2 = new Entry('nombre', '', 'Nombre'); $entry2->setComment('Apellido de tu abuelita'); $left->packStart($entry2); $left->packStart($entry); $left->packStart(new Entry('apellido_2', '', 'Apellido Materno')); /*right side*/ /*right up*/ $right_up = new HBox(); $right_up_left = new VBox(); $right_up_right = new VBox(); $right_up->packStart($right_up_left); $right_up->packStart($right_up_right); /*Right up left*/ $right_up_left->packStart(new Button('hola', 'Hola')); $right_up_left->packStart(new DatePicker('hola', '', '', STOCK_CALENDAR)); $colorPicker = new ColorPicker('color', '', '', STOCK_COLORSELECT); $colorPicker->usePopup(); $right_up_left->packStart($colorPicker); /*Right up right*/ $right_up_right->packStart(new TextArea('textarea', 'Hola Mundo!')); /*right down*/ $right_down = new HBox(); $right_down->packStart(new Button('picame', 'picame')); $right_down->packStart(new Button('sueltame', 'sueltame')); $right_down->packStart($fieldset); $right_down->packStart($combogroup); $right->packStart($right_up); $right->packStart($right_down); $form = new Form('hola.php'); $form->add($main_box); $form->show();