Exemplo n.º 1
1
 /**
  * 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();
 }
Exemplo n.º 2
0
 /**
  * Display the view
  *
  * @param   string $tmpl Template
  *
  * @return  JView  this
  */
 public function display($tmpl = 'default')
 {
     $app = JFactory::getApplication();
     $model = $this->getModel();
     $input = $app->input;
     $renderOrder = $input->getInt('renderOrder');
     $path = JPATH_ROOT . '/plugins/fabrik_list/email/views/popupwin/tmpl/' . $tmpl;
     $this->_setPath('template', $path);
     $this->showToField = $model->getShowToField();
     $records = $model->getRecords();
     if (count($records) == 0) {
         $app->enqueueMessage('None of the selected records can be emailed', 'notice');
         return;
     }
     $this->recordcount = count($records);
     $this->renderOrder = $renderOrder;
     $this->recordids = implode(',', $records);
     $this->listid = $this->get('id', 'list');
     $this->showSubject = $model->getShowSubject();
     $this->subject = $model->getSubject();
     $this->message = $model->getMessage();
     $this->allowAttachment = $model->getAllowAttachment();
     $this->editor = $model->getEditor();
     $this->toType = $model->_toType();
     $this->emailTo = $model->_emailTo();
     $this->params = $model->getParams();
     $this->listEmailTo = $model->formModel->getElementList('list_email_to');
     $this->addressBook = $model->addressBook();
     $srcs = FabrikHelperHTML::framework();
     FabrikHelperHTML::iniRequireJs();
     FabrikHelperHTML::script($srcs);
     return parent::display();
 }
Exemplo n.º 3
0
 /**
  * display the template
  *
  * @param sting $tpl
  */
 function display($tpl = null)
 {
     FabrikHelperHTML::framework();
     $element = JRequest::getVar('element');
     $elementid = JRequest::getVar('elid');
     $pluginManager = JModel::getInstance('Pluginmanager', 'FabrikFEModel');
     $className = JRequest::getVar('plugin');
     $plugin = $pluginManager->getPlugIn($className, 'element');
     if (JError::isError($plugin)) {
         JError::handleMessage($plugin);
         return;
     }
     $plugin->setId($elementid);
     $data = array();
     $repeatCounter = 0;
     $groupModel = $plugin->getGroup();
     $srcs = array();
     $plugin->formJavascriptClass($srcs);
     echo "srcs = ";
     print_r($srcs);
     FabrikHelperHTML::script($srcs, true);
     $html = '<script>';
     $html .= $plugin->elementJavascript($repeatCounter);
     $html .= '</script>';
     $html .= $plugin->_getElement($data, $repeatCounter, $groupModel);
     echo $html;
 }
Exemplo n.º 4
0
	/**
	 * shows the data formatted for the table view
	 * @param string data
	 * @param object all the data in the tables current row
	 * @return string formatted value
	 */

	function renderListData($data, $oAllRowsData)
	{
		$id = $this->getHTMLId();
		$id .= "_" . $oAllRowsData->__pk_val;
		FabrikHelperHTML::script('media/com_fabrik/js/lib/swfobject.js', false);
		$params = $this->getParams();
		$partnerid = $params->get('kaltura_partnerid');
		?>

<script type="text/javascript">
	var params = {
		allowscriptaccess: "always",
		allownetworking: "all",
		allowfullscreen: "true",
		wmode: "opaque"
	};

	var flashVars = {
		entryId: "<?php echo $data?>"
	};

	swfobject.embedSWF("http://www.kaltura.com/kwidget/wid/_<?php echo $partnerid?>", "<?php echo $id?>", "400", "360", "9.0.0", false, flashVars, params);
</script>
		<?php
return '<div id="'.$id.'"></div>';
		//return parent::renderListData($data, $oAllRowsData);
	}
Exemplo n.º 5
0
 /**
  * get JS to manage the plugins html
  * @see components/com_fabrik/models/FabrikModelPlugin#getAdminJs($form, $lists)
  */
 function getAdminJs($form, $lists)
 {
     FabrikHelperHTML::script('admin.js', 'components/com_fabrik/plugins/form/fabriklimit/', true);
     $params =& $this->getParams();
     $children = $params->_xml['_default']->children();
     $opts = $this->getAdminJsOpts($form, $lists);
     foreach ($children as $node) {
         $type = $node->attributes('type');
         //remove any occurance of a mos_ prefix
         $type = str_replace('mos_', '', $type);
         $element =& $params->loadElement($type);
         $repeat = $element->getRepeat();
         $c = $element->getRepeatCounter();
         if ($type == 'fabriktables') {
             $connection = $node->attributes('observe');
             $opts->connection_id = $connection;
         }
         if ($type == 'element') {
             $name = $node->attributes('name');
             $opts->{$name} = new stdClass();
             $opts->{$name}->published = (int) $node->attributes('published', 0);
             $opts->{$name}->include_calculations = (int) $node->attributes('include_calculations', 0);
             $opts->{$name}->showintable = (int) $node->attributes('showintable', 0);
             $opts->{$name}->table_id = $node->attributes('table');
         }
     }
     $opts = json_encode($opts);
     $script = "new fabrikAdminLimit('{$this->row->name}', '{$this->_pluginLabel}', {$opts})";
     return $script;
 }
Exemplo n.º 6
0
 /**
  * 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;
 }
Exemplo n.º 7
0
 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;
 }
Exemplo n.º 8
0
 /**
  * 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;
     }
 }
Exemplo n.º 9
0
 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();
 }
Exemplo n.º 10
0
 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();
 }
Exemplo n.º 11
0
    /**
     * Method to get the field input markup.
     *
     * @return	string	The field input markup.
     */
    protected function getInput()
    {
        JText::script('COM_FABRIK_SUBOPTS_VALUES_ERROR');
        $default = new stdClass();
        $default->sub_values = array();
        $default->sub_labels = array();
        $default->sub_initial_selection = array();
        $opts = $this->value == '' ? json_encode($default) : json_encode($this->value);
        $script = "new Suboptions('{$this->name}', {$opts});";
        FabrikHelperHTML::script('administrator/components/com_fabrik/models/fields/suboptions.js', $script);
        $html = '<div style="float:left;width:100%">

<table style="width: 100%">
	<tr>
		<th style="width: 5%"></th>
		<th style="width: 30%">' . JText::_('COM_FABRIK_VALUE') . '</th>
		<th style="width: 30%">' . JText::_('COM_FABRIK_LABEL') . '</th>
		<th style="width: 30%">' . JText::_('COM_FABRIK_DEFAULT') . '</th>
	</tr>
</table>
<ul id="sub_subElementBody" class="subelements">
	<li></li>
</ul>
<a class="addButton" href="#" id="addSuboption">' . JText::_('COM_FABRIK_ADD') . '</a></div>';
        return $html;
    }
