Merge pull request #18400 from aydun/class_api_tweak_2
[civicrm-core.git] / CRM / Event / Form / ManageEvent / Conference.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
5 | |
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
9 +--------------------------------------------------------------------+
10 */
11
12 /**
13 *
14 * @package CRM
15 * @copyright CiviCRM LLC https://civicrm.org/licensing
16 */
17
18 /**
19 * This class generates form components for Conference Slots.
20 */
21 class CRM_Event_Form_ManageEvent_Conference extends CRM_Event_Form_ManageEvent {
22
23 /**
24 * Page action.
25 * @var int
26 */
27 public $_action;
28
29 /**
30 * Build quick form.
31 */
32 public function buildQuickForm() {
33 $slots = CRM_Core_OptionGroup::values('conference_slot');
34
35 $this->add('select',
36 'slot_label_id',
37 ts('Conference Slot'),
38 [
39 '' => ts('- select -'),
40 ] + $slots,
41 FALSE
42 );
43
44 $this->addEntityRef('parent_event_id', ts('Parent Event'), [
45 'entity' => 'Event',
46 'placeholder' => ts('- any -'),
47 'select' => ['minimumInputLength' => 0],
48 ]);
49
50 parent::buildQuickForm();
51 }
52
53 /**
54 * Post process form.
55 */
56 public function postProcess() {
57 $params = $this->exportValues();
58
59 $params['id'] = $this->_id;
60 CRM_Event_BAO_Event::add($params);
61
62 parent::endPostProcess();
63 }
64
65 /**
66 * Return a descriptive name for the page, used in wizard header.
67 *
68 * @return string
69 */
70 public function getTitle() {
71 return ts('Conference Slots');
72 }
73
74 }