Пример #1
0
 /**
  * called when action is update.
  *
  * @param int $groupId
  *
  * @return null
  */
 public function edit($groupId = NULL)
 {
     $this->assign('edit', $this->_edit);
     if (!$this->_edit) {
         return NULL;
     }
     $action = CRM_Utils_Request::retrieve('action', 'String', CRM_Core_DAO::$_nullObject, FALSE, 'browse');
     if ($action == CRM_Core_Action::DELETE) {
         $groupContactId = CRM_Utils_Request::retrieve('gcid', 'Positive', CRM_Core_DAO::$_nullObject, TRUE);
         $status = CRM_Utils_Request::retrieve('st', 'String', CRM_Core_DAO::$_nullObject, TRUE);
         if (is_numeric($groupContactId) && $status) {
             CRM_Contact_Page_View_GroupContact::del($groupContactId, $status, $this->_contactId);
         }
         $url = CRM_Utils_System::url('civicrm/user', "reset=1&id={$this->_contactId}");
         CRM_Utils_System::redirect($url);
     }
     $controller = new CRM_Core_Controller_Simple('CRM_Contact_Form_GroupContact', ts("Contact's Groups"), CRM_Core_Action::ADD, FALSE, FALSE, TRUE, FALSE);
     $controller->setEmbedded(TRUE);
     $session = CRM_Core_Session::singleton();
     $session->pushUserContext(CRM_Utils_System::url('civicrm/user', "reset=1&id={$this->_contactId}"), FALSE);
     $controller->reset();
     $controller->set('contactId', $this->_contactId);
     $controller->set('groupId', $groupId);
     $controller->set('context', 'user');
     $controller->set('onlyPublicGroups', $this->_onlyPublicGroups);
     $controller->process();
     $controller->run();
 }
Пример #2
0
 /**
  * Run the page.
  *
  * This method is called after the page is created.
  *
  * @return void
  * @access public
  *
  */
 function run()
 {
     $controller = new CRM_Core_Controller_Simple('CRM_Contact_Form_Task_Useradd', ts('Add User'), CRM_Core_Action::ADD);
     $controller->setEmbedded(TRUE);
     $controller->process();
     $controller->run();
     return parent::run();
 }
 function run()
 {
     // get the requested action
     $action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'browse');
     // assign vars to templates
     $this->assign('action', $action);
     $id = CRM_Utils_Request::retrieve('id', 'Positive', $this, FALSE, 0);
     if ($action & CRM_Core_Action::UPDATE) {
         $controller = new CRM_Core_Controller_Simple('CRM_Wci_Form_ProgressBar', 'Edit Progressbar', CRM_Core_Action::UPDATE);
         $controller->set('id', $id);
         $controller->process();
         return $controller->run();
     } elseif ($action & CRM_Core_Action::COPY) {
         try {
             $sql = "INSERT INTO civicrm_wci_progress_bar (name, starting_amount, goal_amount)\n        SELECT concat(name, '-', (SELECT MAX(id) FROM civicrm_wci_progress_bar)),\n        starting_amount, goal_amount FROM civicrm_wci_progress_bar\n        WHERE id=%1";
             CRM_Core_DAO::executeQuery($sql, array(1 => array($id, 'Integer')));
             $new_pb_id = CRM_Core_DAO::singleValueQuery('SELECT LAST_INSERT_ID()');
             $sql = "INSERT INTO civicrm_wci_progress_bar_formula\n            (contribution_page_id, financial_type_id, progress_bar_id, start_date, end_date, percentage)\n            SELECT contribution_page_id, financial_type_id, %1, start_date,\n            end_date, percentage FROM civicrm_wci_progress_bar_formula WHERE progress_bar_id=%2";
             CRM_Core_DAO::executeQuery($sql, array(1 => array($new_pb_id, 'Integer'), 2 => array($id, 'Integer')));
         } catch (Exception $e) {
             CRM_Core_Session::setStatus(ts('Failed to create Progress bar. ') . $e->getMessage(), '', 'error');
             $transaction->rollback();
         }
     } elseif ($action & CRM_Core_Action::DELETE) {
         $errorScope = CRM_Core_TemporaryErrorScope::useException();
         try {
             $transaction = new CRM_Core_Transaction();
             $sql = "DELETE FROM civicrm_wci_progress_bar_formula where progress_bar_id = %1";
             $params = array(1 => array($id, 'Integer'));
             CRM_Core_DAO::executeQuery($sql, $params);
             $sql = "DELETE FROM civicrm_wci_progress_bar where id = %1";
             $params = array(1 => array($id, 'Integer'));
             CRM_Core_DAO::executeQuery($sql, $params);
             $transaction->commit();
         } catch (Exception $e) {
             $errmgs = $e->getMessage() . ts('. Check whether progressbar is used by any widget or not');
             CRM_Core_Session::setStatus($errmgs, '', 'error');
             $transaction->rollback();
         }
     }
     // Example: Set the page-title dynamically; alternatively, declare a static title in xml/Menu/*.xml
     CRM_Utils_System::setTitle(ts('Progress Bar List'));
     $query = "SELECT * FROM civicrm_wci_progress_bar";
     $params = array();
     $dao = CRM_Core_DAO::executeQuery($query, $params, TRUE, 'CRM_Wci_DAO_ProgressBar');
     while ($dao->fetch()) {
         $con_page[$dao->id] = array();
         CRM_Core_DAO::storeValues($dao, $con_page[$dao->id]);
         $action = array_sum(array_keys($this->actionLinks()));
         //build the normal action links.
         $con_page[$dao->id]['action'] = CRM_Core_Action::formLink(self::actionLinks(), $action, array('id' => $dao->id));
     }
     if (isset($con_page)) {
         $this->assign('rows', $con_page);
     }
     return parent::run();
 }
 /**
  * Function to list participations for the UF user
  *
  * return null
  * @access public
  */
 function listParticipations()
 {
     $controller = new CRM_Core_Controller_Simple('CRM_Event_Form_Search', ts('Events'), NULL);
     $controller->setEmbedded(TRUE);
     $controller->reset();
     $controller->set('context', 'user');
     $controller->set('cid', $this->_contactId);
     $controller->set('force', 1);
     $controller->process();
     $controller->run();
 }
