<?php

namespace Modules\Admin\Users;

class View_Options extends \App\Mvc\View_Window_PaginatedListing_OptionsAbstract
{
	/**
	 * (non-PHPdoc)
	 * @see \App\Mvc\View_Window_PaginatedListing_OptionsAbstract::populateDefinedOptions()
	 */
	public function populateDefinedOptions(\App\Mvc\View\Utils\RowOptions\Container\Simple $options)
	{
		$options
			// insert
			->append(\App\Mvc\View\Utils\RowOptions\Option\Popup\Insert::create('insert')
				->setDescription($this->lang['index']['options']['description']['insert'])
				->setDimensions(700, 600)
			)

			// users access
			->append(\App\Mvc\View\Utils\RowOptions\Option\Popup::create('userAccess')	// 'userAccess' is already used below
				->setDescription($this->lang['index']['options']['description']['userAccess'])
				->setDimensions(900, 605)
				->setIcon('noAccess')
				->setModule('Modules/Admin/UserAccess')
				->setAction('index')
				->setKeyForCurrentRow('id')
			)

			// block user
			->append(\App\Mvc\View\Utils\RowOptions\Option\Popup::create('blockUser')
				->setDescription($this->lang['index']['options']['description']['blockUser'])
				->setDimensions(600, 400)
				->setIcon('lock')
				->setModule('Modules/Admin/Users/BlockUser')
				->setAction('index')
				->setKeyForCurrentRow('idUser')
			)

			// update
			->append(\App\Mvc\View\Utils\RowOptions\Option\Popup\Update::create('update')
				->setDescription($this->lang['index']['options']['description']['update'])
				->setDimensions(700, 600)
			)
			->append(\App\Mvc\View\Utils\RowOptions\Container\OptionsMenu::create("mainOptions")


				// access action
				->append(\App\Mvc\View\Utils\RowOptions\Option\Popup::create('copyUserAccess')
					->setLabel($this->lang['index']['options']['description']['copyUserAccess'])
					->setIcon('noAccess')
					->setAction('copyUserAccess')
					->setDimensions(600, 350)
					->setKeyForCurrentRow('id')
				)

				// change password
				->append(\App\Mvc\View\Utils\RowOptions\Option\Popup::create('changePassword')
					->setLabel($this->lang['index']['options']['description']['changePassword'])
					->setIcon('password')
					->setAction('changePassword')
					->setDimensions(450, 250)
					->setKeyForCurrentRow('id')
				)

				// user logout
				->append(\App\Mvc\View\Utils\RowOptions\Option\Option::create('userLogout')
					->setLabel($this->lang['index']['options']['description']['logout'])
					->setIcon('logoutForced')
					->setJsCallback("MVC.listing.installedHandlers.listing.logoutCurrentUser(this)")
				)

				// delete
				->append(\App\Mvc\View\Utils\RowOptions\Option\Delete::create("delete")
					->setLabel($this->lang['index']['options']['description']['delete'])
				)
			)

			// bulk logout user
			->append(\App\Mvc\View\Utils\RowOptions\Option\Option::create('userLogout')
				->setDescription($this->lang['index']['options']['description']['logout'])
				->setIcon('logoutForced')
				->setJsCallback("MVC.listing.installedHandlers.listing.logoutSelectedUsers(this)")
				->setSection('bulk')
			)

			// bulk delete
			->append(\App\Mvc\View\Utils\RowOptions\Option\DeleteSelected::create("delete")
				->setDescription($this->lang['index']['options']['description']['delete'])
			)
		;

	}

}
