本文整理匯總了PHP中FilesModel::cacheByPage方法的典型用法代碼示例。如果您正苦於以下問題:PHP FilesModel::cacheByPage方法的具體用法?PHP FilesModel::cacheByPage怎麽用?PHP FilesModel::cacheByPage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類FilesModel
的用法示例。
在下文中一共展示了FilesModel::cacheByPage方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: sort
public static function sort($data)
{
if (isset($data['changedId']) and $f = self::getFile($data['changedId'])) {
//update position DOWN of removed gallery
dibi::query('UPDATE pages_files
SET ord = ord-1
WHERE id_page = %i', $f->id_page, '
AND gallerynum = %i', $f->gallerynum, '
AND ord > %i', $f->ord);
//insert into new gallery
$f->gallerynum = (int) $data['num'];
$f->save();
//update position UP of new gallery (hidden files not influenced by the bottom one)
dibi::query('UPDATE pages_files
SET ord = ord+1
WHERE id_page = %i', $f->id_page, '
AND gallerynum = %i', $f->gallerynum, '
AND ord > %i', $f->ord);
}
//TODO maybe? SET ord = CASE id WHEN 10 THEN 1 END CASE
$order = 0;
foreach ($data['fileid'] as $id) {
dibi::query('UPDATE pages_files SET ord=%i', $order++, ' WHERE id=%i', $id);
}
self::$cache = array();
self::$cacheByPage = array();
}