Пример #5
0
 function run()
 {
     // get the requested action
     $action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'browse');
     // assign vars to templates
     $this->assign('action', $action);
     $id = CRM_Utils_Request::retrieve('id', 'Positive', $this, FALSE, 0);
     if ($action & CRM_Core_Action::UPDATE) {
         $controller = new CRM_Core_Controller_Simple('CRM_Wci_Form_CreateWidget', 'Edit Widget', CRM_Core_Action::UPDATE);
         $controller->set('id', $id);
         $controller->process();
         return $controller->run();
     } elseif ($action & CRM_Core_Action::COPY) {
         try {
             $sql = "INSERT INTO civicrm_wci_widget (title, logo_image, image,\n        button_title, button_link_to, progress_bar_id, description,\n        email_signup_group_id, size_variant, color_title, color_title_bg,\n        color_progress_bar, color_progress_bar_bg, color_widget_bg, color_description, color_border,\n        color_button, color_button_bg, hide_title, hide_border, hide_pbcap,\n        color_btn_newsletter, color_btn_newsletter_bg, newsletter_text,\n        color_newsletter_text, style_rules, override, custom_template, show_pb_perc)\n        SELECT concat(title, '-', (SELECT MAX(id) FROM civicrm_wci_widget)), logo_image, image,\n        button_title, button_link_to, progress_bar_id, description,\n        email_signup_group_id, size_variant, color_title, color_title_bg,\n        color_progress_bar, color_progress_bar_bg, color_widget_bg, color_description, color_border,\n        color_button, color_button_bg, hide_title, hide_border, hide_pbcap,\n        color_btn_newsletter, color_btn_newsletter_bg, newsletter_text,\n        color_newsletter_text, style_rules, override, custom_template, show_pb_perc FROM civicrm_wci_widget WHERE id=%1";
             CRM_Core_DAO::executeQuery("SET foreign_key_checks = 0;");
             CRM_Core_DAO::executeQuery($sql, array(1 => array($id, 'Integer')));
             CRM_Core_DAO::executeQuery("SET foreign_key_checks = 1;");
         } catch (Exception $e) {
             CRM_Core_Session::setStatus(ts('Failed to create widget. ') . $e->getMessage(), '', 'error');
             $transaction->rollback();
         }
     } elseif ($action & CRM_Core_Action::DELETE) {
         try {
             $transaction = new CRM_Core_Transaction();
             $sql = "DELETE FROM civicrm_wci_widget where id = %1";
             $params = array(1 => array($id, 'Integer'));
             CRM_Core_DAO::executeQuery($sql, $params);
             $transaction->commit();
         } catch (Exception $e) {
             CRM_Core_Session::setStatus(ts('Failed to delete widget. ') . $e->getMessage(), '', 'error');
             $transaction->rollback();
         }
     }
     CRM_Utils_System::setTitle(ts('Widget List'));
     $query = "SELECT * FROM civicrm_wci_widget";
     $params = array();
     $dao = CRM_Core_DAO::executeQuery($query, $params, TRUE, 'CRM_Wci_DAO_Widget');
     while ($dao->fetch()) {
         $wid_page[$dao->id] = array();
         CRM_Core_DAO::storeValues($dao, $wid_page[$dao->id]);
         $wid_page[$dao->id]['title'] = $wid_page[$dao->id]['title'];
         $description = $wid_page[$dao->id]['description'];
         $wid_page[$dao->id]['description'] = strip_tags($description);
         $action = array_sum(array_keys($this->actionLinks()));
         //build the normal action links.
         $wid_page[$dao->id]['action'] = CRM_Core_Action::formLink(self::actionLinks(), $action, array('id' => $dao->id));
     }
     if (isset($wid_page)) {
         $this->assign('rows', $wid_page);
     }
     parent::run();
 }
