コード例 #1
0
    /**
     * time オプション入力フォーム表示
     *
     */
    private function _outform_option_time($option)
    {
        // 時間入力ボックス
        $otime = new MTS_WPTime($option->getValue());
        ?>
		<tr>
			<th><?php 
        // ラベル表示
        $this->_out_option_label_header($option, false);
        ?>
			</th>
			<td>
				<?php 
        echo $otime->time_form($option->keyname, "booking[options]");
        $this->_out_option_note($option);
        // 注記
        $this->_out_option_price($option);
        // 単価
        $this->_out_option_err_message($option->keyname);
        // エラー表示
        ?>
			</td>
		</tr>
<?php 
        return;
    }
コード例 #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 
    }