Skip to content
Snippets Groups Projects
Commit bb568145 authored by Mayur Jadhav's avatar Mayur Jadhav
Browse files

Worked on RG-163

parent 8038bf27
No related branches found
No related tags found
No related merge requests found
......@@ -2,7 +2,7 @@
/*
+--------------------------------------------------------------------+
| CiviCRM version 4.1 |
| CiviCRM version 4.3 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2011 |
+--------------------------------------------------------------------+
......@@ -25,9 +25,6 @@
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
*/
require_once 'CRM/Core/Component/Info.php';
/**
* This class introduces component to the system and provides all the
* information about it. It needs to extend CRM_Core_Component_Info
......@@ -38,88 +35,91 @@ require_once 'CRM/Core/Component/Info.php';
* $Id$
*
*/
class CRM_Grant_Info extends CRM_Core_Component_Info
{
// docs inherited from interface
protected $keyword = 'grant';
// docs inherited from interface
public function getInfo()
{
return array( 'name' => 'CiviGrant',
'translatedName' => ts('CiviGrant'),
'title' => 'CiviCRM Grant Management Engine',
'path' => 'CRM_Grant_',
'search' => 1,
'showActivitiesInCore' => 1
);
}
class CRM_Grant_Info extends CRM_Core_Component_Info {
// docs inherited from interface
protected $keyword = 'grant';
// docs inherited from interface
public function getInfo() {
return array(
'name' => 'CiviGrant',
'translatedName' => ts('CiviGrant'),
'title' => 'CiviCRM Grant Management Engine',
'path' => 'CRM_Grant_',
'search' => 1,
'showActivitiesInCore' => 1
);
}
// docs inherited from interface
public function getPermissions() {
return array(
'access CiviGrant',
'edit grants',
'edit grant program',
'delete in CiviGrant',
'administer CiviGrant'
);
}
// docs inherited from interface
public function getUserDashboardElement() {
// no dashboard element for this component
return null;
}
// docs inherited from interface
public function getPermissions()
{
return array( 'access CiviGrant',
'edit grants',
'edit grant program',
'delete in CiviGrant',
'administer CiviGrant');
}
// docs inherited from interface
public function getUserDashboardElement()
{
// no dashboard element for this component
return null;
}
// docs inherited from interface
public function getUserDashboardObject() {
// no dashboard element for this component
return null;
}
// docs inherited from interface
public function getUserDashboardObject()
{
// no dashboard element for this component
return null;
}
// docs inherited from interface
public function registerTab() {
return array(
'title' => ts('Grants'),
'url' => 'grant',
'weight' => 50
);
}
// docs inherited from interface
public function registerAdvancedSearchPane() {
return array(
'title' => ts('Grants'),
'weight' => 50
);
}
// docs inherited from interface
public function getActivityTypes() {
return null;
}
// docs inherited from interface
public function registerTab()
{
return array( 'title' => ts( 'Grants' ),
'url' => 'grant',
'weight' => 50 );
}
// docs inherited from interface
public function registerAdvancedSearchPane()
{
return array( 'title' => ts( 'Grants' ),
'weight' => 50 );
}
// docs inherited from interface
public function getActivityTypes()
{
return null;
// add shortcut to Create New
public function creatNewShortcut(&$shortCuts) {
if (CRM_Core_Permission::check('access CiviGrant') &&
CRM_Core_Permission::check('edit grants')) {
$shortCuts =
array_merge($shortCuts, array(array(
'path' => 'civicrm/grant/add',
'query' => "reset=1&action=add&context=standalone",
'ref' => 'new-grant',
'title' => ts('Grant'))
)
);
}
// add shortcut to Create New
public function creatNewShortcut( &$shortCuts ) {
if ( CRM_Core_Permission::check('access CiviGrant') &&
CRM_Core_Permission::check('edit grants') ) {
$shortCuts =
array_merge($shortCuts, array( array( 'path' => 'civicrm/grant/add',
'query' => "reset=1&action=add&context=standalone",
'ref' => 'new-grant',
'title' => ts('Grant') ) ));
}
if ( CRM_Core_Permission::check('access CiviGrant') &&
CRM_Core_Permission::check('edit grant program') ) {
$shortCuts =
array_merge($shortCuts, array( array( 'path' => 'civicrm/grant_program',
'query' => "reset=1&action=browse&id=1",
'ref' => 'new-grant program',
'title' => ts('Grant Program') ) ));
}
if (CRM_Core_Permission::check('access CiviGrant') &&
CRM_Core_Permission::check('edit grant program')) {
$shortCuts =
array_merge($shortCuts, array(array(
'path' => 'civicrm/grant_program',
'query' => "reset=1&action=browse&id=1",
'ref' => 'new-grant program',
'title' => ts('Grant Program'))
)
);
}
}
}
......@@ -2,7 +2,7 @@
/*
+--------------------------------------------------------------------+
| CiviCRM version 4.1 |
| CiviCRM version 4.3 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2011 |
+--------------------------------------------------------------------+
......@@ -39,116 +39,116 @@
* used by the search forms
*
*/
class CRM_Grant_PaymentTask
{
const
CANCEL_PAYMENTS = 1,
REPRINT_PAYMENTS = 2;
/**
* the task array
*
* @var array
* @static
*/
static $_tasks = null;
/**
* the optional task array
*
* @var array
* @static
*/
static $_optionalTasks = null;
/**
* These tasks are the core set of tasks that the user can perform
* on a contact / group of contacts
*
* @return array the set of tasks for a group of contacts
* @static
* @access public
*/
static function &tasks( )
{
if ( !( self::$_tasks ) ) {
self::$_tasks = array( 1 => array( 'title' => ts( 'Cancel Payments' ),
'class' => 'CRM_Grant_Form_Task_Cancel',
'result' => false ),
2 => array( 'title' => ts( 'Reprint Payments' ),
'class' => 'CRM_Grant_Form_Task_Reprint',
'result' => false ),
);
}
if ( !CRM_Core_Permission::check( 'cancel payments in CiviGrant' ) ) {
unset( self::$_tasks[1] );
}
if ( !CRM_Core_Permission::check( 'edit payments in CiviGrant' ) && !CRM_Core_Permission::check( 'create payments in CiviGrant' )) {
unset( self::$_tasks[2] );
}
require_once 'CRM/Utils/Hook.php';
CRM_Utils_Hook::searchTasks( 'grant', self::$_tasks );
asort( self::$_tasks );
return self::$_tasks;
class CRM_Grant_PaymentTask {
const
CANCEL_PAYMENTS = 1,
REPRINT_PAYMENTS = 2;
/**
* the task array
*
* @var array
* @static
*/
static $_tasks = NULL;
/**
* the optional task array
*
* @var array
* @static
*/
static $_optionalTasks = NULL;
/**
* These tasks are the core set of tasks that the user can perform
* on a contact / group of contacts
*
* @return array the set of tasks for a group of contacts
* @static
* @access public
*/
static function &tasks() {
if (!(self::$_tasks)) {
self::$_tasks = array(
1 => array(
'title' => ts('Cancel Payments'),
'class' => 'CRM_Grant_Form_Task_Cancel',
'result' => FALSE
),
2 => array(
'title' => ts('Reprint Payments'),
'class' => 'CRM_Grant_Form_Task_Reprint',
'result' => false
),
);
}
/**
* These tasks are the core set of task titles
*
* @return array the set of task titles
* @static
* @access public
*/
static function &taskTitles( )
{
self::tasks( );
$titles = array( );
foreach ( self::$_tasks as $id => $value ) {
$titles[$id] = $value['title'];
}
return $titles;
if (!CRM_Core_Permission::check('cancel payments in CiviGrant')) {
unset(self::$_tasks[1]);
}
/**
* show tasks selectively based on the permission level
* of the user
*
* @param int $permission
*
* @return array set of tasks that are valid for the user
* @access public
*/
static function &permissionedTaskTitles( $permission )
{
$tasks = array( );
if ( ( $permission == CRM_Core_Permission::EDIT )
|| CRM_Core_Permission::check( 'edit payments in CiviGrant' ) ) {
$tasks = self::taskTitles( );
} else {
$tasks = array(
3 => self::$_tasks[3]['title'] );
//CRM-4418,
if ( CRM_Core_Permission::check( 'cancel payments in CiviGrant' ) ) {
$tasks[1] = self::$_tasks[1]['title'];
}
}
return $tasks;
if (!CRM_Core_Permission::check('edit payments in CiviGrant')
&& !CRM_Core_Permission::check('create payments in CiviGrant')) {
unset(self::$_tasks[2]);
}
/**
* These tasks are the core set of tasks that the user can perform
*
* @param int $value
*
* @return array the set of tasks for a group of contacts
* @static
* @access public
*/
static function getTask( $value )
{
require_once 'CRM/Utils/Hook.php';
CRM_Utils_Hook::searchTasks('grant', self::$_tasks);
asort(self::$_tasks);
return self::$_tasks;
}
/**
* These tasks are the core set of task titles
*
* @return array the set of task titles
* @static
* @access public
*/
static function &taskTitles()
self::tasks( );
$titles = array( );
foreach (self::$_tasks as $id => $value) {
$titles[$id] = $value['title'];
}
return $titles;
}
/**
* show tasks selectively based on the permission level
* of the user
*
* @param int $permission
*
* @return array set of tasks that are valid for the user
* @access public
*/
static function &permissionedTaskTitles($permission) {
$tasks = array( );
if (($permission == CRM_Core_Permission::EDIT)
|| CRM_Core_Permission::check('edit payments in CiviGrant')) {
$tasks = self::taskTitles();
} else {
$tasks = array(
3 => self::$_tasks[3]['title']);
//CRM-4418,
if (CRM_Core_Permission::check('cancel payments in CiviGrant')) {
$tasks[1] = self::$_tasks[1]['title'];
}
}
return $tasks;
}
/**
* These tasks are the core set of tasks that the user can perform
*
* @param int $value
*
* @return array the set of tasks for a group of contacts
* @static
* @access public
*/
static function getTask($value) {
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment