PHPFusion\Forums\Admin\ForumAdminView::display_forum_form PHP Метод

display_forum_form() публичный Метод

Display Forum Form
public display_forum_form ( )
    public function display_forum_form()
    {
        require_once INCLUDES . 'photo_functions_include.php';
        require_once INCLUDES . 'infusions_include.php';
        $forum_settings = $this->get_forum_settings();
        $language_opts = fusion_get_enabled_languages();
        add_breadcrumb(array('link' => '', 'title' => self::$locale['forum_001']));
        if (!isset($_GET['action']) && $_GET['parent_id']) {
            $data['forum_cat'] = $_GET['parent_id'];
        }
        $type_opts = array('1' => self::$locale['forum_opts_001'], '2' => self::$locale['forum_opts_002'], '3' => self::$locale['forum_opts_003'], '4' => self::$locale['forum_opts_004']);
        $forum_image_path = FORUM . "images/";
        if (isset($_POST['remove_image']) && isset($_POST['forum_id'])) {
            $data['forum_id'] = form_sanitizer($_POST['forum_id'], '', 'forum_id');
            if ($data['forum_id']) {
                $data = self::get_forum($data['forum_id']);
                if (!empty($data)) {
                    $forum_image = $forum_image_path . $data['forum_image'];
                    if (!empty($data['forum_image']) && file_exists($forum_image) && !is_dir($forum_image)) {
                        @unlink($forum_image);
                        $data['forum_image'] = '';
                    }
                    dbquery_insert(DB_FORUMS, $data, 'update');
                    addNotice('success', self::$locale['forum_notice_8']);
                    redirect(FUSION_REQUEST);
                }
            }
        }
        opentable(self::$locale['forum_001']);
        echo openform('inputform', 'post', FUSION_REQUEST, array('enctype' => 1));
        echo "<div class='row'>\n<div class='col-xs-12 col-sm-8 col-md-8 col-lg-8'>\n";
        echo form_text('forum_name', self::$locale['forum_006'], $this->data['forum_name'], array('required' => 1, 'error_text' => self::$locale['forum_error_1'])) . form_textarea('forum_description', self::$locale['forum_007'], $this->data['forum_description'], array('autosize' => 1, 'type' => 'bbcode', 'form_name' => 'inputform', 'preview' => TRUE)) . form_text('forum_alias', self::$locale['forum_011'], $this->data['forum_alias']);
        echo "</div><div class='col-xs-12 col-sm-4 col-md-4 col-lg-4'>\n";
        openside('');
        $self_id = $this->data['forum_id'] ? $this->data['forum_id'] : '';
        echo form_select_tree('forum_cat', self::$locale['forum_008'], $this->data['forum_cat'], array('add_parent_opts' => 1, 'disable_opts' => $self_id, 'hide_disabled' => 1), DB_FORUMS, 'forum_name', 'forum_id', 'forum_cat', $self_id) . form_select('forum_type', self::$locale['forum_009'], $this->data['forum_type'], array("options" => $type_opts)) . form_select('forum_language', self::$locale['forum_010'], $this->data['forum_language'], array("options" => $language_opts)) . form_text('forum_order', self::$locale['forum_043'], $this->data['forum_order'], array('number' => 1)) . form_button('save_forum', $this->data['forum_id'] ? self::$locale['forum_000a'] : self::$locale['forum_000'], self::$locale['forum_000'], array('class' => 'btn btn-sm btn-success'));
        closeside();
        echo "</div>\n</div>\n";
        echo "<div class='row'>\n<div class='col-xs-12 col-sm-8 col-md-8 col-lg-8'>\n";
        echo form_select('forum_meta', self::$locale['forum_012'], $this->data['forum_meta'], array('tags' => 1, 'multiple' => 1, 'width' => '100%'));
        if ($this->data['forum_image'] && file_exists(FORUM . "images/" . $this->data['forum_image'])) {
            openside();
            echo "<div class='pull-left m-r-10'>\n";
            echo thumbnail(FORUM . "images/" . $this->data['forum_image'], '80px', '80px');
            echo "</div>\n<div class='overflow-hide'>\n";
            echo "<span class='strong'>" . self::$locale['forum_013'] . "</span><br/>\n";
            $image_size = @getimagesize(FORUM . "images/" . $this->data['forum_image']);
            echo "<span class='text-smaller'>" . sprintf(self::$locale['forum_027'], $image_size[0], $image_size[1]) . "</span><br/>";
            echo form_hidden('forum_image', '', $this->data['forum_image']);
            echo form_button('remove_image', self::$locale['forum_028'], self::$locale['forum_028'], array('class' => 'btn-danger btn-sm m-t-10', 'icon' => 'fa fa-trash'));
            echo "</div>\n";
            closeside();
        } else {
            $tab_title['title'][] = self::$locale['forum_013'];
            $tab_title['id'][] = 'fir';
            $tab_title['icon'][] = '';
            $tab_title['title'][] = self::$locale['forum_014'];
            $tab_title['id'][] = 'ful';
            $tab_title['icon'][] = '';
            $tab_active = tab_active($tab_title, 0);
            echo opentab($tab_title, $tab_active, 'forum-image-tab', FALSE, "m-t-20 m-b-20");
            // Upload Image
            echo opentabbody($tab_title['title'][0], 'fir', $tab_active);
            echo "<span class='display-inline-block m-t-10 m-b-10'>" . sprintf(self::$locale['forum_015'], parsebytesize($forum_settings['forum_attachmax'])) . "</span>\n";
            $fileOptions = array("upload_path" => $forum_image_path, "thumbnail" => TRUE, "thumbnail_folder" => $forum_image_path, "type" => "image", "delete_original" => TRUE, "max_count" => $forum_settings['forum_attachmax']);
            echo form_fileinput('forum_image', "", '', $fileOptions);
            echo closetabbody();
            // Upload image via Web Address
            echo opentabbody($tab_title['title'][1], 'ful', $tab_active);
            echo "<span class='display-inline-block m-t-10 m-b-10'>" . self::$locale['forum_016'] . "</strong></span>\n";
            $header_opts = array('0' => 'Local Server', '1' => 'URL');
            echo form_select('forum_image_header', self::$locale['forum_056'], '', array('inline' => TRUE, 'options' => $header_opts));
            echo form_text('forum_image_url', self::$locale['forum_014'], '', array('placeholder' => 'images/forum/', 'inline' => TRUE));
            echo closetabbody();
            echo closetab();
        }
        echo form_textarea('forum_rules', self::$locale['forum_017'], $this->data['forum_rules'], array('autosize' => 1, 'bbcode' => 1));
        echo "</div><div class='col-xs-12 col-sm-4 col-md-4 col-lg-4'>\n";
        openside('');
        // need to get parent category
        echo form_select_tree('forum_permissions', self::$locale['forum_025'], $this->data['forum_branch'], array('no_root' => 1, 'deactivate' => $this->data['forum_id'] ? TRUE : FALSE), DB_FORUMS, 'forum_name', 'forum_id', 'forum_cat');
        if ($this->data['forum_id']) {
            echo form_button('jp_forum', self::$locale['forum_029'], self::$locale['forum_029'], array('class' => 'btn-sm btn-default m-r-10'));
        }
        closeside();
        openside('');
        echo form_checkbox('forum_lock', self::$locale['forum_026'], $this->data['forum_lock'], array("reverse_label" => TRUE)) . form_checkbox('forum_users', self::$locale['forum_024'], $this->data['forum_users'], array("reverse_label" => TRUE)) . form_checkbox('forum_quick_edit', self::$locale['forum_021'], $this->data['forum_quick_edit'], array("reverse_label" => TRUE)) . form_checkbox('forum_merge', self::$locale['forum_019'], $this->data['forum_merge'], array("reverse_label" => TRUE)) . form_checkbox('forum_allow_attach', self::$locale['forum_020'], $this->data['forum_allow_attach'], array("reverse_label" => TRUE)) . form_checkbox('forum_allow_poll', self::$locale['forum_022'], $this->data['forum_allow_poll'], array("reverse_label" => TRUE)) . form_hidden('forum_id', '', $this->data['forum_id']) . form_hidden('forum_branch', '', $this->data['forum_branch']);
        closeside();
        echo "</div>\n</div>\n";
        echo form_button('save_forum', $this->data['forum_id'] ? self::$locale['forum_000a'] : self::$locale['forum_000'], self::$locale['forum_000'], array('class' => 'btn-sm btn-success'));
        echo closeform();
        closetable();
    }