public function actionBooking()
 {
     Yii::app()->clientScript->registerCssFile(Yii::app()->theme->baseUrl . "/css/request-date.css");
     Yii::app()->clientScript->registerCssFile(Yii::app()->theme->baseUrl . "/css/request-date-resp.css");
     Yii::app()->clientScript->registerScriptFile(Yii::app()->theme->baseUrl . "/js/plugins/responsive-calendar/responsive-calendar.js", CClientScript::POS_END);
     Yii::app()->clientScript->registerScriptFile(Yii::app()->theme->baseUrl . "/js/request-booking.js", CClientScript::POS_END);
     if (Yii::app()->request->isPostRequest) {
         $getDate = Yii::app()->request->getParam('changeDate', false);
         $dateObj = DateTime::createFromFormat('j-n-Y', $getDate);
         if ($dateObj) {
             $dateObj = new DateTime($getDate);
             $this->_model->bookingDate = $dateObj->format('Y-m-d');
             $this->_model->save();
         }
     }
     $today = ComponentTime::todayStart();
     $events = array();
     //        $bookingDate = new DateTime(date('Y-m-d', strtotime($this->_model->bookingDate)));
     //        while ($bookingDate >= $today) {
     //            $events[$bookingDate->format('Y-m-d')] = array(
     //                'number' => 1,
     //            );
     //            $bookingDate->modify('-1 day');
     //        }
     $options = array('time' => date('Y-m', strtotime($this->_model->bookingDate)), 'events' => $events);
     $criteria = new CDbCriteria();
     $criteria->addCondition('mstRequestUsers.user_id = ' . Yii::app()->user->getInfo());
     $criteria->addCondition('mstRequestUsers.archived = 0');
     $criteria->addCondition('booking_type > 0');
     $criteria->with = array('mstRequestUsers');
     $modelArray = Requests::model()->findAll($criteria);
     $requests = array();
     foreach ($modelArray as $model) {
         $requests[] = array('color' => ComponentType::booking($model->booking_type), 'day' => date('j', strtotime($model->eventDate)), 'month' => date('n', strtotime($model->eventDate)), 'year' => date('Y', strtotime($model->eventDate)));
     }
     $passedDays = array();
     $created_on = new DateTime(date('Y-m-d', strtotime($this->_model->created_on)));
     while ($created_on < $today) {
         $passedDays[] = array('day' => $created_on->format('j'), 'month' => $created_on->format('n'), 'year' => $created_on->format('Y'));
         $created_on->modify('+1 day');
     }
     $today = array('day' => $today->format('j'), 'month' => $today->format('n'), 'year' => $today->format('Y'));
     $bookingDate = new DateTime(date('Y-m-d', strtotime($this->_model->bookingDate)));
     //        $bookingDate = array(
     //            'day' => $bookingDate->format('j'),
     //            'month' => $bookingDate->format('n'),
     //            'year' => $bookingDate->format('Y'),
     //        );
     $array = array('options' => $options, 'color' => ComponentType::booking($this->_model->booking_type), 'today' => $today, 'requests' => $requests, 'passedDays' => $passedDays, 'bookingDate' => $bookingDate->format('m-d-Y'));
     $json = json_encode($array);
     Yii::app()->clientScript->registerScript('mapvar10', "var json='" . $json . "';", CClientScript::POS_HEAD);
     $this->render('booking', array('model' => $this->_model));
 }
Exemple #2
0
                                    <div class="col-md-4 col-sm-4 col-xs-4 service-event-duration text-center">
                                        <h4>Duration</h4>
                                        <p class="text-center">0 Hours</p>
                                    </div>
                                    <div class="col-md-4 col-sm-4 col-xs-4 service-event-duration text-right no-padd">
                                        <h4 centered>End Time</h4>
                                        <p name="timeEnd[]" class="timeframe-on-hold">
                                            23:00
                                        </p>
                                    </div>
                                </div>
                            </div>
                        <!--Service TIME BOXES 2 END-->
                        </div>
                        <div class="teamButtonDiv col-md-12">
                            <button class="btn btn-primary buttonSmallStyle <?php 
    echo ComponentType::booking($model->booking_type);
    ?>
">SAVE</button>
                        </div>
                        <?php 
}
?>
                     </div>
                </form>
            </div>
        </div>
        <!--------/Content---------->
    </div>
</div>
<!--Container end-->
Exemple #3
0
        <!-----------Content--------->
        <div class="col66 pageContent">
            <div class="col-md-12 col-sm-12 col-xs-12 timeline-box shadow">
                <section id="cd-timeline" class="cd-container">
                    <div class="timeline-start">
                        <span>START</span>
                    </div>
                    <?php 
