コード例 #1
0
ファイル: view.html.php プロジェクト: ankaau/GathBandhan
 /**
  * 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->get('id', $usersConfig->get('visualizationid', $input->getInt('visualizationid', 0))));
     $visualization = $model->getVisualization();
     $params = $model->getParams();
     $pluginManager = JModelLegacy::getInstance('Pluginmanager', 'FabrikFEModel');
     $plugin = $pluginManager->getPlugIn($visualization->plugin, 'visualization');
     $plugin->setRow($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 = $params;
     $tmpl = $plugin->getParams()->get('calendar_layout', $tmpl);
     $plugin->{$pluginTask}($this);
     $this->plugin = $plugin;
     $viewName = $this->getName();
     $jTmplFolder = FabrikWorker::j3() ? 'tmpl' : 'tmpl25';
     $this->addTemplatePath($this->_basePath . '/plugins/' . $this->_name . '/' . $plugin->_name . '/' . $jTmplFolder . '/' . $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();
 }
コード例 #2
0
ファイル: notes.php プロジェクト: jfquestiaux/fabrik
 /**
  * Draws the html form element
  *
  * @param   array  $data           To pre-populate element with
  * @param   int    $repeatCounter  Repeat group counter
  *
  * @return  string	elements html
  */
 public function render($data, $repeatCounter = 0)
 {
     $params = $this->getParams();
     $tmp = $this->_getOptions($data, $repeatCounter, true);
     $layoutName = FabrikWorker::j3() ? 'form' : 'form-25';
     $layout = $this->getLayout($layoutName);
     $layoutData = new stdClass();
     $layoutData->id = $this->getHTMLId($repeatCounter);
     $layoutData->labels = array();
     $layoutData->name = $this->getHTMLName($repeatCounter);
     $layoutData->fieldType = $params->get('fieldType', 'textarea');
     $layoutData->editable = $this->isEditable();
     $layoutData->rowid = $this->getFormModel()->getRowId();
     $layoutData->primaryKey = $this->getGroupModel()->isJoin() ? $this->getJoinedGroupPkVal($repeatCounter) : $layoutData->rowid;
     $layoutData->rows = $tmp;
     $layoutData->model = $this;
     $layoutData->labels = array();
     /*
     foreach ($tmp as $row)
     {
     	$layoutData->labels[] = $this->getDisplayLabel($row);
     }
     */
     return $layout->render($layoutData);
 }
コード例 #3
0
ファイル: view.html.php プロジェクト: jfquestiaux/fabrik
 /**
  * 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;
 }
コード例 #4
0
ファイル: view.html.php プロジェクト: glauberm/cinevi
 /**
  * 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();
 }
コード例 #5
0
ファイル: php.php プロジェクト: glauberm/cinevi
 /**
  * Get button image
  *
  * @since   3.1b
  *
  * @return   string  image
  */
 protected function getImageName()
 {
     $img = parent::getImageName();
     if (FabrikWorker::j3() && $img === 'php.png') {
         $img = 'lightning';
     }
     return $img;
 }
コード例 #6
0
ファイル: suboptions.php プロジェクト: LGBGit/tierno
 /**
  * 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);
 }
コード例 #7
0
ファイル: textarea.php プロジェクト: ppantilla/bbninja
 /**
  * Tagify a string
  *
  * @param   string  $data  Tagify
  *
  * @return  string	Tagified string
  */
 protected function tagify($data)
 {
     $name = $this->getFullName(true, false);
     $params = $this->getParams();
     $listModel = $this->getlistModel();
     $filters = $listModel->getFilterArray();
     $fkeys = JArrayHelper::getValue($filters, 'key', array());
     $data = explode(",", strip_tags($data));
     $tags = array();
     $url = $params->get('textarea_tagifyurl');
     if ($url == '') {
         $url = $_SERVER['REQUEST_URI'];
         $bits = explode('?', $url);
         $root = JArrayHelper::getValue($bits, 0, '', 'string');
         $bits = JArrayHelper::getValue($bits, 1, '', 'string');
         $bits = explode("&", $bits);
         $fullName = $this->getFullName(true, false);
         for ($b = count($bits) - 1; $b >= 0; $b--) {
             $parts = explode("=", $bits[$b]);
             if (count($parts) > 1) {
                 $key = FabrikString::ltrimword(FabrikString::safeColNameToArrayKey($parts[0]), '&');
                 if ($key == $fullName) {
                     unset($bits[$b]);
                 }
                 if ($key == $fullName . '[value]') {
                     unset($bits[$b]);
                 }
                 if ($key == $fullName . '[condition]') {
                     unset($bits[$b]);
                 }
             }
         }
     }
     $url = $root . '?' . implode('&', $bits);
     // $$$ rob 24/02/2011 remove duplicates from tags
     $data = array_unique($data);
     $img = FabrikWorker::j3() ? 'bookmark.png' : 'tag.png';
     $icon = FabrikHelperHTML::image($img, 'form', @$this->tmpl, array('alt' => 'tag'));
     foreach ($data as $d) {
         $d = trim($d);
         if ($d != '') {
             if (trim($params->get('textarea_tagifyurl')) == '') {
                 $qs = strstr($url, '?');
                 if (substr($url, -1) === '?') {
                     $thisurl = $url . $name . '[value]=' . $d;
                 } else {
                     $thisurl = strstr($url, '?') ? $url . '&' . $name . '[value]=' . urlencode($d) : $url . '?' . $name . '[value]=' . urlencode($d);
                 }
                 $thisurl .= '&' . $name . '[condition]=CONTAINS';
                 $thisurl .= '&resetfilters=1';
             } else {
                 $thisurl = str_replace('{tag}', urlencode($d), $url);
             }
             $tags[] = '<a href="' . $thisurl . '" class="fabrikTag">' . $icon . $d . '</a>';
         }
     }
     return implode(' ', $tags);
 }
コード例 #8
0
ファイル: fabriktemplate.php プロジェクト: LGBGit/tierno
 /**
  * Method to get the field options.
  *
  * @return  array  The field option objects.
  */
 protected function getOptions()
 {
     $view = $this->element['view'] ? $this->element['view'] : 'list';
     if (FabrikWorker::j3()) {
         $this->element['directory'] = $this->directory = '/components/com_fabrik/views/' . $view . '/tmpl/';
     } else {
         $this->element['directory'] = '/components/com_fabrik/views/' . $view . '/tmpl25/';
     }
     return parent::getOptions();
 }
コード例 #9
0
ファイル: view.html.php プロジェクト: jfquestiaux/fabrik
 /**
  * Still a wip access the view of subscribed notifications with url:
  * http://localhost/fabrik30x/index.php?option=com_fabrik&task=cron.display&id=3
  *
  * deletion not routing right yet
  *
  * @param   string  $tpl  Template
  *
  * @return  void
  */
 public function display($tpl = 'default')
 {
     $model = $this->getModel();
     $model->loadLang();
     $this->rows = $model->getUserNotifications();
     $this->id = $model->getId();
     $j3 = FabrikWorker::j3();
     $viewName = $this->getName();
     $tpl = $j3 ? 'bootstrap' : 'default';
     $tmplpath = JPATH_ROOT . '/plugins/fabrik_cron/notification/views/notification/tmpl/' . $tpl;
     $this->_setPath('template', $tmplpath);
     FabrikHelperHTML::stylesheetFromPath('plugins/fabrik_cron/notification/views/notification/tmpl/' . $tpl . '/template.css');
     echo parent::display();
 }
コード例 #10
0
ファイル: view.html.php プロジェクト: jfquestiaux/fabrik
 /**
  * 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();
     $usersConfig = JComponentHelper::getParams('com_fabrik');
     $model = $this->getModel();
     $id = $input->getInt('id', $usersConfig->get('visualizationid', $input->getInt('visualizationid', 0)));
     $model->setId($id);
     $row = $model->getVisualization();
     if (!$model->canView()) {
         echo FText::_('JERROR_ALERTNOAUTHOR');
         return false;
     }
     $js = $model->render();
     $this->containerId = $this->get('ContainerId');
     $this->row = $row;
     $this->showFilters = $input->getInt('showfilters', 1) === 1 ? 1 : 0;
     $this->filters = $model->getFilters();
     $this->advancedSearch = $model->getAdvancedSearchLink();
     $this->filterFormURL = $model->getFilterFormURL();
     $params = $model->getParams();
     $this->params = $params;
     $this->width = $params->get('timeline_width', '700');
     $this->height = $params->get('timeline_height', '300');
     $tpl = $j3 ? 'bootstrap' : 'default';
     $tpl = $params->get('timeline_layout', $tpl);
     $tmplpath = '/plugins/fabrik_visualization/timeline/views/timeline/tmpl/' . $tpl;
     $this->_setPath('template', JPATH_ROOT . $tmplpath);
     JHTML::stylesheet('media/com_fabrik/css/list.css');
     FabrikHelperHTML::stylesheetFromPath($tmplpath . '/template.css');
     $srcs['FbListFilter'] = 'media/com_fabrik/js/listfilter.js';
     $srcs['Timeline'] = 'plugins/fabrik_visualization/timeline/timeline.js';
     $srcs['AdvancedSearch'] = 'media/com_fabrik/js/advanced-search.js';
     $js .= $model->getFilterJs();
     FabrikHelperHTML::iniRequireJs($model->getShim());
     FabrikHelperHTML::script($srcs, $js);
     JText::script('COM_FABRIK_ADVANCED_SEARCH');
     JText::script('COM_FABRIK_LOADING');
     $opts = array('alt' => 'calendar', 'class' => 'calendarbutton', 'id' => 'timelineDatePicker_cal_img');
     $img = FabrikHelperHTML::image('calendar.png', 'form', @$this->tmpl, $opts);
     $this->datePicker = '<input type="text" name="timelineDatePicker" id="timelineDatePicker" value="" />' . $img;
     // Check and add a general fabrik custom css file overrides template css and generic table css
     FabrikHelperHTML::stylesheetFromPath('media/com_fabrik/css/custom.css');
     // Check and add a specific biz  template css file overrides template css generic table css and generic custom css
     FabrikHelperHTML::stylesheetFromPath('plugins/fabrik_visualization/timeline/views/timeline/tmpl/' . $tpl . '/custom.css');
     return parent::display();
 }
コード例 #11
0
ファイル: plugin.php プロジェクト: LGBGit/tierno
 /**
  * Render the plugins fields
  *
  * @return string
  */
 public function render()
 {
     $app = JFactory::getApplication();
     $input = $app->input;
     $pluginManager = JModelLegacy::getInstance('Pluginmanager', 'FabrikFEModel');
     $plugin = $pluginManager->getPlugIn($this->getState('plugin'), $this->getState('type'));
     $feModel = $this->getPluginModel();
     $plugin->getJForm()->model = $feModel;
     $data = $this->getData();
     $input->set('view', $this->getState('type'));
     $mode = FabrikWorker::j3() ? 'nav-tabs' : '';
     $str = $plugin->onRenderAdminSettings($data, $this->getState('c'), $mode);
     $input->set('view', 'plugin');
     return $str;
 }
コード例 #12
0
ファイル: textarea.php プロジェクト: LGBGit/tierno
 /**
  * Tagify a string
  *
  * @param   string  $data  Tagify
  *
  * @return  string	Tagified string
  */
 protected function tagify($data)
 {
     $name = $this->getFullName(true, false);
     $params = $this->getParams();
     $data = explode(',', strip_tags($data));
     $url = $params->get('textarea_tagifyurl');
     $listId = $this->getListModel()->getId();
     if ($url == '') {
         if ($this->app->isAdmin()) {
             $url = 'index.php?option=com_fabrik&amp;task=list.view&amp;listid=' . $listId;
         } else {
             $url = 'index.php?option=com_' . $this->package . '&view=list&listid=' . $listId;
         }
     }
     // $$$ rob 24/02/2011 remove duplicates from tags
     // $$$ hugh - strip spaces first, account for "foo,bar, baz, foo"
     $data = array_map('trim', $data);
     $data = array_unique($data);
     $img = FabrikWorker::j3() ? 'bookmark.png' : 'tag.png';
     $icon = FabrikHelperHTML::image($img, 'form', @$this->tmpl, array('alt' => 'tag'));
     $tmplData = new stdClass();
     $tmplData->tags = array();
     foreach ($data as $d) {
         $d = trim($d);
         if ($d != '') {
             if (trim($params->get('textarea_tagifyurl')) == '') {
                 if (substr($url, -1) === '?') {
                     $thisurl = $url . $name . '[value]=' . $d;
                 } else {
                     $thisurl = strstr($url, '?') ? $url . '&' . $name . '[value]=' . urlencode($d) : $url . '?' . $name . '[value]=' . urlencode($d);
                 }
                 $thisurl .= '&' . $name . '[condition]=CONTAINS';
                 $thisurl .= '&resetfilters=1';
             } else {
                 $thisurl = str_replace('{tag}', urlencode($d), $url);
             }
             $o = new stdClass();
             $o->url = $thisurl;
             $o->icon = $icon;
             $o->label = $d;
             $tmplData->tags[] = $o;
         }
     }
     $layout = $this->getLayout('tags');
     return $layout->render($tmplData);
 }
