Skip to content

Instantly share code, notes, and snippets.

@starbuckit
Last active January 17, 2016 10:54
Show Gist options
  • Save starbuckit/81ae3963513dde95be99 to your computer and use it in GitHub Desktop.
Save starbuckit/81ae3963513dde95be99 to your computer and use it in GitHub Desktop.
<?php
class ImageController extends BaseController
{
public function selectImageAlbumAction()
{
Tag::setTitle('ImageEditor');
parent::initialize();
$album_id = $this->request->getPost('album_id');
//$album_id = $this->request->getPut('album_id');
$conditions = "album_id = :album_id:";
$parameters = array(
"album_id" => "$album_id"
);
$album = AlbumLink::find(
array(
$conditions,
"bind" => $parameters
)
);
if (!$album)
{
foreach ($album->getMessages() as $message)
{
echo $message, "\n";
}
$this->flash->error("Sorry, Album empty!");
$this->response->redirect("album/index");
}
else
{
$currentPage = $this->request->getQuery('page', 'int');
$paginator = new Phalcon\Paginator\Adapter\Model(
array(
"data" => $album,
"limit" => 10,
"page" => $currentPage
)
);
$page = $paginator->getPaginate();
$this->view->setVar("page", $page);
//$this->view->setVar('album', $album);
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment