Пример #1
0
 /**
  * Get photo context
  * @since Version 3.9.1
  * @return array
  * @param \Railpage\Images\Image $imageObject
  */
 public function getPhotoContext(Image $imageObject)
 {
     $query = "SELECT s.*, 0 AS current FROM image_competition_submissions AS s LEFT JOIN image AS i ON s.image_id = i.id WHERE s.competition_id = ? AND s.status = ? AND i.photo_id != 0 ORDER BY s.date_added ASC";
     $where = array($this->id, Competitions::PHOTO_APPROVED);
     $photos = $this->db->fetchAll($query, $where);
     $return = Utility\CompetitionUtility::getPhotoContext($photos, $imageObject);
     /**
      * Loop through the context and return a stdClass photo
      */
     foreach ($return as $data) {
         $Photo = $this->getPhoto($data);
         $Photo->current = (bool) $data['current'];
         (yield $Photo);
     }
 }