Form PHP Class Code Examples

This page contains top rated real world PHP examples of class Form extracted from open source projects. You can rate examples to help us improve the quality of examples

Example #1
Show file File: FormTest.php Project: Symfomany/laravelcinema
0
 public function testSubmitAdvancedForm()
 {
     $submittedData = ['title' => 'The title', 'description' => 'The description'];
     $title = new Form('title');
     $description = new Form('description');
     $form = new Form('product');
     $form->add($title);
     $form->add($description);
     $form->submit($submittedData);
     $this->assertSame($title, $form->get('title'));
     $this->assertSame($description, $form->get('description'));
     $this->assertNull($title->get('foo'));
     $this->assertNull($description->get('foo'));
     $this->assertNull($form->getParent());
     $this->assertSame($form, $title->getParent());
     $this->assertSame($form, $description->getParent());
     $this->assertSame('product', $form->getName());
     $this->assertSame('title', $title->getName());
     $this->assertSame('description', $description->getName());
     $this->assertTrue($form->isRoot());
     $this->assertFalse($title->isRoot());
     $this->assertFalse($description->isRoot());
     $this->assertTrue($form->isSubmitted());
     $this->assertTrue($title->isSubmitted());
     $this->assertTrue($description->isSubmitted());
     $this->assertSame($submittedData, $form->getData());
     $this->assertSame('The title', $title->getData());
     $this->assertSame('The description', $description->getData());
     $this->assertNull($form->getFiles());
     $this->assertNull($title->getFiles());
     $this->assertNull($description->getFiles());
 }
Example #2
Show file File: HtmlView.php Project: khanhdeux/typo3test
0
 /**
  * Constructor
  */
 public function __construct(\TYPO3\CMS\Form\Domain\Model\Form $model, array $typoscript)
 {
     $this->localCobj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer');
     $this->localizationHandler = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Form\\Localization');
     $this->typoscript = $typoscript;
     parent::__construct($model);
 }
Example #3
Show file File: ContactPage.php Project: helpfulrobot/weboftalent-contactage
0
 function ContactForm()
 {
     error_log("Render form");
     $name = _t('ContactPage.NAME', 'Name');
     $email = _t('ContactPage.EMAIL', 'Email');
     $comments = _t('ContactPage.COMMENTS', 'Comments');
     $send = _t('ContactPage.SEND', 'Send');
     // Create fields
     $tf = new TextField('Name', $name);
     $tf->addExtraClass('span11');
     $ef = new EmailField('Email', $email);
     $ef->addExtraClass('span11');
     $taf = new TextareaField('Comments', $comments);
     $taf->addExtraClass('span11');
     $fields = new FieldList($tf, $ef, $taf);
     // Create action
     $fa = new FormAction('SendContactForm', $send);
     // for bootstrap
     $fa->useButtonTag = true;
     $fa->addExtraClass('btn btn-primary');
     $actions = new FieldList($fa);
     // Create action
     $validator = new RequiredFields('Name', 'Email', 'Comments');
     $form = new Form($this, 'ContactForm', $fields, $actions, $validator);
     $form->setTemplate('VerticalForm');
     $form->addExtraClass('well');
     return $form;
 }
Example #4
Show file File: FrontendUploadField.php Project: helpfulrobot/lekoala-silverstripe-form-extras
0
 /**
  * @param array $data
  * @param Form $form
  * @param SS_HTTPRequest $request
  */
 public function doEdit(array $data, Form $form, SS_HTTPRequest $request)
 {
     // Check form field state
     if ($this->parent->isDisabled() || $this->parent->isReadonly()) {
         return $this->httpError(403);
     }
     // Check item permissions
     $item = $this->getItem();
     if (!$item) {
         return $this->httpError(404);
     }
     if ($item instanceof Folder) {
         return $this->httpError(403);
     }
     $memberID = Member::currentUserID();
     $res = false;
     try {
         // Owner can always delete
         if ($memberID && $item->OwnerID == $memberID) {
             $res = true;
         } else {
             $res = $item->canEditFrontend();
         }
     } catch (Exception $ex) {
     }
     $form->saveInto($item);
     $item->write();
     $form->sessionMessage(_t('UploadField.Saved', 'Saved'), 'good');
     return $this->edit($request);
 }
