First commit
This commit is contained in:
commit
c6e2478c40
13918 changed files with 2303184 additions and 0 deletions
102
sites/all/modules/civicrm/CRM/Grant/Form/Task/Delete.php
Normal file
102
sites/all/modules/civicrm/CRM/Grant/Form/Task/Delete.php
Normal file
|
@ -0,0 +1,102 @@
|
|||
<?php
|
||||
/*
|
||||
+--------------------------------------------------------------------+
|
||||
| CiviCRM version 4.7 |
|
||||
+--------------------------------------------------------------------+
|
||||
| Copyright CiviCRM LLC (c) 2004-2017 |
|
||||
+--------------------------------------------------------------------+
|
||||
| This file is a part of CiviCRM. |
|
||||
| |
|
||||
| CiviCRM is free software; you can copy, modify, and distribute it |
|
||||
| under the terms of the GNU Affero General Public License |
|
||||
| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
|
||||
| |
|
||||
| CiviCRM is distributed in the hope that it will be useful, but |
|
||||
| WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
||||
| See the GNU Affero General Public License for more details. |
|
||||
| |
|
||||
| You should have received a copy of the GNU Affero General Public |
|
||||
| License and the CiviCRM Licensing Exception along |
|
||||
| with this program; if not, contact CiviCRM LLC |
|
||||
| at info[AT]civicrm[DOT]org. If you have questions about the |
|
||||
| GNU Affero General Public License or the licensing of CiviCRM, |
|
||||
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
|
||||
+--------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @package CRM
|
||||
* @copyright CiviCRM LLC (c) 2004-2017
|
||||
* $Id$
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* This class provides the functionality to delete a group of
|
||||
* participations. This class provides functionality for the actual
|
||||
* deletion.
|
||||
*/
|
||||
class CRM_Grant_Form_Task_Delete extends CRM_Grant_Form_Task {
|
||||
|
||||
/**
|
||||
* Are we operating in "single mode", i.e. deleting one
|
||||
* specific participation?
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
protected $_single = FALSE;
|
||||
|
||||
/**
|
||||
* Build all the data structures needed to build the form.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function preProcess() {
|
||||
parent::preProcess();
|
||||
|
||||
//check permission for delete.
|
||||
if (!CRM_Core_Permission::checkActionPermission('CiviGrant', CRM_Core_Action::DELETE)) {
|
||||
CRM_Core_Error::fatal(ts('You do not have permission to access this page.'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the form object.
|
||||
*
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function buildQuickForm() {
|
||||
$this->addDefaultButtons(ts('Delete Grants'), 'done');
|
||||
}
|
||||
|
||||
/**
|
||||
* 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');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
105
sites/all/modules/civicrm/CRM/Grant/Form/Task/Print.php
Normal file
105
sites/all/modules/civicrm/CRM/Grant/Form/Task/Print.php
Normal file
|
@ -0,0 +1,105 @@
|
|||
<?php
|
||||
/*
|
||||
+--------------------------------------------------------------------+
|
||||
| CiviCRM version 4.7 |
|
||||
+--------------------------------------------------------------------+
|
||||
| Copyright CiviCRM LLC (c) 2004-2017 |
|
||||
+--------------------------------------------------------------------+
|
||||
| This file is a part of CiviCRM. |
|
||||
| |
|
||||
| CiviCRM is free software; you can copy, modify, and distribute it |
|
||||
| under the terms of the GNU Affero General Public License |
|
||||
| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
|
||||
| |
|
||||
| CiviCRM is distributed in the hope that it will be useful, but |
|
||||
| WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
||||
| See the GNU Affero General Public License for more details. |
|
||||
| |
|
||||
| You should have received a copy of the GNU Affero General Public |
|
||||
| License and the CiviCRM Licensing Exception along |
|
||||
| with this program; if not, contact CiviCRM LLC |
|
||||
| at info[AT]civicrm[DOT]org. If you have questions about the |
|
||||
| GNU Affero General Public License or the licensing of CiviCRM, |
|
||||
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
|
||||
+--------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @package CRM
|
||||
* @copyright CiviCRM LLC (c) 2004-2017
|
||||
* $Id$
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* This class provides the functionality to grant list
|
||||
*/
|
||||
class CRM_Grant_Form_Task_Print extends CRM_Grant_Form_Task {
|
||||
|
||||
/**
|
||||
* Build all the data structures needed to build the form.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function preProcess() {
|
||||
parent::preprocess();
|
||||
|
||||
// set print view, so that print templates are called
|
||||
$this->controller->setPrint(1);
|
||||
|
||||
// get the formatted params
|
||||
$queryParams = $this->get('queryParams');
|
||||
|
||||
$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)
|
||||
);
|
||||
}
|
||||
|
||||
$selector = new CRM_Grant_Selector_Search($queryParams, $this->_action, $this->_componentClause);
|
||||
$controller = new CRM_Core_Selector_Controller($selector, NULL, $sortID, CRM_Core_Action::VIEW, $this, CRM_Core_Selector_Controller::SCREEN);
|
||||
$controller->setEmbedded(TRUE);
|
||||
$controller->run();
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the form object - it consists of
|
||||
* - displaying the QILL (query in local language)
|
||||
* - displaying elements for saving the search
|
||||
*
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function buildQuickForm() {
|
||||
//
|
||||
// just need to add a javacript to popup the window for printing
|
||||
//
|
||||
$this->addButtons(array(
|
||||
array(
|
||||
'type' => 'next',
|
||||
'name' => ts('Print Grant List'),
|
||||
'js' => array('onclick' => 'window.print()'),
|
||||
'isDefault' => TRUE,
|
||||
),
|
||||
array(
|
||||
'type' => 'back',
|
||||
'name' => ts('Done'),
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Process the form after the input has been submitted and validated.
|
||||
*
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function postProcess() {
|
||||
// redirect to the main search page after printing is over
|
||||
}
|
||||
|
||||
}
|
83
sites/all/modules/civicrm/CRM/Grant/Form/Task/Result.php
Normal file
83
sites/all/modules/civicrm/CRM/Grant/Form/Task/Result.php
Normal file
|
@ -0,0 +1,83 @@
|
|||
<?php
|
||||
/*
|
||||
+--------------------------------------------------------------------+
|
||||
| CiviCRM version 4.7 |
|
||||
+--------------------------------------------------------------------+
|
||||
| Copyright CiviCRM LLC (c) 2004-2017 |
|
||||
+--------------------------------------------------------------------+
|
||||
| This file is a part of CiviCRM. |
|
||||
| |
|
||||
| CiviCRM is free software; you can copy, modify, and distribute it |
|
||||
| under the terms of the GNU Affero General Public License |
|
||||
| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
|
||||
| |
|
||||
| CiviCRM is distributed in the hope that it will be useful, but |
|
||||
| WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
||||
| See the GNU Affero General Public License for more details. |
|
||||
| |
|
||||
| You should have received a copy of the GNU Affero General Public |
|
||||
| License and the CiviCRM Licensing Exception along |
|
||||
| with this program; if not, contact CiviCRM LLC |
|
||||
| at info[AT]civicrm[DOT]org. If you have questions about the |
|
||||
| GNU Affero General Public License or the licensing of CiviCRM, |
|
||||
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
|
||||
+--------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @package CRM
|
||||
* @copyright CiviCRM LLC (c) 2004-2017
|
||||
* $Id$
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Used for displaying results
|
||||
*
|
||||
*
|
||||
*/
|
||||
class CRM_Grant_Form_Task_Result extends CRM_Grant_Form_Task {
|
||||
|
||||
/**
|
||||
* Build all the data structures needed to build the form.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function preProcess() {
|
||||
$session = CRM_Core_Session::singleton();
|
||||
|
||||
$this->set('searchRows', '');
|
||||
|
||||
$ssID = $this->get('ssID');
|
||||
if (isset($ssID)) {
|
||||
$urlParams = 'reset=1&force=1&ssID=' . $ssID;
|
||||
$qfKey = CRM_Utils_Request::retrieve('qfKey', 'String', $this);
|
||||
if (CRM_Utils_Rule::qfKey($qfKey)) {
|
||||
$urlParams .= "&qfKey=$qfKey";
|
||||
}
|
||||
|
||||
$url = CRM_Utils_System::url('civicrm/grant/search', $urlParams);
|
||||
$session->replaceUserContext($url);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the form object.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function buildQuickForm() {
|
||||
$this->addButtons(array(
|
||||
array(
|
||||
'type' => 'done',
|
||||
'name' => ts('Done'),
|
||||
'isDefault' => TRUE,
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,91 @@
|
|||
<?php
|
||||
/*
|
||||
+--------------------------------------------------------------------+
|
||||
| CiviCRM version 4.7 |
|
||||
+--------------------------------------------------------------------+
|
||||
| Copyright CiviCRM LLC (c) 2004-2017 |
|
||||
+--------------------------------------------------------------------+
|
||||
| This file is a part of CiviCRM. |
|
||||
| |
|
||||
| CiviCRM is free software; you can copy, modify, and distribute it |
|
||||
| under the terms of the GNU Affero General Public License |
|
||||
| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
|
||||
| |
|
||||
| CiviCRM is distributed in the hope that it will be useful, but |
|
||||
| WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
||||
| See the GNU Affero General Public License for more details. |
|
||||
| |
|
||||
| You should have received a copy of the GNU Affero General Public |
|
||||
| License and the CiviCRM Licensing Exception along |
|
||||
| with this program; if not, contact CiviCRM LLC |
|
||||
| at info[AT]civicrm[DOT]org. If you have questions about the |
|
||||
| GNU Affero General Public License or the licensing of CiviCRM, |
|
||||
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
|
||||
+--------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @package CRM
|
||||
* @copyright CiviCRM LLC (c) 2004-2017
|
||||
* $Id$
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* This class provides the functionality to save a search
|
||||
* Saved Searches are used for saving frequently used queries
|
||||
*/
|
||||
class CRM_Grant_Form_Task_SearchTaskHookSample extends CRM_Grant_Form_Task {
|
||||
|
||||
/**
|
||||
* Build all the data structures needed to build the form.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function preProcess() {
|
||||
parent::preProcess();
|
||||
$rows = array();
|
||||
// display name and grant details of all selectced contacts
|
||||
$grantIDs = implode(',', $this->_grantIds);
|
||||
|
||||
$query = "
|
||||
SELECT grt.decision_date as decision_date,
|
||||
grt.amount_total as amount_total,
|
||||
grt.amount_granted as amount_granted,
|
||||
ct.display_name as display_name
|
||||
FROM civicrm_grant grt
|
||||
INNER JOIN civicrm_contact ct ON ( grt.contact_id = ct.id )
|
||||
WHERE grt.id IN ( $grantIDs )";
|
||||
|
||||
$dao = CRM_Core_DAO::executeQuery($query);
|
||||
|
||||
while ($dao->fetch()) {
|
||||
$rows[] = array(
|
||||
'display_name' => $dao->display_name,
|
||||
'decision_date' => $dao->decision_date,
|
||||
'amount_requested' => $dao->amount_total,
|
||||
'amount_granted' => $dao->amount_granted,
|
||||
);
|
||||
}
|
||||
$this->assign('rows', $rows);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the form object.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function buildQuickForm() {
|
||||
$this->addButtons(array(
|
||||
array(
|
||||
'type' => 'done',
|
||||
'name' => ts('Done'),
|
||||
'isDefault' => TRUE,
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
}
|
113
sites/all/modules/civicrm/CRM/Grant/Form/Task/Update.php
Normal file
113
sites/all/modules/civicrm/CRM/Grant/Form/Task/Update.php
Normal file
|
@ -0,0 +1,113 @@
|
|||
<?php
|
||||
/*
|
||||
+--------------------------------------------------------------------+
|
||||
| CiviCRM version 4.7 |
|
||||
+--------------------------------------------------------------------+
|
||||
| Copyright CiviCRM LLC (c) 2004-2017 |
|
||||
+--------------------------------------------------------------------+
|
||||
| This file is a part of CiviCRM. |
|
||||
| |
|
||||
| CiviCRM is free software; you can copy, modify, and distribute it |
|
||||
| under the terms of the GNU Affero General Public License |
|
||||
| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
|
||||
| |
|
||||
| CiviCRM is distributed in the hope that it will be useful, but |
|
||||
| WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
||||
| See the GNU Affero General Public License for more details. |
|
||||
| |
|
||||
| You should have received a copy of the GNU Affero General Public |
|
||||
| License and the CiviCRM Licensing Exception along |
|
||||
| with this program; if not, contact CiviCRM LLC |
|
||||
| at info[AT]civicrm[DOT]org. If you have questions about the |
|
||||
| GNU Affero General Public License or the licensing of CiviCRM, |
|
||||
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
|
||||
+--------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @package CRM
|
||||
* @copyright CiviCRM LLC (c) 2004-2017
|
||||
* $Id$
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* This class provides the functionality to update a group of
|
||||
* grants. This class provides functionality for the actual
|
||||
* update.
|
||||
*/
|
||||
class CRM_Grant_Form_Task_Update extends CRM_Grant_Form_Task {
|
||||
|
||||
/**
|
||||
* Build all the data structures needed to build the form.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function preProcess() {
|
||||
parent::preProcess();
|
||||
|
||||
//check permission for update.
|
||||
if (!CRM_Core_Permission::checkActionPermission('CiviGrant', CRM_Core_Action::UPDATE)) {
|
||||
CRM_Core_Error::fatal(ts('You do not have permission to access this page.'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the form object.
|
||||
*
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function buildQuickForm() {
|
||||
$grantStatus = CRM_Core_PseudoConstant::get('CRM_Grant_DAO_Grant', 'status_id');
|
||||
$this->addElement('select', 'status_id', ts('Grant Status'), array('' => '') + $grantStatus);
|
||||
|
||||
$this->addElement('text', 'amount_granted', ts('Amount Granted'));
|
||||
$this->addRule('amount_granted', ts('Please enter a valid amount.'), 'money');
|
||||
|
||||
$this->addDate('decision_date', ts('Grant Decision'), FALSE, array('formatType' => 'custom'));
|
||||
|
||||
$this->assign('elements', array('status_id', 'amount_granted', 'decision_date'));
|
||||
$this->assign('totalSelectedGrants', count($this->_grantIds));
|
||||
|
||||
$this->addDefaultButtons(ts('Update Grants'), 'done');
|
||||
}
|
||||
|
||||
/**
|
||||
* Process the form after the input has been submitted and validated.
|
||||
*
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function postProcess() {
|
||||
$updatedGrants = 0;
|
||||
|
||||
// get the submitted form values.
|
||||
$params = $this->controller->exportValues($this->_name);
|
||||
$qfKey = $params['qfKey'];
|
||||
foreach ($params as $key => $value) {
|
||||
if ($value == '' || $key == 'qfKey') {
|
||||
unset($params[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($params)) {
|
||||
foreach ($params as $key => $value) {
|
||||
$values[$key] = $value;
|
||||
}
|
||||
foreach ($this->_grantIds as $grantId) {
|
||||
$ids['grant_id'] = $grantId;
|
||||
|
||||
CRM_Grant_BAO_Grant::add($values, $ids);
|
||||
$updatedGrants++;
|
||||
}
|
||||
}
|
||||
|
||||
$status = ts('Updated Grant(s): %1 (Total Selected: %2)', array(1 => $updatedGrants, 2 => count($this->_grantIds)));
|
||||
CRM_Core_Session::setStatus($status, '', 'info');
|
||||
CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/grant/search', 'force=1&qfKey=' . $qfKey));
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue