root/solr/files/lib/acp/form/SolrForm.class.php @ 1185

Revision 1185, 1.8 kB (checked in by d0nut, 3 years ago)

it is possible to display solr status :)

  • Property svn:executable set to *
Line 
1<?php
2// wcf imports
3require_once(WCF_DIR.'lib/data/solr/SolrBridge.php');
4require_once(WCF_DIR.'lib/acp/form/ACPForm.class.php');
5
6/**
7 * solr form
8 *
9 * @author      Torben Brodt
10 * @copyright   2010 easy-coding.de
11 * @license     GNU General Public License <http://opensource.org/licenses/gpl-3.0.html>
12 * @package     de.easy-coding.wcf.solr
13 */
14class SolrForm extends ACPForm {
15        /**
16         * Template name
17         *
18         * @var string
19         */
20        public $templateName = 'solr';
21       
22        /**
23         * Active menu item
24         *
25         * @var string
26         */
27        public $activeMenuItem = 'wcf.acp.menu.link.solr.index';
28       
29        /**
30         * Permission
31         *
32         * @var string
33         */
34        public $neededPermissions = 'admin.contest.canAddClass';
35
36
37        public function readParameters() {
38                parent::readParameters();
39        }
40        /**
41         * @see Form::readFormParameters()
42         */
43        public function readFormParameters() {
44                parent::readFormParameters();
45
46                if (isset($_POST['topic'])) $this->topic = StringUtil::trim($_POST['topic']);
47        }
48
49        /**
50         * @see Page::readData()
51         */
52        public function readData() {
53                parent::readData();
54
55                $this->bridge = new SolrBridge();
56                $this->status = $this->bridge->getIndexStatus();
57        }
58
59        /**
60         * @see Form::save()
61         */
62        public function save() {
63                parent::save();
64
65                // save
66                $this->contestClass = ContestClassEditor::create($this->topic, $this->text, 
67                        $this->parentClassID, $this->position, WCF::getLanguage()->getLanguageID());
68                $this->saved();
69
70                // reset values
71                $this->topic = $this->text = $this->parentClassID = '';
72                $this->languageID = $this->position = 0;
73
74                // show success message
75                WCF::getTPL()->assign('success', true);
76        }
77
78        /**
79         * @see Page::assignVariables()
80         */
81        public function assignVariables() {
82                parent::assignVariables();
83
84                WCF::getTPL()->assign(array(
85                        'results' => $this->status,
86                ));
87        }
88}
89?>
Note: See TracBrowser for help on using the browser.