本文整理汇总了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);
}