Renders the form Tab and Content for the modal
@return \MelisCms\Controller\ViewModel
6621
public function renderTreeSitesModalFormHandlerAction()
    {
        $data = array();
    
        $sourcePageId = (int) $this->params()->fromQuery('sourcePageId', '');
        
        $melisKey = $this->params()->fromRoute('melisKey', '');
        // declare the Tool service that we will be using to completely create our tool.
        $melisTool = $this->getServiceLocator()->get('MelisCoreTool');
        $melisCoreConfig = $this->serviceLocator->get('MelisCoreConfig');
        $appConfigForm = $melisCoreConfig->getFormMergedAndOrdered('meliscms/tools/meliscms_tree_sites_tool/forms/meliscms_tree_sites_duplicate_tree_form','meliscms_tree_sites_duplicate_tree_form');
        $factory = new \Zend\Form\Factory();
        $formElements = $this->serviceLocator->get('FormElementManager');
        $factory->setFormElementManager($formElements);
        $form = $factory->createForm($appConfigForm);
        
        $data = array(
            'sourcePageId' => $sourcePageId  
        );
        
        $form->setData($data);
        
        $view = new ViewModel();
        $view->melisKey = $melisKey;
        $view->form = $form;
        $view->sourcePageId = $sourcePageId;
        return $view;
    }
213501
public function render() {

		$output = '<div id="' . esc_attr( $this->id() ) . '" data-color="' . esc_attr( $this->base_color() ) . '" data-for="' . esc_attr( $this->id() ) . '-control" class="uix-control uix-control-' . esc_attr( $this->type ) . ' ' . esc_attr( $this->id() ) . '"></div>';
		$output .= $this->label();
		$output .= $this->input();

		$output .= $this->component_templates();

		$output .= $this->modal_template();

		return $output;
	}
531845
public function renderPlatformModalContentAction()
    {
        $pids_id = $this->params()->fromQuery('id');

        // Get Cms Platform ID form from  App Tool
        $melisMelisCoreConfig = $this->serviceLocator->get('MelisCoreConfig');
        $genericPlatformForm = $melisMelisCoreConfig->getFormMergedAndOrdered('meliscms/tools/meliscms_platform_tool/forms/meliscms_tool_platform_generic_form', 'meliscms_tool_platform_generic_form');

        // Factoring Calendar event and pass to view
        $factory = new \Zend\Form\Factory();
        $formElements = $this->serviceLocator->get('FormElementManager');
        $factory->setFormElementManager($formElements);
        $propertyForm = $factory->createForm($genericPlatformForm);

        $view = new ViewModel();
        $melisEngineTablePlatformIds = $this->getServiceLocator()->get('MelisEngineTablePlatformIds');
        $availablePlatform = $melisEngineTablePlatformIds->getAvailablePlatforms()->toArray();
        // Check if Cms Platform Id is Set
        if (!empty($pids_id)) {
            // Get Platform ID Details
            $platformIdsData = $melisEngineTablePlatformIds->getEntryById($pids_id);
            $platformIdsData = $platformIdsData->current();

            $platformTable = $this->getServiceLocator()->get('MelisCoreTablePlatform');
            $platformData = $platformTable->getEntryById($pids_id);
            $platformData = $platformData->current();

            // Assign Platform name to Element Name of the Form from the App Tool
            $platformIdsData->pids_name_input = $platformData->plf_name;

            // Removing Select input
            $propertyForm->remove('pids_name_select');
            // Binding datas to the Form
            $propertyForm->bind($platformIdsData);

            // Set variable to View
            $view->pids_id = $pids_id;
            $view->tabTitle = 'tr_meliscms_tool_platform_ids_btn_edit';
        } else {
            // Removing Id input and Platform input
            $propertyForm->remove('pids_id');
            $propertyForm->remove('pids_name_input');
            // Set variable to View
            $view->tabTitle = 'tr_meliscms_tool_platform_ids_btn_add';
        }

        $view->setVariable('meliscms_tool_platform_generic_form', $propertyForm);
        $view->setVariable('available_platform', $availablePlatform);
        $view->melisKey = $this->params()->fromRoute('melisKey', '');

        return $view;
    }
1200360
public function renderToolTemplatesModalEmptyHandlerAction()
    {
        $melisKey = $this->params()->fromRoute('melisKey', '');

        $view = new ViewModel();
        $view->melisKey = $melisKey;

        return $view;
    }
820002
public function renderBegin()
	{
		if($this->getParent() instanceof self)
			return '';
		else
		{
			$options=$this->activeForm;
			if(isset($options['class']))
			{
				$class=$options['class'];
				unset($options['class']);
			}
			else
				$class='CActiveForm';
			$options['action']=$this->action;
			$options['method']=$this->method;
			if(isset($options['htmlOptions']))
			{
				foreach($this->attributes as $name=>$value)
					$options['htmlOptions'][$name]=$value;
			}
			else
				$options['htmlOptions']=$this->attributes;
			ob_start();
			$this->_activeForm=$this->getOwner()->beginWidget($class, $options);
			return ob_get_clean() . "<div style=\"display:none\">".CHtml::hiddenField($this->getUniqueID(),1)."</div>\n";
		}
	}
