Example #1
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;
    }
Example #2
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 
    }