本文整理匯總了PHP中FabrikHelperHTML::addToFrameWork方法的典型用法代碼示例。如果您正苦於以下問題:PHP FabrikHelperHTML::addToFrameWork方法的具體用法?PHP FabrikHelperHTML::addToFrameWork怎麽用?PHP FabrikHelperHTML::addToFrameWork使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類FabrikHelperHTML
的用法示例。
在下文中一共展示了FabrikHelperHTML::addToFrameWork方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getManagementJS
/**
* Get JS objects
*
* @param array $data list data
*
* @return void
*/
protected function getManagementJS($data = array())
{
$app = JFactory::getApplication();
$input = $app->input;
$Itemid = FabrikWorker::itemId();
$model = $this->getModel();
$params = $model->getParams();
$item = $model->getTable();
$listref = $model->getRenderContext();
$listid = $model->getId();
$formModel = $model->getFormModel();
$elementsNotInTable = $formModel->getElementsNotInTable();
$toggleCols = (bool) $params->get('toggle_cols', false);
if ($model->requiresSlimbox()) {
FabrikHelperHTML::slimbox();
}
if ($model->requiresSlideshow()) {
FabrikHelperHTML::slideshow();
}
$src = FabrikHelperHTML::framework();
$shim = array();
$dep = new stdClass();
$dep->deps = array('fab/fabrik', 'fab/listfilter', 'fab/advanced-search', 'fab/encoder');
if ($toggleCols) {
$dep->deps[] = 'fab/list-toggle';
}
$shim['fab/list'] = $dep;
$src = $model->getPluginJsClasses($src, $shim);
FabrikHelperHTML::addToFrameWork($src, 'media/com_fabrik/js/list');
$model->getCustomJsAction($src);
$tmpl = $model->getTmpl();
$this->tmpl = $tmpl;
$model->getListCss();
// Check for a custom js file and include it if it exists
$aJsPath = JPATH_SITE . '/components/com_fabrik/views/list/tmpl/' . $tmpl . '/javascript.js';
if (JFile::exists($aJsPath)) {
$src[] = 'components/com_fabrik/views/list/tmpl/' . $tmpl . '/javascript.js';
}
$origRows = $this->rows;
$this->rows = array(array());
$tmpItemid = !isset($Itemid) ? 0 : $Itemid;
$this->_row = new stdClass();
$script = array();
$params = $model->getParams();
$opts = new stdClass();
$opts->admin = $app->isAdmin();
$opts->ajax = (int) $model->isAjax();
$opts->ajax_links = (bool) $params->get('list_ajax_links', $opts->ajax);
$opts->links = array('detail' => $params->get('detailurl', ''), 'edit' => $params->get('editurl', ''), 'add' => $params->get('addurl', ''));
$opts->filterMethod = $this->filter_action;
$opts->advancedFilters = $model->getAdvancedFilterValues();
$opts->form = 'listform_' . $listref;
$this->listref = $listref;
$opts->headings = $model->jsonHeadings();
$labels = $this->headings;
foreach ($labels as &$l) {
$l = strip_tags($l);
}
$opts->labels = $labels;
$opts->primaryKey = $item->db_primary_key;
$opts->Itemid = $tmpItemid;
$opts->listRef = $listref;
$opts->formid = $model->getFormModel()->getId();
$opts->canEdit = $model->canEdit() ? "1" : "0";
$opts->canView = $model->canView() ? "1" : "0";
$opts->page = JRoute::_('index.php');
$opts->isGrouped = $this->isGrouped;
$opts->toggleCols = $toggleCols;
$opts->j3 = FabrikWorker::j3();
$opts->singleOrdering = (bool) $model->singleOrdering();
$formEls = array();
foreach ($elementsNotInTable as $tmpElement) {
$oo = new stdClass();
$oo->name = $tmpElement->name;
$oo->label = $tmpElement->label;
$formEls[] = $oo;
}
$opts->formels = $formEls;
$opts->fabrik_show_in_list = $input->get('fabrik_show_in_list', array(), 'array');
$opts->csvChoose = (bool) $params->get('csv_frontend_selection');
$opts->popup_width = $params->get('popup_width', '');
$opts->popup_height = $params->get('popup_height', '');
$xOffset = $params->get('popup_offset_x', '');
$yOffset = $params->get('popup_offset_y', '');
if ($xOffset !== '') {
$opts->popup_offset_x = (int) $xOffset;
}
if ($yOffset !== '') {
$opts->popup_offset_y = (int) $yOffset;
}
$opts->popup_edit_label = $model->editLabel();
$opts->popup_view_label = $model->viewLabel();
$opts->popup_add_label = $model->addLabel();
//.........這裏部分代碼省略.........
示例2: _addJavascript
/**
* Append the form javascript into the document head
*
* @param int $listId table id
*
* @return void|boolean
*/
protected function _addJavascript($listId)
{
$pluginManager = FabrikWorker::getPluginManager();
/** @var FabrikFEModelForm $model */
$model = $this->getModel();
$aLoadedElementPlugins = array();
$jsActions = array();
$bKey = $model->jsKey();
$srcs = FabrikHelperHTML::framework();
$shim = array();
if (!defined('_JOS_FABRIK_FORMJS_INCLUDED')) {
define('_JOS_FABRIK_FORMJS_INCLUDED', 1);
FabrikHelperHTML::slimbox();
$dep = new stdClass();
$dep->deps = array('fab/element', 'lib/form_placeholder/Form.Placeholder', 'fab/encoder');
$shim['fabrik/form'] = $dep;
$deps = new stdClass();
$deps->deps = array('fab/fabrik', 'fab/element', 'fab/form-submit');
$framework['fab/elementlist'] = $deps;
$srcs[] = 'media/com_fabrik/js/lib/form_placeholder/Form.Placeholder.js';
FabrikHelperHTML::addToFrameWork($srcs, 'media/com_fabrik/js/form');
FabrikHelperHTML::addToFrameWork($srcs, 'media/com_fabrik/js/form-submit');
FabrikHelperHTML::addToFrameWork($srcs, 'media/com_fabrik/js/element');
}
$aWYSIWYGNames = array();
// $$$ hugh - yet another one where if we =, the $groups array pointer get buggered up and it
// skips a group
$groups = $model->getGroupsHiarachy();
foreach ($groups as $groupModel) {
$elementModels = $groupModel->getPublishedElements();
foreach ($elementModels as $elementModel) {
$res = $elementModel->useEditor();
if ($res !== false && $elementModel->canUse() && $model->isEditable()) {
$aWYSIWYGNames[] = $res;
}
// Load in once the element js class files
$element = $elementModel->getElement();
if (!in_array($element->plugin, $aLoadedElementPlugins)) {
/* $$$ hugh - certain elements, like file-upload, need to load different JS files
* on a per-element basis, so as a test fix, I modified the file-upload's formJavaScriptClass to return false,
* 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) {
//.........這裏部分代碼省略.........