Exemplo n.º 1
0
 public function actionSubmit()
 {
     $event = new Events();
     $address = new Addresses();
     if ($event->load(yii::$app->request->post()) && $event->save() && $address->load(yii::$app->request->post()) && $address->save()) {
         return $this->render('sucess');
     } else {
         return $this->return('unsucess');
     }
 }
Exemplo n.º 2
0
 protected function findModel($id)
 {
     if (($model = Events::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Exemplo n.º 3
0
 public function getEvents($amount = null)
 {
     $query = Events::find();
     if ($amount) {
         $query->limit($amount);
     }
     return $query->all();
 }
Exemplo n.º 4
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Events::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'city_id' => $this->city_id, 'event_date' => $this->event_date]);
     $query->andFilterWhere(['like', 'title_uk', $this->title_uk])->andFilterWhere(['like', 'title_ru', $this->title_ru])->andFilterWhere(['like', 'title_en', $this->title_en])->andFilterWhere(['like', 'address', $this->address]);
     return $dataProvider;
 }
Exemplo n.º 5
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Events::find();
     $dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => 4], 'sort' => ['defaultOrder' => ['id' => SORT_DESC]]]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'type' => $this->type, 'date' => $this->date, 'price' => $this->price, 'organizer_id' => $this->organizer_id, 'is_user_organizer' => $this->is_user_organizer, 'city_id' => $this->city_id, 'updated_at' => $this->updated_at, 'created_at' => $this->created_at]);
     $query->andFilterWhere(['like', 'direction', $this->direction])->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'about', $this->about])->andFilterWhere(['like', 'duration', $this->duration])->andFilterWhere(['like', 'schedule', $this->schedule])->andFilterWhere(['like', 'address', $this->address])->andFilterWhere(['like', 'phone', $this->phone])->andFilterWhere(['like', 'site', $this->site])->andFilterWhere(['like', 'map_coordinates', $this->map_coordinates]);
     return $dataProvider;
 }
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $this->date_dti_1 = time();
     $this->date_dti_2 = time();
     $query = Events::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     // переменная содержит диапазон дат в виде dti = '2015-09-01 2015-09-30'
     // http://www.yiiframework.com/forum/index.php/topic/62788-using-kartik-date-range-picker-for-filtering-in-gridview/
     if (isset($this->dti) && $this->dti != '') {
         $date_explode = explode("TO", $this->dti);
         // извлекаем первую дату
         $date1 = trim($date_explode[0]);
         $y1 = date("y", strtotime($date1));
         $m1 = date("m", strtotime($date1));
         $d1 = date("d", strtotime($date1));
         $this->date_dti_1 = mktime(0, 0, 0, $m1, $d1, $y1);
         $date2 = trim($date_explode[1]);
         $y2 = date("y", strtotime($date2));
         $m2 = date("m", strtotime($date2));
         $d2 = date("d", strtotime($date2));
         $this->date_dti_2 = mktime(23, 59, 59, $m2, $d2, $y2);
     }
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'code' => $this->code]);
     ////$query->andFilterWhere(['>=', 'dti', 'FROM_UNIXTIME('. $this->date_dti_1 . ')']);
     ////$query->orFilterWhere(['<=', 'dti', 'FROM_UNIXTIME('. $this->date_dti_2 . ')']);
     $query->andFilterWhere(['>=', 'dti', $this->date_dti_1]);
     $query->andFilterWhere(['<=', 'dti', $this->date_dti_2]);
     //        if($this->date_dti_1 == $this->date_dti_2){
     //
     //            $query->andFilterWhere(['>=', 'dti', $this->date_dti_1]);
     //        }
     //
     $query->andFilterWhere(['sys_n' => $this->sys_n]);
     //$query->andFilterWhere(['like', 'sys_n', $this->sys_n]);
     return $dataProvider;
 }
Exemplo n.º 7
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getEvent0()
 {
     return $this->hasOne(Events::className(), ['id' => 'event']);
 }
Exemplo n.º 8
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getEvents()
 {
     return $this->hasMany(Events::className(), ['id_user' => 'id']);
 }
Exemplo n.º 9
0
 /**
  * This function displays all the Events of customers
  *
  * @param string  POST Data
  *
  * @return all-events view with $events variable
  */
 public function ViewAllEventsAdmin()
 {
     $events = Events::select('*')->get();
     return view('events/all-events')->with('events', $events);
 }
Exemplo n.º 10
0
 public function store()
 {
     $getid = Events::select('EventID')->get();
     if (!$getid->isEmpty()) {
         $getid = Events::select('EventID')->orderBy('EventID', 'desc')->first()->get();
         foreach ($getid as $key) {
             $id = (int) $key->EventID + 1;
         }
     } else {
         $id = 1;
     }
     $result = Request::all();
     $quoteID = $result['quoteid'];
     $eventType = $result['eventType'];
     $downpayment = $result['downpayment'];
     $userID = Auth::user()->id;
     $addedDate = date('Y-m-d H:i:s');
     try {
         /*
          * Insert the new Quote to Database Table 'quote_requests'
          */
         $events = new Events();
         $events->EventID = $id;
         $events->QuoteID = $quoteID;
         $events->UserID = $userID;
         $events->EventType = $eventType;
         $events->AddedDate = $addedDate;
         $events->save();
         Quote_Requests::where('id', $quoteID)->update(['Status' => 'Paid']);
     } catch (QueryException $e) {
     }
     // ### Address
     // Base Address object used as shipping or billing
     // address in a payment. [Optional]
     $addr = Paypalpayment::address();
     $addr->setLine1("22/1, Nagavihara Road");
     $addr->setLine2("Pitakotte");
     $addr->setCity("Pitakotte");
     $addr->setState("");
     $addr->setPostalCode("10100");
     $addr->setCountryCode("SL");
     $addr->setPhone("0094773685526");
     // ### CreditCard
     $card = Paypalpayment::creditCard();
     $card->setType("visa")->setNumber("4758411877817150")->setExpireMonth("05")->setExpireYear("2019")->setCvv2("456")->setFirstName("Hasitha")->setLastName("Jayasinghe");
     // ### FundingInstrument
     // A resource representing a Payer's funding instrument.
     // Use a Payer ID (A unique identifier of the payer generated
     // and provided by the facilitator. This is required when
     // creating or using a tokenized funding instrument)
     // and the `CreditCardDetails`
     $fi = Paypalpayment::fundingInstrument();
     $fi->setCreditCard($card);
     // ### Payer
     // A resource representing a Payer that funds a payment
     // Use the List of `FundingInstrument` and the Payment Method
     // as 'credit_card'
     $payer = new Payer();
     $payer->setPaymentMethod('paypal');
     $item_1 = new Item();
     $item_1->setName('Quote ID: ' . $quoteID)->setCurrency('USD')->setQuantity(1)->setPrice($downpayment);
     // unit price
     // add item to list
     $item_list = new ItemList();
     $item_list->setItems(array($item_1));
     $amount = new Amount();
     $amount->setCurrency('USD')->setTotal($downpayment);
     $transaction = new Transaction();
     $transaction->setAmount($amount)->setItemList($item_list)->setDescription('Your transaction description');
     // ### Payment
     // A Payment Resource; create one using
     // the above types and intent as 'sale'
     $redirect_urls = new RedirectUrls();
     $redirect_urls->setReturnUrl(URL::route('payment-status'))->setCancelUrl(URL::route('payment-status'));
     $payment = new Payment();
     $payment->setIntent('order')->setPayer($payer)->setRedirectUrls($redirect_urls)->setTransactions(array($transaction));
     try {
         // ### Create Payment
         // Create a payment by posting to the APIService
         // using a valid ApiContext
         // The return object contains the status;
         $payment->create($this->_apiContext);
     } catch (\PPConnectionException $ex) {
         return "Exception: " . $ex->getMessage() . PHP_EOL;
         exit(1);
     }
     foreach ($payment->getLinks() as $link) {
         if ($link->getRel() == 'approval_url') {
             $redirect_url = $link->getHref();
             break;
         }
     }
     // add payment ID to session
     Session::put('paypal_payment_id', $payment->getId());
     if (isset($redirect_url)) {
         // redirect to paypal
         return Redirect::away($redirect_url);
     }
     return Redirect::route('original-route')->with('error', 'Unknown error occurred');
     dd($payment);
 }
 /**
  * Show the application dashboard.
  *
  * @return \Illuminate\Http\Response
  */
 public function dashboard()
 {
     return view('home')->with('eventCount', Events::where('UserID', Auth::User()->id)->get()->count())->with('todoCount', Todo::where('user_id', Auth::User()->id)->get()->count());
 }
Exemplo n.º 12
0
Arquivo: index.php Projeto: jeyfost/jf
    <img src="<?php 
echo Yii::$app->homeUrl;
?>
/img/news.png" class="center-block" />
    <br /><br />
    <div class="news-block">
        <div class="news-block-left">
            <?php 
foreach ($news as $n) {
    ?>
                <?php 
    if ($n->type == "poem") {
        $index_query = Poems::find()->select('header')->where(['id' => $n->stuff_id])->one();
    }
    if ($n->type == "event") {
        $index_query = Events::find()->where(['id' => $n->stuff_id])->one();
    }
    ?>

                <div class="news-entry" id="news<?php 
    echo Html::encode($n->id);
    ?>
"
                     onmouseover="changeNewsEntry('1', 'news<?php 
    echo Html::encode($n->id);
    ?>
', 'img<?php 
    echo Html::encode($n->id);
    ?>
', 'text<?php 
    echo Html::encode($n->id);
Exemplo n.º 13
0
 public function actionIndex()
 {
     $topPsychologists = new PsychologistTop();
     return $this->render('index', ['topPsychologists' => $topPsychologists->getTopPsychologists(4), 'eventsList' => Events::find()->limit('4')->orderBy('id DESC')->all(), 'articlesList' => Article::find()->with('articleAuthor')->limit('2')->orderBy('id DESC')->all()]);
 }