/** * Display * * @param string $tmpl Template * * @return void */ public function display($tmpl = 'default') { $srcs = FabrikHelperHTML::framework(); $app = JFactory::getApplication(); $input = $app->input; FabrikHelperHTML::script($srcs); $model = $this->getModel(); $usersConfig = JComponentHelper::getParams('com_fabrik'); $model->setId($input->getInt('id', $usersConfig->get('visualizationid', $input->getInt('visualizationid', 0)))); $visualization = $model->getVisualization(); $pluginParams = $model->getPluginParams(); $pluginManager = JModelLegacy::getInstance('Pluginmanager', 'FabrikModel'); $plugin = $pluginManager->getPlugIn($visualization->plugin, 'visualization'); $plugin->_row = $visualization; if ($visualization->published == 0) { return JError::raiseWarning(500, FText::_('COM_FABRIK_SORRY_THIS_VISUALIZATION_IS_UNPUBLISHED')); } // Plugin is basically a model $pluginTask = $input->get('plugintask', 'render', 'request'); // @FIXME cant set params directly like this, but I think plugin model setParams() is not right $plugin->_params = $pluginParams; $tmpl = $plugin->getParams()->get('calendar_layout', $tmpl); $plugin->{$pluginTask}($this); $this->plugin = $plugin; $viewName = $this->getName(); $this->addTemplatePath($this->_basePath . '/plugins/' . $this->_name . '/' . $plugin->_name . '/tmpl/' . $tmpl); $root = $app->isAdmin() ? JPATH_ADMINISTRATOR : JPATH_SITE; $this->addTemplatePath($root . '/templates/' . $app->getTemplate() . '/html/com_fabrik/visualization/' . $plugin->_name . '/' . $tmpl); $ab_css_file = JPATH_SITE . '/plugins/fabrik_visualization/' . $plugin->_name . '/tmpl/' . $tmpl . '/template.css'; if (JFile::exists($ab_css_file)) { JHTML::stylesheet('template.css', 'plugins/fabrik_visualization/' . $plugin->_name . '/tmpl/' . $tmpl . '/', true); } echo parent::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') { $model = $this->getModel(); $j3 = FabrikWorker::j3(); $app = JFactory::getApplication(); $input = $app->input; $usersConfig = JComponentHelper::getParams('com_fabrik'); $id = $input->get('id', $usersConfig->get('visualizationid', $input->getInt('visualizationid', 0))); $model->setId($id); if (!$model->canView()) { echo FText::_('JERROR_ALERTNOAUTHOR'); return false; } $this->id = $id; $this->row = $this->get('Visualization'); $this->rows = $this->get('Rows'); $this->containerId = $this->get('ContainerId'); $this->calName = $this->get('VizName'); $this->params = $model->getParams(); $tpl = $j3 ? 'bootstrap' : $tpl; $this->_setPath('template', JPATH_SITE . '/plugins/fabrik_visualization/approvals/views/approvals/tmpl/' . $tpl); FabrikHelperHTML::stylesheetFromPath('plugins/fabrik_visualization/approvals/views/approvals/tmpl/' . $tpl . '/template.css'); $ref = $model->getJSRenderContext(); $js = "var {$ref} = new fbVisApprovals('approvals_" . $id . "');\n"; $js .= "Fabrik.addBlock('" . $ref . "', {$ref});\n"; $js .= $model->getFilterJs(); $srcs = FabrikHelperHTML::framework(); $srcs['FbListFilter'] = 'media/com_fabrik/js/listfilter.js'; $srcs['Approvals'] = 'plugins/fabrik_visualization/approvals/approvals.js'; FabrikHelperHTML::iniRequireJs($model->getShim()); FabrikHelperHTML::script($srcs, $js); $text = $this->loadTemplate(); FabrikHelperHTML::runContentPlugins($text); echo $text; }
/** * 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. */ function display($tpl = 'default') { FabrikHelperHTML::framework(); $app = JFactory::getApplication(); $params = $app->getParams('com_fabrik'); $document = JFactory::getDocument(); $usersConfig = JComponentHelper::getParams('com_fabrik'); $model = $this->getModel(); $model->setId(JRequest::getVar('id', $usersConfig->get('visualizationid', JRequest::getInt('visualizationid', 0)))); $this->row = $model->getVisualization(); $params = $model->getParams(); $this->assign('params', $params); $pluginParams = $model->getPluginParams(); $tpl = $pluginParams->get('fb_gm_layout', $tpl); $tmplpath = JPATH_ROOT . '/plugins/fabrik_visualization/kaltura/views/kaltura/tmpl/' . $tpl; $js = <<<EOT \t\t<script type="text/javascript" > function entryClicked ( entry_id ) { \twindow.location = "./player.php?entry_id=" + entry_id; } </script> EOT; $this->assignRef('data', $this->get('Data')); FabrikHelperHTML::addScriptDeclaration($js); FabrikHelperHTML::stylesheetFromPath('plugins/fabrik_visualization/kaltura/views/kaltura/tmpl/' . $tpl . '/template.css'); $template = null; $this->assign('containerId', $this->get('ContainerId')); $this->assign('showFilters', JRequest::getInt('showfilters', $params->get('show_filters')) === 1 ? 1 : 0); $this->assignRef('filters', $this->get('Filters')); $this->_setPath('template', $tmplpath); echo parent::display($template); }
/** * 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. */ function display($tpl = 'default') { $srcs = FabrikHelperHTML::framework(); $usersConfig = JComponentHelper::getParams('com_fabrik'); $model = $this->getModel(); $id = JRequest::getVar('id', $usersConfig->get('visualizationid', JRequest::getInt('visualizationid', 0))); $model->setId($id); $row = $model->getVisualization(); if ($this->get('RequiredFiltersFound')) { $model->render(); } $params = $model->getParams(); $this->assign('params', $params); $this->assign('containerId', $this->get('ContainerId')); $this->assignRef('row', $row); $this->assign('showFilters', JRequest::getInt('showfilters', $params->get('show_filters')) === 1 ? 1 : 0); $this->assignRef('filters', $this->get('Filters')); $this->assign('filterFormURL', $this->get('FilterFormURL')); $pluginParams = $model->getPluginParams(); $tmplpath = JPATH_ROOT . '/plugins/fabrik_visualization/coverflow/views/coverflow/tmpl/' . $tpl; $this->_setPath('template', $tmplpath); $srcs[] = 'media/com_fabrik/js/listfilter.js'; // Assign something to Fabrik.blocks to ensure we can clear filters $ref = $model->getJSRenderContext(); $js = "{$ref} = {};"; $js .= "\n" . "Fabrik.addBlock('{$ref}', {$ref});"; $js .= $model->getFilterJs(); FabrikHelperHTML::addScriptDeclaration($srcs, $js); echo parent::display(); }
function display($tmpl = 'default') { FabrikHelperHTML::framework(); FabrikHelperHTML::script('media/com_fabrik/js/list.js'); $model = $this->getModel(); $usersConfig = JComponentHelper::getParams('com_fabrik'); $model->setId(JRequest::getVar('id', $usersConfig->get('visualizationid', JRequest::getInt('visualizationid', 0)))); $this->row = $model->getVisualization(); $model->setListIds(); if ($this->row->published == 0) { JError::raiseWarning(500, JText::_('JERROR_ALERTNOAUTHOR')); return ''; } $calendar = $model->_row; $this->media = $model->getMedia(); $params = $model->getParams(); $this->assign('params', $params); $viewName = $this->getName(); $pluginManager = FabrikWorker::getPluginManager(); $plugin = $pluginManager->getPlugIn('media', 'visualization'); $this->assign('containerId', $this->get('ContainerId')); $this->assign('showFilters', JRequest::getInt('showfilters', $params->get('show_filters')) === 1 ? 1 : 0); $this->assignRef('filters', $this->get('Filters')); $this->assign('params', $model->getParams()); $pluginParams = $model->getPluginParams(); $tmpl = $pluginParams->get('media_layout', $tmpl); $tmplpath = JPATH_ROOT . '/plugins/fabrik_visualization/media/views/media/tmpl/' . $tmpl; $this->_setPath('template', $tmplpath); FabrikHelperHTML::stylesheetFromPath('plugins/fabrik_visualization/media/views/media/tmpl/' . $tmpl . '/template.css'); echo parent::display(); }
/** * Method to load the MooTools framework into the document head * * If debugging mode is on an uncompressed version of MooTools is included for easier debugging. * * @param string $extras MooTools file to load * @param boolean $debug Is debugging mode on? [optional] * * @return void * * @since 11.1 */ public static function framework($extras = false, $debug = null) { // $$$ rob this is to stop mootools from being re-loaded when in an ajax loaded page, as that // resets the window events, stopping Fabriks mediator js system from working (e.g. fabrik.form.submitted will not // fire the events added when the url initially loads.) if (FabrikHelperHTML::inAjaxLoadedPage()) { return; } static $loaded = array(); $type = $extras ? 'more' : 'core'; // Only load once if (!empty($loaded[$type])) { return; } JHtml::core($debug); // If no debugging value is set, use the configuration setting if ($debug === null) { $config = JFactory::getConfig(); $debug = $config->get('debug'); } $uncompressed = $debug ? '-uncompressed' : ''; if ($type != 'core' && empty($loaded['core'])) { self::framework(false, $debug); } JHtml::_('script', 'system/mootools-' . $type . $uncompressed . '.js', false, true, false, false); $loaded[$type] = true; return; }
function display($tmpl = 'default') { FabrikHelperHTML::packageJS(); $model =& $this->getModel(); $usersConfig =& JComponentHelper::getParams('com_fabrik'); $model->setId(array('id' => JRequest::getVar('id', $usersConfig->get('visualizationid', JRequest::getInt('visualizationid', 0))), 'package_id' => JRequest::getVar('package_id'))); $visualization =& $model->getVisualization(); $pluginParams =& $model->getPluginParams(); $pluginManager =& JModel::getInstance('Pluginmanager', 'FabrikModel'); $plugin =& $pluginManager->getPlugIn($visualization->plugin, 'visualization'); $plugin->_row = $visualization; if ($visualization->state == 0) { return JError::raiseWarning(500, JText::_('SORRY THIS VISUALIZATION IS UNPUBLISHED')); } //plugin is basically a model $pluginTask = JRequest::getVar('plugintask', 'render', 'request'); $plugin->_params = $pluginParams; $tmpl = $plugin->getParams()->get('calendar_layout', $tmpl); $plugin->{$pluginTask}($this); $this->plugin =& $plugin; $viewName = $this->getName(); $this->_setPath('template', $this->_basePath . DS . 'plugins' . DS . $this->_name . DS . $plugin->_name . DS . 'tmpl' . DS . $tmpl); $ab_css_file = JPATH_SITE . "/components/com_fabrik/plugins/" . $viewName . "/" . $plugin->_name . "/tmpl/{$tmpl}/template.css"; if (file_exists($ab_css_file)) { JHTML::stylesheet('template.css', 'components/com_fabrik/plugins/' . $viewName . '/' . $plugin->_name . '/tmpl/' . $tmpl . '/', true); } $model->getCustomJsAction(); if (isset($this->_isMambot) && $this->_isMambot) { return $this->loadTemplate(); } else { parent::display(); } }
/** * list of items * * @return null */ public function dolist() { $app = JFactory::getApplication(); $input = $app->input; $db = FabrikWorker::getDbo(true); $query = $db->getQuery(true); $list = $input->get('list', 'form'); $selected = $input->get('selected'); $query->select('id, label')->from('#__fabrik_' . $list . 's'); if ($selected != '') { // $query->where('id NOT IN ('.$selected.')'); } $db->setQuery($query); $rows = $db->loadObjectList(); echo "<ul id=\"{$list}-additems\">"; if (empty($rows)) { echo "<li>" . JText::sprintf('COM_FABRIK_NO_FREE_ITEMS_FOUND') . "</li>"; } else { foreach ($rows as $row) { echo "<li><a href=\"#\" id=\"{$row->id}\">{$row->label}</a>"; } } echo "</ul>"; $script = "\$('{$list}-additems').getElements('a').addEvent('click', function(e){\n\t\t\tFabrik.fireEvent('fabrik.package.item.selected', [e]);\n\t\t});"; FabrikHelperHTML::addScriptDeclaration($script); }
/** * Display the view */ public function display($tpl = null) { FabrikHelperHTML::framework(); if ($this->getLayout() == 'confirmupdate') { $this->confirmupdate(); return; } require_once JPATH_COMPONENT . '/helpers/adminhtml.php'; // Initialiase variables. $this->form = $this->get('Form'); $this->item = $this->get('Item'); $this->state = $this->get('State'); $this->pluginFields = $this->get('PluginHTML'); $this->js = $this->get('Js'); $this->jsevents = $this->get('JsEvents'); // Check for errors. if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); return false; } $this->addToolbar(); //used for js part of form if ($this->item->id == 0) { $this->elements = array(JText::_('COM_FABRIK_AVAILABLE_AFTER_SAVE')); } else { $this->elements = $this->get('Elements'); } $this->assign('parent', $this->get('Parent')); parent::display($tpl); }
/** * Returns javascript which creates an instance of the class defined in formJavascriptClass() * * @param int $repeatCounter Repeat group counter * * @return array */ public function elementJavascript($repeatCounter) { if (!$this->isEditable()) { return array(); } FabrikHelperHTML::addPath(COM_FABRIK_BASE . 'plugins/fabrik_element/colourpicker/images/', 'image', 'form', false); $params = $this->getParams(); $id = $this->getHTMLId($repeatCounter); $data = $this->getFormModel()->data; $value = $this->getValue($data, $repeatCounter); if ($value == 'none') { $value = ''; } $vars = explode(",", $value); $vars = array_pad($vars, 3, 0); $opts = $this->getElementJSOptions($repeatCounter); $c = new stdClass(); // 14/06/2011 changed over to color param object from ind colour settings $c->red = (int) $vars[0]; $c->green = (int) $vars[1]; $c->blue = (int) $vars[2]; $opts->colour = $c; $opts->value = $vars; $opts->showPicker = (bool) $params->get('show_picker', 1); $opts->swatchSizeWidth = $params->get('swatch_size_width', '10px'); $opts->swatchSizeHeight = $params->get('swatch_size_height', '10px'); $opts->swatchWidth = $params->get('swatch_width', '160px'); $swatch = $params->get('colourpicker-swatch', 'default.js'); $swatchFile = JPATH_SITE . '/plugins/fabrik_element/colourpicker/swatches/' . $swatch; $opts->swatch = json_decode(file_get_contents($swatchFile)); return array('ColourPicker', $id, $opts); }
/** * Get the src(s) for the list plugin js class * * @return mixed string or array */ public function loadJavascriptClass_result() { $mediaFolder = FabrikHelperHTML::getMediaFolder(); $src = parent::loadJavascriptClass_result(); $src['element'] = $mediaFolder . '/element.js'; return $src; }
function display($tmpl = 'default') { JHTML::_('behavior.calendar'); FabrikHelperHTML::script('media/com_fabrik/js/list.js', true); require_once COM_FABRIK_FRONTEND . DS . 'helpers' . DS . 'html.php'; FabrikHelperHTML::mocha(); FabrikHelperHTML::loadCalendar(); $model =& $this->getModel(); $usersConfig = JComponentHelper::getParams('com_fabrik'); $model->setId(JRequest::getVar('id', $usersConfig->get('visualizationid', JRequest::getInt('visualizationid', 0)))); $this->row =& $model->getVisualization(); $model->setListIds(); if ($this->row->published == 0) { JError::raiseWarning(500, JText::_('ALERTNOTAUTH')); return ''; } $calendar =& $model->_row; $this->media = $model->getMedia(); $viewName = $this->getName(); $pluginManager =& JModel::getInstance('Pluginmanager', 'FabrikFEModel'); $plugin =& $pluginManager->getPlugIn('calendar', 'visualization'); $this->assign('containerId', $this->get('ContainerId')); $this->assign('showFilters', JRequest::getInt('showfilters', 1) === 1 ? 1 : 0); $this->assignRef('filters', $this->get('Filters')); $pluginParams =& $model->getPluginParams(); $tmpl = $pluginParams->get('media_layout', $tmpl); $tmplpath = JPATH_ROOT . DS . 'plugins' . DS . 'fabrik_visualization' . DS . 'media' . DS . 'views' . DS . 'media' . DS . 'tmpl' . DS . $tmpl; $this->_setPath('template', $tmplpath); $ab_css_file = $tmplpath . DS . "template.css"; if (JFile::exists($ab_css_file)) { JHTML::stylesheet('plugins/fabrik_visualization/media/views/media/tmpl/' . $tmpl . '/template.css'); } echo parent::display(); }
/** * Sets up HTML to be injected into the form's bottom * * @param object $params params * @param object $formModel form model * * @return void */ public function getBottomContent($params, $formModel) { $user = JFactory::getUser(); if ($user->get('id') == 0) { $this->html = JText::_('PLG_CRON_NOTIFICATION_SIGN_IN_TO_RECEIVE_NOTIFICATIONS'); return; } if ($params->get('send_mode') == '1') { return; } $opts = new stdClass(); $opts->listid = $formModel->getListModel()->getId(); $opts->formid = $formModel->getId(); $opts->rowid = $formModel->_rowId; $opts->senderBlock = JRequest::getCmd('view') == 'form' ? 'form_' : 'details_'; $opts->senderBlock .= $formModel->getId(); $opts = json_encode($opts); $id = uniqid('fabrik_notification'); if ($params->get('notification_ajax', 0) == 1) { FabrikHelperHTML::script('components/com_fabrik/plugins/form/notification/notify.js'); $script = "head.ready(function() {\n\t\t\t\tvar notify = new Notify('{$id}', {$opts});\n \t\t\t});"; FabrikHelperHTML::addScriptDeclaration($script); } // See if the checkbox should be checked $db = FabrikWorker::getDbo(); $ref = $this->getRef($formModel->getListModel()->getId()); $query = $db->getQuery(true); $query->select('COUNT(id)')->from('#__{package}_notification')->where('user_id = ' . (int) $user->get('id') . ' AND reference = ' . $ref); $db->setQuery($query); $found = $db->loadResult(); $checked = $found ? 'checked="checked"' : ''; $this->html = ' <label><input id="' . $id . '" ' . $checked . ' type="checkbox" name="fabrik_notification" class="input" value="1" /> ' . JText::_('PLG_CRON_NOTIFICATION_NOTIFY_ME') . '</label>'; }
function display($tmpl = 'default') { $usersConfig = JComponentHelper::getParams('com_fabrik'); $model = $this->getModel(); $id = JRequest::getVar('id', $usersConfig->get('visualizationid', JRequest::getInt('visualizationid', 0))); $model->setId($id); $row =& $model->getVisualization(); $model->setListIds(); if ($this->get('RequiredFiltersFound')) { $model->render(); } $this->assign('containerId', $this->get('ContainerId')); $this->assignRef('row', $row); $this->assign('showFilters', JRequest::getInt('showfilters', 1) === 1 ? 1 : 0); $this->assignRef('filters', $this->get('Filters')); $this->assign('filterFormURL', $this->get('FilterFormURL')); $pluginParams =& $model->getPluginParams(); $this->assignRef('params', $pluginParams); $tmplpath = JPATH_ROOT . DS . 'plugins' . DS . 'fabrik_visualization' . DS . 'coverflow' . DS . 'views' . DS . 'coverflow' . DS . 'tmpl' . DS . $tmpl; $this->_setPath('template', $tmplpath); FabrikHelperHTML::script('table.js', 'media/com_fabrik/js/', true); //ensure we don't have an incorrect version of mootools loaded JHTML::stylesheet('media/com_fabrik/css/table.css'); FabrikHelperHTML::script('media/com_fabrik/js/list.js', true); //assign something to Fabrik.blocks to ensure we can clear filters $str = "head.ready(function() {\r\n\t\t\tfabrikChart{$this->row->id} = {};"; $str .= "\n" . "Fabrik.addBlock('vizualization_{$this->row->id}', fabrikChart{$this->row->id});\r\n\t\t});"; FabrikHelperHTML::addScriptDeclaration($str); echo parent::display(); }
/** * Display * * @param string $tpl Template * * @return void */ public function display($tpl = null) { FabrikHelperHTML::framework(); $app = JFactory::getApplication(); $input = $app->input; $state = $this->get('State'); $item = $this->get('Item'); $document = JFactory::getDocument(); $srcs = array('media/com_fabrik/js/icons.js', 'media/com_fabrik/js/icongen.js', 'media/com_fabrik/js/canvas.js', 'media/com_fabrik/js/history.js', 'media/com_fabrik/js/keynav.js', 'media/com_fabrik/js/tabs.js', 'media/com_fabrik/js/pages.js', 'media/com_fabrik/js/frontpackage.js'); FabrikHelperHTML::script($srcs); FabrikHelperHTML::stylesheet('media/com_fabrik/css/package.css'); $canvas = $item->params->get('canvas'); // $$$ rob 08/11/2011 test if component name set but still rendering // in option=com_fabrik then we should use fabrik as the package if ($input->get('option') === 'com_fabrik') { $item->component_name = 'fabrik'; } $opts = JArrayHelper::getvalue($canvas, 'options', array()); $tabs = JArrayHelper::getValue($canvas, 'tabs', array('Page 1')); $tabs = json_encode($tabs); $d = new stdClass(); $layout = JArrayHelper::getValue($canvas, 'layout', $d); $layout = json_encode(JArrayHelper::getValue($canvas, 'layout', $d)); $id = $this->get('State')->get('package.id'); $script = "window.addEvent('fabrik.loaded', function() {\n\t\t\tnew FrontPackage({\n\t\ttabs : {$tabs},\n\t\ttabelement : 'packagemenu',\n\t\tpagecontainer : 'packagepages',\n\t\tlayout: {$layout},\n\t\t'packageId': {$id},\n\t\t'package':'{$item->component_name}'\n\t});\n\t\t});"; FabrikHelperHTML::addScriptDeclaration($script); // Force front end templates $this->_basePath = COM_FABRIK_FRONTEND . '/views'; $tmpl = !isset($item->template) ? 'default' : $item->template; $this->addTemplatePath($this->_basePath . '/' . $this->_name . '/tmpl/' . $tmpl); $text = $this->loadTemplate(); FabrikHelperHTML::runConentPlugins($text); echo $text; }
/** * return the javascript to create an instance of the class defined in formJavascriptClass * @param object parameters * @param object table model * @param array [0] => string table's form id to contain plugin * @return bool */ function loadJavascriptInstance($params, $model, $args) { if (!$this->canUse()) { return; } $form_id = $args[0]; FabrikHelperHTML::script('element.js', 'media/com_fabrik/js/'); $orderEl = $model->getForm()->getElement($params->get('order_element'), true); $opts = new stdClass(); $opts->enabled = count($model->orderEls) === 1 && FabrikString::safeColNameToArrayKey($model->orderEls[0]) == FabrikString::safeColNameToArrayKey($orderEl->getOrderByName()) ? true : false; $opts->liveSite = COM_FABRIK_LIVESITE; $opts->tableid = $model->_id; $opts->orderElementId = $params->get('order_element'); $opts->handle = $params->get('order_element_as_handle', 1) == 1 ? '.fabrik_row___' . $orderEl->getOrderByName() : false; $opts->direction = $opts->enabled ? $model->orderDirs[0] : ''; $opts->transition = ''; $opts->duration = ''; $opts->constrain = ''; $opts->clone = ''; $opts->revert = ''; $opts->container = 'table_' . $model->getTable()->id; $opts = json_encode($opts); $lang = $this->_getLang(); $lang = json_encode($lang); $this->jsInstance = "new FbTableOrder('{$form_id}', {$opts}, {$lang})"; return true; }
/** * return the javascript to create an instance of the class defined in formJavascriptClass * @param object parameters * @param object table model * @param array [0] => string table's form id to contain plugin * @return bool */ function loadJavascriptInstance($params, $model, $args) { $form_id = $args[0]; $js = trim($params->get('table_js_code')); if ($js !== '') { FabrikHelperHTML::addScriptDeclaration($js); } $this->jsInstance = ''; //script $script = $params->get('table_js_file'); if ($script == '-1') { return; } $className = substr($script, 0, strlen($script) - 3); $document =& JFactory::getDocument(); $id =& $model->getTable()->id; $container = 'oTable'; if (JRequest::getVar('tmpl') != 'component') { FabrikHelperHTML::script($script, 'components/com_fabrik/plugins/table/tablejs/scripts/'); } else { // included scripts in the head don't work in mocha window // read in the class and insert it into the body as an inline script $class = JFile::read(JPATH_BASE . "/components/com_fabrik/plugins/table/tablejs/scripts/{$script}"); // $$$ rob dont want/need to delay the loading of the class //FabrikHelperHTML::addScriptDeclaration($class); $document =& JFactory::getDocument(); $document->addScriptDeclaration($class); } $this->jsInstance = "new {$className}({$container}{$id})"; return true; }
/** * set up the html to be injected into the bottom of the form * * @param object $params (no repeat counter stuff needed here as the plugin manager * which calls this function has already done the work for you */ function getBottomContent(&$params, &$formModel) { $user = JFactory::getUser(); if ($user->get('id') == 0) { $this->html = JText::_('PLG_CRON_NOTIFICATION_SIGN_IN_TO_RECEIVE_NOTIFICATIONS'); return; } $opts = new stdClass(); $opts->listid = $formModel->getListModel()->_id; $opts->fabrik = $formModel->_id; $opts->rowid = $formModel->_rowId; $opts->senderBlock = JRequest::getCmd('view') == 'form' ? 'form_' : 'details_'; $opts->senderBlock .= $formModel->_id; $opts = json_encode($opts); $id = uniqid('fabrik_notification'); if ($params->get('notification_ajax', 0) == 1) { FabrikHelperHTML::script('components/com_fabrik/plugins/form/fabriknotification/javascript.js', true); $script = "head.ready(function() { var notify = new Notify('$id', $opts); });"; FabrikHelperHTML::addScriptDeclaration($script); } //see if the checkbox should be checked $db = FabrikWorker::getDbo(); $ref =$this->getRef($formModel->getListModel()->_id); $db->setQuery("SELECT COUNT(id) FROM #__{package}_notification WHERE user_id = ".(int)$user->get('id') . " AND reference = $ref"); $found = $db->loadResult(); $checked = $found ? "checked=\"checked\"" : ""; $this->html = " <label><input id=\"$id\" $checked type=\"checkbox\" name=\"fabrik_notification\" class=\"input\" value=\"1\" /> ".JText::_('PLG_CRON_NOTIFICATION_NOTIFY_ME') . "</label>"; }
/** * Get the input * * @return string HTML output */ protected function getInput() { $from = $this->id . '-from'; $add = $this->id . '-add'; $remove = $this->id . '-remove'; $up = $this->id . '-up'; $down = $this->id . '-down'; $script = "swaplist = new SwapList('{$from}', '{$this->id}','{$add}', '{$remove}', '{$up}', '{$down}');"; FabrikHelperHTML::script('administrator/components/com_fabrik/models/fields/swaplist.js', $script); list($this->currentGroups, $this->currentGroupList) = $this->getCurrentGroupList(); list($this->groups, $this->groupList) = $this->getGroupList(); $str = ''; $checked = empty($this->current_groups) ? 'checked="checked"' : ''; if (empty($this->groups) && empty($this->currentGroups)) { return JText::_('COM_FABRIK_NO_GROUPS_AVAILABLE'); } else { $str .= '<input type="text" readonly="readonly" class="readonly" style="clear:left" size="44" value="' . JText::_('COM_FABRIK_AVAILABLE_GROUPS') . ':" />'; $str .= $this->groupList; $str .= '<input class="button" type="button" id="' . $this->id . '-add" value="' . JText::_('COM_FABRIK_ADD') . '" />'; $str .= '<input type="text" readonly="readonly" class="readonly" style="clear:left" size="44" value="' . JText::_('COM_FABRIK_CURRENT_GROUPS') . ':" />'; $str .= $this->currentGroupList; $str .= '<input class="button" type="button" value="' . JText::_('COM_FABRIK_UP') . '" id="' . $this->id . '-up" />'; $str .= '<input class="button" type="button" value="' . JText::_('COM_FABRIK_DOWN') . '" id="' . $this->id . '-down" />'; $str .= '<input class="button" type="button" value="' . JText::_('COM_FABRIK_REMOVE') . '" id="' . $this->id . '-remove"/>'; return $str; } }
function display($tmpl = 'default') { FabrikHelperHTML::packageJS(); $usersConfig =& JComponentHelper::getParams('com_fabrik'); $model = $this->getModel(); $id = JRequest::getVar('id', $usersConfig->get('visualizationid', JRequest::getInt('visualizationid', 0))); $model->setId($id); $row =& $model->getVisualization(); $model->setTableIds(); if ($this->get('RequiredFiltersFound')) { $model->render(); } $this->assign('containerId', $this->get('ContainerId')); $this->assignRef('row', $row); $this->assign('showFilters', JRequest::getInt('showfilters', 1) === 1 ? 1 : 0); $this->assignRef('filters', $this->get('Filters')); $this->assign('filterFormURL', $this->get('FilterFormURL')); $pluginParams =& $model->getPluginParams(); $this->assignRef('params', $pluginParams); $tmplpath = COM_FABRIK_FRONTEND . DS . 'plugins' . DS . 'visualization' . DS . 'coverflow' . DS . 'views' . DS . 'coverflow' . DS . 'tmpl' . DS . $tmpl; $this->_setPath('template', $tmplpath); //ensure we don't have an incorrect version of mootools loaded JHTML::stylesheet('table.css', 'media/com_fabrik/css/'); FabrikHelperHTML::script('table.js', 'media/com_fabrik/js/', true); //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 biz template css file overrides template css generic table css and generic custom css FabrikHelperHTML::stylesheetFromPath("components" . DS . "com_fabrik" . DS . "plugins" . DS . "visualization" . DS . "coverflow" . DS . "views" . DS . "coverflow" . DS . "tmpl" . DS . $tmpl . DS . "custom.css"); FabrikHelperHTML::cleanMootools(); //assign something to oPackage to ensure we can clear filters $str = "window.addEvent('domready', function(){\n\t\t\tfabrikChart{$this->row->id} = {};"; $str .= "\n" . "oPackage.addBlock('vizualization_{$this->row->id}', fabrikChart{$this->row->id});\n\t\t});"; FabrikHelperHTML::addScriptDeclaration($str); echo parent::display(); }
/** * Display the view * * @param string $tpl Template * * @return void */ public function display($tpl = null) { // Initialise variables. $this->form = $this->get('Form'); $this->item = $this->get('Item'); $this->state = $this->get('State'); $this->pluginFields = $this->get('PluginHTML'); // Check for errors. if (count($errors = $this->get('Errors'))) { throw new RuntimeException(implode("\n", $errors), 500); } $this->addToolbar(); FabrikAdminHelper::setViewLayout($this); $srcs = FabrikHelperHTML::framework(); $srcs[] = 'media/com_fabrik/js/fabrik.js'; $srcs[] = 'administrator/components/com_fabrik/views/namespace.js'; $srcs[] = 'administrator/components/com_fabrik/views/pluginmanager.js'; $srcs[] = 'administrator/components/com_fabrik/views/visualization/adminvisualization.js'; $shim = array(); $dep = new stdClass(); $dep->deps = array('admin/pluginmanager'); $shim['admin/visualization/adminvisualization'] = $dep; FabrikHelperHTML::iniRequireJS($shim); $opts = new stdClass(); $opts->plugin = $this->item->plugin; $js = "\n\tvar options = " . json_encode($opts) . ";\n\t\tFabrik.controller = new AdminVisualization(options);\n"; FabrikHelperHTML::script($srcs, $js); parent::display($tpl); }
/** * Draws the form element * * @param array $data to pre-populate element with * @param int $repeatCounter repeat group counter * * @return string returns element html */ public function render($data, $repeatCounter = 0) { $params = $this->getParams(); $displayData = new stdClass(); $displayData->num = $params->get('fbcomment_number_of_comments', 10); $displayData->width = $params->get('fbcomment_width', 300); $displayData->colour = $params->get('fb_comment_scheme') == '' ? '' : ' colorscheme="dark" '; $displayData->href = $params->get('fbcomment_href', ''); if (empty($data->href)) { $rowId = $this->app->input->getString('rowid', '', 'string'); if ($rowId != '') { $formModel = $this->getFormModel(); $formId = $formModel->getId(); $href = 'index.php?option=com_fabrik&view=form&formid=' . $formId . '&rowid=' . $rowId; $href = JRoute::_($href); $displayData->href = COM_FABRIK_LIVESITE_ROOT . $href; } } if (!empty($displayData->href)) { $w = new FabrikWorker(); $displayData->href = $w->parseMessageForPlaceHolder($data->href, $data); $locale = $params->get('fbcomment_locale', 'en_US'); if (empty($locale)) { $locale = 'en_US'; } $displayData->graphApi = FabrikHelperHTML::facebookGraphAPI($params->get('opengraph_applicationid'), $locale); } $layout = $this->getLayout('form'); return $layout->render($displayData); }
/** * Display the view * * @param string $tpl Template name * * @return void */ public function display($tpl = null) { switch ($this->getLayout()) { case 'confirmdelete': $this->confirmdelete(); return; break; case 'import': $this->import($tpl); return; break; } // Initialise variables. $app = JFactory::getApplication(); $input = $app->input; $this->items = $this->get('Items'); $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); $this->packageOptions = $this->get('PackageOptions'); // Check for errors. if (count($errors = $this->get('Errors'))) { throw new RuntimeException(implode("\n", $errors), 500); return false; } $this->table_groups = $this->get('TableGroups'); FabrikAdminHelper::setViewLayout($this); $this->addToolbar(); FabrikAdminHelper::addSubmenu($input->getWord('view', 'lists')); if (FabrikWorker::j3()) { $this->sidebar = JHtmlSidebar::render(); } FabrikHelperHTML::iniRequireJS(); parent::display($tpl); }
/** * Display the view * * @param string $tpl Template * * @return void */ public function display($tpl = null) { // Initialiase variables. $this->form = $this->get('Form'); $this->item = $this->get('Item'); $this->state = $this->get('State'); $this->pluginFields = $this->get('PluginHTML'); // Check for errors. if (count($errors = $this->get('Errors'))) { throw new RuntimeException(implode("\n", $errors), 500); } $this->addToolbar(); FabrikAdminHelper::setViewLayout($this); $srcs = FabrikHelperHTML::framework(); $srcs['Fabrik'] = FabrikHelperHTML::mediaFile('fabrik.js'); $srcs['Namespace'] = 'administrator/components/com_fabrik/views/namespace.js'; $srcs['PluginManager'] = 'administrator/components/com_fabrik/views/pluginmanager.js'; $srcs['CronAdmin'] = 'administrator/components/com_fabrik/views/cron/admincron.js'; $shim = array(); $dep = new stdClass(); $dep->deps = array('admin/pluginmanager'); $shim['admin/cron/admincron'] = $dep; $opts = new stdClass(); $opts->plugin = $this->item->plugin; $js = array(); $js[] = "\twindow.addEvent('domready', function () {"; $js[] = "\t\tFabrik.controller = new CronAdmin(" . json_encode($opts) . ");"; $js[] = "\t})"; FabrikHelperHTML::iniRequireJS($shim); FabrikHelperHTML::script($srcs, implode("\n", $js)); parent::display($tpl); }
function display($tmpl = 'default') { FabrikHelperHTML::framework(); $model = $this->getModel(); $usersConfig = JComponentHelper::getParams('com_fabrik'); $model->setId(JRequest::getVar('id', $usersConfig->get('visualizationid', JRequest::getInt('visualizationid', 0)))); $visualization = $model->getVisualization(); $pluginParams = $model->getPluginParams(); $pluginManager = JModel::getInstance('Pluginmanager', 'FabrikModel'); $plugin = $pluginManager->getPlugIn($visualization->plugin, 'visualization'); $plugin->_row = $visualization; if ($visualization->published == 0) { return JError::raiseWarning(500, JText::_('COM_FABRIK_SORRY_THIS_VISUALIZATION_IS_UNPUBLISHED')); } //plugin is basically a model $pluginTask = JRequest::getVar('plugintask', 'render', 'request'); // @FIXME cant set params directly like this, but I think plugin model setParams() is not right $plugin->_params = $pluginParams; $tmpl = $plugin->getParams()->get('calendar_layout', $tmpl); $plugin->{$pluginTask}($this); $this->plugin = $plugin; $viewName = $this->getName(); $this->addTemplatePath($this->_basePath . DS . 'plugins' . DS . $this->_name . DS . $plugin->_name . DS . 'tmpl' . DS . $tmpl); $this->addTemplatePath(JPATH_SITE . DS . 'templates' . DS . $app->getTemplate() . DS . 'html' . DS . 'com_fabrik' . DS . 'visualization' . DS . $plugin->_name . DS . $tmpl); $ab_css_file = JPATH_SITE . "/plugins/fabrik_visualization/" . $plugin->_name . "/tmpl/{$tmpl}/template.css"; if (JFile::exists($ab_css_file)) { JHTML::stylesheet('template.css', 'plugins/fabrik_visualization/' . $plugin->_name . '/tmpl/' . $tmpl . '/', true); } echo parent::display(); }
function display($tmpl = 'default') { FabrikHelperHTML::framework(); $usersConfig = JComponentHelper::getParams('com_fabrik'); $model = $this->getModel(); $id = JRequest::getVar('id', $usersConfig->get('visualizationid', JRequest::getInt('visualizationid', 0))); $model->setId($id); $row = $model->getVisualization(); $model->setListIds(); if ($this->get('RequiredFiltersFound')) { $model->render(); } $this->assign('containerId', $this->get('ContainerId')); $this->assignRef('row', $row); $this->assign('showFilters', JRequest::getInt('showfilters', $params->get('show_filters')) === 1 ? 1 : 0); $this->assignRef('filters', $this->get('Filters')); $this->assign('filterFormURL', $this->get('FilterFormURL')); $pluginParams = $model->getPluginParams(); $this->assignRef('params', $model->getParams()); $tmplpath = JPATH_ROOT . '/plugins/fabrik_visualization/coverflow/views/coverflow/tmpl/' . $tmpl; $this->_setPath('template', $tmplpath); FabrikHelperHTML::script('media/com_fabrik/js/list.js'); //assign something to Fabrik.blocks to ensure we can clear filters $str = "head.ready(function() {\r\n\t\t\tfabrikChart{$this->row->id} = {};"; $str .= "\n" . "Fabrik.addBlock('vizualization_{$this->row->id}', fabrikChart{$this->row->id});\r\n\t\t});"; FabrikHelperHTML::addScriptDeclaration($str); echo parent::display(); }
/** * Returns javascript which creates an instance of the class defined in formJavascriptClass() * * @param int $repeatCounter repeat group counter * * @return string */ public function elementJavascript($repeatCounter) { if (!$this->isEditable()) { return; } FabrikHelperHTML::addPath(COM_FABRIK_BASE . 'plugins/fabrik_element/colourpicker/images/', 'image', 'form', false); $params = $this->getParams(); $element = $this->getElement(); $id = $this->getHTMLId($repeatCounter); $data = $this->_form->_data; $value = $this->getValue($data, $repeatCounter); $vars = explode(",", $value); $vars = array_pad($vars, 3, 0); $opts = $this->getElementJSOptions($repeatCounter); $c = new stdClass(); // 14/06/2011 changed over to color param object from ind colour settings $c->red = (int) $vars[0]; $c->green = (int) $vars[1]; $c->blue = (int) $vars[2]; $opts->colour = $c; $swatch = $params->get('colourpicker-swatch', 'default.js'); $swatchFile = JPATH_SITE . '/plugins/fabrik_element/colourpicker/swatches/' . $swatch; $opts->swatch = json_decode(JFile::read($swatchFile)); $opts->closeImage = FabrikHelperHTML::image("close.gif", 'form', @$this->tmpl, array(), true); $opts->handleImage = FabrikHelperHTML::image("handle.gif", 'form', @$this->tmpl, array(), true); $opts->trackImage = FabrikHelperHTML::image("track.gif", 'form', @$this->tmpl, array(), true); $opts = json_encode($opts); return "new ColourPicker('{$id}', {$opts})"; }
/** * set up the html to be injected into the bottom of the form * * @param object $params (no repeat counter stuff needed here as the plugin manager * which calls this function has already done the work for you */ function getBottomContent(&$params, &$formModel) { $user =& JFactory::getUser(); if ($user->get('id') == 0) { $this->html = JText::_('PLG_CRON_NOTIFICATION_SIGN_IN_TO_RECEIVE_NOTIFICATIONS'); return; } $opts = new stdClass(); $opts->tableid = $formModel->getTableModel()->_id; $opts->fabrik = $formModel->_id; $opts->rowid = $formModel->_rowId; $opts->senderBlock = JRequest::getCmd('view') == 'form' ? 'form_' : 'details_'; $opts->senderBlock .= $formModel->_id; $opts = json_encode($opts); $id = uniqid('fabrik_notification'); if ($params->get('notification_ajax', 0) == 1) { FabrikHelperHTML::script('javascript.js', 'components/com_fabrik/plugins/form/fabriknotification/', true); $script = "window.addEvent('domready', function() {\n\t\t\t\tvar notify = new Notify('{$id}', {$opts});\n \t\t\t});"; FabrikHelperHTML::addScriptDeclaration($script); } //see if the checkbox should be checked $db =& JFactory::getDBO(); $ref = $this->getRef($formModel->getTableModel()->_id); $db->setQuery("SELECT COUNT(id) FROM #__fabrik_notification WHERE user_id = " . (int) $user->get('id') . " AND reference = {$ref}"); $found = $db->loadResult(); $checked = $found ? "checked=\"checked\"" : ""; $this->html = "\n\t\t<label><input id=\"{$id}\" {$checked} type=\"checkbox\" name=\"fabrik_notification\" class=\"input\" value=\"1\" />\n\t\t " . JText::_('NOTIFY_ME') . "</label>"; }
function display($tmpl = 'default') { require_once COM_FABRIK_FRONTEND . DS . 'helpers' . DS . 'html.php'; $model = $this->getModel(); $usersConfig = JComponentHelper::getParams('com_fabrik'); $id = JRequest::getVar('id', $usersConfig->get('visualizationid', JRequest::getInt('visualizationid', 0))); $model->setId($id); $this->assign('id', $id); $this->assignRef('row', $this->get('Visualization')); $this->assign('rows', $this->get('Rows')); $this->assign('containerId', $this->get('ContainerId')); $this->calName = $this->get('VizName'); $this->assignRef('params', $this->get('PluginParams')); $tmpl = $this->params->get('approvals_layout', $tmpl); $tmplpath = JPATH_SITE . DS . 'plugins' . DS . 'fabrik_visualization' . DS . 'approvals' . DS . 'views' . DS . 'approvals' . DS . 'tmpl' . DS . $tmpl; $this->_setPath('template', $tmplpath); $ab_css_file = $tmplpath . DS . "template.css"; if (file_exists($ab_css_file)) { JHTML::stylesheet('/plugins/fabrik_visualization/approvals/views/approvals/tmpl/' . $tmpl . '/template.css'); } FabrikHelperHTML::script('plugins/fabrik_visualization/approvals/approvals.js', true, "var approvals = new fbVisApprovals('approvals_" . $id . "');"); $text = $this->loadTemplate(); $opt = JRequest::getVar('option'); $view = JRequest::getCmd('view'); JRequest::setVar('view', 'article'); JRequest::setVar('option', 'com_content'); jimport('joomla.html.html.content'); $text .= '{emailcloak=off}'; $text = JHTML::_('content.prepare', $text); $text = preg_replace('/\\{emailcloak\\=off\\}/', '', $text); JRequest::setVar('option', $opt); echo $text; }
function display($tmpl = 'default') { $model =& $this->getModel(); $document =& JFactory::getDocument(); $renderOrder = JRequest::getInt('renderOrder'); $usersConfig =& JComponentHelper::getParams('com_fabrik'); $tmplpath = COM_FABRIK_FRONTEND . DS . 'plugins' . DS . 'table' . DS . 'emailtable' . DS . 'views' . DS . 'popupwin' . DS . 'tmpl'; $this->_setPath('template', $tmplpath); $this->assign('fieldList', $this->get('ToField')); $records = $this->get('records'); if (count($records) == 0) { JError::raiseNotice(500, 'None of the selected records can be emailed'); return; } $this->assign('recordcount', count($records)); $this->assign('renderOrder', $renderOrder); $this->assign('recordids', implode(',', $records)); $this->assign('tableid', $this->get('id', 'table')); $this->assign('showSubject', $this->get('showSubject')); $this->assign('subject', $this->get('subject')); $this->assign('message', $this->get('message')); $this->assign('allowAttachment', $this->get('allowAttachment')); //ensure we don't have an incorrect version of mootools loaded FabrikHelperHTML::cleanMootools(); if ($this->_isMambot) { return $this->loadTemplate(); } else { parent::display(); } }