Esempio n. 1
0
 /**
  * Class constructor.
  *
  * @param object $controller
  * @param \const|int $action
  */
 public function __construct($controller, $action = CRM_Core_Action::NONE)
 {
     parent::__construct($controller, $action);
     $classType = str_replace('_Controller', '', get_class($controller));
     $this->_pages = array($classType . '_Form_DataSource' => NULL, $classType . '_Form_MapField' => NULL, $classType . '_Form_Preview' => NULL, $classType . '_Form_Summary' => NULL);
     $this->addSequentialPages($this->_pages, $action);
 }
Esempio n. 2
0
 /**
  * @param object $controller
  * @param const|int $action
  */
 public function __construct($controller, $action = CRM_Core_Action::NONE)
 {
     parent::__construct($controller, $action);
     $cart = CRM_Event_Cart_BAO_Cart::find_or_create_for_current_session();
     $cart->load_associations();
     if ($cart->is_empty()) {
         CRM_Core_Error::statusBounce(ts("You don't have any events in you cart. Please add some events."), CRM_Utils_System::url('civicrm/event'));
     }
     $pages = array();
     $is_monetary = FALSE;
     $is_conference = FALSE;
     foreach ($cart->events_in_carts as $event_in_cart) {
         if ($event_in_cart->event->is_monetary) {
             $is_monetary = TRUE;
         }
     }
     $pages["CRM_Event_Cart_Form_Checkout_ParticipantsAndPrices"] = NULL;
     foreach ($cart->events_in_carts as $event_in_cart) {
         if ($event_in_cart->is_parent_event()) {
             foreach ($event_in_cart->participants as $participant) {
                 $pages["CRM_Event_Cart_Form_Checkout_ConferenceEvents_{$event_in_cart->event_id}_{$participant->id}"] = array('className' => 'CRM_Event_Cart_Form_Checkout_ConferenceEvents', 'title' => "Select {$event_in_cart->event->title} Events For {$participant->email}");
             }
         }
     }
     $pages["CRM_Event_Cart_Form_Checkout_Payment"] = NULL;
     $pages["CRM_Event_Cart_Form_Checkout_ThankYou"] = NULL;
     $this->addSequentialPages($pages, $action);
 }
Esempio n. 3
0
 /**
  * Class constructor.
  *
  * @param object $controller
  * @param \const|int $action
  */
 public function __construct($controller, $action = CRM_Core_Action::NONE)
 {
     parent::__construct($controller, $action);
     $this->_pages = array();
     if ($action == CRM_Core_Action::ADVANCED) {
         $this->_pages['CRM_Contact_Form_Search_Advanced'] = NULL;
         list($task, $result) = $this->taskName($controller, 'Advanced');
     } elseif ($action == CRM_Core_Action::PROFILE) {
         $this->_pages['CRM_Contact_Form_Search_Builder'] = NULL;
         list($task, $result) = $this->taskName($controller, 'Builder');
     } elseif ($action == CRM_Core_Action::COPY) {
         $this->_pages['CRM_Contact_Form_Search_Custom'] = NULL;
         list($task, $result) = $this->taskName($controller, 'Custom');
     } else {
         $this->_pages['CRM_Contact_Form_Search_Basic'] = NULL;
         list($task, $result) = $this->taskName($controller, 'Basic');
     }
     $this->_task = $task;
     if (is_array($task)) {
         foreach ($task as $t) {
             $this->_pages[$t] = NULL;
         }
     } else {
         $this->_pages[$task] = NULL;
     }
     if ($result) {
         $this->_pages['CRM_Contact_Form_Task_Result'] = NULL;
     }
     $this->addSequentialPages($this->_pages, $action);
 }
