本文整理匯總了PHP中Images::fetchAll方法的典型用法代碼示例。如果您正苦於以下問題:PHP Images::fetchAll方法的具體用法?PHP Images::fetchAll怎麽用?PHP Images::fetchAll使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Images
的用法示例。
在下文中一共展示了Images::fetchAll方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: deleteAction
/**
* Confirm if image should be deleted and delete image
*
* @return void
*/
function deleteAction()
{
$id = (int) $this->_request->getParam('id', 0);
$image_class = new Images();
if ($this->_request->isPost()) {
$image = $image_class->fetchRow('id = ' . $id);
$album_id = $image->album_id;
// decerement viewer_order on all the images that have a higher
// viewer_order than the deleted image
$select = $image_class->select();
$select->where('album_id = ' . $image->album_id)->where('viewer_order > ' . $image->viewer_order);
$statement = $select->__toString();
$this->logger->info($statement);
$images = $image_class->fetchAll($select);
foreach ($images as $image) {
$image->viewer_order--;
$this->logger->info("image {$image->id} now has index of {$image->viewer_order}");
$image->save();
}
$del = $this->_request->getPost('confirm');
if ($del == 'Confirm' && $id > 0) {
$image_class->delete('id=' . $id);
}
if ($this->_request->getParam('from', 0) == 'viewImage' && $del != 'Confirm') {
$this->_redirect('/image/view/id/' . $id);
} else {
$this->_redirect('/album/view/id/' . $album_id);
}
} else {
if ($id > 0) {
$this->view->title = 'Confirm Deletion';
$image = $image_class->fetchRow('id=' . $id);
$this->view->image_title = $image->title;
$form = new ImageDeleteForm();
$form->confirm->setLabel('Confirm');
$form->cancel->setLabel('Cancel');
$this->view->form = $form;
$form->populate($image->toArray());
}
}
}
示例2: imageList
function imageList()
{
$image_class = new Images();
$images = $image_class->fetchAll('file_uploaded=1 AND album_id=' . $this->album_id);
return $images;
}