Пример #6
0
 /**
  * This function is called when action is browse
  *
  * return null
  * @access public
  */
 function browse()
 {
     $controller = new CRM_Core_Controller_Simple('CRM_Tag_Form_Tag', ts('Contact Tags'), $this->_action);
     $controller->setEmbedded(TRUE);
     // set the userContext stack
     $session = CRM_Core_Session::singleton();
     $session->pushUserContext(CRM_Utils_System::url('civicrm/contact/view', 'action=browse&selectedChild=tag'), FALSE);
     $controller->reset();
     $controller->set('contactId', $this->_contactId);
     $controller->process();
     $controller->run();
 }
Пример #7
0
 /**
  * This function is the main function that is called when the page loads,
  * it decides the which action has to be taken for the page.
  *
  * return null
  * @access public
  */
 function run()
 {
     $this->preProcess();
     $controller = new CRM_Core_Controller_Simple('CRM_Grant_Form_Search', ts('grants'), NULL);
     $controller->setEmbedded(TRUE);
     $controller->reset();
     $controller->set('limit', 10);
     $controller->set('force', 1);
     $controller->set('context', 'dashboard');
     $controller->process();
     $controller->run();
     return parent::run();
 }
Пример #8
0
 /**
  * This function is called when action is update
  *
  * @param int    $groupID group id
  *
  * return null
  * @access public
  */
 function edit($groupId = NULL)
 {
     $controller = new CRM_Core_Controller_Simple('CRM_Contact_Form_GroupContact', ts('Contact\'s Groups'), $this->_action);
     $controller->setEmbedded(TRUE);
     // set the userContext stack
     $session = CRM_Core_Session::singleton();
     $session->pushUserContext(CRM_Utils_System::url('civicrm/contact/view', "action=browse&selectedChild=group&cid={$this->_contactId}"), FALSE);
     $controller->reset();
     $controller->set('contactId', $this->_contactId);
     $controller->set('groupId', $groupId);
     $controller->process();
     $controller->run();
 }
Пример #9
0
 /**
  * This function is called when action is update or new
  *
  * return null
  * @access public
  */
 function edit()
 {
     $controller = new CRM_Core_Controller_Simple('CRM_Contact_Form_APIKey', ts('API Key'), $this->_action);
     $controller->setEmbedded(TRUE);
     // set the userContext stack
     $session = CRM_Core_Session::singleton();
     $url = CRM_Utils_System::url('civicrm/contact/view/apikey', 'action=browse&selectedChild=apikey&cid=' . $this->_contactId);
     $session->pushUserContext($url);
     $controller->reset();
     $controller->set('contactId', $this->_contactId);
     $controller->process();
     $controller->run();
 }
Пример #10
0
 /**
  * This function is called when action is browse
  *
  * return null
  * @access public
  */
 function browse()
 {
     $controller = new CRM_Core_Controller_Simple('CRM_Pledge_Form_Search', ts('Pledges'), $this->_action);
     $controller->setEmbedded(TRUE);
     $controller->reset();
     $controller->set('cid', $this->_contactId);
     $controller->set('context', 'pledge');
     $controller->process();
     $controller->run();
     if ($this->_contactId) {
         $displayName = CRM_Contact_BAO_Contact::displayName($this->_contactId);
         $this->assign('displayName', $displayName);
     }
 }
Пример #11
0
 /**
  * Function to list participations for the UF user
  *
  * return null
  * @access public
  */
 function listActivities()
 {
     $controller = new CRM_Core_Controller_Simple('CRM_Activity_Form_Search', ts('Activities'), NULL, FALSE, FALSE, TRUE, FALSE);
     $controller->setEmbedded(TRUE);
     $controller->reset();
     $controller->set('context', 'user');
     $controller->set('cid', $this->_contactId);
     $controller->set('status', array(1 => 'on', 7 => 'on'));
     $controller->set('activity_role', 2);
     $controller->set('force', 1);
     $controller->process();
     $controller->run();
     return;
 }
