Exemplo n.º 1
0
 /**
  * Run the page.
  *
  * This method is called after the page is created.
  */
 public function run()
 {
     $contactId = CRM_Utils_Request::retrieve('cid', 'Positive', CRM_Core_DAO::$_nullObject, TRUE, NULL, $_REQUEST);
     $this->assign('contactId', $contactId);
     $this->assign('actionsMenuList', CRM_Contact_BAO_Contact::contextMenu($contactId));
     CRM_Contact_Page_View::addUrls($this, $contactId);
     // also create the form element for the activity links box
     $controller = new CRM_Core_Controller_Simple('CRM_Activity_Form_ActivityLinks', ts('Activity Links'), NULL);
     $controller->setEmbedded(TRUE);
     $controller->run();
     // check logged in user permission
     CRM_Contact_Page_View::checkUserPermission($this, $contactId);
     // finally call parent
     parent::run();
 }
Exemplo n.º 2
0
 /** 
  * Heart of the viewing process. The runner gets all the meta data for 
  * the contact and calls the appropriate type of page to view. 
  * 
  * @return void 
  * @access public 
  * 
  */
 function preProcess()
 {
     parent::preProcess();
     // actions buttom contextMenu
     $menuItems = CRM_Contact_BAO_Contact::contextMenu();
     $this->assign('actionsMenuList', $menuItems);
     //retrieve inline custom data
     $entityType = $this->get('contactType');
     $entitySubType = $this->get('contactSubtype');
     $groupTree =& CRM_Core_BAO_CustomGroup::getTree($entityType, $this, $this->_contactId, null, $entitySubType);
     CRM_Core_BAO_CustomGroup::buildCustomDataView($this, $groupTree);
     // also create the form element for the activity links box
     $controller = new CRM_Core_Controller_Simple('CRM_Activity_Form_ActivityLinks', ts('Activity Links'), null);
     $controller->setEmbedded(true);
     $controller->run();
 }
 /**
  * Heart of the viewing process. The runner gets all the meta data for
  * the contact and calls the appropriate type of page to view.
  *
  * @return void
  * @access public
  *
  */
 function preProcess()
 {
     parent::preProcess();
     // actions buttom contextMenu
     $menuItems = CRM_Contact_BAO_Contact::contextMenu($this->_contactId);
     $this->assign('actionsMenuList', $menuItems);
     //retrieve inline custom data
     $entityType = $this->get('contactType');
     if ($entitySubType = $this->get('contactSubtype')) {
         $entitySubType = explode(CRM_Core_DAO::VALUE_SEPARATOR, trim($entitySubType, CRM_Core_DAO::VALUE_SEPARATOR));
     }
     $groupTree =& CRM_Core_BAO_CustomGroup::getTree($entityType, $this, $this->_contactId, NULL, $entitySubType);
     CRM_Core_BAO_CustomGroup::buildCustomDataView($this, $groupTree);
     // also create the form element for the activity links box
     $controller = new CRM_Core_Controller_Simple('CRM_Activity_Form_ActivityLinks', ts('Activity Links'), NULL, FALSE, FALSE, TRUE);
     $controller->setEmbedded(TRUE);
     $controller->run();
 }