コード例 #13
0
ファイル: view.html.php プロジェクト: jfquestiaux/fabrik
 /**
  * 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;
     $srcs = FabrikHelperHTML::framework();
     $srcs['FbListFilter'] = 'media/com_fabrik/js/listfilter.js';
     $srcs['AdvancedSearch'] = 'media/com_fabrik/js/advanced-search.js';
     $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;
     }
     if ($this->row->published == 0) {
         JError::raiseWarning(500, FText::_('JERROR_ALERTNOAUTHOR'));
         return '';
     }
     $this->requiredFiltersFound = $this->get('RequiredFiltersFound');
     if ($this->requiredFiltersFound) {
         $this->chart = $this->get('Chart');
     }
     $params = $model->getParams();
     $this->params = $params;
     $viewName = $this->getName();
     $pluginManager = FabrikWorker::getPluginManager();
     $plugin = $pluginManager->getPlugIn('fusion_gantt_chart', 'visualization');
     $this->containerId = $this->get('ContainerId');
     $this->filters = $this->get('Filters');
     $this->showFilters = $model->showFilters();
     $this->filterFormURL = $this->get('FilterFormURL');
     $tpl = FabrikWorker::j3() ? 'bootstrap' : 'default';
     $tpl = $params->get('fusion_gantt_chart_layout', $tpl);
     $tmplpath = JPATH_ROOT . '/plugins/fabrik_visualization/fusion_gantt_chart/views/fusion_gantt_chart/tmpl/' . $tpl;
     $this->_setPath('template', $tmplpath);
     FabrikHelperHTML::stylesheetFromPath('plugins/fabrik_visualization/fusion_gantt_chart/views/fusion_gantt_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);
     echo parent::display();
 }
コード例 #14
0
ファイル: paginate.php プロジェクト: jfquestiaux/fabrik
    /**
     * Sets up HTML to be injected into the form's bottom
     *
     * @return void
     */
    public function getBottomContent()
    {
        /** @var FabrikFEModelForm $formModel */
        $formModel = $this->getModel();
        if (!$this->show()) {
            $this->data = '';
            return;
        }
        $j3 = FabrikWorker::j3();
        $input = $this->app->input;
        $formId = $formModel->getForm()->id;
        $mode = JString::strtolower($input->get('view', 'form'));
        $this->ids = $this->getNavIds();
        $linkStartPrev = $this->ids->index == 0 ? ' disabled' : '';
        $linkNextEnd = $this->ids->index == $this->ids->lastKey ? ' disabled' : '';
        if ($this->app->isAdmin()) {
            $url = 'index.php?option=com_fabrik&task=' . $mode . '.view&formid=' . $formId . '&rowid=';
        } else {
            $url = 'index.php?option=com_' . $this->package . '&view=' . $mode . '&formid=' . $formId . '&rowid=';
        }
        $links = array();
        $links['first'] = JRoute::_($url . $this->ids->first);
        $links['first-active'] = $linkStartPrev;
        $links['last-active'] = $linkNextEnd;
        $links['prev'] = JRoute::_($url . $this->ids->prev);
        $links['next'] = JRoute::_($url . $this->ids->next);
        $links['last'] = JRoute::_($url . $this->ids->last);
        if ($j3) {
            $layout = new JLayoutFile('plugins.fabrik_form.paginate.layouts.default_paginate', JPATH_SITE);
            $this->data = $layout->render($links);
        } else {
            $firstLink = $linkStartPrev ? '<span>&lt;&lt;</span>' . FText::_('COM_FABRIK_START') : '<a href="' . $links['first'] . '" class="pagenav paginateFirst ' . $linkStartPrev . '"><span>&lt;&lt;</span>' . FText::_('COM_FABRIK_START') . '</a>';
            $prevLink = $linkStartPrev ? '<span>&lt;</span>' . FText::_('COM_FABRIK_PREV') : '<a href="' . $links['prev'] . '" class="pagenav paginatePrevious ' . $linkStartPrev . '"><span>&lt;</span>' . FText::_('COM_FABRIK_PREV') . '</a>';
            $nextLink = $linkNextEnd ? FText::_('COM_FABRIK_NEXT') . '<span>&gt;</span>' : '<a href="' . $links['next'] . '" class="pagenav paginateNext' . $linkNextEnd . '">' . FText::_('COM_FABRIK_NEXT') . '<span>&gt;</span></a>';
            $endLink = $linkNextEnd ? FText::_('COM_FABRIK_END') . '<span>&gt;&gt;</span>' : '<a href="' . $links['last'] . '" class="pagenav paginateLast' . $linkNextEnd . '">' . FText::_('COM_FABRIK_END') . '<span>&gt;&gt;</span></a>';
            $this->data = '<ul id="fabrik-from-pagination" class="pagination">
					<li>' . $firstLink . '</li>
					<li>' . $prevLink . '</li>
					<li>' . $nextLink . '</li>
					<li>' . $endLink . '</li>
			</ul>';
        }
        FabrikHelperHTML::stylesheet('plugins/fabrik_form/paginate/paginate.css');
    }
コード例 #15
0
ファイル: view.html.php プロジェクト: glauberm/cinevi
 /**
  * Display the view
  *
  * @param   string  $tpl  template
  *
  * @return  void
  */
 public function display($tpl = null)
 {
     $srcs = FabrikHelperHTML::framework();
     FabrikHelperHTML::script($srcs);
     $db = FabrikWorker::getDbo(true);
     $query = $db->getQuery(true);
     $query->select('*')->from('#__{package}_log')->where('message_type != ""')->order('timedate_created DESC');
     $db->setQuery($query, 0, 10);
     $this->logs = $db->loadObjectList();
     $this->feed = $this->get('RSSFeed');
     $this->addToolbar();
     FabrikAdminHelper::addSubmenu('home');
     FabrikAdminHelper::setViewLayout($this);
     if (FabrikWorker::j3()) {
         $this->sidebar = JHtmlSidebar::render();
     }
     FabrikHelperHTML::iniRequireJS();
     parent::display($tpl);
 }
コード例 #16
0
ファイル: forminlineedit.php プロジェクト: ppantilla/bbninja
 /**
  * Render the inline edit interface
  *
  * @return void
  */
 public function render()
 {
     $this->formModel = JModelLegacy::getInstance('Form', 'FabrikFEModel');
     $document = JFactory::getDocument();
     $app = JFactory::getApplication();
     $input = $app->input;
     $j3 = FabrikWorker::j3();
     // Need to render() with all element ids in case canEditRow plugins etc. use the row data.
     $elids = $input->get('elementid', array(), 'array');
     $input->set('elementid', null);
     $form = $this->formModel->getForm();
     $this->formModel->render();
     // Set back to original input so we only show the requested elements
     $input->set('elementid', $elids);
     $this->groups = $this->formModel->getGroupView();
     // Main trigger element's id
     $elementid = $input->getInt('elid');
     $html = $j3 ? $this->inlineEditMarkUp() : $this->inlineEditMarkupJ25();
     echo implode("\n", $html);
     $srcs = array();
     $repeatCounter = 0;
     $elementids = (array) $input->get('elementid', array(), 'array');
     $eCounter = 0;
     $onLoad = array();
     $onLoad[] = "Fabrik.inlineedit_{$elementid} = {'elements': {}};";
     foreach ($elementids as $id) {
         $elementModel = $this->formModel->getElement($id, true);
         $elementModel->getElement();
         $elementModel->setEditable(true);
         $elementModel->formJavascriptClass($srcs);
         $elementJS = $elementModel->elementJavascript($repeatCounter);
         $onLoad[] = 'var o = new ' . $elementJS[0] . '("' . $elementJS[1] . '",' . json_encode($elementJS[2]) . ');';
         if ($eCounter === 0) {
             $onLoad[] = "o.select();";
             $onLoad[] = "o.focus();";
             $onLoad[] = "Fabrik.inlineedit_{$elementid}.token = '" . JSession::getFormToken() . "';";
         }
         $eCounter++;
         $onLoad[] = "Fabrik.inlineedit_{$elementid}.elements[{$id}] = o";
     }
     $onLoad[] = "Fabrik.fireEvent('fabrik.list.inlineedit.setData');";
     FabrikHelperHTML::script($srcs, implode("\n", $onLoad));
 }
コード例 #17
0
ファイル: view.html.php プロジェクト: glauberm/cinevi
 /**
  * Display the view
  *
  * @param   string $tpl template
  *
  * @return  this
  */
 public function display($tpl = null)
 {
     $srcs = FabrikHelperHTML::framework();
     FabrikHelperHTML::script($srcs);
     $input = $this->app->input;
     $this->listid = $input->getInt('listid', 0);
     $this->model = JModelLegacy::getInstance('List', 'FabrikFEModel');
     $this->model->setId($this->listid);
     $this->table = $this->model->getTable();
     $this->form = $this->get('Form');
     if (!$this->model->canCSVImport()) {
         throw new RuntimeException('Naughty naughty!', 400);
     }
     $layout = FabrikWorker::j3() ? 'bootstrap' : 'default';
     $this->setLayout($layout);
     $this->fieldsets = $this->setFieldSets();
     parent::display($tpl);
     return $this;
 }