Example #5
Show file File: LogicalBetween.class.php Project: onphp-framework/onphp-framework
0
 public function toBoolean(Form $form)
 {
     $left = $form->toFormValue($this->left);
     $right = $form->toFormValue($this->right);
     $value = $form->toFormValue($this->field);
     return $left <= $value && $value <= $right;
 }
Example #6
Show file File: InnerMetaProperty.class.php Project: onphp-framework/onphp-framework
0
 /**
  * @return Form
  **/
 public function fillForm(Form $form, $prefix = null)
 {
     foreach ($this->getProto()->getPropertyList() as $property) {
         $property->fillForm($form, $this->getName() . ':');
     }
     return $form;
 }
Example #7
Show file File: ContactInquiryForm.php Project: helpfulrobot/jelicanin-silverstripe-contact-page
0
 /**
  * Form action handler for ContactInquiryForm.
  *
  * @param array $data The form request data submitted
  * @param Form $form The {@link Form} this was submitted on
  */
 function dosave(array $data, Form $form, SS_HTTPRequest $request)
 {
     $SQLData = Convert::raw2sql($data);
     $attrs = $form->getAttributes();
     if ($SQLData['Comment'] != '' || $SQLData['Url'] != '') {
         // most probably spam - terminate silently
         Director::redirect(Director::baseURL() . $this->URLSegment . "/success");
         return;
     }
     $item = new ContactInquiry();
     $form->saveInto($item);
     // $form->sessionMessage(_t("ContactPage.FORMMESSAGEGOOD", "Your inquiry has been submitted. Thanks!"), 'good');
     $item->write();
     $mailFrom = $this->currController->MailFrom ? $this->currController->MailFrom : $SQLData['Email'];
     $mailTo = $this->currController->MailTo ? $this->currController->MailTo : Email::getAdminEmail();
     $mailSubject = $this->currController->MailSubject ? $this->currController->MailSubject . ' - ' . $SQLData['Ref'] : _t('ContactPage.SUBJECT', '[web] New contact inquiry - ') . ' ' . $data['Ref'];
     $email = new Email($mailFrom, $mailTo, $mailSubject);
     $email->replyTo($SQLData['Email']);
     $email->setTemplate("ContactInquiry");
     $email->populateTemplate($SQLData);
     $email->send();
     // $this->controller->redirectBack();
     if ($email->send()) {
         $this->controller->redirect($this->controller->Link() . "success");
     } else {
         $this->controller->redirect($this->controller->Link() . "error");
     }
     return false;
 }
Example #8
Show file File: ShowForm.php Project: huanhuashengling/ipc2013-testing
0
 /**
  * Outputs message depending on flag
  *
  * @return string
  */
 public function __invoke(Form $form, $url, $class = 'form-horizontal')
 {
     $form->setAttribute('action', $url);
     $form->setAttribute('class', $class);
     $form->prepare();
     $output = $this->getView()->form()->openTag($form);
     $submitElements = array();
     foreach ($form as $element) {
         if ($element instanceof Submit) {
             $submitElements[] = $element;
         } elseif ($element instanceof Csrf || $element instanceof Hidden) {
             $output .= $this->getView()->formElement($element);
         } else {
             $element->setLabelAttributes(array('class' => 'control-label'));
             $output .= '<div class="control-group">';
             $output .= $this->getView()->formLabel($element);
             $output .= '<div class="controls">';
             $output .= $this->getView()->formElement($element);
             $output .= $this->getView()->formElementErrors($element);
             $output .= '</div>';
             $output .= '</div>';
         }
     }
     $output .= '<div class="form-actions">';
     foreach ($submitElements as $element) {
         $output .= $this->getView()->formElement($element) . '&nbsp;';
     }
     $output .= '</div>';
     $output .= $this->getView()->form()->closeTag();
     return $output;
 }
Example #9
Show file File: FrontEndWorkflowController.php Project: Neumes/advancedworkflow
0
 /**
  * Save the Form Data to the defined Context Object
  * 
  * @param array $data
  * @param Form $form
  * @param SS_HTTPRequest $request
  * @throws Exception
  */
 public function doFrontEndAction(array $data, Form $form, SS_HTTPRequest $request)
 {
     if (!($obj = $this->getContextObject())) {
         throw new Exception(_t('FrontEndWorkflowController.FRONTENDACTION_CONTEXT_EXCEPTION', 'Context Object Not Found'));
     }
     if (!$this->getCurrentTransition()->canExecute($this->contextObj->getWorkflowInstance())) {
         throw new Exception(_t('FrontEndWorkflowController.FRONTENDACTION_TRANSITION_EXCEPTION', 'You do not have permission to execute this action'));
     }
     //Only Save data when Transition is 'Active'
     if ($this->getCurrentTransition()->Type == 'Active') {
         //Hand off to WorkflowAction to perform Save
         $svc = singleton('WorkflowService');
         $active = $svc->getWorkflowFor($obj);
         $active->doFrontEndAction($data, $form, $request);
     }
     //run execute on WorkflowInstance instance
     $action = $this->contextObj->getWorkflowInstance()->currentAction();
     $action->BaseAction()->execute($this->contextObj->getWorkflowInstance());
     //get valid transitions
     $transitions = $action->getValidTransitions();
     //tell instance to execute transition if it's in the permitted list
     if ($transitions->find('ID', $this->transitionID)) {
         $this->contextObj->getWorkflowInstance()->performTransition($this->getCurrentTransition());
     }
 }
Example #10
Show file File: SimpleModelAdmin.php Project: helpfulrobot/axllent-silverstripe-simplemodeladmin
0
 public function getEditForm($id = null, $fields = null)
 {
     $classname = $this->modelClass;
     $list = $classname::get();
     $listField = GridField::create($this->sanitiseClassName($this->modelClass), false, $list, $fieldConfig = GridFieldConfig_RecordEditor::create($this->stat('page_length'))->removeComponentsByType('GridFieldFilterHeader'));
     if (!$this->stat('enable_sorting')) {
         $summary_fields = Config::inst()->get($this->modelClass, 'summary_fields');
         $sorting = array();
         foreach ($summary_fields as $col) {
             $sorting[$col] = 'FieldNameNoSorting';
         }
         $fieldConfig->getComponentByType('GridFieldSortableHeader')->setFieldSorting($sorting);
     }
     // Validation
     if (singleton($this->modelClass)->hasMethod('getCMSValidator')) {
         $detailValidator = singleton($this->modelClass)->getCMSValidator();
         $listField->getConfig()->getComponentByType('GridFieldDetailForm')->setValidator($detailValidator);
     }
     $form = new Form($this, 'EditForm', new FieldList($listField), new FieldList());
     $form->addExtraClass('cms-edit-form cms-panel-padded center');
     $form->setTemplate($this->getTemplatesWithSuffix('_EditForm'));
     $editFormAction = Controller::join_links($this->Link($this->sanitiseClassName($this->modelClass)), 'EditForm');
     $form->setFormAction($editFormAction);
     $form->setAttribute('data-pjax-fragment', 'CurrentForm');
     $this->extend('updateEditForm', $form);
     return $form;
 }
Example #11
Show file File: mod_propale_saphir.php Project: LionSystemsSolutions/El-Canelo-ERP
0
 /**
  *  Return description of module
  *
  *  @return     string      Texte descripif
  */
 function info()
 {
     global $conf, $langs;
     $langs->load("bills");
     $form = new Form($this->db);
     $texte = $langs->trans('GenericNumRefModelDesc') . "<br>\n";
     $texte .= '<form action="' . $_SERVER["PHP_SELF"] . '" method="POST">';
     $texte .= '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
     $texte .= '<input type="hidden" name="action" value="updateMask">';
     $texte .= '<input type="hidden" name="maskconstpropal" value="PROPALE_SAPHIR_MASK">';
     $texte .= '<table class="nobordernopadding" width="100%">';
     $tooltip = $langs->trans("GenericMaskCodes", $langs->transnoentities("Proposal"), $langs->transnoentities("Proposal"));
     $tooltip .= $langs->trans("GenericMaskCodes2");
     $tooltip .= $langs->trans("GenericMaskCodes3");
     $tooltip .= $langs->trans("GenericMaskCodes4a", $langs->transnoentities("Proposal"), $langs->transnoentities("Proposal"));
     $tooltip .= $langs->trans("GenericMaskCodes5");
     // Parametrage du prefix
     $texte .= '<tr><td>' . $langs->trans("Mask") . ':</td>';
     $texte .= '<td align="right">' . $form->textwithpicto('<input type="text" class="flat" size="24" name="maskpropal" value="' . $conf->global->PROPALE_SAPHIR_MASK . '">', $tooltip, 1, 1) . '</td>';
     $texte .= '<td align="left" rowspan="2">&nbsp; <input type="submit" class="button" value="' . $langs->trans("Modify") . '" name="Button"></td>';
     $texte .= '</tr>';
     $texte .= '</table>';
     $texte .= '</form>';
     return $texte;
 }
