public function insertEnt(GalleryEntity $socMedEnt) { $select = $this->sql->select(); $select->where(array("media_url" => $socMedEnt->getMediaUrl())); $result = $this->hydrateResult(new GalleryEntity(), $select, false); if ($result->count() == 0) { $hydrator = new ClassMethods(); $data = $hydrator->extract($socMedEnt); $data['date_inserted'] = date("Y-m-d H:i:s"); $action = $this->sql->insert(); $action->values($data); $statement = $this->sql->prepareStatementForSqlObject($action); //echo "<hr>"; echo $action->getSqlString($this->dbAdapter->getPlatform()); echo "<hr>asdf"; // clear cache $dateYMon = date("Y-M"); $galleryModel = new GalleryModel(); $cacheDir = $galleryModel->getThumbGalleryCacheDir($dateYMon); if (is_dir($cacheDir)) { $galleryModel->removeDirectoryContents($cacheDir); } return $statement->execute(); } else { // don't update date_inserted, it just messes up the gallery thumb page when, for example, a pic from sept 30 gets set to oct 1 // alternatively, that effect could be a good thing as it would keep the day one page of each month populated with thumbs /* $hydrator = new ClassMethods(); $data = $hydrator->extract($socMedEnt); $update = $this->sql->update(); $update->set(array("date_inserted" => $data['date_inserted'])) ->where(array("username" => $socMedEnt->getUsername(), "social_id" => $socMedEnt->getSocialId())); $statement = $this->sql->prepareStatementForSqlObject($update); $r = $statement->execute(); //echo "<hr>"; echo $update->getSqlString($this->dbAdapter->getPlatform()); echo "<hr>asdf"; return $r; */ return true; } return false; }
public function formatGalleryEnt(InstagramEntity $ent) { $socMedEnt = new GalleryEntity(); $socMedEnt->setUsername($ent->getUsername())->setSocialId($ent->getId())->setTitle('')->setHeaderText('')->setText($ent->getCaption())->setMediaUrl($ent->getImage())->setMediaHeight(150)->setMediaWidth(150)->setLink($ent->getLink())->setSource('instagram')->setDateCreated(date("Y-m-d H:i:s", $ent->getCreatedTime())); return $socMedEnt; }
private function setGalleryEnt($tumblrEnt) { $socModel = new GalleryEntity(); $socModel->setUsername($tumblrEnt->getBlogName())->setSource('tumblr')->setMediaUrl($tumblrEnt->getPhoto())->setDateCreated($tumblrEnt->getDate())->setLink($tumblrEnt->getPostUrl())->setMediaHeight($tumblrEnt->getHeight())->setMediaWidth($tumblrEnt->getWidth())->setSocialId($tumblrEnt->getId()); return $socModel; }
public function getMediaWidth() { return $this->utilObj->getSmallMediaWidth(parent::getMediaWidth(), parent::getMediaHeight()); }