本文整理匯總了PHP中FabrikHelperHTML::getEditor方法的典型用法代碼示例。如果您正苦於以下問題:PHP FabrikHelperHTML::getEditor方法的具體用法?PHP FabrikHelperHTML::getEditor怎麽用?PHP FabrikHelperHTML::getEditor使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類FabrikHelperHTML
的用法示例。
在下文中一共展示了FabrikHelperHTML::getEditor方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: edit
/**
* Display the form to add or edit a table
* @param object table
* @param array the drop down lists used on the form
* @param array connection tables
* @param object menus
* @param string compoent action
* @param int form id that the table links to?
* @param object parameters
* @param object plugin mangager
* @param object table model
*/
function edit($row, $lists, $connectionTables, $menus, $fabrikid, $params, $pluginManager, $model, $form)
{
JHTML::stylesheet('fabrikadmin.css', 'administrator/components/com_fabrik/views/');
FabrikViewTable::setTableToolbar();
JRequest::setVar('hidemainmenu', 1);
$document =& JFactory::getDocument();
FabrikHelperHTML::script('namespace.js', 'administrator/components/com_fabrik/views/', true);
FabrikHelperHTML::script('pluginmanager.js', 'administrator/components/com_fabrik/views/', true);
FabrikHelperHTML::script('admintable.js', 'administrator/components/com_fabrik/views/', true);
JFilterOutput::objectHTMLSafe($row);
jimport('joomla.html.editor');
//just until joomla uses mootools 1.2
FabrikHelperHTML::mootools();
require_once COM_FABRIK_FRONTEND . DS . 'helpers' . DS . 'editor.php';
jimport('joomla.html.pane');
FabrikHelperHTML::tips();
$editor =& FabrikHelperHTML::getEditor();
$pane =& JPane::getInstance();
$fbConfig =& JComponentHelper::getParams('com_fabrik');
$opts = new stdClass();
$opts->mooversion = FabrikWorker::getMooVersion() == 1 ? 1.2 : 1.1;
$opts = FastJSON::encode($opts);
$lang = new stdClass();
$lang->action = JText::_('ACTION');
$lang->do = JText::_('DO');
$lang->del = JText::_('DELETE');
$lang->in = JText::_('IN');
$lang->on = JText::_('ON');
$lang->options = JText::_('OPTIONS');
$lang->please_select = JText::_('COM_FABRIK_PLEASE_SELECT');
$lang = FastJSON::encode($lang);
$js = "window.addEvent('domready', function() {\n \t\tvar aPlugins = [];\n";
$js .= $pluginManager->getAdminPluginJs('table', $row, $lists);
$js .= "controller = new TablePluginManager(aPlugins, {$lang}, {$opts});\n";
$usedPlugins = $params->get('plugin', '', '_default', 'array');
$js .= $pluginManager->getAdminSelectedPluginJS('table', $row, $lists, $params);
$js .= "});\n";
$js .= "var connectiontables = new Array;\n";
$i = 0;
if (is_array($connectionTables)) {
foreach ($connectionTables as $k => $items) {
foreach ($items as $v) {
$js .= "connectiontables[" . $i++ . "] = new Array('{$k}','" . addslashes($v->value) . "','" . addslashes($v->text) . "');\n\t\t";
}
}
}
$js .= "\n\t\t\tfunction submitbutton(pressbutton) {\n\t\t\t\tif (pressbutton == 'cancel') {\n\t\t\t\t\tsubmitform( pressbutton);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tvar err = '';";
$js .= $editor->save('introduction');
$js .= "if(\$('label').value == '') {\n\t\t\t\t\terr = err +'" . JText::_('PLEASE ENTER A TABLE LABEL', true) . '\\n' . "';\n\t\t\t\t}\n\n\t\t\t\tif(\$('database_name')) {\n\t\t\t\t\tif(\$('database_name').value == '') {\n\t\t\t\t\t\tif(\$('connection_id')) {\n\t\t\t\t\t\t\tif(\$('connection_id').value == '-1') {\n\t\t\t\t\t\t\t\terr = err +'" . JText::_('PLEASE SELECT A CONNECTION', true) . '\\n' . "';\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif(\$('tablename')) {\n\t\t\t\t\t\t\tif(\$('tablename').value == '' || \$('tablename').value == '-1') {\n\t\t\t\t\t\t\t\terr = err + '" . JText::_('PLEASE SELECT A DATABASE TABLE', true) . '\\n' . "';\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (err == '') {\n\t\t\t\t\tsubmitform( pressbutton);\n\t\t\t\t}else{\n\t\t\t\t\talert (err);\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t\tvar joinCounter = 0;";
$document->addScriptDeclaration($js);
FabrikHelperHTML::cleanMootools();
?>
<form action="index.php" method="post" name="adminForm">
<table style="width: 100%">
<tr>
<td style="width: 50%" valign="top">
<fieldset class="adminform"><legend><?php
echo JText::_('DETAILS');
?>
</legend>
<table class="admintable">
<tr>
<td class="key"><label for="label"><?php
echo JText::_('LABEL');
?>
</label></td>
<td><input class="inputbox" type="text" id="label" name="label"
size="50" value="<?php
echo $row->label;
?>
" /></td>
</tr>
<tr>
<td class="key"><?php
echo JText::_('INTRODUCTION');
?>
</td>
<td><?php
echo $editor->display('introduction', $row->introduction, '100%', '200', '45', '25', false);
?>
</td>
</tr>
</table>
</fieldset>
<fieldset><legend><?php
echo JText::_('FILTERS');
?>
//.........這裏部分代碼省略.........
示例2: _addJavascript
//.........這裏部分代碼省略.........
}
}
$opts = json_encode($opts);
$lang = new stdClass();
$lang->validation_altered_content = JText::_('VALIDATION_HAS_ALTERED_CONTENT');
$lang->validating = JText::_('VALIDATING');
$lang->success = JText::_('SUCCESS');
$lang->nodata = JText::_('NOREPEATGROUPDATA');
$lang->validation_error = JText::_('VALIDATION_ERROR');
$lang->form_saved = JText::_('FORM_SAVED');
$lang->confirmDelete = JText::_('CONFIRMDELETE');
$lang = json_encode($lang);
//$$$ rob dont declare as var $bkey, but rather assign to window, as if loaded via ajax window the function is wrapped
// inside an anoymous function, and therefore $bkey wont be available as a global var in window
$str = "window.{$bkey} = new fabrikForm(" . $model->getId() . ", {$opts}, {$lang});\n";
$str .= "{$bkey}.addListenTo('table_" . $tableModel->getId() . "');\n";
$str .= "{$bkey}.addListenTo('form_" . $model->getId() . "');\n";
$str .= "if(\$type(window.oPackage) !== false) {\n";
$str .= "oPackage.addBlock('{$bkey}', {$bkey});\n";
$str .= "}\n";
//instantaite js objects for each element
$groupstr = '';
$vstr = "\n";
$str .= "{$startJs}";
// $$$ rob in php5.2.6 (and possibly elsewhere) $groups's elements havent been updated
// to contain the default value used by the element
//foreach ($groups as $groupModel) {
//testing this one again as Ive updated getGroupsHiarchy
$str .= "{$bkey}.addElements({";
foreach ($groups as $groupModel) {
$showGroup = $groupModel->getParams()->get('repeat_group_show_first');
if ($showGroup == -1 || $showGroup == 2 && $model->_editable) {
// $$$ rob unpublished group so dont include the element js
continue;
}
$aObjs = array();
$elementModels =& $groupModel->getPublishedElements();
// $$$ rob if _repeatTotal is 0 we still want to add the js objects as the els are only hidden
$max = $groupModel->_repeatTotal > 0 ? $groupModel->_repeatTotal : 1;
$str .= $groupModel->getGroup()->id . ":[";
foreach ($elementModels as $elementModel) {
$element =& $elementModel->getElement();
if ($element->state == 0) {
continue;
}
$fullName = $elementModel->getFullName();
$id = $elementModel->getHTMLId();
$elementModel->_editable = $model->_editable;
if ($elementModel->canUse() || $elementModel->canView()) {
for ($c = 0; $c < $max; $c++) {
// $$$ rob ensure that some js code has been returned otherwise dont add empty data to array
$ref = trim($elementModel->elementJavascript($c));
if ($ref !== '') {
$aObjs[] = $ref;
}
$validations =& $elementModel->getValidations();
if (!empty($validations) && $elementModel->_editable) {
$watchElements = $elementModel->getValidationWatchElements($c);
foreach ($watchElements as $watchElement) {
$vstr .= "{$bkey}.watchValidation('" . $watchElement['id'] . "', '" . $watchElement['triggerEvent'] . "');\n";
}
}
}
}
}
$str .= implode(",\n", $aObjs);
$str .= "],";
$groupParams =& $groupModel->getParams();
$addJs = str_replace('"', "'", $groupParams->get('repeat_group_js_add'));
$addJs = str_replace(array("\n", "\r"), "", $addJs);
$delJs = str_replace('"', "'", $groupParams->get('repeat_group_js_delete'));
$gdelJs = str_replace(array("\n", "\r"), "", $delJs);
if ($delJs !== '') {
$groupstr .= "{$bkey}.addGroupJS(" . $groupModel->getId() . ", 'delete', \"{$delJs}\");\n";
}
if ($addJs !== '') {
$groupstr .= "{$bkey}.addGroupJS(" . $groupModel->getId() . ", 'add', \"{$addJs}\");\n";
}
}
$str = FabrikString::rtrimword($str, ',');
$str .= "});\n";
$str .= $groupstr;
$str .= $actions;
$str .= $vstr;
$str .= $endJs;
$str .= "function submit_form() {";
if (!empty($aWYSIWYGNames)) {
jimport('joomla.html.editor');
$editor =& FabrikHelperHTML::getEditor();
$str .= $editor->save('label');
foreach ($aWYSIWYGNames as $parsedName) {
$str .= $editor->save($parsedName);
}
}
$str .= "\n\t\t\treturn false;\n\t\t}\n\n\t\tfunction submitbutton(button) {\n\t\t\tif (button==\"cancel\") {\n\t\t\t\tdocument.location = '" . JRoute::_('index.php?option=com_fabrik&task=viewTable&cid=' . $tableId) . "';\n\t\t\t}\n\t\t\tif (button == \"cancelShowForm\") {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n";
FabrikHelperHTML::addScriptDeclaration($str);
$pluginManager =& $model->getPluginManager();
$pluginManager->runPlugins('onAfterJSLoad', $model);
FabrikHelperHTML::mootools();
}
示例3: edit
function edit($row, $pluginManager, $lists, $params, $form)
{
JFilterOutput::objectHTMLSafe($row, ENT_QUOTES, '');
FabrikViewElement::setElementToolbar();
FabrikViewElement::editJs($row, $pluginManager, $lists, $params);
jimport('joomla.html.pane');
$pane =& JPane::getInstance();
$fbConfig =& JComponentHelper::getParams('com_fabrik');
JHTML::stylesheet('fabrikadmin.css', 'administrator/components/com_fabrik/views/');
JRequest::setVar('hidemainmenu', 1);
$document =& JFactory::getDocument();
if ($fbConfig->get('fbConf_wysiwyg_label', false)) {
$editor =& FabrikHelperHTML::getEditor();
}
?>
<form action="index.php" method="post" name="adminForm" >
<?php
if ($row->parent_id != 0) {
?>
<div id="system-message">
<dl>
<dd class="notice">
<ul>
<li>
<?php
echo JText::_('THIS ELEMENTS PROPERTIES ARE LINKED TO');
?>
:
</li>
<li>
<a href="#" id="swapToParent" class="element_<?php
echo $lists['parent']->id;
?>
"><?php
echo $lists['parent']->label;
?>
</a>
</li>
<li>
<label><input id="unlink" name="unlink" id="unlinkFromParent" type="checkbox"> <?php
echo JText::_('UNLINK');
?>
</label>
</li>
</ul>
</dd>
</dl>
</div>
<?php
}
echo JHTML::_('form.token');
?>
<input type="hidden" name="id" value="<?php
echo (int) $row->id;
?>
" />
<table style="width:100%" id="elementFormTable" >
<tbody>
<tr>
<td style="width:50%" valign="top">
<?php
FabrikViewElement::editLeft($row, $lists, $params, $form, $fbConfig);
FabrikViewElement::editPluginOptions($pluginManager, $lists, $row);
?>
</td>
<td style="width:50%" valign="top">
<?php
echo $pane->startPane("content-pane");
echo $pane->startPanel(JText::_('PUBLISHING'), "publish-page");
FabrikViewElement::editPublishing($form);
echo $pane->endPanel();
echo $pane->startPanel(JText::_('TABLE SETTINGS'), "table-page");
FabrikViewElement::editTableSettings($form);
echo $pane->endPanel();
echo $pane->startPanel(JText::_('VALIDATIONS'), "validations-page");
FabrikViewElement::editValidations($form);
echo $pane->endPanel();
echo $pane->startPanel(JText::_('JAVASCRIPT'), "javascript-page");
FabrikViewElement::editJavascript($form);
echo $pane->endPanel();
echo $pane->endPane();
?>
</td>
</tr>
</tbody>
</table>
<input type="hidden" name="task" value="save" />
<input type="hidden" name="option" value="com_fabrik" />
<input type="hidden" name="c" value="element" />
<input type="hidden" name="boxchecked" value="" />
<input type="hidden" name="redirectto" value="" />
</form>
<?php
echo JHTML::_('behavior.keepalive');
FabrikHelperHTML::cleanMootools();
}
示例4: getEditorArea
/**
* hack to get the editior code without it being written out to the page straight away
* think this returns a simple text field
*/
function getEditorArea($name, $content, $hiddenField, $width, $height, $col, $row)
{
$editor =& FabrikHelperHTML::getEditor();
return $editor->display($name, $content, $width, $height, $col, $row, false);
}