Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Photo Grading System (grading from 0-10)
*/
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
You can’t perform that action at this time.