org.agbu.annualgrantbudgets/CRM/Grant/Page/AnnualBudgets.php

87 lines
1.8 KiB
PHP
Raw Normal View History

2018-08-11 16:46:21 +00:00
<?php
class CRM_Grant_Page_AnnualBudgets extends CRM_Core_Page_Basic {
/**
* Get BAO Name.
*
* @return string
* Classname of BAO.
*/
public function getBAOName() {
return 'CRM_Grant_BAO_GrantBudget';
}
/**
* Get action Links.
*
* @return array
* (reference) of action links
*/
public function &links() {
return [];
}
/**
* Browse all Grant Budget.
*/
public function browse() {
2018-08-11 18:40:06 +00:00
//check permission
if (!(CRM_Core_Permission::check('administer CiviCRM')
2018-08-11 23:43:25 +00:00
|| (CRM_Core_Permission::check('access CiviGrant')
2018-08-11 18:40:06 +00:00
&& CRM_Core_Permission::check('edit grants')
)
)) {
return CRM_Utils_System::permissionDenied();
}
2018-08-11 19:37:33 +00:00
$fiscalYear = CRM_Utils_Request::retrieve('fiscalYear', 'Positive');
2018-08-11 16:46:21 +00:00
if (empty($fiscalYear)) {
$fiscalYear = date('Y');
}
2018-08-11 23:34:21 +00:00
$fiscalYearOptions = '';
foreach (CRM_Grant_BAO_GrantBudget::getFiscalyear() as $key => $value) {
$extra = '';
if ($key == $fiscalYear) {
$extra = 'selected="selected"';
}
$fiscalYearOptions .= "<option value='{$key}' {$extra}>{$value}</option>";
}
$this->assign('fiscal_year_options', $fiscalYearOptions);
2018-08-11 16:46:21 +00:00
$this->assign('fiscalYear', $fiscalYear);
}
/**
* Get edit form name.
*
* @return string
* name of this page.
*/
public function editName() {
return ts('Annual Grant Budget');
}
2018-08-11 17:51:25 +00:00
/**
* Get name of edit form.
*
* @return string
* Classname of edit form.
*/
public function editForm() {
return 'CRM_Grant_Page_AnnualBudgets';
}
2018-08-11 16:46:21 +00:00
/**
* Get user context.
*
* @param null $mode
*
* @return string
* user context.
*/
public function userContext($mode = NULL) {
return 'civicrm/grant/annual/budgets';
}
}