本文整理汇总了PHP中CRM_Grant_BAO_Grant::del方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Grant_BAO_Grant::del方法的具体用法?PHP CRM_Grant_BAO_Grant::del怎么用?PHP CRM_Grant_BAO_Grant::del使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Grant_BAO_Grant
的用法示例。
在下文中一共展示了CRM_Grant_BAO_Grant::del方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postProcess
/**
* process the form after the input has been submitted and validated
*
* @access public
*
* @return void
*/
public function postProcess()
{
$deletedGrants = 0;
foreach ($this->_grantIds as $grantId) {
if (CRM_Grant_BAO_Grant::del($grantId)) {
$deletedGrants++;
}
}
CRM_Core_Session::setStatus(ts('Deleted Grant(s): %1', array(1 => $deletedGrants)), '', 'info');
CRM_Core_Session::setStatus(ts('Total Selected Grant(s): %1', array(1 => count($this->_grantIds))), '', 'info');
}
示例2: postProcess
/**
* process the form after the input has been submitted and validated
*
* @access public
* @return None
*/
public function postProcess()
{
$deletedGrants = 0;
require_once 'CRM/Grant/BAO/Grant.php';
foreach ($this->_grantIds as $grantId) {
if (CRM_Grant_BAO_Grant::del($grantId)) {
$deletedGrants++;
}
}
$status = array(ts('Deleted Grant(s): %1', array(1 => $deletedGrants)), ts('Total Selected Grant(s): %1', array(1 => count($this->_grantIds))));
CRM_Core_Session::setStatus($status);
}
示例3: postProcess
/**
* Process the form after the input has been submitted and validated.
*
*
* @return void
*/
public function postProcess()
{
$deleted = $failed = 0;
foreach ($this->_grantIds as $grantId) {
if (CRM_Grant_BAO_Grant::del($grantId)) {
$deleted++;
} else {
$failed++;
}
}
if ($deleted) {
$msg = ts('%count grant deleted.', array('plural' => '%count grants deleted.', 'count' => $deleted));
CRM_Core_Session::setStatus($msg, ts('Removed'), 'success');
}
if ($failed) {
CRM_Core_Session::setStatus(ts('1 could not be deleted.', array('plural' => '%count could not be deleted.', 'count' => $failed)), ts('Error'), 'error');
}
}
示例4: postProcess
/**
* Function to process the form
*
* @access public
* @return None
*/
public function postProcess()
{
if ($this->_action & CRM_Core_Action::DELETE) {
require_once 'CRM/Grant/BAO/Grant.php';
CRM_Grant_BAO_Grant::del($this->_id);
return;
}
if ($this->_action & CRM_Core_Action::UPDATE) {
$ids['grant'] = $this->_id;
}
// get the submitted form values.
$params = $this->controller->exportValues($this->_name);
if (!$params['grant_report_received']) {
$params['grant_report_received'] = "null";
}
// set the contact, when contact is selected
if (CRM_Utils_Array::value('contact_select_id', $params)) {
$this->_contactID = $params['contact_select_id'][1];
}
$params['contact_id'] = $this->_contactID;
$dates = array('application_received_date', 'decision_date', 'money_transfer_date', 'grant_due_date');
foreach ($dates as $d) {
$params[$d] = CRM_Utils_Date::processDate($params[$d], null, true);
}
$ids['note'] = array();
if ($this->_noteId) {
$ids['note']['id'] = $this->_noteId;
}
// process custom data
$customFields = CRM_Core_BAO_CustomField::getFields('Grant');
$params['custom'] = CRM_Core_BAO_CustomField::postProcess($params, $customFields, $this->_id, 'Grant');
// add attachments as needed
CRM_Core_BAO_File::formatAttachment($params, $params, 'civicrm_grant', $this->_id);
require_once 'CRM/Grant/BAO/Grant.php';
$grant = CRM_Grant_BAO_Grant::create($params, $ids);
$buttonName = $this->controller->getButtonName();
$session = CRM_Core_Session::singleton();
if ($this->_context == 'standalone') {
if ($buttonName == $this->getButtonName('upload', 'new')) {
$session->replaceUserContext(CRM_Utils_System::url('civicrm/grant/add', 'reset=1&action=add&context=standalone'));
} else {
$session->replaceUserContext(CRM_Utils_System::url('civicrm/contact/view', "reset=1&cid={$this->_contactID}&selectedChild=grant"));
}
} else {
if ($buttonName == $this->getButtonName('upload', 'new')) {
$session->replaceUserContext(CRM_Utils_System::url('civicrm/contact/view/grant', "reset=1&action=add&context=grant&cid={$this->_contactID}"));
}
}
}
示例5: setContext
function setContext()
{
$context = CRM_Utils_Request::retrieve('context', 'String', $this);
$this->_id = CRM_Utils_Request::retrieve('id', 'Integer', $this);
$session = CRM_Core_Session::singleton();
$qfKey = CRM_Utils_Request::retrieve('key', 'String', $this);
//validate the qfKey
if (!CRM_Utils_Rule::qfKey($qfKey)) {
$qfKey = NULL;
}
switch ($context) {
case 'search':
$urlParams = 'force=1';
if ($qfKey) {
$urlParams .= "&qfKey={$qfKey}";
}
$this->assign('searchKey', $qfKey);
$url = CRM_Utils_System::url('civicrm/grant/search', $urlParams);
break;
case 'dashboard':
$url = CRM_Utils_System::url('civicrm/grant', 'reset=1');
break;
case 'edit':
$url = CRM_utils_System::url('civicrm/contact/view/grant', 'reset=1&id=' . $this->_id . '&cid=' . $this->_contactId . '&action=view&context=grant&selectedChild=grant');
break;
case 'grant':
$url = CRM_Utils_System::url('civicrm/contact/view', 'action=browse&selectedChild=grant&cid=' . $this->_contactId);
break;
case 'standalone':
$url = CRM_Utils_System::url('civicrm/dashboard', 'reset=1');
break;
default:
$cid = NULL;
if ($this->_contactId) {
$cid = '&cid=' . $this->_contactId;
}
$url = CRM_Utils_System::url('civicrm/grant/search', 'reset=1&force=1' . $cid);
break;
}
$session->pushUserContext($url);
if (CRM_Utils_Request::retrieve('confirmed', 'Boolean', CRM_Core_DAO::$_nullObject)) {
CRM_Grant_BAO_Grant::del($this->_id);
CRM_Utils_System::redirect($url);
}
}
示例6: setContext
function setContext()
{
$context = CRM_Utils_Request::retrieve('context', 'String', $this);
$this->_id = CRM_Utils_Request::retrieve('id', 'Integer', $this);
$session =& CRM_Core_Session::singleton();
switch ($context) {
case 'search':
$url = CRM_Utils_System::url('civicrm/grant/search', 'force=1');
break;
case 'dashboard':
$url = CRM_Utils_System::url('civicrm/grant', 'reset=1');
break;
case 'edit':
$url = CRM_utils_System::url('civicrm/contact/view/grant', 'reset=1&id=' . $this->_id . '&cid=' . $this->_contactId . '&action=view&context=grant&selectedChild=grant');
break;
case 'grant':
$url = CRM_Utils_System::url('civicrm/contact/view', 'action=browse&selectedChild=grant&cid=' . $this->_contactId);
break;
case 'standalone':
$url = CRM_Utils_System::url('civicrm/dashboard', 'reset=1');
break;
default:
$cid = null;
if ($this->_contactId) {
$cid = '&cid=' . $this->_contactId;
}
$url = CRM_Utils_System::url('civicrm/grant/search', 'reset=1&force=1' . $cid);
break;
}
$session->pushUserContext($url);
if (CRM_Utils_Request::retrieve('confirmed', 'Boolean', CRM_Core_DAO::$_nullObject)) {
require_once 'CRM/Grant/BAO/Grant.php';
CRM_Grant_BAO_Grant::del($this->_id);
CRM_Utils_System::redirect($url);
}
}
示例7: postProcess
/**
* Function to process the form
*
* @access public
*
* @return void
*/
public function postProcess()
{
if ($this->_action & CRM_Core_Action::DELETE) {
CRM_Grant_BAO_Grant::del($this->_id);
return;
}
if ($this->_action & CRM_Core_Action::UPDATE) {
$ids['grant_id'] = $this->_id;
}
// get the submitted form values.
$params = $this->controller->exportValues($this->_name);
if (empty($params['grant_report_received'])) {
$params['grant_report_received'] = "null";
}
// set the contact, when contact is selected
if ($this->_context == 'standalone') {
$this->_contactID = $params['contact_id'];
}
$params['contact_id'] = $this->_contactID;
$ids['note'] = array();
if ($this->_noteId) {
$ids['note']['id'] = $this->_noteId;
}
// build custom data getFields array
$customFieldsGrantType = CRM_Core_BAO_CustomField::getFields('Grant', FALSE, FALSE, CRM_Utils_Array::value('grant_type_id', $params));
$customFields = CRM_Utils_Array::crmArrayMerge($customFieldsGrantType, CRM_Core_BAO_CustomField::getFields('Grant', FALSE, FALSE, NULL, NULL, TRUE));
$params['custom'] = CRM_Core_BAO_CustomField::postProcess($params, $customFields, $this->_id, 'Grant');
// add attachments as needed
CRM_Core_BAO_File::formatAttachment($params, $params, 'civicrm_grant', $this->_id);
$grant = CRM_Grant_BAO_Grant::create($params, $ids);
$buttonName = $this->controller->getButtonName();
$session = CRM_Core_Session::singleton();
if ($this->_context == 'standalone') {
if ($buttonName == $this->getButtonName('upload', 'new')) {
$session->replaceUserContext(CRM_Utils_System::url('civicrm/grant/add', 'reset=1&action=add&context=standalone'));
} else {
$session->replaceUserContext(CRM_Utils_System::url('civicrm/contact/view', "reset=1&cid={$this->_contactID}&selectedChild=grant"));
}
} elseif ($buttonName == $this->getButtonName('upload', 'new')) {
$session->replaceUserContext(CRM_Utils_System::url('civicrm/contact/view/grant', "reset=1&action=add&context=grant&cid={$this->_contactID}"));
}
}