function setUp()
 {
     $this->syncPolicy = $this->getMock('TZIntellitimeSyncPolicy');
     $this->reportStorage = $this->getMock('TZIntellitimeReportStorage');
     $this->weekFactory = $this->getMock('TZIntellitimeWeekFactory');
     $this->mappingPolicy = $this->getMock('TZIntellitimeUserJobsMappingPolicy');
     $this->syncController = new TZIntellitimeSyncController($this->syncPolicy, $this->weekFactory, $this->reportStorage, $this->mappingPolicy);
     $this->timezone = date_default_timezone(FALSE);
     $this->clone_lambda = function ($o) {
         return clone $o;
     };
 }
 public function setUp()
 {
     $this->timezone = date_default_timezone(FALSE);
     $this->server = $this->getMock('IntellitimeServer');
 }
 public function setUp()
 {
     $this->timezone = date_default_timezone(FALSE);
     $this->account = (object) array('name' => 'Kalle', 'uid' => 63);
 }
 public function setUp()
 {
     $this->timezone = date_default_timezone(FALSE);
     $this->base_url = 'http://localhost/demo/v2005/';
     $this->curl = $this->getMock('TZCurl');
 }
/**
 *  Function to figure out which db timezone applies to a date and select it
 */
function date_get_timezone_db($handling, $timezone = '')
{
    switch ($handling) {
        case 'none':
            $timezone = date_default_timezone();
            break;
        default:
            $timezone = 'UTC';
            break;
    }
    return $timezone > '' ? $timezone : 'UTC';
}
    </div>
  <?php endif; ?>

  <?php if ($exposed): ?>
    <div class="view-filters">
      <?php print $exposed; ?>
    </div>
  <?php endif; ?>

  <?php if ($attachment_before): ?>
    <div class="attachment attachment-before">
      <?php print $attachment_before; ?>
    </div>
  <?php endif; ?>
  <div class="time_area hidden-print">
    <p class="text-right"><?php print t('Timezone'); ?> : <strong><?php print date_default_timezone(); ?></strong></p>
  </div>
  <?php if ($rows): ?>
    <div class="<?php print $view_content_class; ?>">
      <?php print $rows; ?>
    </div>
  <?php elseif ($empty): ?>
    <div class="view-empty">
      <?php print $empty; ?>
    </div>
  <?php endif; ?>

  <?php if ($pager): ?>
    <?php print $pager; ?>
  <?php endif; ?>
Exemple #7
0
/**
 * Preprocess variables for node.tpl.php
 */
function os_basetheme_preprocess_node(&$vars)
{
    // Event nodes, inject variables for date month and day shield
    if ($vars['node']->type == 'event' && (!empty($vars['sv_list']) || !$vars['page'])) {
        $vars['event_start'] = array();
        $delta = 0;
        if (isset($vars['node']->date_id)) {
            list(, , , $delta, ) = explode('.', $vars['node']->date_id . '.');
        }
        if (isset($vars['field_date'][$delta]['value']) && !empty($vars['field_date'][$delta]['value'])) {
            // Define the time zone in the DB as a UTC.
            $date = new DateTime($vars['field_date'][$delta]['value'], new DateTimeZone('utc'));
            // Get the timezone of the site and apply it on the date object.
            $time_zone = date_default_timezone();
            $date->setTimezone(new DateTimeZone($time_zone));
            $vars['event_start']['month'] = check_plain($date->format('M'));
            $vars['event_start']['day'] = check_plain($date->format('d'));
            $vars['classes_array'][] = 'event-start';
            // For events with a repeat rule we add the delta to the query string.
            if ($vars['content']['field_date']['#items'][0]['rrule']) {
                $vars['node_url'] .= '?delta=' . $delta;
            }
            // Unset the date id to avoid displaying the first repeat in all the
            // event's results on the page.
            $vars['node']->date_id = NULL;
        }
    } elseif ($vars['node']->type == 'event' && $vars['page'] && !empty($vars['content']['field_date']['#items'][0]['rrule'])) {
        // We are in a page of a repeated event so we need to display the date
        // according to the delta.
        $delta = isset($_GET['delta']) ? $_GET['delta'] : 0;
        // We move the wanted delta to be the first element in order to get the
        // desired markup.
        $vars['node']->field_date['und'][0] = $vars['node']->field_date['und'][$delta];
        // Get the repeat rule.
        $rule = theme_date_repeat_display(array('item' => array('rrule' => $vars['content']['field_date']['#items'][0]['rrule']), 'field' => field_info_field('field_date')));
        // Get the date field. The delta we want to display will be returned.
        $field = field_view_field('node', $vars['node'], 'field_date', array('full'));
        // Rebuild the markup for the date field.
        $vars['content']['field_date'][0]['#markup'] = $rule . ' ' . $field[0]['#markup'];
        // Don't display the repeats in full view mode.
        foreach ($vars['content']['field_date'] as $index => $repeat) {
            if ($index && is_integer($index)) {
                hide($vars['content']['field_date'][$index]);
            }
        }
    }
    // Event persons, change title markup to h1
    if ($vars['type'] == 'person') {
        if (!$vars['teaser'] && $vars['view_mode'] != 'sidebar_teaser') {
            $vars['title_prefix']['#suffix'] = '<h1 class="node-title">' . $vars['title'] . '</h1>';
            if ($vars['view_mode'] == 'slide_teaser') {
                $vars['title_prefix']['#suffix'] = '<div class="toggle">' . $vars['title_prefix']['#suffix'] . '</div>';
            }
        }
    }
    // Show the body last in a presentation.
    if ($vars['type'] == 'presentation' && $vars['view_mode'] == 'full') {
        $vars['content']['body']['#weight'] = 999;
    }
}
 function setUp()
 {
     $this->tz = date_default_timezone();
 }
 public function testShouldThrowIfTimeNowIsLessThanTimeLastCalled()
 {
     try {
         $now = date_make_date("2011-02-15T16:00:00", date_default_timezone(FALSE));
         $timeLastCalled = date_make_date("2011-02-17T00:00", date_default_timezone(FALSE));
         $this->policy->shouldSendMessage($now, $timeLastCalled);
         $this->fail();
     } catch (InvalidArgumentException $e) {
         $this->assertEquals("Seemingly timeNow is less than timeLastCalled. Is time running backwards where you live?", $e->getMessage());
     }
 }