Exemplo n.º 12
0
 /**
  * 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);
 }
Exemplo n.º 13
0
    /**
     * 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>';
    }
Exemplo n.º 14
0
 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();
 }
Exemplo n.º 15
0
 /**
  * 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->js = $this->get('Js');
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         throw new RuntimeException(implode("\n", $errors), 500);
     }
     $this->addToolbar();
     FabrikAdminHelper::setViewLayout($this);
     // Set up the script shim
     $shim = array();
     $dep = new stdClass();
     $dep->deps = array('fab/fabrik');
     $shim['admin/pluginmanager'] = $dep;
     FabrikHelperHTML::iniRequireJS($shim);
     $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';
     FabrikHelperHTML::script($srcs, $this->js);
     parent::display($tpl);
 }
Exemplo n.º 16
0
 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();
 }
Exemplo n.º 17
0
 /**
  * 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;
 }
Exemplo n.º 18
0
	/**
	 * 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>";
	}
Exemplo n.º 19
0
 /**
  * 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;
 }
Exemplo n.º 20
0
 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();
     $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 . 'timeline' . DS . 'views' . DS . 'timeline' . 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 . "timeline" . DS . "views" . DS . "timeline" . DS . "tmpl" . DS . $tmpl . DS . "custom.css");
     FabrikHelperHTML::cleanMootools();
     echo parent::display();
 }
Exemplo n.º 21
0
 /**
  * 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;
 }
Exemplo n.º 22
0
 /**
  * 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>";
 }
Exemplo n.º 23
0
 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();
 }
Exemplo n.º 24
0
 /**
  * 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);
 }
Exemplo n.º 25
0
 /**
  * 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();
 }
Exemplo n.º 26
0
 public function listform()
 {
     $srcs = FabrikHelperHTML::framework();
     FabrikHelperHTML::script($srcs);
     $this->listform = $this->get('PackageListForm');
     JHtml::_('behavior.modal', 'a.modal');
     parent::display('list');
 }
Exemplo n.º 27
0
 /**
  * Method to get the field input markup.
  *
  * @return	string	The field input markup.
  */
 protected function getInput()
 {
     JText::script('COM_FABRIK_SUBOPTS_VALUES_ERROR');
     $default = new stdClass();
     $default->sub_values = array();
     $default->sub_labels = array();
     $default->sub_initial_selection = array();
     $opts = $this->value == '' ? $default : JArrayHelper::toObject($this->value);
     $j3 = FabrikWorker::j3();
     if ($j3) {
         $delButton = '<div class="btn-group">';
         $delButton .= '<a class="btn btn-success" href="#" data-button="addSuboption"><i class="icon-plus"></i> </a>';
         $delButton .= '<a class="btn btn-danger" href="#" data-button="deleteSuboption"><i class="icon-minus"></i> </a>';
         $delButton .= '</div>';
     } else {
         $delButton = '<a class="removeButton" href="#"><i class="icon-minus"></i> ' . FText::_('COM_FABRIK_DELETE') . '</a>';
     }
     if (is_array($opts)) {
         $opts['delButton'] = $delButton;
     } else {
         $opts->delButton = $delButton;
     }
     $opts->id = $this->id;
     $opts->j3 = $j3;
     $opts->defaultMax = (int) $this->getAttribute('default_max', 0);
     $opts = json_encode($opts);
     $script[] = "window.addEvent('domready', function () {";
     $script[] = "\tnew Suboptions('{$this->name}', {$opts});";
     $script[] = "});";
     FabrikHelperHTML::script('administrator/components/com_fabrik/models/fields/suboptions.js', implode("\n", $script));
     $html = array();
     if (!$j3) {
         $html[] = '<div style="float:left;width:100%">';
     }
     $html[] = '<table class="table table-striped" style="width: 100%" id="' . $this->id . '">';
     $html[] = '<thead>';
     $html[] = '<tr style="text-align:left">';
     $html[] = '<th style="width: 5%"></th>';
     $html[] = '<th style="width: 30%">' . FText::_('COM_FABRIK_VALUE') . '</th>';
     $html[] = '<th style="width: 30%">' . FText::_('COM_FABRIK_LABEL') . '</th>';
     $html[] = '<th style="width: 10%">' . FText::_('COM_FABRIK_DEFAULT') . '</th>';
     if ($j3) {
         $html[] = '<th style="width: 20%"><a class="btn btn-success" href="#" data-button="addSuboption"><i class="icon-plus"></i> </a></th>';
     }
     $html[] = '</tr>';
     $html[] = '</thead>';
     $html[] = '<tbody></tbody>';
     $html[] = '</table>';
     if (!$j3) {
         $html[] = '<ul id="sub_subElementBody" class="subelements">';
         $html[] = '<li></li>';
         $html[] = '</ul>';
         $html[] = '<a class="addButton" href="#" id="addSuboption"><i class="icon-plus"></i> ' . FText::_('COM_FABRIK_ADD') . '</a></div>';
     }
     FabrikHelperHTML::framework();
     FabrikHelperHTML::iniRequireJS();
     return implode("\n", $html);
 }
Exemplo n.º 28
0
 /**
  * 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')
 {
     $document = JFactory::getDocument();
     $app = JFactory::getApplication();
     $input = $app->input;
     $model = $this->getModel();
     $usersConfig = JComponentHelper::getParams('com_fabrik');
     $model->setId($input->getInt('id', $usersConfig->get('visualizationid', $input->getInt('visualizationid', 0))));
     if (!$model->canView()) {
         echo FText::_('JERROR_ALERTNOAUTHOR');
         return false;
     }
     $srcs = FabrikHelperHTML::framework();
     FabrikHelperHTML::styleSheet('plugins/fabrik_visualization/nvd3_chart/lib/novus-nvd3/src/nv.d3.css');
     $srcs['FbListFilter'] = 'media/com_fabrik/js/listfilter.js';
     $srcs['AdvancedSearch'] = 'media/com_fabrik/js/advanced-search.js';
     $lib = COM_FABRIK_LIVESITE . 'plugins/fabrik_visualization/nvd3_chart/lib/novus-nvd3/';
     $document->addScript($lib . 'lib/d3.v2.js');
     $document->addScript($lib . 'nv.d3.js');
     $document->addScript($lib . 'src/tooltip.js');
     $document->addScript($lib . 'lib/fisheye.js');
     $document->addScript($lib . 'src/utils.js');
     $document->addScript($lib . 'src/models/legend.js');
     $document->addScript($lib . 'src/models/axis.js');
     $document->addScript($lib . 'src/models/scatter.js');
     $document->addScript($lib . 'src/models/line.js');
     $document->addScript($lib . 'src/models/lineChart.js');
     $document->addScript($lib . 'src/models/multiBar.js');
     $document->addScript($lib . 'src/models/multiBarChart.js');
     $this->row = $model->getVisualization();
     $this->requiredFiltersFound = $model->getRequiredFiltersFound();
     $params = $model->getParams();
     $js = $model->js();
     FabrikHelperHTML::addScriptDeclaration($js);
     $this->params = $params;
     $viewName = $this->getName();
     $pluginManager = JModelLegacy::getInstance('Pluginmanager', 'FabrikFEModel');
     $plugin = $pluginManager->getPlugIn('calendar', 'visualization');
     $this->params = $params;
     $this->postText = $model->postText;
     $this->assign('containerId', $this->get('ContainerId'));
     $this->assign('filters', $this->get('Filters'));
     $this->showFilters = $model->showFilters();
     $this->assign('filterFormURL', $this->get('FilterFormURL'));
     $tpl = $params->get('nvd3_chart_layout', $tpl);
     $this->_setPath('template', JPATH_ROOT . '/plugins/fabrik_visualization/nvd3_chart/views/nvd3_chart/tmpl/' . $tpl);
     FabrikHelperHTML::stylesheetFromPath('plugins/fabrik_visualization/nvd3_chart/views/nvd3_chart/tmpl/' . $tpl . '/template.css');
     // 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::iniRequireJs($model->getShim());
     FabrikHelperHTML::script($srcs, $js);
     $text = $this->loadTemplate();
     FabrikHelperHTML::runContentPlugins($text);
     echo $text;
 }
Exemplo n.º 29
0
 /**
  * Internally render the plugin, and add required script declarations
  * to the document
  *
  * @return  void
  */
 public function render()
 {
     $params = $this->getParams();
     $document = JFactory::getDocument();
     $document->addScript("http://api.simile-widgets.org/runway/1.0/runway-api.js");
     $c = 0;
     $images = (array) $params->get('coverflow_image');
     $titles = (array) $params->get('coverflow_title');
     $subtitles = (array) $params->get('coverflow_subtitle');
     $listIds = (array) $params->get('coverflow_table');
     $eventData = array();
     foreach ($listIds as $listId) {
         $listModel = JModelLegacy::getInstance('List', 'FabrikFEModel');
         $listModel->setId($listId);
         $list = $listModel->getTable();
         $listModel->getPagination(0, 0, 0);
         $image = $images[$c];
         $title = $titles[$c];
         $subtitle = $subtitles[$c];
         $data = $listModel->getData();
         if ($listModel->canView() || $listModel->canEdit()) {
             $elements = $listModel->getElements();
             $imageElement = FArrayHelper::getValue($elements, FabrikString::safeColName($image));
             foreach ($data as $group) {
                 if (is_array($group)) {
                     foreach ($group as $row) {
                         $event = new stdClass();
                         if (!method_exists($imageElement, 'getStorage')) {
                             switch (get_class($imageElement)) {
                                 case 'FabrikModelFabrikImage':
                                     $rootFolder = $imageElement->getParams()->get('selectImage_root_folder');
                                     $rootFolder = JString::ltrim($rootFolder, '/');
                                     $rootFolder = JString::rtrim($rootFolder, '/');
                                     $event->image = COM_FABRIK_LIVESITE . 'images/stories/' . $rootFolder . '/' . $row->{$image . '_raw'};
                                     break;
                                 default:
                                     $event->image = isset($row->{$image . '_raw'}) ? $row->{$image . '_raw'} : '';
                                     break;
                             }
                         } else {
                             $event->image = $imageElement->getStorage()->pathToURL($row->{$image . '_raw'});
                         }
                         $event->title = $title === '' ? '' : (string) strip_tags($row->{$title});
                         $event->subtitle = $subtitle === '' ? '' : (string) strip_tags($row->{$subtitle});
                         $eventData[] = $event;
                     }
                 }
             }
         }
         $c++;
     }
     $json = json_encode($eventData);
     $str = "var coverflow = new FbVisCoverflow({$json});";
     $srcs = FabrikHelperHTML::framework();
     $srcs['Coverflow'] = $this->srcBase . 'coverflow/coverflow.js';
     FabrikHelperHTML::script($srcs, $str);
 }
Exemplo n.º 30
0
 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))));
     $this->row = $model->getVisualization();
     $model->setListIds();
     if ($this->row->published == 0) {
         JError::raiseWarning(500, JText::_('JERROR_ALERTNOAUTHOR'));
         return '';
     }
     $this->assign('js', $this->get('JS'));
     $viewName = $this->getName();
     $pluginManager = JModel::getInstance('Pluginmanager', 'FabrikFEModel');
     $plugin = $pluginManager->getPlugIn('slideshow', 'visualization');
     $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', $model->getParams());
     $tmpl = $pluginParams->get('slideshow_viz_layout', $tmpl);
     $tmplpath = $model->pathBase . 'slideshow' . DS . 'views' . DS . 'slideshow' . DS . 'tmpl' . DS . $tmpl;
     $this->_setPath('template', $tmplpath);
     FabrikHelperHTML::script('media/com_fabrik/js/list.js');
     if ($this->get('RequiredFiltersFound')) {
         FabrikHelperHTML::script('components/com_fabrik/libs/slideshow2/js/slideshow.js');
         $slideshow_viz_type = $pluginParams->get('slideshow_viz_type', 1);
         switch ($slideshow_viz_type) {
             case 1:
                 break;
             case 2:
                 FabrikHelperHTML::script('components/com_fabrik/libs/slideshow2/js/slideshow.kenburns.js');
                 break;
             case 3:
                 FabrikHelperHTML::script('components/com_fabrik/libs/slideshow2/js/slideshow.push.js');
                 break;
             case 4:
                 FabrikHelperHTML::script('components/com_fabrik/libs/slideshow2/js/slideshow.fold.js');
                 break;
             default:
                 break;
         }
         JHTML::stylesheet('components/com_fabrik/libs/slideshow2/css/slideshow.css');
         FabrikHelperHTML::script('plugins/fabrik_visualization/slideshow/slideshow.js');
     }
     FabrikHelperHTML::addScriptDeclaration($this->js);
     $ab_css_file = $tmplpath . DS . "template.css";
     $tmplpath = JPATH_ROOT . DS . 'plugins' . DS . 'fabrik_visualization' . DS . 'slideshow' . DS . 'views' . DS . 'slideshow' . DS . 'tmpl' . DS . $tmpl;
     $this->_setPath('template', $tmplpath);
     if (JFile::exists($ab_css_file)) {
         JHTML::stylesheet($this->srcBase . 'slideshow/views/slideshow/tmpl/' . $tmpl . '/template.css');
     }
     echo parent::display();
 }