本文整理汇总了PHP中CRM_Contact_Form_Search类的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Contact_Form_Search类的具体用法?PHP CRM_Contact_Form_Search怎么用?PHP CRM_Contact_Form_Search使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CRM_Contact_Form_Search类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: preProcess
/**
* build all the data structures needed to build the form
*
* @return void
* @access public
*/
function preProcess()
{
$session = CRM_Core_Session::singleton();
//this is done to unset searchRows variable assign during AddToHousehold and AddToOrganization
$this->set('searchRows', '');
$context = $this->get('context');
if (in_array($context, array('smog', 'amtg'))) {
$urlParams = 'reset=1&force=1&context=smog&gid=';
$urlParams .= $context == 'smog' ? $this->get('gid') : $this->get('amtgID');
$session->replaceUserContext(CRM_Utils_System::url('civicrm/group/search', $urlParams));
return;
}
$ssID = $this->get('ssID');
if ($this->_action == CRM_Core_Action::BASIC) {
$fragment = 'search';
} else {
if ($this->_action == CRM_Core_Action::PROFILE) {
$fragment = 'search/builder';
} else {
if ($this->_action == CRM_Core_Action::ADVANCED) {
$fragment = 'search/advanced';
} else {
$fragment = 'search/custom';
}
}
}
$path = 'force=1';
if (isset($ssID)) {
$path .= "&reset=1&ssID={$ssID}";
}
if (!CRM_Contact_Form_Search::isSearchContext($context)) {
$context = 'search';
}
$path .= "&context={$context}";
//set the user context for redirection of task actions
$qfKey = CRM_Utils_Request::retrieve('qfKey', 'String', $this);
require_once 'CRM/Utils/Rule.php';
if (CRM_Utils_Rule::qfKey($qfKey)) {
$path .= "&qfKey={$qfKey}";
}
$url = CRM_Utils_System::url('civicrm/contact/' . $fragment, $path);
$session->replaceUserContext($url);
return;
}
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:50,代码来源:Result.php
示例2: elseif
/**
* Form rule to send out a test mailing.
*
* @param array $params Array of the form values
* @param array $files Any files posted to the form
* @param array $self an current this object
*
* @return boolean true on succesful SMTP handoff
* @access public
*/
static function &testMail($testParams, $files, $self)
{
$error = NULL;
$urlString = 'civicrm/mailing/send';
$urlParams = "_qf_Test_display=true&qfKey={$testParams['qfKey']}";
$ssID = $self->get('ssID');
if ($ssID && $self->_searchBasedMailing) {
if ($self->_action == CRM_Core_Action::BASIC) {
$fragment = 'search';
} elseif ($self->_action == CRM_Core_Action::PROFILE) {
$fragment = 'search/builder';
} elseif ($self->_action == CRM_Core_Action::ADVANCED) {
$fragment = 'search/advanced';
} else {
$fragment = 'search/custom';
}
$urlString = 'civicrm/contact/' . $fragment;
}
$emails = NULL;
if (CRM_Utils_Array::value('sendtest', $testParams)) {
if (!($testParams['test_group'] || $testParams['test_email'])) {
CRM_Core_Session::setStatus(ts('Your did not provided any email address or selected any group. No test mail is sent.'));
$error = TRUE;
}
if ($testParams['test_email']) {
$emailAdd = explode(',', $testParams['test_email']);
foreach ($emailAdd as $key => $value) {
$email = trim($value);
$testParams['emails'][] = $email;
$emails .= $emails ? ",'{$email}'" : "'{$email}'";
if (!CRM_Utils_Rule::email($email)) {
CRM_Core_Session::setStatus(ts('Please enter valid email addresses only.'));
$error = TRUE;
}
}
}
if ($error) {
$url = CRM_Utils_System::url($urlString, $urlParams);
CRM_Utils_System::redirect($url);
return $error;
}
}
if (CRM_Utils_Array::value('_qf_Test_submit', $testParams)) {
//when user perform mailing from search context
//redirect it to search result CRM-3711.
if ($ssID && $self->_searchBasedMailing) {
$draftURL = CRM_Utils_System::url('civicrm/mailing/browse/unscheduled', 'scheduled=false&reset=1');
$status = ts("Your mailing has been saved. You can continue later by clicking the 'Continue' action to resume working on it.<br /> From <a href='%1'>Draft and Unscheduled Mailings</a>.", array(1 => $draftURL));
CRM_Core_Session::setStatus($status);
//replace user context to search.
$context = $self->get('context');
if (!CRM_Contact_Form_Search::isSearchContext($context)) {
$context = 'search';
}
$urlParams = "force=1&reset=1&ssID={$ssID}&context={$context}&qfKey={$testParams['qfKey']}";
$url = CRM_Utils_System::url($urlString, $urlParams);
CRM_Utils_System::redirect($url);
} else {
$status = ts("Your mailing has been saved. Click the 'Continue' action to resume working on it.");
CRM_Core_Session::setStatus($status);
$url = CRM_Utils_System::url('civicrm/mailing/browse/unscheduled', 'scheduled=false&reset=1');
CRM_Utils_System::redirect($url);
}
}
if (CRM_Mailing_Info::workflowEnabled()) {
if (!CRM_Core_Permission::check('schedule mailings') && CRM_Core_Permission::check('create mailings')) {
$url = CRM_Utils_System::url('civicrm/mailing/browse/unscheduled', 'scheduled=false&reset=1');
CRM_Utils_System::redirect($url);
}
}
if (CRM_Utils_Array::value('_qf_Import_refresh', $_POST) || CRM_Utils_Array::value('_qf_Test_next', $testParams) || !CRM_Utils_Array::value('sendtest', $testParams)) {
$error = TRUE;
return $error;
}
$job = new CRM_Mailing_BAO_Job();
$job->mailing_id = $self->get('mailing_id');
$job->is_test = TRUE;
$job->save();
$newEmails = NULL;
$session = CRM_Core_Session::singleton();
if (!empty($testParams['emails'])) {
$query = "\n SELECT id, contact_id, email \n FROM civicrm_email \n WHERE civicrm_email.email IN ({$emails})";
$dao = CRM_Core_DAO::executeQuery($query);
$emailDetail = array();
// fetch contact_id and email id for all existing emails
while ($dao->fetch()) {
$emailDetail[$dao->email] = array('contact_id' => $dao->contact_id, 'email_id' => $dao->id);
}
$dao->free();
foreach ($testParams['emails'] as $key => $email) {
//.........这里部分代码省略.........
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:101,代码来源:Test.php
示例3: postProcess
//.........这里部分代码省略.........
}
}
if (is_array($outGroups)) {
foreach ($outGroups as $key => $id) {
if ($id) {
$groups['exclude'][] = $id;
}
}
}
$mailings = array();
if (is_array($inMailings)) {
foreach ($inMailings as $key => $id) {
if ($id) {
$mailings['include'][] = $id;
}
}
}
if (is_array($outMailings)) {
foreach ($outMailings as $key => $id) {
if ($id) {
$mailings['exclude'][] = $id;
}
}
}
$session = CRM_Core_Session::singleton();
$params['groups'] = $groups;
$params['mailings'] = $mailings;
if ($this->get('mailing_id')) {
$ids = array();
// don't create a new mailing if already exists
$ids['mailing_id'] = $this->get('mailing_id');
$groupTableName = CRM_Contact_BAO_Group::getTableName();
$mailingTableName = CRM_Mailing_BAO_Mailing::getTableName();
// delete previous includes/excludes, if mailing already existed
require_once 'CRM/Contact/DAO/Group.php';
foreach (array('groups', 'mailings') as $entity) {
$mg = new CRM_Mailing_DAO_Group();
$mg->mailing_id = $ids['mailing_id'];
$mg->entity_table = $entity == 'groups' ? $groupTableName : $mailingTableName;
$mg->find();
while ($mg->fetch()) {
$mg->delete();
}
}
} else {
// new mailing, so lets set the created_id
$session = CRM_Core_Session::singleton();
$params['created_id'] = $session->get('userID');
$params['created_date'] = date('YmdHis');
}
require_once 'CRM/Mailing/BAO/Mailing.php';
$mailing = CRM_Mailing_BAO_Mailing::create($params, $ids);
$this->set('mailing_id', $mailing->id);
$count = CRM_Mailing_BAO_Mailing::getRecipientsCount(true, false, $mailing->id);
$this->set('count', $count);
$this->assign('count', $count);
$this->set('groups', $groups);
$this->set('mailings', $mailings);
if ($qf_Group_submit) {
//when user perform mailing from search context
//redirect it to search result CRM-3711.
$ssID = $this->get('ssID');
$context = $this->get('context');
if ($ssID && $this->_searchBasedMailing) {
if ($this->_action == CRM_Core_Action::BASIC) {
$fragment = 'search';
} else {
if ($this->_action == CRM_Core_Action::PROFILE) {
$fragment = 'search/builder';
} else {
if ($this->_action == CRM_Core_Action::ADVANCED) {
$fragment = 'search/advanced';
} else {
$fragment = 'search/custom';
}
}
}
$context = $this->get('context');
if (!CRM_Contact_Form_Search::isSearchContext($context)) {
$context = 'search';
}
$urlParams = "force=1&reset=1&ssID={$ssID}&context={$context}";
$qfKey = CRM_Utils_Request::retrieve('qfKey', 'String', $this);
if (CRM_Utils_Rule::qfKey($qfKey)) {
$urlParams .= "&qfKey={$qfKey}";
}
$draftURL = CRM_Utils_System::url('civicrm/mailing/browse/unscheduled', 'scheduled=false&reset=1');
$status = ts("Your mailing has been saved. You can continue later by clicking the 'Continue' action to resume working on it.<br /> From <a href='%1'>Draft and Unscheduled Mailings</a>.", array(1 => $draftURL));
CRM_Core_Session::setStatus($status);
//replace user context to search.
$url = CRM_Utils_System::url('civicrm/contact/' . $fragment, $urlParams);
CRM_Utils_System::redirect($url);
} else {
$status = ts("Your mailing has been saved. Click the 'Continue' action to resume working on it.");
CRM_Core_Session::setStatus($status);
$url = CRM_Utils_System::url('civicrm/mailing/browse/unscheduled', 'scheduled=false&reset=1');
CRM_Utils_System::redirect($url);
}
}
}
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:101,代码来源:Group.php
示例4: preProcess
/**
* Build the form object.
*/
public function preProcess()
{
CRM_Core_Form_RecurringEntity::preProcess('civicrm_activity');
$this->_atypefile = CRM_Utils_Array::value('atypefile', $_GET);
$this->assign('atypefile', FALSE);
if ($this->_atypefile) {
$this->assign('atypefile', TRUE);
}
$session = CRM_Core_Session::singleton();
$this->_currentUserId = $session->get('userID');
$this->_currentlyViewedContactId = $this->get('contactId');
if (!$this->_currentlyViewedContactId) {
$this->_currentlyViewedContactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this);
}
$this->assign('contactId', $this->_currentlyViewedContactId);
// Give the context.
if (!isset($this->_context)) {
$this->_context = CRM_Utils_Request::retrieve('context', 'String', $this);
if (CRM_Contact_Form_Search::isSearchContext($this->_context)) {
$this->_context = 'search';
} elseif (!in_array($this->_context, array('dashlet', 'dashletFullscreen')) && $this->_currentlyViewedContactId) {
$this->_context = 'activity';
}
$this->_compContext = CRM_Utils_Request::retrieve('compContext', 'String', $this);
}
$this->assign('context', $this->_context);
$this->_action = CRM_Utils_Request::retrieve('action', 'String', $this);
if ($this->_action & CRM_Core_Action::DELETE) {
if (!CRM_Core_Permission::check('delete activities')) {
CRM_Core_Error::fatal(ts('You do not have permission to access this page.'));
}
}
// CRM-6957
// When we come from contact search, activity id never comes.
// So don't try to get from object, it might gives you wrong one.
// if we're not adding new one, there must be an id to
// an activity we're trying to work on.
if ($this->_action != CRM_Core_Action::ADD && get_class($this->controller) != 'CRM_Contact_Controller_Search') {
$this->_activityId = CRM_Utils_Request::retrieve('id', 'Positive', $this);
}
$this->_activityTypeId = CRM_Utils_Request::retrieve('atype', 'Positive', $this);
$this->assign('atype', $this->_activityTypeId);
$this->assign('activityId', $this->_activityId);
// Check for required permissions, CRM-6264.
if ($this->_activityId && in_array($this->_action, array(CRM_Core_Action::UPDATE, CRM_Core_Action::VIEW)) && !CRM_Activity_BAO_Activity::checkPermission($this->_activityId, $this->_action)) {
CRM_Core_Error::fatal(ts('You do not have permission to access this page.'));
}
if ($this->_action & CRM_Core_Action::VIEW && CRM_Activity_BAO_Activity::checkPermission($this->_activityId, CRM_Core_Action::UPDATE)) {
$this->assign('permission', 'edit');
}
if (!$this->_activityTypeId && $this->_activityId) {
$this->_activityTypeId = CRM_Core_DAO::getFieldValue('CRM_Activity_DAO_Activity', $this->_activityId, 'activity_type_id');
}
// Assigning Activity type name.
if ($this->_activityTypeId) {
$activityTName = CRM_Core_OptionGroup::values('activity_type', FALSE, FALSE, FALSE, 'AND v.value = ' . $this->_activityTypeId, 'label');
if ($activityTName[$this->_activityTypeId]) {
$this->_activityTypeName = $activityTName[$this->_activityTypeId];
$this->assign('activityTName', $activityTName[$this->_activityTypeId]);
}
}
// Set title.
if (isset($activityTName)) {
$activityName = CRM_Utils_Array::value($this->_activityTypeId, $activityTName);
$this->assign('pageTitle', ts('%1 Activity', array(1 => $activityName)));
if ($this->_currentlyViewedContactId) {
$displayName = CRM_Contact_BAO_Contact::displayName($this->_currentlyViewedContactId);
// Check if this is default domain contact CRM-10482.
if (CRM_Contact_BAO_Contact::checkDomainContact($this->_currentlyViewedContactId)) {
$displayName .= ' (' . ts('default organization') . ')';
}
CRM_Utils_System::setTitle($displayName . ' - ' . $activityName);
} else {
CRM_Utils_System::setTitle(ts('%1 Activity', array(1 => $activityName)));
}
}
// Check the mode when this form is called either single or as
// search task action.
if ($this->_activityTypeId || $this->_context == 'standalone' || $this->_currentlyViewedContactId) {
$this->_single = TRUE;
$this->assign('urlPath', 'civicrm/activity');
} else {
// Set the appropriate action.
$url = CRM_Utils_System::currentPath();
$urlArray = explode('/', $url);
$searchPath = array_pop($urlArray);
$searchType = 'basic';
$this->_action = CRM_Core_Action::BASIC;
switch ($searchPath) {
case 'basic':
$searchType = $searchPath;
$this->_action = CRM_Core_Action::BASIC;
break;
case 'advanced':
$searchType = $searchPath;
$this->_action = CRM_Core_Action::ADVANCED;
break;
//.........这里部分代码省略.........
开发者ID:FundingWorks,项目名称:civicrm-core,代码行数:101,代码来源:Activity.php
示例5: postProcess
//.........这里部分代码省略.........
}
}
} else {
$text_message = $formValues['text_message'];
$params['body_text'] = $text_message;
$this->set('textFile', $params['body_text']);
$this->set('text_message', $params['body_text']);
$html_message = $formValues['html_message'];
// dojo editor does some html conversion when tokens are
// inserted as links. Hence token replacement fails.
// this is hack to revert html conversion for { to %7B and
// } to %7D by dojo editor
$html_message = str_replace('%7B', '{', str_replace('%7D', '}', $html_message));
$params['body_html'] = $html_message;
$this->set('htmlFile', $params['body_html']);
$this->set('html_message', $params['body_html']);
}
$params['name'] = $this->get('name');
$session = CRM_Core_Session::singleton();
$params['contact_id'] = $session->get('userID');
$composeFields = array('template', 'saveTemplate', 'updateTemplate', 'saveTemplateName');
$msgTemplate = NULL;
//mail template is composed
if ($formValues['upload_type']) {
$composeParams = array();
foreach ($composeFields as $key) {
if (!empty($formValues[$key])) {
$composeParams[$key] = $formValues[$key];
$this->set($key, $formValues[$key]);
}
}
if (!empty($composeParams['updateTemplate'])) {
$templateParams = array('msg_text' => $text_message, 'msg_html' => $html_message, 'msg_subject' => $params['subject'], 'is_active' => TRUE);
$templateParams['id'] = $formValues['template'];
$msgTemplate = CRM_Core_BAO_MessageTemplate::add($templateParams);
}
if (!empty($composeParams['saveTemplate'])) {
$templateParams = array('msg_text' => $text_message, 'msg_html' => $html_message, 'msg_subject' => $params['subject'], 'is_active' => TRUE);
$templateParams['msg_title'] = $composeParams['saveTemplateName'];
$msgTemplate = CRM_Core_BAO_MessageTemplate::add($templateParams);
}
if (isset($msgTemplate->id)) {
$params['msg_template_id'] = $msgTemplate->id;
} else {
$params['msg_template_id'] = CRM_Utils_Array::value('template', $formValues);
}
$this->set('template', $params['msg_template_id']);
}
CRM_Core_BAO_File::formatAttachment($formValues, $params, 'civicrm_mailing', $this->_mailingID);
$ids['mailing_id'] = $this->_mailingID;
//handle mailing from name & address.
$fromEmailAddress = CRM_Utils_Array::value($formValues['from_email_address'], CRM_Core_OptionGroup::values('from_email_address'));
//get the from email address
$params['from_email'] = CRM_Utils_Mail::pluckEmailFromHeader($fromEmailAddress);
//get the from Name
$params['from_name'] = CRM_Utils_Array::value(1, explode('"', $fromEmailAddress));
//Add Reply-To to headers
if (!empty($formValues['reply_to_address'])) {
$replyToEmail = CRM_Core_OptionGroup::values('from_email_address');
$params['replyto_email'] = CRM_Utils_Array::value($formValues['reply_to_address'], $replyToEmail);
}
/* Build the mailing object */
CRM_Mailing_BAO_Mailing::create($params, $ids);
if (isset($this->_submitValues['_qf_Upload_upload_save']) && $this->_submitValues['_qf_Upload_upload_save'] == 'Save & Continue Later') {
//when user perform mailing from search context
//redirect it to search result CRM-3711.
$ssID = $this->get('ssID');
if ($ssID && $this->_searchBasedMailing) {
if ($this->_action == CRM_Core_Action::BASIC) {
$fragment = 'search';
} elseif ($this->_action == CRM_Core_Action::PROFILE) {
$fragment = 'search/builder';
} elseif ($this->_action == CRM_Core_Action::ADVANCED) {
$fragment = 'search/advanced';
} else {
$fragment = 'search/custom';
}
$context = $this->get('context');
if (!CRM_Contact_Form_Search::isSearchContext($context)) {
$context = 'search';
}
$urlParams = "force=1&reset=1&ssID={$ssID}&context={$context}";
$qfKey = CRM_Utils_Request::retrieve('qfKey', 'String', $this);
if (CRM_Utils_Rule::qfKey($qfKey)) {
$urlParams .= "&qfKey={$qfKey}";
}
$session = CRM_Core_Session::singleton();
$draftURL = CRM_Utils_System::url('civicrm/mailing/browse/unscheduled', 'scheduled=false&reset=1');
$status = ts("You can continue later by clicking the 'Continue' action to resume working on it.<br />From <a href='%1'>Draft and Unscheduled Mailings</a>.", array(1 => $draftURL));
CRM_Core_Session::setStatus($status, ts('Mailing Saved'), 'success');
// Redirect user to search.
$url = CRM_Utils_System::url('civicrm/contact/' . $fragment, $urlParams);
} else {
$status = ts("Click the 'Continue' action to resume working on it.");
$url = CRM_Utils_System::url('civicrm/mailing/browse/unscheduled', 'scheduled=false&reset=1');
}
CRM_Core_Session::setStatus($status, ts('Mailing Saved'), 'success');
return $this->controller->setDestination($url);
}
}
开发者ID:BorislavZlatanov,项目名称:civicrm-core,代码行数:101,代码来源:Upload.php
示例6: taskName
/**
* Determine the form name based on the action. This allows us
* to avoid using conditional state machine, much more efficient
* and simpler
*
* @param CRM_Core_Controller $controller the controller object
*
* @return string the name of the form that will handle the task
* @access protected
*/
function taskName($controller, $formName = 'Search')
{
// total hack, check POST vars and then session to determine stuff
// fix value if print button is pressed
if (CRM_Utils_Array::value('_qf_' . $formName . '_next_print', $_POST)) {
$value = CRM_Contact_Task::PRINT_CONTACTS;
} else {
$value = CRM_Utils_Array::value('task', $_POST);
}
if (!isset($value)) {
$value = $this->_controller->get('task');
}
$this->_controller->set('task', $value);
if ($value) {
$componentMode = $this->_controller->get('component_mode');
require_once 'CRM/Contact/Form/Search.php';
$modeValue = CRM_Contact_Form_Search::getModeValue($componentMode);
require_once str_replace('_', DIRECTORY_SEPARATOR, $modeValue['taskClassName']) . '.php';
return eval("return {$modeValue['taskClassName']}::getTask( {$value} );");
} else {
return CRM_Contact_Task::getTask($value);
}
}
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:33,代码来源:Search.php
示例7: postProcess
public function postProcess()
{
$params = $ids = array();
$session = CRM_Core_Session::singleton();
$params['created_id'] = $session->get('userID');
$uploadParams = array('reply_id', 'unsubscribe_id', 'optout_id', 'resubscribe_id');
$uploadParamsBoolean = array('override_verp', 'forward_replies', 'url_tracking', 'open_tracking', 'auto_responder');
$qf_Settings_submit = $this->controller->exportValue($this->_name, '_qf_Settings_submit');
foreach ($uploadParams as $key) {
$params[$key] = $this->controller->exportvalue($this->_name, $key);
$this->set($key, $this->controller->exportvalue($this->_name, $key));
}
foreach ($uploadParamsBoolean as $key) {
if ($this->controller->exportvalue($this->_name, $key)) {
$params[$key] = TRUE;
} else {
$params[$key] = FALSE;
}
$this->set($key, $this->controller->exportvalue($this->_name, $key));
}
$params['visibility'] = $this->controller->exportvalue($this->_name, 'visibility');
// override_verp must be flipped, as in 3.2 we reverted
// its meaning to ‘should CiviMail manage replies?’ – i.e.,
// ‘should it *not* override Reply-To: with VERP-ed address?’
$params['override_verp'] = !$params['override_verp'];
$ids['mailing_id'] = $this->get('mailing_id');
// update mailing
CRM_Mailing_BAO_Mailing::create($params, $ids);
if ($qf_Settings_submit) {
//when user perform mailing from search context
//redirect it to search result CRM-3711.
$ssID = $this->get('ssID');
if ($ssID && $this->_searchBasedMailing) {
if ($this->_action == CRM_Core_Action::BASIC) {
$fragment = 'search';
} elseif ($this->_action == CRM_Core_Action::PROFILE) {
$fragment = 'search/builder';
} elseif ($this->_action == CRM_Core_Action::ADVANCED) {
$fragment = 'search/advanced';
} else {
$fragment = 'search/custom';
}
$context = $this->get('context');
if (!CRM_Contact_Form_Search::isSearchContext($context)) {
$context = 'search';
}
$urlParams = "force=1&reset=1&ssID={$ssID}&context={$context}";
$qfKey = CRM_Utils_Request::retrieve('qfKey', 'String', $this);
if (CRM_Utils_Rule::qfKey($qfKey)) {
$urlParams .= "&qfKey={$qfKey}";
}
$draftURL = CRM_Utils_System::url('civicrm/mailing/browse/unscheduled', 'scheduled=false&reset=1');
$status = ts("You can continue later by clicking the 'Continue' action to resume working on it.<br />From <a href='%1'>Draft and Unscheduled Mailings</a>.", array(1 => $draftURL));
// Redirect user to search.
$url = CRM_Utils_System::url('civicrm/contact/' . $fragment, $urlParams);
} else {
$status = ts("Click the 'Continue' action to resume working on it.");
$url = CRM_Utils_System::url('civicrm/mailing/browse/unscheduled', 'scheduled=false&reset=1');
}
CRM_Core_Session::setStatus($status, ts('Mailing Saved'), 'success');
CRM_Utils_System::redirect($url);
}
}
开发者ID:BorislavZlatanov,项目名称:civicrm-core,代码行数:63,代码来源:Settings.php
示例8: basic
static function basic(&$form)
{
$form->addElement('hidden', 'hidden_basic', 1);
if ($form->_searchOptions['contactType']) {
// add checkboxes for contact type
$contact_type = array();
$contactTypes = CRM_Contact_BAO_ContactType::getSelectElements();
if ($contactTypes) {
$form->add('select', 'contact_type', ts('Contact Type(s)'), $contactTypes, FALSE, array('id' => 'contact_type', 'multiple' => 'multiple', 'title' => ts('- select -')));
}
}
if ($form->_searchOptions['groups']) {
// multiselect for groups
if ($form->_group) {
$form->add('select', 'group', ts('Groups'), $form->_group, FALSE, array('id' => 'group', 'multiple' => 'multiple', 'title' => ts('- select -')));
}
}
if ($form->_searchOptions['tags']) {
// multiselect for categories
$contactTags = CRM_Core_BAO_Tag::getTags();
if ($contactTags) {
$form->add('select', 'contact_tags', ts('Tags'), $contactTags, FALSE, array('id' => 'contact_tags', 'multiple' => 'multiple', 'title' => ts('- select -')));
}
$parentNames = CRM_Core_BAO_Tag::getTagSet('civicrm_contact');
CRM_Core_Form_Tag::buildQuickForm($form, $parentNames, 'civicrm_contact', NULL, TRUE, FALSE, TRUE);
}
// add text box for last name, first name, street name, city
$form->addElement('text', 'sort_name', ts('Find...'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact', 'sort_name'));
// add text box for last name, first name, street name, city
$form->add('text', 'email', ts('Contact Email'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact', 'sort_name'));
//added contact source
$form->add('text', 'contact_source', ts('Contact Source'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact', 'source'));
//added job title
$attributes['job_title']['size'] = 30;
$form->addElement('text', 'job_title', ts('Job Title'), $attributes['job_title'], 'size="30"');
//added internal ID
$attributes['id']['size'] = 30;
$form->addElement('text', 'id', ts('Contact ID'), $attributes['id'], 'size="30"');
//added external ID
$attributes['external_identifier']['size'] = 30;
$form->addElement('text', 'external_identifier', ts('External ID'), $attributes['external_identifier'], 'size="30"');
$config = CRM_Core_Config::singleton();
if (CRM_Core_Permission::check('access deleted contacts') and $config->contactUndelete) {
$form->add('checkbox', 'deleted_contacts', ts('Search in Trash') . '<br />' . ts('(deleted contacts)'));
}
// add checkbox for cms users only
$form->addYesNo('uf_user', ts('CMS User?'));
// tag all search
$form->add('text', 'tag_search', ts('All Tags'));
// add search profiles
// FIXME: This is probably a part of profiles - need to be
// FIXME: eradicated from here when profiles are reworked.
$types = array('Participant', 'Contribution', 'Membership');
// get component profiles
$componentProfiles = array();
$componentProfiles = CRM_Core_BAO_UFGroup::getProfiles($types);
$ufGroups = CRM_Core_BAO_UFGroup::getModuleUFGroup('Search Profile', 1);
$accessibleUfGroups = CRM_Core_Permission::ufGroup(CRM_Core_Permission::VIEW);
$searchProfiles = array();
foreach ($ufGroups as $key => $var) {
if (!array_key_exists($key, $componentProfiles) && in_array($key, $accessibleUfGroups)) {
$searchProfiles[$key] = $var['title'];
}
}
$form->addElement('select', 'uf_group_id', ts('Search Views'), array('0' => ts('- default view -')) + $searchProfiles);
$componentModes = CRM_Contact_Form_Search::getModeSelect();
// unset contributions or participants if user does not have
// permission on them
if (!CRM_Core_Permission::access('CiviContribute')) {
unset($componentModes['2']);
}
if (!CRM_Core_Permission::access('CiviEvent')) {
unset($componentModes['3']);
}
if (!CRM_Core_Permission::access('CiviMember')) {
unset($componentModes['5']);
}
if (!CRM_Core_Permission::check('view all activities')) {
unset($componentModes['4']);
}
if (count($componentModes) > 1) {
$form->addElement('select', 'component_mode', ts('Display Results As'), $componentModes);
}
$form->addElement('select', 'operator', ts('Search Operator'), array('AND' => ts('AND'), 'OR' => ts('OR')));
// add the option to display relationships
$rTypes = CRM_Core_PseudoConstant::relationshipType();
$rSelect = array('' => ts('- Select Relationship Type-'));
foreach ($rTypes as $rid => $rValue) {
if ($rValue['label_a_b'] == $rValue['label_b_a']) {
$rSelect[$rid] = $rValue['label_a_b'];
} else {
$rSelect["{$rid}_a_b"] = $rValue['label_a_b'];
$rSelect["{$rid}_b_a"] = $rValue['label_b_a'];
}
}
$form->addElement('select', 'display_relationship_type', ts('Display Results as Relationship'), $rSelect);
// checkboxes for DO NOT phone, email, mail
// we take labels from SelectValues
$t = CRM_Core_SelectValues::privacy();
$form->add('select', 'privacy_options', ts('Privacy'), $t, FALSE, array('id' => 'privacy_options', 'multiple' => 'multiple', 'title' => ts('- select -')));
//.........这里部分代码省略.........
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:101,代码来源:Criteria.php
示例9: custom
/**
* Generate the custom Data Fields based for those with is_searchable = 1.
*
* @param CRM_Contact_Form_Search $form
*/
public static function custom(&$form)
{
$form->add('hidden', 'hidden_custom', 1);
$extends = array_merge(array('Contact', 'Individual', 'Household', 'Organization'), CRM_Contact_BAO_ContactType::subTypes());
$groupDetails = CRM_Core_BAO_CustomGroup::getGroupDetail(NULL, TRUE, $extends);
$form->assign('groupTree', $groupDetails);
foreach ($groupDetails as $key => $group) {
$_groupTitle[$key] = $group['name'];
CRM_Core_ShowHideBlocks::links($form, $group['name'], '', '');
foreach ($group['fields'] as $field) {
$fieldId = $field['id'];
$elementName = 'custom_' . $fieldId;
if ($field['data_type'] == 'Date' && $field['is_search_range']) {
CRM_Core_Form_Date::buildDateRange($form, $elementName, 1, '_from', '_to', ts('From:'), FALSE);
} else {
CRM_Core_BAO_CustomField::addQuickFormElement($form, $elementName, $fieldId, FALSE, FALSE, TRUE);
}
}
}
}
开发者ID:rameshrr99,项目名称:civicrm-core,代码行数:25,代码来源:Criteria.php
示例10: preProcess
/**
* processing needed for buildForm and later
*
* @return void
* @access public
*/
function preProcess()
{
/**
* set the varios class variables
*/
$this->_group =& CRM_Core_PseudoConstant::group();
$this->_tag =& CRM_Core_PseudoConstant::tag();
$this->_done = false;
/**
* set the button names
*/
$this->_searchButtonName = $this->getButtonName('refresh');
$this->_exportButtonName = $this->getButtonName('refresh', 'export');
$this->_printButtonName = $this->getButtonName('next', 'print');
$this->_actionButtonName = $this->getButtonName('next', 'action');
/*
* we allow the controller to set force/reset externally, useful when we are being
* driven by the wizard framework
*/
$nullObject = null;
$this->_reset = CRM_Utils_Request::retrieve('reset', $nullObject);
$this->_force = CRM_Utils_Request::retrieve('force', $this, false);
// we only force stuff once :)
$this->set('force', false);
$this->_groupID = CRM_Utils_Request::retrieve('gid', $this);
$this->_amtgID = CRM_Utils_Request::retrieve('amtgID', $this);
$this->_ssID = CRM_Utils_Request::retrieve('ssID', $this);
$this->_sortByCharacter = CRM_Utils_Request::retrieve('sortByCharacter', $this);
// get user submitted values
// get it from controller only if form has been submitted, else preProcess has set this
if (!empty($_POST)) {
$this->_formValues = $this->controller->exportValues($this->_name);
$this->normalizeFormValues();
// CRM_Core_Error::debug( 'fv', $this->_formValues );
// also reset the sort by character
$this->_sortByCharacter = null;
$this->set('sortByCharacter', null);
} else {
$this->_formValues = $this->get('formValues');
}
// we only retrieve the saved search values if out current values are null
if (empty($this->_formValues) && isset($this->_ssID)) {
$this->_formValues = CRM_Contact_BAO_SavedSearch::getFormValues($this->_ssID);
}
/*
* assign context to drive the template display, make sure context is valid
*/
$this->_context = CRM_Utils_Request::retrieve('context', $this, false, 'search');
if (!CRM_Utils_Array::value($this->_context, CRM_Contact_Form_Search::validContext())) {
$this->_context = 'search';
$this->set('context', $this->_context);
}
$this->assign('context', $this->_context);
$selector =& new CRM_Contact_Selector($this->_formValues, $this->_action);
$controller =& new CRM_Contact_Selector_Controller($selector, $this->get(CRM_UTILS_PAGER_PAGE_ID), $this->get(CRM_UTILS_SORT_SORT_ID), CRM_CORE_ACTION_VIEW, $this, CRM_CORE_SELECTOR_CONTROLLER_TRANSFER);
$controller->setEmbedded(true);
if ($this->_force) {
$this->postProcess();
/*
* Note that we repeat this, since the search creates and stores
* values that potentially change the controller behavior. i.e. things
* like totalCount etc
*/
$sortID = null;
if ($this->get(CRM_UTILS_SORT_SORT_ID)) {
$sortID = CRM_Utils_Sort::sortIDValue($this->get(CRM_UTILS_SORT_SORT_ID), $this->get(CRM_UTILS_SORT_SORT_DIRECTION));
}
$controller =& new CRM_Contact_Selector_Controller($selector, $this->get(CRM_UTILS_PAGER_PAGE_ID), $sortID, CRM_CORE_ACTION_VIEW, $this, CRM_CORE_SELECTOR_CONTROLLER_TRANSFER);
$controller->setEmbedded(true);
}
$controller->moveFromSessionToTemplate();
}
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:78,代码来源:Search.php
示例11: preProcess
/**
* Function to build the form
*
* @return None
* @access public
*/
function preProcess()
{
$this->_cdType = CRM_Utils_Array::value('type', $_GET);
$this->assign('cdType', false);
if ($this->_cdType) {
$this->assign('cdType', true);
return CRM_Custom_Form_CustomData::preProcess($this);
}
$this->_atypefile = CRM_Utils_Array::value('atypefile', $_GET);
$this->assign('atypefile', false);
if ($this->_atypefile) {
$this->assign('atypefile', true);
}
$this->_addAssigneeContact = CRM_Utils_Array::value('assignee_contact', $_GET);
$this->assign('addAssigneeContact', false);
if ($this->_addAssigneeContact) {
$this->assign('addAssigneeContact', true);
}
$this->_addTargetContact = CRM_Utils_Array::value('target_contact', $_GET);
$this->assign('addTargetContact', false);
if ($this->_addTargetContact) {
$this->assign('addTargetContact', true);
}
$session = CRM_Core_Session::singleton();
$this->_currentUserId = $session->get('userID');
//give the context.
if (!$this->_context) {
$this->_context = CRM_Utils_Request::retrieve('context', 'String', $this);
require_once 'CRM/Contact/Form/Search.php';
if (CRM_Contact_Form_Search::isSearchContext($this->_context)) {
$this->_context = 'search';
}
$this->_compContext = CRM_Utils_Request::retrieve('compContext', 'String', $this);
}
$this->assign('context', $this->_context);
$this->_action = CRM_Utils_Request::retrieve('action', 'String', $this);
if ($this->_action & CRM_Core_Action::DELETE) {
if (!CRM_Core_Permission::check('delete activities')) {
CRM_Core_Error::fatal(ts('You do not have permission to access this page'));
}
}
//CRM-6957
//when we come from contact search, activity id never comes.
//so don't try to get from object, it might gives you wrong one.
// if we're not adding new one, there must be an id to
// an activity we're trying to work on.
if ($this->_action != CRM_Core_Action::ADD && get_class($this->controller) != 'CRM_Contact_Controller_Search') {
$this->_activityId = CRM_Utils_Request::retrieve('id', 'Positive', $this);
}
$this->_currentlyViewedContactId = $this->get('contactId');
if (!$this->_currentlyViewedContactId) {
$this->_currentlyViewedContactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this);
}
$this->_activityTypeId = CRM_Utils_Request::retrieve('atype', 'Positive', $this);
$this->assign('atype', $this->_activityTypeId);
//check for required permissions, CRM-6264
require_once 'CRM/Case/BAO/Case.php';
if ($this->_activityId && in_array($this->_action, array(CRM_Core_Action::UPDATE, CRM_Core_Action::VIEW)) && !CRM_Activity_BAO_Activity::checkPermission($this->_activityId, $this->_action)) {
CRM_Core_Error::fatal(ts('You do not have permission to access this page.'));
}
if (!$this->_activityTypeId && $this->_activityId) {
$this->_activityTypeId = CRM_Core_DAO::getFieldValue('CRM_Activity_DAO_Activity', $this->_activityId, 'activity_type_id');
}
//Assigning Activity type name
if ($this->_activityTypeId) {
require_once 'CRM/Core/OptionGroup.php';
$activityTName = CRM_Core_OptionGroup::values('activity_type', false, false, false, 'AND v.value = ' . $this->_activityTypeId, 'name');
if ($activityTName[$this->_activityTypeId]) {
$this->assign('activityTName', $activityTName[$this->_activityTypeId]);
}
}
// Assign pageTitle to be "Activity - "+ activity name
$pageTitle = 'Activity - ' . CRM_Utils_Array::value($this->_activityTypeId, $activityTName);
$this->assign('pageTitle', $pageTitle);
//check the mode when this form is called either single or as
//search task action
if ($this->_activityTypeId || $this->_context == 'standalone' || $this->_currentlyViewedContactId) {
$this->_single = true;
$this->assign('urlPath', 'civicrm/activity');
} else {
//set the appropriate action
$url = CRM_Utils_System::currentPath();
$seachPath = array_pop(explode('/', $url));
$searchType = 'basic';
$this->_action = CRM_Core_Action::BASIC;
switch ($seachPath) {
case 'basic':
$searchType = $seachPath;
$this->_action = CRM_Core_Action::BASIC;
break;
case 'advanced':
$searchType = $seachPath;
$this->_action = CRM_Core_Action::ADVANCED;
break;
//.........这里部分代码省略.........
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:101,代码来源:Activity.php
示例12: postProcess
/**
* Process the posted form values. Approve /reject a mailing.
*/
public function postProcess()
{
// get the submitted form values.
$params = $this->controller->exportValues($this->_name);
$ids = array();
if (isset($this->_mailingID)) {
$ids['mailing_id'] = $this->_mailingID;
} else {
$ids['mailing_id'] = $this->get('mailing_id');
}
if (!$ids['mailing_id']) {
CRM_Core_Error::fatal();
}
$params['approver_id'] = $this->_contactID;
$params['approval_date'] = date('YmdHis');
// if rejected, then we need to reset the scheduled date and scheduled id
$rejectOptionID = CRM_Core_OptionGroup::getValue('mail_approval_status', 'Rejected', 'name');
if ($rejectOptionID && $params['approval_status_id'] == $rejectOptionID) {
$params['scheduled_id'] = 'null';
$params['scheduled_date'] = 'null';
// also delete any jobs associated with this mailing
$job = new CRM_Mailing_BAO_MailingJob();
$job->mailing_id = $ids['mailing_id'];
$job->delete();
} else {
$mailing = new CRM_Mailing_BAO_Mailing();
$mailing->id = $ids['mailing_id'];
$mailing->find(TRUE);
$params['scheduled_date'] = CRM_Utils_Date::processDate($mailing->scheduled_date);
}
CRM_Mailing_BAO_Mailing::create($params, $ids);
//when user perform mailing from search context
//redirect it to search result CRM-3711
$ssID = $this->get('ssID');
if ($ssID && $this->_searchBasedMailing) {
if ($this->_action == CRM_Core_Action::BASIC) {
$fragment = 'search';
} elseif ($this->_action == CRM_Core_Action::PROFILE) {
$fragment = 'search/builder';
} elseif ($this->_action == CRM_Core_Action::ADVANCED) {
$fragment = 'search/advanced';
} else {
$fragment = 'search/custom';
}
$context = $this->get('context');
if (!CRM_Contact_Form_Search::isSearchContext($context)) {
$context = 'search';
}
$urlParams = "force=1&reset=1&ssID={$ssID}&context={$context}";
$qfKey = CRM_Utils_Request::retrieve('qfKey', 'String', $this);
if (CRM_Utils_Rule::qfKey($qfKey)) {
$urlParams .= "&qfKey={$qfKey}";
}
$url = CRM_Utils_System::url('civicrm/contact/' . $fragment, $urlParams);
return $this->controller->setDestination($url);
}
$session = CRM_Core_Session::singleton();
$session->pushUserContext(CRM_Utils_System::url('civicrm/mailing/browse/scheduled', 'reset=1&scheduled=true'));
}
开发者ID:kcristiano,项目名称:civicrm-core,代码行数:62,代码来源:Approve.php
示例13: postProcess
/**
* Process the posted form values. Crea
|
请发表评论