Ejemplo n.º 1
0
 /**
  * Run dashboard.
  *
  * @return void
  */
 public function run()
 {
     // Add dashboard js and css
     $resources = CRM_Core_Resources::singleton();
     $resources->addScriptFile('civicrm', 'js/jquery/jquery.dashboard.js', 0, 'html-header', FALSE);
     $resources->addStyleFile('civicrm', 'css/dashboard.css');
     $resetCache = CRM_Utils_Request::retrieve('resetCache', 'Positive', CRM_Core_DAO::$_nullObject);
     CRM_Utils_System::setTitle(ts('CiviCRM Home'));
     $session = CRM_Core_Session::singleton();
     $contactID = $session->get('userID');
     if ($resetCache) {
         CRM_Core_BAO_Dashboard::resetDashletCache($contactID);
     }
     // call hook to get html from other modules
     // ignored but needed to prevent warnings
     $contentPlacement = CRM_Utils_Hook::DASHBOARD_BELOW;
     $html = CRM_Utils_Hook::dashboard($contactID, $contentPlacement);
     if (is_array($html)) {
         $this->assign_by_ref('hookContent', $html);
         $this->assign('hookContentPlacement', $contentPlacement);
     }
     $communityMessages = CRM_Core_CommunityMessages::create();
     if ($communityMessages->isEnabled()) {
         $message = $communityMessages->pick();
         if ($message) {
             $this->assign('communityMessages', $communityMessages->evalMarkup($message['markup']));
         }
     }
     return parent::run();
 }
 /**
  * Run dashboard
  *
  * @return none
  * @access public
  */
 function run()
 {
     $resetCache = CRM_Utils_Request::retrieve('resetCache', 'Positive', CRM_Core_DAO::$_nullObject);
     if ($resetCache) {
         CRM_Core_BAO_Dashboard::resetDashletCache();
     }
     CRM_Utils_System::setTitle(ts('CiviCRM Home'));
     $session = CRM_Core_Session::singleton();
     $contactID = $session->get('userID');
     // call hook to get html from other modules
     // ignored but needed to prevent warnings
     $contentPlacement = CRM_Utils_Hook::DASHBOARD_BELOW;
     $html = CRM_Utils_Hook::dashboard($contactID, $contentPlacement);
     if (is_array($html)) {
         $this->assign_by_ref('hookContent', $html);
         $this->assign('hookContentPlacement', $contentPlacement);
     }
     //check that default FROM email address, owner (domain) organization name and default mailbox are configured.
     $fromEmailOK = TRUE;
     $ownerOrgOK = TRUE;
     $defaultMailboxOK = TRUE;
     // Don't put up notices if user doesn't have administer CiviCRM permission
     if (CRM_Core_Permission::check('administer CiviCRM')) {
         $destination = CRM_Utils_System::url('civicrm/dashboard', 'reset=1', FALSE, NULL, FALSE);
         $destination = urlencode($destination);
         list($domainEmailName, $domainEmailAddress) = CRM_Core_BAO_Domain::getNameAndEmail(TRUE);
         if (!$domainEmailAddress || $domainEmailAddress == '*****@*****.**') {
             $fixEmailUrl = CRM_Utils_System::url("civicrm/admin/domain", "action=update&reset=1&civicrmDestination={$destination}");
             $this->assign('fixEmailUrl', $fixEmailUrl);
             $fromEmailOK = FALSE;
         }
         $domain = CRM_Core_BAO_Domain::getDomain();
         $domainName = $domain->name;
         if (!$domainName || $domainName == 'Default Domain Name') {
             $fixOrgUrl = CRM_Utils_System::url("civicrm/admin/domain", "action=update&reset=1&civicrmDestination={$destination}");
             $this->assign('fixOrgUrl', $fixOrgUrl);
             $ownerOrgOK = FALSE;
         }
         $config = CRM_Core_Config::singleton();
         if (in_array('CiviMail', $config->enableComponents) && CRM_Core_BAO_MailSettings::defaultDomain() == "FIXME.ORG") {
             $fixDefaultMailbox = CRM_Utils_System::url('civicrm/admin/mailSettings', "reset=1&civicrmDestination={$destination}");
             $this->assign('fixDefaultMailbox', $fixDefaultMailbox);
             $defaultMailboxOK = FALSE;
         }
     }
     $this->assign('fromEmailOK', $fromEmailOK);
     $this->assign('ownerOrgOK', $ownerOrgOK);
     $this->assign('defaultMailboxOK', $defaultMailboxOK);
     return parent::run();
 }
