<?php
namespace Modules\Admin\Users;

class View_Utils_FormCopyUserAccess extends \App\Mvc\View_Utils_FormAbstract
{
	public function getForm()
	{

		// extract user name
		$name = \Entity\User::select($this->values['id'])->name;

		// create form
		$form = \Engine\Form\General::create();
		$form->setStyle('width', 350)->setStyle('labelWidth', 25);

		$fieldset_copyUserAccess = \Engine\Form\Container\Fieldset::create($this->lang['formFields']['label']);
		$form->addContainer($fieldset_copyUserAccess);

		// the source user - autocomplete field
		$fld_copyFromUser = new \App\Form\Input\Autocomplete_User($this->lang['formFields']['srcUserFld'], 'idSourceUser', $this->values['idSourceUser']);
		$fld_copyFromUser->setDetails(sprintf($this->lang['formFields']['srcUserDetails'], '<b>'.$name.'</b>'));
		$fieldset_copyUserAccess->addElement($fld_copyFromUser);

		// SUBMIT BUTTON
		$form->addElement(new \Engine\Form\Input\Hidden('', $this->submitButtonName, 1));

		return $form;
	}
}