<p id="timeTitle">Виберіть годину</p><button id="exitButton" onclick="goOut('<?php echo $teacherId; ?>')">x</button> <p id="timeDate" onclick="chooseDate('<?php echo $teacherId; ?>')"><?php echo (Yii::app()->language == 'ua')?$day:Yii::app()->dateFormatter->format("d MMMM y",strtotime($day)); ?></p> <table class='timeGrid' id='<?php echo 'timeGrid'.$teacherId?>'> <?php for ($i = 9; $i < 23; $i++) { ?> <tr> <?php for ( $j = 0; $j < 3; $j++) { ?> <td class='<?php echo Consultationscalendar::classTD($teacherId,Consultationscalendar::timeInterval($i,$j,20),$day); ?>'> <?php echo Consultationscalendar::timeInterval($i,$j,20); ?> </td> <?php } ?> </tr> <?php } ?> </table> <div id="timeInfo"> Ви можете вибрати декілька консультацій. Використовуйте клавіші <span class="colorP">Ctrl</span> або <span class="colorP">Shift</span>. </div>
public function actionDeleteconsultation($id) { Consultationscalendar::model()->deleteByPk($id); if(!isset($_GET['ajax'])) $this->redirect(Yii::app()->request->urlReferrer); }
public static function consultationFree ($id, $times, $date) { $a = Consultationscalendar::model()->findAll("date_cons=:date and teacher_id=:id", array(':date'=>$date, ':id' => $id)); $result = true; $startTime = intval(substr($times, 0, 2))*60 + intval(substr($times, 3, 2)); $endTime = intval(substr($times, 6, 2))*60 + intval(substr($times, 9, 2)); foreach($a as $td){ $startCons = intval(substr($td->start_cons, 0, 2))*60 + intval(substr($td->start_cons, 3, 2)); $endCons = intval(substr($td->end_cons, 0, 2))*60 + intval(substr($td->end_cons, 3, 2)); if( ($startTime>=$startCons && $startTime<$endCons) || ($startCons>=$startTime && $startCons<$endTime)|| ($endCons>$startTime && $endCons<=$endTime)){ $result = false; } } return $result; }