<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.5 |
+ | CiviCRM version 4.6 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2014 |
+--------------------------------------------------------------------+
class CRM_Contact_Page_View_UserDashBoard extends CRM_Core_Page {
public $_contactId = NULL;
- /*
- * always show public groups
- */
-
+ /**
+ * Always show public groups
+ * @var bool
+ */
public $_onlyPublicGroups = TRUE;
public $_edit = TRUE;
/**
* @throws Exception
*/
- function __construct() {
+ public function __construct() {
parent::__construct();
$check = CRM_Core_Permission::check('access Contact Dashboard');
if (!$check) {
CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/dashboard', 'reset=1'));
- break;
}
$this->_contactId = CRM_Utils_Request::retrieve('id', 'Positive', $this);
}
elseif ($this->_contactId != $userID) {
if (!CRM_Contact_BAO_Contact_Permission::allow($this->_contactId, CRM_Core_Permission::VIEW)) {
- CRM_Core_Error::fatal(ts('You do not have permission to view this contact'));
+ CRM_Core_Error::fatal(ts('You do not have permission to access this contact.'));
}
if (!CRM_Contact_BAO_Contact_Permission::allow($this->_contactId, CRM_Core_Permission::EDIT)) {
$this->_edit = FALSE;
}
}
- /*
- * Heart of the viewing process. The runner gets all the meta data for
- * the contact and calls the appropriate type of page to view.
- *
- * @return void
- * @access public
- *
- */
- function preProcess() {
+ /**
+ * Heart of the viewing process. The runner gets all the meta data for
+ * the contact and calls the appropriate type of page to view.
+ *
+ * @return void
+ */
+ public function preProcess() {
if (!$this->_contactId) {
CRM_Core_Error::fatal(ts('You must be logged in to view this page.'));
}
}
/**
- * Function to build user dashboard
+ * Build user dashboard
*
* @return void
- * @access public
*/
- function buildUserDashBoard() {
+ public function buildUserDashBoard() {
//build component selectors
$dashboardElements = array();
$config = CRM_Core_Config::singleton();
usort($dashboardElements, array('CRM_Utils_Sort', 'cmpFunc'));
$this->assign('dashboardElements', $dashboardElements);
+ // return true when 'Invoices / Credit Notes' checkbox is checked
+ $this->assign('invoices', $this->_userOptions['Invoices / Credit Notes']);
+
if (!empty($this->_userOptions['Groups'])) {
$this->assign('showGroup', TRUE);
//build group selector
}
/**
- * perform actions and display for user dashboard
+ * Perform actions and display for user dashboard
*
* @return void
*
- * @access public
*/
- function run() {
+ public function run() {
$this->preProcess();
$this->buildUserDashBoard();
return parent::run();
* @static
*/
static
- function &links() {
+ public function &links() {
if (!(self::$_links)) {
$disableExtra = ts('Are you sure you want to disable this relationship?');
CRM_Core_Action::VIEW => array(
'name' => ts('Dashboard'),
'url' => 'civicrm/user',
+ 'class' => 'no-popup',
'qs' => 'reset=1&id=%%cbid%%',
'title' => ts('View Relationship'),
),
);
-
if (CRM_Core_Permission::check('access CiviCRM')) {
self::$_links = array_merge(self::$_links, array(
CRM_Core_Action::DISABLE => array(