本文整理汇总了PHP中CRM_Core_Session::setStatus方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_Session::setStatus方法的具体用法?PHP CRM_Core_Session::setStatus怎么用?PHP CRM_Core_Session::setStatus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_Session
的用法示例。
在下文中一共展示了CRM_Core_Session::setStatus方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postProcess
function postProcess()
{
$values = $this->exportValues();
$pcp_type_contact = $values['pcp_contact_id'];
$pcp_type = $values['pcp_type'];
$custom_group_name = CRM_Pcpteams_Constant::C_PCP_CUSTOM_GROUP_NAME;
$customGroupParams = array('version' => 3, 'sequential' => 1, 'name' => $custom_group_name);
$custom_group_ret = civicrm_api('CustomGroup', 'GET', $customGroupParams);
$customGroupID = $custom_group_ret['id'];
$customGroupTableName = $custom_group_ret['values'][0]['table_name'];
$query = "SELECT ct.pcp_type_contact as contactID FROM {$customGroupTableName} ct WHERE ct.pcp_type = '{$pcp_type}'";
$dao = CRM_Core_DAO::executeQuery($query);
$pcpFound = FALSE;
while ($dao->fetch()) {
if ($dao->contactID == $pcp_type_contact) {
CRM_Core_Session::setStatus(ts('PCP Found. Redirecting to dashboard'));
CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/pcp/dashboard', 'reset=1'));
$pcpFound = TRUE;
break;
}
}
if (!$pcpFound) {
CRM_Core_Session::setStatus(ts('PCP Not Found. Creating New PCP Record'));
$PcpID = $this->_pcpId;
$insertQuery = "\n INSERT INTO `civicrm_value_pcp_custom_set` (`id`, `entity_id`, `team_pcp_id`, `pcp_type`, `pcp_type_contact`) VALUES (NULL, {$PcpID}, NULL, '{$pcp_type}', {$pcp_type_contact})";
$dao = CRM_Core_DAO::executeQuery($insertQuery);
CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/pcp/dashboard', 'reset=1'));
}
//Fixme:
parent::postProcess();
}
示例2: run
function run()
{
// title
CRM_Utils_System::setTitle(ts('WindowSill'));
// config
// https://github.com/kreynen/civicrm-min/blob/master/CRM/Core/Extensions.php
$config = CRM_Core_Config::singleton();
if ($config->userFramework != 'Drupal') {
$error = "<div class='messages status no-popup'><div class='icon inform-icon'></div>Not a Drupal installation</div>";
} else {
$error = "<div class='messages status no-popup'><div class='icon inform-icon'></div>Drupal installation</div>";
}
// error
$this->assign('error', $error);
// on form action update settings
if (isset($_REQUEST['settings'])) {
// set
CRM_Core_BAO_Setting::setItem($_REQUEST['settings'], 'windowsill', 'settings');
// notice
CRM_Core_Session::setStatus(ts('Windowsill settings changed'), ts('Saved'), 'success');
}
// url
$url = CRM_Utils_System::url() . "civicrm/ctrl/windowsill";
$this->assign('url', $url);
// render
parent::run();
}
示例3: formatUnitSize
/**
* Format size.
*
*/
public static function formatUnitSize($size, $checkForPostMax = FALSE)
{
if ($size) {
$last = strtolower($size[strlen($size) - 1]);
switch ($last) {
// The 'G' modifier is available since PHP 5.1.0
case 'g':
$size *= 1024;
case 'm':
$size *= 1024;
case 'k':
$size *= 1024;
}
if ($checkForPostMax) {
$maxImportFileSize = self::formatUnitSize(ini_get('upload_max_filesize'));
$postMaxSize = self::formatUnitSize(ini_get('post_max_size'));
if ($maxImportFileSize > $postMaxSize && $postMaxSize == $size) {
CRM_Core_Session::setStatus(ts("Note: Upload max filesize ('upload_max_filesize') should not exceed Post max size ('post_max_size') as defined in PHP.ini, please check with your system administrator."), ts("Warning"), "alert");
}
//respect php.ini upload_max_filesize
if ($size > $maxImportFileSize && $size !== $postMaxSize) {
$size = $maxImportFileSize;
CRM_Core_Session::setStatus(ts("Note: Please verify your configuration for Maximum File Size (in MB) <a href='%1'>Administrator >> System Settings >> Misc</a>. It should support 'upload_max_size' as defined in PHP.ini.Please check with your system administrator.", array(1 => CRM_Utils_System::url('civicrm/admin/setting/misc', 'reset=1'))), ts("Warning"), "alert");
}
}
return $size;
}
}
示例4: postProcess
static function postProcess(&$form)
{
$values = $form->exportValues();
$orgName = $values['organization_name'];
$cSubType = CRM_Pcpteams_Constant::C_CONTACT_SUB_TYPE_TEAM;
$params = array('version' => '1', 'contact_type' => 'Organization', 'contact_sub_type' => $cSubType, 'organization_name' => $orgName);
$createTeam = civicrm_api3('Contact', 'create', $params);
// Create Dummy Team PCP Page
$teamPcpId = CRM_Pcpteams_Utils::createDefaultPcp($createTeam['id'], $form->get('component_page_id'));
// Create/Update custom record with team pcp id and create relationship with user as Team Admin
if ($teamPcpId) {
$userId = CRM_Pcpteams_Utils::getloggedInUserId();
CRM_Pcpteams_Utils::createTeamRelationship($userId, $createTeam['id'], $custom = array(), 'create');
$params = array('version' => 3, 'entity_id' => $form->get('page_id'), "team_pcp_id" => $teamPcpId);
$result = civicrm_api3('pcpteams', 'customcreate', $params);
$form->set('teamName', $orgName);
$form->set('teamContactID', $createTeam['id']);
$form->set('teamPcpId', $teamPcpId);
$actParams = array('target_contact_id' => $createTeam['id']);
CRM_Pcpteams_Utils::createPcpActivity($actParams, CRM_Pcpteams_Constant::C_AT_TEAM_CREATE);
CRM_Core_Session::setStatus(ts("Your Team %1 has been created, you can invite members from your team page.", array(1 => $orgName)), ts('New Team Created'));
} else {
CRM_Core_Session::setStatus(ts("Failed to Create Team \"{$orgName}\" ..."));
}
}
示例5: postProcess
/**
* Save values.
*/
public function postProcess()
{
$values = $this->exportValues();
try {
$result = civicrm_api3('Setting', 'create', array('statelegemail_key' => $values['key']));
$success = TRUE;
} catch (CiviCRM_API3_Exception $e) {
$error = $e->getMessage();
CRM_Core_Error::debug_log_message(t('API Error: %1', array(1 => $error, 'domain' => 'com.aghstrategies.statelegemail')));
CRM_Core_Session::setStatus(ts('Error saving Sunlight Foundation API key', array('domain' => 'com.aghstrategies.statelegemail')), 'Error', 'error');
$success = FALSE;
}
try {
$result = civicrm_api3('Setting', 'create', array('statelegemail_states' => $values['states']));
} catch (CiviCRM_API3_Exception $e) {
$error = $e->getMessage();
CRM_Core_Error::debug_log_message(t('API Error: %1', array(1 => $error, 'domain' => 'com.aghstrategies.statelegemail')));
CRM_Core_Session::setStatus(ts('Error saving enabled states', array('domain' => 'com.aghstrategies.statelegemail')), 'Error', 'error');
$success = FALSE;
}
if ($success) {
CRM_Core_Session::setStatus(ts('You have successfully updated the state legislator petition settings.', array('domain' => 'com.aghstrategies.statelegemail')), 'Settings saved', 'success');
}
parent::postProcess();
}
示例6: run
/**
* run this page (figure out the action needed and perform it).
*
* @return void
*/
function run()
{
if (!CRM_Core_Permission::check('administer Reports')) {
return CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/report/list', 'reset=1'));
}
$optionVal = CRM_Report_Utils_Report::getValueFromUrl();
$templateInfo = CRM_Core_OptionGroup::getRowValues('report_template', "{$optionVal}", 'value', 'String', FALSE);
$extKey = strpos(CRM_Utils_Array::value('name', $templateInfo), '.');
$reportClass = NULL;
if ($extKey !== FALSE) {
$ext = CRM_Extension_System::singleton()->getMapper();
$reportClass = $ext->keyToClass($templateInfo['name'], 'report');
$templateInfo['name'] = $reportClass;
}
if (strstr(CRM_Utils_Array::value('name', $templateInfo), '_Form') || !is_null($reportClass)) {
CRM_Utils_System::setTitle($templateInfo['label'] . ' - Template');
$this->assign('reportTitle', $templateInfo['label']);
$session = CRM_Core_Session::singleton();
$session->set('reportDescription', $templateInfo['description']);
$wrapper = new CRM_Utils_Wrapper();
return $wrapper->run($templateInfo['name'], NULL, NULL);
}
if ($optionVal) {
CRM_Core_Session::setStatus(ts('Could not find the report template. Make sure the report template is registered and / or url is correct.'), ts('Template Not Found'), 'error');
}
return CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/report/list', 'reset=1'));
}
示例7: buildQuickForm
function buildQuickForm()
{
require_once 'UK_Direct_Debit/Form/Main.php';
// If no civicrm_sd, then create that table
if (!CRM_Core_DAO::checkTableExists('civicrm_sd')) {
$creatSql = "CREATE TABLE `civicrm_sd` (\n `id` int(10) unsigned NOT NULL AUTO_INCREMENT,\n `start_date` datetime NOT NULL,\n `frequency_unit` enum('day','week','month','year') CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT 'month',\n `frequency_interval` int(10) unsigned DEFAULT NULL,\n\t\t\t\t\t`amount` decimal(20,2) DEFAULT NULL,\n `transaction_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,\n `contact_id` int(10) unsigned DEFAULT NULL,\n `external_id` int(10) unsigned DEFAULT NULL,\n `membership_id` int(10) unsigned DEFAULT NULL,\n `member_count` int(10) unsigned DEFAULT NULL,\n `payment_processor_id` varchar(255) DEFAULT NULL,\n `payment_instrument_id` int(10) unsigned DEFAULT NULL,\n `cycle_day` int(10) unsigned NOT NULL DEFAULT '1',\n `contribution_status_id` int(10) DEFAULT '1',\n `is_valid` int(4) NOT NULL DEFAULT '1',\n `payerReference` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,\n\t `recur_id` int(10) unsigned DEFAULT NULL,\n PRIMARY KEY (`id`)\n ) ENGINE=InnoDB AUTO_INCREMENT=350 DEFAULT CHARSET=latin1";
CRM_Core_DAO::executeQuery($creatSql);
$columnExists = CRM_Core_DAO::checkFieldExists('civicrm_contribution_recur', 'membership_id');
if (!$columnExists) {
$query = "\n ALTER TABLE civicrm_contribution_recur\n ADD membership_id int(10) unsigned AFTER contact_id,\n ADD CONSTRAINT FK_civicrm_contribution_recur_membership_id\n FOREIGN KEY(membership_id) REFERENCES civicrm_membership(id) ON DELETE CASCADE ON UPDATE RESTRICT";
CRM_Core_DAO::executeQuery($query);
}
} else {
$emptySql = "TRUNCATE TABLE `civicrm_sd`";
CRM_Core_DAO::executeQuery($emptySql);
}
$smartDebitArray = self::getSmartDebitPayments(NULL);
foreach ($smartDebitArray as $key => $smartDebitRecord) {
if ($smartDebitRecord['current_state'] == 10 || $smartDebitRecord['current_state'] == 1 || $smartDebitRecord['current_state'] == 11) {
$regularAmount = substr($smartDebitRecord['regular_amount'], 2);
// Extract the number from reference_number
$output = preg_match("/\\d+/", $smartDebitRecord['reference_number'], $results);
if ($regularAmount && $results[0]) {
list($y, $m, $d) = explode('-', $smartDebitRecord['start_date']);
$sql = "INSERT INTO `civicrm_sd`(`start_date`, `frequency_unit`, `amount`, `transaction_id`, `external_id`, `payment_processor_id`, `payment_instrument_id`, `cycle_day`, `contribution_status_id`, `frequency_interval`, `payerReference`) VALUES (%1,%2,%3,%4,%5,%6,%7,%8,%9,%10,%11)";
$params = array(1 => array($smartDebitRecord['start_date'], 'String'), 2 => array(self::translateSmartDebitFrequencyUnit($smartDebitRecord['frequency_type']), 'String'), 3 => array($regularAmount, 'Float'), 4 => array($smartDebitRecord['reference_number'], 'String'), 5 => array($results[0], 'Int'), 6 => array(self::getSmartDebitPaymentProcessorID(), 'Int'), 7 => array(5, 'Int'), 8 => array($d, 'Int'), 9 => array(5, 'Int'), 10 => array($smartDebitRecord['frequency_factor'], 'Int'), 11 => array($smartDebitRecord['payerReference'], 'String'));
CRM_Core_DAO::executeQuery($sql, $params);
}
}
}
if ($smartDebitArray) {
CRM_Core_Session::setStatus('Smart debit data retreived successfully.', 'Success', 'info');
}
}
示例8: browse
/**
* Browse all jobs.
*
* @param null $action
*
* @return void
*/
public function browse($action = NULL)
{
$qm = new CRM_Queryrunner_QueryManager();
// using Export action for Execute. Doh.
if ($this->_action & CRM_Core_Action::EXPORT) {
$qm->execute($this->_id, TRUE);
$name = $qm->getNameFromId($this->_id);
CRM_Core_Session::setStatus(ts("The {$name} query has been executed."), ts("Executed"), "success");
}
$freqs = CRM_Queryrunner_Query::getQueryFrequency();
$rows = array();
foreach ($qm->queries as $query) {
$action = array_sum(array_keys($this->links()));
if ($query->is_active) {
$action -= CRM_Core_Action::ENABLE;
} else {
$action -= CRM_Core_Action::DISABLE;
}
$query->action = CRM_Core_Action::formLink(self::links(), $action, array('id' => $query->id), ts('more'), FALSE, 'query.manage.action', 'Query', $query->id);
$query->last_run = $query->last_run ? date('M j, Y, g:ia', $query->last_run) : 'never';
$query->scheduled_run = $query->scheduled_run ? date('M j, Y, g:ia', $query->scheduled_run) : '';
$query->run_frequency = $freqs[$query->run_frequency];
$query = get_object_vars($query);
$rows[] = $query;
if ($query['id'] == $this->_id) {
$this->assign('query', $query);
}
}
$this->assign('rows', $rows);
if ($this->_action & CRM_Core_Action::PREVIEW) {
$this->assign('server', isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : (isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : ''));
$this->assign('doc_root', $_SERVER['DOCUMENT_ROOT']);
}
}
示例9: postProcess
/**
* Process the form submission.
*/
public function postProcess()
{
$params = $this->controller->exportValues($this->_name);
if ($this->_action & CRM_Core_Action::DELETE) {
CRM_Core_Session::setStatus("", ts("Batch Deleted"), "success");
CRM_Batch_BAO_Batch::deleteBatch($this->_id);
return;
}
if ($this->_id) {
$params['id'] = $this->_id;
} else {
$session = CRM_Core_Session::singleton();
$params['created_id'] = $session->get('userID');
$params['created_date'] = CRM_Utils_Date::processDate(date("Y-m-d"), date("H:i:s"));
}
// always create with data entry status
$params['status_id'] = CRM_Core_OptionGroup::getValue('batch_status', 'Data Entry', 'name');
$batch = CRM_Batch_BAO_Batch::create($params);
// redirect to batch entry page.
$session = CRM_Core_Session::singleton();
if ($this->_action & CRM_Core_Action::ADD) {
$session->replaceUserContext(CRM_Utils_System::url('civicrm/batch/entry', "id={$batch->id}&reset=1&action=add"));
} else {
$session->replaceUserContext(CRM_Utils_System::url('civicrm/batch/entry', "id={$batch->id}&reset=1"));
}
}
示例10: postProcess
/**
* Form submission of new/edit api is processed.
*
* @access public
*
* @return None
*/
public function postProcess()
{
//get the submitted values in an array
$params = $this->controller->exportValues($this->_name);
// Save the API Key & Save the Security Key
if (CRM_Utils_Array::value('api_key', $params)) {
CRM_Core_BAO_Setting::setItem($params['api_key'], self::MC_SETTING_GROUP, 'api_key');
}
$session = CRM_Core_Session::singleton();
$message = "Api Key has been Saved!";
$session->setStatus($message, ts('Api Key Saved'), 'success');
$urlParams = null;
$session->replaceUserContext(CRM_Utils_System::url('civicrm/mailchimp/apikeyregister', $urlParams));
try {
$mcClient = new Mailchimp($params['api_key']);
$mcHelper = new Mailchimp_Helper($mcClient);
$details = $mcHelper->accountDetails();
} catch (Mailchimp_Invalid_ApiKey $e) {
CRM_Core_Session::setStatus($e->getMessage());
return FALSE;
} catch (Mailchimp_HttpError $e) {
CRM_Core_Session::setStatus($e->getMessage());
return FALSE;
}
$message = "Following is the account information received from API callback:<br/>\n <table class='mailchimp-table'>\n <tr><td>Company:</td><td>{$details['contact']['company']}</td></tr>\n <tr><td>First Name:</td><td>{$details['contact']['fname']}</td></tr>\n <tr><td>Last Name:</td><td>{$details['contact']['lname']}</td></tr>\n </table>";
CRM_Core_Session::setStatus($message);
}
示例11: run
function run()
{
require_once 'CRM/Utils/Request.php';
require_once 'CRM/Core/DAO.php';
$eid = CRM_Utils_Request::retrieve('eid', 'Positive', $this, true);
$fid = CRM_Utils_Request::retrieve('fid', 'Positive', $this, false);
$id = CRM_Utils_Request::retrieve('id', 'Positive', $this, true);
$quest = CRM_Utils_Request::retrieve('quest', 'String', $this);
$action = CRM_Utils_Request::retrieve('action', 'String', $this);
require_once 'CRM/Core/BAO/File.php';
list($path, $mimeType) = CRM_Core_BAO_File::path($id, $eid, null, $quest);
if (!$path) {
CRM_Core_Error::statusBounce('Could not retrieve the file');
}
$buffer = file_get_contents($path);
if (!$buffer) {
CRM_Core_Error::statusBounce('The file is either empty or you do not have permission to retrieve the file');
}
if ($action & CRM_Core_Action::DELETE) {
if (CRM_Utils_Request::retrieve('confirmed', 'Boolean', CRM_Core_DAO::$_nullObject)) {
CRM_Core_BAO_File::delete($id, $eid, $fid);
CRM_Core_Session::setStatus(ts('The attached file has been deleted.'));
$session = CRM_Core_Session::singleton();
$toUrl = $session->popUserContext();
CRM_Utils_System::redirect($toUrl);
} else {
$wrapper = new CRM_Utils_Wrapper();
return $wrapper->run('CRM_Custom_Form_DeleteFile', ts('Domain Information Page'), null);
}
} else {
require_once 'CRM/Utils/File.php';
CRM_Utils_System::download(CRM_Utils_File::cleanFileName(basename($path)), $mimeType, $buffer);
}
}
示例12: run
/**
* @return string
*/
function run()
{
$errorMessage = '';
// ensure that all CiviCRM tables are InnoDB, else abort
// this is not a very fast operation, so we do it randomly 10% of the times
// but we do it for most / all tables
// http://bugs.mysql.com/bug.php?id=43664
if (rand(1, 10) == 3 && CRM_Core_DAO::isDBMyISAM(150)) {
$errorMessage = ts('Your database is configured to use the MyISAM database engine. CiviCRM requires InnoDB. You will need to convert any MyISAM tables in your database to InnoDB. Using MyISAM tables will result in data integrity issues.');
CRM_Core_Session::setStatus($errorMessage, ts('Warning'), "alert");
}
if (!CRM_Utils_System::isDBVersionValid($errorMessage)) {
CRM_Core_Session::setStatus($errorMessage, ts('Warning'), "alert", array('expires' => 0));
}
$groups = array('Customize Data and Screens' => ts('Customize Data and Screens'), 'Communications' => ts('Communications'), 'Localization' => ts('Localization'), 'Users and Permissions' => ts('Users and Permissions'), 'System Settings' => ts('System Settings'));
$config = CRM_Core_Config::singleton();
if (in_array('CiviContribute', $config->enableComponents)) {
$groups['CiviContribute'] = ts('CiviContribute');
}
if (in_array('CiviMember', $config->enableComponents)) {
$groups['CiviMember'] = ts('CiviMember');
}
if (in_array('CiviEvent', $config->enableComponents)) {
$groups['CiviEvent'] = ts('CiviEvent');
}
if (in_array('CiviMail', $config->enableComponents)) {
$groups['CiviMail'] = ts('CiviMail');
}
if (in_array('CiviCase', $config->enableComponents)) {
$groups['CiviCase'] = ts('CiviCase');
}
if (in_array('CiviReport', $config->enableComponents)) {
$groups['CiviReport'] = ts('CiviReport');
}
if (in_array('CiviCampaign', $config->enableComponents)) {
$groups['CiviCampaign'] = ts('CiviCampaign');
}
$values = CRM_Core_Menu::getAdminLinks();
$this->_showHide = new CRM_Core_ShowHideBlocks();
foreach ($groups as $group => $title) {
$groupId = str_replace(' ', '_', $group);
$this->_showHide->addShow("id_{$groupId}_show");
$this->_showHide->addHide("id_{$groupId}");
$v = CRM_Core_ShowHideBlocks::links($this, $groupId, '', '', FALSE);
if (isset($values[$group])) {
$adminPanel[$groupId] = $values[$group];
$adminPanel[$groupId]['show'] = $v['show'];
$adminPanel[$groupId]['hide'] = $v['hide'];
$adminPanel[$groupId]['title'] = $title;
} else {
$adminPanel[$groupId] = array();
$adminPanel[$groupId]['show'] = '';
$adminPanel[$groupId]['hide'] = '';
$adminPanel[$groupId]['title'] = $title;
}
}
$this->assign('adminPanel', $adminPanel);
$this->_showHide->addToTemplate();
return parent::run();
}
示例13: postProcess
/**
* Function to process the form
*
* @access public
*
* @return None
*/
public function postProcess()
{
$params = $this->controller->exportValues($this->_name);
if (self::updateSettingsWithDAO($params)) {
CRM_Core_Session::setStatus(ts('Training settings saved.'));
}
}
示例14: pre
/**
* Method to process civicrm pre hook:
* If objectName = GroupContact and Group is a protected group, check if user has permission.
* When user does not have permission, redirect to user context with status message
*
*/
public static function pre($op, $objectName, $objectId, $params)
{
if ($objectName == 'GroupContact' && self::groupIsProtected($objectId) == TRUE) {
// check if request is from webform, and allow groupcontact action if from webform
$webFormRequest = FALSE;
$request = CRM_Utils_Request::exportValues();
if (isset($request['form_id'])) {
$requestParts = explode('_', $request['form_id']);
if (isset($requestParts[2])) {
if ($requestParts[0] == 'webform' && $requestParts[1] == 'client' && ($requestParts[2] = 'form')) {
$webFormRequest = TRUE;
}
}
}
if (!$webFormRequest) {
if (!CRM_Core_Permission::check('manage protected groups')) {
CRM_Core_Session::setStatus(ts("You are not allowed to add or remove contacts to this group"), ts("Not allowed"), "error");
// if from report, redirect to report instance
if (isset($request['q']) && substr($request['q'], 0, 15) == "civicrm/report/") {
CRM_Utils_System::redirect(CRM_Utils_System::url($request['q'], 'reset=1', true));
} else {
$session = CRM_Core_Session::singleton();
CRM_Utils_System::redirect($session->readUserContext());
}
}
}
}
}
示例15: buildForm
function buildForm(&$form)
{
$groups =& CRM_Core_PseudoConstant::group();
$tags =& CRM_Core_PseudoConstant::tag();
if (count($groups) == 0 || count($tags) == 0) {
CRM_Core_Session::setStatus(ts("Atleast one Group and Tag must be present, for Custom Group / Tag search."));
$url = CRM_Utils_System::url('civicrm/contact/search/custom/list', 'reset=1');
CRM_Utils_System::redirect($url);
}
$inG =& $form->addElement('advmultiselect', 'includeGroups', ts('Include Group(s)') . ' ', $groups, array('size' => 5, 'style' => 'width:240px', 'class' => 'advmultiselect'));
$outG =& $form->addElement('advmultiselect', 'excludeGroups', ts('Exclude Group(s)') . ' ', $groups, array('size' => 5, 'style' => 'width:240px', 'class' => 'advmultiselect'));
$andOr =& $form->addElement('checkbox', 'andOr', 'Combine With (AND, Uncheck For OR)', null, array('checked' => 'checked'));
$int =& $form->addElement('advmultiselect', 'includeTags', ts('Include Tag(s)') . ' ', $tags, array('size' => 5, 'style' => 'width:240px', 'class' => 'advmultiselect'));
$outt =& $form->addElement('advmultiselect', 'excludeTags', ts('Exclude Tag(s)') . ' ', $tags, array('size' => 5, 'style' => 'width:240px', 'class' => 'advmultiselect'));
//add/remove buttons for groups
$inG->setButtonAttributes('add', array('value' => ts('Add >>')));
$outG->setButtonAttributes('add', array('value' => ts('Add >>')));
$inG->setButtonAttributes('remove', array('value' => ts('<< Remove')));
$outG->setButtonAttributes('remove', array('value' => ts('<< Remove')));
//add/remove buttons for tags
$int->setButtonAttributes('add', array('value' => ts('Add >>')));
$outt->setButtonAttributes('add', array('value' => ts('Add >>')));
$int->setButtonAttributes('remove', array('value' => ts('<< Remove')));
$outt->setButtonAttributes('remove', array('value' => ts('<< Remove')));
/**
* if you are using the standard template, this array tells the template what elements
* are part of the search criteria
*/
$form->assign('elements', array('includeGroups', 'excludeGroups', 'andOr', 'includeTags', 'excludeTags'));
}