Ejemplo n.º 3
0
 /**
  * Run dashboard
  *
  * @return none
  * @access public
  */
 function run()
 {
     $resetCache = CRM_Utils_Request::retrieve('resetCache', 'Positive', CRM_Core_DAO::$_nullObject);
     if ($resetCache) {
         require_once 'CRM/Core/BAO/Dashboard.php';
         CRM_Core_BAO_Dashboard::resetDashletCache();
     }
     CRM_Utils_System::setTitle(ts('CiviCRM Home'));
     $session = CRM_Core_Session::singleton();
     $contactID = $session->get('userID');
     // call hook to get html from other modules
     require_once 'CRM/Utils/Hook.php';
     $contentPlacement = CRM_Utils_Hook::DASHBOARD_BELOW;
     // ignored but needed to prevent warnings
     $html = CRM_Utils_Hook::dashboard($contactID, $contentPlacement);
     if (is_array($html)) {
         $this->assign_by_ref('hookContent', $html);
         $this->assign('hookContentPlacement', $contentPlacement);
     }
     return parent::run();
 }
Ejemplo n.º 4
0
 function preProcess()
 {
     $params = array();
     $defaults = array();
     $ids = array();
     $session =& CRM_Core_Session::singleton();
     $uid = $session->get('userID');
     if (!$uid) {
         require_once 'CRM/Utils/System.php';
         CRM_Utils_System::setUFMessage(ts('We could not find a user id. You must be logged in to access the CiviCRM Home Page and menus.'));
         CRM_Core_Error::statusBounce(ts('We could not find a user id. You must be logged in to access the CiviCRM Home Page and menus.'));
     }
     $this->assign('contactId', $uid);
     $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, false, 'view');
     $this->assign('action', $this->_action);
     // a user can always view their own activity history
     // if they have access CiviCRM permission
     $this->_permission = CRM_Core_Permission::VIEW;
     // make the permission edit if the user has edit permission on the contact
     require_once 'CRM/Contact/BAO/Contact/Permission.php';
     if (CRM_Contact_BAO_Contact_Permission::allow($uid, CRM_Core_Permission::EDIT)) {
         $this->_permission = CRM_Core_Permission::EDIT;
     }
     $displayName = $this->get('displayName');
     list($displayName, $contactImage, $contactType) = CRM_Contact_BAO_Contact::getDisplayAndImage($uid, true);
     $this->set('displayName', $displayName);
     $this->set('contactImage', $contactImage);
     CRM_Utils_System::setTitle($contactImage . ' ' . $displayName, $displayName);
     CRM_Utils_Recent::add($displayName, CRM_Utils_System::url('civicrm/contact/view', 'reset=1&cid=' . $uid), $uid, $contactType, $uid, $displayName);
     // call hook to get html from other modules
     require_once 'CRM/Utils/Hook.php';
     $contentPlacement = CRM_Utils_Hook::DASHBOARD_BELOW;
     // ignored but needed to prevent warnings
     $html = CRM_Utils_Hook::dashboard($uid, $contentPlacement);
     if (is_array($html)) {
         $this->assign_by_ref('hookContent', $html);
         $this->assign('hookContentPlacement', $contentPlacement);
     }
 }
Ejemplo n.º 5
0
 /**
  * Run dashboard
  *
  * @return void
  * @access public
  */
 function run()
 {
     // Add dashboard js and css
     $resources = CRM_Core_Resources::singleton();
     $resources->addScriptFile('civicrm', 'packages/jquery/plugins/jquery.dashboard.js', 0, 'html-header', FALSE);
     $resources->addStyleFile('civicrm', 'packages/jquery/css/dashboard.css');
     $config = CRM_Core_Config::singleton();
     // Add dashlet-specific js files
     // TODO: Need a much better way of managing on-the-fly js requirements. Require.js perhaps?
     // Checking if a specific dashlet is enabled is a pain and including the js here sucks anyway
     // So here's a compromise:
     if (in_array('CiviCase', $config->enableComponents)) {
         $resources->addScriptFile('civicrm', 'templates/CRM/Case/Form/ActivityChangeStatus.js');
     }
     $resetCache = CRM_Utils_Request::retrieve('resetCache', 'Positive', CRM_Core_DAO::$_nullObject);
     CRM_Utils_System::setTitle(ts('CiviCRM Home'));
     $session = CRM_Core_Session::singleton();
     $contactID = $session->get('userID');
     if ($resetCache) {
         CRM_Core_BAO_Dashboard::resetDashletCache($contactID);
     }
     // call hook to get html from other modules
     // ignored but needed to prevent warnings
     $contentPlacement = CRM_Utils_Hook::DASHBOARD_BELOW;
     $html = CRM_Utils_Hook::dashboard($contactID, $contentPlacement);
     if (is_array($html)) {
         $this->assign_by_ref('hookContent', $html);
         $this->assign('hookContentPlacement', $contentPlacement);
     }
     //check that default FROM email address, owner (domain) organization name and default mailbox are configured.
     $fromEmailOK = TRUE;
     $ownerOrgOK = TRUE;
     $defaultMailboxOK = TRUE;
     // Don't put up notices if user doesn't have administer CiviCRM permission
     if (CRM_Core_Permission::check('administer CiviCRM')) {
         $destination = CRM_Utils_System::url('civicrm/dashboard', 'reset=1', FALSE, NULL, FALSE);
         $destination = urlencode($destination);
         list($domainEmailName, $domainEmailAddress) = CRM_Core_BAO_Domain::getNameAndEmail(TRUE);
         if (!$domainEmailAddress || $domainEmailAddress == '*****@*****.**') {
             $fixEmailUrl = CRM_Utils_System::url("civicrm/admin/domain", "action=update&reset=1&civicrmDestination={$destination}");
             $this->assign('fixEmailUrl', $fixEmailUrl);
             $fromEmailOK = FALSE;
         }
         $domain = CRM_Core_BAO_Domain::getDomain();
         $domainName = $domain->name;
         if (!$domainName || $domainName == 'Default Domain Name') {
             $fixOrgUrl = CRM_Utils_System::url("civicrm/admin/domain", "action=update&reset=1&civicrmDestination={$destination}");
             $this->assign('fixOrgUrl', $fixOrgUrl);
             $ownerOrgOK = FALSE;
         }
         if (in_array('CiviMail', $config->enableComponents) && CRM_Core_BAO_MailSettings::defaultDomain() == "EXAMPLE.ORG") {
             $fixDefaultMailbox = CRM_Utils_System::url('civicrm/admin/mailSettings', "reset=1&civicrmDestination={$destination}");
             $this->assign('fixDefaultMailbox', $fixDefaultMailbox);
             $defaultMailboxOK = FALSE;
         }
     }
     $this->assign('fromEmailOK', $fromEmailOK);
     $this->assign('ownerOrgOK', $ownerOrgOK);
     $this->assign('defaultMailboxOK', $defaultMailboxOK);
     $communityMessages = CRM_Core_CommunityMessages::create();
     if ($communityMessages->isEnabled()) {
         $message = $communityMessages->pick();
         if ($message) {
             $this->assign('communityMessages', $communityMessages->evalMarkup($message['markup']));
         }
     }
     return parent::run();
 }