1. Go to this page and download the library: Download zumba/swivel-cake library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
App::uses('AppModel', 'Model');
App::uses('SwivelModelInterface', 'Swivel.Lib');
class SwivelFeature extends AppModel implements SwivelModelInterface {
public $useTable = false;
public function getMapData()
{
// @todo Load data from some source
// @todo Format this data in a KEY/VALUE array, where KEY is the feature
// and VALUE is the buckets in an array format, ie [1, 2, 3]
// @todo Return the formatted data
return [
'FeatureA' => [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
'FeatureB' => [1, 2, 3],
'FeatureC' => [2, 4, 6, 8, 10],
];
}
}
class UsersController extends AppController
{
public $components = ['Swivel.Swivel'];
public $uses = ['User', 'MyCoolWidget'];
public function index()
{
$this->set('users', $this->User->find(/* ... */));
$this->Swivel->invoke('MyCoolWidget', function() {
return $this->set('widget', $this->MyCoolWidget->find(/* ... */));
});
}
public function view($id = null)
{
$this->Swivel->forFeature('Redesign')
->addBehavior('userView', [$this, 'renderNewView'], [$id])
->defaultBehavior([$this, 'renderOldView'], [$id])
->execute();
}
protected function renderOldView($id)
{
// @todo implement
$this->render('oldView');
}
protected function renderNewView($id)
{
// @todo implement
$this->render('newView');
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.