| 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 | class CRM_Contact_Page_View_Tag extends CRM_Core_Page { |
| 18 | |
| 19 | /** |
| 20 | * Called when action is browse. |
| 21 | */ |
| 22 | public function browse() { |
| 23 | $controller = new CRM_Core_Controller_Simple('CRM_Tag_Form_Tag', ts('Contact Tags'), $this->_action); |
| 24 | $controller->setEmbedded(TRUE); |
| 25 | |
| 26 | // set the userContext stack |
| 27 | $session = CRM_Core_Session::singleton(); |
| 28 | |
| 29 | $session->pushUserContext(CRM_Utils_System::url('civicrm/contact/view', 'action=browse&selectedChild=tag'), FALSE); |
| 30 | $controller->reset(); |
| 31 | $controller->set('contactId', $this->_contactId); |
| 32 | $controller->process(); |
| 33 | $controller->run(); |
| 34 | } |
| 35 | |
| 36 | public function preProcess() { |
| 37 | $this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this, TRUE); |
| 38 | $this->assign('contactId', $this->_contactId); |
| 39 | |
| 40 | // check logged in url permission |
| 41 | CRM_Contact_Page_View::checkUserPermission($this); |
| 42 | |
| 43 | $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'browse'); |
| 44 | $this->assign('action', $this->_action); |
| 45 | } |
| 46 | |
| 47 | /** |
| 48 | * the main function that is called when the page loads |
| 49 | * it decides the which action has to be taken for the page. |
| 50 | * |
| 51 | * @return null |
| 52 | */ |
| 53 | public function run() { |
| 54 | $this->preProcess(); |
| 55 | |
| 56 | $this->browse(); |
| 57 | |
| 58 | return parent::run(); |
| 59 | } |
| 60 | |
| 61 | } |