public function __construct() { parent::__construct(); $columns = array(); $columns[] = new PropertyColumn('Sample Value', 'value'); $provider = new SampleDataProvider(); $table = new DefaultDataTable('table', $provider, $columns); $this->add($table); }
public function __construct() { parent::__construct(); $self = $this; $this->add(new Link('login', function () use($self) { $_SESSION['auth'] = true; $self->setPage(HomePage::getIdentifier()); })); }
public function __construct() { parent::__construct(); $this->domain = new ExampleDomain(); $this->setModel(new CompoundPropertyModel($this, 'domain')); $feedback = new FeedbackPanel('feedback'); $this->add($feedback); $form = new Form('form'); $this->add($form); $self = $this; $form->add(new Button('button', function () use($self) { $self->info('First button pressed, valid form'); }, function () use($self) { $self->info('First button pressed, invalid form'); })); $form->add(new Button('button2', function () use($self) { $self->info('Second button pressed, valid form'); }, function () use($self) { $self->info('Second button pressed, invalid form'); })); $submitedInfo = new MarkupContainer('submitedInfo'); $this->add($submitedInfo); $choices = array('default', 'option', 'other option', 'something else'); $form->add(new TextField('textBox')); $form->add(new TextArea('textArea')); $form->add(new DropDown('select', $choices)); $group = new RadioGroup('rgroup'); $form->add($group); $group->add(new Radio('gradio1', new BasicModel('option1'))); $group->add(new Radio('gradio2', new BasicModel('option2'))); $form->add(new CheckBox('icheck')); $checkGroup = new CheckBoxGroup('cgroup'); $form->add($checkGroup); $checkGroup->add(new Check('check1', new BasicModel('option1'))); $checkGroup->add(new Check('check2', new BasicModel('option2'))); $form->add(new RadioChoice('rchoice', $choices)); $form->add(new CheckChoice('cchoice', $choices)); $form->add(new ListMultiple('mchoice', $choices)); $submitedInfo->add(new Label('textBox')); $submitedInfo->add(new Label('textArea')); $submitedInfo->add(new Label('select')); $submitedInfo->add(new Label('rgroup')); $submitedInfo->add(new Label('icheck')); $submitedInfo->add(new ListView('cgroup', function (&$item) { $item->add(new Label('value', $item->getModel())); })); $submitedInfo->add(new Label('rchoice')); $submitedInfo->add(new ListView('cchoice', function (&$item) { $item->add(new Label('value', $item->getModel())); })); $submitedInfo->add(new ListView('mchoice', function (&$item) { $item->add(new Label('value', $item->getModel())); })); }
public function __construct() { parent::__construct(); $this->add(new Label('text', new PropertyModel($this, 'text'))); $self = $this; $this->add(new Link('alterLink', function () use($self) { $self->text = 'Update in callback text'; })); $this->add(new Link('pageLink', function () use($self) { $self->setPage(HomePage::getIdentifier()); })); }
public function __construct() { parent::__construct(); $label = new Label('text', new PropertyModel($this, 'text')); $label->setOutputMarkupId(true); $this->add($label); $self = $this; $this->add(new AjaxLink('alterLink', function (AjaxRequestTarget $target) use($self, $label) { $self->text = 'Update in callback text'; $target->add($label); })); }
public function __construct() { parent::__construct(); $collection = new TabCollection(); $collection->addTab('One', function ($id) { return new TabOnePanel($id); }); $collection->addTab('Two', function ($id) { return new TabTwoPanel($id); }); $tab = new TabPanel('tabs', $collection); $this->add($tab); }
public function __construct() { parent::__construct(); $fruit = array('apples', 'pears', 'bananas', 'oranges'); $this->add(new ListView('fruit', function ($entry) { $entry->add(new Label('name', new BasicModel($entry->getModelObject()))); }, new ArrayModel($fruit))); $repeatingView = new RepeatingView('repeater'); $this->add($repeatingView); foreach ($fruit as $item) { $element = new Label('text', new BasicModel($item)); $container = new MarkupContainer($repeatingView->getNextChildId()); $container->add($element); $repeatingView->add($container); } }
public function __construct() { parent::__construct(); $layoutExamples = array(); $layoutExamples[] = new Example('Markup Inheretence', MarkupInheritancePage::getIdentifier()); $layoutExamples[] = new Example('Panels', PanelPage::getIdentifier()); $layoutExamples[] = new Example('Borders', BorderPage::getIdentifier()); $generalExamples = array(); $generalExamples[] = new Example('Labels', LabelPage::getIdentifier()); $generalExamples[] = new Example('Links', LinkPage::getIdentifier()); $generalExamples[] = new Example('Lists', ListPage::getIdentifier()); $generalExamples[] = new Example('Tabs', TabPanelPage::getIdentifier()); $formExamples = array(); $formExamples[] = new Example('Form Fields', FormPage::getIdentifier()); $formExamples[] = new Example('Validation', ValidationPage::getIdentifier()); $formExamples[] = new Example('Special Fields', SpecialFields::getIdentifier()); $tableExamples = array(); $tableExamples[] = new Example('Data Table', DataTablePage::getIdentifier()); $ajaxExamples = array(); $ajaxExamples[] = new Example('Ajax Link', AjaxLinkPage::getIdentifier()); $ajaxExamples[] = new Example('Ajax Button', AjaxButtonPage::getIdentifier()); $authoExamples[] = new Example('Authorised Access Page', AuthorisedPage::getIdentifier()); $examples = array(); $examples[] = new ExampleType('General', $generalExamples); $examples[] = new ExampleType('Layout', $layoutExamples); $examples[] = new ExampleType('Form Components', $formExamples); $examples[] = new ExampleType('Data Tables', $tableExamples); $examples[] = new ExampleType('Ajax', $ajaxExamples); $examples[] = new ExampleType('Security', $authoExamples); $self = $this; $this->add(new ListView('examples', function (ListItem $item) use($self) { $type = $item->getModelObject(); $item->add(new Label('title', new BasicModel($type->name))); $examples = $type->examples; $item->add(new ListView('list', function (ListItem $item) use($self, $examples) { $link = new Link('link', function () use($item, $self) { $self->setPage($item->getModelObject()->page); }); $item->add($link); $link->add(new Label('exampleName', new BasicModel($item->getModelObject()->name))); }, new ArrayModel($examples))); }, new ArrayModel($examples))); }
public function __construct() { parent::__construct(); $feedback = new FeedbackPanel('feedback'); $feedback->setOutputMarkupId(true); $this->add($feedback); $label = new Label('text', new PropertyModel($this, 'text')); $label->setOutputMarkupId(true); $this->add($label); $form = new Form('form'); $this->add($form); $form->add(new RequiredTextField('text', new PropertyModel($this, 'text'))); $self = $this; $form->add(new AjaxButton('button', function (AjaxRequestTarget $target) use($label, $feedback) { $target->add($label); $target->add($feedback); }, function (AjaxRequestTarget $target) use($feedback) { $target->add($feedback); })); }
public function __construct() { parent::__construct(); $feedback = new FeedbackPanel('feedback'); $this->add($feedback); $form = new Form('form'); $form->add(new DateField('date', new PropertyModel($this, 'date'))); $feedback->setOutputMarkupId(true); $this->add($form); $model = new FileModel(); $form->add(new FileUploadField('file', $model)); $self = $this; $form->add(new Button('button', function () use($model, $self) { $self->success(sprintf("The file was uploaded successfully. Name: %s, size: %d", $model->getName(), $model->getSize())); $self->success(sprintf('Date was: %s', $self->date)); })); $form->add(new AjaxButton('ajaxbutton', function (picon\AjaxRequestTarget $target) use($feedback, $model, $self) { $self->success(sprintf("The file was uploaded successfully. Name: %s, size: %d", $model->getName(), $model->getSize())); $self->success(sprintf('Date was: %s', $self->date)); $target->add($feedback); })); }
public function __construct() { parent::__construct(); $feedback = new FeedbackPanel('feedback'); $this->add($feedback); $form = new Form('form'); $this->add($form); $self = $this; $form->add(new Button('button', function () use($self) { $self->info('The form validation passed'); }, function () use($self) { $self->info('The form was invalid'); })); $email = new RequiredTextField('email'); $email->add(new EmailAddressValidator()); $form->add($email); $maxNumber = new RequiredTextField('maxNumber'); $maxNumber->add(new MaximumValidator(14)); $form->add($maxNumber); $minNumber = new RequiredTextField('minNumber'); $minNumber->add(new MinimumValidator(34)); $form->add($minNumber); $rangeNumber = new RequiredTextField('rangeNumber'); $rangeNumber->add(new RangeValidator(4, 45)); $form->add($rangeNumber); $maxString = new RequiredTextField('maxString'); $maxString->add(new MaximumLengthValidator(10)); $form->add($maxString); $minString = new RequiredTextField('minString'); $minString->add(new MinimumLengthValidator(4)); $form->add($minString); $rangeString = new RequiredTextField('rangeString'); $rangeString->add(new RangeLengthValidator(4, 10)); $form->add($rangeString); $textArea = new TextArea('textArea'); $textArea->setRequired(true); $form->add($textArea); }
public function __construct() { parent::__construct(); $this->add(new Label('text', new PropertyModel($this, 'text'))); }
public function __construct() { parent::__construct(); $border = new SampleBorder('border'); $this->add($border); }