Пример #12
0
 /**
  * This function is called when action is browse
  * 
  * return null
  * @access public
  */
 function browse()
 {
     require_once 'CRM/Contribute/BAO/Contribution.php';
     // add annual contribution
     $annual = array();
     list($annual['count'], $annual['amount'], $annual['avg']) = CRM_Contribute_BAO_Contribution::annual($this->_contactId);
     $this->assign('annual', $annual);
     $controller = new CRM_Core_Controller_Simple('CRM_Contribute_Form_Search', ts('Contributions'), $this->_action);
     $controller->setEmbedded(true);
     $controller->reset();
     $controller->set('cid', $this->_contactId);
     $controller->set('id', $this->_id);
     $controller->set('context', 'contribution');
     $controller->process();
     $controller->run();
     //add honor block
     // form all action links
     $action = array_sum(array_keys($this->honorLinks()));
     $params = array();
     $params = CRM_Contribute_BAO_Contribution::getHonorContacts($this->_contactId);
     if (!empty($params)) {
         foreach ($params as $ids => $honorId) {
             $params[$ids]['action'] = CRM_Core_Action::formLink(self::honorLinks(), $action, array('cid' => $honorId['honorId'], 'id' => $ids, 'cxt' => 'contribution', 'contributionType' => $honorId['type_id'], 'honorId' => $this->_contactId));
         }
         // assign vars to templates
         $this->assign('action', $this->_action);
         $this->assign('honorRows', $params);
         $this->assign('honor', true);
     }
     //enable/disable soft credit records for test contribution
     $isTest = 0;
     if (CRM_Utils_Request::retrieve('isTest', 'Positive', $this)) {
         $isTest = 1;
     }
     $this->assign('isTest', $isTest);
     $softCreditList = CRM_Contribute_BAO_Contribution::getSoftContributionList($this->_contactId, $isTest);
     if (!empty($softCreditList)) {
         $softCreditTotals = array();
         list($softCreditTotals['amount'], $softCreditTotals['avg'], $softCreditTotals['currency']) = CRM_Contribute_BAO_Contribution::getSoftContributionTotals($this->_contactId, $isTest);
         $this->assign('softCredit', true);
         $this->assign('softCreditRows', $softCreditList);
         $this->assign('softCreditTotals', $softCreditTotals);
     }
     if ($this->_contactId) {
         require_once 'CRM/Contact/BAO/Contact.php';
         $displayName = CRM_Contact_BAO_Contact::displayName($this->_contactId);
         $this->assign('displayName', $displayName);
     }
 }
Пример #13
0
 /**
  * This function is called when action is browse
  *
  * return null
  * @access public
  */
 function browse()
 {
     $controller = new CRM_Core_Controller_Simple('CRM_Grant_Form_Search', ts('Grants'), $this->_action);
     $controller->setEmbedded(TRUE);
     $controller->reset();
     $controller->set('cid', $this->_contactId);
     $controller->set('context', 'grant');
     $controller->process();
     $controller->run();
     if ($this->_contactId) {
         $displayName = CRM_Contact_BAO_Contact::displayName($this->_contactId);
         $this->assign('displayName', $displayName);
         $this->ajaxResponse['tabCount'] = CRM_Contact_BAO_Contact::getCountComponent('grant', $this->_contactId);
     }
 }
Пример #14
0
 /**
  * @return mixed
  */
 public function interview()
 {
     //build interview and release voter interface.
     $controller = new CRM_Core_Controller_Simple('CRM_Campaign_Form_Task_Interview', ts('Interview Respondents'));
     $controller->set('votingTab', TRUE);
     $controller->set('subVotingTab', 'searchANDInterview');
     if ($this->_surveyId) {
         $controller->set('surveyId', $this->_surveyId);
     }
     if ($this->_interviewerId) {
         $controller->set('interviewerId', $this->_interviewerId);
     }
     $controller->process();
     return $controller->run();
 }
Пример #15
0
 /**
  * List participations for the UF user.
  *
  * @return bool
  */
 public function listActivities()
 {
     $controller = new CRM_Core_Controller_Simple('CRM_Activity_Form_Search', ts('Activities'), NULL, FALSE, FALSE, TRUE, FALSE);
     $controller->setEmbedded(TRUE);
     $controller->reset();
     $controller->set('context', 'user');
     $controller->set('cid', $this->_contactId);
     // Limit to status "Scheduled" and "Available"
     $controller->set('status', array('IN' => array(1, 7)));
     $controller->set('activity_role', 2);
     $controller->set('force', 1);
     $controller->process();
     $controller->run();
     return FALSE;
 }
Пример #16
0
 /**
  * This function is called when action is browse
  *
  * return null
  * @access public
  */
 function browse()
 {
     $controller = new CRM_Core_Controller_Simple('CRM_Grant_Form_Search', ts('Grants'), $this->_action);
     $controller->setEmbedded(true);
     $controller->reset();
     $controller->set('cid', $this->_contactId);
     $controller->set('context', 'grant');
     $controller->process();
     $controller->run();
     if ($this->_contactId) {
         require_once 'CRM/Contact/BAO/Contact.php';
         $displayName = CRM_Contact_BAO_Contact::displayName($this->_contactId);
         $this->assign('displayName', $displayName);
     }
 }
