本文整理汇总了PHP中FormElement类的典型用法代码示例。如果您正苦于以下问题:PHP FormElement类的具体用法?PHP FormElement怎么用?PHP FormElement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FormElement类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: form
public function form()
{
$text = new FormElement("textarea", "q_post");
$t = new Theme();
$text->addClasses("actualite_area_text");
return $t->process_form_elements($text);
}
示例2: coupleWith
function coupleWith(FormElement $component, $url, $filter_column = null, $empty_value = '')
{
$this->setAttribute('rel', $component->getId());
$this->setAttribute('data-url', UrlHelper::get($url));
$this->filter_column = $filter_column;
$this->related = $component;
$this->empty_value = $empty_value;
}
示例3: submitEditFormElementDescData
function submitEditFormElementDescData($moduleCompId, $elementId)
{
$myElement = new FormElement();
$myElement->fromHtmlForm();
$updateQuery = $myElement->toMysqlUpdateQuery($moduleCompId);
if (mysql_query($updateQuery)) {
return true;
} else {
return false;
}
}
示例4: _selectElements
/**
* Return an array with the elements according to the parameters
*
* @param int $id
* @param int $langId
* @param string $type
*
* @return array
*/
protected function _selectElements($id, $all = false)
{
$oElem = new FormElement();
$oElemType = new FormElementType();
$select = $oElem->select()->setIntegrityCheck(false)->from($oElem->getName())->joinInner($oElemType->getName(), 'FET_ID = FE_TypeID', 'FET_Title');
if (!$all) {
$select->where('FE_ID = ?', $id);
} else {
$select->where('FE_SectionID = ?', $id);
}
$select->order('FE_Seq ASC');
$elements = $oElem->fetchAll($select)->toArray();
return $elements;
}
示例5: smarty_function_add_form_element
/**
* Render and add a form element to both the PHP session and HTML output.
*
* @experimental
* @param array $params Associative (and/or indexed) array of smarty parameters passed in from the template
* @param Smarty $smarty Parent Smarty template object
*
* @return string
* @throws SmartyException
*/
function smarty_function_add_form_element($params, $smarty){
if(!isset($params['form'])){
$form = null;
}
elseif($params['form'] instanceof Form){
$form = $params['form'];
}
elseif($params['form'] instanceof \Core\ListingTable\Table){
$form = $params['form']->getEditForm();
}
else{
throw new SmartyException('Unsupported value provided for "form", please ensure it is either a valid Form object or omitted completely!');
}
$type = isset($params['type']) ? $params['type'] : 'text';
$element = FormElement::Factory($type, $params);
if($form){
$form->addElement($element);
}
// Assign or render?
if(isset($params['assign'])){
$smarty->assign($params['assign'], $element->render());
}
else{
echo $element->render();
}
}
示例6: renderInput
/**
* @see FormElement::renderInput()
*
* @param array $params
* @return string
*/
public function renderInput($params = null)
{
parent::renderInput($params);
$output = '<div class="color_input"><input type="text" id="colorh_' . $this->getId() . '" name="' . $this->getName() . '" ' . ($this->getValue() !== null ? '" value="' . $this->getValue() . '"' : '') . ' />' . ' <input type="button" class="color_button" id="color_' . $this->getId() . '" style="background:' . ($this->getValue() !== null ? $this->getValue() : '') . '" />
<div style="display:none;"><div id="colorcont_' . $this->getId() . '"></div></div></div>';
$varName = rand(10, 100000);
$js = "var callback" . $varName . " = function(color){\n \$('#colorh_" . $this->getId() . "').attr('value', color);\n \$('#color_" . $this->getId() . "').css({backgroundColor:color});\n window.colorPickers['" . $this->getId() . "'].close();\n };\n new ColorPicker(\$('#colorcont_" . $this->getId() . "'), callback" . $varName . ", '" . $this->getValue() . "');\n \$('#color_" . $this->getId() . "').click(\n function(){\n if( !window.colorPickers )\n {\n window.colorPickers = {};\n }\n window.colorPickers['" . $this->getId() . "'] = new OW_FloatBox({\$contents:\$('#colorcont_" . $this->getId() . "'), \$title:'Color Picker'});\n }\n );";
OW::getDocument()->addOnloadScript($js);
return $output;
}
示例7: renderInput
/**
* @see FormElement::renderInput()
*
* @param array $params
* @return string
*/
public function renderInput($params = null)
{
parent::renderInput($params);
$deleteLabel = OW::getLanguage()->text('base', 'delete');
$markup = '<div class="ow_avatar_field">';
$markup .= UTIL_HtmlTag::generateTag('input', $this->attributes);
$markup .= '<div class="ow_avatar_field_preview" style="display: none;"><img src="" alt="" /><span title="' . $deleteLabel . '"></span></div>';
$markup .= '<input type="hidden" name="" value="" class="ow_avatar_field_value" />';
$markup .= '</div>';
return $markup;
}
示例8: set
public function set($key, $value) {
if ($key == 'options') {
// The options need to be an array, (hence the plural use)
if (!is_array($value)) return false;
// if every key in this is an int, transpose the value over to the key instead.
// This allows for having an option with a different title and value.
// (and cheating, not actually checking every key)
if (isset($value[0]) && isset($value[sizeof($value) - 1])) {
foreach ($value as $k => $v) {
unset($value[$k]);
$value[$v] = $v;
}
}
// Please note, this system CANNOT call the parent function, because its default behaviour is to
// remap any int-based array to value/value pairs. Since that logic is already handled here, there
// is no need to perform it again, (of which it performs incorrectly)...
$this->_attributes[$key] = $value;
return true;
//return parent::set($key, $value);
}
else {
parent::set($key, $value);
}
}
示例9: renderAttributes
public function renderAttributes()
{
$this->_processAttributes();
if (!$this->path)
{
$action_path = $_SERVER['PHP_SELF'];
if($node_id = Limb :: toolkit()->getRequest()->get('node_id'))
$action_path .= '?node_id=' . $node_id;
}
else
$action_path = $this->path;
if (strpos($action_path, '?') === false)
$action_path .= '?';
else
$action_path .= '&';
if($this->action)
$action_path .= 'action=' . $this->action;
if ((bool)$this->reload_parent)
{
$action_path .= '&reload_parent=1';
}
$this->attributes['onclick'] = $this->onclick;
$this->attributes['onclick'] .= "submitForm(this.form, '{$action_path}')";
parent :: renderAttributes();
unset($this->attributes['onclick']);
}
示例10: __construct
public function __construct($atts = null) {
parent::__construct($atts);
// Some defaults
$this->_attributes['class'] = 'formelement formpasswordinput';
$this->_validattributes = array('accesskey', 'autocomplete', 'dir', 'disabled', 'id', 'lang', 'name', 'required', 'size', 'tabindex', 'width', 'height', 'value', 'style');
}
示例11: __construct
public function __construct($atts = null) {
parent::__construct($atts);
// Some defaults
$this->_attributes['class'] = 'formelement formcheckboxinput';
$this->_validattributes = array('accesskey', 'checked', 'dir', 'disabled', 'id', 'lang', 'name', 'required', 'tabindex', 'style', 'value');
}
示例12: toHtml
/**
* Return html rendering for the element label
* $arr_return['label'] - array or string of form element lable
* $arr_return['html'] - array or string of form element
*
* @return Array $arr_return
*
*/
function toHtml()
{
$arr_return = parent::toHtml();
$arr_return['html'] = '';
$arr_checkboxes = array();
$arr_checkboxes = $this->getAttribute('checkboxes');
$arr_checked = array();
$arr_checked = $this->getAttribute('checked');
$string = '';
$id = $this->getAttribute('id');
if (is_array($arr_checkboxes)) {
foreach ($arr_checkboxes as $key => $value) {
$encode_key = str_replace(' ', '_', $key);
$string = '<input {attr_name=attr_value} {extra_attr} id="' . "{$id}_{$encode_key}" . '" value="' . $key . '" ';
if (is_array($arr_checked)) {
$string .= in_array($key, $arr_checked) ? 'checked ' : '';
}
$string .= '%id|checked|checkboxes|separator% />';
$string .= $value != '' ? '<label for="{attr_id}_' . $encode_key . '">' . $value . '</label>' : '';
$string .= $this->arr_attr['separator'] . "\n";
if ($this->return_type == 'string') {
$arr_return['html'] .= $string;
} else {
$arr_return['html'][] = $string;
}
}
}
return $arr_return;
}
示例13:
function __toString()
{
//Allows children to write this attribute first
if ($this->getAttribute('value') === false) {
$this->setAttribute("value", $this->getRawValue());
}
return parent::__toString();
}
示例14: __construct
public function __construct($atts = null)
{
parent::__construct($atts);
// Some defaults
$this->_attributes['class'] = 'formelement formwysiwyginput tinymce';
$this->_attributes['rows'] = '25';
// Note, I'm taking the required flag out from here; tinymce doesn't support it.
$this->_validattributes = array('accesskey', 'dir', 'disabled', 'id', 'lang', 'name', 'readonly', 'tabindex', 'rows', 'cols', 'style', 'class');
}
示例15: Display
function Display()
{
$html = $this->_loadTemplate();
$html = str_replace("#LABEL#", $this->label, $html);
$html = str_replace("#NOMBRE#", $this->nombre, $html);
$html = str_replace("#ID#", $this->id, $html);
$html = str_replace("#SELECTED_VALUE#", $this->selected_value, $html);
$html = str_replace("#OPTIONS#", parent::Display(), $html);
return $html;
}