<?php

/**
 * Подумать и снести нафиг!
 */

class ArticlesController extends Controller
{

	static function actionIndex()
	{
		self::$layout = 'layouts/page.php';
		self::addStyle('/css/style.css?ver=' . App::getConfig('version'));
		self::addStyle('/css/pageStyle.css?ver=' . App::getConfig('version'));
		self::addScript('/js/jquery-2.1.0.min.js');
		self::addScript('/js/jquery-ui-1.10.4.custom.min.js');
		self::addScript('/js/bootstrap.min.js');
		self::addStyle('/css/bootstrap.min.css');
		self::addStyle('/css/bootstrap-theme.min.css');

		if (!App::$user || !App::$user->isAdmin) {
			App::error404();
		}
		// ------------------------------------------

		App::setConfig('title', App::$defaultTitle);

		self::render('articles/index.php', array(
			'user' => App::$user,
			'articles' => Article::model()->getAll(),
			'randomPoint' => Point::model()->getRandom(),
		));
	}

}
