@EXT\Route("/import", name="claro_admin_import_users_form")
@EXT\Template

@return Response
195306
public function importFormAction()
    {
        $form = $this->formFactory->create(new ImportUserType(true));

        return array('form' => $form->createView(), 'error' => null);
    }
773304
public function getForm()
    {
        $form = empty($_POST['source']) && empty($_POST['importFile'])
            ? new tao_models_classes_import_CsvUploadForm()
            : $this->createImportFormContainer();
        return $form->getForm();
    }
350558
private function importLine()
    {
        $import = false;
        $from = false;
        while (!$this->eol()) {
            $c = $this->peek();
            $tok = null;
            $m = null;

            if ($c === '\\') {
                $m = $this->get(2);
            } elseif ($this->scan('/[,\\.;\\*]+/')) {
                $tok = 'OPERATOR';
            } elseif ($this->scan("/[ \t]+/")) {
            } elseif (($m = $this->scan('/import\\b|from\\b/'))) {
                if ($m === 'import') {
                    $import = true;
                } elseif ($m === 'from') {
                    $from = true;
                } else {
                    assert(0);
                }
                $tok = 'IDENT';
            } elseif ($this->scan('/[_a-zA-Z]\w*/')) {
                assert($from || $import);
                if ($import) {
                    // from module import *item*, or just import *item*
                    $tok = 'USER_FUNCTION';
                    $this->userDefs[$this->match()] = 'TYPE';
                } else {
                    // from *module* ...[import item], the module is not imported
                    $tok = 'IDENT';
                }
            } else {
                break;
            }
            $this->record(($m !== null) ? $m : $this->match(), $tok);
        }
    }
328864
public function indexAction()
    {
        // Clear the user identity, if any. (#370)
        if (PHP_SESSION_ACTIVE !== session_status()) {
            session_start();
        }
        session_destroy();

        $form    = $this->installForm;
        $prereqs = $this->plugin('Install/Prerequisites')->check();
    
        return $this->createViewModel(
            array(
                'prerequisites' => $prereqs,
                'form'          => $form,
                'lang'          => $this->params('lang'),
            )
        );
    }
273299
public function importAction()
	{
		$cntl = $this->createAdmin();

		if( ( $html = $cntl->import() ) == '' ) {
			return $this->setPsrResponse( $cntl->getView()->response() );
		}

		$this->view->assign( 'content', $html );
	}
1005511
public function actionAdmin()
	{
		$model = new User();
		$profile = new Profile();

		$model->scenario = 'register';

		if ($model->load(Yii::$app->request->post())) {
			if (Yii::$app->request->isAjax) {
				Yii::$app->response->format = Response::FORMAT_JSON;

				return ActiveForm::validate($model);
			}

			if ($model->register(TRUE))
				return $this->redirect(Yii::$app->urlManager->createUrl('//installer/config/finished'));
		}

		return $this->render('admin', ['model' => $model, 'profile' => $profile]);
	}
1134101
public function routes()
	{
		Route::group(array('prefix' => $this->config->get('coanda::coanda.admin_path')), function()
		{
			// All module admin routes should be wrapper in the auth filter
			Route::group(array('before' => 'admin_auth'), function()
			{
				foreach ($this->modules as $module)
				{
					$module->adminRoutes();
				}
			});

			// We will put the main admin controller outside the group so it can handle its own filters
			Route::controller('/', 'CoandaCMS\Coanda\Controllers\AdminController');

		});

		// Let the module output any front end 'user' routes
		foreach ($this->modules as $module)
		{
			$module->userRoutes();
		}

		App::before( function () {

			Route::match(['GET', 'POST'], 'search', function () {
				
				// Pass this route to the search provider, it can do whatever it likes!
				return Coanda::search()->handleSearch();

			});

			Route::match(['GET', 'POST'], '{slug}', function ($slug)
			{
				return Coanda::route($slug);

			})->where('slug', '[\.\/_\-\_A-Za-z0-9]+');

			Route::match(['GET', 'POST'], '/', function ()
			{
				return Coanda::routeHome();

			});

		});

	}
