Automatic generation of HTML FORMs from given data.
Inheritance: extends AppHelper
 public function render()
 {
     $value = 0;
     $value_id = 0;
     $oDataProvider = new DataProvider($this->getDataSource());
     $oData = $oDataProvider->execute();
     //echo '<pre>', print_r($oData, true), '</pre>'; die();
     $aResult = array();
     /*$aResult[] = array(
           'Name' => $this->getDefaultText(),
           'Value' => $this->getDefaultValue()
       ); */
     if ($this->getDefault()) {
         $aRs = array();
         if (preg_match("#:(.*?)#isU", $this->getDefault(), $aRs)) {
             $value = Toolkit::getInstance()->request->get($aRs[1], Request::C_GET);
         }
     }
     //echo 'val:', print_r($this->getValue()->toSimpleArray(), true);
     if ($this->getValue()) {
         $value_id = $this->getValue()->toSimpleArray();
     }
     if ($oData->count() > 0) {
         foreach ($oData as $itm) {
             $getter = 'get' . $this->getValueField();
             $aResultTmp = array('Value' => call_user_func(array($itm, $getter)), 'Name' => $this->getTextFormat());
             $aRs = array();
             if (preg_match_all("/:(.*):/iU", $aResultTmp['Name'], $aRs)) {
                 foreach ($aRs[1] as $k => $val) {
                     $value = $itm;
                     if (strpos($val, "-") !== false) {
                         $xVal = explode("-", $val);
                         foreach ($xVal as $_val) {
                             $sGetter = 'get' . $_val;
                             $value = call_user_func(array($value, $sGetter));
                         }
                     } else {
                         $sGetter = 'get' . $val;
                         $value = call_user_func(array($value, $sGetter));
                     }
                     $aResultTmp['Name'] = str_replace($aRs[0][$k], $value, $aResultTmp['Name']);
                 }
             }
             /*if (isset($aContainer['IsTree']) && $aContainer['IsTree'] == true) {
             			$aResultTmp['Name'] = str_repeat(' |-- ', $itm->getTreeLevel() - 1).$aResultTmp['Name'];
             		}*/
             $aResult[] = $aResultTmp;
         }
     }
     $sResult = FormHelper::multiselect($this->getAlias() . '[]', $value_id, $aResult, array('class' => 'multiselect', 'id' => 'field_' . $this->getAlias()));
     if ($this->getExtended()) {
         $sResult .= '<script>$(document).ready(
             function()
             {
                 $(\'#field_' . $this->getAlias() . '\').multiselect({sortable: false, searchable: false});
             }
         );</script>';
     }
     echo $sResult;
 }
 public function postLink($title, $url = null, $options = array(), $confirmMessage = false)
 {
     if ($this->_aclCheck($url)) {
         return parent::postLink($title, $url, $options, $confirmMessage);
     }
     return '';
 }
 public function submit($caption = null, $options = array())
 {
     $defaults = array('class' => 'btn', 'escape' => false);
     $options = array_merge($defaults, $options);
     list($caption, $options) = $this->_bootstrapGenerate($caption, $options);
     return parent::submit($caption, $options);
 }
 public function render()
 {
     $value = 0;
     $value_id = 0;
     $aDataSource = $this->getDataSource();
     if ($this->getIsTree()) {
         $aDataSource[2]['Criteria']['ParentId'] = 0;
     }
     $oDataProvider = new DataProvider($aDataSource);
     $oData = $oDataProvider->execute();
     //echo '<pre>', print_r($oData, true), '</pre>'; die();
     $aResult = array();
     $aResult[] = array('Name' => $this->getDefaultText(), 'Value' => $this->getDefaultValue());
     if ($this->getDefault()) {
         $aRs = array();
         if (preg_match("#:(.*?)#isU", $this->getDefault(), $aRs)) {
             $value = Toolkit::getInstance()->request->get($aRs[1], Request::C_GET);
         }
     }
     if ($this->getValue()) {
         $value_id = $this->getValue();
     }
     $aResult = $this->createRow($oData, $aResult);
     if ($this->getOnChange()) {
         $tmpChange = $this->getOnChange();
         echo FormHelper::selectbox($this->getAlias(), $value_id, $aResult, array('class' => 'selectbox ajax_response_list', 'data-field' => $tmpChange[0], 'data-id' => $this->getValue(), 'id' => 'field_' . $this->getAlias()));
         //$.post('/structure/page_backend/typeParams', {Id: $this->getValue()}, function (data) { /* response */ });
     } else {
         echo FormHelper::selectbox($this->getAlias(), $value_id, $aResult, array('class' => 'selectbox', 'id' => 'field_' . $this->getAlias()));
     }
 }
 /**
  * Default Constructor
  *
  * @param View $View The View this helper is being attached to.
  * @param array $settings Configuration settings for the helper.
  */
 public function __construct(View $View, $settings = array())
 {
     parent::__construct($View, $settings);
     //$this->DataType = ClassRegistry::init('DataTypes.DataType');
     $this->DataTypeTemplate = ClassRegistry::init('DataTypes.DataTypeTemplate');
     $this->DataTypeTemplatesPlugin = ClassRegistry::init('DataTypes.DataTypeTemplatesPlugin');
 }
 /**
  * Mandatory execute method...
  *
  * @param block_BlockContext $context
  * @param block_BlockRequest $request
  */
 public function execute($context, $request)
 {
     FormHelper::addScriptsAndStyles($context);
     $form = $this->getParameter('form');
     $this->setTemplateName('markup/' . $form->getMarkup() . '/Form');
     $this->setAttribute('form', $form);
     $contents = array();
     form_FormService::getInstance()->buildContentsFromRequest($form->getDocumentNode()->getChildren(), $contents, $request, $form);
     $this->setAttribute('elements', $contents);
     if ($this->hasParameter('errors')) {
         $this->setAttribute('errors', $this->getParameter('errors'));
     }
     $this->setAttribute('selfUrl', $_SERVER['REQUEST_URI']);
     if ($request->getParameter(form_FormConstants::BACK_URL_PARAMETER)) {
         $backUrl = $request->getParameter(form_FormConstants::BACK_URL_PARAMETER);
     } else {
         if (isset($_SERVER['HTTP_REFERER'])) {
             $backUrl = $_SERVER['HTTP_REFERER'];
         } else {
             $backUrl = website_WebsiteModuleService::getInstance()->getCurrentWebsite()->getUrl();
         }
     }
     $this->setAttribute("receiverLabels", $this->getParameter("receiverLabels"));
     $this->setAttribute('requestParameters', $request->getParameters());
     $this->setAttribute('backUrl', $backUrl);
     $this->setAttribute('useCaptcha', $form->getDocumentService()->hasToUseCaptcha($form));
     $this->setAttribute('jQueryConditionalElement', $form->getDocumentService()->getJQueryForConditionalElementsOf($form));
 }
 public function render()
 {
     $value = 0;
     $value_id = 0;
     $aDataSource = $this->getDataSource();
     $aDataSource[2]['Criteria']['ParentId'] = 0;
     $oDataProvider = new DataProvider($aDataSource);
     $oData = $oDataProvider->execute();
     //echo '<pre>', print_r($oData, true), '</pre>'; die();
     $aResult = array();
     $aResult[] = array('Name' => $this->getDefaultText(), 'Value' => $this->getDefaultValue());
     if ($this->getDefault()) {
         $aRs = array();
         if (preg_match("#:(.*?)#isU", $this->getDefault(), $aRs)) {
             $value = Toolkit::getInstance()->request->get($aRs[1], Request::C_GET);
         }
     }
     if ($this->getValue()) {
         $value_id = $this->getValue();
     }
     if ($oData->count() > 0) {
         $aResult = $this->getChilds($oData, 1, $aResult);
     }
     echo FormHelper::selectbox($this->getAlias(), $value_id, $aResult, array('class' => 'selectbox', 'id' => 'field_' . $this->getAlias()));
 }