Esempio n. 4
0
 /**
  * class constructor
  *
  * @param object  CRM_Auction_Controller
  * @param int     $action
  *
  * @return object CRM_Import_StateMachine
  */
 function __construct($controller, $action = CRM_Core_Action::NONE)
 {
     parent::__construct($controller, $action);
     $session =& CRM_Core_Session::singleton();
     $session->set('singleForm', false);
     $this->_pages = array('CRM_Auction_Form_ItemAccount' => null, 'CRM_Auction_Form_Item' => null);
     $this->addSequentialPages($this->_pages, $action);
 }
 /**
  * class constructor
  *
  * @param object  CRM_Contribute_Controller_ContributionPage
  * @param int     $action
  *
  * @return object CRM_Contribute_StateMachine_ContributionPage
  */
 function CRM_Contribute_StateMachine_ContributionPage($controller, $action = CRM_CORE_ACTION_NONE)
 {
     parent::CRM_Core_StateMachine($controller, $action);
     $session =& CRM_Core_Session::singleton();
     $session->set('singleForm', false);
     $this->_pages = array('CRM_Contribute_Form_ContributionPage_Settings', 'CRM_Contribute_Form_ContributionPage_Amount', 'CRM_Contribute_Form_ContributionPage_ThankYou', 'CRM_Contribute_Form_ContributionPage_Custom', 'CRM_Contribute_Form_ContributionPage_Premium');
     $this->addSequentialPages($this->_pages, $action);
 }
Esempio n. 6
0
 /**
  * Class constructor.
  *
  * @param object $controller
  * @param \const|int $action
  *
  * @internal param \CRM_Contact_Import_Controller $object
  * @return \CRM_PCP_StateMachine_PCP CRM_Contact_Import_StateMachine
  */
 public function __construct($controller, $action = CRM_Core_Action::NONE)
 {
     parent::__construct($controller, $action);
     $session = CRM_Core_Session::singleton();
     $session->set('singleForm', FALSE);
     $this->_pages = array('CRM_PCP_Form_PCPAccount' => NULL, 'CRM_PCP_Form_Campaign' => NULL);
     $this->addSequentialPages($this->_pages, $action);
 }
Esempio n. 7
0
 /**
  * class constructor
  *
  * @param object  CRM_Contribute_Controller_ContributionPage
  * @param int     $action
  *
  * @return object CRM_Contribute_StateMachine_ContributionPage
  */
 function __construct($controller, $action = CRM_Core_Action::NONE)
 {
     parent::__construct($controller, $action);
     $session = CRM_Core_Session::singleton();
     $session->set('singleForm', FALSE);
     $config = CRM_Core_Config::singleton();
     $this->_pages = array('CRM_Contribute_Form_ContributionPage_Settings' => NULL, 'CRM_Contribute_Form_ContributionPage_Amount' => NULL, 'CRM_Member_Form_MembershipBlock' => NULL, 'CRM_Contribute_Form_ContributionPage_ThankYou' => NULL, 'CRM_Friend_Form_Contribute' => NULL, 'CRM_PCP_Form_Contribute' => NULL, 'CRM_Contribute_Form_ContributionPage_Custom' => NULL, 'CRM_Contribute_Form_ContributionPage_Premium' => NULL, 'CRM_Contribute_Form_ContributionPage_Widget' => NULL);
     if (!in_array("CiviMember", $config->enableComponents)) {
         unset($this->_pages['CRM_Member_Form_MembershipBlock']);
     }
     $this->addSequentialPages($this->_pages, $action);
 }
Esempio n. 8
0
 /**
  * class constructor
  *
  * @param object  CRM_Mailing_Controller
  * @param int     $action
  *
  * @return object CRM_Mailing_StateMachine
  */
 function __construct($controller, $action = CRM_Core_Action::NONE)
 {
     parent::__construct($controller, $action);
     $this->_pages = array('CRM_Mailing_Form_Group' => null, 'CRM_Mailing_Form_Settings' => null, 'CRM_Mailing_Form_Upload' => null, 'CRM_Mailing_Form_Test' => null);
     require_once 'CRM/Mailing/Info.php';
     if (CRM_Mailing_Info::workflowEnabled()) {
         if (CRM_Core_Permission::check('schedule mailings')) {
             $this->_pages['CRM_Mailing_Form_Schedule'] = null;
         }
     } else {
         $this->_pages['CRM_Mailing_Form_Schedule'] = null;
     }
     $this->addSequentialPages($this->_pages, $action);
 }
 /**
  * Class constructor.
  *
  * @param object $controller
  * @param \const|int $action
  *
  * @internal param \CRM_Contact_Import_Controller $object
  * @return \CRM_PCP_StateMachine_PCP CRM_Contact_Import_StateMachine
  */
 public function __construct($controller, $action = CRM_Core_Action::NONE)
 {
     parent::__construct($controller, $action);
     $session = CRM_Core_Session::singleton();
     $session->set('singleForm', FALSE);
     $this->_pages = array('CRM_QuickDonate_Form_PCPAccount' => NULL, 'CRM_QuickDonate_Form_Campaign' => NULL);
     //MV: skip pcpAccount for logged in user
     $userID = $session->get('userID');
     $controller->set('jumpForm', FALSE);
     if ($userID) {
         unset($this->_pages['CRM_QuickDonate_Form_PCPAccount']);
         $controller->set('jumpForm', TRUE);
     }
     $this->addSequentialPages($this->_pages, $action);
 }