568286
public function processUpdateAction()
    {
        // Check current user authorization
        if (null !== $response = $this->checkAuth(AdminResources::MODULE, Dealer::getModuleCode(),
                AccessManager::VIEW)
        ) {
            return $response;
        }

        // Error (Default: false)
        $error_msg = false;

        // Create the Form from the request
        $changeForm = $this->getForm($this->getRequest());

        try {
            // Check the form against constraints violations
            $form = $this->validateForm($changeForm, "POST");

            // Get the form field values
            $data = $form->getData();

            $updatedObject = $this->getService()->updateFromArray($data);

            // Check if object exist
            if (!$updatedObject) {
                throw new \LogicException(
                    $this->getTranslator()->trans("No %obj was updated.", ['%obj' => 'Dealer'])
                );
            }
            // If we have to stay on the same page, do not redirect to the successUrl,
            // just redirect to the edit page again.
            if ($this->getRequest()->get('save_mode') == 'stay') {
                $id = $this->getRequest()->query->get("dealer_id");

                return new RedirectResponse(URL::getInstance()->absoluteUrl("/admin/module/Dealer/dealer/edit",
                    ["dealer_id" => $id, ]));
            }

            // Redirect to the success URL
            return $this->generateSuccessRedirect($changeForm);
        } catch (FormValidationException $ex) {
            // Form cannot be validated
            $error_msg = $this->createStandardFormValidationErrorMessage($ex);
            /*} catch (\Exception $ex) {
                // Any other error
                $error_msg = $ex->getMessage();*/
        }

        if (false !== $error_msg) {
            // At this point, the form has errors, and should be redisplayed.
            $this->setupFormErrorContext(
                $this->getTranslator()->trans("%obj modification", ['%obj' => 'Dealer']),
                $error_msg,
                $changeForm,
                $ex
            );

            $id = $this->getRequest()->query->get("dealer_id");

            return new RedirectResponse(URL::getInstance()->absoluteUrl("/admin/module/Dealer/dealer/edit",
                ["dealer_id" => $id, ]));
        }
    }
622859
public function index()
    {
        return Admin::content(function (Content $content) {
            $content->header(trans('admin.lang.menu'));
            $content->description(trans('admin.:lang.list'));

            $content->row(function (Row $row) {
                $row->column(6, $this->treeView()->render());

                $row->column(6, function (Column $column) {
                    $form = new \Jblv\Admin\Widgets\Form();
                    $form->action(admin_url('auth/menu'));

                    $form->select('parent_id', trans('admin.parent_id'))->options(Menu::selectOptions());
                    $form->text('title', trans('admin.title'))->rules('required');
                    $form->icon('icon', trans('admin.icon'))->default('fa-bars')->rules('required')->help($this->iconHelp());
                    $form->text('uri', trans('admin.uri'));
                    $form->multipleSelect('roles', trans('admin.roles'))->options(Role::all()->pluck('name', 'id'));

                    $column->append((new Box(trans('admin.new'), $form))->style('success'));
                });
            });
        });
    }
1158152
public function actionAssign()
    {
        $routes = Yii::$app->getRequest()->post('routes', []);
        $model = new AdminRoute();
        $model->addNew($routes);
        Yii::$app->getResponse()->format = Response::FORMAT_JSON;
        return $model->getRoutes();
    }
42277
protected function createComponentUserForm(): Form
	{
		$form = $this->formFactory->create();
		$form->setAjaxRequest();

		$form->addProtection();

		$form->addText('username', 'cms.user.username')
			->setDisabled()
			->setDefaultValue($this->profile->username);
		$form->addText('roles', 'cms.permissions.roles')
			->setDisabled()
			->setDefaultValue(implode(', ', $this->profile->roleTitles));
		$form->addText('firstName', 'cms.user.firstName')
			->setDefaultValue($this->profile->firstName);
		$form->addText('surname', 'cms.user.surname')
			->setDefaultValue($this->profile->surname);
		$form->addText('email', 'cms.user.email')
			->setDefaultValue($this->profile->email)
			->setRequired()
			->addRule(Form::EMAIL);
		$form->addPhone('phone', 'cms.user.phone')
			->setDefaultValue($this->profile->phone);

		$language = $form->addSelectUntranslated('language', 'cms.user.language', $this->localeService->allowed, 'form.none');
		$locale = $this->localeService->get($this->profile->language);
		if ($locale) {
			$language->setDefaultValue($locale->id);
		}

		$form->addSubmit('save', 'form.save');

		$form->onError[] = function (Form $form) {
			if ($this->isAjax()) {
				$this->redrawControl('userForm');
			}
		};

		$form->onSuccess[] = [$this, 'userFormSucceeded'];

		return $form;
	}
453984
public function answerImportAction()
    {
        $controller   = 'answers';
        $importLoader = $this->loader->getImportLoader();

        $params['defaultImportTranslator'] = $importLoader->getDefaultTranslator($controller);
        $params['formatBoxClass']          = 'browser table';
        $params['importer']                = $importLoader->getImporter($controller);
        $params['importLoader']            = $importLoader;
        $params['tempDirectory']           = $importLoader->getTempDirectory();
        $params['importTranslators']       = $importLoader->getTranslators($controller);

        $this->addSnippets('Survey_AnswerImportSnippet', $params);
    }
