skills on main page api and admin
This commit is contained in:
24
frontend/modules/api/Api.php
Normal file
24
frontend/modules/api/Api.php
Normal 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
|
||||
}
|
||||
}
|
20
frontend/modules/api/controllers/DefaultController.php
Normal file
20
frontend/modules/api/controllers/DefaultController.php
Normal 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');
|
||||
}
|
||||
}
|
36
frontend/modules/api/controllers/SkillsController.php
Normal file
36
frontend/modules/api/controllers/SkillsController.php
Normal 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;
|
||||
}
|
||||
|
||||
}
|
12
frontend/modules/api/views/default/index.php
Normal file
12
frontend/modules/api/views/default/index.php
Normal 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>
|
9
frontend/modules/api/views/skills/index.php
Normal file
9
frontend/modules/api/views/skills/index.php
Normal 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>
|
Reference in New Issue
Block a user