protected function parse($match) { $match = $match[0]; require_once COM_FABRIK_FRONTEND . DS . 'helpers' . DS . 'parent.php'; $w = new FabrikWorker(); $w->replaceRequest($match); $match = $w->parseMessageForPlaceHolder($match); return $match; }
function parse($match) { $match = $match[0]; require_once COM_FABRIK_FRONTEND . DS . 'helpers' . DS . 'json.php'; require_once COM_FABRIK_FRONTEND . DS . 'helpers' . DS . 'parent.php'; $w = new FabrikWorker(); $w->replaceRequest($match); // stop [] for ranged filters from being removed $match = str_replace('{}', '[]', $match); $match = $w->parseMessageForPlaceHolder($match); return $match; }
function display($tmpl = 'default') { JHTML::_('behavior.calendar'); FabrikHelperHTML::packageJS(); FabrikHelperHTML::script('table.js', 'media/com_fabrik/js/'); FabrikHelperHTML::script('advanced-search.js', 'media/com_fabrik/js/'); require_once COM_FABRIK_FRONTEND . DS . 'helpers' . DS . 'html.php'; $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->setTableIds(); if ($this->row->state == 0) { JError::raiseWarning(500, JText::_('ALERTNOTAUTH')); return ''; } $this->assign('requiredFiltersFound', $this->get('RequiredFiltersFound')); if ($this->requiredFiltersFound) { $this->assign('chart', $this->get('Fusionchart')); } else { $this->assign('chart', ''); } $w = new FabrikWorker(); $w->replaceRequest($this->row->intro_text); $viewName = $this->getName(); $pluginManager =& JModel::getInstance('Pluginmanager', 'FabrikModel'); $plugin =& $pluginManager->getPlugIn('calendar', 'visualization'); $this->assign('containerId', $this->get('ContainerId')); $this->assignRef('filters', $this->get('Filters')); $this->assign('showFilters', JRequest::getInt('showfilters', 1)); $this->assign('filterFormURL', $this->get('FilterFormURL')); $pluginParams =& $model->getPluginParams(); $this->assignRef('params', $pluginParams); JHTML::stylesheet('table.css', 'media/com_fabrik/css/'); $tmpl = $pluginParams->get('fusionchart_layout', $tmpl); $tmplpath = COM_FABRIK_FRONTEND . DS . 'plugins' . DS . 'visualization' . DS . 'fusionchart' . DS . 'views' . DS . 'fusionchart' . DS . 'tmpl' . DS . $tmpl; $this->_setPath('template', $tmplpath); $ab_css_file = $tmplpath . DS . "template.css"; if (JFile::exists($ab_css_file)) { JHTML::stylesheet('template.css', 'components/com_fabrik/plugins/visualization/fusionchart/views/fusionchart/tmpl/' . $tmpl . '/', 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 . "fusionchart" . DS . "views" . DS . "fusionchart" . DS . "tmpl" . DS . $tmpl . DS . "custom.css"); //assign something to oPackage to ensure we can clear filters $str = "window.addEvent('domready', function(){\n\t\t\tfabrikFusionChart{$this->row->id} = {};"; $str .= "\n" . "oPackage.addBlock('vizualization_{$this->row->id}', fabrikFusionChart{$this->row->id});\n\t\t});"; FabrikHelperHTML::addScriptDeclaration($str); //ensure we don't have an incorrect version of mootools loaded FabrikHelperHTML::cleanMootools(); echo parent::display(); }
/** * Parse the {fabrik} tag * * @param array $match {fabrik} preg match * * @return string */ protected function parse($match) { $match = $match[0]; // $$$ hugh - see if we can remove formatting added by WYSIWYG editors $match = strip_tags($match); require_once COM_FABRIK_FRONTEND . '/helpers/parent.php'; $w = new FabrikWorker(); $match = preg_replace('/\\s+/', ' ', $match); /* $$$ hugh - only replace []'s in value, not key, so we handle * ranged filters and 'complex' filters */ $match2 = array(); foreach (explode(" ", $match) as $m) { if (strstr($m, '=')) { list($key, $val) = explode('=', $m); $val = str_replace('[', '{', $val); $val = str_replace(']', '}', $val); $match2[] = $key . '=' . $val; } else { $match2[] = $m; } } $match = implode(' ', $match2); $w->replaceRequest($match); // Stop [] for ranged filters from being removed // $match = str_replace('{}', '[]', $match); $match = $w->parseMessageForPlaceHolder($match); return $match; }
/** * Run the pre-filter sql and replace any placeholders in the subsequent pre-filter * * @param mixed $selValue string/array pre-filter value * * @return mixed string/array pre-filter value */ protected function prefilterParse($selValue) { $isstring = false; if (is_string($selValue)) { $isstring = true; $selValue = array($selValue); } $preSQL = htmlspecialchars_decode($this->getParams()->get('prefilter_query'), ENT_QUOTES); if (trim($preSQL) != '') { $db = FabrikWorker::getDbo(); $w = new FabrikWorker(); $w->replaceRequest($preSQL); $preSQL = $w->parseMessageForPlaceHolder($preSQL); $db->setQuery($preSQL); $q = $db->loadObjectList(); if (!$q) { // Try the table's connection db for the query $thisDb = $this->getDb(); $thisDb->setQuery($preSQL); $q = $thisDb->loadObjectList(); } if (!empty($q)) { $q = $q[0]; } } if (isset($q)) { foreach ($q as $key => $val) { if (substr($key, 0, 1) != '_') { $found = false; for ($i = 0; $i < count($selValue); $i++) { if (strstr($selValue[$i], '{$q->' . $key)) { $found = true; $pattern = '{$q->' . $key . "}"; } if (strstr($selValue[$i], '{$q->' . $key)) { $found = true; $pattern = '{$q->' . $key . "}"; } if ($found) { $selValue[$i] = str_replace($pattern, $val, $selValue[$i]); } } } } } else { /* Parse for default values only * $$$ hugh - this pattern is being greedy, so for example ... * foo {$my->id} bar {$my->id} bosh * ... matches everything from first to last brace, like ... * {$my->id} bar {$my->id} *$pattern = "/({[^}]+}).*}?/s"; */ $pattern = "/({[^}]+})/"; for ($i = 0; $i < count($selValue); $i++) { $ok = preg_match($pattern, $selValue[$i], $matches); foreach ($matches as $match) { $matchX = JString::substr($match, 1, JString::strlen($match) - 2); // A default option was set so lets use that if (strstr($matchX, '|')) { $bits = explode('|', $matchX); $selValue[$i] = str_replace($match, $bits[1], $selValue[$i]); } } } } $selValue = $isstring ? $selValue[0] : $selValue; // Replace {authorisedViewLevels} with array of view levels the user can access if (is_array($selValue)) { foreach ($selValue as &$v) { if (strstr($v, '{authorisedViewLevels}')) { $v = $this->user->getAuthorisedViewLevels(); } } } else { if (strstr($selValue, '{authorisedViewLevels}')) { $selValue = $this->user->getAuthorisedViewLevels(); } } return $selValue; }
/** * run the prefilter sql and replace any placeholders in the subsequent prefilter * * @param string/array prefilter value * @return string/array prefilter value */ function _prefilterParse($selValue) { $isstring = false; if (is_string($selValue)) { $isstring = true; $selValue = array($selValue); } $preSQL = htmlspecialchars_decode($this->getParams()->get('prefilter_query'), ENT_QUOTES); if (trim($preSQL) != '') { $db = FabrikWorker::getDbo(); $w = new FabrikWorker(); $w->replaceRequest($preSQL); $preSQL = $w->parseMessageForPlaceHolder($preSQL); $db->setQuery($preSQL); $q = $db->loadObjectList(); if (!empty($q)) { $q = $q[0]; } } if (isset($q)) { foreach ($q as $key => $val) { if (substr($key, 0, 1) != '_') { $found = false; for ($i = 0; $i < count($selValue); $i++) { if (strstr($selValue[$i], '{$q->' . $key)) { $found = true; $pattern = '{$q->' . $key . "}"; } if (strstr($selValue[$i], '{$q->' . $key)) { $found = true; $pattern = '{$q->' . $key . "}"; } if ($found) { $selValue[$i] = str_replace($pattern, $val, $selValue[$i]); } } } } } else { //parse for default values only $pattern = "/({[^}]+}).*}?/s"; for ($i = 0; $i < count($selValue); $i++) { $ok = preg_match($pattern, $selValue[$i], $matches); foreach ($matches as $match) { $matchx = substr($match, 1, strlen($match) - 2); //a default option was set so lets use that if (strstr($matchx, '|')) { $bits = explode('|', $matchx); $selValue[$i] = str_replace($match, $bits[1], $selValue[$i]); } } } } return $isstring ? $selValue[0] : $selValue; }
/** * run the prefilter sql and replace any placeholders in the subsequent prefilter * * @param string/array prefilter value * @return string/array prefilter value */ function _prefilterParse($selValue) { $isstring = false; if (is_string($selValue)) { $isstring = true; $selValue = array($selValue); } $preSQL = htmlspecialchars_decode($this->getParams()->get('prefilter_query'), ENT_QUOTES); if (trim($preSQL) != '') { $db =& JFactory::getDBO(); $w = new FabrikWorker(); $w->replaceRequest($preSQL); $preSQL = $w->parseMessageForPlaceHolder($preSQL); $db->setQuery($preSQL); $q = $db->loadObjectList(); if (!$q) { // Try the table's connection db for the query $thisDb = $this->getDb(); $thisDb->setQuery($preSQL); $q = $thisDb->loadObjectList(); } if (!empty($q)) { $q = $q[0]; } } if (isset($q)) { foreach ($q as $key => $val) { if (substr($key, 0, 1) != '_') { $found = false; for ($i = 0; $i < count($selValue); $i++) { if (strstr($selValue[$i], '{$q->' . $key)) { $found = true; $pattern = '{$q->' . $key . "}"; } if (strstr($selValue[$i], '{$q->' . $key)) { $found = true; $pattern = '{$q->' . $key . "}"; } if ($found) { $selValue[$i] = str_replace($pattern, $val, $selValue[$i]); } } } } } else { // $$$ hugh - this pattern is being greedy, so for example ... // foo {$my->id} bar {$my->id} gaprly // ... matches everyting from first to last brace, like ... // {$my->id} bar {$my->id} //$pattern = "/({[^}]+}).*}?/s"; $pattern = "/({[^}]+})/"; for ($i = 0; $i < count($selValue); $i++) { $ok = preg_match($pattern, $selValue[$i], $matches); foreach ($matches as $match) { $matchx = substr($match, 1, strlen($match) - 2); //a default option was set so lets use that if (strstr($matchx, '|')) { $bits = explode('|', $matchx); $selValue[$i] = str_replace($match, $bits[1], $selValue[$i]); } } } } return $isstring ? $selValue[0] : $selValue; }