1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11:
12: class Agora_Form_Forum extends Horde_Form {
13:
14: 15:
16: function __construct(&$vars, $title)
17: {
18: global $forums, $conf;
19:
20: parent::Horde_Form($vars, $title);
21:
22: $forums_list = Agora::formatCategoryTree($forums->getForums(0, false, 'forum_name', 0, true));
23:
24: $this->setButtons($vars->get('forum_id') ? _("Update") : _("Create"));
25:
26: $this->addHidden('', 'forum_id', 'int', false);
27: $this->addVariable(_("Forum name"), 'forum_name', 'text', true);
28:
29: if (count($forums_list) > 0) {
30: $this->addVariable(_("Parent forum"), 'forum_parent_id', 'enum', false, false, null, array($forums_list, true));
31: } else {
32: $this->addHidden('', 'forum_parent_id', 'text', false);
33: $vars->set('forum_parent_id', key($forums_list));
34: }
35: $this->addVariable(_("Enter a brief description of this forum"), 'forum_description', 'longtext', false, false, null, array(4, 40));
36: $this->addVariable(_("Is this a moderated forum?"), 'forum_moderated', 'boolean', false, false, _("Set this if you want all messages to be checked by a moderator before they are posted."));
37: $this->addVariable(_("Optional email address to recieve a copy of each posted message"), 'forum_distribution_address', 'text', false, false);
38: if ($conf['forums']['enable_attachments'] == '0') {
39: $this->addVariable(_("Allow attachments in this forum?"), 'forum_attachments', 'boolean', false, false, _("If selected users will be able to attach files to their messages."));
40: }
41: }
42:
43: 44:
45: function execute(&$vars)
46: {
47: global $forums;
48:
49: $this->getInfo($vars, $info);
50: return $forums->saveForum($info);
51: }
52:
53: }
54: