Esempio n. 1
0
 public function run()
 {
     $person = CommandBusList::getPersonCommanBus()->handle(new GetCurrentPersonCommand());
     $person->setStudioId(IsSetStudioSpecification::EMPTY_STUDIO_ID);
     $this->getPersonCommandBus()->handle(new UpdatePersonCommand($person));
     \Yii::$app->response->redirect(URL::toRoute('/cabinet/' . $person->user()->slug()));
 }
Esempio n. 2
0
 public function run()
 {
     /**
      * @var Person $person
      */
     $person = CommandBusList::getPersonCommanBus()->handle(new GetCurrentPersonCommand());
     if (IsSetStudioSpecification::withoutStudio($person)) {
         \Yii::$app->response->redirect(URL::toRoute('/cabinet/' . $person->user()->slug()));
         \Yii::$app->end();
     }
     $studioForm = new StudioForm();
     if ($studioForm->load(\Yii::$app->request->post()) && $studioForm->validate()) {
         $transaction = \Yii::$app->getDb()->beginTransaction();
         try {
             /**
              * @var Studio $studio
              */
             $studio = $this->getStudioCommandBus()->handle(new CreateStudioCommand($studioForm->name, $studioForm->phone, $studioForm->address));
             $person->setStudioId($studio->id());
             $this->getPersonCommandBus()->handle(new UpdatePersonCommand($person));
             $transaction->commit();
             \Yii::$app->response->redirect(URL::toRoute('/cabinet'));
         } catch (Exception $e) {
             $studioForm->addError('name', $e->getMessage());
         }
         $transaction->rollBack();
     }
     return $this->controller->render('studio', ['studioForm' => $studioForm]);
 }
Esempio n. 3
0
 public function actionIndex()
 {
     switch (\Yii::$app->getUser()->identity->type) {
         case UserType::USER_BRIDE:
             \Yii::$app->response->redirect(URL::toRoute('bride/index'));
             \Yii::$app->end();
             break;
         case UserType::USER_PHOTOGRAPGER:
             \Yii::$app->response->redirect(URL::toRoute('photographer/index'));
             \Yii::$app->end();
             break;
         default:
             \Yii::$app->getUser()->logout();
             \Yii::$app->response->redirect(URL::toRoute('/'));
             \Yii::$app->end();
     }
 }
Esempio n. 4
0
 public function run($slug = false)
 {
     /**
      * @var Person $person
      */
     list($person, $slug) = $this->getPersonAndSlug($slug);
     $result = false;
     switch ($person->user()->type()->type()) {
         case UserType::USER_PHOTOGRAPGER:
             $result = (new photographer\IndexAction('index', $this->controller))->run($slug);
             break;
         case UserType::USER_BRIDE:
             $result = (new bride\IndexAction('index', $this->controller))->run($slug);
             break;
         default:
             \Yii::$app->getUser()->logout();
             \Yii::$app->response->redirect(URL::toRoute('/auth'));
             \Yii::$app->end();
     }
     return $result;
 }
Esempio n. 5
0
 public function run()
 {
     /**
      * @var Person $bride
      */
     $bride = $this->getPersonCommandBus()->handle(new GetCurrentPersonCommand());
     $wedding = WeddingRepository::getByBride($bride);
     $cabinetURL = URL::toRoute('/cabinet/' . $bride->user()->slug());
     if ($wedding instanceof Wedding) {
         \Yii::$app->response->redirect($cabinetURL);
         \Yii::$app->end();
     }
     $weddingForm = new WeddingForm();
     if ($weddingForm->load(\Yii::$app->getRequest()->post()) && $weddingForm->validate()) {
         $transaction = \Yii::$app->getDb()->beginTransaction();
         $groom = $this->getPersonCommandBus()->handle(new CreatePersonCommand($weddingForm->groomFirstName(), $weddingForm->groomLastName()));
         $this->getWeddingCommandBus()->handle(new CreateWeddingCommand($groom, $bride, $weddingForm->date()));
         $transaction->commit();
         \Yii::$app->response->redirect($cabinetURL);
         \Yii::$app->end();
     }
     return $this->controller->render('wedding', ['weddingForm' => $weddingForm]);
 }
Esempio n. 6
0
    ?>
                    <?php 
    foreach ($files as $file) {
        ?>
                        <img src="<?php 
        echo '/image/book/tmp/1/' . basename($file);
        ?>
" alt="" width="200"/>
                    <?php 
    }
    ?>
                <?php 
} else {
    ?>
                    <img data-url="<?php 
    echo URL::toRoute('book/file', true);
    ?>
" src="" alt="" width="200"/>
                <?php 
}
?>
            </div>
            <input type='file' id="upload-image" name="image" class="hide" accept=".jpg, .png, .jpeg">
            <button id="image" type="button" class="btn btn-default">Upload Title Image</button>
        </div>
        <div class="col-lg-5">
        </div>
    </div>
    <div class="form-group">
        <div class="col-lg-12 text-right">
            <button type="submit" class="btn btn-default">Submit</button>
Esempio n. 7
0
    ?>
</td>
            <td><?php 
    echo Ref::getDesc('role', $user->role);
    ?>
</td>
            <td align="center">
                <a href="<?php 
    echo URL::toRoute('user/edit');
    ?>
&id=<?php 
    echo $user->user_id;
    ?>
" title="Kemaskini" data-rel="tooltip"><span class="fa fa-pencil-square-o bigger-130"/></a>
                <a href="<?php 
    echo URL::toRoute('user/delete');
    ?>
&id=<?php 
    echo $user->user_id;
    ?>
" title="Hapus" data-rel="tooltip" class="askme"><span class="fa fa-trash-o bigger-130"/></a>
            </td>
        </tr>
    <?php 
}
?>
</table>

<?php 
echo LinkPager::widget(['pagination' => $pages]);
?>
Esempio n. 8
0
foreach ($refs as $r) {
    ?>
            <tr>
                <td><?php 
    echo $i++;
    ?>
.</td>
                <td><?php 
    echo $r->code;
    ?>
</td>
                <td><?php 
    echo $r->descr;
    ?>
</td>
                <td align='center'>
                    <a href="<?php 
    echo URL::toRoute('ref/list');
    ?>
&kat=<?php 
    echo $r->code;
    ?>
" class="green" title="Senarai Kod" data-rel="tooltip"><i class="glyphicon glyphicon-search bigger-130"></i></a>
                </td>
            </tr>
        <?php 
}
?>
 
    </table>
</div>
Esempio n. 9
0
 protected function validateRegistrationStep()
 {
     if (\Yii::$app->session->get('USER')->status == User::STATUS_REGISTERED) {
         \yii::$app->user->login(\Yii::$app->session->get('USER'));
         \Yii::$app->session->remove('USER');
         \yii::$app->response->redirect(URL::toRoute('/userDetails'));
         \Yii::$app->end();
     }
 }
Esempio n. 10
0
            <a href="<?php 
        echo URL::toRoute('/product/view/' . $product->id);
        ?>
"><img src="<?php 
        echo Url::to('/images/products/' . $product->image);
        ?>
"/></a>
            <p><?php 
        echo $product->description;
        ?>
</p>
            <p class="product_price">$ <?php 
        echo $product->price;
        ?>
</p>
            <a href="<?php 
        echo URL::toRoute('/cart/add/' . $product->id);
        ?>
" class="addtocart"></a>
            <a href="<?php 
        echo URL::toRoute('/product/view/' . $product->id);
        ?>
" class="detail"></a>
        </div>
    <?php 
    }
} else {
    ?>
    <p>Sorry, we don't have products</p>
<?php 
}
Esempio n. 11
0
">
                  </div>
                  <div class="media-body">
                    <h4 class="media-heading">
                        <strong><?php 
    echo $ad->subject;
    ?>
</strong>
                    </h4>
                    <p><?php 
    echo Html::encode($ad->body);
    ?>
</p>
                    <div class="media-footer clearfix">
                        <a href="<?php 
    echo URL::toRoute(['user/profile/show', 'id' => $ad->user->id]);
    ?>
" class="author"><?php 
    echo Html::encode($ad->user->profile->name ? $ad->user->profile->name : $ad->user->username);
    ?>
</a>
                        <span class="time"><?php 
    echo Yii::$app->formatter->format($ad->created_at, 'relativeTime');
    ?>
</span>
                    </div>
                  </div>
                </div>
            <?php 
}
?>
Esempio n. 12
0
 * @var Person $groom
 * @var Wedding $wedding
 * @var boolean $isOwner
 */
echo $bride->user()->type()->name();
?>
<h3><?php 
echo $bride->lastName();
?>
 <?php 
echo $bride->firstName();
?>
</h3>
<?php 
if ($isOwner) {
    echo HTML::a('Именить личные данные', [URL::toRoute('edit')], ['class' => 'btn btn-info pull-right']);
}
?>
<h4>Дата свадьбы</h4>
<?php 
echo $wedding->date() ? \Yii::$app->formatter->asDate($wedding->date()) : 'пусто';
?>
<h4>Жених</h4>
<?php 
echo $groom->lastName();
?>
 <?php 
echo $groom->firstName();
?>
<h4>О себе</h4>
<?php 
Esempio n. 13
0
                                    </div>
                                    <div class="col-xs-4 text-center">
                                        <a href="#">Sales</a>
                                    </div>
                                    <div class="col-xs-4 text-center">
                                        <a href="#">Friends</a>
                                    </div>
                                </li>
                                <!-- Menu Footer-->
                                <li class="user-footer">
                                    <div class="pull-left">
                                        <a href="#" class="btn btn-default btn-flat">Profile</a>
                                    </div>
                                    <div class="pull-right">
                                        <a href="<?php 
echo URL::toRoute(['/site/logout']);
?>
" class="btn btn-default btn-flat">Sign out</a>
                                    </div>
                                </li>
                            </ul>
                        </li>
                    </ul>
                </div>
            </nav>
        </header>

        <!-- Left side column. contains the logo and sidebar -->
        <aside class="main-sidebar">
            <!-- sidebar: style can be found in sidebar.less -->
            <section class="sidebar" style="height: auto;">
Esempio n. 14
0
                    </tr>
                    <tr>
                        <td>Model:</td>
                        <td><?php 
echo $product->title;
?>
</td>
                    </tr>
                    <tr>
                        <td>Manufacturer:</td>
                        <td>Apple</td>
                    </tr>
                </table>
                <div class="cleaner h20"></div>

                <a href="<?php 
echo URL::toRoute('/cart/add/' . $product->id);
?>
" class="addtocart"></a>

			</div>
            <div class="cleaner h30"></div>

            <h5>Product Description</h5>
            <p><?php 
echo $product->description;
?>
</p>

          <div class="cleaner h50"></div>
Esempio n. 15
0
        echo $product['description'];
        ?>
></td>
                        <td align="center"><input name="Form[<?php 
        echo $product['id'];
        ?>
]" type="text" class="quantity" value="<?php 
        echo $product['quantity'];
        ?>
" style="width: 20px; text-align: right" /> </td>
                        <td align="right" class="price"><?php 
        echo $product['price'];
        ?>
</td>
                        <td align="right" class="total">0</td>
                        <td align="center"> <a href="<? URL::toRoute('/cart/delete/'.$product['id']);?>"><img src="<?php 
        echo Url::to('/public/images/remove_x.gif');
        ?>
" alt="remove" /><br />Remove</a> </td>
                    </tr>
                <?php 
    }
    ?>
            </tbody>
            <tr>
                <td colspan="3" align="right"  height="30px">Have you modified your basket? Please click here to <input type="submit" value="Update">&nbsp;&nbsp;</td>
                <td align="right" style="background:#ddd; font-weight:bold"> Total $</td>
                <td align="right" style="background:#ddd; font-weight:bold" id="total">0 </td>
                <td style="background:#ddd; font-weight:bold"> </td>
            </tr>
Esempio n. 16
0
use domain\service\entities\Service;
use yii\helpers\Html;
use yii\helpers\Url;
use yii\widgets\ActiveForm;
/**
 * @var Service[]       $serviceList
 * @var PersonService[] $personServiceList
 * @var array           $hoursArray
 * @var bool            $isSaved
 */
?>
<!-- price -->
<div class="col-xs-7">
    <div class="alert alert-info">
        <?php 
$form = ActiveForm::begin(['action' => URL::toRoute('save-price'), 'options' => ['enctype' => 'multipart/form-data', 'method' => 'post', 'role' => 'form', 'class' => 'form-inline', 'data-pjax' => 1], 'id' => 'services']);
?>
        <div class="container-fluid">
            <?php 
foreach ($serviceList as $service) {
    ?>
                <div class="col-xs-4">
                    <label for="service[<?php 
    echo $service->id();
    ?>
]"><?php 
    echo $service->name();
    ?>
</label>
                </div>
                <div class="col-xs-2">
Esempio n. 17
0
<?php

use yii\widgets\ActiveForm;
use yii\helpers\Html;
use app\models\Ref;
use yii\helpers\Url;
?>
<legend>Daftar Pengguna Baru</legend>

<div class="well col col-sm-10">
    <?php 
$form = ActiveForm::begin(['action' => URL::toRoute('cms/save')]);
?>
    <input type="hidden" name="Cms[id]" value="<?php 
echo $model->id;
?>
">
    <div class="row">
        <div class="col col-sm-2">Tajuk</div>
        <div class="col col-sm-8"><?php 
echo $form->field($model, 'title')->label(false);
?>
</div>
    </div>
    <div class="row">
        <div class="col col-sm-2">Kandungan</div>
        <div class="col col-sm-8"><?php 
echo $form->field($model, 'content')->textarea(['rows' => 5])->label(false);
?>
</div>
    </div>