Example #1
0
 /**
  * initialises the $_properties array
  * @return void
  */
 static function initProperties()
 {
     if (!defined('BLOCK_CACHE_GLOBAL')) {
         define('BLOCK_CACHE_GLOBAL', 0x8);
     }
     if (!defined('BLOCK_CACHE_PER_PAGE')) {
         define('BLOCK_CACHE_PER_PAGE', 0x4);
     }
     if (!self::$_properties) {
         self::$_properties = array(self::CREATE_NEW => array('template' => 'CreateNew.tpl', 'info' => ts('CiviCRM Create New Record'), 'subject' => ts(''), 'active' => true, 'cache' => BLOCK_CACHE_GLOBAL, 'visibility' => 1, 'weight' => -100, 'status' => 1, 'pages' => 'civicrm*', 'region' => 'left'), self::RECENTLY_VIEWED => array('template' => 'RecentlyViewed.tpl', 'info' => ts('CiviCRM Recent Items'), 'subject' => ts('Recent Items'), 'active' => true, 'cache' => BLOCK_CACHE_GLOBAL, 'visibility' => 1, 'weight' => -99, 'status' => 1, 'pages' => 'civicrm*', 'region' => 'left'), self::DASHBOARD => array('template' => 'Dashboard.tpl', 'info' => ts('CiviCRM Contact Dashboard'), 'subject' => '', 'active' => true, 'cache' => BLOCK_CACHE_GLOBAL, 'visibility' => 1, 'weight' => -98, 'status' => 1, 'pages' => 'civicrm*', 'region' => 'left'), self::ADD => array('template' => 'Add.tpl', 'info' => ts('CiviCRM Quick Add'), 'subject' => ts('New Individual'), 'active' => true, 'cache' => BLOCK_CACHE_GLOBAL, 'visibility' => 1, 'weight' => -97, 'status' => 1, 'pages' => 'civicrm*', 'region' => 'left'), self::LANGSWITCH => array('template' => 'LangSwitch.tpl', 'info' => ts('CiviCRM Language Switcher'), 'subject' => '', 'templateValues' => array(), 'active' => true, 'cache' => BLOCK_CACHE_GLOBAL, 'visibility' => 1, 'weight' => -96, 'status' => 1, 'pages' => 'civicrm*', 'region' => 'left'), self::EVENT => array('template' => 'Event.tpl', 'info' => ts('CiviCRM Upcoming Events'), 'subject' => ts('Upcoming Events'), 'templateValues' => array(), 'active' => true, 'cache' => BLOCK_CACHE_GLOBAL, 'visibility' => 1, 'weight' => -95, 'status' => 0, 'pages' => 'civicrm*', 'region' => 'left'), self::FULLTEXT_SEARCH => array('template' => 'FullTextSearch.tpl', 'info' => ts('CiviCRM Full-text Search'), 'subject' => ts('Full-text Search'), 'active' => true, 'cache' => BLOCK_CACHE_GLOBAL, 'visibility' => 1, 'weight' => -94, 'status' => 0, 'pages' => 'civicrm*', 'region' => 'left'), self::CIVICRM_CONTENT => array('template' => 'Content.tpl', 'info' => ts('CiviCRM'), 'subject' => ts('CiviCRM'), 'active' => true, 'cache' => BLOCK_CACHE_GLOBAL, 'visibility' => 1, 'weight' => -94, 'status' => 0, 'pages' => 'civicrm*', 'region' => 'left'));
         ksort(self::$_properties);
     }
 }
Example #2
0
 /**
  * Reuse drupal blocks into a left sidebar. Assign the generated template
  * to the smarty instance
  *
  * @return void
  * @access public
  * @static
  */
 function sidebarLeft()
 {
     $blockIds = array(1, 2, 4, 8);
     $blocks = array();
     foreach ($blockIds as $id) {
         require_once 'CRM/Core/Block.php';
         $blocks[] = CRM_Core_Block::getContent($id);
     }
     require_once 'CRM/Core/Smarty.php';
     $template =& CRM_Core_Smarty::singleton();
     $template->assign_by_ref('blocks', $blocks);
     $sidebarLeft = $template->fetch('CRM/Block/blocks.tpl');
     $template->assign_by_ref('sidebarLeft', $sidebarLeft);
 }
Example #3
0
 /**
  * Reuse drupal blocks into a left sidebar. Assign the generated template
  * to the smarty instance
  *
  * @return void
  * @access public
  * @static
  */
 static function sidebarLeft()
 {
     $config =& CRM_Core_Config::singleton();
     require_once 'CRM/Core/Block.php';
     $blockIds = array(CRM_Core_Block::CREATE_NEW, CRM_Core_Block::RECENTLY_VIEWED, CRM_Core_Block::DASHBOARD, CRM_Core_Block::ADD, CRM_Core_Block::LANGSWITCH);
     $blocks = array();
     foreach ($blockIds as $id) {
         $blocks[] = CRM_Core_Block::getContent($id);
     }
     require_once 'CRM/Core/Smarty.php';
     $template =& CRM_Core_Smarty::singleton();
     $template->assign_by_ref('blocks', $blocks);
     $sidebarLeft = $template->fetch('CRM/Block/blocks.tpl');
     $template->assign_by_ref('sidebarLeft', $sidebarLeft);
 }
