Last active
August 29, 2015 14:00
-
-
Save swthate/11182871 to your computer and use it in GitHub Desktop.
Dashboard
This file contains 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 | |
// app/Model/Dashboard.php | |
App::uses('AppModel', 'Model'); | |
class Dashboard extends AppModel | |
{ | |
var $useTable = false; | |
} |
This file contains 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 | |
// app/Controller/DashboardsController.php | |
App::uses('AppController', 'Controller'); | |
class DashboardsController extends AppController | |
{ | |
public function index() | |
{ | |
$this->loadModel('Job'); | |
/* | |
$this->set('job', $this->Job->find('all', array( | |
'contain' => 'Client', 'order'=> array( | |
'Job.id' => 'desc')))); | |
*/ | |
$this->set('job', $this->Job->find('all', array( | |
'contain' => 'Client', | |
'limit' => 5, | |
'order' => array('Job.id' => 'desc')))); | |
$this->loadModel('User'); | |
$this->set('authUser', $this->Auth->user()); | |
} | |
} |
This file contains 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
array( | |
'Job' => array( | |
'client_id' => '2', | |
'id' => '17', | |
'datein' => '2014-03-05', | |
'description' => 'A custom widget built by composition of Autocomplete and Button. You can either type something into the field to get filtered suggestions based on your input, or use the button to get the full list of selections.', | |
'title' => 'Autocomplete ' | |
) | |
) |
This file contains 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
<!-- app/View/Dashboards/index.ctp --> | |
<h1>Dashboard</h1> | |
<h2>Welcome</h2> | |
<?php foreach($jobs as $job): ?> | |
<p><?php echo $job['Job']['title']; ?><br> | |
<?php echo $job['Job']['id']; ?><br> | |
<?php echo $job['Job']['datein']; ?></p> | |
<?php endforeach; ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment