1publicfunctionadd(){2if($this->request->is('post')){3$this->Reply->create();4if($this->Reply->save($this->request->data)){5$this->Flash->success(__('The reply has been saved.'));6return$this->redirect(array('action'=>'index'));7}else{8$this->Flash->error(__('The reply could not be saved. Please, try again.'));9}10}11$tweets=$this->Reply->Tweet->find('list');12$users=$this->Reply->User->find('list');13$this->set(compact('tweets','users'));14}15
1<divclass="tweets view">2<h2><?phpecho__('Tweet');?></h2>3<dl>4<dt><?phpecho__('Id');?></dt>5<dd>6<?phpechoh($tweet['Tweet']['id']);?>7 8</dd>9<dt><?phpecho__('User');?></dt>10<dd>11<?phpecho$this->Html->link($tweet['User']['username'],array('controller'=>'users','action'=>'view',$tweet['User']['id']));?>12 13</dd>14<dt><?phpecho__('Tweet');?></dt>15<dd>16<?phpechoh($tweet['Tweet']['tweet']);?>17 18</dd>19</dl>20</div>21<divclass="actions">22<h3><?phpecho__('Actions');?></h3>23<ul>24<li><?phpecho$this->Html->link(__('Edit Tweet'),array('action'=>'edit',$tweet['Tweet']['id']));?></li>25<li><?phpecho$this->Form->postLink(__('Delete Tweet'),array('action'=>'delete',$tweet['Tweet']['id']),array('confirm'=>__('Are you sure you want to delete # %s?',$tweet['Tweet']['id'])));?></li>26<li><?phpecho$this->Html->link(__('List Tweets'),array('action'=>'index'));?></li>27<li><?phpecho$this->Html->link(__('New Tweet'),array('action'=>'add'));?></li>28<li><?phpecho$this->Html->link(__('List Users'),array('controller'=>'users','action'=>'index'));?></li>29<li><?phpecho$this->Html->link(__('New User'),array('controller'=>'users','action'=>'add'));?></li>30<li><?phpecho$this->Html->link(__('List Replies'),array('controller'=>'replies','action'=>'index'));?></li>31<li><?phpecho$this->Html->link(__('New Reply'),array('controller'=>'replies','action'=>'add'));?></li>32</ul>33</div>34<divclass="related">35<h3><?phpecho__('Related Replies');?></h3>36<?phpif(!empty($tweet['Reply'])):?>37<tablecellpadding="0"cellspacing="0">38<tr>39<th><?phpecho__('Id');?></th>40<th><?phpecho__('Tweet Id');?></th>41<th><?phpecho__('User Id');?></th>42<th><?phpecho__('Reply');?></th>43<thclass="actions"><?phpecho__('Actions');?></th>44</tr>45<?phpforeach($tweet['Reply']as$reply):?>46<tr>47<td><?phpecho$reply['id'];?></td>48<td><?phpecho$reply['tweet_id'];?></td>49<td><?phpecho$reply['user_id'];?></td>50<td><?phpecho$reply['reply'];?></td>51<tdclass="actions">52<?phpecho$this->Html->link(__('View'),array('controller'=>'replies','action'=>'view',$reply['id']));?>53<?phpecho$this->Html->link(__('Edit'),array('controller'=>'replies','action'=>'edit',$reply['id']));?>54<?phpecho$this->Form->postLink(__('Delete'),array('controller'=>'replies','action'=>'delete',$reply['id']),array('confirm'=>__('Are you sure you want to delete # %s?',$reply['id'])));?>55</td>56</tr>57<?phpendforeach;?>58</table>59<?phpendif;?>6061<divclass="actions">62<ul>63<li><?phpecho$this->Html->link(__('New Reply'),array('controller'=>'replies','action'=>'add'));?></li>64</ul>65</div>66</div>67
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2016/01/14 09:04