コード例 #1
0
 protected function beforeRender()
 {
     $this->template->addFilter('time', function ($seconds) {
         return Base::getSecondsToString($seconds);
     });
     $this->template->addFilter('bool2string', function ($bool) {
         return Base::getBooleanToString($bool);
     });
     $this->template->addFilter('respondentWebsitePeriod', function ($period) {
         return Respondent::getRespondentWebsitePeriodLabel($period);
     });
     $this->template->addFilter('respondentAgeLabel', function ($age) {
         return Respondent::getAgeLabel($age);
     });
     $this->template->addFilter('respondentGenderLabel', function ($gender) {
         return Respondent::getGenderLabel($gender);
     });
     $this->template->addFilter('respondentCategoryPeriodLabel', function ($period) {
         return Respondent::getRespondentCategoryPeriodLabel($period);
     });
 }
コード例 #2
0
 protected function createTemplate($class = NULL)
 {
     $template = parent::createTemplate($class);
     $template->addFilter('time', function ($seconds) {
         return Base::getSecondsToString($seconds);
     });
     $template->addFilter('bool2string', function ($bool) {
         return Base::getBooleanToString($bool);
     });
     $template->addFilter('respondentWebsitePeriod', function ($period) {
         return Respondent::getRespondentWebsitePeriodLabel($period);
     });
     $template->addFilter('respondentAgeLabel', function ($age) {
         return Respondent::getAgeLabel($age);
     });
     $template->addFilter('respondentGenderLabel', function ($gender) {
         return Respondent::getGenderLabel($gender);
     });
     $template->addFilter('respondentCategoryPeriodLabel', function ($period) {
         return Respondent::getRespondentCategoryPeriodLabel($period);
     });
     return $template;
 }
コード例 #3
0
 protected function createComponentFilterForm()
 {
     $form = new \Nette\Application\UI\Form();
     $form->addGroup('Filtrování');
     $form->addText('id', 'Id');
     $form->addText('datetime', 'Čas');
     $form->addCheckboxList('age', 'Věk', array("null" => "neznámé", \App\Model\Respondent::AGE_15 => \App\Utils\Respondent::getAgeLabel(\App\Model\Respondent::AGE_15), \App\Model\Respondent::AGE_15_20 => \App\Utils\Respondent::getAgeLabel(\App\Model\Respondent::AGE_15_20), \App\Model\Respondent::AGE_21_30 => \App\Utils\Respondent::getAgeLabel(\App\Model\Respondent::AGE_21_30), \App\Model\Respondent::AGE_31_45 => \App\Utils\Respondent::getAgeLabel(\App\Model\Respondent::AGE_31_45), \App\Model\Respondent::AGE_46_60 => \App\Utils\Respondent::getAgeLabel(\App\Model\Respondent::AGE_46_60), \App\Model\Respondent::AGE_60 => \App\Utils\Respondent::getAgeLabel(\App\Model\Respondent::AGE_60)));
     $form->addCheckboxList('gender', 'Pohlaví', array("null" => "neznámé", \App\Model\Respondent::GENDER_MALE => "muž", \App\Model\Respondent::GENDER_FEMALE => "žena"));
     $form->addCheckboxList('english', 'Angličtina', array("null" => "neznámé", 1 => "ano", 0 => "ne"));
     $form->addCheckboxList('it', 'It', array("null" => "neznámé", 1 => "ano", 0 => "ne"));
     $form->addCheckboxList('devices', 'Zařízení', array(\App\Model\Respondent::DEVICE_COMPUTER => "počítač", \App\Model\Respondent::DEVICE_PHONE => "smartphone", \App\Model\Respondent::DEVICE_TABLET => "tablet"));
     $form->addCheckboxList('device_most', 'Nejčastější zařízení', array("null" => "neznámé", \App\Model\Respondent::DEVICE_COMPUTER => "počítač", \App\Model\Respondent::DEVICE_PHONE => "smartphone", \App\Model\Respondent::DEVICE_TABLET => "tablet"));
     $form->addText('websites', 'Navštěvované stránky');
     $form->addText('questions', 'Otázek');
     $form->addText('subquestions', 'Podotázek');
     $form->addText('correct', 'Správně');
     $form->addText('wrong', 'Špatně');
     $form->addText('almost', 'Téměř');
     $form->addText('disqualified', 'Nepočítané');
     $form->addText('unknown', 'Nevyhodnoceno');
     $form->addText('percentages', 'Procenta');
     $this->addOrder($form, array('respondent.id_respondent' => 'id', 'respondent.datetime' => 'čas', 'total_questions' => 'počet otázek', 'total_subquestions' => 'počet podotázek', 'total_correct_subquestions' => 'správně', 'total_wrong_subquestions' => 'špatně', 'total_almost_subquestions' => 'téměř', 'total_disqualified_subquestions' => 'nepočítané', 'total_unknown_subquestions' => 'nevyhodnoceno', 'total_correct_subquestions_percents' => 'úspěšnost'));
     $form->onSuccess[] = $this->filterFormSubmited;
     $form->addGroup();
     $form->addSubmit('filter', 'Filtrovat')->setAttribute("class", "btn btn-primary ajax");
     return $form;
 }