Пример #1
0
 /**
  * 予約データの読み込み
  *
  * @booking_id
  * @return $bookingタイプ
  */
 protected function get_booking($booking_id)
 {
     global $wpdb;
     $record = $wpdb->get_row($wpdb->prepare("\n\t\t\tSELECT * FROM {$this->tblBooking}\n\t\t\tWHERE booking_id=%d", intval($booking_id)), ARRAY_A);
     if (empty($record)) {
         return false;
     }
     $booked = $record;
     $booking = $this->new_booking($booked['booking_time'], $booked['article_id']);
     $booked['options'] = unserialize($record['options']);
     $booked['client'] = unserialize($record['client']);
     $birthday = new MTS_WPDate();
     if (isset($booked['client']['birthday'])) {
         $birthday->set_date($booked['client']['birthday']);
     }
     $booked['client']['birthday'] = $birthday;
     // オプションデータをオプションオブジェクトにセットする
     $booking = $this->array_merge_default($booking, $booked);
     return $booking;
 }
Пример #2
0
    /**
     * 新規予約登録 予約品目の選択
     *
     */
    private function _select_article_page()
    {
        // 予約品目
        $articles = MTSSB_Article::get_all_articles();
        // 日付フォームオブジェクト生成、初期日付をセット
        $odate = new MTS_WPDate();
        $odate->set_date(date_i18n('Y-n-j'));
        $article_id = key($articles);
        ?>
	<div class="wrap">

		<?php 
        screen_icon('edit');
        ?>
		<h2><?php 
        _e('Add Booking', $this->domain);
        ?>
</h2>
		<?php 
        if (!empty($this->message)) {
            ?>
			<div class="<?php 
            echo $this->errflg ? 'error' : 'updated';
            ?>
"><p><strong><?php 
            echo $this->message;
            ?>
</strong></p></div>
		<?php 
        }
        ?>

		<h3><?php 
        _e('Select article', $this->domain);
        ?>
</h3>
		<form id="select-article" method="get" action="<?php 
        echo $_SERVER['REQUEST_URI'];
        ?>
">
			<input type="hidden" name="page" value="<?php 
        echo self::PAGE_NAME;
        ?>
" />

			<table class="form-table" style="width: 100%">
				<tr class="form-field">
					<th>
						<?php 
        _e('Booking Date', $this->domain);
        ?>
					</th>
					<td>
						<?php 
        echo $odate->date_form('booking_new', 'bd');
        ?>
					</td>
				</tr>
				<tr class="form-field">
					<th>
						<?php 
        _e('Booking Event', $this->domain);
        ?>
					</th>
					<td>
						<select id="booking-article" class="booking-select-article" name="article_id">
							<?php 
        foreach ($articles as $aid => $article) {
            echo "<option value=\"{$aid}\">{$article['name']}</option>\n";
        }
        ?>
						</select>
						<select id="booking-time" class="booking-select-time" name="timetable">
							<?php 
        if (empty($articles[$article_id]['timetable'])) {
            echo '<option value="">' . __('Nothing', $this->domain) . "</option>\n";
        } else {
            foreach ($articles[$article_id]['timetable'] as $time) {
                echo "<option value=\"{$time}\">" . date('H:i', $time) . "</option>\n";
            }
        }
        ?>
						</select>
						<span id="loader-img" style="display:none"><img src="<?php 
        echo $this->plugin_url . 'image/ajax-loader.gif';
        ?>
" alt="Loading" /></span>
						<input type="hidden" id="ajax-nonce" value="<?php 
        echo wp_create_nonce('mtssb_get_timetable');
        ?>
">
					</td>
				</tr>
			</table>

			<p><input class="button-secondary" type="submit" value="<?php 
        _e('Add booking', $this->domain);
        ?>
" /></P>
		</form>
	</div>

    <?php 
    }