Example #8
0
 /**
  * ファイルインプットボックス出力
  * 画像の場合は画像タグ、その他の場合はファイルへのリンク
  * そして削除用のチェックボックスを表示する
  * [カスタムオプション]
  * imgsize・・・画像のサイズを指定する
  * 
  * @param string $fieldName
  * @param array $options
  * @return string
  * @access public
  */
 function file($fieldName, $options = array())
 {
     $linkOptions = $_options = array('imgsize' => 'midium', 'rel' => '', 'title' => '');
     $options = $this->_initInputField($fieldName, Set::merge($_options, $options));
     $linkOptions['imgsize'] = $options['imgsize'];
     $linkOptions['rel'] = $options['rel'];
     $linkOptions['title'] = $options['title'];
     unset($options['imgsize']);
     unset($options['rel']);
     unset($options['title']);
     $view =& ClassRegistry::getObject('view');
     $_field = $view->entity();
     $modelName = $_field[0];
     $field = $_field[1];
     if (ClassRegistry::isKeySet($modelName)) {
         $model =& ClassRegistry::getObject($modelName);
     } else {
         return;
     }
     $fileLinkTag = $this->fileLink($fieldName, $linkOptions);
     $fileTag = parent::file($fieldName, $options);
     $delCheckTag = parent::checkbox($modelName . '.' . $field . '_delete') . parent::label($modelName . '.' . $field . '_delete', '削除する');
     $hiddenValue = $this->value($fieldName . '_');
     $fileValue = $this->value($fieldName);
     if (is_array($fileValue) && empty($fileValue['tmp_name']) && $hiddenValue) {
         $hiddenTag = parent::hidden($modelName . '.' . $field . '_', array('value' => $hiddenValue));
     } else {
         $hiddenTag = parent::hidden($modelName . '.' . $field . '_', array('value' => $this->value($fieldName)));
     }
     $out = $fileTag;
     if ($fileLinkTag) {
         $out .= '&nbsp;' . $delCheckTag . $hiddenTag . '<br />' . $fileLinkTag;
     }
     return '<div class="upload-file">' . $out . '</div>';
 }
Example #9
0
File: AJAX.php Project: h3rb/page
 public function FormPost()
 {
     $out = array();
     $out["map"] = array();
     foreach (getpost() as $name => $value) {
         if (matches($name, "map")) {
             $map = json_decode(FormHelper::Decode($value));
             foreach ($map as $mapped) {
                 $parts = explode('|', $mapped);
                 if (contains($parts[0], '__')) {
                     $d = explode('__', $parts[0]);
                     if (!isset($out["map"][$d[0]])) {
                         $out["map"][$d[0]] = array();
                     }
                     $out["map"][$d[0]][$d[1]] = AJAX::fp($parts[1]);
                 } else {
                     $mapped[$parts[0]] = AJAX::fp($parts[1]);
                 }
             }
         } else {
             if (contains($name, '__')) {
                 $d = explode("__", $name);
                 if (!isset($out[$d[0]])) {
                     $out[$d[0]] = array();
                 }
                 $out[$d[0]][$d[1]] = base64_decode(urldecode($value));
             } else {
                 $out[$name] = FormHelper::Decode($value);
             }
         }
     }
     $out['signal'] = json_decode($out['signal'], true);
     return $out;
 }
Example #10
0
 public static function __printFormNew($shema)
 {
     $html = '<div style="border-radius: 2px;border: 1px solid #B9B9B9;"><div style="background: #F9F9F9;padding :4px;">';
     $html .= FormHelper::getInstance()->file($shema["Field"], array("id" => $shema["Field"]));
     $html .= '</div></div>';
     return $html;
 }
Example #11
0
 function end($options = null)
 {
     if ($this->_fieldsetOpen === true) {
         return "</fieldset>\n" . parent::end($options);
     }
     return parent::end($options);
 }
Example #12
0
 function dateYMD($fieldName, $selected = null, $attributes = array(), $showEmpty = true)
 {
     if (!isset($this->options['month'])) {
         $this->options['month'] = array();
         for ($i = 1; $i <= 12; $i++) {
             $this->options['month'][sprintf("%02d", $i)] = $i;
         }
     }
     $sep = array('', '', '');
     if (isset($attributes['separator'])) {
         if (is_array($attributes['separator'])) {
             $sep = $attributes['separator'];
             $attributes['separator'] = "";
         }
     } else {
         $attributes['separator'] = "";
         $sep = array("年", "月", "日");
     }
     $ret = parent::dateTime($fieldName, 'YMD', 'NONE', $selected, $attributes, $showEmpty);
     $ret = preg_replace('|</select>|', '{/select}' . @$sep[0], $ret, 1);
     $ret = preg_replace('|</select>|', '{/select}' . @$sep[1], $ret, 1);
     $ret = preg_replace('|</select>|', '{/select}' . @$sep[2], $ret, 1);
     $ret = $ret = str_replace('{/select}', '</select>', $ret);
     return $ret;
 }
 /**
  * check if options are available and find current value in list
  * if not found: do not set the value, otherwise potential sql injection vulnerability
  * TODO: try to check against options_callbacks as well!!!
  *
  * @param $varValue
  * @param $arrData
  *
  * @return bool
  */
 public static function isValidOption($varValue, &$arrData, $objDc = null)
 {
     $arrOptions = FormHelper::getFieldOptions($arrData, $objDc);
     if (empty($arrOptions)) {
         $arrOptions = array(0, 1);
     }
     $blnIsAssociative = $arrData['eval']['isAssociative'] || array_is_assoc($arrOptions);
     $intFounds = 0;
     foreach ($arrOptions as $k => $v) {
         if (!is_array($v)) {
             $checkValue = $blnIsAssociative ? $k : $v;
             if (is_array($varValue)) {
                 if (in_array(urldecode($checkValue), array_map('urldecode', $varValue))) {
                     $intFounds++;
                 }
             } elseif (urldecode($checkValue) == urldecode($varValue)) {
                 $intFounds++;
                 break;
             }
             continue;
         }
         $blnIsAssoc = array_is_assoc($v);
         foreach ($v as $kk => $vv) {
             $checkValue = $blnIsAssoc ? $kk : $vv;
             if (urldecode($checkValue) == urldecode($varValue)) {
                 $intFounds++;
                 break;
             }
         }
     }
     if (is_array($varValue) && $intFounds < count($varValue) || !is_array($varValue) && $intFounds < 1) {
         return false;
     }
     return true;
 }
 /**
  * Validate the user input and set the value
  */
 public static function validateGetAndPost($objWidget, $strMethod, $strFormId, $arrData)
 {
     if ($strMethod == FORMHYBRID_METHOD_GET) {
         $varValue = $objWidget->validator(static::getGet($objWidget, $objWidget->strName));
         $varValue = FormHelper::xssClean($varValue, $objWidget->allowHtml);
     } else {
         // \Widget->validate retrieves submission data form post -> xss related stuff needs to be removed beforehands
         $_POST[$objWidget->name] = FormHelper::xssClean($_POST[$objWidget->name], $objWidget->allowHtml);
         // Captcha needs no value, just simple validation
         if ($objWidget instanceof \FormCaptcha) {
             $varValue = '';
             $objWidget->validate();
         } else {
             $objWidget->validate();
             $varValue = $objWidget->value;
         }
     }
     $objWidget->varValue = $varValue;
     // HOOK: validate form field callback
     if (isset($GLOBALS['TL_HOOKS']['formHybridValidateFormField']) && is_array($GLOBALS['TL_HOOKS']['formHybridValidateFormField'])) {
         foreach ($GLOBALS['TL_HOOKS']['formHybridValidateFormField'] as $callback) {
             $objClass = \Controller::importStatic($callback[0]);
             $objClass->{$callback[1]}($objWidget, $strFormId, $arrData);
         }
     }
     if ($objWidget->hasErrors()) {
         $objWidget->class = 'error';
     }
 }
Example #15
0
	public function input($fieldName, $options = array()) {

		if (!empty($options['type']) and ($options['type'] == 'submit')) {
            if ((!empty($options['label'])) and is_array($options['label'])) {
				$label['class'] = (!empty($label['class']))? 'control-label col-sm-2 '.$options['label']: 'control-label col-sm-2';
				$label['text'] = (!empty($label['text']))? $options['label']['text']: false;
			} else if (!empty($options['label'])) {
				$label['text'] = false;
				$label['class'] = 'control-label col-sm-2';
			}

			if (isset($label)) {
				$options['label'] = $label;
			}
			if (empty($options['class'])) $options['class'] = 'btn btn-danger';
		} else {
			if (!empty($options['class'])) $options['class'] = 'form-control '.$options['class'];
			if ((!empty($options['label'])) and is_array($options['label'])) {
				$options['label']['class'] = (!empty($options['label']['class']))? 'control-label col-sm-2 '.$options['label']['class']: 'control-label col-sm-2';
			} else if (!empty($options['label'])) {
				$label['text'] = $options['label'];
				$label['class'] = 'control-label col-sm-2';
				$options['label'] = $label;
			}
		}

		if (empty($options['between'])) $options['between'] = '<div class="col-sm-10">';
		if (!empty($options['after'])) $options['after'] = $options['after'].'</div></div> ';

		return parent::input($fieldName, $options);
	}
Example #16
0
 function input($fieldName, $options = array())
 {
     if (ClassRegistry::isKeySet($this->model())) {
         $model =& ClassRegistry::getObject($this->model());
         if ($model->isOrigamiColumn($fieldName)) {
             $type = $model->getOrigamiColumnType($fieldName);
             if (method_exists($this, $type)) {
                 unset($options['type']);
                 // We are specifying the type, so we need to remove any user specified types
                 $out = $this->{$type}($fieldName, $options);
                 // The code is this section is mostly copied from the cake php
                 // FormHelper input method
                 $div = true;
                 $divOptions = array();
                 if (array_key_exists('div', $options)) {
                     $div = $options['div'];
                     unset($options['div']);
                 }
                 if (!empty($div)) {
                     $divOptions['class'] = 'input';
                     $divOptions = $this->addClass($divOptions, $type);
                     if (is_string($div)) {
                         $divOptions['class'] = $div;
                     } elseif (is_array($div)) {
                         $divOptions = array_merge($divOptions, $div);
                     }
                     if (in_array($this->field(), $this->fieldset['validates'])) {
                         $divOptions = $this->addClass($divOptions, 'required');
                     }
                     if (!isset($divOptions['tag'])) {
                         $divOptions['tag'] = 'div';
                     }
                 }
                 if ($type != 'hidden') {
                     $error = null;
                     if (isset($options['error'])) {
                         $error = $options['error'];
                         unset($options['error']);
                     }
                     if ($error !== false) {
                         $errMsg = $this->error($fieldName, $error);
                         if ($errMsg) {
                             $out .= $errMsg;
                             $divOptions = $this->addClass($divOptions, 'error');
                         }
                     }
                 }
                 if (isset($divOptions) && isset($divOptions['tag'])) {
                     $tag = $divOptions['tag'];
                     unset($divOptions['tag']);
                     $out = $this->Html->tag($tag, $out, $divOptions);
                 }
                 // end cake php inputs copy
                 return $out;
             }
         }
     }
     return parent::input($fieldName, $options);
 }
 public function end($string = 'Salvar', $options = array())
 {
     $optionsDefault = array('class' => 'btn btn-primary', 'div' => 'form-group');
     $options = array_merge_recursive($optionsDefault, $options);
     $retorno = parent::submit($string, $options);
     $retorno .= parent::end();
     return $retorno;
 }
 /**
  * Default Constructor
  *
  * @param View $View The View this helper is being attached to.
  * @param array $settings Configuration settings for the helper.
  */
 public function __construct(View $View, $settings = array())
 {
     parent::__construct($View, $settings);
     $this->UserRole = ClassRegistry::init('UserRoles.UserRole');
     $this->Role = ClassRegistry::init('Roles.Role');
     $this->isUsableOptions = array('1' => __d('user_roles', 'Use'), '0' => __d('user_roles', 'Not use'));
     $this->isPermittedOptions = array('1' => __d('user_roles', 'Permitted'), '0' => __d('user_roles', 'Not permitted'));
 }
 /**
  * @param string $moduleName
  */
 public static function setModuleName($moduleName = 'form')
 {
     if ($moduleName !== null) {
         self::$moduleName = $moduleName;
     } else {
         self::$moduleName = 'form';
     }
 }
