GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Pull Request — master (#212)
by ostashev
33:06
created

BMenuController::actionSetPosition()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 23
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 12
nc 2
nop 0
dl 0
loc 23
rs 9.0856
c 1
b 0
f 0
1
<?php
2
/**
3
 * @author Nikita Melnikov <[email protected]>
4
 * @link https://github.com/shogodev/argilla/
5
 * @copyright Copyright &copy; 2003-2014 Shogo
6
 * @license http://argilla.ru/LICENSE
7
 * @package backend.modules.menu.controllers
8
 */
9
class BMenuController extends BController
10
{
11
  public $name = 'Меню';
12
13
  public $modelClass = 'BFrontendMenu';
14
15
  public function actionSetPosition()
16
  {
17
    BFrontendMenu::loadExtraModels();
18
19
    $gridId = Yii::app()->request->getPost('gridId');
20
    $id = Yii::app()->request->getPost('id');
21
    $menuId = BFrontendMenuGridView::getIdFromGridViewId($gridId);
22
    $position = Yii::app()->request->getPost('value');
23
24
    /**
25
     * @var BFrontendMenuItem $item
26
     */
27
    $item = BFrontendMenuItem::model()->findByAttributes(['menu_id' => $menuId, 'item_id' => $id]);
28
29
    if( $item !== null )
30
    {
31
      $item->position = $position;
32
      $item->save();
33
34
      echo $item->position;
35
      Yii::app()->end();
36
    }
37
  }
38
39
  /**
40
   * Добавление / удаление записи меню
41
   */
42
  public function actionSwitchEntry($type, $item_id, $menu_id)
43
  {
44
    BFrontendMenu::loadExtraModels();
45
46
    if( class_exists($type) && BFrontendMenu::model()->exists('id = :id', array(':id' => $menu_id)) )
47
    {
48
      $menu  = BFrontendMenu::model()->findByPk($menu_id);
49
      $model = $type::model()->findByPk($item_id);
50
      $menu->switchMenuEntryStatus($model);
51
    }
52
  }
53
}