コード例 #1
0
ファイル: TimeField.php プロジェクト: pablius/oob-n1
 /**
  * Helper function to create a TimeField.  Useful for quick adding it to a ComponentCollection
  *
  * @param string $name The field's HTML name attribute.
  * @param string $label The label text to display next to this field (defaults to '')
  * @param string $id The unique id of this component (defaults to an auto-assigned id).	 
  * @return PhpExt_Form_TimeField
  */
 public static function createTimeField($name, $label = null, $id = null)
 {
     $c = new PhpExt_Form_TimeField();
     $c->setName($name);
     if ($label !== null) {
         $c->setFieldLabel($label);
     }
     if ($id !== null) {
         $c->setId($id);
     }
     return $c;
 }
コード例 #2
0
ファイル: dynamic.php プロジェクト: beodob/php-ext
include_once 'PhpExt/Panel.php';
include_once 'PhpExt/TabPanel.php';
include_once 'PhpExt/QuickTips.php';
include_once 'PhpExt/Layout/ColumnLayout.php';
include_once 'PhpExt/Layout/FormLayout.php';
include_once 'PhpExt/Layout/FitLayout.php';
include_once 'PhpExt/Layout/AnchorLayoutData.php';
include_once 'PhpExt/Layout/ColumnLayoutData.php';
//****************************** Simple Form
$simple = new PhpExt_Form_FormPanel();
$simple->setLabelWidth(75)->setUrl("save-form.php")->setFrame(true)->setTitle("Simple Form")->setBodyStyle("padding:5px 5px 0")->setWidth(350)->setDefaults(new PhpExt_Config_ConfigObject(array("width" => 230)))->setDefaultType("textfield");
$firstName = PhpExt_Form_TextField::createTextField("first", "First Name")->setAllowBlank(false);
$lastName = PhpExt_Form_TextField::createTextField("last", "Last Name");
$company = PhpExt_Form_TextField::createTextField("company", "Company");
$email = PhpExt_Form_TextField::createTextField("email", "Email", null, PhpExt_Form_FormPanel::VTYPE_EMAIL);
$time = PhpExt_Form_TimeField::createTimeField("time", "Time")->setMinValue("8:00am")->setMaxValue("6:00pm");
$simple->addItem($firstName)->addItem($lastName)->addItem($company)->addItem($email)->addItem($time);
$simple->addButton(PhpExt_Button::createTextButton("Save"));
$simple->addButton(PhpExt_Button::createTextButton("Cancel"));
//****************************** Adding Fieldset
$fsf = new PhpExt_Form_FormPanel();
$fsf->setLabelWidth(75)->setUrl("save-form.php")->setFrame(true)->setTitle("Simple Form with FieldSets")->setBodyStyle("padding:5px 5px 0")->setWidth(350);
//- Fielset 1
$fieldset1 = new PhpExt_Form_FieldSet();
$fieldset1->setCheckboxToggle(true)->setTitle("User Information")->setAutoHeight(true)->setDefaults(new PhpExt_Config_ConfigObject(array("width" => 210)))->setCollapsed(true);
// Use the helper function to easily create fields to add them inline
$fieldset1->addItem(PhpExt_Form_TextField::createTextField("first", "First Name")->setAllowBlank(false))->addItem(PhpExt_Form_TextField::createTextField("last", "Last Name"))->addItem(PhpExt_Form_TextField::createTextField("company", "Company"))->addItem(PhpExt_Form_TextField::createTextField("email", "Email")->setVType(PhpExt_Form_FormPanel::VTYPE_EMAIL));
$fsf->addItem($fieldset1);
//- Fieldset 2
$fieldset2 = new PhpExt_Form_FieldSet();
$fieldset2->setTitle("Phone Number")->setCollapsible(true)->setAutoHeight(true)->setDefaults(new PhpExt_Config_ConfigObject(array("width" => 210)))->addItem(PhpExt_Form_TextField::createTextField("home", "Home")->setValue("(888) 555-1212"))->addItem(PhpExt_Form_TextField::createTextField("business", "Business"))->addItem(PhpExt_Form_TextField::createTextField("mobile", "Mobile"))->addItem(PhpExt_Form_TextField::createTextField("fax", "Fax"));