268273
public function render() {
		
		$model = $this->getParent()->getModel();
		$attribute = $this->name;
		$options = $this->generateGroupOptions();

		if (isset(self::$inputTypes[$this->type])) {
			$method = self::$inputTypes[$this->type];
			// FIXME ... why we are passing $this->attributes ... most all TbActiveForm method only require $options 
			return $this->getParent()->getActiveFormWidget()->$method($model, $attribute, $this->attributes, $options);
			/* no need for this as now data goes inside $options['widgetOptions']['data']
			switch ($method) {
				case 'listBoxGroup':
				case 'dropDownListGroup':
				case 'checkBoxListGroup':
				case 'radioButtonListGroup': 
					return $this->getParent()->getActiveFormWidget()->$method($model, $attribute, $this->attributes, $this->items, $options);

				default:
					return $this->getParent()->getActiveFormWidget()->$method($model, $attribute, $this->attributes, $options);
			}
			*/
		} else {
			$attributes = $this->attributes;
			$attributes['model'] = $this->getParent()->getModel();
			$attributes['attribute'] = $this->name;

			return $this->getParent()->getActiveFormWidget()->customFieldGroup(
				array(array($this->getParent()->getOwner(), 'widget'), array($this->type, $attributes, true)),
				$model,
				$attribute,
				$options
			);
		}
	}
479360
function render() {
		if ($this->show_metainfo) {
			$this->appendtagbody($this->hidden('form')
				->value_is($this->signature()));
		}

		return parent::render();
	}
10106
public function renderContainerAction(){
        
        $translator = $this->getServiceLocator()->get('translator');
        $melisKey = $this->params()->fromRoute('melisKey', '');
        $noAccessPrompt = '';
        // Checks wether the user has access to this tools or not
        $melisCoreRights = $this->getServiceLocator()->get('MelisCoreRights');
        if(!$melisCoreRights->canAccess(self::INTERFACE_KEY)) {
            $noAccessPrompt = $translator->translate('tr_tool_no_access');
        }
        
        $view = new ViewModel();
        $view->melisKey = $melisKey;
        $view->noAccessPrompt = $noAccessPrompt;
        return $view;
    }
304910
public function renderToolTemplatesModalEditHandlerAction()
    {
        $melisKey = $this->params()->fromRoute('melisKey', '');

        // declare the Tool service that we will be using to completely create our tool.
        $melisTool = $this->getServiceLocator()->get('MelisCoreTool');

        // tell the Tool what configuration in the app.tool.php that will be used.
        $melisTool->setMelisToolKey('meliscms', 'meliscms_tool_templates');

        $view = new ViewModel();
        $view->editModalHandler = $melisTool->getModal('meliscms_tool_template_edit_modal');
        $view->melisKey = $melisKey;

        return $view;
    }
434782
protected function renderBody()
	{
		foreach($this->tabs as $id=>$tab)
		{
			$inactive=$id!==$this->activeTab?' style="display:none"' : '';
			echo "<div class=\"view\" id=\"{$id}\"{$inactive}>\n";
			if(isset($tab['content']))
				echo $tab['content'];
			elseif(isset($tab['view']))
			{
				if(isset($tab['data']))
				{
					if(is_array($this->viewData))
						$data=array_merge($this->viewData, $tab['data']);
					else
						$data=$tab['data'];
				}
				else
					$data=$this->viewData;
				$this->getController()->renderPartial($tab['view'], $data);
			}
			echo "</div><!-- {$id} -->\n";
		}
	}
1044118
public function formAction()
    {
        $repository = $this->repositories->get('Applications/Application');
        
        $mode  = $this->params()->fromQuery('mode', 'new');
        $appId = $this->params()->fromQuery('id');
        /* @var \Applications\Entity\Application $application */
        $application = $repository->find($appId);

        $viewModel = new ViewModel();
        if ('edit' == $mode) {
            $comment = $repository->findComment($appId);
        } else {
            $comment = new Comment();
            $comment->setUser($this->auth()->getUser());
        }
        
        $this->acl($application, 'read');
        
        $form = $this->formManager->get('Applications/CommentForm');
        $form->bind($comment);
        
        if ($this->getRequest()->isPost()) {
            $form->setData($_POST);
            
            if ($form->isValid()) {
                if ('new' == $mode) {
                    $application = $repository->find($appId);
                    $application->getComments()->add($comment);
                    $application->changeStatus(
                        $application->getStatus(),
                        sprintf(
                                    /* @translate */ 'Application was rated by %s',
                                     $this->auth()->getUser()->getInfo()->getDisplayName()
                    )
                        );
                }
                $viewModel->setVariable('isSaved', true);
            }
        }
       
        $viewModel->setVariables(
            array(
            'mode' => $mode,
            'identifier' => $appId,
            'commentForm' => $form,
            )
        );
        return $viewModel;
    }
