<?php
/*
* @package LabCMS
* @copyright (c) 2006 Alexander Levin aka Loki (loki_angel@mail.ru)
* @support http://labcms.ru
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*/

class blocks_static_main extends ModuleTools
{
	public function __construct()
	{
		self::_setTpl('');
	
		if (!config::get('show')) return;
		
		if (!$blocks=Cache_Generic::init()->get('blocks_static')) {
			$results=Db::i()->select("SELECT block_id, data FROM ?_blocks_static WHERE visible=1");
			foreach ($results as $result) {
				$blocks['_module_blocks_static_'.$result['block_id']]=$result['data'];
			}
			Cache_Generic::init()->set('blocks_static', $blocks, 60*60*24*7);
		}
		self::_assign($blocks);
	}
}