当前位置: 首页>>代码示例>>PHP>>正文


PHP PHPWS_DB::resetOrder方法代码示例

本文整理汇总了PHP中PHPWS_DB::resetOrder方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPWS_DB::resetOrder方法的具体用法?PHP PHPWS_DB::resetOrder怎么用?PHP PHPWS_DB::resetOrder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PHPWS_DB的用法示例。


在下文中一共展示了PHPWS_DB::resetOrder方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: viewImage

 public function viewImage($id, $view_folder = true)
 {
     Layout::addStyle('filecabinet');
     PHPWS_Core::initModClass('filecabinet', 'Image.php');
     $image = new PHPWS_Image($id);
     $folder = new Folder($image->folder_id);
     if (!$folder->allow()) {
         $content = dgettext('filecabinet', 'Sorry, the file you requested is off limits.');
         Layout::add($content);
         return;
     }
     $tpl['TITLE'] = $image->title;
     if ($image->width > FC_MAX_IMAGE_POPUP_WIDTH || $image->height > FC_MAX_IMAGE_POPUP_HEIGHT) {
         if (FC_MAX_IMAGE_POPUP_WIDTH < FC_MAX_IMAGE_POPUP_HEIGHT) {
             $ratio = FC_MAX_IMAGE_POPUP_WIDTH / $image->width;
             $image->width = FC_MAX_IMAGE_POPUP_WIDTH;
             $image->height = $image->height * $ratio;
         } else {
             $ratio = FC_MAX_IMAGE_POPUP_HEIGHT / $image->height;
             $image->height = FC_MAX_IMAGE_POPUP_HEIGHT;
             $image->width = $image->width * $ratio;
         }
         $tpl['IMAGE'] = sprintf('<a href="%s">%s</a>', $image->getPath(), $image->getTag());
     } else {
         $tpl['IMAGE'] = $image->getTag();
     }
     $tpl['DESCRIPTION'] = $image->getDescription();
     $tpl['CLOSE'] = javascript('close_window');
     if ($view_folder && $folder->public_folder) {
         $db = new PHPWS_DB('images');
         $db->setLimit(1);
         $db->addWhere('folder_id', $image->folder_id);
         $db->addWhere('title', $image->title, '>');
         $db->addOrder('title');
         $next_img = $db->getObjects('PHPWS_Image');
         if (!empty($next_img)) {
             $next_link = Icon::show('next', dgettext('filecabinet', 'Next image'));
             $tpl['NEXT'] = sprintf('<a id="next-link" href="%s%s">%s</a>', PHPWS_Core::getHomeHttp(), $next_img[0]->popupAddress(), $next_link);
         }
         $db->resetWhere();
         $db->resetOrder();
         $db->addWhere('folder_id', $image->folder_id);
         $db->addWhere('title', $image->title, '<');
         $db->addOrder('title desc');
         $prev_img = $db->getObjects('PHPWS_Image');
         if (!empty($prev_img)) {
             $prev_link = Icon::show('previous', dgettext('filecabinet', 'Previous image'));
             $tpl['PREV'] = sprintf('<a id="prev-link" href="%s%s">%s</a>', PHPWS_Core::getHomeHttp(), $prev_img[0]->popupAddress(), $prev_link);
         }
     }
     $content = PHPWS_Template::process($tpl, 'filecabinet', 'image_view.tpl');
     Layout::nakedDisplay($content);
 }
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:53,代码来源:Cabinet.php


注:本文中的PHPWS_DB::resetOrder方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。