本文整理匯總了PHP中FabrikHelperHTML::slimbox方法的典型用法代碼示例。如果您正苦於以下問題:PHP FabrikHelperHTML::slimbox方法的具體用法?PHP FabrikHelperHTML::slimbox怎麽用?PHP FabrikHelperHTML::slimbox使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類FabrikHelperHTML
的用法示例。
在下文中一共展示了FabrikHelperHTML::slimbox方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: display
/**
* Execute and display a template script.
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return mixed A string if successful, otherwise a JError object.
*/
public function display($tpl = 'default')
{
$app = JFactory::getApplication();
$input = $app->input;
$j3 = FabrikWorker::j3();
$srcs = FabrikHelperHTML::framework();
$model = $this->getModel();
$usersConfig = JComponentHelper::getParams('com_fabrik');
$model->setId($input->getInt('id', $usersConfig->get('visualizationid', $input->getInt('visualizationid', 0))));
$this->row = $model->getVisualization();
if (!$model->canView()) {
echo FText::_('JERROR_ALERTNOAUTHOR');
return false;
}
$this->js = $this->get('JS');
$viewName = $this->getName();
$params = $model->getParams();
$this->params = $params;
$pluginManager = JModelLegacy::getInstance('Pluginmanager', 'FabrikFEModel');
$plugin = $pluginManager->getPlugIn('slideshow', 'visualization');
$this->showFilters = $model->showFilters();
$this->filters = $this->get('Filters');
$this->filterFormURL = $this->get('FilterFormURL');
$this->params = $model->getParams();
$this->containerId = $this->get('ContainerId');
$srcs['FbListFilter'] = 'media/com_fabrik/js/listfilter.js';
if ($this->get('RequiredFiltersFound')) {
$srcs['Slideshow2'] = 'components/com_fabrik/libs/slideshow2/js/slideshow.js';
$mode = $params->get('slideshow_viz_type', 1);
switch ($mode) {
case 1:
break;
case 2:
$srcs['Kenburns'] = 'components/com_fabrik/libs/slideshow2/js/slideshow.kenburns.js';
break;
case 3:
$srcs['Push'] = 'components/com_fabrik/libs/slideshow2/js/slideshow.push.js';
break;
case 4:
$srcs['Fold'] = 'components/com_fabrik/libs/slideshow2/js/slideshow.fold.js';
break;
default:
break;
}
JHTML::stylesheet('components/com_fabrik/libs/slideshow2/css/slideshow.css');
$srcs['SlideShow'] = 'plugins/fabrik_visualization/slideshow/slideshow.js';
}
FabrikHelperHTML::slimbox();
FabrikHelperHTML::iniRequireJs($model->getShim());
FabrikHelperHTML::script($srcs, $this->js);
//FabrikHelperHTML::slimbox();
$tpl = $j3 ? 'bootstrap' : 'default';
$tpl = $params->get('slideshow_viz_layout', $tpl);
$tmplpath = $model->pathBase . 'slideshow/views/slideshow/tmpl/' . $tpl;
$this->_setPath('template', $tmplpath);
FabrikHelperHTML::stylesheetFromPath('plugins/fabrik_visualization/slideshow/views/slideshow/tmpl/' . $tpl . '/template.css');
FabrikHelperHTML::stylesheetFromPath('plugins/fabrik_visualization/slideshow/views/slideshow/tmpl/' . $tpl . '/custom.css');
echo parent::display();
}
示例2: display
/**
* Execute and display a template script.
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return mixed A string if successful, otherwise a JError object.
*/
public function display($tpl = 'default')
{
$app = JFactory::getApplication();
$input = $app->input;
$model = $this->getModel();
$usersConfig = JComponentHelper::getParams('com_fabrik');
$id = $input->get('id', $usersConfig->get('visualizationid', $input->get('visualizationid', 0)));
$model->setId($id);
$this->row = $model->getVisualization();
if (!$model->canView()) {
echo FText::_('JERROR_ALERTNOAUTHOR');
return false;
}
$params = $model->getParams();
$this->events = $model->setUpEvents();
$this->params = $params;
$this->containerId = $model->getJSRenderContext();
$this->filters = $this->get('Filters');
$this->showFilters = $model->showFilters();
$this->showTitle = $input->getInt('show-title', 1);
$this->filterFormURL = $this->get('FilterFormURL');
$this->canAdd = (bool) $params->get('fullcalendar-read-only', 0) == 1 ? false : $model->getCanAdd();
$this->requiredFiltersFound = $this->get('RequiredFiltersFound');
if ($params->get('fullcalendar_show_messages', '1') == '1' && $this->canAdd && $this->requiredFiltersFound) {
$msg = FText::_('PLG_VISUALIZATION_FULLCALENDAR_DOUBLE_CLICK_TO_ADD');
$msg .= $model->getDateLimitsMsg();
$app->enqueueMessage($msg);
}
$this->jLayouts();
$this->jsText();
$this->iniJs();
FabrikHelperHTML::slimbox();
$this->params = $model->getParams();
$tpl = $params->get('calendar_layout', $tpl);
$tmplPath = JPATH_ROOT . '/plugins/fabrik_visualization/fullcalendar/views/fullcalendar/tmpl/' . $tpl;
$this->_setPath('template', $tmplPath);
$this->css($tpl);
return parent::display();
}
示例3: elementJavascript
/**
* Returns javascript which creates an instance of the class defined in formJavascriptClass()
*
* @param int $repeatCounter Repeat group counter
*
* @return array
*/
public function elementJavascript($repeatCounter)
{
$listModel = $this->getlistModel();
$params = $this->getParams();
$target = $params->get('link_target', '');
$smart_link = $params->get('link_smart_link', false);
if ($listModel->getOutPutFormat() != 'rss' && ($smart_link || $target == 'mediabox')) {
FabrikHelperHTML::slimbox();
}
$id = $this->getHTMLId($repeatCounter);
$opts = $this->getElementJSOptions($repeatCounter);
return array('FbLink', $id, $opts);
}
示例4: getManagementJS
protected function getManagementJS($data = array())
{
global $Itemid;
// $$$ rob ALWAYS load the calendar (so its avaible in ajax forms)
FabrikHelperHTML::loadcalendar();
$app =& JFactory::getApplication();
$model =& $this->getModel();
$table =& $model->getTable();
$formModel =& $model->getForm();
$elementsNotInTable =& $formModel->getElementsNotInTable();
$keys = array('id' => '', 'name' => '', 'label' => '');
foreach ($elementsNotInTable as &$i) {
if (is_a($i, 'TableElement')) {
$i = array_intersect_key($i->getPublicProperties(), $keys);
}
}
FabrikHelperHTML::packageJS();
$document =& JFactory::getDocument();
if ($model->requiresSlimbox()) {
FabrikHelperHTML::slimbox();
}
if ($model->requiresMocha()) {
FabrikHelperHTML::mocha();
}
FabrikHelperHTML::script('table.js', 'media/com_fabrik/js/', true);
$tmpl = $this->getTmpl();
FabrikHelperHTML::stylesheet('table.css', 'media/com_fabrik/css/');
// check for a custom css file and include it if it exists
FabrikHelperHTML::stylesheetFromPath("components" . DS . "com_fabrik" . DS . "views" . DS . "table" . DS . "tmpl" . DS . $tmpl . DS . "template.css");
//check and add a general fabrik custom css file overrides template css and generic table css
FabrikHelperHTML::stylesheetFromPath("media" . DS . "com_fabrik" . DS . "css" . DS . "custom.css");
//check and add a specific table template css file overrides template css generic table css and generic custom css
FabrikHelperHTML::stylesheetFromPath("components" . DS . "com_fabrik" . DS . "views" . DS . "table" . DS . "tmpl" . DS . $tmpl . DS . "custom.css");
// check for a custom js file and include it if it exists
$aJsPath = JPATH_SITE . DS . "components" . DS . "com_fabrik" . DS . "views" . DS . "table" . DS . "tmpl" . DS . $tmpl . DS . "javascript.js";
if (JFile::exists($aJsPath)) {
FabrikHelperHTML::script("javascript.js", 'components/com_fabrik/views/table/tmpl/' . $tmpl . '/', true);
}
$origRows = $this->rows;
$this->rows = array(array());
$tmpItemid = !isset($Itemid) ? 0 : $Itemid;
$this->_c = 0;
$this->_row = new stdClass();
$script = '';
// $$$ rob done in HTMLHelper
//$script = "/* <![CDATA[ */ \n";
static $tableini;
if (!$tableini) {
$tableini = true;
$script .= "var oTables = \$H();\n";
}
$opts = new stdClass();
$opts->admin = $app->isAdmin();
$opts->postMethod = $model->getPostMethod();
$opts->filterMethod = $this->filter_action;
$opts->form = 'tableform_' . $model->_id;
$opts->headings = $model->_jsonHeadings();
$labels = $this->headings;
foreach ($labels as &$l) {
$l = strip_tags($l);
}
$opts->labels = $labels;
$opts->primaryKey = $table->db_primary_key;
$opts->Itemid = $tmpItemid;
$opts->formid = $model->_oForm->getId();
$opts->canEdit = $model->canEdit() ? "1" : "0";
$opts->canView = $model->canView() ? "1" : "0";
$opts->page = JRoute::_('index.php');
$opts->isGrouped = $this->isGrouped;
$opts->mooversion = FabrikWorker::getMooVersion() == 1 ? 1.2 : 1.1;
if (FabrikWorker::nativeMootools12()) {
$opts->mooversion = 1.24;
}
$opts->formels = $elementsNotInTable;
//if table data starts as empty then we need the html from the row
// template otherwise we can't add a row to the table
if ($model->_postMethod == 'ajax') {
ob_start();
$this->_row = new stdClass();
$this->_row->id = '';
$this->_row->class = 'fabrik_row';
require COM_FABRIK_FRONTEND . DS . 'views' . DS . 'table' . DS . 'tmpl' . DS . 'default' . DS . 'default_row.php';
$opts->rowtemplate = ob_get_contents();
ob_end_clean();
}
//$$$rob if you are loading a table in a window from a form db join select record option
// then we want to know the id of the window so we can set its showSpinner() method
$opts->winid = JRequest::getVar('winid', '');
$opts->ajaxEditViewLink = $model->ajaxEditViewLink() ? 1 : 0;
$opts = json_encode($opts);
$lang = new stdClass();
$lang->select_rows = JText::_('SELECT SOME ROWS FOR DELETION');
$lang->yes = JText::_('Yes');
$lang->no = JText::_('No');
$lang->select_colums_to_export = JText::_('SELECT_COLUMNS_TO_EXPORT');
$lang->include_filters = JText::_('INCLUDE_FILTERS');
$lang->include_data = JText::_('INCLUDE_DATA');
$lang->inlcude_raw_data = JText::_('INCLUDE_RAW_DATA');
$lang->include_calculations = JText::_('INLCUDE_CALCULATIONS');
$lang->export = JText::_('EXPORT');
//.........這裏部分代碼省略.........
示例5: getManagementJS
protected function getManagementJS($data = array())
{
$app = JFactory::getApplication();
$menuItem = $app->getMenu('site')->getActive();
$Itemid = is_object($menuItem) ? $menuItem->id : 0;
$model = $this->getModel();
$item = $model->getTable();
$listref = $model->getRenderContext();
$listid = $model->getId();
$formModel = $model->getFormModel();
$elementsNotInTable = $formModel->getElementsNotInTable();
if ($model->requiresSlimbox()) {
FabrikHelperHTML::slimbox();
}
$src = $this->get('PluginJsClasses');
array_unshift($src, 'media/com_fabrik/js/list.js');
array_unshift($src, 'media/com_fabrik/js/advanced-search.js');
FabrikHelperHTML::script($src);
$tmpl = $this->get('tmpl');
$this->assign('tmpl', $tmpl);
$this->get('ListCss');
// check for a custom js file and include it if it exists
$aJsPath = JPATH_SITE . DS . "components" . DS . "com_fabrik" . DS . "views" . DS . "list" . DS . "tmpl" . DS . $tmpl . DS . "javascript.js";
if (JFile::exists($aJsPath)) {
FabrikHelperHTML::script('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();
$script[] = "head.ready(function() {";
$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->form = 'listform_' . $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->formels = $elementsNotInTable;
$opts->actionMethod = $params->get('actionMethod');
$opts->floatPos = $params->get('floatPos');
$opts->csvChoose = (bool) $params->get('csv_frontend_selection');
$popUpWidth = $params->get('popup_width', '');
if ($popUpWidth !== '') {
$opts->popup_width = (int) $popUpWidth;
}
$popUpHeight = $params->get('popup_height', '');
if ($popUpHeight !== '') {
$opts->popup_height = (int) $popUpHeight;
}
$xOffset = $params->get('popup_offset_x', '');
if ($xOffset !== '') {
$opts->popup_offset_x = (int) $xOffset;
}
$yOffset = $params->get('popup_offset_y', '');
if ($yOffset !== '') {
$opts->popup_offset_y = (int) $yOffset;
}
$opts->popup_edit_label = $params->get('editlabel', JText::_('COM_FABRIK_EDIT'));
$opts->popup_view_label = $params->get('detaillabel', JText::_('COM_FABRIK_VIEW'));
$opts->popup_add_label = $params->get('addlabel', JText::_('COM_FABRIK_ADD'));
$opts->limitLength = $model->limitLength;
$opts->limitStart = $model->limitStart;
$csvOpts = new stdClass();
$csvOpts->excel = (int) $params->get('csv_format');
$csvOpts->inctabledata = (int) $params->get('csv_include_data');
$csvOpts->incraw = (int) $params->get('csv_include_raw_data');
$csvOpts->inccalcs = (int) $params->get('csv_include_calculations');
$opts->csvOpts = $csvOpts;
$opts->csvFields = $this->get('CsvFields');
$csvOpts->incfilters = (int) $params->get('incfilters');
$opts->data = $data;
//if table data starts as empty then we need the html from the row
// template otherwise we can't add a row to the table
ob_start();
$this->_row = new stdClass();
$this->_row->id = '';
$this->_row->class = 'fabrik_row';
/* if (JFile::exists(COM_FABRIK_FRONTEND . '/views/list/tmpl/' . $tmpl . '/default_row.php')) {
require(COM_FABRIK_FRONTEND . '/views/list/tmpl/' . $tmpl . '/default_row.php');
} */
echo $this->loadTemplate('row');
$opts->rowtemplate = ob_get_contents();
ob_end_clean();
//.........這裏部分代碼省略.........
示例6: elementJavascript
/**
* return the javascript to create an instance of the class defined in formJavascriptClass
* @return string javascript to create instance. Instance name must be 'el'
*/
function elementJavascript($repeatCounter)
{
$tableModel =& $this->getTableModel();
$params =& $this->getParams();
$target = $params->get('link_target', '');
$smart_link = $params->get('link_smart_link', false);
if ($tableModel->_outPutFormat != 'rss' && ($smart_link || $target == 'mediabox')) {
FabrikHelperHTML::slimbox();
}
$id = $this->getHTMLId($repeatCounter);
$opts =& $this->getElementJSOptions($repeatCounter);
$opts = json_encode($opts);
return "new fbLink('{$id}', {$opts})";
}
示例7: getManagementJS
protected function getManagementJS($data = array())
{
$app = JFactory::getApplication();
$menuItem = $app->getMenu('site')->getActive();
$Itemid = is_object($menuItem) ? $menuItem->id : 0;
$model = $this->getModel();
$item = $model->getTable();
$listid = $model->getId();
$formModel = $model->getFormModel();
$elementsNotInTable = $formModel->getElementsNotInTable();
if ($model->requiresSlimbox()) {
FabrikHelperHTML::slimbox();
}
if ($model->requiresMocha()) {
FabrikHelperHTML::mocha();
}
FabrikHelperHTML::script('media/com_fabrik/js/list.js', true);
$tmpl = $this->get('tmpl');
$this->assign('tmpl', $tmpl);
$this->get('ListCss');
// check for a custom js file and include it if it exists
$aJsPath = JPATH_SITE.DS."components".DS."com_fabrik".DS."views".DS."list".DS."tmpl".DS.$tmpl.DS."javascript.js";
if (JFile::exists($aJsPath)) {
FabrikHelperHTML::script('components/com_fabrik/views/list/tmpl/'.$tmpl.'/javascript.js', true);
}
$origRows = $this->rows;
$this->rows = array(array());
$tmpItemid = !isset($Itemid) ? 0 : $Itemid;
$this->_c = 0;
$this->_row = new stdClass();
$script = '';
$opts = new stdClass();
$opts->admin = $app->isAdmin();
$opts->ajax = (int)$model->isAjax();
$opts->filterMethod = $this->filter_action;
$opts->form = 'listform_' . $listid;
$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->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->formels = $elementsNotInTable;
$opts->actionMethod = $model->getParams()->get('actionMethod');
$opts->data = $data;
//if table data starts as empty then we need the html from the row
// template otherwise we can't add a row to the table
if ($model->isAjax()) {
ob_start();
$this->_row = new stdClass();
$this->_row->id = '';
$this->_row->class = 'fabrik_row';
require(COM_FABRIK_FRONTEND.DS.'views'.DS.'list'.DS.'tmpl'.DS.$tmpl.DS.'default_row.php');
$opts->rowtemplate = ob_get_contents();
ob_end_clean();
}
//$$$rob if you are loading a table in a window from a form db join select record option
// then we want to know the id of the window so we can set its showSpinner() method
$opts->winid = JRequest::getVar('winid', '');
$opts = json_encode($opts);
JText::script('COM_FABRIK_PREV');
JText::script('COM_FABRIK_SELECT_ROWS_FOR_DELETION');
JText::script('JYES');
JText::script('JNO');
JText::script('COM_FABRIK_SELECT_COLUMNS_TO_EXPORT');
JText::script('COM_FABRIK_INCLUDE_FILTERS');
JText::script('COM_FABRIK_INCLUDE_DATA');
JText::script('COM_FABRIK_INCLUDE_RAW_DATA');
JText::script('COM_FABRIK_INLCUDE_CALCULATIONS');
JText::script('COM_FABRIK_EXPORT');
JText::script('COM_FABRIK_START');
JText::script('COM_FABRIK_NEXT');
JText::script('COM_FABRIK_END');
JText::script('COM_FABRIK_PAGE');
JText::script('COM_FABRIK_OF');
JText::script('COM_FABRIK_LOADING');
JText::script('COM_FABRIK_RECORDS');
JText::script('COM_FABRIK_SAVING_TO');
JText::script('COM_FABRIK_CONFIRM_DROP');
JText::script('COM_FABRIK_CONFIRM_DELETE');
JText::script('COM_FABRIK_NO_RECORDS');
JText::script('COM_FABRIK_CSV_COMPLETE');
JText::script('COM_FABRIK_CSV_DOWNLOAD_HERE');
JText::script('COM_FABRIK_CONFIRM_DELETE');
JText::script('COM_FABRIK_CSV_DOWNLOADING');
//.........這裏部分代碼省略.........
示例8: _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) {
//.........這裏部分代碼省略.........
示例9: linkOpts
/**
* Get the link options
*
* @return array
*/
protected function linkOpts()
{
$fbConfig = JComponentHelper::getParams('com_fabrik');
$params = $this->getParams();
$target = $params->get('link_target_options', 'default');
$opts = array();
$opts['rel'] = $params->get('rel', '');
switch ($target) {
default:
$opts['target'] = $target;
break;
case 'default':
break;
case 'lightbox':
FabrikHelperHTML::slimbox();
$opts['rel'] = 'lightbox[]';
if ($fbConfig->get('use_mediabox', false)) {
$opts['target'] = 'mediabox';
}
break;
}
return $opts;
}
示例10: _addJavascript
/**
* append the form javascript into the document head
* @param int table id
*/
function _addJavascript($tableId)
{
// $$$ rob ALWAYS load the calendar (so its avaible in ajax forms)
FabrikHelperHTML::loadcalendar();
$app =& JFactory::getApplication();
$document =& JFactory::getDocument();
$model =& $this->getModel();
$aLoadedElementPlugins = array();
$jsActions = array();
$jsControllerKey = $model->_editable ? 'form_' . $model->getId() : 'details_' . $model->getId();
$allJsActions = $model->getJsActions();
FabrikHelperHTML::packageJS();
if (!defined('_JOS_FABRIK_FORMJS_INCLUDED')) {
define('_JOS_FABRIK_FORMJS_INCLUDED', 1);
FabrikHelperHTML::slimbox();
FabrikHelperHTML::script('form.js', 'media/com_fabrik/js/', true);
FabrikHelperHTML::script('element.js', 'media/com_fabrik/js/', true);
}
$aWYSIWYGNames = array();
// $$$ hugh - yeat 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) {
$aWYSIWYGNames[] = $res;
}
$eparams =& $elementModel->getParams();
//load in once the element js class files
// $$$ hugh - only needed getParent when we weren't saving changes to parent params to child
// which we should now be doing ... and getParent() causes an extra table lookup for every child
// element on the form.
//$element =& $elementModel->getParent();
$element =& $elementModel->getElement();
if (!in_array($element->plugin, $aLoadedElementPlugins)) {
$aLoadedElementPlugins[] = $element->plugin;
$elementModel->formJavascriptClass();
}
$eventMax = $groupModel->_repeatTotal == 0 ? 1 : $groupModel->_repeatTotal;
for ($c = 0; $c < $eventMax; $c++) {
$jsActions[] = $elementModel->getFormattedJSActions($allJsActions, $jsControllerKey, $c);
}
}
}
//new
$actions = trim(implode("\n", $jsActions));
//end new
$params =& $model->getParams();
$tableModel =& $model->getTableModel();
$table =& $tableModel->getTable();
$form =& $model->getForm();
FabrikHelperHTML::mocha();
$bkey = $model->_editable ? 'form_' . $model->getId() : 'details_' . $model->getId();
FabrikHelperHTML::tips('.hasTip', array(), "\$('{$bkey}')");
$key = FabrikString::safeColNameToArrayKey($table->db_primary_key);
$this->get('FormCss');
$this->get('CustomJsAction');
//$startJs = "window.addEvent('domready', function() {\n";
$startJs = "window.addEvent('" . FabrikHelperHTML::useLoadEvent() . "', function() {\n";
$endJs = "});\n";
$start_page = isset($model->sessionModel->last_page) ? (int) $model->sessionModel->last_page : 0;
if ($start_page !== 0) {
$app->enqueueMessage(JText::_('RESTARTINGMUTLIPAGEFORM'));
} else {
// form submitted but fails validation - needs to go to the last page
$start_page = JRequest::getInt('currentPage', 0);
}
$opts = new stdClass();
$opts->admin = $app->isAdmin();
$opts->postMethod = $this->get('PostMethod');
$opts->ajaxValidation = $params->get('ajax_validations');
$opts->primaryKey = $key;
$opts->liveSite = COM_FABRIK_LIVESITE;
$opts->error = @$form->origerror;
$opts->pages = $model->getPages();
$opts->plugins = array();
$opts->multipage_save = (bool) $model->saveMultiPage();
$opts->editable = $model->_editable;
$opts->start_page = $start_page;
$opts->mooversion = FabrikWorker::getMooVersion() == 1 ? 1.2 : 1.1;
//$$$rob dont int this as keys may be string
$opts->rowid = $model->_rowId;
//$$$rob if you are loading a table in a window from a form db join select record option
// then we want to know the id of the window so we can set its showSpinner() method
$opts->winid = JRequest::getVar('winid', '');
//for editing groups with joined data and an empty joined record (ie no joined records)
$hidden = array();
$maxRepeat = array();
$showMaxRepeats = array();
$postedRepeatGroupCounts = (array) JRequest::getVar('fabrik_repeat_group');
foreach ($this->groups as $g) {
$hidden[$g->id] = $g->startHidden;
if (JArrayHelper::getValue($postedRepeatGroupCounts, $g->id, 1) == 0) {
$hidden[$g->id] = true;
//.........這裏部分代碼省略.........
示例11: _addJavascript
/**
* Append the form javascript into the document head
*
* @param int $tableId table id
*
* @return void
*/
protected function _addJavascript($tableId)
{
$app = JFactory::getApplication();
$document = JFactory::getDocument();
$model = $this->getModel();
$aLoadedElementPlugins = array();
$jsActions = array();
$jsControllerKey = $model->isEditable() ? 'form_' . $model->getId() : 'details_' . $model->getId();
$srcs = FabrikHelperHTML::framework();
if (!defined('_JOS_FABRIK_FORMJS_INCLUDED')) {
define('_JOS_FABRIK_FORMJS_INCLUDED', 1);
FabrikHelperHTML::slimbox();
$srcs[] = 'media/com_fabrik/js/form.js';
$srcs[] = 'media/com_fabrik/js/element.js';
$srcs[] = 'media/com_fabrik/js/lib/form_placeholder/Form.Placeholder.js';
}
$aWYSIWYGNames = array();
// $$$ hugh - yeat 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) {
$aWYSIWYGNames[] = $res;
}
$eparams = $elementModel->getParams();
/* load in once the element js class files
* $$$ hugh - only needed getParent when we weren't saving changes to parent params to child
* which we should now be doing ... and getParent() causes an extra table lookup for every child
* element on the form.
* $element = $elementModel->getParent();
*/
$element = $elementModel->getElement();
if (!in_array($element->plugin, $aLoadedElementPlugins)) {
/* $$$ hugh - certain elements, like fileupload, need to load different JS files
* on a per-element basis, so as a test fix, I modified the fileupload'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) !== false) {
$aLoadedElementPlugins[] = $element->plugin;
}
}
$eventMax = $groupModel->repeatTotal == 0 ? 1 : $groupModel->repeatTotal;
for ($c = 0; $c < $eventMax; $c++) {
$jsActions[] = $elementModel->getFormattedJSActions($jsControllerKey, $c);
}
}
}
$actions = trim(implode("\n", $jsActions));
$params = $model->getParams();
$listModel = $model->getlistModel();
$table = $listModel->getTable();
$form = $model->getForm();
FabrikHelperHTML::mocha();
$bkey = $model->isEditable() ? 'form_' . $model->getId() : 'details_' . $model->getId();
FabrikHelperHTML::tips('.hasTip', array(), "\$('{$bkey}')");
$key = FabrikString::safeColNameToArrayKey($table->db_primary_key);
$this->get('FormCss');
$start_page = isset($model->sessionModel->last_page) ? (int) $model->sessionModel->last_page : 0;
if ($start_page !== 0) {
$app->enqueueMessage(JText::_('COM_FABRIK_RESTARTING_MUTLIPAGE_FORM'));
} else {
// Form submitted but fails validation - needs to go to the last page
$start_page = JRequest::getInt('currentPage', 0);
}
$opts = new stdClass();
$opts->admin = $app->isAdmin();
$opts->ajax = $model->isAjax();
$opts->ajaxValidation = (bool) $params->get('ajax_validations');
$opts->primaryKey = $key;
$opts->error = @$form->origerror;
$opts->pages = $model->getPages();
$opts->plugins = array();
$opts->multipage_save = (int) $model->saveMultiPage();
$opts->editable = $model->isEditable();
$opts->start_page = $start_page;
$opts->inlineMessage = (bool) $this->isMambot;
// $$$rob dont int this as keys may be string
$opts->rowid = (string) $model->_rowId;
// 3.0 needed for ajax requests
$opts->listid = (int) $this->get('ListModel')->getId();
$imgs = new stdClass();
$imgs->alert = FabrikHelperHTML::image('alert.png', 'form', $this->tmpl, '', true);
$imgs->action_check = FabrikHelperHTML::image('action_check.png', 'form', $this->tmpl, '', true);
$imgs->ajax_loader = FabrikHelperHTML::image('ajax-loader.gif', 'form', $this->tmpl, '', true);
$opts->images = $imgs;
// $$$rob if you are loading a table in a window from a form db join select record option
// then we want to know the id of the window so we can set its showSpinner() method
// 3.0 changed to fabrik_window_id (automatically appended by Fabrik.Window xhr request to load window data
$opts->fabrik_window_id = JRequest::getVar('fabrik_window_id', '');
//.........這裏部分代碼省略.........
示例12: linkOpts
/**
* Get the link options
*
* @return array
*/
protected function linkOpts()
{
$params = $this->getParams();
$target = $params->get('link_target_options', 'default');
$opts = array();
$opts['rel'] = $params->get('rel', '');
switch ($target) {
default:
$opts['target'] = $target;
break;
case 'default':
break;
case 'lightbox':
FabrikHelperHTML::slimbox();
$opts['rel'] = 'lightbox[]';
break;
}
return $opts;
}
示例13: getManagementJS
function getManagementJS($data = array())
{
global $Itemid;
$app =& JFactory::getApplication();
$model =& $this->getModel();
$table =& $model->getTable();
FabrikHelperHTML::packageJS();
$document =& JFactory::getDocument();
FabrikHelperHTML::slimbox();
FabrikHelperHTML::mocha();
FabrikHelperHTML::script('table.js', 'media/com_fabrik/js/', true);
$tmpl = JRequest::getVar('layout', $table->template);
// check for a custom css file and include it if it exists
$ab_css_file = JPATH_SITE . DS . "components" . DS . "com_fabrik" . DS . "views" . DS . "table" . DS . "tmpl" . DS . $tmpl . DS . "template.css";
if (file_exists($ab_css_file)) {
JHTML::stylesheet('template.css', 'components/com_fabrik/views/table/tmpl/' . $tmpl . '/');
}
// check for a custom js file and include it if it exists
$aJsPath = JPATH_SITE . DS . "components" . DS . "com_fabrik" . DS . "views" . DS . "table" . DS . "tmpl" . DS . $tmpl . DS . "javascript.js";
if (file_exists($aJsPath)) {
FabrikHelperHTML::script("javascript.js", 'components/com_fabrik/views/table/tmpl/' . $tmpl . '/', true);
}
// temporarily set data to load requierd info for js templates
$origRows = $this->rows;
$this->rows = array(array());
$tmpItemid = !isset($Itemid) ? 0 : $Itemid;
$this->_c = 0;
$this->_row = new stdClass();
$script = '';
static $tableini;
if (!$tableini) {
$tableini = true;
$script .= "var oTables = \$H();\n";
}
$opts = new stdClass();
$opts->admin = $app->isAdmin();
$opts->postMethod = $model->getPostMethod();
$opts->filterMethod = $this->filter_action;
$opts->form = 'tableform_' . $model->getId();
$opts->headings = $model->_jsonHeadings();
$opts->labels = $this->headings;
$opts->primaryKey = $table->db_primary_key;
$opts->data = $data;
$opts->Itemid = $tmpItemid;
$opts->formid = $model->_oForm->getId();
$opts->canEdit = $model->canEdit() ? "1" : "0";
$opts->canView = $model->canView() ? "1" : "0";
$opts->page = JRoute::_('index.php');
$opts->mooversion = FabrikWorker::getMooVersion() == 1 ? 1.2 : 1.1;
$opts = json_encode($opts);
$lang = new stdClass();
$lang->select_rows = JText::_('SELECT SOME ROWS FOR DELETION');
$lang = json_encode($lang);
$script .= "\n" . "var oTable = new fabrikTable(" . $model->getId() . ",";
$script .= $opts . "," . $lang;
$script .= "\n" . ");";
$script .= "\n" . "oTable.addListenTo('form_" . $model->_oForm->getId() . "');";
$script .= "\n" . "oTable.addListenTo('table_" . $model->getId() . "');";
$script .= "\n" . "oPackage.addBlock('table_" . $model->getId() . "', oTable);";
//add in plugin objects
$plugins = $this->get('PluginJsObjects');
$script .= "\noTable{$model->_id}.addPlugins([\n";
$script .= " " . implode(",\n ", $plugins);
$script .= "]\n);\n";
$script .= "oTables.set({$model->_id}, oTable);\n";
FabrikHelperHTML::addScriptDeclaration($script);
//reset data back to original settings
$this->rows = $origRows;
}
示例14: display
function display($tmpl = 'default')
{
FabrikHelperHTML::slimbox();
$document =& JFactory::getDocument();
FabrikHelperHTML::packageJS();
$usersConfig =& JComponentHelper::getParams('com_fabrik');
$model =& $this->getModel();
$model->setId(JRequest::getVar('id', $usersConfig->get('visualizationid', JRequest::getInt('visualizationid', 0))));
$this->row =& $model->getVisualization();
$model->setTableIds();
$js = $model->getJs();
$model->getCustomJsAction();
$this->txt = $model->getText();
$this->params =& $model->getParams();
$params =& $model->getPluginParams();
$this->assignRef('params', $params);
$tmpl = $params->get('fb_gm_layout', $tmpl);
$tmplpath = COM_FABRIK_FRONTEND . DS . 'plugins' . DS . 'visualization' . DS . 'googlemap' . DS . 'views' . DS . 'googlemap' . DS . 'tmpl' . DS . $tmpl;
FabrikHelperHTML::script('table.js', 'media/com_fabrik/js/', true);
FabrikHelperHTML::script('Event.Delegation.js', 'media/com_fabrik/js/', true);
if ($params->get('fb_gm_center') == 'userslocation') {
$document->addScript('http://code.google.com/apis/gears/gears_init.js');
FabrikHelperHTML::script('geo.js', 'components/com_fabrik/libs/geo-location/');
}
$this->get('PluginJsClasses');
$tableplugins = "window.addEvent('domready', function(){\n" . $this->get('PluginJsObjects') . "\n});";
FabrikHelperHTML::addScriptDeclaration($tableplugins);
JHTML::stylesheet('table.css', 'media/com_fabrik/css/');
global $ispda;
if ($ispda == 1) {
//pdabot
$template = 'static';
$this->assign('staticmap', $this->get('StaticMap'));
} else {
//$src = "http://maps.google.com/maps/api/js?sensor=".$params->get('fb_gm_sensor', 'false');
$uri = JURI::getInstance();
$src = $uri->getScheme() . "://maps.google.com/maps/api/js?sensor=" . $params->get('fb_gm_sensor', 'false');
$document->addScript($src);
FabrikHelperHTML::script('googlemap.js', 'components/com_fabrik/plugins/visualization/googlemap/', true);
if ($this->params->get('fb_gm_clustering') == 1) {
$document->addScript('http://google-maps-utility-library-v3.googlecode.com/svn/tags/markermanager/1.0/src/markermanager.js');
} else {
if ($this->params->get('fb_gm_clustering') == 2) {
//$document->addScript('http://google-maps-utility-library-v3.googlecode.com/svn/trunk/markerclusterer/src/markerclusterer_compiled.js');
FabrikHelperHTML::script('markerclusterer_packed.js', 'components/com_fabrik/libs/googlemaps/markerclustererplus/src/', true);
} else {
//doesnt work in v3
//FabrikHelperHTML::script('markermanager.js', 'components/com_fabrik/libs/googlemaps/', true);
}
}
FabrikHelperHTML::addScriptDeclaration($js);
$ab_css_file = $tmplpath . DS . 'template.css';
if (JFile::exists($ab_css_file)) {
JHTML::stylesheet('template.css', 'components/com_fabrik/plugins/visualization/googlemap/views/googlemap/tmpl/' . $tmpl . '/', true);
}
$template = null;
}
//check and add a general fabrik custom css file overrides template css and generic table css
FabrikHelperHTML::stylesheetFromPath("media" . DS . "com_fabrik" . DS . "css" . DS . "custom.css");
//check and add a specific viz template css file overrides template css generic table css and generic custom css
FabrikHelperHTML::stylesheetFromPath("components" . DS . "com_fabrik" . DS . "plugins" . DS . "visualization" . DS . "googlemap" . DS . "views" . DS . "googlemap" . DS . "tmpl" . DS . $tmpl . DS . "custom.css");
$this->assignRef('filters', $this->get('Filters'));
$this->assign('showFilters', JRequest::getInt('showfilters', 1) === 1 ? 1 : 0);
$this->assign('filterFormURL', $this->get('FilterFormURL'));
$this->assign('sidebarPosition', $params->get('fb_gm_use_overlays_sidebar'));
//if ((int)$params->get('fb_gm_use_overlays', 0) === 1 && (int)$params->get('fb_gm_use_overlays_sidebar', 0) > 0) {
if ($this->get('ShowSideBar')) {
$this->assign('showSidebar', 1);
$this->assign('overlayUrls', $params->get('fb_gm_overlay_urls', array(), '_default', 'array'));
$this->assign('overlayLabels', $params->get('fb_gm_overlay_labels', array(), '_default', 'array'));
} else {
$this->assign('showSidebar', 0);
}
$this->_setPath('template', $tmplpath);
$this->assign('containerId', $this->get('ContainerId'));
$this->assignRef('grouptemplates', $this->get('GroupTemplates'));
//ensure we don't have an incorrect version of mootools loaded
FabrikHelperHTML::cleanMootools();
echo parent::display();
}
示例15: getManagementJS
/**
* Get JS objects
*
* @param array $data list data
*
* @return void
*/
protected function getManagementJS($data = array())
{
$input = $this->app->input;
$itemId = FabrikWorker::itemId();
/** @var FabrikFEModelList $model */
$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);
$ajax = (int) $model->isAjax();
$ajaxLinks = (bool) $params->get('list_ajax_links', $ajax);
$opts = new stdClass();
$pluginManager = FabrikWorker::getPluginManager();
if ($ajaxLinks) {
$modalTitle = 'test';
$modalOpts = array('content' => '', 'id' => 'ajax_links', 'title' => JText::_($modalTitle), 'modal' => false, 'expandable' => true);
FabrikHelperHTML::jLayoutJs('ajax_links', 'fabrik-modal', (object) $modalOpts);
}
// Advanced search
if ($params->get('advanced-filter')) {
$modalOpts = array('content' => '', 'id' => 'advanced-filter', 'title' => JText::_('COM_FABRIK_FIELD_ADVANCED_SEARCH_LABEL'), 'modal' => false, 'expandable' => true);
FabrikHelperHTML::jLayoutJs('advanced-filter', 'fabrik-modal', (object) $modalOpts);
}
FabrikHelperHTML::jLayoutJs('modal-state-label', 'list.fabrik-filters-modal-state-label', $layoutData = (object) array('label' => '', 'displayValue' => '', 'key' => ''));
$this->csvJS($opts, $model);
if ($model->requiresSlimbox()) {
FabrikHelperHTML::slimbox();
}
if ($model->requiresSlideshow()) {
FabrikHelperHTML::slideshow();
}
$src = FabrikHelperHTML::framework();
$shim = array();
$dep = new stdClass();
$dep->deps = array();
$shim['fab/list'] = $dep;
$src['FbList'] = FabrikHelperHTML::mediaFile('list.js');
$src['FbListFilter'] = FabrikHelperHTML::mediaFile('listfilter.js');
$src['ListPlugin'] = FabrikHelperHTML::mediaFile('list-plugin.js');
$src = $model->getPluginJsClasses($src, $shim);
$pluginManager->runPlugins('loadJavascriptClassName', $model, 'list');
$pluginManager->data = array_filter($pluginManager->data, function ($v) {
return $v !== '';
});
$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['CustomJs'] = '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->admin = $this->app->isAdmin();
$opts->ajax = $ajax;
$opts->ajax_links = $ajaxLinks;
$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->resetFilters = (bool) FabrikWorker::getMenuOrRequestVar('resetfilters', 0, false, 'request');
$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();
// Reset data back to original settings
$this->rows = $origRows;
$formEls = array();
foreach ($elementsNotInTable as $tmpElement) {
//.........這裏部分代碼省略.........