Timeline demo
Timeline is a widget for the Yii framework 2.0. It renders the Javascript SIMILE Timeline 2.3.1 in a View and displays time-related Models.
The SIMILE project isn't supported since 2008, so you might be better of looking at an alternative. My Yii2-dateline gets its inspiration from the SIMILE timeline and fills the gap perfectly.
Code in Controller
<?php use yii\data\ActiveDataProvider; use yii\web\Controller; use app\models\Event; class SoftwareController extends Controller { ... public function actionTimeline() { return $this->render('timeline', [ 'dataProvider' => new ActiveDataProvider([ 'query' => Event::find(), 'pagination' => false ]) ]); } ... } ?>
Code in View
<?php ... use sjaakp\timeline\Timeline; ... $t = Timeline::begin([ 'dataProvider' => $dataProvider, // keys are Simile Timeline attribute names, // values are Yii Model attribute names 'attributes' => [ 'id' => 'id', 'start' => 'start', 'end' => 'stop', 'latestStart' => 'post_start', 'earliestEnd' => 'pre_stop', 'description' => 'description', 'text' => 'title', 'caption' => 'caption', ], 'height' => 280, 'start' => '1900-01-01', 'end' => '2016-01-01' ])->band([ 'width' => '60%', 'intervalUnit' => Timeline::MONTH, 'intervalPixels' => 60 ])->band([ 'width' => '24%', 'layout' => 'overview', 'intervalUnit' => Timeline::YEAR, 'intervalPixels' => 100 ]) ->band([ 'width' => '16%', 'layout' => 'overview', 'intervalUnit' => Timeline::DECADE, 'intervalPixels' => 40, 'multiple' => 2 ])->end(); ... ?>