Last active
December 17, 2015 20:19
-
-
Save kylejohnson/5667134 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| class EventsController extends AppController { | |
| public $helpers = array('Paginator'); | |
| public $components = array('Paginator', 'RequestHandler'); | |
| public function index() { | |
| $this->loadModel('Monitor'); | |
| $this->loadModel('Config'); | |
| if($this->params['named']['MonitorId']) { | |
| $monitor_id = $this->params['named']['MonitorId']; | |
| $conditions = array("MonitorId = $monitor_id"); | |
| }; | |
| $events_per_page = Configure::read('ZM_WEB_EVENTS_PER_PAGE'); | |
| $this->paginate = array( | |
| 'fields' => array('Event.Name', 'Event.Length', 'Event.MonitorId', 'Event.Id', 'Monitor.Name'), | |
| 'limit' => $events_per_page, | |
| 'order' => array( 'Event.Id' => 'asc'), | |
| 'conditions' => $conditions | |
| ); | |
| $data = $this->paginate('Event'); | |
| $this->set('events', $data); | |
| } | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment