public function createSchedule()
 {
     $schedule = Schedule::insert();
     $employees = Employee::getAllEmployees();
     foreach ($employees as $employee) {
         Week::insert($employee['id'], $schedule);
     }
     require_once 'views/home_view.php';
 }
Example #2
0
 public static function createDays($schId)
 {
     $db = Database::getInstance();
     $weekId = Week::getLastId();
     $schedule = Schedule::getSchedule($schId);
     $sql = "INSERT INTO day (weekId, startTime, shiftDate) VALUES (:weekId, :startTime, :shiftDate)";
     for ($i = 0; $i < 7; $i++) {
         $shift = date('Y-m-d', strToTime("+" . $i . " days", strToTime($schedule['startDate'])));
         $result = $db->prepare($sql);
         $result->execute(array(":weekId" => $weekId, ":startTime" => null, ":shiftDate" => $shift));
     }
 }
Example #3
0
 public function weekget($page)
 {
     if (Week::all()->count() > ($page - 1) * 20) {
         $weeks = Week::take(20)->skip(($page - 1) * 20)->orderBy("id", "desc")->get();
         for ($i = 0; $i < count($weeks); $i++) {
             $export[] = array("title" => urlencode(trim($weeks[$i]->web_main_top_title)), "day" => urlencode(trim($weeks[$i]->web_main_top_day)), "writer" => urlencode(trim($weeks[$i]->web_main_where)), "body" => urlencode(base64_encode($weeks[$i]->web_main_data)), "file" => urlencode(trim($weeks[$i]->web_main_link)), "image" => urlencode(trim($weeks[$i]->web_main_file)), "link" => urlencode(trim($weeks[$i]->web_main_outside_link)));
         }
         return urldecode(json_encode($export));
     } else {
         $export[] = array("title" => " ", "day" => " ", "writer" => " ", "body" => " ", "file" => " ", "image" => " ", "link" => " ");
         return urldecode(json_encode($export));
     }
 }
 function testWeekModule()
 {
     $today = date('y-m-d');
     $timestamp = mktime(0, 0, 0, substr($today, 3, 2), substr($today, 6, 2), substr($today, 0, 2));
     $dayofweek = date("N", $timestamp);
     $mondaymm = date("m", mktime(0, 0, 0, substr($today, 3, 2), substr($today, 6, 2) - $dayofweek + 1, substr($today, 0, 2)));
     $mondaydd = date("d", mktime(0, 0, 0, substr($today, 3, 2), substr($today, 6, 2) - $dayofweek + 1, substr($today, 0, 2)));
     $mondayyy = date("y", mktime(0, 0, 0, substr($today, 3, 2), substr($today, 6, 2) - $dayofweek + 1, substr($today, 0, 2)));
     $roomlogs = new ArrayObject();
     for ($d = $mondaydd; $d < $mondaydd + 7; $d++) {
         $day_id = date("y-m-d", mktime(0, 0, 0, $mondaymm, $d, $mondayyy));
         $roomlogs[] = new RoomLog($day_id);
     }
     $w = new Week($roomlogs);
     $mon = $roomlogs[0];
     $sun = $roomlogs[6];
     $this->assertTrue($w->get_id() == $mon->get_id());
     $this->assertTrue(sizeof($w->get_roomlogs()) == 7);
     $this->assertTrue($w->get_name() == $mon->get_name() . " to " . $sun->get_name());
     $this->assertTrue($w->get_end() == $sun->get_end_time());
     $this->assertTrue(true);
     echo $mon->get_name() . " to " . $sun->get_name() . "\n";
     echo "testWeek complete";
 }
Example #5
0
 function testWeekModule()
 {
     $days = array();
     for ($i = 6; $i < 13; $i++) {
         $days[] = new RMHDate(date('y-m-d', mktime(0, 0, 0, 2, $i, 2012)), "house", array(), "");
     }
     $aweek = new Week($days, "house", "archived");
     $this->assertEqual($aweek->get_name(), "February 6, 2012 to February 12, 2012");
     $this->assertEqual($aweek->get_id(), "12-02-06:house");
     $this->assertTrue(sizeof($aweek->get_dates()) == 7);
     $this->assertEqual($aweek->get_venue(), "house");
     $this->assertEqual($aweek->get_status(), "archived");
     $this->assertEqual($aweek->get_end(), mktime(23, 59, 59, 2, 12, 2012));
     echo "testWeek complete";
 }
Example #6
0
 /**
  * Adds an object to the instance pool.
  *
  * Propel keeps cached copies of objects in an instance pool when they are retrieved
  * from the database.  In some cases -- especially when you override doSelect*()
  * methods in your stub classes -- you may need to explicitly add objects
  * to the cache in order to ensure that the same objects are always returned by doSelect*()
  * and retrieveByPK*() calls.
  *
  * @param      Week $value A Week object.
  * @param      string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
  */
 public static function addInstanceToPool(Week $obj, $key = null)
 {
     if (Propel::isInstancePoolingEnabled()) {
         if ($key === null) {
             $key = (string) $obj->getId();
         }
         // if key === null
         self::$instances[$key] = $obj;
     }
 }
Example #7
0
 /**
  * @return int
  */
 public function getWeekId()
 {
     return $this->week->getId();
 }
 /**
  * 計算
  *
  * @return \Month
  */
 public function calc()
 {
     $day = 1;
     // 先月用
     $lastMonthLastDay = $this->lastMonthLastDay() - $this->firstDayWeekCode;
     // 来月開始日用
     $nextMonthDay = 1;
     $weekCnt = $this->haveWeeksCount();
     for ($i = 1; $i <= $weekCnt; $i++) {
         $week = new Week();
         for ($j = 0; $j < 7; $j++) {
             // 先月
             if ($i === 1 && $j < $this->firstDayWeekCode) {
                 $week->setDays(Day::forge($this->lastMonthFullDate($lastMonthLastDay + $j + 1), Day::LAST_MONTH)->calc());
                 continue;
             }
             // 当月
             if ($day <= $this->lastDay) {
                 $week->setDays(Day::forge($this->fullDate($day++))->calc());
                 continue;
             }
             // 来月
             $week->setDays(Day::forge($this->nextMonthFullDate($nextMonthDay++), Day::NEXT_MONTH)->calc());
         }
         $this->weeks[$i] = $week;
     }
     return $this;
 }
 /**
  * Test converting
  */
 function test_converting()
 {
     $dateAndTime = DateAndTime::withYearMonthDayHourMinuteSecondOffset(2005, 6, 4, 15, 25, 10, Duration::withHours(-5));
     // asDate()
     $temp = $dateAndTime->asDate();
     $this->assertTrue($temp->isEqualTo(Date::withYearMonthDay(2005, 6, 4)));
     // asDuration()
     $temp = $dateAndTime->asDuration();
     $this->assertTrue($temp->isEqualTo(Duration::withSeconds(55510)));
     // asDateAndTime()
     $temp = $dateAndTime->asDateAndTime();
     $this->assertTrue($temp->isEqualTo(DateAndTime::withYearMonthDayHourMinuteSecondOffset(2005, 6, 4, 15, 25, 10, Duration::withHours(-5))));
     // asLocal()
     $startDuration = Duration::withHours(-5);
     $localOffset = DateAndTime::localOffset();
     $difference = $localOffset->minus($startDuration);
     $temp = $dateAndTime->asLocal();
     $local = DateAndTime::withYearMonthDayHourMinuteSecondOffset(2005, 6, 4, 15 + $difference->hours(), 25, 10, $localOffset);
     $this->assertTrue($temp->isEqualTo($local));
     // asMonth()
     $temp = $dateAndTime->asMonth();
     $this->assertTrue($temp->isEqualTo(Month::withMonthYear(6, 2005)));
     // asSeconds()
     $localOffset = DateAndTime::localOffset();
     $this->assertEqual($dateAndTime->asSeconds(), 3295369510 + $localOffset->asSeconds());
     // asTime()
     $temp = $dateAndTime->asTime();
     $this->assertTrue($temp->isEqualTo(Time::withHourMinuteSecond(15, 25, 10)));
     $this->assertTrue($temp->isEqualTo(Time::withSeconds(55510)));
     // asTimeStamp()
     $temp = $dateAndTime->asTimeStamp();
     $this->assertTrue($temp->isEqualTo(TimeStamp::withYearMonthDayHourMinuteSecondOffset(2005, 6, 4, 15, 25, 10, Duration::withHours(-5))));
     // asUTC()
     $temp = $dateAndTime->asUTC();
     $this->assertTrue($temp->isEqualTo(DateAndTime::withYearMonthDayHourMinuteSecondOffset(2005, 6, 4, 20, 25, 10, Duration::withHours(0))));
     // asWeek()
     $temp = $dateAndTime->asWeek();
     $this->assertTrue($temp->isEqualTo(Week::starting($dateAndTime)));
     // asYear()
     $temp = $dateAndTime->asYear();
     $this->assertTrue($temp->isEqualTo(Year::starting($dateAndTime)));
     // midnight();
     $temp = $dateAndTime->atMidnight();
     $this->assertTrue($temp->isEqualTo(DateAndTime::withYearMonthDayHourMinuteSecond(2005, 6, 4, 0, 0, 0)));
     // middleOf()
     $dat = DateAndTime::withYearDay(2005, 100);
     $timespan = $dat->middleOf(Duration::withDays(100));
     $start = $timespan->start();
     $duration = $timespan->duration();
     $end = $timespan->end();
     $this->assertEqual($start->dayOfYear(), 50);
     $this->assertTrue($start->isEqualTo(DateAndTime::withYearDay(2005, 50)));
     $this->assertEqual($duration->days(), 100);
     $this->assertEqual($end->dayOfYear(), 149);
     // to()
     $datA = DateAndTime::withYearDay(2005, 125);
     $datB = DateAndTime::withYearDay(2006, 125);
     $timespan = $datA->to($datB);
     $this->assertEqual($timespan->startYear(), 2005);
     $this->assertEqual($timespan->dayOfYear(), 125);
     $duration = $timespan->duration();
     $this->assertTrue($duration->isEqualTo(Duration::withDays(365)));
     $end = $timespan->end();
     $this->assertEqual($end->julianDayNumber(), 2453860);
     $this->assertEqual($end->julianDayNumber() - $datA->julianDayNumber(), 364);
     $this->assertEqual($end->year(), 2006);
     $this->assertEqual($end->dayOfYear(), 124);
     $this->assertTrue($end->isEqualTo(DateAndTime::withYearDayHourMinuteSecond(2006, 124, 23, 59, 59)));
     // withOffset()
     $temp = $dateAndTime->withOffset(Duration::withHours(-7));
     $this->assertTrue($temp->isEqualTo(DateAndTime::withYearMonthDayHourMinuteSecondOffset(2005, 6, 4, 15, 25, 10, Duration::withHours(-7))));
 }
Example #10
0
 /**
  * Answer the week that represents this date's week
  * 
  * @return object Week
  * @access public
  * @since 5/5/05
  */
 function asWeek()
 {
     $obj = Week::starting($this);
     return $obj;
 }
Example #11
0
 /**
  * Declares an association between this object and a Week object.
  *
  * @param      Week $v
  * @return     Gradeunit The current object (for fluent API support)
  * @throws     PropelException
  */
 public function setWeek(Week $v = null)
 {
     if ($v === null) {
         $this->setWeekdayId(NULL);
     } else {
         $this->setWeekdayId($v->getId());
     }
     $this->aWeek = $v;
     // Add binding for other direction of this n:n relationship.
     // If this object has already been added to the Week object, it will not be re-added.
     if ($v !== null) {
         $v->addGradeunit($this);
     }
     return $this;
 }
/**
 * Use this method to sanity-check a Week object before it is inserted into the database
 * @param Week $w The week object to check
 *
 * @return bool true only if the week starts on a Sunday and has a length of 7 days, otherwise return false
 */
function assert_week_format(Week $w)
{
    $date = DateTime::createFromFormat("m-d-y", $w->get_id());
    $dow = $date->format("w");
    return $dow == 0 && count($w->get_dates()) == 7;
}
Example #13
0
 public function key()
 {
     return $this->current->getNumber();
 }
Example #14
0
 /**
  * Create a new object starting now, with a given duration. 
  * Override - as each Week has a defined duration
  * 
  * @param object DateAndTime $aDateAndTime
  * @param object Duration $aDuration
  * @param optional string $class DO NOT USE OUTSIDE OF PACKAGE.
  *		This parameter is used to get around the limitations of not being
  *		able to find the class of the object that recieved the initial 
  *		method call.
  * @return object Week
  * @access public
  * @since 5/5/05
  * @static
  */
 static function startingDuration($aDateAndTime, $aDuration, $class = 'Week')
 {
     // Validate our passed class name.
     if (!(strtolower($class) == strtolower('Week') || is_subclass_of(new $class(), 'Week'))) {
         die("Class, '{$class}', is not a subclass of 'Week'.");
     }
     $asDateAndTime = $aDateAndTime->asDateAndTime();
     $midnight = $asDateAndTime->atMidnight();
     $dayNames = ChronologyConstants::DayNames();
     $temp = $midnight->dayOfWeek() + 7 - array_search(Week::startDay(), $dayNames);
     $delta = abs($temp - intval($temp / 7) * 7);
     $adjusted = $midnight->minus(Duration::withDays($delta));
     $obj = parent::startingDuration($adjusted, Duration::withWeeks(1), $class);
     return $obj;
 }
Example #15
0
 /**
  * Answer the previous date whose weekday name is dayName.
  * 
  * @param string $dayNameString
  * @return object Date
  * @access public
  * @since 5/23/05
  */
 function previousDayNamed($dayNameString)
 {
     $days = abs($this->dayOfWeek() - Week::indexOfDay($dayNameString) % 7);
     if ($days == 0) {
         $days = 7;
     }
     $obj = $this->subtractDays($days);
     return $obj;
 }
Example #16
0
 /**
  * Test Converting Methods
  * 
  */
 function test_converting()
 {
     // Converting
     $timespan = Year::startingDuration(DateAndTime::withYearMonthDayHourMinuteSecondOffset(2005, 5, 4, 15, 25, 10, Duration::withHours(-4)), Duration::withDays(10));
     // asDate()
     $temp = $timespan->asDate();
     $this->assertTrue($temp->isEqualTo(Date::withYearMonthDay(2005, 5, 4)));
     // asDateAndTime()
     $temp = $timespan->asDateAndTime();
     $this->assertTrue($temp->isEqualTo(DateAndTime::withYearMonthDayHourMinuteSecond(2005, 5, 4, 00, 00, 00)));
     // asDuration()
     $temp = $timespan->asDuration();
     $this->assertTrue($temp->isEqualTo(Duration::withDays(365)));
     // asMonth()
     $temp = $timespan->asMonth();
     $this->assertTrue($temp->isEqualTo(Month::withMonthYear(5, 2005)));
     // asTime()
     $temp = $timespan->asTime();
     $dateAndTime = DateAndTime::withYearMonthDayHourMinuteSecond(2005, 5, 4, 0, 0, 0);
     $this->assertTrue($temp->isEqualTo($dateAndTime->asTime()));
     // asTimeStamp()
     $temp = $timespan->asTimeStamp();
     $this->assertTrue($temp->isEqualTo(TimeStamp::withYearMonthDayHourMinuteSecond(2005, 5, 4, 0, 0, 0)));
     // asWeek()
     $temp = $timespan->asWeek();
     $this->assertTrue($temp->isEqualTo(Week::starting(Date::withYearMonthDay(2005, 5, 1))));
     // asYear()
     $temp = $timespan->asYear();
     $this->assertTrue($temp->isEqualTo(Year::starting(Date::withYearMonthDay(2005, 5, 4))));
     // to()
     $temp = $timespan->to(Date::withYearMonthDay(2005, 10, 1));
     $comparison = Timespan::startingEnding(DateAndTime::withYearMonthDayHourMinuteSecond(2005, 5, 4, 0, 0, 0), Date::withYearMonthDay(2005, 10, 1));
     $this->assertTrue($temp->isEqualTo($comparison));
 }
Example #17
0
 /**
  * Test converting methods
  * 
  */
 function test_converting()
 {
     $time = Time::withHourMinuteSecond(15, 25, 10);
     // asDate ()
     $temp = $time->asDate();
     $this->assertTrue($temp->isEqualTo(Date::today()));
     $this->assertEqual(strtolower(get_class($temp)), 'date');
     // asDateAndTime ()
     $temp = $time->asDateAndTime();
     $comparison = DateAndTime::midnight();
     $comparison = $comparison->plus(Duration::withSeconds(55510));
     $this->assertTrue($temp->isEqualTo($comparison));
     $this->assertEqual(strtolower(get_class($temp)), 'dateandtime');
     // asDuration ()
     $temp = $time->asDuration();
     $this->assertTrue($temp->isEqualTo(Duration::withSeconds(55510)));
     $this->assertEqual(strtolower(get_class($temp)), 'duration');
     // asMonth ()
     $temp = $time->asMonth();
     $this->assertTrue($temp->isEqualTo(Month::starting(Date::today())));
     $this->assertEqual(strtolower(get_class($temp)), 'month');
     // asSeconds ()
     $this->assertEqual($time->asSeconds(), 55510);
     // asTime ()
     $temp = $time->asTime();
     $this->assertTrue($temp->isEqualTo($time));
     $this->assertEqual(strtolower(get_class($temp)), 'time');
     // asTimeStamp ()
     $temp = $time->asTimeStamp();
     $comparison = TimeStamp::midnight();
     $comparison = $comparison->plus(Duration::withSeconds(55510));
     $this->assertTrue($temp->isEqualTo($comparison));
     $this->assertEqual(strtolower(get_class($temp)), 'timestamp');
     // asWeek ()
     $temp = $time->asWeek();
     $this->assertTrue($temp->isEqualTo(Week::starting(Date::today())));
     $this->assertEqual(strtolower(get_class($temp)), 'week');
     // asYear ()
     $temp = $time->asYear();
     $this->assertTrue($temp->isEqualTo(Year::starting(Date::today())));
     $this->assertEqual(strtolower(get_class($temp)), 'year');
     // to ()
     $today = DateAndTime::today();
     $tomorrow = DateAndTime::tomorrow();
     $result = $time->to($tomorrow);
     $this->assertEqual(strtolower(get_class($result)), 'timespan');
     $this->assertTrue($result->isEqualTo(Timespan::startingDuration($today->plus(Duration::withSeconds(55510)), Duration::withDaysHoursMinutesSeconds(0, 8, 34, 50))));
     $result = $time->to(Time::withHourMinuteSecond(23, 25, 10));
     $this->assertEqual(strtolower(get_class($result)), 'timespan');
     $this->assertTrue($result->isEqualTo(Timespan::startingDuration($today->plus(Duration::withSeconds(55510)), Duration::withDaysHoursMinutesSeconds(0, 8, 0, 0))));
 }
Example #18
0
<?php

require_once "includes/init.php";
$user = new User();
$week = new Week();
$week->get_latest('videos', 'week_number');
$latest_wk = (int) $week->latest_week();
$week_order = isset($_GET['ver']) ? $_GET['ver'] : null;
if (isset($_GET['ver']) && !preg_match('/n/', $week_order)) {
    Redirect::to("index.php");
}
?>

<!DOCTYPE html>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="viewport" content="width=device-width, initial-scale=1">

		<title>The Story of MH370 In Online Videos</title>
		
		<meta name="Description" CONTENT=""/>
		<link rel="icon" href="images/favicon.ico" type="image/x-icon" />
		<!-- Bootstrap style-->
		<link href="css/bootstrap.min.css" rel="stylesheet">
		<link href="css/bootstrap-theme.css" rel="stylesheet">
		<!--owl-carousel styles-->
		<link rel="stylesheet" type="text/css" href="css/owl.carousel.css"/>
		<link rel="stylesheet" type="text/css" href="css/owl.theme.css"/>
		<link rel="stylesheet" type="text/css" href="css/owl.transitions.css"/>