<?php

class lc_seo_editor_list
{
	public function get()
	{
		$result=array();
		if ($list=Db::i()->select("SELECT * FROM ?_lc_seo ORDER BY pos")) {
			foreach ($list as $item) {
				$obj=Factory::create('lc_seo_editor.tags');
				$obj->set($item);
				$result[]=$obj;
			}
		}
		return $result;
	}
	
	public function setSort($items)
	{
		if ($items) foreach ($items as $sort=>$id) {
				Db::i()->query(
					"UPDATE ?_lc_seo SET pos=? WHERE id=?", $sort, $id
				);
		}
	}
}