Yii2-dateline demo
Dateline is a widget for date-related data in the Yii framework 2.0. It renders my JavaScript Dateline in a View and displays date-related Models.
You can create interactive datelines, which can be dragged by mouse, touch or keyboard, and display events. The movements of two or more datelines ('bands') are synchronized. Clicking or tapping on an event displays more information or redirects you to another page.
Controller code
<?php use yii\data\ActiveDataProvider; use yii\web\Controller; use app\models\Event; class SoftwareController extends Controller { ... public function actionDateline2() { return $this->render('dateline2', [ 'dataProvider' => new ActiveDataProvider([ 'query' => Event::find(), 'pagination' => false ]) ]); } ... } ?>
View code
<?php ... use sjaakp\dateline\Dateline; ... Dateline::begin([ 'dataProvider' => $dataProvider, // keys are Dateline attribute names, // values are Yii Model attribute names 'attributes' => [ 'text' => 'title', 'class' => 'symbol' ], 'options' => [ 'begin' => '1900-01-01', 'end' => date('Y-m-d'), // today 'cursor' => '2007-02-01', ], ])->band([ 'width' => '60%', 'scale' => Dateline::MONTH, 'interval'=> 60, ])->band([ 'width' => '24%', 'layout' => 'overview', 'scale' => Dateline::YEAR, 'interval'=> 100 ])->band([ 'width' => '16%', 'layout' => 'overview', 'scale' => Dateline::DECADE, 'interval'=> 40, 'multiple' => 2 ])->end(); ... ?>