Skip to content

Commit

Permalink
No commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
malder1975 committed Oct 17, 2016
1 parent 0dbea1a commit 613b25d
Showing 1 changed file with 13 additions and 21 deletions.
34 changes: 13 additions & 21 deletions common/models/Mainmenu.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
class Mainmenu extends ActiveRecord
{

const STATUS_ACTIVE = 1;

const STATUS_DISABLED = 0;

public $data;
public $tree;
/**
Expand All @@ -46,6 +50,13 @@ public function rules()
];
}

public function relations()
{
return [
'menuItems' => [self::HAS_MANY, 'MenuItem', 'menu_id'],
];
}


/**
* @return \yii\db\ActiveQuery
Expand All @@ -55,6 +66,8 @@ public function getMenutype()
return $this->hasOne(Menutypes::className(), ['id' => 'menutype_id']);
}



private static function getLeftTopMenuItems()
{
$items = array();
Expand Down Expand Up @@ -155,28 +168,7 @@ public static function viewMiddleMenuItems($parentId=0)
return $result;
}

private static function getTopMenuData()
{
$items = [];
$data = Mainmenu::find()->where(['visible' => 1, 'menutype_id' => 1])->indexBy('id')->all();

foreach ($data as $item) {

if(empty ($items[$item->parent_id]))
{
$items[$item->parent_id] = [];

}
else
{
$items[$item->parent_id][] = $item->attributes;
}

}

return $items;
//return $menuItems;
}



Expand Down

0 comments on commit 613b25d

Please sign in to comment.