Exemplo n.º 1
0
    /**
     * 予約オプション入力フォーム postbox
     *
     */
    private function _postbox_options()
    {
        $odate = new MTS_WPDate();
        $opt_number = $this->option->count_option();
        ?>
	<div class="postbox">
		<h3><?php 
        _e('Select Options', $this->domain);
        ?>
</h3>
		<div class="inside">
			<?php 
        if (empty($opt_number)) {
            ?>
<p>
				<?php 
            _e('The option which can be chosen has nothing.', $this->domain);
            ?>
			</p><?php 
        } else {
            ?>

			<table class="form-table" style="width: 100%">
			<?php 
            for ($i = 0; $i < $opt_number; $i++) {
                $option = $this->booking['options'][$i];
                ?>
<tr>
				<th>
					<label for="option_<?php 
                echo $option->getType() . '_' . $option->getKeyname();
                ?>
"><?php 
                echo $option->getLabel();
                ?>
</label>
				</th>
				<td><?php 
                switch ($option->getType()) {
                    case 'number':
                        ?>
						<input id="option_number_<?php 
                        echo $option->getKeyname();
                        ?>
" type="text" name="booking[options][<?php 
                        echo $option->getKeyname();
                        ?>
]" class="small-text" value="<?php 
                        echo $option->getValue();
                        ?>
" /> (0 | <?php 
                        echo $option->getPrice();
                        ?>
)
					<?php 
                        break;
                    case 'text':
                        ?>
						<input id="option_text_<?php 
                        echo $option->getKeyname();
                        ?>
" class="mts-fat" type="text" name="booking[options][<?php 
                        echo $option->getKeyname();
                        ?>
]" class="mts-fat" value="<?php 
                        echo $option->getValue();
                        ?>
" /> (0 | <?php 
                        echo $option->getPrice();
                        ?>
)
					<?php 
                        break;
                    case 'textarea':
                        ?>
						<textarea id="option_textarea_<?php 
                        echo $option->keyname;
                        ?>
" class="mts-fat" name="booking[options][<?php 
                        echo $option->keyname;
                        ?>
]" rows="8" cols="50"><?php 
                        echo esc_textarea($option->getValue());
                        ?>
</textarea> (0 | <?php 
                        echo $option->getPrice();
                        ?>
)
					<?php 
                        break;
                    case 'radio':
                        foreach ($option->getField() as $fieldname => $val) {
                            ?>
							<label class="field-item">
								<input id="option_radio_<?php 
                            echo $fieldname;
                            ?>
" type="radio" name="booking[options][<?php 
                            echo $option->getKeyname();
                            ?>
]" value="<?php 
                            echo $fieldname;
                            ?>
"<?php 
                            echo $fieldname == $option->getValue() ? ' checked="checked"' : '';
                            ?>
> <?php 
                            echo $val['label'] . " ({$val['time']} | {$val['price']})";
                            ?>
							</label><br />
						<?php 
                        }
                        break;
                    case 'select':
                        ?>
						<select id="option_select_<?php 
                        echo $option->getKeyname();
                        ?>
" name="booking[options][<?php 
                        echo $option->getKeyname();
                        ?>
]">
							<option value=""> </option>
						<?php 
                        foreach ($option->getField() as $fieldname => $val) {
                            ?>
							<option value="<?php 
                            echo $fieldname;
                            ?>
"<?php 
                            echo $fieldname == $option->getValue() ? ' selected="selected"' : '';
                            ?>
><?php 
                            echo $val['label'] . " ({$val['time']} | {$val['price']})";
                            ?>
</option>
						<?php 
                        }
                        ?>
						</select>
					<?php 
                        break;
                    case 'check':
                        foreach ($option->getField() as $fieldname => $val) {
                            ?>
							<input id="option_check_<?php 
                            echo $fieldname;
                            ?>
_" type="hidden" name="booking[options][<?php 
                            echo $option->getKeyname();
                            ?>
][<?php 
                            echo $fieldname;
                            ?>
]" value="0" />
							<label class="field-item">
								<input id="option_check_<?php 
                            echo $fieldname;
                            ?>
" type="checkbox" name="booking[options][<?php 
                            echo $option->getKeyname();
                            ?>
][<?php 
                            echo $fieldname;
                            ?>
]" value="1"<?php 
                            echo $option->isChecked($fieldname) ? ' checked="checked"' : '';
                            ?>
 /> <?php 
                            echo $val['label'] . " ({$val['time']} | {$val['price']})";
                            ?>
							</label><br />
						<?php 
                        }
                        break;
                    case 'date':
                        echo $odate->set_time($option->getValue())->date_form('booking-options-' . $option->getKeyname(), 'booking[options][' . $option->getKeyname() . ']') . ' (0 | ' . $option->getPrice() . ')';
                        break;
                    case 'time':
                        $otime = new MTS_WPTime($option->getValue());
                        echo $otime->time_form($option->keyname, 'booking[options]') . ' (0 | ' . $option->getPrice() . ')';
                        break;
                    default:
                        break;
                }
                ?>
</td>
			</tr><?php 
            }
            ?>
			</table><?php 
        }
        ?>
		</div>
	</div>