657010
public function indexAction()
    {
        return $this->render('LiipTranslationBundle:Import:index.html.twig', array(
            'upload_form' => $this->createForm(new FileImportType())->createView(),
            'translations' => $this->getSessionImporter()->getCurrentTranslations(),
        ));
    }
1091460
public function installAction()
    {
        $form = $this->installForm;
        $form->setData($_POST);

        if (!$form->isValid()) {
            return $this->createJsonResponse(
                array(
                    'ok'     => false,
                    'errors' => $form->getMessages(),
                )
            );
        }

        $data = $form->getData();

        try {
            $options = [
                'connection' => $data['db_conn'],
            ];
            $userOk = $this->plugin('Install/UserCreator', $options)->process($data['username'], $data['password'], $data['email']);
            $ok = $this->plugin('Install/ConfigCreator')->process($data['db_conn'], $data['email']);
        } catch (\Exception $exception) {
            /* @TODO: provide a way to handle global error message */
            return $this->createJsonResponse([
                'ok'        => false,
                'errors'    => [
                    'global' => [$exception->getMessage()]
                ]
            ]);
        }

        /*
         * Make sure there's no cached config files
         */
        $this->cacheService->clearCache();

        $model = $this->createViewModel(array('ok' => $ok), true);
        $model->setTemplate('install/index/install.ajax.phtml');

        return $model;
    }
547447
public function importsEventsIcsAction()
    {
        $form = $this->createForm(new ImportAgendaType());
        $form->handleRequest($this->request);

        if ($form->isValid()) {
            $events = $this->agendaManager->importEvents($form->get('file')->getData());

            return new JsonResponse($events, 200);
        }

        return ['form' => $form->createView()];
    }
151324
public function importAction()
    {
        $success = null;
        $request = $this->getRequest();
        $data    = $request->getPost();
        $form    = $this->getServiceLocator()
                        ->get( 'Form' )
                        ->get( 'Grid\Paragraph\ImportContent\Import' );

        $form->setAttribute(
            'action',
            $this->url()
                 ->fromRoute( 'Grid\Paragraph\ImportContent\Import', array(
                     'locale'       => (string) $this->locale(),
                     'redirectUri'  => $request->getQuery( 'returnUri' ),
                 ) )
        );

        if ( $request->isPost() )
        {
            $form->setData( $data );

            if ( $form->isValid() )
            {
                $data   = $form->getData();
                $model  = $this->getServiceLocator()
                               ->get( 'Grid\Paragraph\Model\Paragraph\Model' );
                $id     = $model->cloneFrom( $data['importId'], '_central' );
                $menuId = (int) $data['menuId'];
                unset( $data['menuId'] );
                unset( $data['importId'] );

                if ( empty( $id ) )
                {
                    $success = false;
                }
                else
                {
                    $content = $model->find( $id );

                    if ( empty( $content ) )
                    {
                        $success = false;
                    }
                    else
                    {
                        $userId = $this->getAuthenticationService()
                                       ->getIdentity()
                                       ->id;

                        $data['created']    = null;
                        $data['userId']     = $userId;
                        $data['editUsers']  = array( $userId );

                        $success = (bool) $content->setOptions( $data )
                                                  ->save();

                        if ( $success )
                        {
                            if ( isset( $data['title'] ) )
                            {
                                $data['title'] = trim( $data['title'] );
                            }

                            if ( ! empty( $data['title'] ) )
                            {
                                $subdomain = $this->getServiceLocator()
                                                  ->get( 'SiteInfo' )
                                                  ->getSubdomainId();

                                $postfix = '';
                                $uri = preg_replace(
                                    '/\\s+/', '-',
                                    mb_strtolower( $data['title'], 'UTF-8' )
                                );

                                $model = $this->getServiceLocator()
                                              ->get( 'Grid\Core\Model\Uri\Model' );

                                while ( $model->isSubdomainUriExists(
                                            $subdomain,
                                            $uri . $postfix
                                        ) )
                                {
                                    --$postfix;
                                }

                                $uri = $model->create( array(
                                    'subdomainId'   => $subdomain,
                                    'contentId'     => $content->id,
                                    'locale'        => $this->getAdminLocale(),
                                    'uri'           => $uri . $postfix,
                                ) );

                                if ( $uri->save() )
                                {
                                    $redirect = '/' . $uri->safeUri;
                                }

                                if ( $menuId )
                                {
                                    $menuModel = $this->getServiceLocator()
                                                      ->get( 'Grid\Menu\Model\Menu\Model' );

                                    $menu = $menuModel->create( array(
                                        'type'      => 'content',
                                        'label'     => $data['title'],
                                        'contentId' => $content->id,
                                    ) );

                                    if ( $menu->save() )
                                    {
                                        $menuModel->appendTo( $menu->id, $menuId );
                                    }
                                }
                            }
                        }
                    }
                }
            }
            else
            {
                $success = false;
            }
        }

        if ( true === $success )
        {
            $this->messenger()
                 ->add( 'paragraph.action.importContent.success',
                        'paragraph', Message::LEVEL_INFO );
        }

        if ( false === $success )
        {
            $this->messenger()
                 ->add( 'paragraph.action.importContent.failed',
                        'paragraph', Message::LEVEL_ERROR );
        }

        if ( null !== $success )
        {
            if ( empty( $redirect ) )
            {
                if ( empty( $id ) )
                {
                    $redirect = $request->getQuery( 'returnUri', '/' );
                }
                else
                {
                    $redirect = $this->url()
                                     ->fromRoute( 'Grid\Paragraph\Render\Paragraph', array(
                                         'locale'       => $this->getAdminLocale(),
                                         'paragraphId'  => $id,
                                     ) );
                }
            }

            return $this->redirect()
                        ->toUrl( $redirect );
        }

        $view = new ViewModel( array(
            'form' => $form,
        ) );
        return $view->setTerminal( true );
    }
