<?php
namespace Modules\Documents\Generate\QuickLaunch;

class Controller extends \App\Mvc\ControllerAbstract
{
	/**
	 * (non-PHPdoc)
	 * @see \App\Mvc\Controller\Window\PaginatedListing\PaginatedListing::initialize()
	 */
	protected function initialize()
	{
		parent::initialize();

		$this->actionsCfg['index'] = 	['checkOption' => false, 'checkSection'=>false, 'authType'=> 'easy'];
	}

	/**
	 * Block a list of services
	 * @return string
	 */
	protected function actionIndex($R)
	{
		if (!$R['pivot']) {
			throw new \Engine\Mvc\ControllerException("Unspecified pivot");
		}
		if (!$R['idPivot']) {
			throw new \Engine\Mvc\ControllerException("Unspecified idPivot");
		}

		// create view object
		$view = new View_Index($this);
		$model = new Model();

		$view->setOutputVar('pivot', $R['pivot']);
		$view->setOutputVar('idPivot', $R['idPivot']);
		$view->setOutputVar('documentTypesDetails', $model->getDocumentTypesDetails($R['pivot'], $R['idPivot']));

		return new \Engine\Mvc\Response\Html($view->render());
	}
}