Example #20
0
 public function testPassword()
 {
     //test where valueOrArray is array
     $html = $this->object->password('element', array('arbitrary' => 'arbitrary', 'class' => 'test-class'));
     $this->assertAttributes($html, array('class' => array('test-class', 'ccm-input-password'), 'arbitrary' => 'arbitrary', 'type' => 'password'));
     //test where valueOrArray is value
     $html = $this->object->password('element', 'value', array('arbitrary' => 'arbitrary', 'class' => 'test-class'));
     $this->assertAttributes($html, array('class' => array('test-class', 'ccm-input-password'), 'value' => 'value', 'arbitrary' => 'arbitrary', 'type' => 'password'));
 }
 /**
  * @param string $moduleName
  * @param string $treeType
  * @param array<string, string> $nodeAttributes
  */
 protected function addTreeAttributes($moduleName, $treeType, &$nodeAttributes)
 {
     if ($this->hasCondition()) {
         $nodeAttributes['conditioned'] = 'conditioned';
         $activationLabel = FormHelper::getActivationLabel($this->getId());
         $activationQuestionLabel = $this->getActivationquestion()->getLabel();
         $nodeAttributes['fieldConditioned'] = f_Locale::translate('&modules.form.bo.general.Activation;', array('value' => $activationLabel, 'question' => $activationQuestionLabel));
     }
 }
