skills on main page api and admin

This commit is contained in:
andrey
2021-06-09 18:06:13 +03:00
parent 23773eff4e
commit b9f919204c
27 changed files with 842 additions and 0 deletions

View File

@ -0,0 +1,24 @@
<?php
namespace frontend\modules\api;
/**
* api module definition class
*/
class Api extends \yii\base\Module
{
/**
* {@inheritdoc}
*/
public $controllerNamespace = 'frontend\modules\api\controllers';
/**
* {@inheritdoc}
*/
public function init()
{
parent::init();
// custom initialization code goes here
}
}

View File

@ -0,0 +1,20 @@
<?php
namespace frontend\modules\api\controllers;
use yii\web\Controller;
/**
* Default controller for the `api` module
*/
class DefaultController extends Controller
{
/**
* Renders the index view for the module
* @return string
*/
public function actionIndex()
{
return $this->render('index');
}
}

View File

@ -0,0 +1,36 @@
<?php
namespace frontend\modules\api\controllers;
use common\models\Options;
use yii\filters\AccessControl;
class SkillsController extends \yii\rest\Controller
{
public function behaviors()
{
return [
[
'class' => \yii\filters\ContentNegotiator::className(),
'formats' => [
'application/json' => \yii\web\Response::FORMAT_JSON,
],
],
];
}
public function actionIndex()
{
return ['some' => 'rrr'];
}
public function actionSkillsOnMainPage()
{
$data = \common\models\Options::getValue('skills_on_main_page_to_front');
if ($data) $data = json_decode($data, true);
else return [];
return $data;
}
}

View File

@ -0,0 +1,12 @@
<div class="api-default-index">
<h1><?= $this->context->action->uniqueId ?></h1>
<p>
This is the view content for action "<?= $this->context->action->id ?>".
The action belongs to the controller "<?= get_class($this->context) ?>"
in the "<?= $this->context->module->id ?>" module.
</p>
<p>
You may customize this page by editing the following file:<br>
<code><?= __FILE__ ?></code>
</p>
</div>

View File

@ -0,0 +1,9 @@
<?php
/* @var $this yii\web\View */
?>
<h1>skills/index</h1>
<p>
You may change the content of this page by modifying
the file <code><?= __FILE__; ?></code>.
</p>