本文整理汇总了PHP中CRM_Case_BAO_Case::restoreCase方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Case_BAO_Case::restoreCase方法的具体用法?PHP CRM_Case_BAO_Case::restoreCase怎么用?PHP CRM_Case_BAO_Case::restoreCase使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Case_BAO_Case
的用法示例。
在下文中一共展示了CRM_Case_BAO_Case::restoreCase方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postProcess
/**
* process the form after the input has been submitted and validated
*
* @access public
*
* @return None
*/
public function postProcess()
{
$restoredCases = 0;
foreach ($this->_caseIds as $caseId) {
if (CRM_Case_BAO_Case::restoreCase($caseId)) {
$restoredCases++;
}
}
CRM_Core_Session::setStatus($restoredCases, ts('Restored Cases'), 'success');
CRM_Core_Session::setStatus('', ts('Total Selected Case(s): %1', array(1 => count($this->_caseIds))), 'info');
}
示例2: postProcess
/**
* process the form after the input has been submitted and validated
*
* @access public
* @return None
*/
public function postProcess()
{
$restoredCases = 0;
require_once 'CRM/Case/BAO/Case.php';
foreach ($this->_caseIds as $caseId) {
if (CRM_Case_BAO_Case::restoreCase($caseId)) {
$restoredCases++;
}
}
$status = array(ts('Restored Case(s): %1', array(1 => $restoredCases)), ts('Total Selected Case(s): %1', array(1 => count($this->_caseIds))));
CRM_Core_Session::setStatus($status);
}
示例3: postProcess
/**
* Process the form after the input has been submitted and validated.
*/
public function postProcess()
{
$restoredCases = $failed = 0;
foreach ($this->_caseIds as $caseId) {
if (CRM_Case_BAO_Case::restoreCase($caseId)) {
$restoredCases++;
} else {
$failed++;
}
}
if ($restoredCases) {
$msg = ts('%count case restored from trash.', array('plural' => '%count cases restored from trash.', 'count' => $restoredCases));
CRM_Core_Session::setStatus($msg, ts('Restored'), 'success');
}
if ($failed) {
CRM_Core_Session::setStatus(ts('1 could not be restored.', array('plural' => '%count could not be restored.', 'count' => $failed)), ts('Error'), 'error');
}
}
示例4: postProcess
/**
* Function to process the form
*
* @access public
*
* @return None
*/
public function postProcess()
{
$tx = new CRM_Core_Transaction();
// check if dedupe button, if so return.
$buttonName = $this->controller->getButtonName();
if (isset($this->_dedupeButtonName) && $buttonName == $this->_dedupeButtonName) {
return;
}
if ($this->_action & CRM_Core_Action::DELETE) {
$statusMsg = NULL;
$caseDelete = CRM_Case_BAO_Case::deleteCase($this->_caseId, TRUE);
if ($caseDelete) {
$statusMsg = ts('The selected case has been moved to the Trash. You can view and / or restore deleted cases by checking the "Deleted Cases" option under Find Cases.<br />');
}
CRM_Core_Session::setStatus($statusMsg);
return;
}
if ($this->_action & CRM_Core_Action::RENEW) {
$statusMsg = NULL;
$caseRestore = CRM_Case_BAO_Case::restoreCase($this->_caseId);
if ($caseRestore) {
$statusMsg = ts('The selected case has been restored.<br />');
}
CRM_Core_Session::setStatus($statusMsg);
return;
}
// store the submitted values in an array
$params = $this->controller->exportValues($this->_name);
$params['now'] = date("Ymd");
// 1. call begin post process
if ($this->_activityTypeFile) {
eval("CRM_Case_Form_Activity_{$this->_activityTypeFile}" . "::beginPostProcess( \$this, \$params );");
}
if (CRM_Utils_Array::value('hidden_custom', $params) && !isset($params['custom'])) {
$customFields = array();
$params['custom'] = CRM_Core_BAO_CustomField::postProcess($params, $customFields, NULL, 'Case');
}
// 2. create/edit case
if (CRM_Utils_Array::value('case_type_id', $params)) {
$caseType = CRM_Case_PseudoConstant::caseType('name');
$params['case_type'] = $caseType[$params['case_type_id']];
$params['subject'] = $params['activity_subject'];
$params['case_type_id'] = CRM_Core_DAO::VALUE_SEPARATOR . $params['case_type_id'] . CRM_Core_DAO::VALUE_SEPARATOR;
}
$caseObj = CRM_Case_BAO_Case::create($params);
$params['case_id'] = $caseObj->id;
// unset any ids, custom data
unset($params['id'], $params['custom']);
// add tags if exists
$tagParams = array();
if (!empty($params['tag'])) {
$tagParams = array();
foreach ($params['tag'] as $tag) {
$tagParams[$tag] = 1;
}
}
CRM_Core_BAO_EntityTag::create($tagParams, 'civicrm_case', $caseObj->id);
//save free tags
if (isset($params['case_taglist']) && !empty($params['case_taglist'])) {
CRM_Core_Form_Tag::postProcess($params['case_taglist'], $caseObj->id, 'civicrm_case', $this);
}
// user context
$url = CRM_Utils_System::url('civicrm/contact/view/case', "reset=1&action=view&cid={$this->_currentlyViewedContactId}&id={$caseObj->id}");
$session = CRM_Core_Session::singleton();
$session->pushUserContext($url);
// 3. format activity custom data
if (CRM_Utils_Array::value('hidden_custom', $params)) {
$customFields = CRM_Core_BAO_CustomField::getFields('Activity', FALSE, FALSE, $this->_activityTypeId);
$customFields = CRM_Utils_Array::crmArrayMerge($customFields, CRM_Core_BAO_CustomField::getFields('Activity', FALSE, FALSE, NULL, NULL, TRUE));
$params['custom'] = CRM_Core_BAO_CustomField::postProcess($params, $customFields, $this->_activityId, 'Activity');
}
// 4. call end post process
if ($this->_activityTypeFile) {
eval("CRM_Case_Form_Activity_{$this->_activityTypeFile}" . "::endPostProcess( \$this, \$params );");
}
// 5. auto populate activites
// 6. set status
CRM_Core_Session::setStatus("{$params['statusMsg']}");
}
示例5: postProcess
/**
* Function to process the form
*
* @access public
* @return None
*/
public function postProcess()
{
// check if dedupe button, if so return.
$buttonName = $this->controller->getButtonName();
if ($buttonName == $this->_dedupeButtonName) {
return;
}
if ($this->_action & CRM_Core_Action::DELETE) {
$statusMsg = null;
require_once 'CRM/Case/BAO/Case.php';
$caseDelete = CRM_Case_BAO_Case::deleteCase($this->_caseId, true);
if ($caseDelete) {
$statusMsg = ts('The selected case has been moved to the Trash. You can view and / or restore deleted cases by checking the "Deleted Cases" option under Find Cases.<br />');
}
CRM_Core_Session::setStatus($statusMsg);
return;
}
if ($this->_action & CRM_Core_Action::RENEW) {
$statusMsg = null;
require_once 'CRM/Case/BAO/Case.php';
$caseRestore = CRM_Case_BAO_Case::restoreCase($this->_caseId);
if ($caseRestore) {
$statusMsg = ts('The selected case has been restored.<br />');
}
CRM_Core_Session::setStatus($statusMsg);
return;
}
// store the submitted values in an array
$params = $this->controller->exportValues($this->_name);
$params['now'] = date("Ymd");
require_once 'CRM/Case/XMLProcessor/Process.php';
// 1. call begin post process
if ($this->_activityTypeFile) {
eval("CRM_Case_Form_Activity_{$this->_activityTypeFile}" . "::beginPostProcess( \$this, \$params );");
}
// 2. create/edit case
require_once 'CRM/Case/BAO/Case.php';
if (CRM_Utils_Array::value('case_type_id', $params)) {
$caseType = CRM_Core_OptionGroup::values('case_type', false, false, false, null, 'name');
$params['case_type'] = $caseType[$params['case_type_id']];
$params['case_type_id'] = CRM_Case_BAO_Case::VALUE_SEPERATOR . $params['case_type_id'] . CRM_Case_BAO_Case::VALUE_SEPERATOR;
}
$caseObj = CRM_Case_BAO_Case::create($params);
$params['case_id'] = $caseObj->id;
// unset any ids, custom data
unset($params['id'], $params['custom']);
// user context
$url = CRM_Utils_System::url('civicrm/contact/view/case', "reset=1&action=view&cid={$this->_currentlyViewedContactId}&id={$caseObj->id}");
$session =& CRM_Core_Session::singleton();
$session->pushUserContext($url);
// 3. format activity custom data
if (CRM_Utils_Array::value('hidden_custom', $params)) {
$customFields = CRM_Core_BAO_CustomField::getFields('Activity', false, false, $this->_activityTypeId);
$customFields = CRM_Utils_Array::crmArrayMerge($customFields, CRM_Core_BAO_CustomField::getFields('Activity', false, false, null, null, true));
$params['custom'] = CRM_Core_BAO_CustomField::postProcess($params, $customFields, $this->_activityId, 'Activity');
}
// 4. call end post process
if ($this->_activityTypeFile) {
eval("CRM_Case_Form_Activity_{$this->_activityTypeFile}" . "::endPostProcess( \$this, \$params );");
}
// 5. auto populate activites
// 6. set status
CRM_Core_Session::setStatus("{$params['statusMsg']}");
}