本文整理匯總了PHP中FabrikHelperHTML::tipOpts方法的典型用法代碼示例。如果您正苦於以下問題:PHP FabrikHelperHTML::tipOpts方法的具體用法?PHP FabrikHelperHTML::tipOpts怎麽用?PHP FabrikHelperHTML::tipOpts使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類FabrikHelperHTML
的用法示例。
在下文中一共展示了FabrikHelperHTML::tipOpts方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: _addJavascript
//.........這裏部分代碼省略.........
* and test for that here, so as to not add it to aLoadedElementPlugins[]. The existing 'static' tests in
* formJavascriptClass() should still prevent scripts being added twice.
*/
if ($elementModel->formJavascriptClass($srcs, '', $shim) !== false) {
$aLoadedElementPlugins[] = $element->plugin;
}
}
$eventMax = $groupModel->repeatTotal == 0 ? 1 : $groupModel->repeatTotal;
for ($c = 0; $c < $eventMax; $c++) {
$jsAct = $elementModel->getFormattedJSActions($bKey, $c);
if (!empty($jsAct)) {
$jsActions[] = $jsAct;
}
}
}
}
FabrikHelperHTML::iniRequireJS($shim);
$actions = trim(implode("\n", $jsActions));
FabrikHelperHTML::windows('a.fabrikWin');
FabrikHelperHTML::tips('.hasTip', array(), "\$('{$bKey}')");
$model->getFormCss();
$opts = $this->jsOpts();
$model->jsOpts = $opts;
$pluginManager->runPlugins('onJSOpts', $model);
$opts = json_encode($model->jsOpts);
if (!FabrikHelperHTML::inAjaxLoadedPage()) {
JText::script('COM_FABRIK_VALIDATING');
JText::script('COM_FABRIK_SUCCESS');
JText::script('COM_FABRIK_NO_REPEAT_GROUP_DATA');
JText::script('COM_FABRIK_VALIDATION_ERROR');
JText::script('COM_FABRIK_CONFIRM_DELETE_1');
}
JText::script('COM_FABRIK_FORM_SAVED');
// $$$ rob don't declare as var $bKey, but rather assign to window, as if loaded via ajax window the function is wrapped
// inside an anonymous function, and therefore $bKey wont be available as a global var in window
$script = array();
$script[] = "\t\tvar {$bKey} = Fabrik.form('{$bKey}', " . $model->getId() . ", {$opts});";
// Instantiate js objects for each element
$vstr = "\n";
$groups = $model->getGroupsHiarachy();
$script[] = "\tFabrik.blocks['{$bKey}'].addElements(";
$groupedJs = new stdClass();
foreach ($groups as $groupModel) {
$groupId = $groupModel->getGroup()->id;
$groupedJs->{$groupId} = array();
if (!$groupModel->canView('form')) {
continue;
}
$elementJs = 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;
foreach ($elementModels as $elementModel) {
$element = $elementModel->getElement();
if ($element->published == 0) {
continue;
}
// If the view is a form then we should always add the js as long as the element is editable or viewable
// if the view is details then we should only add the js if the element is viewable.
if ($elementModel->canUse() && $model->isEditable() || $elementModel->canView()) {
for ($c = 0; $c < $max; $c++) {
$ref = $elementModel->elementJavascript($c);
if (!empty($ref)) {
$elementJs[] = $ref;
}
$validations = $elementModel->validator->findAll();
if (!empty($validations) && $elementModel->isEditable()) {
$watchElements = $elementModel->getValidationWatchElements($c);
foreach ($watchElements as $watchElement) {
$vstr .= "\tFabrik.blocks['{$bKey}'].watchValidation('" . $watchElement['id'] . "', '" . $watchElement['triggerEvent'] . "');\n";
}
}
}
}
}
$groupedJs->{$groupId} = $elementJs;
}
$script[] = json_encode($groupedJs);
$script[] = "\t);";
$script[] = $actions;
$script[] = $vstr;
// Placeholder
$script[] = "\tnew Form.Placeholder('.fabrikForm input');";
$this->_addJavascriptSumbit($script, $listId, $aWYSIWYGNames);
if (FabrikHelperHTML::inAjaxLoadedPage()) {
$tipOpts = FabrikHelperHTML::tipOpts();
$script[] = "new FloatingTips('#" . $bKey . " .fabrikTip', " . json_encode($tipOpts) . ");";
}
$res = $pluginManager->runPlugins('onJSReady', $model);
if (in_array(false, $res)) {
return false;
}
$str = implode("\n", $script);
$model->getCustomJsAction($srcs);
$pluginManager->runPlugins('onAfterJSLoad', $model);
// 3.1 call form js plugin code within main require method
$srcs = array_merge($srcs, $model->formPluginShim);
$str .= $model->formPluginJS;
FabrikHelperHTML::script($srcs, $str);
}
示例2: _addJavascript
//.........這裏部分代碼省略.........
$opts = json_encode($opts);
if (!FabrikHelperHTML::inAjaxLoadedPage()) {
JText::script('COM_FABRIK_VALIDATING');
JText::script('COM_FABRIK_SUCCESS');
JText::script('COM_FABRIK_NO_REPEAT_GROUP_DATA');
JText::script('COM_FABRIK_VALIDATION_ERROR');
JText::script('COM_FABRIK_FORM_SAVED');
Jtext::script('COM_FABRIK_CONFIRM_DELETE');
}
// $$$ 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
$script = array();
$script[] = "window.{$bkey} = new FbForm(" . $model->getId() . ", {$opts});";
$script[] = "if(typeOf(Fabrik) !== 'null') {";
$script[] = "Fabrik.addBlock('{$bkey}', {$bkey});";
$script[] = "}";
// Instantaite js objects for each element
$vstr = "\n";
$groups = $model->getGroupsHiarachy();
$script[] = "{$bkey}.addElements({";
$gs = array();
foreach ($groups as $groupModel) {
$showGroup = $groupModel->getParams()->get('repeat_group_show_first');
if ($showGroup == -1 || $showGroup == 2 && $model->isEditable()) {
// $$$ 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;
foreach ($elementModels as $elementModel) {
$element = $elementModel->getElement();
if ($element->published == 0) {
continue;
}
$fullName = $elementModel->getFullName();
$id = $elementModel->getHTMLId();
$elementModel->setEditable($model->isEditable());
// If the view is a form then we should always add the js as long as the element is editable or viewable
// if the view is details then we should only add hte js if the element is viewable.
if ($elementModel->canUse() && $model->isEditable() || $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->isEditable()) {
$watchElements = $elementModel->getValidationWatchElements($c);
foreach ($watchElements as $watchElement) {
$vstr .= "{$bkey}.watchValidation('" . $watchElement['id'] . "', '" . $watchElement['triggerEvent'] . "');\n";
}
}
}
}
}
$gs[] = $groupModel->getGroup()->id . ':[' . implode(",\n", $aObjs) . ']';
}
$script[] = implode(", ", $gs);
$script[] = '});';
$script[] = $actions;
$script[] = $vstr;
// Placholder test
$script[] = "new Form.Placeholder('.fabrikForm input');";
$script[] = "function submit_form() {";
if (!empty($aWYSIWYGNames)) {
jimport('joomla.html.editor');
$editor = JFactory::getEditor();
$script[] = $editor->save('label');
foreach ($aWYSIWYGNames as $parsedName) {
$script[] = $editor->save($parsedName);
}
}
$script[] = "\treturn false;";
$script[] = "}";
$script[] = "function submitbutton(button) {";
$script[] = "\tif (button==\"cancel\") {";
$script[] = "\t\tdocument.location = '" . JRoute::_('index.php?option=com_fabrik&task=viewTable&cid=' . $tableId) . "';";
$script[] = "\t}";
$script[] = "\tif (button == \"cancelShowForm\") {";
$script[] = "\t\treturn false;";
$script[] = "\t}";
$script[] = "}";
if (FabrikHelperHTML::inAjaxLoadedPage()) {
$tipOpts = FabrikHelperHTML::tipOpts();
$script[] = "new FloatingTips('#" . $bkey . " .fabrikTip', " . json_encode($tipOpts) . ");";
}
$pluginManager = FabrikWorker::getPluginManager();
$res = $pluginManager->runPlugins('onJSReady', $model);
if (in_array(false, $res)) {
return false;
}
$str = implode("\n", $script);
$model->getCustomJsAction($srcs);
$srcs[] = 'media/com_fabrik/js/encoder.js';
FabrikHelperHTML::script($srcs, $str);
$pluginManager->runPlugins('onAfterJSLoad', $model);
}