public function createComponentForm($name) { $form = new Form($this, $name); $form->addTextArea("html", "Upravte data", 80, 50)->controlPrototype->class[] = "tinymce"; $form->addSubmit("doPDFka", "Do PDFka!"); $appDir = Nette\Environment::getVariable('appDir'); $form->setDefaults(array("html" => $this->createTemplate()->setFile($appDir . "/templates/Homepage/pdf-source.latte")->__toString())); $form->onSuccess[] = array($this, "onSubmit"); }
/** * Gets nicer date format * @param mixed date (MySQL DateTime or timestamp) * @param bool withoutTime (returns only date without time) * @return string */ public static function formatDate($date, $withoutTime = false) { if (!is_int($date)) { $date = strtotime($date); } switch (Nette\Environment::getVariable('lang')) { case 'cs': if ($withoutTime) { return date('j.n.Y', $date); } return date('j.n.Y G:i', $date); case 'en': if ($withoutTime) { return date('j.n.Y', $date); } return date('j.n.Y G:i', $date); default: if ($withoutTime) { return date('j.n.Y', $date); } return date('Y/m/d H:i', $date); } }