コード例 #18
0
ファイル: slider.php プロジェクト: jfquestiaux/fabrik
 /**
  * Draws the html form element
  *
  * @param   array  $data           To pre-populate element with
  * @param   int    $repeatCounter  Repeat group counter
  *
  * @return  string	elements html
  */
 public function render($data, $repeatCounter = 0)
 {
     FabrikHelperHTML::stylesheet(COM_FABRIK_LIVESITE . 'media/com_fabrik/css/slider.css');
     $params = $this->getParams();
     $width = (int) $params->get('slider_width', 250);
     $val = $this->getValue($data, $repeatCounter);
     if (!$this->isEditable()) {
         return $val;
     }
     $labels = explode(',', $params->get('slider-labels'));
     FabrikHelperHTML::addPath(COM_FABRIK_BASE . 'plugins/fabrik_element/slider/images/', 'image', 'form', false);
     $layout = $this->getLayout('form');
     $layoutData = new stdClass();
     $layoutData->id = $this->getHTMLId($repeatCounter);
     $layoutData->name = $this->getHTMLName($repeatCounter);
     $layoutData->value = $val;
     $layoutData->width = $width;
     $layoutData->j3 = FabrikWorker::j3();
     $layoutData->showNone = $params->get('slider-shownone');
     $layoutData->outSrc = FabrikHelperHTML::image('clear_rating_out.png', 'form', $this->tmpl, array(), true);
     $layoutData->labels = $labels;
     $layoutData->spanWidth = floor(($width - 2 * count($labels)) / count($labels));
     $layoutData->align = array();
     for ($i = 0; $i < count($labels); $i++) {
         switch ($i) {
             case 0:
                 $align = 'left';
                 break;
             case count($labels) - 1:
                 $align = 'right';
                 break;
             case 1:
             default:
                 $align = 'center';
                 break;
         }
         $layoutData->align[] = $align;
     }
     return $layout->render($layoutData);
 }
コード例 #19
0
ファイル: view.html.php プロジェクト: LGBGit/tierno
 /**
  * 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();
     $model = $this->getModel();
     $usersConfig = JComponentHelper::getParams('com_fabrik');
     $model->setId($input->getInt('id', $usersConfig->get('visualizationid', $input->getInt('visualizationid', 0))));
     $this->row = $model->getVisualization();
     $params = $model->getParams();
     $js = $model->getJs();
     $srcs = FabrikHelperHTML::framework();
     $srcs[] = 'media/com_fabrik/js/listfilter.js';
     $srcs[] = 'plugins/fabrik_visualization/media/media.js';
     if ($params->get('media_which_player', 'jw') == 'jw') {
         $srcs[] = 'plugins/fabrik_visualization/media/libs/jw/jwplayer.js';
     }
     FabrikHelperHTML::iniRequireJs($model->getShim());
     FabrikHelperHTML::script($srcs, $js);
     if (!$model->canView()) {
         echo FText::_('JERROR_ALERTNOAUTHOR');
         return false;
     }
     $media = $model->getRow();
     $this->media = $model->getMedia();
     $this->params = $params;
     $viewName = $this->getName();
     $this->containerId = $model->getContainerId();
     $this->showFilters = $model->showFilters();
     $this->filterFormURL = $model->getFilterFormURL();
     $this->filters = $this->get('Filters');
     $this->params = $model->getParams();
     $tpl = $j3 ? 'bootstrap' : 'default';
     $tpl = $params->get('media_layout', $tpl);
     $tplpath = JPATH_ROOT . '/plugins/fabrik_visualization/media/views/media/tmpl/' . $tpl;
     $this->_setPath('template', $tplpath);
     FabrikHelperHTML::stylesheetFromPath('plugins/fabrik_visualization/media/views/media/tmpl/' . $tpl . '/template.css');
     echo parent::display();
 }
コード例 #20
0
ファイル: view.html.php プロジェクト: glauberm/cinevi
 /**
  * Display the view
  *
  * @param   string  $tpl  Template
  *
  * @return  void
  */
 public function display($tpl = null)
 {
     // Initialise variables.
     $app = JFactory::getApplication();
     $input = $app->input;
     $this->items = $this->get('Items');
     $this->pagination = $this->get('Pagination');
     $this->state = $this->get('State');
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         throw new RuntimeException(implode("\n", $errors), 500);
         return false;
     }
     FabrikAdminHelper::setViewLayout($this);
     $this->addToolbar();
     FabrikAdminHelper::addSubmenu($input->getWord('view', 'lists'));
     if (FabrikWorker::j3()) {
         $this->sidebar = JHtmlSidebar::render();
     }
     FabrikHelperHTML::iniRequireJS();
     parent::display($tpl);
 }
コード例 #21
0
ファイル: fabriktemplate.php プロジェクト: glauberm/cinevi
 /**
  * Method to get the field options.
  *
  * @return  array  The field option objects.
  */
 protected function getOptions()
 {
     $view = $this->element['view'] ? $this->element['view'] : 'list';
     $dir = JPATH_ROOT . '/components/com_fabrik/views/' . $view . '/tmpl/';
     $dir = str_replace('\\', '/', $dir);
     $dir = str_replace('//', '/', $dir);
     if (FabrikWorker::j3()) {
         $this->element['directory'] = $this->directory = $dir;
     } else {
         $this->element['directory'] = '/components/com_fabrik/views/' . $view . '/tmpl25/';
     }
     $opts = parent::getOptions();
     foreach ($opts as &$opt) {
         $opt->value = str_replace('\\', '/', $opt->value);
         $opt->value = str_replace('//', '/', $opt->value);
         $opt->value = str_replace($dir, '', $opt->value);
         $opt->text = str_replace('\\', '/', $opt->text);
         $opt->text = str_replace('//', '/', $opt->text);
         $opt->text = str_replace($dir, '', $opt->text);
     }
     return $opts;
 }
コード例 #22
0
ファイル: view.html.php プロジェクト: jfquestiaux/fabrik
 /**
  * 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();
     $usersConfig = JComponentHelper::getParams('com_fabrik');
     $model = $this->getModel();
     $id = $input->getInt('id', $usersConfig->get('visualizationid', $input->getInt('visualizationid', 0)));
     $model->setId($id);
     $row = $model->getVisualization();
     if (!$model->canView()) {
         echo FText::_('JERROR_ALERTNOAUTHOR');
         return false;
     }
     if ($this->get('RequiredFiltersFound')) {
         $model->render();
     }
     $params = $model->getParams();
     $this->params = $params;
     $this->containerId = $this->get('ContainerId');
     $this->row = $row;
     $this->showFilters = $model->showFilters();
     $this->filters = $this->get('Filters');
     $this->filterFormURL = $this->get('FilterFormURL');
     $tpl = $j3 ? 'bootstrap' : 'default';
     $tmplpath = JPATH_ROOT . '/plugins/fabrik_visualization/coverflow/views/coverflow/tmpl/' . $tpl;
     $this->_setPath('template', $tmplpath);
     $srcs['FbListFilter'] = '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::iniRequireJs($model->getShim());
     FabrikHelperHTML::script($srcs, $js);
     echo parent::display();
 }
コード例 #23
0
ファイル: fabrik.php プロジェクト: glauberm/cinevi
 /**
  * Configure the Linkbar.
  *
  * @param   string  $vName  The name of the active view.
  *
  * @since	1.6
  *
  * @return	void
  */
 public static function addSubmenu($vName)
 {
     $vizUrl = 'index.php?option=com_fabrik&view=visualizations';
     if (FabrikWorker::j3()) {
         JHtmlSidebar::addEntry(FText::_('COM_FABRIK_SUBMENU_HOME'), 'index.php?option=com_fabrik', $vName == 'home');
         JHtmlSidebar::addEntry(FText::_('COM_FABRIK_SUBMENU_LISTS'), 'index.php?option=com_fabrik&view=lists', $vName == 'lists');
         JHtmlSidebar::addEntry(FText::_('COM_FABRIK_SUBMENU_FORMS'), 'index.php?option=com_fabrik&view=forms', $vName == 'forms');
         JHtmlSidebar::addEntry(FText::_('COM_FABRIK_SUBMENU_GROUPS'), 'index.php?option=com_fabrik&view=groups', $vName == 'groups');
         JHtmlSidebar::addEntry(FText::_('COM_FABRIK_SUBMENU_ELEMENTS'), 'index.php?option=com_fabrik&view=elements', $vName == 'elements');
         JHtmlSidebar::addEntry(FText::_('COM_FABRIK_SUBMENU_VISUALIZATIONS'), $vizUrl, $vName == 'visualizations');
         JHtmlSidebar::addEntry(FText::_('COM_FABRIK_SUBMENU_PACKAGES'), 'index.php?option=com_fabrik&view=packages', $vName == 'packages');
         JHtmlSidebar::addEntry(FText::_('COM_FABRIK_SUBMENU_CONNECTIONS'), 'index.php?option=com_fabrik&view=connections', $vName == 'connections');
         JHtmlSidebar::addEntry(FText::_('COM_FABRIK_SUBMENU_CRONS'), 'index.php?option=com_fabrik&view=crons', $vName == 'crons');
     } else {
         JSubMenuHelper::addEntry(FText::_('COM_FABRIK_SUBMENU_LISTS'), 'index.php?option=com_fabrik&view=lists', $vName == 'lists');
         JSubMenuHelper::addEntry(FText::_('COM_FABRIK_SUBMENU_FORMS'), 'index.php?option=com_fabrik&view=forms', $vName == 'forms');
         JSubMenuHelper::addEntry(FText::_('COM_FABRIK_SUBMENU_GROUPS'), 'index.php?option=com_fabrik&view=groups', $vName == 'groups');
         JSubMenuHelper::addEntry(FText::_('COM_FABRIK_SUBMENU_ELEMENTS'), 'index.php?option=com_fabrik&view=elements', $vName == 'elements');
         JSubMenuHelper::addEntry(FText::_('COM_FABRIK_SUBMENU_VISUALIZATIONS'), $vizUrl, $vName == 'visualizations');
         JSubMenuHelper::addEntry(FText::_('COM_FABRIK_SUBMENU_PACKAGES'), 'index.php?option=com_fabrik&view=packages', $vName == 'packages');
         JSubMenuHelper::addEntry(FText::_('COM_FABRIK_SUBMENU_CONNECTIONS'), 'index.php?option=com_fabrik&view=connections', $vName == 'connections');
         JSubMenuHelper::addEntry(FText::_('COM_FABRIK_SUBMENU_CRONS'), 'index.php?option=com_fabrik&view=crons', $vName == 'crons');
     }
 }
コード例 #24
0
ファイル: html.php プロジェクト: jfquestiaux/fabrik
 /**
  * Make a grid of items
  *
  * @param   array  $values              Option values
  * @param   array  $labels              Option labels
  * @param   array  $selected            Selected options
  * @param   string $name                Input name
  * @param   string $type                Checkbox/radio etc.
  * @param   bool   $elementBeforeLabel  Element before or after the label - deprecated - not used in Joomla 3
  * @param   int    $optionsPerRow       Number of suboptions to show per row
  * @param   array  $classes             Array of arrays, for 'label' and 'container' classes
  * @param   bool   $buttonGroup         Should it be rendered as a bootstrap button group (radio only)
  * @param   array  $dataAttributes      Additional array('data-foo="bar"), like YesNo needs data-toggle="button"
  * @param   array  $inputDataAttributes Input data attributes e.g. array('data-foo="bar")
  *
  * @return  string  grid
  */
 public static function grid($values, $labels, $selected, $name, $type = 'checkbox', $elementBeforeLabel = true, $optionsPerRow = 4, $classes = array(), $buttonGroup = false, $dataAttributes = array(), $inputDataAttributes = array())
 {
     if (FabrikWorker::j3()) {
         $elementBeforeLabel = true;
     }
     $containerClasses = array_key_exists('container', $classes) ? implode(' ', $classes['container']) : '';
     $dataAttributes = implode(' ', $dataAttributes);
     $items = self::gridItems($values, $labels, $selected, $name, $type, $elementBeforeLabel, $classes, $buttonGroup, $inputDataAttributes);
     $grid = array();
     $optionsPerRow = empty($optionsPerRow) ? 4 : $optionsPerRow;
     $w = floor(100 / $optionsPerRow);
     if ($buttonGroup && $type == 'radio') {
         $grid[] = '<fieldset class="' . $type . ' ' . $containerClasses . ' btn-group" ' . $dataAttributes . '>';
         foreach ($items as $i => $s) {
             $grid[] = $s;
         }
         $grid[] = '</fieldset>';
     } else {
         if (FabrikWorker::j3()) {
             $grid = self::bootstrapGrid($items, $optionsPerRow, 'fabrikgrid_' . $type);
         } else {
             $grid[] = '<ul>';
             foreach ($items as $i => $s) {
                 $clear = $i % $optionsPerRow == 0 ? 'clear:left;' : '';
                 $grid[] = '<li style="' . $clear . 'float:left;width:' . $w . '%;padding:0;margin:0;">' . $s . '</li>';
             }
             $grid[] = '</ul>';
         }
     }
     return $grid;
 }
コード例 #25
0
ファイル: _advancedsearch.php プロジェクト: LGBGit/tierno
</span></td>
				<td><?php 
    echo $row['element'] . $row['type'] . $row['grouped'];
    ?>
				</td>
				<td><?php 
    echo $row['condition'];
    ?>
</td>
				<td class='filtervalue'><?php 
    echo $row['filter'];
    ?>
