本文整理汇总了PHP中CRM_Contact_Form_Task类的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Contact_Form_Task类的具体用法?PHP CRM_Contact_Form_Task怎么用?PHP CRM_Contact_Form_Task使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CRM_Contact_Form_Task类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: preProcess
public function preProcess()
{
$this->_context = CRM_Utils_Request::retrieve('context', 'String', $this);
$cid = CRM_Utils_Request::retrieve('cid', 'Positive', $this, FALSE);
CRM_Contact_Form_Task_SMSCommon::preProcessProvider($this);
if (!$cid && $this->_context != 'standalone') {
parent::preProcess();
}
$this->assign('single', $this->_single);
if (CRM_Core_Permission::check('administer CiviCRM')) {
$this->assign('isAdmin', 1);
}
}
示例2: preProcess
/**
* build all the data structures needed to build the form
*
* @return void
* @access public
*/
function preProcess()
{
CRM_Contact_Form_Task_PDFLetterCommon::preProcess($this);
// store case id if present
$this->_caseId = CRM_Utils_Request::retrieve('caseid', 'Positive', $this, false);
$cid = CRM_Utils_Request::retrieve('cid', 'Positive', $this, false);
if ($cid) {
CRM_Contact_Form_Task_PDFLetterCommon::preProcessSingle($this, $cid);
} else {
parent::preProcess();
}
$this->assign('single', $this->_single);
}
示例3: preProcess
/**
* build all the data structures needed to build the form
*
* @return void
* @access public
*/
function preProcess()
{
parent::preProcess();
require_once 'CRM/Utils/Rule.php';
$qfKey = CRM_Utils_Request::retrieve('qfKey', 'String', $this);
$urlParams = 'force=1';
if (CRM_Utils_Rule::qfKey($qfKey)) {
$urlParams .= '&qfKey=' . $qfKey;
}
$session = CRM_Core_Session::singleton();
$url = CRM_Utils_System::url('civicrm/contact/search/custom', $urlParams);
$session->replaceUserContext($url);
//get the survey id from user submitted values.
$this->_surveyId = CRM_Utils_Array::value('survey_id', $this->get('formValues'));
$isHeld = CRM_Utils_Array::value('status_id', $this->get('formValues'));
if (!$this->_surveyId || !$isHeld) {
CRM_Core_Error::statusBounce(ts("Please search with 'Is Held' and 'Survey Id' filters to apply this action."));
}
$session = CRM_Core_Session::singleton();
if (empty($this->_contactIds) || !$session->get('userID')) {
CRM_Core_Error::statusBounce(ts("Could not find contacts for release voters resevation Or Missing Interviewer contact."));
}
$this->_interviewerId = $session->get('userID');
$surveyDetails = array();
$params = array('id' => $this->_surveyId);
$this->_surveyDetails = CRM_Campaign_BAO_Survey::retrieve($params, $surveyDetails);
$numVoters = CRM_Core_DAO::singleValueQuery("SELECT COUNT(*) FROM " . self::ACTIVITY_SURVEY_DETAIL_TABLE . " WHERE status_id = 'H' AND survey_id = %1 AND interviewer_id = %2", array(1 => array($this->_surveyId, 'Integer'), 2 => array($this->_interviewerId, 'Integer')));
if (!isset($numVoters) || $numVoters < 1) {
CRM_Core_Error::statusBounce(ts("All voters held by you are already released for this survey."));
}
$this->assign('surveyTitle', $surveyDetails['title']);
}
示例4: postProcess
function postProcess()
{
$values = $this->exportValues();
// find/determine household name
if ($values['hh_option'] == 'new') {
// extract the name:
if ($values['household_name_pattern'] == 'custom') {
$household_name = $values['household_name'];
} else {
$household_name = $values['household_name_pattern'];
}
$household = civicrm_api3('Contact', 'create', array('contact_type' => 'Household', 'household_name' => $household_name));
$household_id = $household['id'];
} elseif ($values['hh_option'] == 'existing') {
$household_id = (int) $values['existing_household'];
} else {
// has to be the selected_XXX preselected household change
$household_id = (int) substr($values['hh_option'], 9);
}
// find contact_ids
$contact_ids = $values['hh_contacts'];
// ...and pass the ball to the merge view
$mergeview_url = CRM_Utils_System::url('civicrm/household/mergeview', "hid={$household_id}&oids={$contact_ids}");
CRM_Utils_System::redirect($mergeview_url);
parent::postProcess();
}
示例5: preProcess
/**
* build all the data structures needed to build the form
*
* @return void
* @access public
*/
function preProcess()
{
$cid = CRM_Utils_Request::retrieve('cid', 'Positive', $this, false);
if ($cid) {
// not sure why this is needed :(
// also add the cid params to the Menu array
CRM_Core_Menu::addParam('cid', $cid);
// create menus ..
$startWeight = CRM_Core_Menu::getMaxWeight('civicrm/contact/view');
$startWeight++;
CRM_Core_BAO_CustomGroup::addMenuTabs(CRM_Contact_BAO_Contact::getContactType($cid), 'civicrm/contact/view/cd', $startWeight);
$this->_contactIds = array($cid);
$this->_single = true;
$smsNumbers = CRM_Contact_BAO_Contact::allPhones($cid, 'Mobile');
$this->_emails = array();
$toName = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $cid, 'display_name');
foreach ($smsNumbers as $number => $item) {
$this->_smsNumbers[$number] = '"' . $toName . '" <' . $number . '> ' . $item['locationType'];
if ($item['is_primary']) {
$this->_smsNumbers[$number] .= ' ' . ts('(preferred)');
}
$this->_smsNumbers[$number] = htmlspecialchars($this->_emails[$email]);
}
} else {
parent::preProcess();
}
$this->assign('single', $this->_single);
}
示例6: preProcess
/**
* Set variables up before form is built.
*
* @return void
*/
public function preProcess()
{
if (CRM_Core_BAO_MailSettings::defaultDomain() == "EXAMPLE.ORG") {
CRM_Core_Error::fatal(ts('The <a href="%1">default mailbox</a> has not been configured. You will find <a href="%2">more info in our online user and administrator guide.</a>', array(1 => CRM_Utils_System::url('civicrm/admin/mailSettings', 'reset=1'), 2 => "http://book.civicrm.org/user/advanced-configuration/email-system-configuration/")));
}
$this->_mailingID = CRM_Utils_Request::retrieve('mid', 'Integer', $this, FALSE, NULL);
// when user come from search context.
$this->_searchBasedMailing = CRM_Contact_Form_Search::isSearchContext($this->get('context'));
if ($this->_searchBasedMailing) {
$searchParams = $this->controller->exportValues();
// number of records that were selected - All or Few.
$this->_resultSelectOption = $searchParams['radio_ts'];
if (CRM_Utils_Array::value('task', $searchParams) == 20) {
parent::preProcess();
}
}
$session = CRM_Core_Session::singleton();
if ($this->_searchBasedMailing) {
$config = CRM_Core_Config::singleton();
$path = CRM_Utils_Array::value($config->userFrameworkURLVar, $_GET);
$qfKey = CRM_Utils_Array::value('qfKey', $_GET);
if ($qfKey) {
$session->pushUserContext(CRM_Utils_System::url($path, "qfKey={$qfKey}"));
} else {
$session->pushUserContext(CRM_Utils_System::url('civicrm/mailing', 'reset=1'));
}
} elseif (strpos($session->readUserContext(), 'civicrm/mailing') === FALSE) {
// use previous context unless mailing is not schedule, CRM-4290
$session->pushUserContext(CRM_Utils_System::url('civicrm/mailing', 'reset=1'));
}
}
示例7: preProcess
/**
* Build all the data structures needed to build the form.
*
* @return void
*/
public function preProcess()
{
parent::preprocess();
// set print view, so that print templates are called
$this->controller->setPrint(1);
$this->assign('id', $this->get('id'));
$this->assign('pageTitle', ts('CiviCRM Contact Listing'));
$params = $this->get('queryParams');
if (!empty($this->_contactIds)) {
//using _contactIds field for creating params for query so that multiple selections on multiple pages
//can be printed.
foreach ($this->_contactIds as $contactId) {
$params[] = array(CRM_Core_Form::CB_PREFIX . $contactId, '=', 1, 0, 0);
}
}
// create the selector, controller and run - store results in session
$fv = $this->get('formValues');
$returnProperties = $this->get('returnProperties');
$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));
}
$includeContactIds = FALSE;
if ($fv['radio_ts'] == 'ts_sel') {
$includeContactIds = TRUE;
}
$selectorName = $this->controller->selectorName();
require_once str_replace('_', DIRECTORY_SEPARATOR, $selectorName) . '.php';
$returnP = isset($returnPropeties) ? $returnPropeties : "";
$customSearchClass = $this->get('customSearchClass');
$selector = new $selectorName($customSearchClass, $fv, $params, $returnP, $this->_action, $includeContactIds);
$controller = new CRM_Core_Selector_Controller($selector, NULL, $sortID, CRM_Core_Action::VIEW, $this, CRM_Core_Selector_Controller::SCREEN);
$controller->setEmbedded(TRUE);
$controller->run();
}
示例8: preProcess
/**
* build all the data structures needed to build the form
*
* @return void
* @access public
*/
function preProcess()
{
parent::preprocess();
// set print view, so that print templates are called
$this->controller->setPrint(1);
$this->assign('id', $this->get('id'));
$this->assign('pageTitle', ts('CiviCRM Contact Listing'));
// create the selector, controller and run - store results in session
$fv = $this->get('formValues');
$params = $this->get('queryParams');
$returnProperties = $this->get('returnProperties');
$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));
}
$includeContactIds = false;
if ($fv['radio_ts'] == 'ts_sel') {
$includeContactIds = true;
}
$selectorName = $this->controller->selectorName();
require_once str_replace('_', DIRECTORY_SEPARATOR, $selectorName) . '.php';
$returnP = isset($returnPropeties) ? $returnPropeties : "";
$customSearchClass = $this->get('customSearchClass');
eval('$selector = new ' . $selectorName . '( $customSearchClass,
$fv,
$params,
$returnP,
$this->_action,
$includeContactIds );');
$controller = new CRM_Core_Selector_Controller($selector, null, $sortID, CRM_Core_Action::VIEW, $this, CRM_Core_Selector_Controller::SCREEN);
$controller->setEmbedded(true);
$controller->run();
}
示例9: preProcess
/**
* Build all the data structures needed to build the form.
*
* @return void
*/
public function preProcess()
{
// initialize the task and row fields
parent::preProcess();
$session = CRM_Core_Session::singleton();
// Step 1: if we can't get team ID, there's no point continuing.
$this->_id = $this->get('amtgID');
if (!isset($this->_id)) {
$this->_id = CRM_Utils_Request::retrieve('amtgID', 'Positive');
}
if (!isset($this->_id)) {
$this->_id = $session->get('amtgID');
}
$session->set('amtgID', $this->_id);
//@todo Exit more gracefully if id still isn't set
if (!isset($this->_id)) {
return;
}
$this->_teamValues = array();
$params = array('id' => $this->_id);
$this->_team = CRM_Contact_BAO_Group::retrieve($params, $this->_teamValues);
$this->_context = $this->get('context');
$this->findTeamPlayers();
$this->findEligiblePlayers();
$session = CRM_Core_Session::singleton();
//$urlParams = 'reset=1&force=1';
$session->replaceUserContext(CRM_Utils_System::url('civicrm/tournament/team'));
//search', $urlParams));
}
示例10: preProcess
/**
* build all the data structures needed to build the form
*
* @return void
* @access public
*/
function preProcess()
{
//check for permission to edit contributions
if (!CRM_Core_Permission::check('issue cdn tax receipts')) {
CRM_Core_Error::fatal(ts('You do not have permission to access this page', array('domain' => 'org.civicrm.cdntaxreceipts')));
}
parent::preProcess();
$thisYear = date("Y");
$this->_years = array($thisYear, $thisYear - 1, $thisYear - 2);
$receipts = array();
foreach ($this->_years as $year) {
$receipts[$year] = array('email' => 0, 'print' => 0, 'total' => 0, 'contrib' => 0);
}
// count and categorize contributions
foreach ($this->_contactIds as $id) {
foreach ($this->_years as $year) {
list($issuedOn, $receiptId) = cdntaxreceipts_annual_issued_on($id, $year);
$eligible = count(cdntaxreceipts_contributions_not_receipted($id, $year));
if ($eligible > 0) {
list($method, $email) = cdntaxreceipts_sendMethodForContact($id);
$receipts[$year][$method]++;
$receipts[$year]['total']++;
$receipts[$year]['contrib'] += $eligible;
}
}
}
$this->_receipts = $receipts;
}
示例11: preProcess
/**
* build all the data structures needed to build the form
*
* @return void
* @access public
*/
function preProcess()
{
/*
* initialize the task and row fields
*/
parent::preProcess();
}
示例12: preProcess
/**
* Build all the data structures needed to build the form.
*/
public function preProcess()
{
// initialize the task and row fields
parent::preProcess();
$this->_context = $this->get('context');
$this->_id = $this->get('amtgID');
}
示例13: preProcess
public function preProcess()
{
parent::preProcess();
list($groupId, $ssId) = $this->createHiddenGroup();
$mailing = civicrm_api3('Mailing', 'create', array('name' => "", 'campaign_id' => NULL, 'replyto_email' => "", 'subject' => "", 'body_html' => "", 'body_text' => "", 'groups' => array('include' => array($groupId), 'exclude' => array(), 'base' => array()), 'mailings' => array('include' => array(), 'exclude' => array())));
CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/a/', NULL, TRUE, '/mailing/' . $mailing['id']));
}
示例14: preProcess
/**
* Build all the data structures needed to build the form
*
* @access public
*
* @return void
*/
function preProcess()
{
parent::preProcess();
// get rows
$rows = $this->getContactRows();
// our array now contains all contacts who can be synced to WordPress
$this->assign('rows', $rows);
}
示例15: preProcess
/**
* Build all the data structures needed to build the form.
*/
public function preProcess()
{
$cid = CRM_Utils_Request::retrieve('cid', 'Positive', $this, FALSE);
$this->_searchKey = CRM_Utils_Request::retrieve('key', 'String', $this);
// sort out whether it’s a delete-to-trash, delete-into-oblivion or restore (and let the template know)
$values = $this->controller->exportValues();
$this->_skipUndelete = (CRM_Core_Permission::check('access deleted contacts') and (CRM_Utils_Request::retrieve('skip_undelete', 'Boolean', $this) or CRM_Utils_Array::value('task', $values) == CRM_Contact_Task::DELETE_PERMANENTLY));
$this->_restore = (CRM_Utils_Request::retrieve('restore', 'Boolean', $this) or CRM_Utils_Array::value('task', $values) == CRM_Contact_Task::RESTORE);
if ($this->_restore && !CRM_Core_Permission::check('access deleted contacts')) {
CRM_Core_Error::fatal(ts('You do not have permission to access this contact.'));
} elseif (!CRM_Core_Permission::check('delete contacts')) {
CRM_Core_Error::fatal(ts('You do not have permission to delete this contact.'));
}
$this->assign('trash', Civi::settings()->get('contact_undelete') and !$this->_skipUndelete);
$this->assign('restore', $this->_restore);
if ($this->_restore) {
CRM_Utils_System::setTitle(ts('Restore Contact'));
}
if ($cid) {
if (!CRM_Contact_BAO_Contact_Permission::allow($cid, CRM_Core_Permission::EDIT)) {
CRM_Core_Error::fatal(ts('You do not have permission to delete this contact. Note: you can delete contacts if you can edit them.'));
} elseif (CRM_Contact_BAO_Contact::checkDomainContact($cid)) {
CRM_Core_Error::fatal(ts('This contact is a special one for the contact information associated with the CiviCRM installation for this domain. No one is allowed to delete it because the information is used for special system purposes.'));
}
$this->_contactIds = array($cid);
$this->_single = TRUE;
$this->assign('totalSelectedContacts', 1);
} else {
parent::preProcess();
}
$this->_sharedAddressMessage = $this->get('sharedAddressMessage');
if (!$this->_restore && !$this->_sharedAddressMessage) {
// we check for each contact for shared contact address
$sharedContactList = array();
$sharedAddressCount = 0;
foreach ($this->_contactIds as $contactId) {
// check if a contact that is being deleted has any shared addresses
$sharedAddressMessage = CRM_Core_BAO_Address::setSharedAddressDeleteStatus(NULL, $contactId, TRUE);
if ($sharedAddressMessage['count'] > 0) {
$sharedAddressCount += $sharedAddressMessage['count'];
$sharedContactList = array_merge($sharedContactList, $sharedAddressMessage['contactList']);
}
}
$this->_sharedAddressMessage = array('count' => $sharedAddressCount, 'contactList' => $sharedContactList);
if ($sharedAddressCount > 0) {
if (count($this->_contactIds) > 1) {
// more than one contact deleted
$message = ts('One of the selected contacts has an address record that is shared with 1 other contact.', array('plural' => 'One or more selected contacts have address records which are shared with %count other contacts.', 'count' => $sharedAddressCount));
} else {
// only one contact deleted
$message = ts('This contact has an address record which is shared with 1 other contact.', array('plural' => 'This contact has an address record which is shared with %count other contacts.', 'count' => $sharedAddressCount));
}
CRM_Core_Session::setStatus($message . ' ' . ts('Shared addresses will not be removed or altered but will no longer be shared.'), ts('Shared Addesses Owner'));
}
// set in form controller so that queries are not fired again
$this->set('sharedAddressMessage', $this->_sharedAddressMessage);
}
}