Example #4
0
 /**
  * Reuse drupal blocks into a left sidebar.
  *
  * Assign the generated template to the smarty instance.
  */
 public static function sidebarLeft()
 {
     $config = CRM_Core_Config::singleton();
     if ($config->userFrameworkFrontend) {
         return;
     }
     $blockIds = array(CRM_Core_Block::CREATE_NEW, CRM_Core_Block::RECENTLY_VIEWED, CRM_Core_Block::DASHBOARD, CRM_Core_Block::ADD, CRM_Core_Block::LANGSWITCH);
     $blocks = array();
     foreach ($blockIds as $id) {
         $blocks[] = CRM_Core_Block::getContent($id);
     }
     $template = CRM_Core_Smarty::singleton();
     $template->assign_by_ref('blocks', $blocks);
     $sidebarLeft = $template->fetch('CRM/Block/blocks.tpl');
     $template->assign_by_ref('sidebarLeft', $sidebarLeft);
 }
Example #5
0
 /**
  * Initialises the $_properties array
  *
  * @return void
  */
 public static function initProperties()
 {
     if (!defined('BLOCK_CACHE_GLOBAL')) {
         define('BLOCK_CACHE_GLOBAL', 0x8);
     }
     if (!defined('BLOCK_CACHE_PER_PAGE')) {
         define('BLOCK_CACHE_PER_PAGE', 0x4);
     }
     if (!defined('BLOCK_NO_CACHE')) {
         define('BLOCK_NO_CACHE', -1);
     }
     if (!self::$_properties) {
         $config = CRM_Core_Config::singleton();
         self::$_properties = array(self::CREATE_NEW => array('template' => 'CreateNew.tpl', 'info' => ts('CiviCRM Create New Record'), 'subject' => '', 'active' => TRUE, 'cache' => BLOCK_CACHE_GLOBAL, 'visibility' => 1, 'weight' => -100, 'status' => 1, 'pages' => "civicrm\ncivicrm/*", 'region' => $config->userSystem->getDefaultBlockLocation()), self::RECENTLY_VIEWED => array('template' => 'RecentlyViewed.tpl', 'info' => ts('CiviCRM Recent Items'), 'subject' => ts('Recent Items'), 'active' => TRUE, 'cache' => BLOCK_NO_CACHE, 'visibility' => 1, 'weight' => -99, 'status' => 1, 'pages' => "civicrm\ncivicrm/*", 'region' => $config->userSystem->getDefaultBlockLocation()), self::DASHBOARD => array('template' => 'Dashboard.tpl', 'info' => ts('CiviCRM Contact Dashboard'), 'subject' => '', 'active' => TRUE, 'cache' => BLOCK_NO_CACHE, 'visibility' => 1, 'weight' => -98, 'status' => 1, 'pages' => "civicrm\ncivicrm/*", 'region' => $config->userSystem->getDefaultBlockLocation()), self::ADD => array('template' => 'Add.tpl', 'info' => ts('CiviCRM Quick Add'), 'subject' => ts('New Individual'), 'active' => TRUE, 'cache' => BLOCK_NO_CACHE, 'visibility' => 1, 'weight' => -97, 'status' => 1, 'pages' => "civicrm\ncivicrm/*", 'region' => $config->userSystem->getDefaultBlockLocation()), self::LANGSWITCH => array('template' => 'LangSwitch.tpl', 'info' => ts('CiviCRM Language Switcher'), 'subject' => '', 'templateValues' => array(), 'active' => TRUE, 'cache' => BLOCK_NO_CACHE, 'visibility' => 1, 'weight' => -96, 'status' => 1, 'pages' => "civicrm\ncivicrm/*", 'region' => $config->userSystem->getDefaultBlockLocation()), self::EVENT => array('template' => 'Event.tpl', 'info' => ts('CiviCRM Upcoming Events'), 'subject' => ts('Upcoming Events'), 'templateValues' => array(), 'active' => TRUE, 'cache' => BLOCK_NO_CACHE, 'visibility' => 1, 'weight' => -95, 'status' => 0, 'pages' => "civicrm\ncivicrm/*", 'region' => $config->userSystem->getDefaultBlockLocation()), self::FULLTEXT_SEARCH => array('template' => 'FullTextSearch.tpl', 'info' => ts('CiviCRM Full-text Search'), 'subject' => ts('Full-text Search'), 'active' => TRUE, 'cache' => BLOCK_NO_CACHE, 'visibility' => 1, 'weight' => -94, 'status' => 0, 'pages' => "civicrm\ncivicrm/*", 'region' => $config->userSystem->getDefaultBlockLocation()));
         ksort(self::$_properties);
     }
 }
Example #6
0
 /**
  * Given an id creates a subject/content array
  *
  * @param int $id id of the block
  *
  * @return array
  * @access public
  */
 function getContent($id)
 {
     CRM_Core_Block::setTemplateValues($id);
     $block = array();
     if (!CRM_Core_Block::getProperty($id, 'active')) {
         return null;
     }
     if (($id == CRM_CORE_BLOCK_ADD || $id == CRM_CORE_BLOCK_SHORTCUTS) && !CRM_Utils_System::checkPermission('add contacts') && !CRM_Utils_System::checkPermission('edit groups')) {
         return null;
     }
     $block['name'] = 'block-civicrm';
     $block['id'] = $block['name'] . '_' . $id;
     $block['subject'] = CRM_Core_Block::fetch($id, 'Subject.tpl', array('subject' => CRM_Core_Block::getProperty($id, 'subject')));
     $block['content'] = CRM_Core_Block::fetch($id, CRM_Core_Block::getProperty($id, 'template'), CRM_Core_Block::getProperty($id, 'templateValues'));
     return $block;
 }