function setUp()
 {
     $this->ipAvailabilities = array('2011-06-23' => new IntellitimeAvailability(date_make_date('2011-06-23'), 'abc_form_id'));
     $this->ipAvailabilities['2011-06-23']->setDay(TRUE);
     $this->localAvailabilities = array(new Availability(array('id' => 10000, 'uid' => 123, 'availability_type' => Availability::AVAILABLE, 'start_time' => 1308780000, 'end_time' => 1308866399)));
     $this->store = new AvailabilityStore(NULL);
     $factory = new IntellitimeAvailabilityFactory($this->store, "08:00-12:00", "12:00-18:00", "18:00-24:00");
     $this->merge = new IntellitimeAvailabilityMergeStrategy($factory);
 }
 function setUp()
 {
     $this->server = $this->getMock('IntellitimeServer');
     $this->form = $this->getMockBuilder('IntellitimeForm')->disableOriginalConstructor()->getMock();
     $this->formAction = "Availability.aspx?MId=Availability";
     $this->expectedAction = "Availability/Availability.aspx?MId=Availability";
     $this->form->expects($this->once())->method('getAction')->will($this->returnValue($this->formAction));
     $this->expectedAvailability = new IntellitimeAvailability(date_make_date('2011-07-14'));
     $this->post = new IntellitimeAvailabilityAddPost($this->server, $this->form, $this->expectedAvailability);
 }
 public function testUnsetsOldRowsFromPost()
 {
     $originalFormValues = array('keep_field' => 'magic value', 'm_availabilityItems:m_availableDaysRepeater:_ctl6:AvailabilityCheckBoxList:2' => 'on', 'm_availabilityItems:m_availableDaysRepeater:_ctl6:AvailabilityHiddenIndex' => '336');
     $expectedAvailability = new IntellitimeAvailability(date_make_date('2011-07-14'));
     $expectedPostData = $originalFormValues;
     unset($expectedPostData['m_availabilityItems:m_availableDaysRepeater:_ctl6:AvailabilityCheckBoxList:2']);
     $expectedPostData[$this->expectedFormId . ':AvailabilityCheckBoxList:0'] = 'on';
     $expectedPostData[$this->expectedFormId . ':AvailabilityCheckBoxList:1'] = 'on';
     $expectedPostData[$this->expectedFormId . ':AvailabilityCheckBoxList:2'] = 'on';
     $this->form->expects($this->once())->method('getFormValues')->will($this->returnValue($originalFormValues));
     $this->server->expects($this->once())->method('post')->with($this->expectedAction, $expectedPostData)->will($this->returnValue($this->readfile('availability-1-day.txt')));
     $this->post->post();
 }
<?php

// Prepare a couple of variables.
$start = date_make_date($fields['field_datetime_value']->raw);
$price = $fields['field_entry_price_value']->raw < 1 ? t('Free') : intval($fields['field_entry_price_value']->raw) . ' kr.';
//converts the date value to time
if (date('d-m-Y') == dynamo_datef($start, "d-m-Y")) {
    $is_today = "today";
}
?>
<div class="calendar-leafs">
  <div class="leaf <?php 
print $is_today;
?>
">
    <div class="day"><?php 
print dynamo_datef($start, 'l');
?>
</div>
    <div class="date"><?php 
print dynamo_datef($start, 'j');
?>
</div>
    <div class="month"><?php 
print dynamo_datef($start, 'M');
?>
</div>
  </div>

  <div class="info">
    <h4><?php 
 function testDoesNotDeleteMappingsForSameJobIdInOtherWeeks()
 {
     $expected_mapping_id = 88281;
     $expected_jobid = 44;
     $start_date = date_make_date('2011-06-23 12:36:18');
     $end_date = date_make_date('2011-06-25 12:36:18');
     $expected_mappings = array(new TZUserJobMapping(array('id' => rand(1, 100), 'uid' => $this->account->uid, 'jobid' => $expected_jobid, 'start_time' => $start_date->format('U') - 1, 'end_time' => $end_date->format('U'))), new TZUserJobMapping(array('id' => $expected_mapping_id, 'uid' => $this->account->uid, 'jobid' => $expected_jobid, 'start_time' => $start_date->format('U'), 'end_time' => $end_date->format('U'))), new TZUserJobMapping(array('id' => rand(101, 200), 'uid' => $this->account->uid, 'jobid' => $expected_jobid, 'start_time' => $start_date->format('U'), 'end_time' => $end_date->format('U') + 1)));
     $assignments = array();
     $this->mapper->expects($this->once())->method('find')->with($this->account->uid)->will($this->returnValue($expected_mappings));
     $this->mapper->expects($this->once())->method('deleteMapping')->with($expected_mapping_id);
     $this->policy->resolveMappings($start_date, $end_date, $assignments);
 }
    }
    ?>
    </div> <!-- /committee-updates-description -->
    <div class="committee-updates-right-infobox">
      <div class="field field-type-date field-field-date">
        <div class="field-items">
          <div class="field-item">
            <label><?php 
    print t('Meeting Schedule');
    ?>
