PageRenderTime 7ms CodeModel.GetById 2ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/php/handbook_topic_form.class.php

https://bitbucket.org/chamilo/chamilo-handbook-topic-dev/
PHP | 51 lines | 39 code | 8 blank | 4 comment | 0 complexity | 84a71b9e5408a01d072cdf91626a35b0 MD5 | raw file
 1<?php
 2namespace repository\content_object\handbook_topic;
 3
 4use repository\ContentObjectForm;
 5use common\libraries\Translation;
 6
 7/**
 8 * This class represents a form to create or update handbook_topics
 9 */
10class HandbookTopicForm extends ContentObjectForm
11{
12
13    // Inherited
14    function create_content_object()
15    {
16        $object = new HandbookTopic();
17        $object->set_text($this->exportValue(HandbookTopic :: PROPERTY_TEXT));
18        $this->set_content_object($object);
19        return parent :: create_content_object();
20    }
21
22    function update_content_object()
23    {
24        $object = $this->get_content_object();
25        $object->set_text($this->exportValue(HandbookTopic :: PROPERTY_TEXT));
26        return parent :: update_content_object();
27    }
28
29    function build_creation_form()
30    {
31        parent :: build_creation_form(array('height' => '50', 'collapse_toolbar' => true));
32        $htmleditor_options = array('toolbar' => 'HandbookItem');
33        $this->add_html_editor(HandbookTopic :: PROPERTY_TEXT, Translation :: get('HandbookTopicText'), $required, $htmleditor_options);
34    }
35
36    function build_editing_form()
37    {
38        $htmleditor_options = array('toolbar' => 'HandbookItem');
39        parent :: build_editing_form(array('height' => '50', 'collapse_toolbar' => true));
40        $this->add_html_editor(HandbookTopic :: PROPERTY_TEXT, Translation :: get('HandbookTopicText'), $required, $htmleditor_options);
41    }
42
43    function setDefaults($defaults = array ())
44    {
45        $object = $this->get_content_object();
46        $defaults[HandbookTopic :: PROPERTY_TEXT] = $object->get_text();
47        parent :: setDefaults($defaults);
48    }
49
50}
51?>