Example #1
0
 /**
  * @param Context $ctx
  */
 public function __construct($ctx)
 {
     $this->ui = $ctx->getUIManager();
     $this->form = $ctx->getForm();
     $this->format = $ctx->getUIManager()->getFormatter();
     $this->sEcho = $ctx->getRequest()->getLong('sEcho');
     $this->pagingInfo = new PagingInfo();
     $this->init($ctx);
 }
Example #2
0
 /**
  * @param Context $ctx
  */
 public function render($ctx)
 {
     $this->ctx = $ctx;
     $path = $this->getTemplateDirPath() . "/" . $this->getTemplateName();
     global $form, $format;
     $form = $ctx->getForm();
     $format = $ctx->getUIManager()->getFormatter();
     // Make $page and $ui globals, so they can be accessed by the view template.
     global $page, $ui, $lang;
     $page = $this->getPage();
     $ui = $this->ctx->getUIManager();
     $lang = Application::getTranslator()->getLanguage();
     include $path;
 }
Example #3
0
 /**
  * Add an error associated with the given field name. The message is defined
  * by the given error tag and will be defined in the form.
  *
  * @param Context $ctx
  * @param String $fieldName the name of the field
  * @param String $errorTag the tag identifying the error message
  */
 protected function addFieldErrorTag($ctx, $fieldName, $errorTag)
 {
     $form = $ctx->getForm();
     $form->addFieldError($fieldName, $errorTag);
     $ctx->getUIManager()->getErrorManager()->addError($errorTag);
 }
Example #4
0
 /**
  * @covers Context::getForm
  * @covers Context::__construct
  * @covers Context::newUIManager
  */
 public function testGetForm()
 {
     $actual = $this->ctx->getForm();
     $this->assertInstanceOf("Form", $actual);
 }