com.megaphonetech.entitytem.../CRM/EntityTemplates/Page/EntityTemplates.php

84 lines
1.7 KiB
PHP

<?php
class CRM_EntityTemplates_Page_EntityTemplates extends CRM_Core_Page_Basic {
/**
* Get BAO Name.
*
* @return string
* Classname of BAO.
*/
public function getBAOName() {
return 'CRM_EntityTemplates_BAO_EntityTemplates';
}
/**
* Get action Links.
*
* @return array
* (reference) of action links
*/
public function &links() {
return [];
}
/**
* Browse all Grant Budget.
*/
public function browse() {
//check permission
if (!CRM_Core_Permission::check('administer CiviCRM')) {
return CRM_Utils_System::permissionDenied();
}
$entityType = CRM_Utils_Request::retrieve('entityType', 'Positive');
$entityTypes = CRM_EntityTemplates_BAO_EntityTemplates::getEntityTypes();
if (empty($entityType)) {
$entityType = key($entityTypes);
}
$entityTypeOptions = '';
foreach ($entityTypes as $key => $value) {
$extra = '';
if ($key == $entityType) {
$extra = 'selected="selected"';
}
$entityTypeOptions .= "<option value='{$key}' {$extra}>{$value}</option>";
}
$this->assign('entityTypeOptions', $entityTypeOptions);
$this->assign('entityType', $entityType);
}
/**
* Get edit form name.
*
* @return string
* name of this page.
*/
public function editName() {
return ts('Entity Templates');
}
/**
* Get name of edit form.
*
* @return string
* Classname of edit form.
*/
public function editForm() {
return 'CRM_EntityTemplates_Page_EntityTemplates';
}
/**
* Get user context.
*
* @param null $mode
*
* @return string
* user context.
*/
public function userContext($mode = NULL) {
return 'civicrm/grant/annual/budgets';
}
}