Last active
November 29, 2015 17:29
-
-
Save lancasterjones/fe09d87f5be11e5b2286 to your computer and use it in GitHub Desktop.
Photo Grading System (grading from 0-10)
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
*/ | |
I am developing an app that enables a user to upload a picture and then have it graded by a different user. | |
When viewing a photo, I would like to get the list of the appropriate criteria in a list. | |
Sections (or locations) | |
Photos | |
Each photo belongs to a section. | |
Criteria | |
Each section has different grading criteria. | |
The photo table has the folowing fields: | |
-id | |
-section_id | |
-name | |
The criteria table fields: | |
-id | |
-section_id | |
-name | |
The section table fields: | |
-id | |
-name | |
*/ | |
// Inside Template/Photos/view.ctp | |
<?php foreach ($criterios as $criterio): ?> | |
<li> | |
<div><?= h($criterio->nombre) ?></div> | |
</li> | |
<?php endforeach; ?> | |
// FotosController | |
public function view($id = null) | |
{ | |
$foto = $this->Fotos->get($id, [ | |
'contain' => ['Tiendas', 'Sections', 'Users', 'Clientes'] | |
]); | |
$this->set('foto', $foto); | |
$sections = $this->Fotos->Sections->find('list', ['limit' => 200]); | |
//$criterios = $this->Sections->Criterios->find('list', ['limit' => 200]); | |
$this->loadModel('Criterios'); | |
// $criterios = "99"; | |
$criterios = $this->Sections->Criterios->find('list', ['limit' => 200]); | |
$this->set('_serialize', ['foto']); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment