// TODO: Split up; this was copied verbatim from CiviCRM 4.0's multi-UF theming function
// but the parts should be copied into cleaner subclass implementations
- if (function_exists('theme') && !$print) {
+ $config = CRM_Core_Config::singleton();
+ if (
+ $config->userSystem->is_drupal &&
+ function_exists('theme') &&
+ !$print
+ ) {
if ($maintenance) {
drupal_set_breadcrumb('');
drupal_maintenance_theme();
$out = $content;
$config = &CRM_Core_Config::singleton();
- if (!$print &&
+ if (
+ !$print &&
$config->userFramework == 'WordPress'
) {
if (is_admin()) {
*/
function userLoginFinalize($params = array()){
}
+
+ /**
+ * Set timezone in mysql so that timestamp fields show the correct time
+ */
+ function setMySQLTimeZone(){
+ $timeZoneOffset = $this->getTimeZoneOffset();
+ if($timeZoneOffset){
+ $sql = "SET time_zone = '$timeZoneOffset'";
+ CRM_Core_DAO::executequery($sql);
+ }
+ }
+
+
+ /**
+ * Get timezone from CMS
+ * @return boolean|string
+ */
+ /**
+ * Get timezone from Drupal
+ * @return boolean|string
+ */
+ function getTimeZoneOffset(){
+ $timezone = $this->getTimeZoneString();
+ if($timezone){
+ $tzObj = new DateTimeZone($timezone);
+ $dateTime = new DateTime("now", $tzObj);
+ $tz = $tzObj->getOffset($dateTime);
+
+ if(empty($tz)){
+ return false;
+ }
+
+ $timeZoneOffset = sprintf("%02d:%02d", $tz / 3600, ($tz/60)%60 );
+
+ if($timeZoneOffset > 0){
+ $timeZoneOffset = '+' . $timeZoneOffset;
+ }
+ return $timeZoneOffset;
+ }
+ }
+
+ /**
+ * Over-ridable function to get timezone as a string eg.
+ * @return string Timezone e.g. 'America/Los_Angeles'
+ */
+ function getTimeZoneString() {
+ return NULL;
+ }
}