Пример #17
0
 /**
  * This function is called when action is browse
  *
  * return null
  * @access public
  */
 function browse()
 {
     $controller = new CRM_Core_Controller_Simple('CRM_Booking_Form_Search', ts('Booking'), $this->_action);
     $controller->setEmbedded(TRUE);
     $controller->reset();
     $controller->set('cid', $this->_contactId);
     $controller->set('context', 'booking');
     $controller->process();
     $controller->run();
     if ($this->_contactId) {
         $displayName = CRM_Contact_BAO_Contact::displayName($this->_contactId);
         $this->assign('displayName', $displayName);
     }
     $bookings = CRM_Booking_BAO_Booking::getContactAssociatedBooking($this->_contactId);
     $this->assign('associatedBooking', $bookings);
 }
Пример #18
0
 /**
  * Run the page.
  *
  * This method is called after the page is created. It checks for the
  * type of action and executes that action.
  * Finally it calls the parent's run method.
  *
  * @return void
  * @access public
  *
  */
 function run()
 {
     //if javascript is enabled
     if (CRM_Utils_Request::retrieve('confirmed', 'Boolean', $this, '', '', 'GET')) {
         CRM_Core_BAO_CMSUser::synchronize();
         return;
     }
     $controller = new CRM_Core_Controller_Simple('CRM_Admin_Form_CMSUser', 'Synchronize CMS Users');
     // set the userContext stack
     $session = CRM_Core_Session::singleton();
     $session->pushUserContext(CRM_Utils_System::url('civicrm/admin', 'reset=1'));
     $controller->setEmbedded(TRUE);
     $controller->process();
     $controller->run();
     return parent::run();
 }
Пример #19
0
 /**
  * called when action is browse.
  *
  * @return void
  */
 public function browse()
 {
     $controller = new CRM_Core_Controller_Simple('CRM_Pledge_Form_Search', ts('Pledges'), $this->_action);
     $controller->setEmbedded(TRUE);
     $controller->reset();
     $controller->set('cid', $this->_contactId);
     $controller->set('context', 'pledge');
     $controller->set('limit', '25');
     $controller->process();
     $controller->run();
     if ($this->_contactId) {
         $displayName = CRM_Contact_BAO_Contact::displayName($this->_contactId);
         $this->assign('displayName', $displayName);
         $this->ajaxResponse['tabCount'] = CRM_Contact_BAO_Contact::getCountComponent('pledge', $this->_contactId);
         // Refresh other tabs with related data
         $this->ajaxResponse['updateTabs'] = array('#tab_contribute' => CRM_Contact_BAO_Contact::getCountComponent('contribution', $this->_contactId), '#tab_activity' => CRM_Contact_BAO_Contact::getCountComponent('activity', $this->_contactId));
     }
 }
 function run()
 {
     // get the requested action
     $action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'browse');
     // assign vars to templates
     $this->assign('action', $action);
     $id = CRM_Utils_Request::retrieve('id', 'Positive', $this, FALSE, 0);
     if ($action & CRM_Core_Action::UPDATE) {
         $controller = new CRM_Core_Controller_Simple('CRM_Wci_Form_NewEmbedCode', 'Edit Embed Code', CRM_Core_Action::UPDATE);
         $controller->set('id', $id);
         $controller->process();
         return $controller->run();
     } elseif ($action & CRM_Core_Action::DELETE) {
         try {
             $transaction = new CRM_Core_Transaction();
             $sql = "DELETE FROM civicrm_wci_embed_code where id = %1";
             $params = array(1 => array($id, 'Integer'));
             CRM_Core_DAO::executeQuery($sql, $params);
             $transaction->commit();
         } catch (Exception $e) {
             CRM_Core_Session::setStatus(ts('Failed to delete embed code. ') . $e->getMessage(), '', 'error');
             $transaction->rollback();
         }
     }
     CRM_Utils_System::setTitle(ts('Embed Code List'));
     $query = "SELECT * FROM civicrm_wci_embed_code";
     $params = array();
     $dao = CRM_Core_DAO::executeQuery($query, $params, TRUE, 'CRM_Wci_DAO_EmbedCode');
     while ($dao->fetch()) {
         $emb_code[$dao->id] = array();
         CRM_Core_DAO::storeValues($dao, $emb_code[$dao->id]);
         $emb_code[$dao->id]['id'] = $emb_code[$dao->id]['id'];
         $emb_code[$dao->id]['name'] = $emb_code[$dao->id]['name'];
         $action = array_sum(array_keys($this->actionLinks()));
         //build the normal action links.
         $emb_code[$dao->id]['action'] = CRM_Core_Action::formLink(self::actionLinks(), $action, array('id' => $dao->id));
     }
     if (isset($emb_code)) {
         $this->assign('rows', $emb_code);
     }
     parent::run();
 }
