<?php

namespace Modules\Admin\Countries;

use \App\Mvc\View\Utils\Types\ListingColumn;
use \App\Mvc\View\Utils\Types\ListingColumns;

class View_List extends \App\Mvc\View_Window_PaginatedListing_ListAbstract
{
	/**
	 * Results per page list
	 * @see \App\Mvc\View_Window_PaginatedListing_ListAbstract::$resultsPerPageList
	 */
	protected $resultsPerPageList = [5, 10, 15, 20, 25, 50, 100];

	/**
	 * (non-PHPdoc)
	 * @see \App\Mvc\View_Window_PaginatedListing_ListAbstract::list_getThDetails()
	 */
	protected function list_getThDetails()
	{

		return ListingColumns::create()
			->append(
				ListingColumn::create('name')
					->setSortable('ASC')
			)
			->append(
				ListingColumn::create('code')
					->setWidth(5)->setSortable('ASC')
			)
			->append(
				ListingColumn::create('code3')
					->setWidth(10)->setSortable('ASC')
			)
			->append(
				ListingColumn::create('criterion')
					->setWidth(20)->setSortable('ASC')
			)
			->append(
				ListingColumn::create('zone')
					->setWidth(20)->setSortable('ASC')
			)
			->append(
				ListingColumn::create('continent')
					->setWidth(20)->setSortable('ASC')
			)
			->append(
				ListingColumn::create('continentCode')
				->setWidth(10)->setSortable('ASC')
				)
			->append(
				ListingColumn::create('regionName')
					->setWidth(20)->setSortable('ASC')
			)

		->loadLabels($this->lang['index']['listCols'])
		->loadSettings($this->input['listingParams']->getDynamicColumnsSettings());
	}

	/**
	 * (non-PHPdoc)
	 * @see \App\Mvc\ViewAbstract::render_prepare()
	 */
	protected function render_prepare($smarty)
	{
		$CFG   = \Engine\Loader_Cfg::getInstance()->getGlobal();
		$smarty->assign("enableAlternativeNames", $CFG['useAlternativeNames']['countries']);
		$smarty->assign("continentCodes", $CFG['continentCodes']);

		parent::render_prepare($smarty);
	}
}
