on todays date. How would I change that to -1 day onClick of
#changeDate in my Students/index.ctp file. I have the Js helper
loaded, as well as RequestHandler component ready.
Any help is greatly appreciated. Thanks!
Here is my StudentsController.php file
public function index() {
//find all classes student is signed up for in students table
$periods = $this->Student->find('all' , array(
'conditions'=>array('Student.user_id'=>$this->Session-
>read('Auth.User.id'),
)));
//for each class student is signed up for, find all information
relating to that class matching the period_id
foreach($periods as $k => $p){
$posts = $this->Period->find('all', array(
'conditions' => array(
'period_id' => $p['Student']['period_id']
)
));
$homework = $this->Post->find('all', array(
'conditions' => array(
'period_id' => $p['Student']['period_id'],
'created' => date('Ymd') ////////////////////////RIGHT
HERE!!!
)
));
$periods[$k]['Period'] = $posts;
$periods[$k]['Post'] = $homework;
}
$this->set('period', $periods);
}
Here is my Students/index.ctp file
<div id="changeDate">Back Arrow</div>
<?php foreach ($period as $what): ?>
<?php foreach($what['Period'] as $ps): ?>
<?php
$lol=
$this->Form->postLink(
'Remove Class',
array('controller' => 'students', 'action'
=> 'delete', $ps['Period']['period_id']),
array('confirm' => 'Are you sure?'));
echo '<div class="classPeriod"><h3>' . ($ps['Period']
['title']) .'</h3><div id="testing">'.$lol . '</div><hr><br>';
?>
<?php foreach ($what['Post'] as $something): ?>
<?php echo $this->Html->link($something['Post']['title'],
array('action' => 'view', $something['Post']['id']));?>
<?php endforeach; ?>
<?php echo '</div>'; ?>
<?php endforeach; ?>
<?php endforeach; ?>
--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
No comments:
Post a Comment