3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php namespace AdminModule; use Nette\Application\UI; /** * Description of InvoiceDateForm * * @author Richard Kapička, http://richard.kapicka.cz * @copyright 2014 */ class InvoiceDateForm extends UI\Form { /** * @var \AdminModule\Models\InvoiceModel */ private $invoiceModel; /** * @var \AdminModule\Models\ProjectModel( */ private $projectModel; /** * @var \Xprom\FlexiBee */ private $flexiBee; /** * @param \AdminModule\Models\InvoiceModel * @param \AdminModule\Models\ProjectModel * @param \Xprom\FlexiBee */ public function __construct(\AdminModule\Models\InvoiceModel $im, \AdminModule\Models\ProjectModel $pm, \Xprom\FlexiBee $fb) { parent::__construct(); $this->invoiceModel = $im; $this->projectModel = $pm; $this->flexiBee = $fb; } /** * @return \Nette\Forms\Form */ public function builForm() { $form = $this->form; $_this = $this; $form->addDynamic('projects', function(\Nette\Forms\Container $container) use($_this) { $container->addHidden('id'); $container->addHidden('phaseId'); $container->addDatePicker('date_transfer') ->controlPrototype->class('input-small no-margin'); $container->addSubmit('submit', 'Převést') ->onClick[] = $_this->formSuccess; $container['submit']->controlPrototype->class('btn btn-success'); }, 1); return $form; } /** * @param \Nette\Forms\Controls\SubmitButton */ public function formSuccess(\Nette\Forms\Controls\SubmitButton $button) { $values = $button->form->getValues(); $errors = array(); if (isset($values->projects->{$button->parent->name}) && !empty($values->projects->{$button->parent->name}->date_transfer)) { $section = $values->projects->{$button->parent->name}; $pr = $this->projectModel->getProjectByPhaseId($section->phaseId); $phase = $this->projectModel->getPhaseById($section->phaseId); if (!is_null($phase->date_invoice_transfer) && $phase->date_invoice_transfer->format('Y-m-d') >= $section->date_transfer->format('Y-m-d')) { $errors[] = 'Datum převodu musí být větší než datum posledního převodu!'; } else { // This is first invoice for this phase if (is_null($phase->date_invoice_transfer)) { // Only on firt invoice set SDZ && VDZ (signs pay by amount) // Create FlexiBee record $fbResult = $this->flexiBee->addOrder( $phase->id, $pr->number, $pr->name, $pr->place, $pr->note, $pr->bil_name, $pr->bil_street, $pr->bil_city, $pr->bil_postcode, $pr->bil_cin, $pr->bil_tin, array('pdz', 'sdz', 'vdz'), NULL, $section->date_transfer ); } else { // Create FlexiBee record $fbResult = $this->flexiBee->addOrder( $phase->id, $pr->number, $pr->name, $pr->place, $pr->note, $pr->bil_name, $pr->bil_street, $pr->bil_city, $pr->bil_postcode, $pr->bil_cin, $pr->bil_tin, array('pdz'), $phase->date_invoice_transfer, $section->date_transfer ); } if ($fbResult === TRUE) { $this->invoiceModel->setDateInvoiceTransferBy($section->date_transfer, array('id_project' => $pr->id, 'id' => $phase->id)); } else { $errors[] = 'FlexiBee převod nebyl uskutečněn, jelikož dané období neobsahuje žádná data.'; } } } if (count($errors)) { foreach ($errors as $error) { $button->form->addError((string) $error); } } else { $this->presenter->redirect('this'); } } }
Output for 7.0.0 - 7.1.0
Fatal error: Class 'Nette\Application\UI\Form' not found in /in/QdOOu on line 13
Process exited with code 255.
Output for 5.3.0 - 5.6.28
Fatal error: Class 'Nette\Application\UI\Form' not found in /in/QdOOu on line 14
Process exited with code 255.
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.2.17
Parse error: syntax error, unexpected T_STRING in /in/QdOOu on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_STRING in /in/QdOOu on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/QdOOu on line 3
Process exited with code 255.