public function actionDelete(Request $request) { if (!Oauth::isLogged()) { return $this->goBack(); } /* @var $model Unit */ $model = Unit::find($request->getAttribute('id')); if ($model->delete()) { Alert::add("Successful delete {$model->name}"); } return $this->goBack(); }
<?php use controller\OauthController as Oauth; use app\core\View; /* @var $this View */ if (!Oauth::isLogged()) { ?> <form class="form" method="post" role="form" action="<?php echo Main::$app->router->pathFor('login'); ?> "> <div class="form-group text-center"> <label>PIN</label> <input style="max-width: 200px; margin: auto;" type="text" class="form-control" placeholder="pin" name="pin" value=""> </div> <div class="col-xs-12 text-center"> <button class="btn btn-default" type="submit">auth</button> </div> </form> <?php } else { ?> <form class="form" method="post" fole="form" action="<?php echo Main::$app->router->pathFor('logout'); ?> "> <div class="col-xs-12 text-center"> <button class="btn btn-default" type="submit">logout</button> </div> </form> <?php
<?php use models\Unit; use app\core\View; use controller\OauthController as Oauth; /* @var $this View */ /* @var $unit Unit */ ?> <li id="unit-<?php echo $unit->id; ?> " class="list-group-item media unit"> <div class="buttons media-left "> <?php if (Oauth::isLogged()) { ?> <div class="form-group text-center"> <button type="button" class="btn ajax btn-default" data-target="<?php echo Main::$app->router->pathFor('unitUpdate', ['id' => $unit->id]); ?> "> Edit </button> </div> <?php } ?> <?php if ($unit->isImagesRequired()) { ?> <div class="form-group text-center">