Esempio n. 10
0
 /**
  * class constructor
  *
  * @param object  CRM_Mailing_Controller
  * @param int     $action
  *
  * @return object CRM_Mailing_StateMachine
  */
 function __construct($controller, $action = CRM_Core_Action::NONE)
 {
     parent::__construct($controller, $action);
     $this->_pages = array('CRM_Mailing_Form_Group' => NULL, 'CRM_Mailing_Form_Settings' => NULL, 'CRM_Mailing_Form_Upload' => NULL, 'CRM_Mailing_Form_Test' => NULL);
     if (CRM_Mailing_Info::workflowEnabled()) {
         if (CRM_Core_Permission::check('schedule mailings')) {
             $this->_pages['CRM_Mailing_Form_Schedule'] = NULL;
         }
         if (CRM_Core_Permission::check('approve mailings')) {
             $this->_pages['CRM_Mailing_Form_Approve'] = NULL;
         }
     } else {
         $this->_pages['CRM_Mailing_Form_Schedule'] = NULL;
     }
     $this->addSequentialPages($this->_pages, $action);
 }
Esempio n. 11
0
 /**
  * class constructor
  */
 function __construct($controller, $action = CRM_Core_Action::NONE)
 {
     parent::__construct($controller, $action);
     $this->_pages = array();
     $this->_pages['CRM_Member_Form_Search'] = null;
     list($task, $result) = $this->taskName($controller, 'Search');
     $this->_task = $task;
     if (is_array($task)) {
         foreach ($task as $t) {
             $this->_pages[$t] = null;
         }
     } else {
         $this->_pages[$task] = null;
     }
     $this->addSequentialPages($this->_pages, $action);
 }
Esempio n. 12
0
 /**
  * class constructor
  */
 function CRM_Contribute_StateMachine_Search($controller, $action = CRM_CORE_ACTION_NONE)
 {
     parent::CRM_Core_StateMachine($controller, $action);
     $this->_pages = array();
     $this->_pages[] = 'CRM_Contribute_Form_Search';
     list($task, $result) = $this->taskName($controller, 'Search');
     $this->_task = $task;
     if (is_array($task)) {
         foreach ($task as $t) {
             $this->_pages[] = $t;
         }
     } else {
         $this->_pages[] = $task;
     }
     $this->addSequentialPages($this->_pages, $action);
 }
Esempio n. 13
0
 /**
  * class constructor
  *
  * @param object  CRM_Event_Controller
  * @param int     $action
  *
  * @return object CRM_Event_StateMachine
  */
 function __construct($controller, $action = CRM_Core_Action::NONE)
 {
     parent::__construct($controller, $action);
     $id = CRM_Utils_Request::retrieve('id', 'Positive', $controller, true);
     $is_monetary = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $id, 'is_monetary');
     $pages = array('CRM_Event_Form_Registration_Register' => null);
     //handle additional participant scenario, where we need to insert participant pages on runtime
     $additionalParticipant = null;
     // check that the controller has some data, hence we dont send the form name
     // which results in an invalid argument error
     $values = $controller->exportValues();
     //first check POST value then QF
     if (isset($_POST['additional_participants']) && CRM_Utils_Rule::positiveInteger($_POST['additional_participants'])) {
         // we need to use $_POST since the QF framework has not yet been called
         // and the additional participants page is the next one, so need to set this up
         // now
         $additionalParticipant = $_POST['additional_participants'];
     } else {
         if (isset($values['additional_participants']) && CRM_Utils_Rule::positiveInteger($values['additional_participants'])) {
             $additionalParticipant = $values['additional_participants'];
         }
     }
     if ($additionalParticipant) {
         $additionalParticipant = CRM_Utils_Type::escape($additionalParticipant, 'Integer');
         $controller->set('addParticipant', $additionalParticipant);
     }
     //to add instances of Additional Participant page, only if user has entered any additional participants
     if ($additionalParticipant) {
         require_once "CRM/Event/Form/Registration/AdditionalParticipant.php";
         $extraPages =& CRM_Event_Form_Registration_AdditionalParticipant::getPages($additionalParticipant);
         $pages = array_merge($pages, $extraPages);
     }
     $additionalPages = array('CRM_Event_Form_Registration_Confirm' => null, 'CRM_Event_Form_Registration_ThankYou' => null);
     $pages = array_merge($pages, $additionalPages);
     if (!$is_monetary) {
         unset($pages['CRM_Event_Form_Registration_Confirm']);
     }
     $this->addSequentialPages($pages, $action);
 }
