當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Images::fetchAll方法代碼示例

本文整理匯總了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());
         }
     }
 }
開發者ID:ngroesz,項目名稱:Photoplate,代碼行數:46,代碼來源:ImageController.php

示例2: imageList

 function imageList()
 {
     $image_class = new Images();
     $images = $image_class->fetchAll('file_uploaded=1 AND album_id=' . $this->album_id);
     return $images;
 }
開發者ID:ngroesz,項目名稱:Photoplate,代碼行數:6,代碼來源:ViewerBuilder.php


注:本文中的Images::fetchAll方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。