<?php
/**
 * Trash.
 *
 * @package HostCMS
 * @version 6.x
 * @author Hostmake LLC
 * @copyright © 2005-2013 ООО "Хостмэйк" (Hostmake LLC), http://www.hostcms.ru
 */
require_once('../../../bootstrap.php');

Core_Auth::authorization('trash');

// Код формы
$iAdmin_Form_Id = 184;
$sAdminFormAction = '/admin/trash/table/index.php';

$oAdmin_Form = Core_Entity::factory('Admin_Form', $iAdmin_Form_Id);

$tableName = Core_Array::getRequest('table');
$singular = Core_Inflection::getSingular($tableName);

$titleName = class_exists($singular . '_Model')
	? Core::_($singular . '.model_name')
	: NULL;

// Контроллер формы
$oAdmin_Form_Controller = new Admin_Form_Controller($oAdmin_Form);
$oAdmin_Form_Controller
	->setUp()
	->path($sAdminFormAction)
	->title(Core::_('Trash_Table.title', $titleName))
	->pageTitle(Core::_('Trash_Table.title', $titleName));

$sTrashPath = '/admin/trash/index.php';

$oAdmin_Form_Entity_Breadcrumbs = new Admin_Form_Entity_Breadcrumbs();

// Элементы строки навигации
$oAdmin_Form_Entity_Breadcrumbs->add(
	Core::factory('Admin_Form_Entity_Breadcrumb')
		->name(Core::_('Trash.title'))
		->href(
			$oAdmin_Form_Controller->getAdminLoadHref($sTrashPath, NULL, NULL, '')
		)
		->onclick(
			$oAdmin_Form_Controller->getAdminLoadAjax($sTrashPath, NULL, NULL, '')
	)
)->add(
	Core::factory('Admin_Form_Entity_Breadcrumb')
		->name(Core::_('Trash_Table.title', $titleName))
		->href(
			$oAdmin_Form_Controller->getAdminLoadHref($oAdmin_Form_Controller->getPath())
		)
		->onclick(
			$oAdmin_Form_Controller->getAdminLoadAjax($oAdmin_Form_Controller->getPath())
	)
);

// Добавляем все хлебные крошки контроллеру
$oAdmin_Form_Controller->addEntity($oAdmin_Form_Entity_Breadcrumbs);

// Источник данных 0
$oAdmin_Form_Dataset = new Trash_Table_Dataset($tableName);

// Добавляем источник данных контроллеру формы
$oAdmin_Form_Controller->addDataset(
	$oAdmin_Form_Dataset
);

// Показ формы
$oAdmin_Form_Controller->execute();