Esempio n. 14
0
 /**
  * class constructor
  */
 function CRM_Contact_StateMachine_Search($controller, $action = CRM_CORE_ACTION_NONE)
 {
     parent::CRM_Core_StateMachine($controller, $action);
     $this->_pages = array();
     if ($action == CRM_CORE_ACTION_ADVANCED) {
         $this->_pages[] = 'CRM_Contact_Form_Search_Advanced';
         list($task, $result) = $this->taskName($controller, 'Advanced');
     } else {
         $this->_pages[] = 'CRM_Contact_Form_Search';
         list($task, $result) = $this->taskName($controller, 'Search');
     }
     $this->_task = $task;
     if (is_array($task)) {
         foreach ($task as $t) {
             $this->_pages[] = $t;
         }
     } else {
         $this->_pages[] = $task;
     }
     if ($result) {
         $this->_pages[] = 'CRM_Contact_Form_Task_Result';
     }
     $this->addSequentialPages($this->_pages, $action);
 }
Esempio n. 15
0
 /**
  * class constructor
  *
  * @param object  CRM_Import_Controller
  * @param int     $action
  *
  * @return object CRM_Import_StateMachine
  */
 function __construct(&$controller, $action = CRM_Core_Action::NONE)
 {
     parent::__construct($controller, $action);
     $this->_pages = array('CRM_Import_Form_DataSource' => null, 'CRM_Import_Form_MapField' => null, 'CRM_Import_Form_Preview' => null, 'CRM_Import_Form_Summary' => null);
     $this->addSequentialPages($this->_pages, $action);
 }
Esempio n. 16
0
 /**
  * class constructor
  *
  * @param object  CRM_CiviBooking_Controller_Booking
  * @param int     $action
  *
  * @return object CRM_CiviBooking_StateMachine
  */
 function __construct($controller, $action = CRM_Core_Action::NONE)
 {
     parent::__construct($controller, $action);
     $this->_pages = array('CRM_Booking_Form_SelectResource' => NULL, 'CRM_Booking_Form_AddSubResource' => NULL, 'CRM_Booking_Form_Booking_Info' => NULL);
     $this->addSequentialPages($this->_pages, $action);
 }
Esempio n. 17
0
 /**
  * class constructor
  */
 function CRM_Group_StateMachine($controller, $action = CRM_CORE_ACTION_NONE)
 {
     parent::CRM_Core_StateMachine($controller, $action);
     $this->_pages = array('CRM_Group_Form_Edit', 'CRM_Contact_Form_Search', 'CRM_Contact_Form_Task_AddToGroup', 'CRM_Contact_Form_Task_Result');
     $this->addSequentialPages($this->_pages, $action);
 }
Esempio n. 18
0
 /**
  * class constructor
  *
  * @param object  CRM_Upgrade_Controller_base
  * @param int     $action
  *
  * @return object CRM_Upgrade_StateMachine_Base
  */
 function __construct(&$controller, &$pages, $action = CRM_Core_Action::NONE)
 {
     parent::__construct($controller, $action);
     $this->_pages =& $pages;
     $this->addSequentialPages($this->_pages, $action);
 }
Esempio n. 19
0
 /**
  * class constructor
  *
  * @param object  CRM_Import_Controller
  * @param int     $action
  *
  * @return object CRM_Import_StateMachine
  */
 function CRM_Contribute_StateMachine_Contribution($controller, $action = CRM_CORE_ACTION_NONE)
 {
     parent::CRM_Core_StateMachine($controller, $action);
     $this->_pages = array('CRM_Contribute_Form_Contribution_Main', 'CRM_Contribute_Form_Contribution_Confirm', 'CRM_Contribute_Form_Contribution_ThankYou');
     $this->addSequentialPages($this->_pages, $action);
 }