</td>
				<td>
				<?php 
    if (FabrikWorker::j3()) {
        ?>
					<div class="button-group">
						<a class="advanced-search-remove-row btn btn-danger" href="#">
							<?php 
        echo FabrikHelperHTML::image('minus.png', 'list', $this->tmpl);
        ?>
						</a>
					</div>
				<?php 
    } else {
        ?>
					<ul class="fabrik_action">
					<li>
						<a class="advanced-search-remove-row" href="#">
							<?php 
コード例 #26
0
ファイル: list.php プロジェクト: jfquestiaux/fabrik
 /**
  * Create the js that manages the edit list view page
  *
  * @return  string  js
  */
 public function getJs()
 {
     $connModel = $this->getCnn();
     $item = $this->getItem();
     JText::script('COM_FABRIK_OPTIONS');
     JText::script('COM_FABRIK_JOIN');
     JText::script('COM_FABRIK_FIELD');
     JText::script('COM_FABRIK_CONDITION');
     JText::script('COM_FABRIK_VALUE');
     JText::script('COM_FABRIK_EVAL');
     JText::script('COM_FABRIK_APPLY_FILTER_TO');
     JText::script('COM_FABRIK_DELETE');
     JText::script('JYES');
     JText::script('JNO');
     JText::script('COM_FABRIK_QUERY');
     JTEXT::script('COM_FABRIK_NO_QUOTES');
     JText::script('COM_FABRIK_TEXT');
     JText::script('COM_FABRIK_TYPE');
     JText::script('COM_FABRIK_PLEASE_SELECT');
     JText::script('COM_FABRIK_GROUPED');
     JText::script('COM_FABRIK_TO');
     JText::script('COM_FABRIK_FROM');
     JText::script('COM_FABRIK_JOIN_TYPE');
     JText::script('COM_FABRIK_FROM_COLUMN');
     JText::script('COM_FABRIK_TO_COLUMN');
     JText::script('COM_FABRIK_REPEAT_GROUP_BUTTON_LABEL');
     JText::script('COM_FABRIK_PUBLISHED');
     $joinTypeOpts = array();
     $joinTypeOpts[] = array('inner', FText::_('INNER JOIN'));
     $joinTypeOpts[] = array('left', FText::_('LEFT JOIN'));
     $joinTypeOpts[] = array('right', FText::_('RIGHT JOIN'));
     $activeTableOpts[] = '';
     $activeTableOpts[] = $item->get('db_table_name');
     $joins = $this->getJoins();
     for ($i = 0; $i < count($joins); $i++) {
         $j = $joins[$i];
         $activeTableOpts[] = $j->table_join;
         $activeTableOpts[] = $j->join_from_table;
     }
     $activeTableOpts = array_unique($activeTableOpts);
     $activeTableOpts = array_values($activeTableOpts);
     $opts = new stdClass();
     $opts->joinOpts = $joinTypeOpts;
     $opts->tableOpts = $connModel->getThisTables(true);
     $opts->activetableOpts = $activeTableOpts;
     $opts->j3 = FabrikWorker::j3();
     $opts = json_encode($opts);
     $filterOpts = new stdClass();
     $filterOpts->filterJoinDd = $this->getFilterJoinDd(false, 'jform[params][filter-join][]');
     $filterOpts->filterCondDd = $this->getFilterConditionDd(false, 'jform[params][filter-conditions][]', 2);
     $filterOpts->filterAccess = JHtml::_('access.level', 'jform[params][filter-access][]', $item->access, 'class="input-small"');
     $filterOpts->filterAccess = str_replace(array("\n", "\r"), '', $filterOpts->filterAccess);
     $filterOpts->j3 = FabrikWorker::j3();
     $filterOpts = json_encode($filterOpts);
     $formModel = $this->getFormModel();
     $attribs = 'class="inputbox input-small" size="1"';
     $filterfields = $formModel->getElementList('jform[params][filter-fields][]', '', false, false, true, 'name', $attribs);
     $filterfields = addslashes(str_replace(array("\n", "\r"), '', $filterfields));
     $plugins = json_encode($this->getPlugins());
     $js = array();
     $js[] = "window.addEvent('domready', function () {";
     $js[] = "Fabrik.controller = new PluginManager({$plugins}, " . (int) $this->getItem()->id . ", 'list');";
     $js[] = "oAdminTable = new ListForm({$opts});";
     $js[] = "oAdminTable.watchJoins();";
     for ($i = 0; $i < count($joins); $i++) {
         $joinGroupParams = json_decode($joins[$i]->params);
         $j = $joins[$i];
         $joinFormFields = json_encode($j->joinFormFields);
         $joinToFields = json_encode($j->joinToFields);
         $repeat = $joinGroupParams->repeat_group_button == 1 ? 1 : 0;
         $js[] = "\toAdminTable.addJoin('{$j->group_id}','{$j->id}','{$j->join_type}','{$j->table_join}'," . "'{$j->table_key}','{$j->table_join_key}','{$j->join_from_table}', {$joinFormFields}, {$joinToFields}, {$repeat});";
     }
     $js[] = "oAdminFilters = new adminFilters('filterContainer', '{$filterfields}', {$filterOpts});";
     $form = $this->getForm();
     $afilterJoins = $form->getValue('params.filter-join');
     // Force to arrays as single prefilters imported from 2.x will be stored as string values
     $filterFields = (array) $form->getValue('params.filter-fields');
     $afilterConditions = (array) $form->getValue('params.filter-conditions');
     $afilterEval = (array) $form->getValue('params.filter-eval');
     $afilterValues = (array) $form->getValue('params.filter-value');
     $afilterAccess = (array) $form->getValue('params.filter-access');
     $aGrouped = (array) $form->getValue('params.filter-grouped');
     for ($i = 0; $i < count($filterFields); $i++) {
         $selJoin = FArrayHelper::getValue($afilterJoins, $i, 'and');
         // 2.0 upgraded sites had quoted filter names
         $selFilter = str_replace('`', '', $filterFields[$i]);
         $grouped = FArrayHelper::getValue($aGrouped, $i, 0);
         $selCondition = $afilterConditions[$i];
         $filerEval = (int) FArrayHelper::getValue($afilterEval, $i, '1');
         if ($selCondition == '&gt;') {
             $selCondition = '>';
         }
         if ($selCondition == '&lt;') {
             $selCondition = '<';
         }
         $selValue = FArrayHelper::getValue($afilterValues, $i, '');
         $selAccess = $afilterAccess[$i];
         // Allow for multi-line js variables ?
         $selValue = htmlspecialchars_decode($selValue, ENT_QUOTES);
         $selValue = json_encode($selValue);
         // No longer check for empty $selFilter as EXISTS pre-filter condition doesn't require element to be selected
         $js[] = "\toAdminFilters.addFilterOption('{$selJoin}', '{$selFilter}', '{$selCondition}', {$selValue}, '{$selAccess}', {$filerEval}, '{$grouped}');\n";
     }
     $js[] = "});";
     return implode("\n", $js);
 }
コード例 #27
0
ファイル: yesno.php プロジェクト: jfquestiaux/fabrik
 /**
  * Should the grid be rendered as a Bootstrap button-group
  *
  * @since 3.1
  *
  * @return  bool
  */
 protected function buttonGroup()
 {
     $params = $this->getParams();
     $ok = FabrikWorker::j3() && $params->get('btnGroup', true);
     return $ok;
 }
コード例 #28
0
ファイル: view.html.php プロジェクト: ppantilla/bbninja
    /**
     * 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();
        $package = $app->getUserState('com_fabrik.package', 'fabrik');
        $input = $app->input;
        $j3 = FabrikWorker::j3();
        $Itemid = FabrikWorker::itemId();
        $model = $this->getModel();
        $usersConfig = JComponentHelper::getParams('com_fabrik');
        $id = $input->get('id', $usersConfig->get('visualizationid', $input->get('visualizationid', 0)));
        $model->setId($id);
        $this->row = $model->getVisualization();
        $params = $model->getParams();
        $this->params = $params;
        $this->containerId = $model->getJSRenderContext();
        $this->filters = $this->get('Filters');
        $this->showFilters = $model->showFilters();
        $this->showTitle = $input->getInt('show-title', 1);
        $this->filterFormURL = $this->get('FilterFormURL');
        $calendar = $this->row;
        JHTML::stylesheet('media/com_fabrik/css/list.css');
        $this->canAdd = (bool) $params->get('calendar-read-only', 0) == 1 ? false : $model->getCanAdd();
        $this->requiredFiltersFound = $this->get('RequiredFiltersFound');
        if ($params->get('calendar_show_messages', '1') == '1' && $this->canAdd && $this->requiredFiltersFound) {
            $msg = JText::_('PLG_VISUALIZATION_CALENDAR_DOUBLE_CLICK_TO_ADD');
            $msg .= $model->getDateLimitsMsg();
            $app->enqueueMessage($msg);
        }
        JHTML::stylesheet('media/com_fabrik/css/list.css');
        // Get all list where statements - which are then included in the ajax call to ensure we get the correct data set loaded
        $urlfilters = new stdClass();
        $urlfilters->where = $model->buildQueryWhere();
        $urls = new stdClass();
        // Don't JRoute as its wont load with sef?
        $urls->del = 'index.php?option=com_' . $package . '&controller=visualization.calendar&view=visualization&task=deleteEvent&format=raw&Itemid=' . $Itemid . '&id=' . $id;
        $urls->add = 'index.php?option=com_' . $package . '&view=visualization&format=raw&Itemid=' . $Itemid . '&id=' . $id;
        $user = JFactory::getUser();
        $legend = $params->get('show_calendar_legend', 0) ? $model->getLegend() : '';
        $tpl = $j3 ? 'bootstrap' : 'default';
        $tpl = $params->get('calendar_layout', $j3);
        $options = new stdClass();
        $options->url = $urls;
        $options->dateLimits = $model->getDateLimits();
        $options->deleteables = $model->getDeleteAccess();
        $options->eventLists = $model->getEventLists();
        $options->calendarId = $calendar->id;
        $options->popwiny = $params->get('yoffset', 0);
        $options->urlfilters = $urlfilters;
        $options->canAdd = $this->canAdd;
        $options->showFullDetails = (bool) $params->get('show_full_details', false);
        $options->restFilterStart = FabrikWorker::getMenuOrRequestVar('resetfilters', 0, false, 'request');
        $options->tmpl = $tpl;
        $o = $model->getAddStandardEventFormInfo();
        if ($o != null) {
            $options->listid = $o->id;
        }
        // $$$rob @TODO not sure this is need - it isn't in the timeline viz
        $model->setRequestFilters();
        $options->filters = $model->filters;
        // End not sure
        $options->Itemid = $Itemid;
        $options->show_day = (bool) $params->get('show_day', true);
        $options->show_week = (bool) $params->get('show_week', true);
        $options->days = array(JText::_('SUNDAY'), JText::_('MONDAY'), JText::_('TUESDAY'), JText::_('WEDNESDAY'), JText::_('THURSDAY'), JText::_('FRIDAY'), JText::_('SATURDAY'));
        $options->shortDays = array(JText::_('SUN'), JText::_('MON'), JText::_('TUE'), JText::_('WED'), JText::_('THU'), JText::_('FRI'), JText::_('SAT'));
        $options->months = array(JText::_('JANUARY'), JText::_('FEBRUARY'), JText::_('MARCH'), JText::_('APRIL'), JText::_('MAY'), JText::_('JUNE'), JText::_('JULY'), JText::_('AUGUST'), JText::_('SEPTEMBER'), JText::_('OCTOBER'), JText::_('NOVEMBER'), JText::_('DECEMBER'));
        $options->shortMonths = array(JText::_('JANUARY_SHORT'), JText::_('FEBRUARY_SHORT'), JText::_('MARCH_SHORT'), JText::_('APRIL_SHORT'), JText::_('MAY_SHORT'), JText::_('JUNE_SHORT'), JText::_('JULY_SHORT'), JText::_('AUGUST_SHORT'), JText::_('SEPTEMBER_SHORT'), JText::_('OCTOBER_SHORT'), JText::_('NOVEMBER_SHORT'), JText::_('DECEMBER_SHORT'));
        $options->first_week_day = (int) $params->get('first_week_day', 0);
        $options->monthday = new stdClass();
        $options->monthday->width = (int) $params->get('calendar-monthday-width', 90);
        $options->monthday->height = (int) $params->get('calendar-monthday-height', 80);
        $options->greyscaledweekend = $params->get('greyscaled-week-end', 0) === '1';
        $options->viewType = $params->get('calendar_default_view', 'monthView');
        $options->weekday = new stdClass();
        $options->weekday->width = (int) $params->get('calendar-weekday-width', 90);
        $options->weekday->height = (int) $params->get('calendar-weekday-height', 10);
        $options->open = (int) $params->get('open-hour', 0);
        $options->close = (int) $params->get('close-hour', 24);
        $options->showweekends = (bool) $params->get('calendar-show-weekends', true);
        $options->readonly = (bool) $params->get('calendar-read-only', false);
        $options->timeFormat = $params->get('time_format', '%X');
        $options->readonlyMonth = (bool) $params->get('readonly_monthview', false);
        $options->j3 = FabrikWorker::j3();
        if (FabrikWorker::j3()) {
            $options->buttons = new stdClass();
            $options->buttons->del = '<button class="btn popupDelete" data-task="deleteCalEvent"><i class="icon-delete"></i></button>';
            $options->buttons->edit = '<button class="btn popupEdit" data-task="editCalEvent"><i class="icon-edit"></i></button>';
            $options->buttons->view = '<button class="btn popupView" data-task="viewCalEvent"><i class="icon-eye"></i></button>';
        } else {
            $src = COM_FABRIK_LIVESITE . 'plugins/fabrik_visualization/calendar/views/calendar/tmpl/' . $tpl . '/images/minus-sign.png';
            $options->buttons = '<img src="' . $src . '"
				alt = "del" class="fabrikDeleteEvent" />' . JText::_('PLG_VISUALIZATION_CALENDAR_DELETE');
        }
        $json = json_encode($options);
        JText::script('PLG_VISUALIZATION_CALENDAR_NEXT');
        JText::script('PLG_VISUALIZATION_CALENDAR_PREVIOUS');
        JText::script('PLG_VISUALIZATION_CALENDAR_DAY');
        JText::script('PLG_VISUALIZATION_CALENDAR_WEEK');
        JText::script('PLG_VISUALIZATION_CALENDAR_MONTH');
        JText::script('PLG_VISUALIZATION_CALENDAR_KEY');
        JText::script('PLG_VISUALIZATION_CALENDAR_TODAY');
        JText::script('PLG_VISUALIZATION_CALENDAR_CONF_DELETE');
        JText::script('PLG_VISUALIZATION_CALENDAR_DELETE');
        JText::script('PLG_VISUALIZATION_CALENDAR_VIEW');
        JText::script('PLG_VISUALIZATION_CALENDAR_EDIT');
        JText::script('PLG_VISUALIZATION_CALENDAR_ADD_EDIT_EVENT');
        JText::script('COM_FABRIK_FORM_SAVED');
        JText::script('PLG_VISUALIZATION_CALENDAR_EVENT_START_END');
        JText::script('PLG_VISUALIZATION_CALENDAR_DATE_ADD_TOO_LATE');
        JText::script('PLG_VISUALIZATION_CALENDAR_DATE_ADD_TOO_EARLY');
        $ref = $model->getJSRenderContext();
        $js = array();
        $js[] = "\tvar {$ref} = new fabrikCalendar('{$ref}');";
        $js[] = "\t{$ref}.render({$json});";
        $js[] = "\tFabrik.addBlock('" . $ref . "', {$ref});";
        $js[] = "\t" . $legend . "";
        $js[] = "" . $model->getFilterJs();
        $js = implode("\n", $js);
        $srcs = FabrikHelperHTML::framework();
        $srcs[] = 'media/com_fabrik/js/listfilter.js';
        $srcs[] = 'plugins/fabrik_visualization/calendar/calendar.js';
        FabrikHelperHTML::iniRequireJs($model->getShim());
        FabrikHelperHTML::script($srcs, $js);
        $viewName = $this->getName();
        $this->params = $model->getParams();
        $tpl = $params->get('calendar_layout', $tpl);
        $tmplpath = JPATH_ROOT . '/plugins/fabrik_visualization/calendar/views/calendar/tmpl/' . $tpl;
        $this->_setPath('template', $tmplpath);
        FabrikHelperHTML::stylesheetFromPath('plugins/fabrik_visualization/calendar/views/calendar/tmpl/' . $tpl . '/template.css');
        // Adding custom.css, just for the heck of it
        FabrikHelperHTML::stylesheetFromPath('plugins/fabrik_visualization/calendar/views/calendar/tmpl/' . $tpl . '/custom.css');
        return parent::display();
    }
コード例 #29
0
ファイル: elementlist.php プロジェクト: ankaau/GathBandhan
 /**
  * Should the grid be rendered as a Bootstrap button-group
  *
  * @since 3.1
  *
  * @return  bool
  */
 protected function buttonGroup()
 {
     $params = $this->getParams();
     return FabrikWorker::j3() && $params->get('btnGroup', false);
 }
コード例 #30
0
ファイル: view.base.php プロジェクト: ppantilla/bbninja
 /**
  * Display the template
  *
  * @param   sting  $tpl  template
  *
  * @return void
  */
 public function display($tpl = null)
 {
     if ($this->getLayout() == '_advancedsearch') {
         $this->advancedSearch($tpl);
         return;
     }
     $fbConfig = JComponentHelper::getParams('com_fabrik');
     $profiler = JProfiler::getInstance('Application');
     $app = JFactory::getApplication();
     $input = $app->input;
     $model = $this->getModel();
     // Force front end templates
     $tmpl = $model->getTmpl();
     $this->_basePath = COM_FABRIK_FRONTEND . '/views';
     $jTmplFolder = FabrikWorker::j3() ? 'tmpl' : 'tmpl25';
     $this->addTemplatePath($this->_basePath . '/' . $this->_name . '/' . $jTmplFolder . '/' . $tmpl);
     $root = $app->isAdmin() ? JPATH_ADMINISTRATOR : JPATH_SITE;
     $this->addTemplatePath($root . '/templates/' . $app->getTemplate() . '/html/com_fabrik/list/' . $tmpl);
     $user = JFactory::getUser();
     $document = JFactory::getDocument();
     $item = $model->getTable();
     $data = $model->render();
     $w = new FabrikWorker();
     // Add in some styling short cuts
     $c = 0;
     $form = $model->getFormModel();
     $nav = $model->getPagination();
     foreach ($data as $groupk => $group) {
         $last_pk = '';
         $last_i = 0;
         $num_rows = 1;
         foreach (array_keys($group) as $i) {
             $o = new stdClass();
             // $$$ rob moved merge wip code to FabrikModelTable::formatForJoins() - should contain fix for pagination
             $o->data = $data[$groupk][$i];
             $o->cursor = $num_rows + $nav->limitstart;
             $o->total = $nav->total;
             $o->id = 'list_' . $model->getRenderContext() . '_row_' . @$o->data->__pk_val;
             $o->class = 'fabrik_row oddRow' . $c;
             $data[$groupk][$i] = $o;
             $c = 1 - $c;
             $num_rows++;
         }
     }
     $groups = $form->getGroupsHiarachy();
     foreach ($groups as $groupModel) {
         $elementModels = $groupModel->getPublishedElements();
         foreach ($elementModels as $elementModel) {
             $elementModel->setContext($groupModel, $form, $model);
             $rowclass = $elementModel->setRowClass($data);
         }
     }
     $this->rows = $data;
     reset($this->rows);
     // Cant use numeric key '0' as group by uses grouped name as key
     $firstRow = current($this->rows);
     $this->requiredFiltersFound = $model->getRequiredFiltersFound();
     $this->advancedSearch = $model->getAdvancedSearchLink();
     $this->advancedSearchURL = $model->getAdvancedSearchURL();
     $this->nodata = empty($this->rows) || count($this->rows) == 1 && empty($firstRow) || !$this->requiredFiltersFound ? true : false;
     $this->tableStyle = $this->nodata ? 'display:none' : '';
     $this->emptyStyle = $this->nodata ? '' : 'display:none';
     $params = $model->getParams();
     if (!$this->access($model)) {
         return false;
     }
     if (!class_exists('JSite')) {
         require_once JPATH_ROOT . '/includes/application.php';
     }
     $app = JFactory::getApplication();
     $package = $app->getUserState('com_fabrik.package', 'fabrik');
     $this->setTitle($w, $params, $model);
     // Deprecated (keep in case people use them in old templates)
     $this->table = new stdClass();
     $this->table->label = FabrikString::translate($w->parseMessageForPlaceHolder($item->label, $_REQUEST));
     $this->table->intro = $params->get('show_into', 1) == 0 ? '' : FabrikString::translate($w->parseMessageForPlaceHolder($item->introduction));
     $this->table->outro = $params->get('show_outro', 1) == 0 ? '' : FabrikString::translate($w->parseMessageForPlaceHolder($params->get('outro')));
     $this->table->id = $item->id;
     $this->table->renderid = $model->getRenderContext();
     $this->table->db_table_name = $item->db_table_name;
     // End deprecated
     $this->list = $this->table;
     $this->list->class = $model->htmlClass();
     $this->group_by = $item->group_by;
     $this->form = new stdClass();
     $this->form->id = $item->form_id;
     $this->renderContext = $model->getRenderContext();
     $this->formid = 'listform_' . $this->renderContext;
     $form = $model->getFormModel();
     $this->table->action = $model->getTableAction();
     $this->showCSV = $model->canCSVExport();
     $this->showCSVImport = $model->canCSVImport();
     $this->toggleCols = $model->toggleCols();
     $this->showToggleCols = (bool) $params->get('toggle_cols', false);
     $this->canGroupBy = $model->canGroupBy();
     $this->navigation = $nav;
     $this->nav = $input->getInt('fabrik_show_nav', $params->get('show-table-nav', 1)) ? $nav->getListFooter($this->renderContext, $model->getTmpl()) : '';
     $this->nav = '<div class="fabrikNav">' . $this->nav . '</div>';
     $this->fabrik_userid = $user->get('id');
     $this->canDelete = $model->deletePossible() ? true : false;
     $this->limitLength = $model->limitLength;
     $this->ajax = $model->isAjax();
     // 3.0 observed in list.js & html moved into fabrik_actions rollover
     $this->showPDF = $params->get('pdf', $fbConfig->get('list_pdf', false));
     if ($this->showPDF) {
         FabrikWorker::canPdf();
     }
     $this->emptyLink = $model->canEmpty() ? '#' : '';
     $this->csvImportLink = $this->showCSVImport ? JRoute::_('index.php?option=com_' . $package . '&view=import&filetype=csv&listid=' . $item->id) : '';
     $this->showAdd = $model->canAdd();
     if ($this->showAdd) {
         if ($params->get('show-table-add', 1)) {
             $this->addRecordLink = $model->getAddRecordLink();
         } else {
             $this->showAdd = false;
         }
     }
     $this->addLabel = $model->addLabel();
     $this->showRSS = $params->get('rss', 0) == 0 ? 0 : 1;
     if ($this->showRSS) {
         $this->rssLink = $model->getRSSFeedLink();
         if ($this->rssLink != '') {
             $attribs = array('type' => 'application/rss+xml', 'title' => 'RSS 2.0');
             $document->addHeadLink($this->rssLink, 'alternate', 'rel', $attribs);
         }
     }
     if ($app->isAdmin()) {
         // Admin always uses com_fabrik option
         $this->pdfLink = JRoute::_('index.php?option=com_fabrik&task=list.view&listid=' . $item->id . '&format=pdf&tmpl=component');
     } else {
         $pdfLink = 'index.php?option=com_' . $package . '&view=list&format=pdf&listid=' . $item->id;
         if (!$this->nodata) {
             // If some data is shown then ensure that menu links reset filters (combined with require filters) doesn't produce an empty data set for the pdf
             $pdfLink .= '&resetfilters=0';
         }
         $this->pdfLink = JRoute::_($pdfLink);
     }
     list($this->headings, $groupHeadings, $this->headingClass, $this->cellClass) = $model->getHeadings();
     $this->groupByHeadings = $model->getGroupByHeadings();
     $this->filter_action = $model->getFilterAction();
     JDEBUG ? $profiler->mark('fabrik getfilters start') : null;
     $this->filters = $model->getFilters('listform_' . $this->renderContext);
     $fKeys = array_keys($this->filters);
     $this->bootShowFilters = count($fKeys) === 1 && $fKeys[0] === 'all' ? false : true;
     $this->clearFliterLink = $model->getClearButton();
     JDEBUG ? $profiler->mark('fabrik getfilters end') : null;
     $this->filterMode = (int) $params->get('show-table-filters');
     $this->toggleFilters = $this->filterMode == 2 || $this->filterMode == 4;
     $this->showFilters = $model->getShowFilters();
     $this->filterCols = (int) $params->get('list_filter_cols', '1');
     $this->showClearFilters = $this->showFilters || $params->get('advanced-filter') ? true : false;
     $this->emptyDataMessage = $model->getEmptyDataMsg();
     $this->groupheadings = $groupHeadings;
     $this->calculations = $this->_getCalculations($this->headings);
     $this->isGrouped = !($model->getGroupBy() == '');
     $this->colCount = count($this->headings);
     $this->hasButtons = $model->getHasButtons();
     $this->grouptemplates = $model->groupTemplates;
     $this->params = $params;
     $this->loadTemplateBottom();
     $this->getManagementJS($this->rows);
     // Get dropdown list of other tables for quick nav in admin
     $this->tablePicker = $app->isAdmin() && $app->input->get('format') !== 'pdf' ? FabrikHelperHTML::tableList($this->table->id) : '';
     $this->buttons();
     $this->pluginTopButtons = $model->getPluginTopButtons();
 }