Exemplo n.º 4
0
 /**
  * Processing needed for buildForm and later.
  */
 public function preProcess()
 {
     // set the various class variables
     $this->_group = CRM_Core_PseudoConstant::group();
     $this->_groupIterator = CRM_Core_PseudoConstant::groupIterator();
     $this->_tag = CRM_Core_BAO_Tag::getTags();
     $this->_done = FALSE;
     /*
      * 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', CRM_Core_DAO::$_nullObject);
     $this->_groupID = CRM_Utils_Request::retrieve('gid', 'Positive', $this);
     $this->_amtgID = CRM_Utils_Request::retrieve('amtgID', 'Positive', $this);
     $this->_ssID = CRM_Utils_Request::retrieve('ssID', 'Positive', $this);
     $this->_sortByCharacter = CRM_Utils_Request::retrieve('sortByCharacter', 'String', $this);
     $this->_ufGroupID = CRM_Utils_Request::retrieve('id', 'Positive', $this);
     $this->_componentMode = CRM_Utils_Request::retrieve('component_mode', 'Positive', $this, FALSE, 1, $_REQUEST);
     $this->_operator = CRM_Utils_Request::retrieve('operator', 'String', $this, FALSE, 1, $_REQUEST, 'AND');
     /**
      * set the button names
      */
     $this->_searchButtonName = $this->getButtonName('refresh');
     $this->_actionButtonName = $this->getButtonName('next', 'action');
     $this->assign('actionButtonName', $this->_actionButtonName);
     // reset from session, CRM-3526
     $session = CRM_Core_Session::singleton();
     if ($this->_force && $session->get('selectedSearchContactIds')) {
         $session->resetScope('selectedSearchContactIds');
     }
     // if we dont get this from the url, use default if one exsts
     $config = CRM_Core_Config::singleton();
     if ($this->_ufGroupID == NULL && $config->defaultSearchProfileID != NULL) {
         $this->_ufGroupID = $config->defaultSearchProfileID;
     }
     // assign context to drive the template display, make sure context is valid
     $this->_context = CRM_Utils_Request::retrieve('context', 'String', $this, FALSE, 'search');
     if (!CRM_Utils_Array::value($this->_context, self::validContext())) {
         $this->_context = 'search';
     }
     $this->set('context', $this->_context);
     $this->assign('context', $this->_context);
     $this->_modeValue = self::getModeValue($this->_componentMode);
     $this->assign($this->_modeValue);
     $this->set('selectorName', self::$_selectorName);
     // get user submitted values
     // get it from controller only if form has been submitted, else preProcess has set this
     // $this->controller->isModal( ) returns TRUE if page is
     // valid, i.e all the validations are TRUE
     if (!empty($_POST) && !$this->controller->isModal()) {
         $this->_formValues = $this->controller->exportValues($this->_name);
         $this->normalizeFormValues();
         $this->_params = CRM_Contact_BAO_Query::convertFormValues($this->_formValues);
         $this->_returnProperties =& $this->returnProperties();
         // also get the uf group id directly from the post value
         $this->_ufGroupID = CRM_Utils_Array::value('uf_group_id', $_POST, $this->_ufGroupID);
         $this->_formValues['uf_group_id'] = $this->_ufGroupID;
         $this->set('id', $this->_ufGroupID);
         // also get the object mode directly from the post value
         $this->_componentMode = CRM_Utils_Array::value('component_mode', $_POST, $this->_componentMode);
         // also get the operator from the post value if set
         $this->_operator = CRM_Utils_Array::value('operator', $_POST, $this->_operator);
         $this->_formValues['operator'] = $this->_operator;
         $this->set('operator', $this->_operator);
     } else {
         $this->_formValues = $this->get('formValues');
         $this->_params = CRM_Contact_BAO_Query::convertFormValues($this->_formValues);
         $this->_returnProperties =& $this->returnProperties();
         if (!empty($this->_ufGroupID)) {
             $this->set('id', $this->_ufGroupID);
         }
     }
     if (empty($this->_formValues)) {
         //check if group is a smart group (fix for CRM-1255)
         if ($this->_groupID) {
             if ($ssId = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Group', $this->_groupID, 'saved_search_id')) {
                 $this->_ssID = $ssId;
             }
         }
         // fix for CRM-1907
         if (isset($this->_ssID) && $this->_context != 'smog') {
             // we only retrieve the saved search values if out current values are null
             $this->_formValues = CRM_Contact_BAO_SavedSearch::getFormValues($this->_ssID);
             //fix for CRM-1505
             if (CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_SavedSearch', $this->_ssID, 'mapping_id')) {
                 $this->_params = CRM_Contact_BAO_SavedSearch::getSearchParams($this->_ssID);
             } else {
                 $this->_params = CRM_Contact_BAO_Query::convertFormValues($this->_formValues);
             }
             $this->_returnProperties =& $this->returnProperties();
         } else {
             if (isset($this->_ufGroupID)) {
                 // also set the uf group id if not already present
                 $this->_formValues['uf_group_id'] = $this->_ufGroupID;
             }
             if (isset($this->_componentMode)) {
                 $this->_formValues['component_mode'] = $this->_componentMode;
             }
             if (isset($this->_operator)) {
                 $this->_formValues['operator'] = $this->_operator;
             }
             // FIXME: we should generalise in a way that components could inject url-filters
             // just like they build their own form elements
             foreach (array('mailing_id', 'mailing_delivery_status', 'mailing_open_status', 'mailing_click_status', 'mailing_reply_status', 'mailing_optout', 'mailing_forward', 'mailing_unsubscribe', 'mailing_date_low', 'mailing_date_high') as $mailingFilter) {
                 $type = 'String';
                 if ($mailingFilter == 'mailing_id' && ($filterVal = CRM_Utils_Request::retrieve('mailing_id', 'Positive', $this))) {
                     $this->_formValues[$mailingFilter] = array($filterVal);
                 } elseif ($filterVal = CRM_Utils_Request::retrieve($mailingFilter, $type, $this)) {
                     $this->_formValues[$mailingFilter] = $filterVal;
                 }
                 if ($filterVal) {
                     $this->_openedPanes['Mailings'] = 1;
                     $this->_formValues['hidden_CiviMail'] = 1;
                 }
             }
         }
     }
     $this->assign('id', CRM_Utils_Array::value('uf_group_id', $this->_formValues));
     $operator = CRM_Utils_Array::value('operator', $this->_formValues, 'AND');
     $this->set('queryOperator', $operator);
     if ($operator == 'OR') {
         $this->assign('operator', ts('OR'));
     } else {
         $this->assign('operator', ts('AND'));
     }
     // show the context menu only when we’re not searching for deleted contacts; CRM-5673
     if (empty($this->_formValues['deleted_contacts'])) {
         $menuItems = CRM_Contact_BAO_Contact::contextMenu();
         $primaryActions = CRM_Utils_Array::value('primaryActions', $menuItems, array());
         $this->_contextMenu = CRM_Utils_Array::value('moreActions', $menuItems, array());
         $this->assign('contextMenu', $primaryActions + $this->_contextMenu);
     }
     if (!isset($this->_componentMode)) {
         $this->_componentMode = CRM_Contact_BAO_Query::MODE_CONTACTS;
     }
     $modeValues = self::getModeValue($this->_componentMode);
     self::$_selectorName = $this->_modeValue['selectorName'];
     $setDynamic = FALSE;
     if (strpos(self::$_selectorName, 'CRM_Contact_Selector') !== FALSE) {
         $selector = new self::$_selectorName($this->_customSearchClass, $this->_formValues, $this->_params, $this->_returnProperties, $this->_action, FALSE, TRUE, $this->_context, $this->_contextMenu);
         $setDynamic = TRUE;
     } else {
         $selector = new self::$_selectorName($this->_params, $this->_action, NULL, FALSE, NULL, "search", "advanced");
     }
     $selector->setKey($this->controller->_key);
     $controller = new CRM_Contact_Selector_Controller($selector, $this->get(CRM_Utils_Pager::PAGE_ID), $this->get(CRM_Utils_Sort::SORT_ID), CRM_Core_Action::VIEW, $this, CRM_Core_Selector_Controller::TRANSFER);
     $controller->setEmbedded(TRUE);
     $controller->setDynamicAction($setDynamic);
     if ($this->_force) {
         $this->postProcess();
         /*
          * Note that we repeat this, since the search creates and stores
          * values that potentially change the controller behavior. i.e. things
          * like totalCount etc
          */
         $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_Contact_Selector_Controller($selector, $this->get(CRM_Utils_Pager::PAGE_ID), $sortID, CRM_Core_Action::VIEW, $this, CRM_Core_Selector_Controller::TRANSFER);
         $controller->setEmbedded(TRUE);
         $controller->setDynamicAction($setDynamic);
     }
     $controller->moveFromSessionToTemplate();
 }