Esempio n. 20
0
 /**
  * class constructor
  *
  * @param object  CRM_Mailing_Controller
  * @param int     $action
  *
  * @return object CRM_Mailing_StateMachine
  */
 function CRM_Mailing_StateMachine_Send($controller, $action = CRM_CORE_ACTION_NONE)
 {
     parent::CRM_Core_StateMachine($controller, $action);
     $this->_pages = array('CRM_Mailing_Form_Name', 'CRM_Mailing_Form_Group', 'CRM_Mailing_Form_Upload', 'CRM_Mailing_Form_Test', 'CRM_Mailing_Form_Schedule');
     $this->addSequentialPages($this->_pages, $action);
 }
Esempio n. 21
0
 /**
  * class constructor
  *
  * @param object  CRM_Mailing_Controller
  * @param int     $action
  *
  * @return object CRM_Mailing_StateMachine
  */
 function __construct($controller, $action = CRM_Core_Action::NONE)
 {
     parent::__construct($controller, $action);
     $this->_pages = array('CRM_Mailing_Form_Group' => null, 'CRM_Mailing_Form_Settings' => null, 'CRM_Mailing_Form_Upload' => null, 'CRM_Mailing_Form_Test' => null, 'CRM_Mailing_Form_Schedule' => null);
     $this->addSequentialPages($this->_pages, $action);
 }
Esempio n. 22
0
 /**
  * Class constructor.
  *
  * @param object $controller
  * @param \const|int $action
  */
 public function __construct($controller, $action = CRM_Core_Action::NONE)
 {
     parent::__construct($controller, $action);
     $this->_pages = array('CRM_Tournament_Team_Form_Edit' => NULL, 'CRM_Tournament_Player_Form_Task_AddToTeam' => NULL);
     $this->addSequentialPages($this->_pages, $action);
 }
 /**
  * class constructor
  *
  * @param object  CRM_Activity_Import_Controller
  * @param int     $action
  *
  * @return object CRM_Activity_Import_StateMachine
  */
 function __construct($controller, $action = CRM_Core_Action::NONE)
 {
     parent::__construct($controller, $action);
     $this->_pages = array('CRM_Activity_Import_Form_UploadFile' => NULL, 'CRM_Activity_Import_Form_MapField' => NULL, 'CRM_Activity_Import_Form_Preview' => NULL, 'CRM_Activity_Import_Form_Summary' => NULL);
     $this->addSequentialPages($this->_pages, $action);
 }
Esempio n. 24
0
 /**
  * class constructor
  */
 function __construct($controller, $action = CRM_Core_Action::NONE)
 {
     parent::__construct($controller, $action);
     $this->_pages = array('CRM_Group_Form_Edit' => null, 'CRM_Contact_Form_Search_Basic' => null, 'CRM_Contact_Form_Task_AddToGroup' => null, 'CRM_Contact_Form_Task_Result' => null);
     $this->addSequentialPages($this->_pages, $action);
 }
Esempio n. 25
0
 /**
  * Add pages to the controller. Note that the controller does not really care
  * the order in which the pages are added
  *
  * @param CRM_Core_StateMachine $stateMachine
  * @param \const|int $action the mode in which the state machine is operating
  *                              typically this will be add/view/edit
  */
 public function addPages(&$stateMachine, $action = CRM_Core_Action::NONE)
 {
     $pages = $stateMachine->getPages();
     foreach ($pages as $name => $value) {
         $className = CRM_Utils_Array::value('className', $value, $name);
         $title = CRM_Utils_Array::value('title', $value);
         $options = CRM_Utils_Array::value('options', $value);
         $stateName = CRM_Utils_String::getClassName($className);
         if (!empty($value['className'])) {
             $formName = $name;
         } else {
             $formName = CRM_Utils_String::getClassName($name);
         }
         $ext = CRM_Extension_System::singleton()->getMapper();
         if ($ext->isExtensionClass($className)) {
             require_once $ext->classToPath($className);
         } else {
             require_once str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php';
         }
         ${$stateName} = new $className($stateMachine->find($className), $action, 'post', $formName);
         if ($title) {
             ${$stateName}->setTitle($title);
         }
         if ($options) {
             ${$stateName}->setOptions($options);
         }
         if (property_exists(${$stateName}, 'urlPath') && isset($_GET[CRM_Core_Config::singleton()->userFrameworkURLVar])) {
             ${$stateName}->urlPath = explode('/', $_GET[CRM_Core_Config::singleton()->userFrameworkURLVar]);
         }
         $this->addPage(${$stateName});
         $this->addAction($stateName, new HTML_QuickForm_Action_Direct());
         //CRM-6342 -we need kill the reference here,
         //as we have deprecated reference object creation.
         unset(${$stateName});
     }
 }
