07.11
php
saved
avairet
Note
avairet did not leave a note
avairet did not leave a note
- <?php
- // Modèle diaporama
- class Diaporama extends AppModel {
- (
- 'Illustration' => array
- (
- 'className' => 'Illustration',
- 'joinTable' => 'diaporamas_illustrations',
- 'foreignKey' => 'diaporama_id',
- 'associationForeignKey' => 'illustration_id',
- 'unique' => true,
- 'conditions' => '',
- 'fields' => '',
- 'order' => '',
- 'limit' => '',
- 'offset' => '',
- 'finderQuery' => '',
- 'deleteQuery' => '',
- 'insertQuery' => ''
- )
- );
- }
- // Modèle illustration
- class Illustration extends AppModel {
- (
- 'Diaporama' => array
- (
- 'className' => 'Diaporama',
- 'joinTable' => 'diaporamas_illustrations',
- 'foreignKey' => 'illustration_id',
- 'associationForeignKey' => 'diaporama_id',
- 'unique' => true,
- 'conditions' => '',
- 'fields' => '',
- 'order' => '',
- 'limit' => '',
- 'offset' => '',
- 'finderQuery' => '',
- 'deleteQuery' => '',
- 'insertQuery' => ''
- )
- );
- }
- // Contrôleur diaporamas_controller.php
- class DiaporamasController extends AppController {
- public function admin_add($item_id = 0, $theme_id = 0) {
- $this->Diaporama->create();
- if ($this->Diaporama->save($this->data)) {
- $this->Session->setFlash(__('The Diaporama has been saved', true));
- $this->redirect('/admin/items/edit/'.$this->data['Diaporama']['item_id']);
- }
- $this->Session->setFlash(__('The Diaporama could not be saved. Please, try again.', true));
- }
- }
- }
- // Vue diaporamas/admin_add.ctp
- foreach ($photos as $key=>$val) {
- echo '<input type="checkbox" value="'.$val['Illustration']['id'].'" name="data[Illustration][Illustration][]" />'
- }
- ?>
Parsed in 0.147 seconds, using GeSHi 1.0.7.14