Ejemplo n.º 1
0
 /**
  * Signs user up.
  *
  * @return User|null the saved model or null if saving fails
  */
 public function signup($id)
 {
     if ($this->validate()) {
         $flag = 1;
         $request = new Reply();
         $carr = new Carrequest();
         $query2 = (new Query())->select('user_name,dealer_name,car_model,request_id')->from('carrequest')->where('id=:id', array(':id' => $id));
         $data2 = $query2->one();
         $use = new User();
         $user = Yii::$app->user->identity->username;
         $val = $use->findByUsername($user);
         $userr = $use->findByUsername($data2['user_name']);
         $request->username = $data2['user_name'];
         $request->car_model = $data2['car_model'];
         $request->dealer_name = $data2['dealer_name'];
         $request->dealer_id = $val->id;
         $request->request_id = $id;
         $request->userreq_id = $data2['request_id'];
         $request->feature = $this->feature;
         $request->price = $this->price . ',' . $this->roadt . ',' . $this->handc . ',' . $this->compin . ',' . $this->depin . ',' . $this->engc . ',' . $this->rtoinv . ',' . $this->cashs . ',' . $this->cashd;
         $com = $this->compa;
         $com1 = $this->comps;
         $access = "access";
         $service = "service";
         foreach ($com as $acom) {
             $access = $access . ',' . $acom;
         }
         foreach ($com1 as $acom1) {
             $service = $service . ',' . $acom1;
         }
         $request->access = $access;
         $request->service = $service;
         $request->other = $this->other;
         $request->fuel = $this->fuel;
         $request->sname = $this->sname;
         $request->scontact = $this->scontact;
         $dreply = new Dealerreply();
         $dreply->username = $data2['user_name'];
         $dreply->dealer_name = $data2['dealer_name'];
         $dreply->request_id = $data2['request_id'];
         if ($request->save() && $dreply->save()) {
             \Yii::$app->mailer->compose(['html' => 'requestreply-html'], ['user' => $userr, 'req' => $request])->setFrom([\Yii::$app->params['supportEmail'] => \Yii::$app->name . ' robot'])->setTo($userr->email)->setSubject('New Reply ' . $request->car_model)->send();
             return $request;
         }
         return null;
         //$user->username = $this->username;
     }
 }
Ejemplo n.º 2
0
</tr>




<?php 
if (count($rows) > 0) {
    foreach ($rows as $row) {
        echo "<tr>";
        $car = Car::find()->where('id=:id', array('id' => $row->car_id))->one();
        $reqs = Carrequest::find()->where('request_id=:id', array('id' => $row->id))->all();
        if (count($reqs) > 0) {
            foreach ($reqs as $req) {
                if ($req->status == 1) {
                    $reply = Reply::find()->where('request_id=:id', array('id' => $req->id))->one();
                    echo "<td>" . $row->id . "</td>";
                    echo "<td>" . $req->dealer_id . "</td>";
                    echo "<td>" . $car->model . "</td>";
                    echo "<td>" . $car->model_name . "</td>";
                    echo "<td>" . $car->fuel . "</td>";
                    echo "<td>" . $car->variant . "</td>";
                    echo "<td>" . $row->color . "</td>";
                    echo "<td>" . $row->delivery . "</td>";
                    if (count($reply) > 0) {
                        echo "<td><b>" . $reply->price . "</b></td>";
                        $data = explode(",", $reply->feature);
                        echo "<td>";
                        for ($i = 0; $i < count($data); $i++) {
                            echo "<span class=\"glyphicon glyphicon-ok\" aria-hidden=true style=\" margin-right:5px;color:green; border:solid\"></span> " . $data[$i] . "<br>";
                        }