Example #22
0
 /**
  * create tweet box
  *
  * @param $fieldName
  * @param $options
  *      type: element type (default: textarea)
  *      maxLength:   text max length (default: 140)
  *      counterText: length message
  *      submit: submit button message. if set to false, not create.
  *      jqueryCharCount: path to charCount.js (jquery plugin)
  *      other keys set to input element options.
  */
 public function tweet($fieldName, $options = array())
 {
     $this->setEntity($fieldName);
     $domId = !empty($options['id']) ? $options['id'] : $this->domId($fieldName);
     $default = array('type' => 'textarea', 'maxlength' => 140, 'jqueryCharCount' => '/twitter_kit/js/charCount.js', 'counterText' => __d('twitter_kit', 'Characters left: ', true), 'submit' => __d('twitter_kit', 'Tweet', true));
     $options = am($default, $options);
     $inputOptions = $options;
     unset($inputOptions['jqueryCharCount']);
     unset($inputOptions['counterText']);
     unset($inputOptions['submit']);
     $out = $this->Html->script($options['jqueryCharCount']);
     $out .= $this->Form->input($fieldName, $inputOptions);
     $out .= $this->Js->buffer("\n            \$('#{$domId}').charCount({\n                limit: {$options['maxlength']},\n                counterText: '{$options['counterText']}',\n                exceeded: function(element) {\n                    \$('#{$domId}Submit').attr('disabled', true);\n                },\n                allowed: function(element) {\n                    \$('#{$domId}Submit').removeAttr('disabled');\n                }\n            });\n        ");
     if ($options['submit']) {
         $out .= $this->Form->submit($options['submit'], array('id' => $domId . 'Submit'));
     }
     return $this->output($out);
 }
 public function input($fieldName, $options = array())
 {
     $this->setEntity($fieldName);
     $model = $this->_getModel($this->model());
     $fieldKey = $this->field();
     if (!@$options['type'] && $model->hasMethod('cloudinaryFields') && in_array($fieldKey, $model->cloudinaryFields())) {
         $options['type'] = 'file';
     }
     return parent::input($fieldName, $options);
 }
 public function render()
 {
     $sResult = FormHelper::textbox($this->getAlias(), htmlentities($this->getValue(), ENT_QUOTES, "utf-8"), \ArrayHelper::merge(array('class' => 'TextboxField', 'id' => 'field_' . $this->getAlias()), $this->getHtmlOptions()));
     $sResult .= '<script type="text/javascript">
         $(document).ready(function() {
             $(\'#field_' . $this->getAlias() . '\').datetimepicker();
         });
         </script>';
     echo $sResult;
 }
Example #25
0
 public function create($model = null, $options = array())
 {
     $defaultOptions = array('class' => 'form-horizontal', 'inputDefaults' => array('format' => array('before', 'label', 'between', 'input', 'error', 'after'), 'div' => 'control-group', 'label' => array('class' => 'control-label'), 'between' => '<div class="controls">', 'after' => '</div>', 'error' => array('attributes' => array('wrap' => 'span', 'class' => 'help-inline'))));
     if (!empty($options['inputDefaults'])) {
         $options = array_merge($defaultOptions['inputDefaults'], $options['inputDefaults']);
     } else {
         $options = array_merge($defaultOptions, $options);
     }
     return parent::create($model, $options);
 }
 public function file($fieldName, $options = array())
 {
     $retval = parent::file($fieldName, $options);
     $content = $this->value($fieldName);
     if (is_numeric($content) and $content > 0) {
         $retval .= '<br><img src="' . $this->value($fieldName . '_basepath') . 'md3.png" />';
         $retval .= '<span class="help-block">' . floor($content / 1024) . ' kB uploaded</span>';
     }
     return $retval;
 }
 public static function FillProjectSessionWithDataList($caller, $sessionProject)
 {
     $sessionProject[\Library\Enums\SessionKeys::ProjectLocations] = LocationHelper::GetProjectLocations($caller, $sessionProject);
     $sessionProject[\Library\Enums\SessionKeys::ProjectTasks] = array();
     $sessionProject[\Library\Enums\SessionKeys::ProjectFieldAnalytes] = AnalyteHelper::GetProjectAnalytes($caller, TRUE, $sessionProject);
     $sessionProject[\Library\Enums\SessionKeys::ProjectLabAnalytes] = AnalyteHelper::GetProjectAnalytes($caller, FALSE, $sessionProject);
     $sessionProject[\Library\Enums\SessionKeys::ProjectForms] = FormHelper::GetProjectForms($caller, $sessionProject);
     $sessionProject[\Library\Enums\SessionKeys::ProjectServices] = array();
     return $sessionProject;
 }
 public function render()
 {
     $sResult = FormHelper::textbox('', $this->getValue(), array('class' => 'TextboxField', 'id' => 'field_' . $this->getAlias()));
     $sResult .= '<script>$(document).ready(
         function()
         {
             $(\'#field_' . $this->getAlias() . '\').autoSuggest("http://mysite.com/path/to/script", {minChars: 2, matchCase: true, startText: "Введите текст", preFill: \'' . $this->getValue() . '\', asHtmlName: \'' . $this->getAlias() . '\'});
         }
     );</script>';
     echo $sResult;
 }
 public function input($fieldName, $options = array())
 {
     $options += $this->_inputDefaults + array('div' => 'form-field', 'class' => 'input-text medium', 'error' => array('attributes' => array('wrap' => 'small')));
     if ($options['class'] !== 'input-text') {
         $options['class'] .= ' input-text';
     }
     if (!empty($options['error']) && empty($options['error']['attributes']['wrap'])) {
         $options['error']['attributes']['wrap'] = 'small';
     }
     return parent::input($fieldName, $options);
 }
 public function render()
 {
     if ($this->getValue()) {
         $file = Toolkit::i()->fileStorage->bucket($this->getBucketName())->getFile($this->getValue());
         echo '<a target="_blank" href="' . $file->getFileUrl() . '">' . $this->getValue() . '</a>';
         echo '<br />';
         echo FormHelper::checkbox($this->getAlias() . '_delete', false, ['id' => $this->getAlias() . '_delete']);
         echo ' ' . FormHelper::labelFor($this->getAlias() . '_delete', 'Удалить');
     }
     echo FormHelper::file($this->getAlias(), $this->getValue(), array('id' => 'field_' . $this->getAlias()));
 }