Esempio n. 26
0
 /**
  * class constructor
  *
  * @param object $controller
  * @param \const|int $action
  *
  * @internal param \CRM_SMS_Controller $object
  * @return \CRM_SMS_StateMachine_Send CRM_SMS_StateMachine
  */
 function __construct($controller, $action = CRM_Core_Action::NONE)
 {
     parent::__construct($controller, $action);
     $this->_pages = array('CRM_SMS_Form_Group' => NULL, 'CRM_SMS_Form_Upload' => NULL, 'CRM_SMS_Form_Schedule' => NULL);
     $this->addSequentialPages($this->_pages, $action);
 }
Esempio n. 27
0
 /**
  * Class constructor.
  *
  * @param CRM_Core_Controller $controller
  * @param \const|int $action
  *
  * @return CRM_Contribute_StateMachine_Contribution
  */
 public function __construct($controller, $action = CRM_Core_Action::NONE)
 {
     parent::__construct($controller, $action);
     $this->_pages = array('CRM_Contribute_Form_Contribution_Main' => NULL, 'CRM_Contribute_Form_Contribution_Confirm' => NULL, 'CRM_Contribute_Form_Contribution_ThankYou' => NULL);
     $this->addSequentialPages($this->_pages, $action);
 }
 /**
  * class constructor
  *
  * @param object $controller
  * @param \const|int $action
  *
  * @internal param \CRM_Contact_Import_Controller $object
  * @return \CRM_PCP_StateMachine_PCP CRM_Contact_Import_StateMachine
  */
 function __construct($controller, $action = CRM_Core_Action::NONE)
 {
     parent::__construct($controller, $action);
     $session = CRM_Core_Session::singleton();
     $session->set('singleForm', FALSE);
     $pages = array('cpfeq' => 'CRM_Pcpteams_Form_EventQuery', 'cpfer' => 'CRM_Pcpteams_Form_EventReact', 'cpfec' => 'CRM_Pcpteams_Form_EventConfirm', 'cpfere' => 'CRM_Pcpteams_Form_EventRegister', 'cpftq' => 'CRM_Pcpteams_Form_TeamQuery', 'cpftn' => 'CRM_Pcpteams_Form_TeamReact', 'cpftc' => 'CRM_Pcpteams_Form_TeamConfirm', 'cpftt' => 'CRM_Pcpteams_Form_TeamThankYou', 'cpfgq' => 'CRM_Pcpteams_Form_GroupQuery', 'cpfgj' => 'CRM_Pcpteams_Form_GroupJoin', 'cpftrq' => 'CRM_Pcpteams_Form_TributeQuery', 'cpftrj' => 'CRM_Pcpteams_Form_TributeJoin');
     $step = CRM_Utils_Request::retrieve('code', 'String', $controller);
     $pcpId = CRM_Utils_Request::retrieve('id', 'Positive', $controller);
     $pageId = CRM_Utils_Request::retrieve('pageId', 'Positive', $controller);
     $component = CRM_Utils_Request::retrieve('component', 'String', $controller);
     $teamPcpId = CRM_Utils_Request::retrieve('tpId', 'Positive', $controller);
     $workflowTeam = $controller->get('workflowTeam');
     // DS: for now we skipping branch and tribute screens. We might enable them back later.
     $controller->set('workflowGroup', 'skip');
     // remove me later
     $controller->set('workflowTribute', 'skip');
     // remove me later
     $workflowGroup = $controller->get('workflowGroup');
     $workflowTribute = $controller->get('workflowTribute');
     // check if contact is already registered
     // get pcp id
     if ('event' == $controller->get('component') && $pageId) {
         $eventId = $pageId;
         if (is_null($controller->get('participantId'))) {
             $participantId = CRM_Pcpteams_Utils::isaParticipantFor($eventId);
             // store in session so we not checking everytime
             $controller->set('participantId', $participantId);
         }
         if (!$pcpId) {
             $pcpId = CRM_Pcpteams_Utils::getPcpId($pageId, $component, TRUE);
             $controller->set('id', $pcpId);
             // in PCPAccount.php this gets retrieved & set as page_id
             $controller->set('page_id', $pcpId);
             // set it anyway
         }
     }
     // if team pages need skipping
     // FIXME: we 'll need to keep pcp info laoded ad stored in static cache?
     // so we not making this check everytime
     if ($controller->get('page_id') && (empty($workflowTeam) || empty($workflowGroup) || empty($workflowTribute) || $teamPcpId)) {
         $result = civicrm_api('Pcpteams', 'get', array('version' => 3, 'sequential' => 1, 'pcp_id' => $controller->get('page_id')));
         if (empty($workflowTeam) || $teamPcpId) {
             // $cfid = CRM_Pcpteams_Utils::getTeamPcpCustomFieldId();
             if (!empty($result['values'][0]["team_pcp_id"])) {
                 $controller->set('workflowTeam', 'skip');
             }
         }
         if (empty($workflowGroup)) {
             // $cfid = CRM_Pcpteams_Utils::getBranchorPartnerCustomFieldId();
             if (!empty($result['values'][0]["org_id"])) {
                 $controller->set('workflowGroup', 'skip');
             }
         }
         if (empty($workflowTribute)) {
             // $cfid = CRM_Pcpteams_Utils::getPcpTypeContactCustomFieldId();
             if (!empty($result['values'][0]["tribute_contact_id"])) {
                 $controller->set('workflowTribute', 'skip');
             }
         }
     }
     // if need jumping to invite page
     if (!$workflowTeam) {
         if (empty($teamPcpId)) {
             $teamPcpId = CRM_Core_Session::singleton()->get('pcpteams_tpid');
         }
         if ($teamPcpId) {
             $controller->set('tpId', $teamPcpId);
             $controller->set('workflowTeam', 'invite');
         }
     }
     // unset pages per workflow
     if (in_array($controller->get('workflowTeam'), array('invite', 2))) {
         // team invite or join
         unset($pages['cpftc'], $pages['cpftt']);
     }
     if ('skip' == $controller->get('workflowTeam')) {
         // unset all team pages
         unset($pages['cpftq'], $pages['cpftn'], $pages['cpftc'], $pages['cpftt']);
     }
     if ('skip' == $controller->get('workflowGroup')) {
         // unset all group pages
         unset($pages['cpfgq'], $pages['cpfgj']);
     }
     if ('skip' == $controller->get('workflowTribute')) {
         // unset all group pages
         unset($pages['cpftrq'], $pages['cpftrj']);
     }
     // if no event or already registered, skip event pages
     if (!$eventId || $controller->get('participantId')) {
         unset($pages['cpfec'], $pages['cpfere']);
     }
     if ('cpfeq' != $step) {
         unset($pages['cpfeq'], $pages['cpfer']);
     }
     if (!$step) {
         // if no code, set it true, so we consider all pages
         $stepFound = true;
     } else {
         // otherwise set it to false, we consider all pages starting from the code
         $stepFound = false;
         // DS: we now using drupal's account page
         //if (!$session->get('userID')) {
         // if user not logged in, inject the account page anyway
         //$this->_pages[$pages['cpfpa']] = NULL;
         //}
     }
     foreach ($pages as $pCode => $page) {
         if ($pCode == $step) {
             $stepFound = true;
         }
         if ($stepFound) {
             $this->_pages[$page] = NULL;
         }
     }
     if (empty($this->_pages)) {
         CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/pcp/manage', 'id=' . $controller->get('page_id')));
     }
     $this->addSequentialPages($this->_pages, $action);
 }
Esempio n. 29
0
 /**
  * class constructor
  *
  * @param object  CRM_History_Import_Controller
  * @param int     $action
  *
  * @return object CRM_History_Import_StateMachine
  */
 function CRM_History_Import_StateMachine($controller, $action = CRM_CORE_ACTION_NONE)
 {
     parent::CRM_Core_StateMachine($controller, $action);
     $this->_pages = array('CRM_History_Import_Form_UploadFile', 'CRM_History_Import_Form_MapField', 'CRM_History_Import_Form_Preview', 'CRM_History_Import_Form_Summary');
     $this->addSequentialPages($this->_pages, $action);
 }