Example #12
Show file File: FormTest.php Project: laubosslink/lab
0
 public function testConstructorThrowsExceptionIfTheNodeHasNoFormAncestor()
 {
     $dom = new \DOMDocument();
     $dom->loadHTML('
         <html>
             <input type="submit" />
             <form>
                 <input type="foo" />
             </form>
             <button />
         </html>
     ');
     $nodes = $dom->getElementsByTagName('input');
     try {
         $form = new Form($nodes->item(0), 'http://example.com');
         $this->fail('__construct() throws a \\LogicException if the node has no form ancestor');
     } catch (\LogicException $e) {
         $this->assertTrue(true, '__construct() throws a \\LogicException if the node has no form ancestor');
     }
     try {
         $form = new Form($nodes->item(1), 'http://example.com');
         $this->fail('__construct() throws a \\LogicException if the input type is not submit, button, or image');
     } catch (\LogicException $e) {
         $this->assertTrue(true, '__construct() throws a \\LogicException if the input type is not submit, button, or image');
     }
     $nodes = $dom->getElementsByTagName('button');
     try {
         $form = new Form($nodes->item(0), 'http://example.com');
         $this->fail('__construct() throws a \\LogicException if the node has no form ancestor');
     } catch (\LogicException $e) {
         $this->assertTrue(true, '__construct() throws a \\LogicException if the node has no form ancestor');
     }
 }
Example #13
Show file File: status_logs_vpn.php Project: sjourdois/pfsense
0
function filter_form_vpn()
{
    global $filter_active, $rawfilter, $filterfieldsarray, $filtertext, $filterlogentries_qty, $nentries, $Include_Act, $interfacefilter;
    global $logfile;
    if ($filter_active) {
        $filter_state = SEC_OPEN;
    } else {
        $filter_state = SEC_CLOSED;
    }
    if (!$rawfilter) {
        // Advanced log filter form
        $form = new Form(false);
        $section = new Form_Section('Advanced Log Filter', 'adv-filter-panel', COLLAPSIBLE | $filter_state);
        if ($logfile == "vpn") {
            $group = new Form_Group('');
            $group->add(new Form_Input('filterlogentries_time', null, 'text', $filterfieldsarray['time']))->setWidth(3)->setHelp('Time');
            $group->add(new Form_Input('filterlogentries_action', null, 'text', $filterfieldsarray['action']))->setWidth(3)->setHelp('Action');
            $group->add(new Form_Input('filterlogentries_qty', null, 'number', $filterlogentries_qty, ['placeholder' => $nentries]))->setWidth(2)->setHelp('Quantity');
            $section->add($group);
            $group = new Form_Group('');
            $group->add(new Form_Input('filterlogentries_user', null, 'text', $filterfieldsarray['user']))->setWidth(3)->setHelp('User');
            $group->add(new Form_Input('filterlogentries_ip_address', null, 'text', $filterfieldsarray['ip_address']))->setWidth(4)->setHelp('IP Address');
        } else {
            $group = new Form_Group('');
            $group->add(new Form_Input('filterlogentries_time', null, 'text', $filterfieldsarray['time']))->setWidth(3)->setHelp('Time');
            $group->add(new Form_Input('filterlogentries_type', null, 'text', $filterfieldsarray['type']))->setWidth(2)->setHelp('Type');
            $group->add(new Form_Input('filterlogentries_pid', null, 'text', $filterfieldsarray['pid']))->setWidth(2)->setHelp('PID');
            $group->add(new Form_Input('filterlogentries_qty', null, 'number', $filterlogentries_qty, ['placeholder' => $nentries]))->setWidth(2)->setHelp('Quantity');
            $section->add($group);
            $group = new Form_Group('');
            $group->add(new Form_Input('filterlogentries_message', null, 'text', $filterfieldsarray['message']))->setWidth(7)->setHelp('Log Message');
        }
        $btnsubmit = new Form_Button('filterlogentries_submit', ' ' . gettext('Apply Filter'), null, 'fa-filter');
    } else {
        // Simple log filter form
        $form = new Form(false);
        $section = new Form_Section('Log Filter', 'basic-filter-panel', COLLAPSIBLE | $filter_state);
        $group = new Form_Group('');
        $group->add(new Form_Input('filtertext', null, 'text', $filtertext))->setWidth(6)->setHelp('Filter Expression');
        $group->add(new Form_Input('filterlogentries_qty', null, 'number', $filterlogentries_qty, ['placeholder' => $nentries]))->setWidth(2)->setHelp('Quantity');
        $btnsubmit = new Form_Button('filtersubmit', ' ' . gettext('Apply Filter'), null, 'fa-filter');
    }
    $btnsubmit->removeClass('btn-primary')->addClass('btn-success')->addClass('btn-sm');
    $group->add(new Form_StaticText('', $btnsubmit));
    $group->setHelp('<a target="_blank" href="http://www.php.net/manual/en/book.pcre.php">' . gettext('Regular expression reference') . '</a> ' . gettext('Precede with exclamation (!) to exclude match.'));
    $section->add($group);
    $form->add($section);
    print $form;
}
Example #14
Show file File: BuildAttributeValueFormListenerSpec.php Project: aleherse/Sylius
0
 function it_builds_options_base_on_product_attribute(FormEvent $event, Form $form, AttributeValueInterface $productAttribute, Form $valueField, $formFactory)
 {
     $productAttribute->getType()->willReturn('choice');
     $productAttribute->getValue()->willReturn(array());
     $productAttribute->getConfiguration()->willReturn(array('choices' => array('red' => 'Red', 'blue' => 'Blue')));
     $productAttribute->getName()->willReturn('My name');
     $event->getData()->willReturn($productAttribute);
     $event->getForm()->willReturn($form);
     $formFactory->createNamed('value', 'choice', null, array('label' => 'My name', 'auto_initialize' => false, 'choices' => array('red' => 'Red', 'blue' => 'Blue')))->willReturn($valueField)->shouldBeCalled();
     $form->add($valueField)->shouldBeCalled()->willReturn($form);
     $this->buildForm($event);
 }
Example #15
Show file File: BuildAttributeValueFormSubscriberSpec.php Project: themarios/Sylius
0
 function it_is_triggered_pre_submit_to_add_proper_typed_form_field($attributeRepository, $formFactory, AttributeInterface $productAttribute, Form $form, Form $valueField, FormEvent $event)
 {
     $event->getData()->willReturn(array('attribute' => 1, 'value' => array('year' => 2010, 'month' => 01, 'day' => 01)));
     $event->getForm()->willReturn($form);
     $attributeRepository->find(1)->willReturn($productAttribute);
     $productAttribute->getType()->willReturn('date');
     $productAttribute->getStorageType()->willReturn('date');
     $formFactory->createNamed('value', 'sylius_attribute_type_date', Argument::type('\\DateTime'), Argument::type('array'))->willReturn($valueField);
     $form->add($valueField)->shouldBeCalled();
     $this->preSubmit($event);
 }
Example #16
Show file File: plugin.php Project: precurse/netharbour
0
 function add_interface_form()
 {
     // This function will be the wizard that allows the user
     // to add interfaces to an accounting profile
     // First check if Device ID is set, if not then render device menu
     if (isset($_POST['device_id'])) {
         $device = new Device($_POST['device_id']);
         $all_interfaces = $device->get_interfaces();
         $data = array();
         $title = array();
         foreach ($all_interfaces as $id => $value) {
             array_push($title, "<input type='checkbox' class='check_pref' name='if_add[]' value='" . $id . "' />");
             array_push($data, $value->get_name());
             array_push($data, $value->get_alias());
             array_push($data, $value->get_oper_status());
         }
         $form = new Form("auto", 4);
         $heading = array("Select All<input name='all' type='checkbox' value='Select All' onclick=\"checkAll(document.dataForm['if_add[]'],this)\"", "Interface name", "Description", "Status");
         $form->setSortable(true);
         // or false for not sortable
         $form->setHeadings($heading);
         $form->setTitles($title);
         $form->setTitleWidth("50px");
         $form->setData($data);
         $form->setTableWidth("500px");
         $content .= "<form action='' id='dataForm' method='POST' name='dataForm'>";
         $content .= $form->showForm();
         $content .= "<div style='clear:both'></div>\n                                        <INPUT TYPE=SUBMIT VALUE='Add Selected Interfaces' name='addInterfacesToProfile'>\n                                        <INPUT TYPE=hidden NAME=action VALUE='add_device_interface_to_profile'>\n                                        <INPUT TYPE=hidden NAME=tab VALUE='" . $_GET['tab'] . "'>\n                                        <INPUT TYPE=hidden NAME=name VALUE='" . $_POST['name'] . "'>\n                                        <INPUT TYPE=hidden NAME=pluginID VALUE='" . $_GET['pluginID'] . "'>\n                                        <INPUT TYPE=hidden NAME=device_id VALUE='" . $_POST['device_id'] . "'>\n                                </form>";
         $content .= $form->showForm();
         print_r($_POST);
         return $content;
     } elseif (isset($_POST['addInterfacesToProfile'])) {
         print "adding ifs!!<br>";
         print_r($_POST);
     } else {
         // Render device menu
         $heading = array("Select Device");
         $titles = array("Device");
         $keys = array("device_id");
         $all_devices = Device::get_devices();
         $myDropDownListener = "alert('Your gender is '+this.value)";
         $fieldType = array("drop_down");
         $form = new Form("auto", 2);
         $form->setHeadings($heading);
         $form->setTitles($titles);
         $form->setDatabase($keys);
         $form->setType($all_devices);
         $form->setFieldType($fieldType);
         $form->setUpdateText("Continue to select Interface");
         $form->setUpdateValue("select_if");
         //$form->setMethod("GET") ;
         echo $form->editForm();
     }
     return;
 }
Example #17
Show file File: BuildAttributeFormChoicesListenerSpec.php Project: lingoda/Sylius
0
 function it_build_configuration_collection_type(FormEvent $event, Form $form, Form $collectionField, $formFactory)
 {
     $event->getData()->willReturn(array('type' => 'foo'));
     $event->getForm()->willReturn($form);
     $form->has('configuration')->willReturn(false);
     $formFactory->createNamed('configuration', 'collection', null, array('allow_add' => true, 'allow_delete' => true, 'by_reference' => false, 'auto_initialize' => false))->willReturn($collectionField)->shouldBeCalled();
     $form->add($collectionField)->shouldBeCalled()->willReturn($form);
     $event->setData(Argument::any())->shouldBeCalled();
     $this->buildConfiguration($event);
 }
Example #18
Show file File: BuildReportDataFetcherFormSubscriberSpec.php Project: lingoda/Sylius
0
 function it_adds_configuration_fields_in_pre_bind($factory, FormEvent $event, Form $form, Form $field)
 {
     $data = array('dataFetcher' => 'test_data_fetcher');
     $event->getData()->willReturn($data);
     $event->getForm()->willReturn($form);
     $factory->createNamed('dataFetcherConfiguration', 'sylius_data_fetcher_test_type', Argument::cetera())->willReturn($field);
     $form->add($field)->shouldBeCalled();
     $this->preBind($event);
 }
Example #19
Show file File: BuildReportRendererFormSubscriberSpec.php Project: ahmadrabie/Sylius
0
 function it_adds_configuration_fields_in_pre_bind($factory, FormEvent $event, Form $form, Form $field)
 {
     $data = ['renderer' => 'test_renderer'];
     $event->getData()->willReturn($data);
     $event->getForm()->willReturn($form);
     $factory->createNamed('rendererConfiguration', 'sylius_renderer_test_type', Argument::cetera())->willReturn($field);
     $form->add($field)->shouldBeCalled();
     $this->preBind($event);
 }
Example #20
Show file File: status_logs_vpn.php Project: LFCavalcanti/pfsense
0
function filter_form_vpn()
{
    global $filter_active, $rawfilter, $filterfieldsarray, $filtertext, $filterlogentries_qty, $nentries, $Include_Act, $interfacefilter;
    global $logfile;
    global $system_logs_filter_form_hidden;
    if ($filter_active) {
        $panel_state = 'in';
        $panel_body_state = SEC_OPEN;
    } else {
        if ($system_logs_filter_form_hidden) {
            $panel_state = 'out';
            $panel_body_state = SEC_OPEN;
        } else {
            $panel_state = 'in';
            $panel_body_state = SEC_CLOSED;
        }
    }
    if (!$rawfilter) {
        // Advanced log filter form
        $form = new Form(false);
        $form->setAttribute('id', 'filter-form')->addClass('collapse ' . $panel_state);
        $section = new Form_Section('Advanced Log Filter', 'filter-panel', COLLAPSIBLE | $panel_body_state);
        if ($logfile == "vpn") {
            $group = new Form_Group('');
            $group->add(new Form_Input('filterlogentries_time', null, 'text', $filterfieldsarray['time']))->setWidth(3)->setHelp('Time');
            $group->add(new Form_Input('filterlogentries_action', null, 'text', $filterfieldsarray['action']))->setWidth(3)->setHelp('Action');
            $group->add(new Form_Input('filterlogentries_qty', null, 'number', $filterlogentries_qty, ['placeholder' => $nentries]))->setWidth(2)->setHelp('Quantity');
            $section->add($group);
            $group = new Form_Group('');
            $group->add(new Form_Input('filterlogentries_user', null, 'text', $filterfieldsarray['user']))->setWidth(3)->setHelp('User');
            $group->add(new Form_Input('filterlogentries_ip_address', null, 'text', $filterfieldsarray['ip_address']))->setWidth(4)->setHelp('IP Address');
        } else {
            $group = new Form_Group('');
            $group->add(new Form_Input('filterlogentries_time', null, 'text', $filterfieldsarray['time']))->setWidth(3)->setHelp('Time');
            $group->add(new Form_Input('filterlogentries_type', null, 'text', $filterfieldsarray['type']))->setWidth(2)->setHelp('Type');
            $group->add(new Form_Input('filterlogentries_pid', null, 'text', $filterfieldsarray['pid']))->setWidth(2)->setHelp('PID');
            $group->add(new Form_Input('filterlogentries_qty', null, 'number', $filterlogentries_qty, ['placeholder' => $nentries]))->setWidth(2)->setHelp('Quantity');
            $section->add($group);
            $group = new Form_Group('');
            $group->add(new Form_Input('filterlogentries_message', null, 'text', $filterfieldsarray['message']))->setWidth(7)->setHelp('Log Message');
        }
        $btnsubmit = new Form_Button('filterlogentries_submit', gettext('Apply Filter'), null, 'fa-filter');
    } else {
        // Simple log filter form
        $form = new Form(false);
        $form->setAttribute('id', 'filter-form')->addClass('collapse ' . $panel_state);
        $section = new Form_Section('Log Filter', 'filter-panel', COLLAPSIBLE | $panel_body_state);
        $group = new Form_Group('');
        $group->add(new Form_Input('filtertext', null, 'text', $filtertext))->setWidth(6)->setHelp('Filter Expression');
        $group->add(new Form_Input('filterlogentries_qty', null, 'number', $filterlogentries_qty, ['placeholder' => $nentries]))->setWidth(2)->setHelp('Quantity');
        $btnsubmit = new Form_Button('filtersubmit', gettext('Apply Filter'), null, 'fa-filter');
    }
    $btnsubmit->removeClass('btn-primary')->addClass('btn-success')->addClass('btn-sm');
    $group->add(new Form_StaticText('', $btnsubmit));
    $group->setHelp('<a target="_blank" href="http://www.php.net/manual/en/book.pcre.php">' . gettext('Regular expression reference') . '</a> ' . gettext('Precede with exclamation (!) to exclude match.'));
    $section->add($group);
    $form->add($section);
    print $form;
}
Example #21
Show file File: mod_facsim_muro.php Project: LionSystemsSolutions/El-Canelo-ERP
0
 /**     \brief      Renvoi la description du modele de numerotation
  *      \return     string      Texte descripif
  */
 function info()
 {
     global $conf, $langs;
     $langs->load("pos@pos");
     $form = new Form($db);
     $texte = $langs->trans('GenericNumRefModelDesc') . "<br>\n";
     $texte .= '<form action="' . $_SERVER["PHP_SELF"] . '" method="POST">';
     $texte .= '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
     $texte .= '<input type="hidden" name="action" value="updateMask">';
     $texte .= '<input type="hidden" name="maskconstfacsim" value="FACSIM_MURO_MASK">';
     $texte .= '<input type="hidden" name="maskconstfacsimcredit" value="FACSIM_MURO_MASK_CREDIT">';
     $texte .= '<table class="nobordernopadding" width="100%">';
     $tooltip = $langs->trans("GenericMaskCodes", $langs->transnoentities("Facsim"));
     $tooltip .= $langs->trans("GenericMaskCodes2");
     $tooltip .= $langs->trans("POSMaskCodes");
     $tooltip .= $langs->trans("GenericMaskCodes3");
     $tooltip .= $langs->trans("GenericMaskCodes4a", $langs->transnoentities("Facsim"), $langs->transnoentities("facsim"));
     $tooltip .= $langs->trans("GenericMaskCodes5");
     // Parametrage du prefix
     $texte .= '<tr><td>' . $langs->trans("Mask") . ' (' . $langs->trans("Facsim") . '):</td>';
     $texte .= '<td align="right">' . $form->textwithpicto('<input type="text" class="flat" size="24" name="maskfacsim" value="' . $conf->global->FACSIM_MURO_MASK . '">', $tooltip, 1, 1) . '</td>';
     $texte .= '<td align="left" rowspan="2">&nbsp; <input type="submit" class="button" value="' . $langs->trans("Modify") . '" name="Button"></td>';
     $texte .= '</tr>';
     // Parametrage du prefix des avoirs
     $texte .= '<tr><td>' . $langs->trans("Mask") . ' (' . $langs->trans("FacsimAvoir") . '):</td>';
     $texte .= '<td align="right">' . $form->textwithpicto('<input type="text" class="flat" size="24" name="maskfacsimcredit" value="' . $conf->global->FACSIM_MURO_MASK_CREDIT . '">', $tooltip, 1, 1) . '</td>';
     $texte .= '</tr>';
     $texte .= '</table>';
     $texte .= '</form>';
     return $texte;
 }
Frequently Used Methods