本文整理汇总了PHP中CRM_Contact_Form_Task::preProcess方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Contact_Form_Task::preProcess方法的具体用法?PHP CRM_Contact_Form_Task::preProcess怎么用?PHP CRM_Contact_Form_Task::preProcess使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Contact_Form_Task
的用法示例。
在下文中一共展示了CRM_Contact_Form_Task::preProcess方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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']);
}
示例2: 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);
}
示例3: 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'));
}
}
示例4: 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();
}
示例5: 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));
}
示例6: 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;
}
示例7: 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');
}
示例8: 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']));
}
示例9: 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);
}
示例10: 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);
}
}
示例11: 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);
}
}
示例12: preProcess
/**
* build all the data structures needed to build the form
*
* @return void
* @access public
*/
function preProcess()
{
$cid = CRM_Utils_Request::retrieve('cid', $this, false);
$lid = CRM_Utils_Request::retrieve('lid', $this, false);
if ($cid) {
$this->_contactIds = array($cid);
$this->_single = true;
} else {
parent::preProcess();
}
$this->createLocation($this->_contactIds, $lid);
$this->assign('single', $this->_single);
}
示例13: preProcess
public function preProcess()
{
parent::preProcess();
// TODO: These would probably not be needed if the logic in \CRM_Simplemail_BAO_SimpleMail::createSmartContactGroupForSearchContacts() is moved into this class' postProcess() method
simplemail_civicrm_addToSessionScope('createdFromSearch', TRUE);
simplemail_civicrm_addToSessionScope('contactCountFromSearch', count($this->_contactIds));
simplemail_civicrm_addToSessionScope('contactIds', $this->_contactIds);
simplemail_civicrm_addToSessionScope('searchParams', $this->controller->exportValues());
simplemail_civicrm_addToSessionScope('formValues', $this->get('formValues'));
simplemail_civicrm_addToSessionScope('customSearchId', $this->get('customSearchID'));
simplemail_civicrm_addToSessionScope('context', $this->get('context'));
CRM_Utils_System::redirect('/civicrm/simple-mail#/mailings/new');
}
示例14: 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);
}
示例15: preProcess
/**
* build all the data structures needed to build the form
*
* @return void
* @access public
*/
function preProcess()
{
parent::preProcess();
// display name and email of all contact ids
$contactIDs = implode(',', $this->_contactIds);
$query = "\nSELECT c.id as contact_id, c.display_name as name,\n c.contact_type as contact_type, e.email as email\nFROM civicrm_contact c, civicrm_email e\nWHERE e.contact_id = c.id\nAND e.is_primary = 1\nAND c.id IN ( {$contactIDs} )";
$rows = array();
$dao = CRM_Core_DAO::executeQuery($query);
while ($dao->fetch()) {
$rows[] = array('id' => $dao->contact_id, 'name' => $dao->name, 'contact_type' => $dao->contact_type, 'email' => $dao->email);
}
$this->assign('rows', $rows);
}