Пример #21
0
 /**
  * called when action is browse.
  */
 public function listPledges()
 {
     $controller = new CRM_Core_Controller_Simple('CRM_Pledge_Form_Search', ts('Pledges'), NULL, FALSE, FALSE, TRUE, FALSE);
     $controller->setEmbedded(TRUE);
     $controller->reset();
     $controller->set('limit', 12);
     $controller->set('cid', $this->_contactId);
     $controller->set('context', 'user');
     $controller->set('force', 1);
     $controller->process();
     $controller->run();
     // add honor block.
     $honorParams = array();
     $honorParams = CRM_Pledge_BAO_Pledge::getHonorContacts($this->_contactId);
     if (!empty($honorParams)) {
         // assign vars to templates
         $this->assign('pledgeHonorRows', $honorParams);
         $this->assign('pledgeHonor', TRUE);
     }
     $session = CRM_Core_Session::singleton();
     $loggedUserID = $session->get('userID');
     $this->assign('loggedUserID', $loggedUserID);
 }
Пример #22
0
 function run($args = NULL)
 {
     if (CRM_Utils_Array::value(0, $args) !== 'civicrm' || CRM_Utils_Array::value(1, $args) !== 'volunteer') {
         CRM_Core_Error::fatal('Invalid page callback config.');
         return;
     }
     switch (CRM_Utils_Array::value(2, $args)) {
         /**
          * This routes civicrm/volunteer/join to CiviVolunteer's reserved profile for volunteer interest.
          */
         case 'join':
             // the profile expects the ID (and some other parameters) to be passed via URL; since we are providing
             // a nice clean URL, these parameters won't be there, so we fake it
             $_REQUEST['gid'] = civicrm_api3('UFGroup', 'getvalue', array('sequential' => 1, 'name' => "volunteer_interest", 'return' => "id"));
             $_REQUEST['force'] = '1';
             // if the user is logged in, serve edit mode profile; else serve create mode
             $contact_id = CRM_Core_Session::getLoggedInContactID();
             // set params for controller
             $class = 'CRM_Profile_Form_Edit';
             $title = NULL;
             $mode = isset($contact_id) ? CRM_Core_Action::UPDATE : CRM_Core_Action::ADD;
             $imageUpload = FALSE;
             $addSequence = FALSE;
             $ignoreKey = TRUE;
             $attachUpload = FALSE;
             $controller = new CRM_Core_Controller_Simple($class, $title, $mode, $imageUpload, $addSequence, $ignoreKey, $attachUpload);
             if (isset($contact_id)) {
                 $controller->set('edit', 1);
             }
             $controller->process();
             return $controller->run();
         default:
             CRM_Core_Error::fatal('Invalid page callback config.');
             return;
     }
 }
Пример #23
0
 /**
  * This function contains the actions for profile arguments
  *
  * @param $args array this array contains the arguments of the url
  *
  * @static
  * @access public
  */
 static function profile($args)
 {
     if ($args[1] !== 'profile') {
         return;
     }
     $secondArg = CRM_Utils_Array::value(2, $args, '');
     if ($secondArg == 'map') {
         $controller = new CRM_Core_Controller_Simple('CRM_Contact_Form_Task_Map', ts('Map Contact'), NULL, FALSE, FALSE, TRUE);
         $gids = explode(',', CRM_Utils_Request::retrieve('gid', 'String', CRM_Core_DAO::$_nullObject, FALSE, 0, 'GET'));
         if (count($gids) > 1) {
             foreach ($gids as $pfId) {
                 $profileIds[] = CRM_Utils_Type::escape($pfId, 'Positive');
             }
             $controller->set('gid', $profileIds[0]);
             $profileGID = $profileIds[0];
         } else {
             $profileGID = CRM_Utils_Request::retrieve('gid', 'Integer', $controller, TRUE);
         }
         // make sure that this profile enables mapping
         // CRM-8609
         $isMap = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFGroup', $profileGID, 'is_map');
         if (!$isMap) {
             CRM_Core_Error::statusBounce(ts('This profile does not have the map feature turned on.'));
         }
         $profileView = CRM_Utils_Request::retrieve('pv', 'Integer', $controller, FALSE);
         // set the userContext stack
         $session = CRM_Core_Session::singleton();
         if ($profileView) {
             $session->pushUserContext(CRM_Utils_System::url('civicrm/profile/view'));
         } else {
             $session->pushUserContext(CRM_Utils_System::url('civicrm/profile', 'force=1'));
         }
         $controller->set('profileGID', $profileGID);
         $controller->process();
         return $controller->run();
     }
     if ($secondArg == 'edit' || $secondArg == 'create') {
         // set the userContext stack
         $session = CRM_Core_Session::singleton();
         $session->pushUserContext(CRM_Utils_System::url('civicrm/profile', 'reset=1'));
         if ($secondArg == 'edit') {
             $controller = new CRM_Core_Controller_Simple('CRM_Profile_Form_Edit', ts('Create Profile'), CRM_Core_Action::UPDATE, FALSE, FALSE, TRUE);
             $controller->set('edit', 1);
             $controller->process();
             return $controller->run();
         } else {
             $wrapper = new CRM_Utils_Wrapper();
             return $wrapper->run('CRM_Profile_Form_Edit', ts('Create Profile'), array('mode' => CRM_Core_Action::ADD, 'ignoreKey' => TRUE));
         }
     }
     if ($secondArg == 'view' || empty($secondArg)) {
         $page = new CRM_Profile_Page_Listings();
         return $page->run();
     }
     CRM_Utils_System::permissionDenied();
     return;
 }
