[Ref] Separate url path calculation into the relevant classes
[civicrm-core.git] / CRM / Event / Form / Task / Register.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 provides the register functionality from a search context.
20 *
21 * Originally the functionality was all munged into the main Participant form.
22 *
23 * Ideally it would be entirely separated but for now this overrides the main form,
24 * just providing a better separation of the functionality for the search vs main form.
25 */
26 class CRM_Event_Form_Task_Register extends CRM_Event_Form_Participant {
27
28
29 /**
30 * Are we operating in "single mode", i.e. adding / editing only
31 * one participant record, or is this a batch add operation
32 *
33 * ote the goal is to disentangle all the non-single stuff
34 * into this form and discontinue this param.
35 *
36 * @var bool
37 */
38 public $_single = FALSE;
39
40 /**
41 * Assign the url path to the template.
42 */
43 protected function assignUrlPath() {
44 //set the appropriate action
45 $context = $this->get('context');
46 $urlString = 'civicrm/contact/search';
47 $this->_action = CRM_Core_Action::BASIC;
48 switch ($context) {
49 case 'advanced':
50 $urlString = 'civicrm/contact/search/advanced';
51 $this->_action = CRM_Core_Action::ADVANCED;
52 break;
53
54 case 'builder':
55 $urlString = 'civicrm/contact/search/builder';
56 $this->_action = CRM_Core_Action::PROFILE;
57 break;
58
59 case 'basic':
60 $urlString = 'civicrm/contact/search/basic';
61 $this->_action = CRM_Core_Action::BASIC;
62 break;
63
64 case 'custom':
65 $urlString = 'civicrm/contact/search/custom';
66 $this->_action = CRM_Core_Action::COPY;
67 break;
68 }
69 CRM_Contact_Form_Task::preProcessCommon($this);
70
71 $this->_contactId = NULL;
72
73 //set ajax path, this used for custom data building
74 $this->assign('urlPath', $urlString);
75 $this->assign('urlPathVar', "_qf_Participant_display=true&qfKey={$this->controller->_key}");
76 }
77
78 }