title="Главная страница";
$newsDataProvider = new \yii\data\ActiveDataProvider(
[
"query"=>\app\models\Design::find()->orderBy(["order"=>SORT_ASC]),
"pagination" => false
]
);
?>
# |
заголовок |
статусы |
управление |
foreach( $newsDataProvider->getModels() as $item ){
// print_r($item);
//return;
$strbage = '';
switch($item->type){
case 'story':
$model = Story::findOne($item->parent_id);
break;
case 'topic':
$model = NewsTopic::findOne($item->parent_id);
break;
case 'tag':
$model = Tags::findOne($item->parent_id);
break;
default:
$title = $item->title;
$model = null;
break;
}
if( $model ){
$title = (trim($item->title) == '')?$model->title:$item->title;
}else{
$strbage .= 'Дохлый элемент
';
}
$mark = '';
if( $item->active == 'N' ){
$mark = ' class="table-dark"';
$strbage .= 'Спрятано
';
}
switch($item->design){
case 1:
$strbage .= ' ';
break;
case 2:
$strbage .= '';
break;
case 3:
$strbage .= '';
break;
case 4:
$strbage .= '';
break;
case 5:
$strbage .= '';
break;
case 6:
$strbage .= ' ';
break;
default:
$strbage .= 'неопределён дизайн';
break;
}
?>
class="ui-sortable" id="item_=$item->id?>">
=$item->id?> |
=$title?> =($model && $model->description)?$model->description:''?> |
=$strbage?> |
if( Yii::$app->user->can('admin') ){
?>
}
?>
|
//
// print_r($item);
//
?>
}
?>
getModels());