Пример #24
0
 /**
  * called when action is update or new.
  *
  */
 public function edit()
 {
     $controller = new CRM_Core_Controller_Simple('CRM_Contact_Form_Relationship', ts('Contact Relationships'), $this->_action);
     $controller->setEmbedded(TRUE);
     // set the userContext stack
     $session = CRM_Core_Session::singleton();
     // if this is called from case view, we need to redirect back to same page
     if ($this->_caseId) {
         $url = CRM_Utils_System::url('civicrm/contact/view/case', "action=view&reset=1&cid={$this->_contactId}&id={$this->_caseId}");
     } else {
         $url = CRM_Utils_System::url('civicrm/contact/view', "action=browse&selectedChild=rel&reset=1&cid={$this->_contactId}");
     }
     $session->pushUserContext($url);
     if (CRM_Utils_Request::retrieve('confirmed', 'Boolean', CRM_Core_DAO::$_nullObject)) {
         if ($this->_caseId) {
             //create an activity for case role removal.CRM-4480
             CRM_Case_BAO_Case::createCaseRoleActivity($this->_caseId, $this->_id);
             CRM_Core_Session::setStatus(ts('Case Role has been deleted successfully.'), ts('Record Deleted'), 'success');
         }
         // delete relationship
         CRM_Contact_BAO_Relationship::del($this->_id);
         CRM_Utils_System::redirect($url);
     }
     $controller->set('contactId', $this->_contactId);
     $controller->set('id', $this->_id);
     $controller->process();
     $controller->run();
 }
Пример #25
0
 /**
  * This function is the main function that is called when the page loads,
  * it decides the which action has to be taken for the page.
  *
  * return null
  * @access public
  */
 function run()
 {
     $this->preProcess();
     $controller = new CRM_Core_Controller_Simple('CRM_Contribute_Form_Search', ts('Contributions'), NULL);
     $controller->setEmbedded(TRUE);
     $controller->set('limit', 10);
     $controller->set('force', 1);
     $controller->set('context', 'dashboard');
     $controller->process();
     $controller->run();
     $chartForm = new CRM_Core_Controller_Simple('CRM_Contribute_Form_ContributionCharts', ts('Contributions Charts'), NULL);
     $chartForm->setEmbedded(TRUE);
     $chartForm->process();
     $chartForm->run();
     CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'templates/CRM/Contribute/Page/DashBoard.js');
     return parent::run();
 }
Пример #26
0
 /**
  * edit custom Option.
  *
  * editing would involved modifying existing fields + adding data to new fields.
  *
  * @param string  $action   the action to be invoked
  *
  * @return void
  * @access public
  */
 function edit($action)
 {
     $oid = CRM_Utils_Request::retrieve('oid', 'Positive', $this, FALSE, 0);
     $params = array();
     if ($oid) {
         $params['oid'] = $oid;
         $sid = CRM_Price_BAO_PriceSet::getSetId($params);
         $usedBy = CRM_Price_BAO_PriceSet::getUsedBy($sid);
     }
     // set the userContext stack
     $session = CRM_Core_Session::singleton();
     $session->pushUserContext(CRM_Utils_System::url('civicrm/admin/price/field/option', "reset=1&action=browse&fid={$this->_fid}&sid={$this->_sid}"));
     $controller = new CRM_Core_Controller_Simple('CRM_Price_Form_Option', ts('Price Field Option'), $action);
     $controller->set('fid', $this->_fid);
     $controller->setEmbedded(TRUE);
     $controller->process();
     $controller->run();
     $this->browse();
     if ($action & CRM_Core_Action::DELETE) {
         // add breadcrumb
         $url = CRM_Utils_System::url('civicrm/admin/price/field/option', 'reset=1');
         CRM_Utils_System::appendBreadCrumb(ts('Price Option'), $url);
         $this->assign('usedPriceSetTitle', CRM_Price_BAO_PriceFieldValue::getOptionLabel($oid));
         $this->assign('usedBy', $usedBy);
         $comps = array("Event" => "civicrm_event", "Contribution" => "civicrm_contribution_page");
         $priceSetContexts = array();
         foreach ($comps as $name => $table) {
             if (array_key_exists($table, $usedBy)) {
                 $priceSetContexts[] = $name;
             }
         }
         $this->assign('contexts', $priceSetContexts);
     }
 }
