diff options
| author | Michaela Brückner <brueckner@data-quest.de> | 2026-01-30 15:21:45 +0100 |
|---|---|---|
| committer | Michaela Brückner <brueckner@data-quest.de> | 2026-03-17 10:55:55 +0100 |
| commit | c960bd2269080d47c9f6dff273131de663e4e981 (patch) | |
| tree | b2fdff00d3942cc7e7cac6c9505ed26456ffe774 /lib/models | |
| parent | 766df4e54fa732011be4ce4e23e026aac02a3c37 (diff) | |
trying to create new question type 'headline'
Diffstat (limited to 'lib/models')
| -rw-r--r-- | lib/models/Headline.php | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/lib/models/Headline.php b/lib/models/Headline.php new file mode 100644 index 0000000..d03ea91 --- /dev/null +++ b/lib/models/Headline.php @@ -0,0 +1,70 @@ +<?php + +class Headline extends QuestionnaireQuestion implements QuestionType +{ + public static function getIcon(bool $active = false) : Icon + { + return Icon::create(static::getIconShape(), $active ? 'clickable' : 'info'); + } + + /** + * Returns the shape of the icon of this QuestionType + * @return string + */ + public static function getIconShape() + { + // TODO we need an icon + return 'question-text'; + } + + public static function getName() + { + return _('Überschrift'); + } + + + public function getDisplayTemplate() + { + $factory = new Flexi\Factory(realpath(__DIR__.'/../../app/views')); + $template = $factory->open('questionnaire/question_types/info/info'); + $template->set_attribute('vote', $this); + return $template; + } + + static public function getEditingComponent() + { + return ['HeadlineEdit', '']; + } + + public function beforeStoringQuestiondata($questiondata) + { + $questiondata['description'] = \Studip\Markup::markAsHtml( + \Studip\Markup::purifyHtml($questiondata['description']) + ); + return $questiondata; + } + + public function createAnswer() + { + return $this->getMyAnswer(); + } + + public function getUserIdsOfFilteredAnswer($answer_option) + { + return []; + } + + public function getResultTemplate($only_user_ids = null) + { + $factory = new Flexi\Factory(realpath(__DIR__.'/../../app/views')); + $template = $factory->open('questionnaire/question_types/info/info'); + $template->set_attribute('vote', $this); + return $template; + } + + public function getResultArray() + { + return []; + } + +} |