:</label>
            <?php 
    $from_date = date_make_date($node->field_date[0]['value'], 'UTC');
    date_timezone_set($from_date, timezone_open(date_get_timezone('site')));
    // Fix timezone
    $to_date = date_make_date($node->field_date[0]['value2'], 'UTC');
    date_timezone_set($to_date, timezone_open(date_get_timezone('site')));
    // Fix timezone
    $from_date_string = date_format_date($from_date, 'custom', 'F j');
    $from_time_string = date_format_date($from_date, 'custom', 'g:i A');
    $to_date_string = date_format_date($to_date, 'custom', 'F j');
    $to_time_string = date_format_date($to_date, 'custom', 'g:i A');
    if ($from_date_string == $to_date_string) {
        print '<span class="date-display-start">' . "{$from_date_string}, {$from_time_string}" . '</span><span class="date-display-separator"> - </span><span class="date-display-end">' . $to_time_string . '</span>';
    } else {
        print '<span class="date-display-start">' . "{$from_date_string}, {$from_time_string}" . '</span><span class="date-display-separator"> - </span><span class="date-display-end">' . "{$to_date_string}, {$to_time_string}" . '</span>';
    }
    ?>
<br />
            <?php 
    print l(t('Read more...'), 'node/' . $node->nid);
 public function setUp()
 {
     $this->expected_date = date_make_date('2011-07-14T00:00');
     $this->availability = new IntellitimeAvailability();
 }
    <?php 
    print $meeting['facility_name'];
    ?>
    <a href="<?php 
    print $meeting['gmap_link'];
    ?>
">
    <img src="<?php 
    print base_path() . drupal_get_path('module', 'osu_courses_feature');
    ?>
/map-icon.jpg" alt="Google Maps" style="margin:0px 2px 0px 3px;"/></a>
  </td>
  <td class="osu_course_days"><?php 
    print $pattern[0];
    ?>
</td>
  <td class="osu_course_times"><?php 
    print $pattern[1];
    ?>
</td>
  <td class="osu_course_pat_from osu_course_pat_to"><?php 
    print date_format_date(date_make_date($meeting['start_date']), 'custom', 'n/j');
    ?>
-<?php 
    print date_format_date(date_make_date($meeting['end_date']), 'custom', 'n/j');
    ?>
</td>
  <?php 
}
?>
</tr>
 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());
     }
 }
Example #10
0
<?php

$date = date_make_date('now');
if ($_SERVER['argc'] == 5) {
    $date = date_make_date($_SERVER['argv'][4]);
}
$intelli = array('url' => "https://my2.intelliplan.eu/IntelliplanWeb/v2005/Portal/Login.aspx?Gw27UDttLdgps9TM4HqqoQ%3d%3d", 'user' => "Johan Heander", 'pass' => "0733623516");
/*
$intelli = array(
  'url' => "http://localhost/demo/v2005/Portal/Login.aspx?Gw27UDttLdgps9TM4HqqoQ%3d%3d",
  'user' => "test user",
  'pass' => "test password",
);*/
$start_time = microtime(TRUE);
$bot = new TZIntellitimeBot($intelli['url']);
if ($bot->login($intelli['user'], $intelli['pass'])) {
    $data = $bot->load_week($date);
    print_r($data);
} else {
    print 'Login failed!';
}
$stop_time = microtime(TRUE);
print "\nDuration: " . ($stop_time - $start_time) . "\n";
 public function testThrowsWhenAddingAvailabilitiesBeforeDateRange()
 {
     $expectedAvailability = new IntellitimeAvailability();
     $expectedAvailability->setDate(date_make_date('2011-07-13'));
     $page = $this->build_from_page('availability-1-day.txt');
     try {
         $page->setAvailabilities(array($expectedAvailability));
         $this->fail();
     } catch (InvalidArgumentException $e) {
         $this->assertNotNull($e, 'Expected exception');
     }
 }
 public function testNonConsecutiveRangesBecomesThreeAvailabilities()
 {
     $expected_ia = new IntellitimeAvailability(date_make_date('2011-06-23'), 'abc_form_id');
     $expected_ia->setDay(TRUE)->setEvening(TRUE)->setNight(TRUE);
     $factory = new IntellitimeAvailabilityFactory($this->store, "08:00-11:59", "12:00-17:59", "18:00-01:00");
     $availabilities = $factory->createAvailabilities($expected_ia);
     $this->assertEquals(3, count($availabilities));
     $this->assertEquals('2011-06-23 08:00:00', $availabilities[0]->getStartTime()->format('Y-m-d H:i:s'));
     $this->assertEquals('2011-06-23 11:59:00', $availabilities[0]->getEndTime()->format('Y-m-d H:i:s'));
     $this->assertEquals('2011-06-23 12:00:00', $availabilities[1]->getStartTime()->format('Y-m-d H:i:s'));
     $this->assertEquals('2011-06-23 17:59:00', $availabilities[1]->getEndTime()->format('Y-m-d H:i:s'));
     $this->assertEquals('2011-06-23 18:00:00', $availabilities[2]->getStartTime()->format('Y-m-d H:i:s'));
     $this->assertEquals('2011-06-24 01:00:00', $availabilities[2]->getEndTime()->format('Y-m-d H:i:s'));
 }