Пример #27
0
 /**
  * This function is called when action is browse
  *
  * return null
  * @access public
  */
 function browse()
 {
     CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'js/crm.livePage.js');
     // add annual contribution
     $annual = array();
     list($annual['count'], $annual['amount'], $annual['avg']) = CRM_Contribute_BAO_Contribution::annual($this->_contactId);
     $this->assign('annual', $annual);
     $controller = new CRM_Core_Controller_Simple('CRM_Contribute_Form_Search', ts('Contributions'), $this->_action, FALSE, FALSE, TRUE);
     $controller->setEmbedded(TRUE);
     $controller->reset();
     $controller->set('cid', $this->_contactId);
     $controller->set('crid', $this->_crid);
     $controller->set('context', 'Search');
     $controller->set('limit', 50);
     $controller->process();
     $controller->run();
     // add recurring block
     $action = array_sum(array_keys($this->recurLinks()));
     $params = CRM_Contribute_BAO_ContributionRecur::getRecurContributions($this->_contactId);
     if (!empty($params)) {
         foreach ($params as $ids => $recur) {
             $action = array_sum(array_keys($this->recurLinks($ids)));
             // no action allowed if it's not active
             $params[$ids]['is_active'] = $recur['contribution_status_id'] != 3;
             if ($params[$ids]['is_active']) {
                 $details = CRM_Contribute_BAO_ContributionRecur::getSubscriptionDetails($params[$ids]['id'], 'recur');
                 $hideUpdate = $details->membership_id & $details->auto_renew;
                 if ($hideUpdate) {
                     $action -= CRM_Core_Action::UPDATE;
                 }
                 $params[$ids]['action'] = CRM_Core_Action::formLink(self::recurLinks($ids), $action, array('cid' => $this->_contactId, 'crid' => $ids, 'cxt' => 'contribution'), ts('more'), FALSE, 'contribution.selector.recurring', 'Contribution', $ids);
             }
         }
         // assign vars to templates
         $this->assign('action', $this->_action);
         $this->assign('recurRows', $params);
         $this->assign('recur', TRUE);
     }
     //enable/disable soft credit records for test contribution
     $isTest = 0;
     if (CRM_Utils_Request::retrieve('isTest', 'Positive', $this)) {
         $isTest = 1;
     }
     $this->assign('isTest', $isTest);
     $softCreditList = CRM_Contribute_BAO_ContributionSoft::getSoftContributionList($this->_contactId, $isTest);
     if (!empty($softCreditList)) {
         $softCreditTotals = array();
         list($softCreditTotals['amount'], $softCreditTotals['avg'], $softCreditTotals['currency']) = CRM_Contribute_BAO_ContributionSoft::getSoftContributionTotals($this->_contactId, $isTest);
         $this->assign('softCredit', TRUE);
         $this->assign('softCreditRows', $softCreditList);
         $this->assign('softCreditTotals', $softCreditTotals);
     }
     if ($this->_contactId) {
         $displayName = CRM_Contact_BAO_Contact::displayName($this->_contactId);
         $this->assign('displayName', $displayName);
         $this->ajaxResponse['tabCount'] = CRM_Contact_BAO_Contact::getCountComponent('contribution', $this->_contactId);
     }
 }
Пример #28
0
 /**
  * Preview custom group
  *
  * @param int $id custom group id
  *
  * @return void
  * @access public
  */
 function preview($id)
 {
     $controller = new CRM_Core_Controller_Simple('CRM_Custom_Form_Preview', ts('Preview Custom Data'), NULL);
     $session = CRM_Core_Session::singleton();
     $session->pushUserContext(CRM_Utils_System::url('civicrm/admin/custom/group', 'action=browse'));
     $controller->set('groupId', $id);
     $controller->setEmbedded(TRUE);
     $controller->process();
     $controller->run();
 }
Пример #29
0
 function search()
 {
     if ($this->_action & CRM_Core_Action::DELETE) {
         return;
     }
     $form = new CRM_Core_Controller_Simple('CRM_Contribute_Form_PCP_PCP', ts('Search Campaign Pages'), CRM_Core_Action::ADD);
     $form->setEmbedded(true);
     $form->setParent($this);
     $form->process();
     $form->run();
 }
Пример #30
0
 /**
  * Preview price set
  *
  * @param int $id price set id
  * @return void
  * @access public
  */
 function preview($sid)
 {
     $controller = new CRM_Core_Controller_Simple('CRM_Price_Form_Preview', ts('Preview Price Set'), null);
     $session = CRM_Core_Session::singleton();
     $context = CRM_Utils_Request::retrieve('context', 'String', $this);
     if ($context == 'field') {
         $session->pushUserContext(CRM_Utils_System::url('civicrm/admin/price/field', "action=browse&sid={$sid}"));
     } else {
         $session->pushUserContext(CRM_Utils_System::url('civicrm/admin/price', 'action=browse'));
     }
     $controller->set('groupId', $sid);
     $controller->setEmbedded(true);
     $controller->process();
     $controller->run();
 }