本文整理汇总了PHP中Dao::getForm方法的典型用法代码示例。如果您正苦于以下问题:PHP Dao::getForm方法的具体用法?PHP Dao::getForm怎么用?PHP Dao::getForm使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dao
的用法示例。
在下文中一共展示了Dao::getForm方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getOutput
protected function getOutput()
{
$id = $this->getArg('id', 0, true);
if (!in_array($this->getContext(), ['module', 'action']) || !is_numeric($id) || $id < 1 || $id > 20) {
return false;
}
$value = $this->getContextData()->getValue('value' . $id);
if ($this->hasArg('isset') && $this->getArg('isset')) {
return $value ? 'true' : 'false';
}
if ($this->hasArg('widget') && $this->getArg('widget')) {
if (!$this->environmentIs(self::ENV_INPUT)) {
return false;
}
$select = new rex_category_select();
if ($this->hasArg('multiple') && $this->getArg('multiple')) {
$select->setName('REX_INPUT_VALUE[' . $id . '][]');
$select->setMultiple();
$select->setSelected(rex_var::toArray($value));
} else {
$select->setName('REX_INPUT_VALUE[' . $id . ']');
$select->setSelected($value);
}
if ($this->hasArg('root') && $this->getArg('root')) {
$select->setRootId(explode(',', $this->getArg('root')));
}
$widget = '<div class="rex-select-style">' . $select->get() . '</div>';
if ($this->hasArg('output') && $this->getArg('output')) {
$label = $this->hasArg('label') ? $this->getArg('label') : '';
$widget = Dao::getForm($widget, $label, $this->getArg('output'));
}
return self::quote($widget);
}
return self::quote(htmlspecialchars($value));
}
示例2: getOutput
protected function getOutput()
{
$id = $this->getArg('id', 0, true);
if (!in_array($this->getContext(), ['module', 'action']) || !is_numeric($id) || $id < 1 || $id > 20) {
return false;
}
$value = $this->getContextData()->getValue('value' . $id);
if ($this->hasArg('isset') && $this->getArg('isset')) {
return $value ? 'true' : 'false';
}
$classes = [];
if ($this->hasArg('class') && $this->getArg('class')) {
$classes[] = $this->getArg('class');
}
if ($this->hasArg('widget') && $this->getArg('widget')) {
$value = htmlspecialchars($value);
if (!$this->environmentIs(self::ENV_INPUT)) {
$value = nl2br($value);
}
$classes[] = 'form-control';
$class = ' class="' . implode(' ', $classes) . '"';
$type = $this->getArg('type', 'text', true);
switch ($type) {
case 'textarea':
$widget = '<textarea' . $class . ' name="REX_INPUT_VALUE[' . $id . ']" rows="10">' . $value . '</textarea>';
break;
default:
$widget = '<input' . $class . ' type="' . $type . '" name="REX_INPUT_VALUE[' . $id . ']" value="' . $value . '" />';
break;
}
if ($this->hasArg('output') && $this->getArg('output')) {
$label = $this->hasArg('label') ? $this->getArg('label') : '';
$widget = Dao::getForm($widget, $label, $this->getArg('output'));
}
return self::quote($widget);
}
$output = $this->getArg('output');
if ($output == 'php') {
if ($this->environmentIs(self::ENV_BACKEND)) {
$value = rex_string::highlight($value);
} else {
return 'rex_var::nothing(require rex_stream::factory(substr(__FILE__, 6) . \'/REX_VALUE/' . $id . '\', ' . self::quote($value) . '))';
}
} elseif ($output == 'html') {
$value = str_replace(['<?', '?>'], ['<?', '?>'], $value);
} else {
$value = htmlspecialchars($value);
if (!$this->environmentIs(self::ENV_INPUT)) {
$value = nl2br($value);
}
}
return self::quote($value);
}
示例3: getOutput
//.........这里部分代码省略.........
if (tbl.tHead !== null && tbl.tHead.rows.length > 0) {
var thead_tr = tbl.tHead.rows;
redips.updateCell(type, "thead", thead_tr);
}
if (tbl.tBodies !== null && tbl.tBodies[0].rows.length > 0) {
var tbody_tr = tbl.tBodies[0].rows;
redips.updateCell(type, "tbody", tbody_tr);
}
if (tbl.tFoot !== null && tbl.tFoot.rows.length > 0) {
var tfoot_tr = tbl.tFoot.rows;
redips.updateCell(type, "tfoot", tfoot_tr);
}
}
redips.updateCell = function (type, group, rows) {
// local variable
var r, c, numberOfRows, numberOfCells, cell, cellContent;
numberOfRows = rows.length;
// loop through all TD elements
for (r = 0; r < numberOfRows; r++) {
numberOfCells = rows[r].cells.length;
// loop through all TD elements
var $cIndex = -1;
for (c = 0; c < numberOfCells; c++) {
cell = rows[r].cells[c];
$cIndex++;
if (cell.colSpan > 1) {
$cIndex = $cIndex + cell.colSpan - 1;
}
// ignore thead and tfoot
// no merge and split
if (group == "thead" || group == "tfoot") {
REDIPS.table.cell_ignore(cell);
}
if (type == "init" || type == "insert" || type == "split") {
if (cell.innerHTML == "") {
//cell.innerHTML += \'<input type="hidden" name="REX_INPUT_VALUE[\'+ id + \'][\'+ group + \'][\'+ r + \'][\'+ c + \'][colspan]" value="\' + cell.colSpan + \'" />\';
//cell.innerHTML += \'<input type="hidden" name="REX_INPUT_VALUE[\'+ id + \'][\'+ group + \'][\'+ r + \'][\'+ c + \'][rowspan]" value="\' + cell.rowSpan + \'" />\';
cell.innerHTML += \'<textarea name="REX_INPUT_VALUE[\'+ id + \'][\'+ group + \'][\'+ r + \'][\'+ $cIndex + \'][cell]"></textarea>\';
}
}
if (type == "merge" && cell.redips && cell.redips.selected === true) {
var textarea = cell.getElementsByTagName("TEXTAREA");
var j;
var content = "";
for (j = 0; j < textarea.length; j++) {
content += textarea[j].value;
}
cell.innerHTML = "";
//cell.innerHTML += \'<input title="" name="REX_INPUT_VALUE[\'+ id + \'][\'+ group + \'][\'+ r + \'][\'+ c + \'][colspan]" value="\' + cell.colSpan + \'" type="hidden" />\';
//cell.innerHTML += \'<input name="REX_INPUT_VALUE[\'+ id + \'][\'+ group + \'][\'+ r + \'][\'+ c + \'][rowspan]" value="\' + cell.rowSpan + \'" type="hidden" />\';
cell.innerHTML += \'<textarea name="REX_INPUT_VALUE[\'+ id + \'][\'+ group + \'][\'+ r + \'][\'+ $cIndex + \'][cell]">\' + content + \'</textarea>\';
REDIPS.table.mark(false, cell);
}
cellContent = cell.getElementsByTagName("TEXTAREA")[0].outerHTML;
cell.innerHTML = "";
cell.innerHTML += \'<input name="REX_INPUT_VALUE[\'+ id + \'][\'+ group + \'][\'+ r + \'][\'+ $cIndex + \'][colspan]" value="\' + cell.colSpan + \'" type="hidden" />\';
cell.innerHTML += \'<input name="REX_INPUT_VALUE[\'+ id + \'][\'+ group + \'][\'+ r + \'][\'+ $cIndex + \'][rowspan]" value="\' + cell.rowSpan + \'" type="hidden" />\';
cell.innerHTML += cellContent;
/*
// if table cell is selected
if (td[i].redips && td[i].redips.selected === true) {
// set value from selected item to the cell content
td[i].innerHTML = "text";
// unselect TD
REDIPS.table.mark(false, td[i]);
}
*/
}
}
}
// add onload event listener
if (window.addEventListener) {
window.addEventListener("load", redips.init, false);
}
else if (window.attachEvent) {
window.attachEvent("onload", redips.init);
}
$(document).on("rex:ready", function (event, container) {
redips.init();
});
//});
</script>';
$widget = $table;
if ($this->hasArg('output') && $this->getArg('output')) {
$label = $this->hasArg('label') ? $this->getArg('label') : '';
$widget = Dao::getForm($widget, $label, $this->getArg('output'));
}
return self::quote($widget);
}
return self::quote(htmlspecialchars($value));
}
示例4: getOutput
protected function getOutput()
{
$id = $this->getArg('id', 0, true);
if (!in_array($this->getContext(), ['module', 'action']) || !is_numeric($id) || $id < 1 || $id > 20) {
return false;
}
$valueArray = rex_var::toArray($this->getContextData()->getValue('value' . $id));
$value = isset($valueArray['value']) ? $valueArray['value'] : '';
$clang = isset($valueArray['clang']) ? $valueArray['clang'] : '';
$label = isset($valueArray['label']) ? $valueArray['label'] : '';
if ($this->hasArg('isset') && $this->getArg('isset')) {
return $value ? 'true' : 'false';
}
if ($this->hasArg('widget') && $this->getArg('widget')) {
if (!$this->environmentIs(self::ENV_INPUT)) {
return false;
}
$args = [];
if (!$this->hasArg('linkmap')) {
$args['linkmap'] = true;
}
if (!$this->hasArg('url')) {
$args['url'] = false;
}
if (!$this->hasArg('text')) {
$args['text'] = false;
}
foreach (['category', 'linkmap', 'url', 'text'] as $key) {
if ($this->hasArg($key)) {
$args[$key] = $this->getArg($key);
}
}
$widget = self::getWidget($id, 'REX_INPUT_VALUE[' . $id . '][value]', $valueArray, $args);
$label = $this->hasArg('label') ? $this->getArg('label') : '';
$widget = Dao::getForm($widget, $label, $this->getArg('output'));
return self::quote($widget);
} elseif ($this->hasArg('output') && $this->getArg('output')) {
if (is_numeric($value)) {
if ($label == '') {
$art = rex_article::get($value);
if ($art instanceof rex_article) {
$label = $art->getName();
}
}
$value = rex_getUrl($value, $clang);
} else {
if ($label == '') {
$label = $value;
}
}
if ($this->getArg('output') == 'link') {
$class = '';
if ($this->hasArg('class')) {
$class = ' class="' . $this->getArg('class') . '"';
}
return self::quote('<a' . $class . ' href="' . $value . '">' . $label . '</a>');
} else {
return self::quote($value);
}
}
return self::quote(json_encode($valueArray));
}
示例5: getOutput
protected function getOutput()
{
$id = $this->getArg('id', 0, true);
if (!in_array($this->getContext(), ['module', 'action']) || !is_numeric($id) || $id < 1 || $id > 20) {
return false;
}
$value = $this->getContextData()->getValue('value' . $id);
if ($this->hasArg('isset') && $this->getArg('isset')) {
return $value ? 'true' : 'false';
}
if ($this->hasArg('widget') && $this->getArg('widget')) {
if (!$this->environmentIs(self::ENV_INPUT)) {
return false;
}
$select = new rex_select();
if ($this->hasArg('multiple') && $this->getArg('options')) {
$select->setName('REX_INPUT_VALUE[' . $id . '][]');
$select->setMultiple();
$select->setSelected(rex_var::toArray($value));
} else {
$select->setName('REX_INPUT_VALUE[' . $id . ']');
$select->setSelected($value);
}
if ($this->hasArg('options') && $this->getArg('options')) {
$options = $this->getArg('options');
if (rex_sql::getQueryType($options) == 'SELECT') {
$select->addSqlOptions($options);
} else {
$groups = explode('|', $options);
if (count($groups)) {
foreach ($groups as $group) {
$parseGroup = explode(':', $group);
$groupOptions = $parseGroup[0];
if (count($parseGroup) == 2) {
$select->addOptgroup($parseGroup[0]);
$groupOptions = $parseGroup[1];
}
if (rex_sql::getQueryType($groupOptions) == 'SELECT') {
$select->addSqlOptions($groupOptions);
} else {
$groupOptions = explode(',', $groupOptions);
if (count($groupOptions)) {
foreach ($groupOptions as $groupOption) {
$optionPair = explode('=', $groupOption);
if (count($optionPair) == 1) {
$select->addOption($optionPair[0], $optionPair[0]);
} elseif (count($optionPair) == 2) {
$select->addOption($optionPair[0], $optionPair[1]);
}
}
}
}
}
}
}
}
$widget = '<div class="rex-select-style">' . $select->get() . '</div>';
if ($this->hasArg('output') && $this->getArg('output')) {
$label = $this->hasArg('label') ? $this->getArg('label') : '';
$widget = Dao::getForm($widget, $label, $this->getArg('output'));
}
return self::quote($widget);
}
return self::quote(htmlspecialchars($value));
}