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