0

我如何在 yii 框架中使用它?
我想使用这个http://www.innovativecounseling.com/Templates/timesheet_includes/jquery-ui-timepicker-0.1.3/ timepicker 并停用几个小时和分钟。

$('#timepicker').timepicker({
    showPeriod: true,
    onHourShow: OnHourShowCallback,
    onMinuteShow: OnMinuteShowCallback
});
function OnHourShowCallback(hour) {
  if ((hour > 22) || (hour < 6)) {
    return false; // not valid
}
return true; // valid
}
function OnMinuteShowCallback(hour, minute) {
  if ((hour == 22) && (minute >= 30)) { return false; } // not valid
  if ((hour == 6) && (minute < 30)) { return false; }   // not valid
  return true;  // valid
}

我在我的项目中使用这样的,但我怎样才能将它修改为我的时间选择器。

这是我在 _form.php 页面上的日期选择器和时间选择器...

<div class="row">
    <div class="tarih tarih2">
        <?php echo $form->labelEx($model,'tarih2'); ?>
        <?php
            $this->widget('zii.widgets.jui.CJuiDatePicker', array(
            'model' => $model,
            'attribute' => 'tarih2',
            'language' => 'tr',
            'options' => array(     
                'dateFormat' => 'dd-mm-yy',
                'size' => '10',         // textField size
                'maxlength' => '10',    // textField maxlength
                'minDate'=> date('d-m-Y', strtotime(Yii::app()->db->createCommand('select gidis_saat from tbl_takip where id="'. $model->id .'"')->queryScalar())),
            ),
            ));
        ?>
        <?php //echo $form->textField($model,'tarih'); ?>
        <?php echo $form->error($model,'tarih2'); ?>
    </div>

    <div class="tarih">
        <?php echo $form->labelEx($model,'donus_saat'); ?>
        <?php
            $this->widget('application.extensions.jui_timepicker.JTimePicker', array(
            'model'=>$model,
            'attribute'=>'donus_saat',
            // additional javascript options for the date picker plugin
            'options'=>array(
                //'showPeriod'=>true,  // Bu 12 - 24 saat arasında geçiş sağlıyor.
                'showPeriodLabels' => false,
                'showNowButton'=>true,
                'hourText' => 'Saat',
                'minuteText' => 'Dakika',
                'hours'=>array('starts'=>0, 'ends'=>23),
                'minutes'=>array('starts'=>0, 'ends'=>55, 'interval'=>5),
                ),
            'htmlOptions'=>array('size'=>8,'maxlength'=>8 ),
            ));
        ?>  
        <?php // echo $form->textField($model,'donus_saat'); ?>
        <?php echo $form->error($model,'donus_saat'); ?>
    </div>
</div>
4

1 回答 1

0

使用为时间选择器提供的扩展通过这个线程Yii Timepicker

于 2013-07-16T12:32:04.747 回答