コード例 #1
0
 /** @inheritdoc */
 public function renderMetaBox(WP_Post $post)
 {
     OpeningHoursModule::setCurrentSetId($post->ID);
     $set = OpeningHoursModule::getCurrentSet();
     if (count($set->getHolidays()) < 1) {
         $set->getHolidays()->append(Holiday::createDummyPeriod());
     }
     $variables = array('holidays' => $set->getHolidays());
     echo $this->renderTemplate(self::TEMPLATE_PATH, $variables, 'once');
 }
コード例 #2
0
 /** @inheritdoc */
 public function renderMetaBox(WP_Post $post)
 {
     OpeningHoursModule::setCurrentSetId($post->ID);
     $set = OpeningHoursModule::getCurrentSet();
     if (count($set->getIrregularOpenings()) < 1) {
         $set->getIrregularOpenings()->append(IrregularOpening::createDummy());
     }
     $variables = array('irregular_openings' => $set->getIrregularOpenings());
     echo self::renderTemplate(static::TEMPLATE_PATH, $variables, 'once');
 }
コード例 #3
0
 /** @inheritdoc */
 public function renderMetaBox(WP_Post $post)
 {
     if (!OpeningHoursModule::getSets()->offsetExists($post->ID)) {
         OpeningHoursModule::getSets()->offsetSet($post->ID, new SetEntity($post->ID));
     }
     OpeningHoursModule::setCurrentSetId($post->ID);
     $set = OpeningHoursModule::getCurrentSet();
     $set->addDummyPeriods();
     $variables = array('post' => $post, 'set' => $set);
     echo static::renderTemplate(static::TEMPLATE_PATH, $variables, 'once');
 }
コード例 #4
0
ファイル: Period.php プロジェクト: misagues/WP-Opening-Hours
 /**
  * Checks if Period is currently open also regarding Holidays and SpecialOpenings
  *
  * @param     DateTime  $now
  * @param     Set       $set      The set in whose context to determine the opening status of this Period
  *
  * @return    bool
  */
 public function isOpen($now = null, Set $set = null)
 {
     if ($set == null) {
         $set = OpeningHours::getCurrentSet();
     }
     if ($set->isHolidayActive($now) or $set->isIrregularOpeningActive($now)) {
         return false;
     }
     return $this->isOpenStrict($now);
 }
コード例 #5
0
				<td class="col-times" colspan="2" valign="top">
					<div class="period-container" data-day="<?php 
    echo $index;
    ?>
"
					     data-set="<?php 
    echo OpeningHours::getCurrentSet()->getId();
    ?>
">

						<table class="period-table">
							<tbody>

							<?php 
    foreach (OpeningHours::getCurrentSet()->getPeriodsByDay($index) as $period) {
        echo OpeningHours::renderTemplate('ajax/op-set-period.php', array('period' => $period), 'always');
    }
    ?>

							</tbody>
						</table>

					</div>
				</td>

				<td class="col-options" valign="top">
					<a class="button add-period green has-icon">
						<i class="dashicons dashicons-plus"></i>
					</a>
				</td>