/** * List activities as dashlet * * @return none * * @access public */ function run() { $session = CRM_Core_Session::singleton(); $contactID = $session->get('userID'); // a user can always view their own activity // if they have access CiviCRM permission $permission = CRM_Core_Permission::VIEW; // make the permission edit if the user has edit permission on the contact require_once 'CRM/Contact/BAO/Contact/Permission.php'; if (CRM_Contact_BAO_Contact_Permission::allow($contactID, CRM_Core_Permission::EDIT)) { $permission = CRM_Core_Permission::EDIT; } $admin = CRM_Core_Permission::check('view all activities') || CRM_Core_Permission::check('administer CiviCRM'); require_once 'CRM/Core/Selector/Controller.php'; $output = CRM_Core_Selector_Controller::SESSION; require_once 'CRM/Activity/Selector/Activity.php'; $selector = new CRM_Activity_Selector_Activity($contactID, $permission, $admin, 'home'); $sortID = null; if ($this->get(CRM_Utils_Sort::SORT_ID)) { $sortID = CRM_Utils_Sort::sortIDValue($this->get(CRM_Utils_Sort::SORT_ID), $this->get(CRM_Utils_Sort::SORT_DIRECTION)); } $controller = new CRM_Core_Selector_Controller($selector, $this->get(CRM_Utils_Pager::PAGE_ID), $sortID, CRM_Core_Action::VIEW, $this, $output); $controller->setEmbedded(true); $controller->run(); $controller->moveFromSessionToTemplate(); return parent::run(); }
/** * Browse all activities for a particular contact * * @return none * * @access public */ function browse() { require_once 'CRM/Core/Selector/Controller.php'; $output = CRM_Core_Selector_Controller::SESSION; require_once 'CRM/Activity/Selector/Activity.php'; $selector = new CRM_Activity_Selector_Activity($this->_contactId, $this->_permission); $sortID = null; if ($this->get(CRM_Utils_Sort::SORT_ID)) { $sortID = CRM_Utils_Sort::sortIDValue($this->get(CRM_Utils_Sort::SORT_ID), $this->get(CRM_Utils_Sort::SORT_DIRECTION)); } $controller = new CRM_Core_Selector_Controller($selector, $this->get(CRM_Utils_Pager::PAGE_ID), $sortID, CRM_Core_Action::VIEW, $this, $output); $controller->setEmbedded(true); $controller->run(); $controller->moveFromSessionToTemplate(); // check if case is enabled require_once 'CRM/Core/BAO/Preferences.php'; $viewOptions = CRM_Core_BAO_Preferences::valueOptions('contact_view_options', true, null, true); $enableCase = false; if (CRM_Utils_Array::value('CiviCase', $viewOptions)) { $enableCase = true; } $this->assign('enableCase', $enableCase); $this->assign('context', 'activity'); }
/** * processing needed for buildForm and later * * @return void * @access public */ function preProcess() { $this->set('searchFormName', 'Search'); /** * set the button names */ $this->_searchButtonName = $this->getButtonName('refresh'); $this->_actionButtonName = $this->getButtonName('next', 'action'); $this->_done = FALSE; $this->defaults = array(); /* * we allow the controller to set force/reset externally, useful when we are being * driven by the wizard framework */ $this->_reset = CRM_Utils_Request::retrieve('reset', 'Boolean', CRM_Core_DAO::$_nullObject); $this->_force = CRM_Utils_Request::retrieve('force', 'Boolean', $this, FALSE); $this->_limit = CRM_Utils_Request::retrieve('limit', 'Positive', $this); $this->_context = CRM_Utils_Request::retrieve('context', 'String', $this, FALSE, 'search'); $this->assign("context", $this->_context); // get user submitted values // get it from controller only if form has been submitted, else preProcess has set this if (!empty($_POST)) { $this->_formValues = $this->controller->exportValues($this->_name); } else { $this->_formValues = $this->get('formValues'); } if ($this->_force) { $this->postProcess(); $this->set('force', 0); } $sortID = NULL; if ($this->get(CRM_Utils_Sort::SORT_ID)) { $sortID = CRM_Utils_Sort::sortIDValue($this->get(CRM_Utils_Sort::SORT_ID), $this->get(CRM_Utils_Sort::SORT_DIRECTION)); } $this->_queryParams = CRM_Contact_BAO_Query::convertFormValues($this->_formValues); $selector = new CRM_Member_Selector_Search($this->_queryParams, $this->_action, NULL, $this->_single, $this->_limit, $this->_context); $prefix = NULL; if ($this->_context == 'basic') { $prefix = $this->_prefix; } $this->assign("{$prefix}limit", $this->_limit); $this->assign("{$prefix}single", $this->_single); $controller = new CRM_Core_Selector_Controller($selector, $this->get(CRM_Utils_Pager::PAGE_ID), $sortID, CRM_Core_Action::VIEW, $this, CRM_Core_Selector_Controller::TRANSFER, $prefix); $controller->setEmbedded(TRUE); $controller->moveFromSessionToTemplate(); $this->assign('summary', $this->get('summary')); }
/** * Processing needed for buildForm and later. */ public function preProcess() { $this->set('searchFormName', 'Search'); //check for civicase access. if (!CRM_Case_BAO_Case::accessCiviCase()) { CRM_Core_Error::fatal(ts('You are not authorized to access this page.')); } //validate case configuration. $configured = CRM_Case_BAO_Case::isCaseConfigured(); $this->assign('notConfigured', !$configured['configured']); if (!$configured['configured']) { return; } /** * set the button names */ $this->_searchButtonName = $this->getButtonName('refresh'); $this->_actionButtonName = $this->getButtonName('next', 'action'); $this->_done = FALSE; $this->defaults = array(); /* * we allow the controller to set force/reset externally, useful when we are being * driven by the wizard framework */ $this->_reset = CRM_Utils_Request::retrieve('reset', 'Boolean', CRM_Core_DAO::$_nullObject); $this->_force = CRM_Utils_Request::retrieve('force', 'Boolean', $this, FALSE); $this->_limit = CRM_Utils_Request::retrieve('limit', 'Positive', $this); $this->_context = CRM_Utils_Request::retrieve('context', 'String', $this, FALSE, 'search'); $this->assign('context', $this->_context); // get user submitted values // get it from controller only if form has been submitted, else preProcess has set this if (!empty($_POST) && !$this->controller->isModal()) { $this->_formValues = $this->controller->exportValues($this->_name); } else { $this->_formValues = $this->get('formValues'); } if (empty($this->_formValues)) { if (isset($this->_ssID)) { $this->_formValues = CRM_Contact_BAO_SavedSearch::getFormValues($this->_ssID); } } if ($this->_force) { $this->postProcess(); $this->set('force', 0); } $sortID = NULL; if ($this->get(CRM_Utils_Sort::SORT_ID)) { $sortID = CRM_Utils_Sort::sortIDValue($this->get(CRM_Utils_Sort::SORT_ID), $this->get(CRM_Utils_Sort::SORT_DIRECTION)); } $this->_queryParams = CRM_Contact_BAO_Query::convertFormValues($this->_formValues); $selector = new CRM_Case_Selector_Search($this->_queryParams, $this->_action, NULL, $this->_single, $this->_limit, $this->_context); $prefix = NULL; if ($this->_context == 'user') { $prefix = $this->_prefix; } $this->assign("{$prefix}limit", $this->_limit); $this->assign("{$prefix}single", $this->_single); $controller = new CRM_Core_Selector_Controller($selector, $this->get(CRM_Utils_Pager::PAGE_ID), $sortID, CRM_Core_Action::VIEW, $this, CRM_Core_Selector_Controller::TRANSFER, $prefix); $controller->setEmbedded(TRUE); $controller->moveFromSessionToTemplate(); $this->assign('summary', $this->get('summary')); }
/** * Processing needed for buildForm and later. */ public function preProcess() { $this->_done = FALSE; $this->_defaults = array(); //set the button name. $this->_searchButtonName = $this->getButtonName('refresh'); $this->_printButtonName = $this->getButtonName('next', 'print'); $this->_actionButtonName = $this->getButtonName('next', 'action'); //we allow the controller to set force/reset externally, //useful when we are being driven by the wizard framework $this->_limit = CRM_Utils_Request::retrieve('limit', 'Positive', $this); $this->_force = CRM_Utils_Request::retrieve('force', 'Boolean', $this, FALSE); $this->_context = CRM_Utils_Request::retrieve('context', 'String', $this, FALSE, 'search'); $this->_reset = CRM_Utils_Request::retrieve('reset', 'Boolean', CRM_Core_DAO::$_nullObject); //operation for state machine. $this->_operation = CRM_Utils_Request::retrieve('op', 'String', $this, FALSE, 'reserve'); //validate operation. if (!in_array($this->_operation, array('reserve', 'release', 'interview'))) { $this->_operation = 'reserve'; $this->set('op', $this->_operation); } $this->set('searchVoterFor', $this->_operation); $this->assign('searchVoterFor', $this->_operation); $this->assign('isFormSubmitted', $this->isSubmitted()); //do check permissions. if (!CRM_Core_Permission::check('administer CiviCampaign') && !CRM_Core_Permission::check('manage campaign') && !CRM_Core_Permission::check("{$this->_operation} campaign contacts")) { CRM_Utils_System::permissionDenied(); CRM_Utils_System::civiExit(); } $this->assign("context", $this->_context); // get user submitted values // get it from controller only if form has been submitted, else preProcess has set this if (empty($_POST)) { $this->_formValues = $this->get('formValues'); } else { $this->_formValues = $this->controller->exportValues($this->_name); } if ($this->_force) { $this->postProcess(); $this->set('force', 0); } $sortID = NULL; if ($this->get(CRM_Utils_Sort::SORT_ID)) { $sortID = CRM_Utils_Sort::sortIDValue($this->get(CRM_Utils_Sort::SORT_ID), $this->get(CRM_Utils_Sort::SORT_DIRECTION)); } //get the voter clause. $voterClause = $this->voterClause(); $this->_queryParams = CRM_Contact_BAO_Query::convertFormValues($this->_formValues); $selector = new CRM_Campaign_Selector_Search($this->_queryParams, $this->_action, $voterClause, $this->_single, $this->_limit, $this->_context); $prefix = NULL; if ($this->_context == 'user') { $prefix = $this->_prefix; } $this->assign("{$prefix}limit", $this->_limit); $this->assign("{$prefix}single", $this->_single); $controller = new CRM_Core_Selector_Controller($selector, $this->get(CRM_Utils_Pager::PAGE_ID), $sortID, CRM_Core_Action::VIEW, $this, CRM_Core_Selector_Controller::TRANSFER, $prefix); $controller->setEmbedded(TRUE); $controller->moveFromSessionToTemplate(); //append breadcrumb to survey dashboard. if (CRM_Campaign_BAO_Campaign::accessCampaign()) { $url = CRM_Utils_System::url('civicrm/campaign', 'reset=1&subPage=survey'); CRM_Utils_System::appendBreadCrumb(array(array('title' => ts('Survey(s)'), 'url' => $url))); } //set the form title. CRM_Utils_System::setTitle(ts('Find Respondents To %1', array(1 => ucfirst($this->_operation)))); }
/** * View details of a case * * @return void * @access public */ function view() { $controller = new CRM_Core_Controller_Simple('CRM_Case_Form_CaseView', 'View Case', $this->_action, FALSE, FALSE, TRUE); $controller->setEmbedded(TRUE); $controller->set('id', $this->_id); $controller->set('cid', $this->_contactId); $controller->run(); $this->assign('caseId', $this->_id); $output = CRM_Core_Selector_Controller::SESSION; $selector = new CRM_Activity_Selector_Activity($this->_contactId, $this->_permission, FALSE, 'case'); $controller = new CRM_Core_Selector_Controller($selector, $this->get(CRM_Utils_Pager::PAGE_ID), NULL, CRM_Core_Action::VIEW, $this, $output, NULL, $this->_id); $controller->setEmbedded(TRUE); $controller->run(); $controller->moveFromSessionToTemplate(); $this->assign('context', 'case'); }
/** * processing needed for buildForm and later * * @return void * @access public */ function preProcess() { $this->set('searchFormName', 'Search'); /** * set the button names */ $this->_searchButtonName = $this->getButtonName('refresh'); $this->_printButtonName = $this->getButtonName('next', 'print'); $this->_actionButtonName = $this->getButtonName('next', 'action'); $this->_done = false; $this->defaults = array(); /* * we allow the controller to set force/reset externally, useful when we are being * driven by the wizard framework */ $this->_reset = CRM_Utils_Request::retrieve('reset', 'Boolean', CRM_Core_DAO::$_nullObject); $this->_force = CRM_Utils_Request::retrieve('force', 'Boolean', $this, false); $this->_limit = CRM_Utils_Request::retrieve('limit', 'Positive', $this); $this->_context = CRM_Utils_Request::retrieve('context', 'String', $this, false, 'search'); $this->assign("context", $this->_context); // get user submitted values // get it from controller only if form has been submitted, else preProcess has set this if (!empty($_POST)) { $this->_formValues = $this->controller->exportValues($this->_name); } else { $this->_formValues = $this->get('formValues'); } //membership ID $memberShipId = CRM_Utils_Request::retrieve('memberId', 'Positive', $this); if (isset($memberShipId)) { $this->_formValues['contribution_membership_id'] = $memberShipId; } $participantId = CRM_Utils_Request::retrieve('participantId', 'Positive', $this); if (isset($participantId)) { $this->_formValues['contribution_participant_id'] = $participantId; } if ($this->_force) { $this->postProcess(); $this->set('force', 0); } $sortID = null; if ($this->get(CRM_Utils_Sort::SORT_ID)) { $sortID = CRM_Utils_Sort::sortIDValue($this->get(CRM_Utils_Sort::SORT_ID), $this->get(CRM_Utils_Sort::SORT_DIRECTION)); } require_once 'CRM/Contact/BAO/Query.php'; $this->_queryParams =& CRM_Contact_BAO_Query::convertFormValues($this->_formValues); $selector = new CRM_Contribute_Selector_Search($this->_queryParams, $this->_action, null, $this->_single, $this->_limit, $this->_context); $prefix = null; if ($this->_context == 'user') { $prefix = $this->_prefix; } $this->assign("{$prefix}limit", $this->_limit); $this->assign("{$prefix}single", $this->_single); $controller = new CRM_Core_Selector_Controller($selector, $this->get(CRM_Utils_Pager::PAGE_ID), $sortID, CRM_Core_Action::VIEW, $this, CRM_Core_Selector_Controller::TRANSFER, $prefix); $controller->setEmbedded(true); $controller->moveFromSessionToTemplate(); $this->assign('contributionSummary', $this->get('summary')); }
/** * View details of a case * * @return void * @access public */ function view() { $controller = new CRM_Core_Controller_Simple('CRM_Case_Form_CaseView', 'View Case', $this->_action); $controller->setEmbedded(true); $controller->set('id', $this->_id); $controller->set('cid', $this->_contactId); $controller->run(); $this->assign('caseId', $this->_id); require_once 'CRM/Activity/Selector/Activity.php'; require_once 'CRM/Core/Selector/Controller.php'; $output = CRM_Core_Selector_Controller::SESSION; $selector = new CRM_Activity_Selector_Activity($this->_contactId, $this->_permission, false, 'case'); $controller = new CRM_Core_Selector_Controller($selector, $this->get(CRM_Utils_Pager::PAGE_ID), null, CRM_Core_Action::VIEW, $this, $output, null, $this->_id); $controller->setEmbedded(true); $controller->run(); $controller->moveFromSessionToTemplate(); $this->assign('context', 'case'); }