public function run() { $model = new Filter(); $model->city = $this->city; $model->date_n = $this->date_n; $model->time_n = $this->time_n; $model->language = $this->language; $model->guide = $this->guide; /*CITY*/ $citys = SegCities::model()->findAll(); /*TIME*/ $times = SegStarttimes::model()->findAll(); /*LANGUAGE*/ $languages = Languages::model()->findAll(); /*GUIDE*/ $criteria = new CDbCriteria(); $criteria->condition = 'cities_id=:cities_id'; $criteria->params = array(':cities_id' => $this->city); //$criteria->join = 'LEFT JOIN `users` ON (`users`.`id` = `t`.`users_id`)'; $guides_link = SegGuidesCities::model()->findAll($criteria); $guides = array(); $i = 0; foreach ($guides_link as $item) { $criteria_1 = new CDbCriteria(); $criteria_1->condition = 'id=:id'; $criteria_1->params = array(':id' => $item->users_id); $guides_contact = User::model()->find($criteria_1); // print_r($guides_contact); $criteria_2 = new CDbCriteria(); $criteria_2->condition = 'idcontacts=:idcontacts'; $criteria_2->params = array(':idcontacts' => $guides_contact->id_contact); $guides[$i] = SegContacts::model()->find($criteria_2); $i++; } $this->render('dopMenuFilter', array('citys' => $citys, 'times' => $times, 'languages' => $languages, 'guides' => $guides, 'model' => $model)); }
<? $citys = SegCities::model()->findAll(); $last_search = Yii::app()->session->get('last_search'); if($last_search !='') $arr = json_decode($last_search); $opt_city = ''; foreach($citys as $val){ $sel=''; if($model->city_ob->webadress_en == $val->webadress_en) $sel = 'selected'; $opt_city .= '<option value="'.$val->idseg_cities.'" data-city="'.$val->webadress_en.'" '.$sel.'>'.$val->seg_cityname.'</option>'; }; $times = SegStarttimes::model()->findAll(); $opt_time=''; foreach($times as $val){ $tm = str_replace("00:00","00",$val->timevalue); $sel=''; if(isset($_POST['SegScheduledTours']['starttime']) || !empty($arr->starttime)){ if(!empty($arr->starttime) && $arr->starttime == $val->timevalue) $sel = 'selected'; if(@$_POST['SegScheduledTours']['starttime'] == $val->timevalue) $sel = 'selected'; } $opt_time .= '<option value="'.$val->timevalue.'" '.$sel.'>'.$tm.'</option>'; }; $lang = Languages::model()->findAll(); $opt_lang=''; foreach($lang as $val){ $sel=''; if(isset($_POST['SegScheduledTours']['language_id']) || !empty($arr->language_id)){ if(!empty($arr->language_id) && $arr->language_id == $val->id_languages) $sel = 'selected'; if(isset($_POST['SegScheduledTours']['language_id'])){ if($_POST['SegScheduledTours']['language_id'] == $val->id_languages) $sel = 'selected'; }
public function loadStarttime($id) { $model=SegStarttimes::model()->findByPk($id); if($model===null) throw new CHttpException(404,'The requested page does not exist.'); return $model; }
echo $form->dropDownList($model, 'city_id', CHtml::listData(SegCities::model()->findAll(), 'idseg_cities', 'seg_cityname'), array('id' => 'pickcity', 'onChange' => 'do_city(value,0)')); ?> </div> </div> <div class="row-filter"> <div class="form-group"> <?php $this->widget('zii.widgets.jui.CJuiDatePicker', array('name' => 'SegScheduledTours[date]', 'attribute' => 'date', 'model' => $model, 'options' => array('showAnim' => 'fold', 'dateFormat' => 'dd.mm.yy'), 'htmlOptions' => array('class' => 'form-control-date-filter'))); // echo $form->textField($model,'date'); ?> </div> </div> <div class="row-filter"> <div class="form-group"> <?php echo $form->dropDownList($model, 'starttime', CHtml::listData(SegStarttimes::model()->findAll(), 'timevalue', 'timevalue'), array('empty' => 'Uhrzeit', 'id' => 'picktime')); ?> </div> </div> <div class="row-filter"> <?php echo $form->dropDownList($model, 'language_id', CHtml::listData(Languages::model()->findAll(), 'id_languages', 'germanname'), array('empty' => 'Sprache', 'id' => 'picklang')); ?> </div> <div class="row-filter"> <?php $gui = new User('search_gn'); echo $form->dropDownList($model, 'guide1_id', CHtml::listData($gui->search_gn(), 'id', 'guidename'), array('empty' => 'Guide', 'id' => 'pickguide')); ?> </div>
echo "Total scheduled tours:".$data->getTotalItemCount(); foreach ($data->getData() as $value) { $arr[$value->guidename][]=array($value->date,$value->starttime,$value->original_starttime); } ?> <table class='table shorttable' > <thead> <tr> <td>Zeitintervall</td> <?php foreach($arr as $key => $value){ echo "<td>".$key."</td>";} ?> </tr> </thead> <tbody> <?php $start_times_tour =SegStarttimes::model()->findAll(); $carr=count($arr); $dt =date_create($model->from_date); $interval=new DateInterval( "P1D" ); for($inx=0;$inx<7;$inx++){ $date_format=date_timestamp_get($dt); $curdate=Yii::app()->dateFormatter->format('EEEE, dd-MMMM-yyyy',$date_format); date_add($dt,$interval); echo "<tr><td class='daterow' colspan='".($carr+1)."'>".$curdate."</td></tr>"; foreach($start_times_tour as $item){ echo "<tr><td>".Yii::app()->dateFormatter->format('HH:mm',strtotime($item->timevalue))."</td>"; $classp="even"; foreach($arr as $value){
), 'htmlOptions'=>array( 'class'=>'form-control-date-filter', ), // 'fontSize'=>'0.8em' ) ); // echo $form->textField($model,'date'); ?> </div> </div> <div class="row-filter"> <div class="form-group"> <?php echo $form->dropDownList($model,'starttime', CHtml::listData (SegStarttimes::model()->findAll(),/*'idseg_starttimes'*/'timevalue', 'timevalue'), array('empty'=>'Uhrzeit','id'=>'picktime')); ?> </div> </div> <div class="row-filter"> <?php echo $form->dropDownList($model,'language_id', CHtml::listData (Languages::model()->findAll(),'id_languages', 'germanname'), array('empty'=>'Sprache','id'=>'picklang')); ?> </div> <div class="row-filter"> <?php $gui=new User('search_gn'); echo $form->dropDownList($model,'guide1_id',CHtml::listData($gui->search_gn(),'id','guidename'), array('empty'=>'Guide','id'=>'pickguide'));
public function actionWeeks($date) { $id_control = Yii::app()->user->id; // $update_user = User::model()->findByPk($id_user); $role_control = User::model()->findByPk($id_control)->id_usergroups; // $id_guide = SegGuidesdata::model()->findByPk($update_user->id_guide)->idseg_guidesdata; if ($role_control == 1) { $this->layout = "root"; } if ($role_control == 2) { $this->layout = "admin"; } if ($role_control == 3) { $this->layout = "office"; } if ($role_control == 5) { $this->layout = "guide"; } //city work $criteria_city = new CDbCriteria(); $criteria_city->condition = 'users_id=:users_id'; $criteria_city->params = array(':users_id' => $id_control); $id_city = SegGuidesCities::model()->find($criteria_city)->cities_id; $model_week = array(); $i = 0; $status_old = ''; $start_times_tour = SegStarttimes::model()->findAll(); foreach ($start_times_tour as $item) { $day = new DayResult(); $day->time = $item->timevalue; $date_format = strtotime($date); $criteria = new CDbCriteria(); $criteria->condition = 'original_starttime=:original_starttime AND date_now=:date_now AND city_id=:city_id'; $criteria->params = array(':original_starttime' => $item->timevalue, ':date_now' => $date_format, ':city_id' => $id_city); $scheduled_item = SegScheduledTours::model()->find($criteria); if (isset($scheduled_item)) { $day->id = $scheduled_item->idseg_scheduled_tours; $day->starttime = $scheduled_item->starttime; if ($scheduled_item->guide1_id == $id_control) { //if($scheduled_item->current_subscribers>0){ // $day->status ='Belegt, braucht aber einen Guide'; //}else{ $day->status = 'Belegt, Deine Tour!'; //} } else { $day->status = 'Belegt'; } } else { $day->id = 0; $day->status = 'frei!'; } if ($status_old == 'Belegt, Deine Tour!') { $day->status = 'Block'; } $status_old = $day->status; if ($day->status == 'Belegt, Deine Tour!') { if ($i != 0) { $model_week[$i - 1]->status = 'Block'; } } //$day_id_old1 = $day->id; //$day_id_old2 = $day->id; // $day->status = 1; $model_week[$i] = $day; $i++; } // $model=new CActiveDataProvider($model_week); // $date_format = date('Y-m-d', strtotime($date)); $this->render('weeks', array('date' => $date, 'model' => $model_week)); }
public function actionWeeks($date,$err=null) { $id_control = Yii::app()->user->id; // $update_user = User::model()->findByPk($id_user); $role_control = User::model()->findByPk($id_control)->id_usergroups; // $id_guide = SegGuidesdata::model()->findByPk($update_user->id_guide)->idseg_guidesdata; //city work $criteria_city = new CDbCriteria; $criteria_city->condition = 'users_id=:users_id'; $criteria_city->params = array(':users_id' => $id_control); $city = SegGuidesCities::model()->with('cities')->find($criteria_city); $dt =date_create($date); $model_week = array(); $start_times_tour =SegStarttimes::model()->findAll(); $interval=new DateInterval( "P1D" ); // setlocale(LC_TIME, array("de_de","de_DE", "de", "ge", "de-DE", "de-de","DE", "ge_GE")); Yii::app()->setLanguage("de_de"); for($inx=0;$inx<7;$inx++){ $model_day = array(); $i=0;$status_old =''; $date_format=date_timestamp_get($dt); // $curdate=strftime("%A, %d-%B-%Y",$date_format); $curdate=Yii::app()->dateFormatter->format('EEEE, dd-MMMM-yyyy',$date_format); date_add($dt,$interval); foreach($start_times_tour as $item){ $day = new DayResult; $day->time =Yii::app()->dateFormatter->format('HH:mm',strtotime($item->timevalue)); $day->date = Yii::app()->dateFormatter->format('dd.MM.yyyy',$date_format); // $date_format = strtotime($date); $criteria = new CDbCriteria; $criteria->condition = 'original_starttime=:original_starttime AND date_now=:date_now AND city_id=:city_id AND isCanceled=0'; $criteria->params = array(':original_starttime' => $item->timevalue,':date_now'=>$date_format,':city_id'=>$city->cities->idseg_cities); $scheduled_item = SegScheduledTours::model()->find($criteria); if(isset($scheduled_item)){ $day->id = $scheduled_item->idseg_scheduled_tours; $day->owner = $scheduled_item->guide1_id; $day->starttime = Yii::app()->dateFormatter->format('HH:mm',strtotime($scheduled_item->starttime)); if($scheduled_item->guide1_id == $id_control){ //if($scheduled_item->current_subscribers>0){ // $day->status ='Belegt, braucht aber einen Guide'; //}else{ $day->status ='Belegt, Deine Tour!'; //} }else{ $day->status ='Belegt'; } }else{ $day->id = 0; $day->status = 'frei!'; } if(($status_old=='Belegt, Deine Tour!')&&($day->status == 'frei!')){ $day->status ='Keine Aktion'; } if($day->status == 'Belegt, Deine Tour!'){ if($i!=0){ if($status_old=='frei!') $model_day[$i-1]->status = 'Keine Aktion'; } } $status_old = $day->status; //$day_id_old1 = $day->id; //$day_id_old2 = $day->id; // $day->status = 1; $model_day[$i] = $day; $i++; } $model_week[$inx]['day'] = $model_day; $model_week[$inx]['label'] = $curdate; } // $model=new CActiveDataProvider($model_week); // $date_format = date('Y-m-d', strtotime($date)); $test=array('guide'=>$this->loadGuide(),'tours'=>$this->loadTours(),'todo'=>$this->loadUnreported()); $this->render('weeks',array( 'date'=>$date, 'model'=>$model_week, 'info'=>$test, 'city'=>$city, 'err'=>$err, )); }