public static function getLightboxArray($entity, $entity_id) { $images = array(); $c = new Criteria(); $c->add(sfPhotoGalleryPeer::ENTITY, $entity); $c->add(sfPhotoGalleryPeer::ENTITY_ID, $entity_id); $c->setIgnoreCase(true); $photos = sfPhotoGalleryPeer::doSelect($c); if (count($photos) > 0) { foreach ($photos as $photo) { $images[] = array('real_name' => $photo->getRealName(), 'options' => array('title' => $photo->getDescription())); } } return $images; }
public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = sfPhotoGalleryPeer::getFieldNames($keyType); if (array_key_exists($keys[0], $arr)) { $this->setId($arr[$keys[0]]); } if (array_key_exists($keys[1], $arr)) { $this->setUuid($arr[$keys[1]]); } if (array_key_exists($keys[2], $arr)) { $this->setEntity($arr[$keys[2]]); } if (array_key_exists($keys[3], $arr)) { $this->setEntityId($arr[$keys[3]]); } if (array_key_exists($keys[4], $arr)) { $this->setName($arr[$keys[4]]); } if (array_key_exists($keys[5], $arr)) { $this->setMimeType($arr[$keys[5]]); } if (array_key_exists($keys[6], $arr)) { $this->setSize($arr[$keys[6]]); } if (array_key_exists($keys[7], $arr)) { $this->setSuffix($arr[$keys[7]]); } if (array_key_exists($keys[8], $arr)) { $this->setTitle($arr[$keys[8]]); } if (array_key_exists($keys[9], $arr)) { $this->setDescription($arr[$keys[9]]); } if (array_key_exists($keys[10], $arr)) { $this->setRank($arr[$keys[10]]); } if (array_key_exists($keys[11], $arr)) { $this->setCreatedAt($arr[$keys[11]]); } }
public function executeRemovePhoto() { $photo = sfPhotoGalleryPeer::retrieveByUuid($this->getRequestParameter('photo')); $this->forward404Unless($photo, 'Photo not found, unable to set profile photo'); // Make sure photo belongs to user if (sfPhotoGalleryPeer::isAttachedToEntity('User', $this->getUser()->getProfile()->getId(), $photo->getUuid())) { // Make sure we update the picture if profile photo if ($photo->getUuid() != $this->getUser()->getProfile()->getPicture()) { $photo->delete(); } else { $photo->delete(); $this->getUser()->getProfile()->setPicture(NULL); $this->getUser()->getProfile()->save(); } } $this->redirect($this->getRequest()->getReferer()); }
public function getPhotos() { return sfPhotoGalleryPeer::getPhotos('project', $this->getId()); }
public function executeDelete() { $photo = sfPhotoGalleryPeer::retrieveByPk($this->getRequestParameter('id')); $this->forward404Unless($photo); $photo->delete(); return $this->redirect('photo/list'); }
function photo_get_photos($entity, $entity_id) { // Retrieve the photos associated with the entity return sfPhotoGalleryPeer::getPhotos($entity, $entity_id); }
public static function retrieveByPKs($pks, $con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } $objs = null; if (empty($pks)) { $objs = array(); } else { $criteria = new Criteria(); $criteria->add(sfPhotoGalleryPeer::ID, $pks, Criteria::IN); $objs = sfPhotoGalleryPeer::doSelect($criteria, $con); } return $objs; }
public function getPhotos() { return sfPhotoGalleryPeer::getPhotos('User', $this->getUserId()); }