70749
public function renderPlatformContentActionDeleteAction()
    {
        $melisKey = $this->params()->fromRoute('melisKey', '');
    
        $view = new ViewModel();
        $view->melisKey = $melisKey;
    
        return $view;
    }
1253896
private function renderForm()
    {
        /** @var ActiveRecord $model */
        $model = new $this->modelClass;

        echo <<<HTML
<div class="modal" id="{$this->id}-new-node-modal" tabindex="-1" role="dialog" aria-labelledby="newNodeModalLabel">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
HTML;
        /** @var ActiveForm $form */
        $form = ActiveForm::begin([
            'id' => $this->id . '-new-node-form'
        ]);

        echo <<<HTML
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" id="newNodeModalLabel">New node</h4>
      </div>
      <div class="modal-body">
HTML;

        echo call_user_func($this->formFieldsCallable, $form, $model);

        echo <<<HTML
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
        <button type="submit" class="btn btn-primary">Create node</button>
      </div>
HTML;
        $form->end();
        echo <<<HTML
    </div>
  </div>
</div>
HTML;
    }
355077
public function loadModalContent()
	{
		global $objPage;

		$id = \Input::get('modal');

		if($id == '')
		{
			return;
		}

		$page = \Input::get('page');

		// load layout because we need to initiate bootstrap
		/** @var \PageModel $objPage */
		$objPage = \PageModel::findByPk($page);
		$objPage->loadDetails();

		if($objPage === null)
		{
			$this->log(sprintf('Page ID %s not found', $page), 'Netzmacht\Bootstrap\Ajax::loadModalContent', TL_ERROR);
			exit;
		}

		$objLayout = $this->getPageLayout($objPage);

		// Set the layout template and template group
		$objPage->template = $objLayout->template ?: 'fe_page';
		$objPage->templateGroup = $objLayout->getRelated('pid')->templates;

		// trigger getPageLayout hook so
		if(isset($GLOBALS['TL_HOOKS']['getPageLayout']) && is_array($GLOBALS['TL_HOOKS']['getPageLayout']))
		{
			foreach($GLOBALS['TL_HOOKS']['getPageLayout'] as $hook)
			{
				$this->import($hook[0]);
				$this->{$hook[0]}->{$hook[1]}($objPage, $objLayout, $this);
			}
		}

		$model = \ModuleModel::findOneBy('type="bootstrap_modal" AND tl_module.id', $id);

		if($model === null)
		{
			exit;
		}

		$model->isAjax = true;
		$this->output($this->getFrontendModule($model));
	}
1292048
public function content()
    {
        if ($this->app->getMatchRoute()) {
            $actionName = strtolower(preg_replace('/(?<=\d)(?=[A-Za-z])|(?<=[A-Za-z])(?=\d)|(?<=[a-z])(?=[A-Z])/', '-', $this->app->getActionName()));

            $fileArray = [
                strtolower($this->app->getModuleName()),
                str_replace('controller', '', strtolower($this->app->getControllerName())),
                $actionName . '.phtml'
            ];

            $file = implode('/', $fileArray);
        } else {
            $viewManager = $this->config->get('view_manager');
            $file = $viewManager['template_map']['error/404'];
        }

        $this->render($file);
    }
929378
public function render()
	{
		switch ($this->getContext()) {
			case BaseField::CONTEXT_LIST:
				$values = [];
				foreach ($this->getValue() as $item) {
					$values[] = $item->{$this->getDisplayField()};
				}

				return implode(', ', $values);

				break;
			case BaseField::CONTEXT_FORM:

				$baseModel  = $this->getAdmin()->getModel();
				$baseModel  = new $baseModel;
				$primaryKey = $baseModel->getKeyName();

				$relatedModel = $baseModel->{$this->getName()}()->getRelated();
				$relatedModel = get_class($relatedModel);

				$items = [];
				foreach ($relatedModel::all() as $item) {
					$items[$item->{$primaryKey}] = $item->{$this->getDisplayField()};
				}

				$id = $this->getAdmin()->getFormBuilder()->getIdentifier();

				$values = [];
				foreach ($relatedModel::where(Str::singular($baseModel->getTable()) . '_id', $id)->get() as $item) {
					$values[] = (string) $item->{$primaryKey};
				}

				return View::make('krafthaus/bauhaus::models.fields._has_many')
					->with('field',  $this)
					->with('items',  $items)
					->with('values', $values);

				break;
		}
	}
558488
public function renderToolUserContentActionDeleteAction()
    {
        $melisKey = $this->params()->fromRoute('melisKey', '');

        $view = new ViewModel();
        $view->melisKey = $melisKey;

        return $view;
    }