Exemplo n.º 5
0
 /**
  * processing needed for buildForm and later
  *
  * @return void
  * @access public
  */
 function preProcess()
 {
     /**
      * set the varios class variables
      */
     $this->_group =& CRM_Core_PseudoConstant::group();
     $this->_groupIterator =& CRM_Core_PseudoConstant::groupIterator();
     $this->_tag =& CRM_Core_PseudoConstant::tag();
     $this->_done = false;
     /**
      * set the button names
      */
     $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->_reset = CRM_Utils_Request::retrieve('reset', 'Boolean', CRM_Core_DAO::$_nullObject);
     $this->_force = CRM_Utils_Request::retrieve('force', 'Boolean', CRM_Core_DAO::$_nullObject);
     $this->_groupID = CRM_Utils_Request::retrieve('gid', 'Positive', $this);
     $this->_amtgID = CRM_Utils_Request::retrieve('amtgID', 'Positive', $this);
     $this->_ssID = CRM_Utils_Request::retrieve('ssID', 'Positive', $this);
     $this->_sortByCharacter = CRM_Utils_Request::retrieve('sortByCharacter', 'String', $this);
     $this->_ufGroupID = CRM_Utils_Request::retrieve('id', 'Positive', $this);
     // reset from session, CRM-3526
     $session =& CRM_Core_Session::singleton();
     if ($this->_force && $session->get('selectedSearchContactIds')) {
         $session->resetScope('selectedSearchContactIds');
     }
     // if we dont get this from the url, use default if one exsts
     $config =& CRM_Core_Config::singleton();
     if ($this->_ufGroupID == null && $config->defaultSearchProfileID != null) {
         $this->_ufGroupID = $config->defaultSearchProfileID;
     }
     /*
      * assign context to drive the template display, make sure context is valid
      */
     $this->_context = CRM_Utils_Request::retrieve('context', 'String', $this, false, 'search');
     if (!CRM_Utils_Array::value($this->_context, self::validContext())) {
         $this->_context = 'search';
         $this->set('context', $this->_context);
     }
     $this->assign('context', $this->_context);
     $this->set('selectorName', $this->_selectorName);
     // get user submitted values
     // get it from controller only if form has been submitted, else preProcess has set this
     // $this->controller->isModal( ) returns true if page is
     // valid, i.e all the validations are true
     if (!empty($_POST) && !$this->controller->isModal()) {
         $this->_formValues = $this->controller->exportValues($this->_name);
         $this->normalizeFormValues();
         $this->_params =& CRM_Contact_BAO_Query::convertFormValues($this->_formValues);
         $this->_returnProperties =& $this->returnProperties();
         // also get the uf group id directly from the post value
         $this->_ufGroupID = CRM_Utils_Array::value('uf_group_id', $_POST, $this->_ufGroupID);
         $this->_formValues['uf_group_id'] = $this->_ufGroupID;
         $this->set('id', $this->_ufGroupID);
     } else {
         $this->_formValues = $this->get('formValues');
         $this->_params =& CRM_Contact_BAO_Query::convertFormValues($this->_formValues);
         $this->_returnProperties =& $this->returnProperties();
     }
     if (empty($this->_formValues)) {
         //check if group is a smart group (fix for CRM-1255)
         if ($this->_groupID) {
             if ($ssId = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Group', $this->_groupID, 'saved_search_id')) {
                 $this->_ssID = $ssId;
             }
         }
         // fix for CRM-1907
         if (isset($this->_ssID) && $this->_context != 'smog') {
             // we only retrieve the saved search values if out current values are null
             $this->_formValues = CRM_Contact_BAO_SavedSearch::getFormValues($this->_ssID);
             //fix for CRM-1505
             if (CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_SavedSearch', $this->_ssID, 'mapping_id')) {
                 $this->_params =& CRM_Contact_BAO_SavedSearch::getSearchParams($this->_ssID);
             } else {
                 $this->_params =& CRM_Contact_BAO_Query::convertFormValues($this->_formValues);
             }
             $this->_returnProperties =& $this->returnProperties();
         } else {
             if (isset($this->_ufGroupID)) {
                 // also set the uf group id if not already present
                 $this->_formValues['uf_group_id'] = $this->_ufGroupID;
             }
         }
     }
     $this->assign('id', CRM_Utils_Array::value('uf_group_id', $this->_formValues));
     require_once 'CRM/Contact/BAO/Contact.php';
     $menuItems = CRM_Contact_BAO_Contact::contextMenu();
     $primaryActions = CRM_Utils_Array::value('primaryActions', $menuItems, array());
     $this->_contextMenu = CRM_Utils_Array::value('moreActions', $menuItems, array());
     $this->assign('contextMenu', $primaryActions + $this->_contextMenu);
     // CRM_Core_Error::debug( 'f', $this->_formValues );
     // CRM_Core_Error::debug( 'p', $this->_params );
     eval('$selector =& new ' . $this->_selectorName . '( $this->_customSearchClass,
              $this->_formValues,
              $this->_params,
              $this->_returnProperties,
              $this->_action,
              false, true,
              $this->_context );');
     $controller =& new CRM_Contact_Selector_Controller($selector, $this->get(CRM_Utils_Pager::PAGE_ID), $this->get(CRM_Utils_Sort::SORT_ID), CRM_Core_Action::VIEW, $this, CRM_Core_Selector_Controller::TRANSFER);
     $controller->setEmbedded(true);
     if ($this->_force) {
         $this->postProcess();
         /*
          * Note that we repeat this, since the search creates and stores
          * values that potentially change the controller behavior. i.e. things
          * like totalCount etc
          */
         $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_Contact_Selector_Controller($selector, $this->get(CRM_Utils_Pager::PAGE_ID), $sortID, CRM_Core_Action::VIEW, $this, CRM_Core_Selector_Controller::TRANSFER);
         $controller->setEmbedded(true);
     }
     $controller->moveFromSessionToTemplate();
 }