Ejemplo n.º 1
0
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $this->layout = "admin";
     $model = new SegScheduledTours();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['SegScheduledTours'])) {
         $model->attributes = $_POST['SegScheduledTours'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->idseg_scheduled_tours));
         }
     }
     $this->render('create', array('model' => $model));
 }
Ejemplo n.º 2
0
	public function actionTake($date,$time,$spont=0)
	{
	    $id_control = Yii::app()->user->id;
        // $update_user = User::model()->findByPk($id_user);
 			$arrtime=explode(":",$time);
			$ortime=$arrtime[0].":00:00";
         
            $date_format =  strtotime($date);
            $date_bd = date('Y-m-d',$date_format);
			$err="";
			if($spont>0)
			{
		      $criteria = new CDbCriteria;
			  $criteria->condition = 'original_starttime=:original_starttime AND date_now=:date_now AND guide1_id=:guide_id';
            $criteria->params = array(':original_starttime' => $ortime,':date_now'=>$date_format,':guide_id'=>$id_control);
            $scheduled_item = SegScheduledTours::model()->find($criteria);
			if($scheduled_item){
				$err=$time;
				$this->redirect( array('weeks','date'=>$date,'err'=>$err) );
			}
 
			}
			
            $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;
  
                $scheduled_item = new SegScheduledTours;
                $scheduled_item->starttime = $time;
                $scheduled_item->date_now = $date_format;
				$scheduled_item->date = $date_bd;
                $scheduled_item->guide1_id = $id_control;
                $scheduled_item->original_starttime = $ortime;
                $scheduled_item->visibility = 1;
               // $scheduled_item->tourroute_id =  $tour_schel;
                $scheduled_item->city_id = $id_city;
                $scheduled_item->save();
                $this->redirect(array('weeks','date'=>$date)) ;
   
    }