1168647
public function createAction()
    {
        // Check current user authorization
        if (null !== $response = $this->checkAuth(self::CONTROLLER_CHECK_RESOURCE, Dealer::getModuleCode(),
                AccessManager::CREATE)
        ) {
            return $response;
        }

        // Create the Creation Form
        $creationForm = $this->getCreationForm($this->getRequest());

        $con = Propel::getConnection();
        $con->beginTransaction();

        try {
            // Check the form against constraints violations
            $form = $this->validateForm($creationForm, "POST");
            // Get the form field values
            $data = $form->getData();

            if (empty($data["day"])) {
                $dataAM = $this->formatData($data);
                $dataPM = $this->formatData($data, 'PM');

                if ($this->hasNullDate($dataAM) && $this->hasNullDate($dataPM)) {
                    $this->getService()->createFromArray($dataAM, $this->getCurrentEditionLocale());
                } else {
                    if (!$this->hasNullDate($dataAM)) {
                        $this->getService()->createFromArray($dataAM, $this->getCurrentEditionLocale());
                    }
                    if (!$this->hasNullDate($dataPM)) {
                        $this->getService()->createFromArray($dataPM, $this->getCurrentEditionLocale());
                    }
                }
            } else {
                foreach ($data["day"] as $day) {
                    $currentData = $data;
                    $currentData["day"] = $day;
                    $dataAM = $this->formatData($currentData);
                    $dataPM = $this->formatData($currentData, 'PM');

                    if ($this->hasNullDate($dataAM) && $this->hasNullDate($dataPM)) {
                        $this->getService()->createFromArray($dataAM, $this->getCurrentEditionLocale());
                    } else {
                        if (!$this->hasNullDate($dataAM)) {
                            $this->getService()->createFromArray($dataAM, $this->getCurrentEditionLocale());
                        }
                        if (!$this->hasNullDate($dataPM)) {
                            $this->getService()->createFromArray($dataPM, $this->getCurrentEditionLocale());
                        }
                    }
                }
            }


            // Substitute _ID_ in the URL with the ID of the created object
            $successUrl = $creationForm->getSuccessUrl();

            $con->commit();

            // Redirect to the success URL
            return $this->generateRedirect($successUrl);
        } catch (FormValidationException $ex) {
            $con->rollBack();
            // Form cannot be validated
            $error_msg = $this->createStandardFormValidationErrorMessage($ex);
        } catch (\Exception $ex) {
            $con->rollBack();
            // Any other error
            $error_msg = $ex->getMessage();
        }
        if (false !== $error_msg) {
            $this->setupFormErrorContext(
                $this->getTranslator()->trans("%obj creation", ['%obj' => static::CONTROLLER_ENTITY_NAME]),
                $error_msg,
                $creationForm,
                $ex
            );

            // At this point, the form has error, and should be redisplayed.
            return $this->generateErrorRedirect($creationForm);
        }
    }