@@ -2,10 +2,7 @@ | |||
namespace backend\controllers; | |||
use yii; | |||
use common\controllers\CommonController; | |||
class BackendController extends CommonController { | |||
class BackendController extends \common\controllers\CommonController { | |||
} | |||
@@ -2,28 +2,6 @@ | |||
namespace backend\controllers; | |||
use common\models\ProductionProduit; | |||
use Yii; | |||
use common\models\Production; | |||
use yii\filters\AccessControl; | |||
use yii\web\Controller; | |||
use common\models\LoginForm; | |||
use yii\filters\VerbFilter; | |||
use common\models\Commande; | |||
use common\models\CommandeProduit; | |||
use common\models\PointVente; | |||
use common\models\PointVenteUser; | |||
use common\models\Produit; | |||
use common\helpers\CSV; | |||
use common\models\User; | |||
use kartik\mpdf\Pdf; | |||
use common\models\CommandeAutoForm; | |||
use common\models\CommandeAuto; | |||
use common\models\CreditHistorique; | |||
use common\models\UserEtablissement; | |||
use yii\helpers\Html; | |||
use common\models\ProductionPointVente; | |||
class CommandeController extends BackendController { | |||
var $enableCsrfValidation = false; |
@@ -2,24 +2,6 @@ | |||
namespace backend\controllers; | |||
use Yii; | |||
use common\models\Production; | |||
use yii\filters\AccessControl; | |||
use yii\web\Controller; | |||
use common\models\LoginForm; | |||
use yii\filters\VerbFilter; | |||
use common\models\Commande; | |||
use common\models\CommandeProduit; | |||
use common\models\PointVente; | |||
use common\models\Produit; | |||
use common\models\User; | |||
use common\models\CommandeAutoForm; | |||
use common\models\ProductionProduit; | |||
use yii\data\ActiveDataProvider; | |||
use common\models\CommandeAuto; | |||
use common\models\CommandeAutoProduit; | |||
use yii\web\NotFoundHttpException; | |||
class CommandeautoController extends BackendController { | |||
var $enableCsrfValidation = false; |
@@ -2,16 +2,6 @@ | |||
namespace backend\controllers; | |||
use Yii; | |||
use common\models\User; | |||
use yii\data\ActiveDataProvider; | |||
use yii\web\Controller; | |||
use yii\web\NotFoundHttpException; | |||
use yii\filters\VerbFilter; | |||
use yii\filters\AccessControl; | |||
use kartik\mpdf\Pdf; | |||
use common\models\Etablissement; | |||
/** | |||
* UserController implements the CRUD actions for User model. | |||
*/ |
@@ -2,24 +2,6 @@ | |||
namespace backend\controllers; | |||
use Yii; | |||
use common\models\User; | |||
use backend\models\MailForm; | |||
use yii\data\ActiveDataProvider; | |||
use yii\web\Controller; | |||
use yii\web\NotFoundHttpException; | |||
use yii\filters\VerbFilter; | |||
use yii\filters\AccessControl; | |||
use common\helpers\Upload; | |||
use common\helpers\Password; | |||
use common\models\UserEtablissement; | |||
use common\models\Etablissement; | |||
use yii\base\UserException; | |||
use common\models\CreditHistorique; | |||
use backend\models\CreditForm; | |||
use common\models\Commande; | |||
use common\helpers\Mail; | |||
/** | |||
* UserController implements the CRUD actions for User model. | |||
*/ | |||
@@ -46,10 +28,10 @@ class UserController extends BackendController { | |||
$action->actionMethod == 'actionCredit' || | |||
$action->actionMethod == 'actionMail' || | |||
$action->actionMethod == 'actionCommandes') { | |||
return Yii::$app->user->identity->status == USER::STATUS_ADMIN | |||
|| Yii::$app->user->identity->status == USER::STATUS_BOULANGER; | |||
return Yii::$app->user->identity->status == User::STATUS_ADMIN | |||
|| Yii::$app->user->identity->status == User::STATUS_BOULANGER; | |||
} else { | |||
return Yii::$app->user->identity->status == USER::STATUS_ADMIN; | |||
return Yii::$app->user->identity->status == User::STATUS_ADMIN; | |||
} | |||
} | |||
] | |||
@@ -64,7 +46,7 @@ class UserController extends BackendController { | |||
*/ | |||
public function actionIndex() { | |||
$params = Yii::$app->request->queryParams; | |||
$query = User::findBy($params); | |||
$dataProvider = new ActiveDataProvider([ |
@@ -3,3 +3,31 @@ Yii::setAlias('common', dirname(__DIR__)); | |||
Yii::setAlias('frontend', dirname(dirname(__DIR__)) . '/frontend'); | |||
Yii::setAlias('backend', dirname(dirname(__DIR__)) . '/backend'); | |||
Yii::setAlias('console', dirname(dirname(__DIR__)) . '/console'); | |||
/* | |||
* Autoload | |||
*/ | |||
Yii::$classMap['Import'] = Yii::getAlias('@common/exts/Import.php'); // sesuaikan pathnya | |||
// yii | |||
Import::using('Yii'); | |||
Import::using('yii\filters\*'); | |||
Import::using('yii\data\*'); | |||
Import::using('yii\db\*'); | |||
Import::using('yii\behaviors\*'); | |||
Import::using('yii\helpers\*'); | |||
Import::using('yii\web\NotFoundHttpException'); | |||
// models | |||
Import::using('common\models\*'); | |||
Import::using('frontend\models\*'); | |||
Import::using('backend\models\*'); | |||
// helpers | |||
Import::using('common\helpers\*'); | |||
Import::using('kartik\mpdf\Pdf'); | |||
@@ -0,0 +1,87 @@ | |||
<?php | |||
/** | |||
* Import. Use to import all class under namespace | |||
* | |||
* @author Misbahul D Munir <misbahuldmunir@gmail.com> | |||
* @since 1.0 | |||
*/ | |||
class Import | |||
{ | |||
private static $_paths = []; | |||
private static $_classMap = []; | |||
private static $_registered = false; | |||
/** | |||
* Import namespace | |||
* ``` | |||
* Import::using('yii\bootstrap\*'); | |||
* Import::using('yii\widgets\ActiveForm'); | |||
* | |||
* Import::using([ | |||
* 'yii\helpers\Html', | |||
* 'yii\bootstrap\Html' => 'BHtml' | |||
* ]); | |||
* ``` | |||
* @param string $namespace | |||
* @throws BadMethodCallException | |||
*/ | |||
public static function using($namespace, $as = null) | |||
{ | |||
if (!static::$_registered) { | |||
spl_autoload_register(['Import', 'load']); | |||
static::$_registered = true; | |||
} | |||
if (is_array($namespace)) { | |||
foreach ($namespace as $class => $alias) { | |||
if (is_int($class)) { | |||
static::using($alias); | |||
} else { | |||
static::using($class, $alias); | |||
} | |||
} | |||
return; | |||
} | |||
$namespace = trim($namespace, '\\'); | |||
if (($pos = strrpos($namespace, '\\')) !== false) { | |||
$ns = trim(substr($namespace, 0, $pos), '\\'); | |||
$alias = substr($namespace, $pos + 1); | |||
} else { | |||
$ns = ''; | |||
$alias = $namespace; | |||
} | |||
if ($alias === '*') { | |||
static::$_paths[$ns] = true; | |||
} else { | |||
static::$_classMap[$as ? : $alias] = $namespace; | |||
} | |||
} | |||
/** | |||
* Autoload class | |||
* @param string $class | |||
* @return boolean | |||
*/ | |||
public static function load($class) | |||
{ | |||
if (empty(static::$_paths) && empty(static::$_classMap)) { | |||
return; | |||
} | |||
if (($pos = strrpos($class, '\\')) !== false) { | |||
$alias = substr($class, $pos + 1); | |||
} else { | |||
$alias = $class; | |||
} | |||
if (isset(static::$_classMap[$alias])) { | |||
return class_alias(static::$_classMap[$alias], $class); | |||
} else { | |||
foreach (array_keys(static::$_paths) as $path) { | |||
if (class_exists(rtrim($path . '\\' . $alias, '\\'))) { | |||
return class_alias(rtrim($path . '\\' . $alias, '\\'), $class); | |||
} | |||
} | |||
} | |||
} | |||
} |
@@ -2,11 +2,6 @@ | |||
namespace common\models; | |||
use Yii; | |||
use yii\base\NotSupportedException; | |||
use yii\behaviors\TimestampBehavior; | |||
use yii\db\ActiveRecord; | |||
use yii\db\CDbCriteria; | |||
use yii\web\IdentityInterface; | |||
/** |
@@ -16,8 +16,9 @@ use common\helpers\Url ; | |||
$this->setTitle('Bienvenue sur la boîte à pain') ; | |||
$this->setSubtitle('Des outils numériques pour les circuits courts') ; | |||
$this->setPageTitle('Plateforme de réservation de pain') ; | |||
?> | |||
<div id="presentation"> | |||
<div class="row" id="row-clients-boulanger"> | |||
<div class="col-md-6" id="clients"> |