/** * init */ public function init() { $ff = \Form\Factory::getInstance(); $this->form = $ff->createForm('Contact'); $this->form->attach(new Send('send'), 'send')->setRedirectUrl(\Tk\Url::create('/contactUs.html')); $this->form->attach($ff->createEventLink('cancel'), 'cancel')->setRedirectUrl(\Tk\Url::create('/index.html')); $this->form->addField($ff->createFieldText('name'))->setRequired(); $this->form->addField($ff->createFieldText('email'))->setRequired(); $this->form->addField($ff->createFieldTextarea('comments'))->setRequired(); $this->form->addField($ff->createFieldCaptcha('valid'))->setRequired(); $this->addChild($ff->createFormRenderer($this->form), $this->form->getId()); }
/** * init */ public function init() { $fac = $this->getConfig()->getPluginFactory(); $this->plugin = $fac->getPlugin($this->getNamespace()); $arr = $this->plugin->getDataArray()->exportFormArray(); $backUrl = \Tk\Url::createHomeUrl('/plugin/manager.html'); $ff = \Form\Factory::getInstance(); $this->form = $ff->createForm('Config', $arr); $this->form->attach(new Save('update'))->setRedirectUrl($backUrl); $this->form->attach($ff->createEventLink('cancel'), 'cancel')->setRedirectUrl($backUrl); $courseList = \Ext\Db\Course::findAll(\Tk\Db\Tool::create('`name`')); $this->form->addField($ff->createFieldDualSelect('coa-course-enable', $courseList))->setLabel('Enable Courses')->setRequired(); $this->addChild($ff->createFormRenderer($this->form), $this->form->getId()); }
/** * URL: http://localhost:8080/?route=demo/four */ public function four() { $form = new Form(); $form->addField('firstname', 'WordField', array('blank' => false)); $form->addField('lastname', 'WordField', array('blank' => false)); $form->addField('telephone', 'NumericField'); $values = null; if ($this->request->isMethodPost()) { $form->setValues($_POST); if ($form->isValid()) { $values = $form->getValues(); } } $context = array('title' => 'four', 'form' => $form, 'values' => $values); $this->render('four.tpl', $context); }
/** * init */ public function init() { $this->setPageTitle('COA Setup'); $this->term = $this->getPage()->getTerm(); $this->setup = \coa\Db\CoaSetup::getMapper()->findByCourseId($this->term->courseId); if (!$this->setup) { $this->setup = new \coa\Db\CoaSetup(); $this->setup->courseId = $this->term->courseId; } $ff = \Form\Factory::getInstance(); $this->form = $ff->createForm('settings', $this->setup); $this->form->attach(new Save('update', 'fa fa-arrow-left'))->setRedirectUrl($this->getBackUrl()); $this->form->attach(new Save('save', 'fa fa-refresh'))->setRedirectUrl($this->getUri()); $this->form->attach($ff->createEventLink('cancel'))->setRedirectUrl($this->getBackUrl()); $this->form->addField($ff->createFieldText('pdfTopMargin'))->setLabel('Top Content padding'); if (!$this->setup->pdfBgImage) { $this->form->addField($ff->createFieldFile('pdfBgImage'))->setLabel('Certificate Background')->setNotes('Set the background image of the Certificate. (Recommended Size: 1343x929)'); } else { $delUrl = htmlentities($this->getUri()->set('delBgImage')->toString()); $html = <<<HTML <p> <a href="{$this->setup->getPdfBgImageUrl()->toString()}" target="_blank"><img style="width: 100px;" src="{$this->setup->getPdfBgImageUrl()->toString()}" /></a> <br/> <a href="{$delUrl}">Delete</a> </p> HTML; $this->form->addField($ff->createFieldRenderer('bgImage', $html))->setLabel('Certificate Background')->setNotes('Set the background image of the Certificate. (Recommended Size: 1343x929)'); } $this->form->addField($ff->createFieldTextarea('pdfContent'))->setLabel('Certificate HTML')->setNotes('Available variables: {name}, {dateFrom}, {dateTo}, {date}, {year}, {totalUnits}, {totalPlaces}, {cpd}'); $this->form->addField($ff->createFieldText('emailSubject'))->setLabel('Email Subject'); $this->form->addField($ff->createFieldTextarea('emailContent'))->addCssClass('mce-full')->setNotes('Available variables: {name}, {dateFrom}, {dateTo}, {date}, {year}, {email}, {totalUnits}, {totalPlaces}, {cpd}'); $this->addChild($ff->createFormRenderer($this->form), $this->form->getId()); }
/** * init */ public function init() { $ff = \Form\Factory::getInstance(); $this->form = $ff->createForm('Edit', $this->consumer); $this->form->attach(new Save('save', 'fa fa-refresh'))->setRedirectUrl($this->getBackUrl()); $this->form->attach($ff->createEventLink('cancel'))->setRedirectUrl($this->getBackUrl()); //$this->form->attach(new EditEvent()); $this->form->addField($ff->createFieldText('name'))->setRequired(); $cc = $this->form->addField($ff->createFieldText('key'))->setRequired(); // if ($this->consumer->getKey()) { // $cc->setEnabled(false); // } $this->form->addField($ff->createFieldText('secret'))->setRequired(); $this->form->addField($ff->createFieldText('css_path')); $this->form->addField($ff->createFieldCheckbox('enabled')); //$this->form->addField($ff->createFieldDate('enabledFrom')); //$this->form->addField($ff->createFieldDate('enabledTo')); //$this->form->addField($ff->createFieldCheckbox('protected')); $this->addChild($ff->createFormRenderer($this->form), $this->form->getId()); }
/** * init */ public function init() { $ff = \Form\Factory::getInstance(); $arr = $this->getConfig()->exportFormArray(); $this->form = $ff->createForm('Settings', $arr); $se = new SettingsSaveEvent('update', 'icon-arrow-left icon-white'); $this->form->attach($se->setRedirectUrl(\Tk\Url::createHomeUrl('/index.html')), 'update'); $se = new SettingsSaveEvent('save'); $this->form->attach($se->setRedirectUrl(\Tk\Request::getInstance()->getRequestUri()), 'save'); $this->form->attach($ff->createEventLink('cancel'), 'cancel')->setRedirectUrl(\Tk\Url::createHomeUrl('/index.html')); // Site $this->form->addField($ff->createFieldText('system-site-title'))->setTabGroup('Site')->setRequired()->setLabel('Site Title'); $this->form->addField($ff->createFieldText('system-site-email'))->setTabGroup('Site')->setLabel('Site Email')->setRequired()->setNotes('This email is used for site notifications like user sign-up, contact forms, etc.'); $this->form->addField($ff->createFieldText('system-site-email-support'))->setTabGroup('Site')->setLabel('Support Email')->setRequired()->setNotes('This email is used for any site support forms or errors that are generated.'); $this->form->addField($ff->createFieldText('system-site-email-dev'))->setTabGroup('Site')->setLabel('Developer Email')->setRequired()->setNotes('This email is used for any site error emails and notifications to developers.'); $this->form->addField($ff->createFieldText('system-google-apikey'))->setTabGroup('Site')->setRequired()->setLabel('Google API Key'); $this->form->addField($ff->createFieldTimezoneSelect('system-timezone'))->setTabGroup('Site')->setRequired()->prependOption('-- Select --', '')->setLabel('Timezone'); $this->form->addField($ff->createFieldText('system-site-proxy'))->setTabGroup('Site')->setLabel('Site Proxy')->setNotes('Only set this if you require a proxy to access the outside network.'); $this->form->addField($ff->createFieldCheckbox('system-enableSsl'))->setTabGroup('Site')->setLabel('Enable SSL')->setNotes('Only check this option if you have a valid SSL cert installed.'); // Maintenance $this->form->addField($ff->createFieldCheckbox('system-maintenance-enable'))->setTabGroup('Maintenance')->setLabel('Enable')->setNotes('If enabled, the site is disabled with only the access given to those below.'); $this->form->addField($ff->createFieldTextarea('system-maintenance-message'))->addStyle('width', '600px')->addStyle('height', '100px')->setTabGroup('Maintenance')->setLabel('Message')->setNotes('Enter the message (HTML) that will be displayed when in maintenance mode.'); $this->form->addField($ff->createFieldText('system-maintenance-access-ip'))->setTabGroup('Maintenance')->setLabel('IP Access')->setNotes('Enter a comma separated list of allowable IP addresses in maintenance mode'); $list = array(array('Admin', \Tk\Auth\Auth::P_ADMIN), array('User', \Tk\Auth\Auth::P_USER)); $this->form->addField($ff->createFieldCheckbox('system-maintenance-access-permission', $list))->setTabGroup('Maintenance')->setLabel('Permission Access')->setNotes('Select user permissions allowed to access the site in maintenance mode'); $this->addChild($ff->createFormRenderer($this->form), $this->form->getId()); }