X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FCore%2FBlock.php;h=569f0552129c9759cef64f2ea8b89bb476b469ca;hb=c503dcf3dc4ec114585dcaa8ffdfdbaab9609da7;hp=d5667195419a74e94f5f77a3e202af406dfeac80;hpb=2aa397bc9ba4608d4146278d55dedd4080c53aec;p=civicrm-core.git diff --git a/CRM/Core/Block.php b/CRM/Core/Block.php index d566719541..569f055212 100644 --- a/CRM/Core/Block.php +++ b/CRM/Core/Block.php @@ -23,7 +23,7 @@ | GNU Affero General Public License or the licensing of CiviCRM, | | see the CiviCRM license FAQ at http://civicrm.org/licensing | +--------------------------------------------------------------------+ -*/ + */ /** * @@ -41,7 +41,7 @@ class CRM_Core_Block { /** - * The following blocks are supported + * The following blocks are supported. * * @var int */ @@ -55,13 +55,12 @@ class CRM_Core_Block { FULLTEXT_SEARCH = 7; /** - * Template file names for the above blocks + * Template file names for the above blocks. */ static $_properties = NULL; /** - * Class constructor - * + * Class constructor. */ public function __construct() { } @@ -188,7 +187,8 @@ class CRM_Core_Block { * @param string $property * The desired property. * - * @return string the value of the desired property + * @return string + * the value of the desired property */ public static function getProperty($id, $property) { if (!(self::$_properties)) { @@ -219,7 +219,8 @@ class CRM_Core_Block { /** * Returns the whole $_properties array * - * @return array the $_properties array + * @return array + * the $_properties array */ public static function properties() { if (!(self::$_properties)) { @@ -229,7 +230,7 @@ class CRM_Core_Block { } /** - * Creates the info block for drupal + * Creates the info block for drupal. * * @return array */ @@ -239,7 +240,9 @@ class CRM_Core_Block { foreach (self::properties() as $id => $value) { if ($value['active']) { if (in_array($id, array( - self::ADD, self::CREATE_NEW))) { + self::ADD, + self::CREATE_NEW, + ))) { $hasAccess = TRUE; if (!CRM_Core_Permission::check('add contacts') && !CRM_Core_Permission::check('edit groups') @@ -266,7 +269,6 @@ class CRM_Core_Block { $block[$id] = array( 'info' => $value['info'], 'cache' => $value['cache'], - 'status' => $value['active'], 'region' => $value['region'], 'visibility' => $value['visibility'], 'pages' => $value['pages'], @@ -303,7 +305,7 @@ class CRM_Core_Block { $defaultLocation = CRM_Core_BAO_LocationType::getDefault(); $defaultPrimaryLocationId = $defaultLocation->id; $values = array( - 'postURL' => CRM_Utils_System::url('civicrm/contact/add', 'reset=1&ct=Individual'), + 'postURL' => CRM_Utils_System::url('civicrm/contact/add', 'reset=1&ct=Individual'), 'primaryLocationType' => $defaultPrimaryLocationId, ); @@ -327,7 +329,8 @@ class CRM_Core_Block { $urlArray = array( 'fullTextSearchID' => CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionValue', 'CRM_Contact_Form_Search_Custom_FullText', 'value', 'name' - )); + ), + ); self::setProperty(self::FULLTEXT_SEARCH, 'templateValues', $urlArray); break; @@ -343,7 +346,7 @@ class CRM_Core_Block { } /** - * Create the list of options to create New objects for the application and format is as a block + * Create the list of options to create New objects for the application and format is as a block. * * @return void */ @@ -366,7 +369,8 @@ class CRM_Core_Block { 'query' => 'action=add&reset=1&context=standalone', 'ref' => 'new-activity', 'title' => ts('Activity'), - ))); + ), + )); $components = CRM_Core_Component::getEnabledComponents(); @@ -384,30 +388,33 @@ class CRM_Core_Block { // new email (select recipients) $shortCuts = array_merge($shortCuts, array( array( - 'path' => 'civicrm/activity/email/add', - 'query' => 'atype=3&action=add&reset=1&context=standalone', - 'ref' => 'new-email', - 'title' => ts('Email'), - ))); + 'path' => 'civicrm/activity/email/add', + 'query' => 'atype=3&action=add&reset=1&context=standalone', + 'ref' => 'new-email', + 'title' => ts('Email'), + ), + )); if (CRM_Core_Permission::check('edit groups')) { $shortCuts = array_merge($shortCuts, array( array( - 'path' => 'civicrm/group/add', - 'query' => 'reset=1', - 'ref' => 'new-group', - 'title' => ts('Group'), - ))); + 'path' => 'civicrm/group/add', + 'query' => 'reset=1', + 'ref' => 'new-group', + 'title' => ts('Group'), + ), + )); } if (CRM_Core_Permission::check('administer CiviCRM')) { $shortCuts = array_merge($shortCuts, array( array( - 'path' => 'civicrm/admin/tag', - 'query' => 'reset=1&action=add', - 'ref' => 'new-tag', - 'title' => ts('Tag'), - ))); + 'path' => 'civicrm/admin/tag', + 'query' => 'reset=1&action=add', + 'ref' => 'new-tag', + 'title' => ts('Tag'), + ), + )); } if (empty($shortCuts)) { @@ -452,7 +459,7 @@ class CRM_Core_Block { $value['url'] = CRM_Utils_System::url($short['path'], $short['query'], FALSE); } $value['title'] = $short['title']; - $value['ref'] = $short['ref']; + $value['ref'] = $short['ref']; if (!empty($short['shortCuts'])) { foreach ($short['shortCuts'] as $shortCut) { $value['shortCuts'][] = self::setShortcutValues($shortCut); @@ -462,7 +469,7 @@ class CRM_Core_Block { } /** - * Create the list of dashboard links + * Create the list of dashboard links. * * @return void */ @@ -471,10 +478,11 @@ class CRM_Core_Block { if (CRM_Core_Permission::check('access Contact Dashboard')) { $dashboardLinks = array( array( - 'path' => 'civicrm/user', + 'path' => 'civicrm/user', 'query' => 'reset=1', 'title' => ts('My Contact Dashboard'), - )); + ), + ); } if (empty($dashboardLinks)) { @@ -491,14 +499,14 @@ class CRM_Core_Block { $value['url'] = CRM_Utils_System::url($dash['path'], $dash['query'], FALSE); } $value['title'] = $dash['title']; - $value['key'] = CRM_Utils_Array::value('key', $dash); - $values[] = $value; + $value['key'] = CRM_Utils_Array::value('key', $dash); + $values[] = $value; } self::setProperty(self::DASHBOARD, 'templateValues', array('dashboardLinks' => $values)); } /** - * Create the list of mail urls for the application and format is as a block + * Create the list of mail urls for the application and format is as a block. * * @return void */ @@ -508,7 +516,7 @@ class CRM_Core_Block { if (!($shortCuts)) { $shortCuts = array( array( - 'path' => 'civicrm/mailing/send', + 'path' => 'civicrm/mailing/send', 'query' => 'reset=1', 'title' => ts('Send Mailing'), ), @@ -522,16 +530,16 @@ class CRM_Core_Block { $values = array(); foreach ($shortCuts as $short) { - $value = array(); - $value['url'] = CRM_Utils_System::url($short['path'], $short['query']); + $value = array(); + $value['url'] = CRM_Utils_System::url($short['path'], $short['query']); $value['title'] = $short['title']; - $values[] = $value; + $values[] = $value; } self::setProperty(self::MAIL, 'templateValues', array('shortCuts' => $values)); } /** - * Create the list of shortcuts for the application and format is as a block + * Create the list of shortcuts for the application and format is as a block. * * @return void */ @@ -546,7 +554,7 @@ class CRM_Core_Block { } /** - * Create the event blocks for upcoming events + * Create the event blocks for upcoming events. * * @return void */ @@ -582,7 +590,7 @@ class CRM_Core_Block { // return if upgrade mode $config = CRM_Core_Config::singleton(); if ($config->isUpgradeMode()) { - return; + return NULL; } if (!self::getProperty($id, 'active')) { @@ -634,9 +642,9 @@ class CRM_Core_Block { return NULL; } - $block = array(); - $block['name'] = 'block-civicrm'; - $block['id'] = $block['name'] . '_' . $id; + $block = array(); + $block['name'] = 'block-civicrm'; + $block['id'] = $block['name'] . '_' . $id; $block['subject'] = self::fetch($id, 'Subject.tpl', array('subject' => self::getProperty($id, 'subject')) ); @@ -668,4 +676,5 @@ class CRM_Core_Block { return $template->fetch('CRM/Block/' . $fileName); } + }