<?php 
    }
Exemplo n.º 2
0
    /**
     * オプションの確認フォーム出力
     *
     */
    private function _outconfirm_option()
    {
        ?>
		<tr>
			<td class="option-confirm-header" colspan="2"><?php 
        echo apply_filters('booking_form_option_title', 'オプション注文', 'confirm');
        ?>
</td>
		</tr>
		<?php 
        foreach ($this->booking['options'] as $option) {
            ?>
<tr id="confirmation-<?php 
            echo $option->keyname;
            ?>
">
			<th class="option-confirm-label"><?php 
            echo apply_filters("option_confirm_label", $option->getLabel(), array('name' => $option->keyname));
            ?>
</th>
			<td class="option-confirm-value">
				<?php 
            echo apply_filters("option_confirm_text", nl2br(esc_html($option->getText())), array('name' => $option->keyname));
            ?>
				<span class="option-confirm-note"> <?php 
            echo apply_filters("option_confirm_note", $option->getNote(), array('name' => $option->keyname));
            ?>
</span>

				<?php 
            switch ($option->getType()) {
                case 'number':
                case 'text':
                case 'radio':
                case 'select':
                case 'textarea':
                    ?>
						<input type="hidden" name="booking[options][<?php 
                    echo $option->keyname;
                    ?>
]" value="<?php 
                    echo esc_html($option->getValue());
                    ?>
" />
						<?php 
                    break;
                case 'check':
                    foreach ($option->field as $fieldname => $fieldlabel) {
                        ?>
							<input type="hidden" name="booking[options][<?php 
                        echo $option->keyname;
                        ?>
][<?php 
                        echo $fieldname;
                        ?>
]" value="<?php 
                        echo $option->isChecked($fieldname) ? '1' : '0';
                        ?>
" />
						<?php 
                    }
                    break;
                case 'date':
                    $odate = new MTS_WPDate();
                    echo $odate->set_time($option->getValue())->date_form_hidden("booking[options][{$option->keyname}]");
                    break;
                case 'time':
                    $otime = new MTS_WPTime($option->getValue());
                    echo $otime->time_form_hidden("booking[options][{$option->keyname}]");
                    break;
                default:
                    break;
            }
            ?>
</td>
		</tr><?php 
        }
        return;
    }
    /**
     * 予約データ入力フォーム postbox
     *
     */
    private function _postbox_booking()
    {
        $odate = new MTS_WPDate();
        ?>
	<div class="postbox">
		<h3><?php 
        _e('Booking Data', $this->domain);
        ?>
</h3>
		<div class="inside">
			<table class="form-table" style="width: 100%">
				<tr class="form-field">
					<th>
						<?php 
        _e('Booking Date', $this->domain);
        ?>
					</th>
					<td>
						<input type="hidden" name="booking[booking_id]" value="<?php 
        echo $this->booking['booking_id'];
        ?>
" />
						<?php 
        echo $odate->set_time($this->booking['booking_time'])->date_form('booking_time', 'booking');
        ?>
					</td>
				</tr>
				<tr class="form-field">
					<th>
						<?php 
        _e('Booking Event', $this->domain);
        ?>
					</th>
					<td>
						<select id="booking-article" class="booking-select-article" name="booking[article_id]">
							<?php 
        foreach ($this->articles as $article_id => $article) {
            echo "<option value=\"{$article_id}\"" . ($this->booking['article_id'] == $article_id ? ' selected="selected"' : '') . ">{$article['name']}</option>\n";
        }
        ?>
						</select>
						<select id="booking-time" class="booking-select-time" name="booking[timetable]">
							<?php 
        reset($this->articles);
        $article_id = empty($this->booking['article_id']) ? key($this->articles) : $this->booking['article_id'];
        $timetable = $this->booking['booking_time'] % 86400;
        //if (0 < $this->booking['booking_time']) {
        //	$timetable = $this->booking['booking_time']
        //	 - mktime(0, 0, 0, date('n', $this->booking['booking_time']), date('j', $this->booking['booking_time']), date('Y', $this->booking['booking_time']));
        //}
        if (empty($this->articles[$article_id]['timetable'])) {
            echo '<option value="">' . __('Nothing', $this->domain) . "</option>\n";
        } else {
            foreach ($this->articles[$article_id]['timetable'] as $time) {
                echo "<option value=\"{$time}\"" . ($timetable == $time ? ' selected="selected"' : '') . ">" . 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($this->domain . '_ajax');
        ?>
" />
					</td>
				</tr>
				<tr>
					<th>
						<?php 
        _e('Attendance', $this->domain);
        ?>
					</th>
					<td>
						<input id="booking-attendance" class="small-text" type="text" name="booking[number]" value="<?php 
        echo $this->booking['number'];
        ?>
" /> 人
					</td>
				</tr>
			</table>
		</div>
	</div>

<?php 
    }