本文整理汇总了PHP中FormElement类的典型用法代码示例。如果您正苦于以下问题:PHP FormElement类的具体用法?PHP FormElement怎么用?PHP FormElement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FormElement类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:decima,项目名称:M2-platine,代码行数:7,代码来源:QRender.php
示例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;
}
开发者ID:RNKushwaha022,项目名称:orange-php,代码行数:8,代码来源:coupleddropdown.input.php
示例3: submitEditFormElementDescData
function submitEditFormElementDescData($moduleCompId, $elementId)
{
$myElement = new FormElement();
$myElement->fromHtmlForm();
$updateQuery = $myElement->toMysqlUpdateQuery($moduleCompId);
if (mysql_query($updateQuery)) {
return true;
} else {
return false;
}
}
开发者ID:ksb1712,项目名称:pragyan,代码行数:11,代码来源:editformelement.php
示例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;
}
开发者ID:anunay,项目名称:stentors,代码行数:23,代码来源:FormElementObject.php
示例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();
}
}
开发者ID:nicholasryan,项目名称:CorePlus,代码行数:41,代码来源:function.add_form_element.php
示例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;
}
开发者ID:vazahat,项目名称:dudex,代码行数:16,代码来源:form_fields.php
示例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;
}
开发者ID:hardikamutech,项目名称:hammu,代码行数:17,代码来源:avatar_field.php
示例8: validate
/**
* This function will validate the element's value against defined validation rules (e.g. not null, ...)
*
* The validation will also activate the error flag, if any
* rule is broken, which will trigger the error message in
* form mode output.
*
* @see setMaximumLength()
* @see FormElement::validate()
* @return boolean TRUE if no errors occurred
*/
public function validate()
{
parent::validate();
$value = trim($this->value());
// only use reg exp validation if value is not empty.
// an empty value validation should be made with setNotNull()
if (!$this->isEmpty() && $this->validRegExp() != '' && !preg_match($this->validRegExp(), $value)) {
$this->setError('REGEXP MISMATCH');
}
$this->_isValidated = true;
return !$this->error();
}
开发者ID:aselvan,项目名称:PHPKnock,代码行数:23,代码来源:text_class.php
示例9: confirmDelete
public function confirmDelete($label)
{
$group = new GroupObject();
if ($group->load_by_label($label)) {
if (isset($_POST['delete'])) {
$group = new GroupObject();
$group->load_by_label($label);
$group->delete();
header("Location:" . Page::url("/admin/groups"));
}
$theme = new Theme();
$form = new Form("POST", Page::url("/admin/groups/confirm/{$label}"));
$link = new FormElement("a", null, t("Retourner à la liste des groupes"), "", "");
$link->setAttribute("href", Page::url("/admin/groups/"));
$form->addElement($link);
$form->addElement(new InputElement("delete", "", t("supprimer le groupe"), "submit"));
$theme->add_to_body($theme->forming($form));
$theme->set_title("Confirmer la suppression du groupe {$label}");
$theme->process_theme(Theme::STRUCT_ADMIN);
} else {
header("Location:" . Page::url("/admin/groups?err=notexists"));
}
}
开发者ID:decima,项目名称:M2-platine,代码行数:23,代码来源:GroupPage.php
示例10: smarty_function_input
function smarty_function_input($params, $smarty)
{
$type = FormElement::getParameter($params, 'type', 'text');
$label = FormElement::getParameter($params, 'label');
if (! $label && !FormElement::getBoolParameter($params, 'nolabel'))
{
$type = 'hidden';
}
$object = FormElement::getObject($type);
if ($object instanceof FileInput)
{
$smarty->_coorg_form->file_upload = true;
}
if ($object instanceof LabeledFormElement)
{
$object->setLabel(t($label));
$object->setIDPrefix($smarty->_coorg_form->formID);
if (FormElement::getBoolParameter($params, 'disabled')) $object->disable();
if ($tabindex = FormElement::getParameter($params, 'tabindex')) $object->tabindex($tabindex);
}
if ($object instanceof IUserInput)
{
if ($placeholder = FormElement::getParameter($params, 'placeholder')) $object->setPlaceholder($placeholder);
if (FormElement::getBoolParameter($params, 'readonly')) $object->readonly();
if ($for = FormElement::getParameter($params, 'for'))
{
$object->setName($for); // This can be overriden by a name="" (see later)
$instance = $smarty->_coorg_form->instance;
$object->setObject($instance, $for);
}
else
{
$object->setValue(FormElement::getParameter($params, 'value'));
}
}
if ($name = FormElement::getParameter($params, 'name'))
{
$object->setName($name);
}
$object->setSpecificParameters($params);
return $object->render();
}
开发者ID:nathansamson,项目名称:CoOrg,代码行数:50,代码来源:function.input.php
示例11: renderInput
/**
* @see FormElement::renderInput()
*
* @param array $params
* @return string
*/
public function renderInput($params = null)
{
parent::renderInput($params);
$staticUrl = OW::getPluginManager()->getPlugin('mcompose')->getStaticUrl();
OW::getDocument()->addStyleSheet($staticUrl . 'select2.css');
OW::getDocument()->addScript($staticUrl . 'select2.js');
OW::getDocument()->addStyleSheet($staticUrl . 'style.css');
OW::getDocument()->addScript($staticUrl . 'script.js');
$this->addAttribute('type', 'hidden');
$this->addAttribute('style', 'width: 100%');
$imagesUrl = OW::getPluginManager()->getPlugin('base')->getStaticCssUrl();
$css = array('.mc-tag-bg { background-image: url(' . $imagesUrl . 'images/tag_bg.png); };');
OW::getDocument()->addStyleDeclaration(implode("\n", $css));
return UTIL_HtmlTag::generateTag('input', $this->attributes) . '<div class="us-field-fake"><input type="text" class="ow_text invitation" value="' . $this->invitation . '" /></div>';
}
开发者ID:vazahat,项目名称:dudex,代码行数:21,代码来源:user_select_field.php
示例12: 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);
}
}
开发者ID:nicholasryan,项目名称:CorePlus,代码行数:26,代码来源:FormCheckboxesInput.class.php
示例13: 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']);
}
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:34,代码来源:GridButtonComponent.class.php
示例14: __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');
}
开发者ID:nicholasryan,项目名称:CorePlus,代码行数:7,代码来源:FormPasswordInput.class.php
示例15: __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');
}
开发者ID:nicholasryan,项目名称:CorePlus,代码行数:7,代码来源:FormCheckboxInput.class.php
示例16: 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;
}
开发者ID:BackupTheBerlios,项目名称:openology-svn,代码行数:37,代码来源:FormCheckbox.php
示例17:
function __toString()
{
//Allows children to write this attribute first
if ($this->getAttribute('value') === false) {
$this->setAttribute("value", $this->getRawValue());
}
return parent::__toString();
}
开发者ID:RNKushwaha022,项目名称:orange-php,代码行数:8,代码来源:forminput.base.php
示例18: __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');
}
开发者ID:nicholasryan,项目名称:CorePlus,代码行数:9,代码来源:TinyMCEFormElement.class.php
示例19: 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;
}
开发者ID:vallejos,项目名称:samples,代码行数:10,代码来源:select.php
示例20:
function __toString()
{
$this->setAttribute('class', 'tinymce_textarea');
$this->innerHTML = HtmlHelper::escape($this->_value);
$config = JsonHelper::encode($this->config);
$script = HtmlHelper::inlineJavascript('tinyMCE.init(' . $config . ');');
$this->afterHTML = $script;
self::$instances_included++;
return parent::__toString();
}
开发者ID:RNKushwaha022,项目名称:orange-php,代码行数:10,代码来源:tinymceeditor.input.php
注:本文中的FormElement类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论