$thisDate = false;
$today = new DateTime();
$todayFormat = $today->format('d-m-Y');
foreach ($timelinesArray as $timeline) {
    $right = $timeline->created_by != $timeline->request->created_by;
    $theDate = new DateTime($timeline->created_on);
    $class = ComponentType::booking($timeline->booking_type_id);
    $creatorFullName = $timeline->createdBy->firstName . ' ' . $timeline->createdBy->lastName;
    $topDate = ($todayFormat == $theDate->format('d-m-Y') ? 'Today | ' : '') . $theDate->format('l, dS F Y');
    $sideDate = $todayFormat == $theDate->format('d-m-Y') ? 'Today | ' . $theDate->format('H:i A') : $theDate->format('D d M | H:i A');
    $finalArray = array(6);
    if (in_array($timeline->timeline_name_id, $finalArray)) {
        ?>
                            <div class="cd-timeline-block">
                                <div class="timeline-end  <?php 
        echo $class;
        ?>
 is-hidden">
                                    <p><?php 
        echo $timeline->timelineName->name;
        ?>
</p>
Exemple #4
0
 public function actionChat()
 {
     $limit = 5;
     $id = (int) Yii::app()->request->getParam('id', 0);
     $status = (bool) $this->isReal($id);
     if ($status) {
         $requestModel = $this->isReal($id)['model'];
         $criteria = new CDbCriteria();
         $criteria->addCondition('request.id = ' . $requestModel->id);
         $criteria->addCondition('t.status = 1');
         $criteria->order = 't.created_on DESC';
         $criteria->with = array('request');
         $modelTotalArrayCount = Messages::model()->count($criteria);
         $criteria->limit = $limit;
         $modelArray = Messages::model()->findAll($criteria);
         $messagesArray = array();
         foreach ($modelArray as $model) {
             $messagesArray[] = array('id' => $model->id, 'message' => $model->message, 'booking_type' => $model->booking_type, 'date' => $model->created_on, 'creator' => $model->created_by);
         }
         if ($modelTotalArrayCount < $limit) {
             $messagesArray[] = array('id' => false, 'message' => $requestModel->title, 'booking_type' => $requestModel->booking_type, 'date' => $requestModel->created_on, 'creator' => $requestModel->created_by);
         }
         echo '<ul class="chat">';
         foreach ($messagesArray as $message) {
             $divPhoto = "<li class='li-photo'><div class='chat-imgCircle'>\n                    <img src='" . ActionClass::getProfileImage($message['creator']) . "'/>\n                    </div></li>";
             $divMessage = '<li class="li-message"><div class="message">
                 <p class="chat-txt">' . $message['message'] . '</p>
                 <p class="chat-data-time">' . date('D H:i', strtotime($message['date'])) . '</p>
                 </div></li>';
             $divTrash = '<li class="li-chat-trash"><div class="trash">';
             if ($message['creator'] == Yii::app()->user->getInfo()) {
                 $divTrash .= '<p class="chat-trash" data-id="' . $message['id'] . '"><i class="fa fa-trash-o"></i></p>';
             }
             $divTrash .= '<p  class="color-' . ComponentType::booking($message['booking_type']) . '"><i class="fa fa-check-circle"></i></p>
                 </div></li>';
             echo '<li class="chat-user-' . ($message['creator'] == Yii::app()->user->getInfo() ? 'receive' : 'send') . ' clearfix" ><div class=""><ul>';
             echo $message['creator'] == Yii::app()->user->getInfo() ? $divTrash . $divMessage . $divPhoto : $divPhoto . $divMessage . $divTrash;
             echo '</ul></div></li>';
         }
         echo '</ul>';
     }
 }
Exemple #5
0
 public function actionBookings()
 {
     $this->pageParamsArray = array('provisional', 'confirmed', 'cancelled');
     $this->_setPage(Yii::app()->request->getQuery('params', false));
     Yii::app()->clientScript->registerCssFile(Yii::app()->theme->baseUrl . "/css/my-quotes.css");
     Yii::app()->clientScript->registerCssFile(Yii::app()->theme->baseUrl . "/css/my-quotes-resp.css");
     $criteria = new CDbCriteria();
     $criteria->addCondition('mstRequestUsers.user_id = ' . Yii::app()->user->getInfo());
     $criteria->addCondition('mstRequestUsers.archived = 0');
     $criteria->addCondition('booking_type = ' . ComponentType::bookingType($this->pageParams));
     $criteria->order = 'created_on DESC';
     $criteria->with = array('mstRequestUsers');
     $modelArray = Requests::model()->findAll($criteria);
     $this->render('bookings', array('modelArray' => $modelArray));
 }