本文整理汇总了PHP中FabrikWorker::itemId方法的典型用法代码示例。如果您正苦于以下问题:PHP FabrikWorker::itemId方法的具体用法?PHP FabrikWorker::itemId怎么用?PHP FabrikWorker::itemId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FabrikWorker
的用法示例。
在下文中一共展示了FabrikWorker::itemId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getMedia
/**
* Get Media
*
* @return string
*/
public function getMedia()
{
$itemId = FabrikWorker::itemId();
$params = $this->getParams();
$w = $params->get('media_width');
$h = $params->get('media_height');
$return = '';
if ($params->get('media_which_player', 'jw') == 'xspf') {
$player_type = "Extended";
$playerUrl = COM_FABRIK_LIVESITE . $this->srcBase . "media/libs/xspf/{$player_type}/xspf_player.swf";
$playlistUrl = 'index.php?option=com_' . $this->package . '&controller=visualization.media&view=visualization&task=getPlaylist&format=raw&Itemid=' . $itemId . '&visualizationid=' . $this->getId();
$playlistUrl = urlencode($playlistUrl);
$return = '<object type="application/x-shockwave-flash" width="400" height="170" data="' . $playerUrl . '?playlist_url=' . $playlistUrl . '">';
$return .= '<param name="movie" value="xspf_player.swf?playlist_url=' . $playlistUrl . '" />';
$return .= '</object>';
} else {
$return = "<div id='jw_player'></div>";
}
return $return;
}
示例2: printURL
/**
* Create print URL
*
* @param object $formModel form model
*
* @since 3.0.6
*
* @return string
*/
public static function printURL($formModel)
{
$app = JFactory::getApplication();
$input = $app->input;
$form = $formModel->getForm();
$package = $app->getUserState('com_fabrik.package', 'fabrik');
$table = $formModel->getTable();
if ($app->isAdmin()) {
$url = 'index.php?option=com_' . $package . '&task=details.view&tmpl=component&formid=' . $form->id . '&listid=' . $table->id . '&rowid=' . $formModel->getRowId() . '&iframe=1&print=1';
} else {
//$this->pdfURL = 'index.php?option=com_' . $this->package . '&view=details&formid=' . $model->getId() . '&rowid=' . $model->getRowId() . '&format=pdf';
$url = COM_FABRIK_LIVESITE . 'index.php?option=com_' . $package . '&view=details&tmpl=component&formid=' . $form->id . '&listid=' . $table->id . '&rowid=' . $formModel->getRowId() . '&iframe=1&print=1';
$url .= '&Itemid=' . FabrikWorker::itemId();
}
/* $$$ hugh - @TODO - FIXME - if they were using rowid=-1, we don't need this, as rowid has already been transmogrified
* to the correct (PK based) rowid. but how to tell if original rowid was -1???
*/
if ($input->get('usekey') !== null) {
$url .= '&usekey=' . $input->get('usekey');
}
$url = JRoute::_($url);
// $$$ rob for some reason JRoute wasn't doing this ???
//$url = str_replace('&', '&', $url);
self::$printURL = $url;
return self::$printURL;
}
示例3: display
/**
* Execute and display a template script.
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return mixed A string if successful, otherwise a JError object.
*/
public function display($tpl = 'default')
{
$app = JFactory::getApplication();
$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');
}
//.........这里部分代码省略.........
示例4: makeRedirect
/**
* Generic function to redirect
*
* @param object &$model form model
* @param string $msg redirection message to show
*
* @return string redirect url
*/
protected function makeRedirect(&$model, $msg = null)
{
$app = JFactory::getApplication();
$package = $app->getUserState('com_fabrik.package', 'fabrik');
$input = $app->input;
$formId = $input->getInt('formid');
$listId = $input->getInt('listid');
$rowId = $input->getString('rowid', '', 'string');
if (is_null($msg)) {
$msg = FText::_('COM_FABRIK_RECORD_ADDED_UPDATED');
}
if ($app->isAdmin()) {
// Admin option is always com_fabrik
if (array_key_exists('apply', $model->formData)) {
$url = 'index.php?option=com_fabrik&c=form&task=form&formid=' . $formId . '&listid=' . $listId . '&rowid=' . $rowId;
} else {
$url = 'index.php?option=com_fabrik&c=table&task=viewTable&cid[]=' . $model->getTable()->id;
}
$this->setRedirect($url, $msg);
} else {
if (array_key_exists('apply', $model->formData)) {
$url = 'index.php?option=com_' . $package . '&c=form&view=form&formid=' . $formId . '&rowid=' . $rowId . '&listid=' . $listId;
} else {
if ($this->isMambot) {
// Return to the same page
$url = FArrayHelper::getValue($_SERVER, 'REQUEST_URI', 'index.php');
} else {
// Return to the page that called the form
$url = $input->get('fabrik_referrer', 'index.php', 'string');
}
$itemId = FabrikWorker::itemId();
if ($url == '') {
$url = 'index.php?option=com_' . $package . '&Itemid=' . $itemId;
}
}
$config = JFactory::getConfig();
if ($config->get('sef')) {
$url = JRoute::_($url);
}
$this->setRedirect($url, $msg);
}
}
示例5: loadTemplateBottom
/**
* Get the table's forms hidden fields
*
* @return string hidden fields
*/
protected function loadTemplateBottom()
{
$app = JFactory::getApplication();
$input = $app->input;
$Itemid = FabrikWorker::itemId();
$model = $this->getModel();
$item = $model->getTable();
$reffer = str_replace('&', '&', $input->server->get('REQUEST_URI', '', 'string'));
$reffer = FabrikString::removeQSVar($reffer, 'fabrik_incsessionfilters');
$this->hiddenFields = array();
// $$$ rob 15/12/2011 - if in com_content then doing this means you cant delete rows
$this->hiddenFields[] = '<input type="hidden" name="option" value="' . $input->get('option', 'com_fabrik') . '" />';
// $$$ rob 28/12/2011 but when using com_content as a value you cant filter!
// $this->hiddenFields[] = '<input type="hidden" name="option" value="com_fabrik" />';
$this->hiddenFields[] = '<input type="hidden" name="orderdir" value="' . $input->get('orderdir') . '" />';
$this->hiddenFields[] = '<input type="hidden" name="orderby" value="' . $input->get('orderby') . '" />';
// $$$ rob if the content plugin has temporarily set the view to list then get view from origview var, if that doesn't exist
// revert to view var. Used when showing table in article/blog layouts
$view = $input->get('origview', $input->get('view', 'list'));
$this->hiddenFields[] = '<input type="hidden" name="view" value="' . $view . '" />';
$this->hiddenFields[] = '<input type="hidden" name="listid" value="' . $item->id . '"/>';
$this->hiddenFields[] = '<input type="hidden" name="listref" value="' . $this->renderContext . '"/>';
$this->hiddenFields[] = '<input type="hidden" name="Itemid" value="' . $Itemid . '"/>';
// Removed in favour of using list_{id}_limit dropdown box
$this->hiddenFields[] = '<input type="hidden" name="fabrik_referrer" value="' . $reffer . '" />';
$this->hiddenFields[] = JHTML::_('form.token');
$this->hiddenFields[] = '<input type="hidden" name="format" value="html" />';
// $packageId = $input->getInt('packageId', 0);
// $$$ rob testing for ajax table in module
$packageId = $model->packageId;
$this->hiddenFields[] = '<input type="hidden" name="packageId" value="' . $packageId . '" />';
if ($app->isAdmin()) {
$this->hiddenFields[] = '<input type="hidden" name="task" value="list.view" />';
} else {
$this->hiddenFields[] = '<input type="hidden" name="task" value="" />';
}
$this->hiddenFields[] = '<input type="hidden" name="fabrik_listplugin_name" value="" />';
$this->hiddenFields[] = '<input type="hidden" name="fabrik_listplugin_renderOrder" value="" />';
// $$$ hugh - added this so plugins have somewhere to stuff any random data they need during submit
$this->hiddenFields[] = '<input type="hidden" name="fabrik_listplugin_options" value="" />';
$this->hiddenFields[] = '<input type="hidden" name="incfilters" value="1" />';
// $$$ hugh - testing social profile hash stuff
if ($input->get('fabrik_social_profile_hash', '') != '') {
$this->hiddenFields[] = '<input type="hidden" name="fabrik_social_profile_hash" value="' . $input->get('fabrik_social_profile_hash', '', 'string') . '" />';
}
$this->hiddenFields = implode("\n", $this->hiddenFields);
}
示例6: jsOptions
/**
* Get Js Options
*
* @return stdClass
* @throws Exception
*/
private function jsOptions()
{
$model = $this->getModel();
$app = JFactory::getApplication();
$package = $app->getUserState('com_fabrik.package', 'fabrik');
$params = $model->getParams();
$Itemid = FabrikWorker::itemId();
$urls = new stdClass();
$calendar = $this->row;
$j3 = FabrikWorker::j3();
$tpl = $params->get('fullcalendar_layout', $j3);
// 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();
// Don't JRoute as its wont load with sef?
$urls->del = 'index.php?option=com_' . $package . '&controller=visualization.fullcalendar&view=visualization&task=deleteEvent&format=raw&Itemid=' . $Itemid . '&id=' . $model->getId();
$urls->add = 'index.php?option=com_' . $package . '&view=visualization&format=raw&Itemid=' . $Itemid . '&id=' . $model->getId();
$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;
// $$$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->default_view = $params->get('fullcalendar_default_view', 'month');
$options->add_type = $params->get('add_type', 'both');
$options->time_format = $params->get('time_format', 'H(:mm)');
$options->first_week_day = (int) $params->get('first_week_day', 0);
$options->minDuration = $params->get('minimum_duration', "00:30:00");
$options->open = $params->get('open-hour', "00:00:00");
$options->close = $params->get('close-hour', "23:59:59");
$options->lang = FabrikWorker::getShortLang();
$options->showweekends = (bool) $params->get('show-weekends', true);
$options->greyscaledweekend = (bool) $params->get('greyscaled-weekend', false);
$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();
$options->calOptions = $params->get('calOptions', '{}');
$options->startOffset = (int) $params->get('startdate_hour_offset', '0');
return $options;
}
示例7: onLastProcess
/**
* Process the plugin, called after form is submitted
*
* @return bool
*/
public function onLastProcess()
{
$formModel = $this->getModel();
$params = $this->getParams();
$context = $formModel->getRedirectContext();
// Get existing session params
$surl = (array) $this->session->get($context . 'url', array());
$stitle = (array) $this->session->get($context . 'title', array());
$smsg = (array) $this->session->get($context . 'msg', array());
$sshowsystemmsg = (array) $this->session->get($context . 'showsystemmsg', array());
$this->formModel = $formModel;
$w = new FabrikWorker();
$form = $formModel->getForm();
$this->data = $this->getProcessData();
$this->data['append_jump_url'] = $params->get('append_jump_url');
$this->data['save_and_next'] = $params->get('save_and_next', '0');
$this->data['save_in_session'] = $params->get('save_insession');
$this->data['jump_page'] = $w->parseMessageForPlaceHolder($params->get('jump_page'), $this->data);
$this->data['thanks_message'] = $w->parseMessageForPlaceHolder($params->get('thanks_message'), $this->data);
if (!$this->shouldRedirect($params)) {
// Clear any session redirects
unset($surl[$this->renderOrder]);
unset($stitle[$this->renderOrder]);
unset($smsg[$this->renderOrder]);
unset($sshowsystemmsg[$this->renderOrder]);
$this->session->set($context . 'url', $surl);
$this->session->set($context . 'title', $stitle);
$this->session->set($context . 'msg', $smsg);
$this->session->set($context . 'showsystemmsg', $sshowsystemmsg);
return true;
}
$this->_storeInSession();
$sshowsystemmsg[$this->renderOrder] = true;
$this->session->set($context . 'showsystemmsg', $sshowsystemmsg);
if ($this->data['save_and_next'] === '1') {
$navIds = $this->getNavIds();
$next_rowid = $navIds->next == $navIds->last ? '' : '&rowid=' . $navIds->next;
$itemId = FabrikWorker::itemId();
if ($this->app->isAdmin()) {
$url = 'index.php?option=com_' . $this->package . '&task=form.view&formid=' . $form->id . $keyIdentifier;
} else {
$url = 'index.php?option=com_' . $this->package . '&view=form&Itemid=' . $itemId . '&formid=' . $form->id . '&listid=' . $formModel->getListModel()->getId();
}
$url .= $next_rowid;
$this->data['jump_page'] = JRoute::_($url);
}
if ($this->data['jump_page'] != '') {
$this->data['jump_page'] = $this->buildJumpPage();
// 3.0 ajax/module redirect logic handled in form controller not in plugin
$surl[$this->renderOrder] = $this->data['jump_page'];
$this->session->set($context . 'url', $surl);
$this->session->set($context . 'redirect_content_how', $params->get('redirect_content_how', 'popup'));
$this->session->set($context . 'redirect_content_popup_width', $params->get('redirect_content_popup_width', '300'));
$this->session->set($context . 'redirect_content_popup_height', $params->get('redirect_content_popup_height', '300'));
$this->session->set($context . 'redirect_content_popup_x_offset', $params->get('redirect_content_popup_x_offset', '0'));
$this->session->set($context . 'redirect_content_popup_y_offset', $params->get('redirect_content_popup_y_offset', '0'));
$this->session->set($context . 'redirect_content_popup_title', $params->get('redirect_content_popup_title', ''));
$this->session->set($context . 'redirect_content_popup_reset_form', $params->get('redirect_content_popup_reset_form', '1'));
} else {
$msg = $this->data['thanks_message'];
// Redirect not working in admin.
if (!$this->app->isAdmin()) {
$sshowsystemmsg[$this->renderOrder] = false;
$this->session->set($context . 'showsystemmsg', $sshowsystemmsg);
$stitle[$this->renderOrder] = $form->label;
$this->session->set($context . 'title', $stitle);
$surl[$this->renderOrder] = 'index.php?option=com_' . $this->package . '&view=plugin&g=form&plugin=redirect&method=displayThanks&task=pluginAjax';
$this->session->set($context . 'url', $surl);
}
}
$smsg[$this->renderOrder] = $this->data['thanks_message'];
// Don't display system message if thanks is empty
if (FArrayHelper::getValue($this->data, 'thanks_message', '') !== '') {
$this->session->set($context . 'msg', $smsg);
}
return true;
}
示例8: display
/**
* Display the Feed
*
* @param sting $tpl template
*
* @return void
*/
public function display($tpl = null)
{
$input = $this->app->input;
$itemId = FabrikWorker::itemId();
$model = $this->getModel();
$model->setOutPutFormat('feed');
$this->doc->_itemTags = array();
$table = $model->getTable();
$model->render();
$params = $model->getParams();
if ($params->get('rss') == '0') {
return '';
}
$formModel = $model->getFormModel();
$form = $formModel->getForm();
$aJoinsToThisKey = $model->getJoinsToThisKey();
// Get headings
$aTableHeadings = array();
$groupModels = $formModel->getGroupsHiarachy();
foreach ($groupModels as $groupModel) {
$elementModels = $groupModel->getPublishedElements();
foreach ($elementModels as $elementModel) {
$element = $elementModel->getElement();
$elParams = $elementModel->getParams();
if ($elParams->get('show_in_rss_feed') == '1') {
$heading = $element->label;
if ($elParams->get('show_label_in_rss_feed') == '1') {
$aTableHeadings[$heading]['label'] = $heading;
} else {
$aTableHeadings[$heading]['label'] = '';
}
$aTableHeadings[$heading]['colName'] = $elementModel->getFullName();
$aTableHeadings[$heading]['dbField'] = $element->name;
$aTableHeadings[$heading]['key'] = $elParams->get('use_as_fake_key');
}
}
}
foreach ($aJoinsToThisKey as $element) {
$element = $elementModel->getElement();
$elParams = new JRegistry($element->attribs);
if ($elParams->get('show_in_rss_feed') == '1') {
$heading = $element->label;
if ($elParams->get('show_label_in_rss_feed') == '1') {
$aTableHeadings[$heading]['label'] = $heading;
} else {
$aTableHeadings[$heading]['label'] = '';
}
$aTableHeadings[$heading]['colName'] = $element->db_table_name . "___" . $element->name;
$aTableHeadings[$heading]['dbField'] = $element->name;
$aTableHeadings[$heading]['key'] = $elParams->get('use_as_fake_key');
}
}
$w = new FabrikWorker();
$rows = $model->getData();
$this->doc->title = $w->parseMessageForPlaceHolder($table->label, $_REQUEST);
$this->doc->description = htmlspecialchars(trim(strip_tags($w->parseMessageForPlaceHolder($table->introduction, $_REQUEST))));
$this->doc->link = JRoute::_('index.php?option=com_' . $this->package . '&view=list&listid=' . $table->id . '&Itemid=' . $itemId);
// Check for a custom css file and include it if it exists
$tmpl = $input->get('layout', $table->template);
$cssPath = COM_FABRIK_FRONTEND . '/views/list/tmpl/' . $tmpl . '/feed.css';
if (file_exists($cssPath)) {
$this->doc->addStyleSheet(COM_FABRIK_LIVESITE . 'components/com_fabrik/views/list/tmpl/' . $tmpl . '/feed.css');
}
$titleEl = $params->get('feed_title');
$dateColId = (int) $params->get('feed_date', 0);
$dateColElement = $formModel->getElement($dateColId, true);
$dateEl = $this->db->qn($dateColElement->getFullName(false, false, false));
$view = $model->canEdit() ? 'form' : 'details';
// List of tags to look for in the row data
// If they are there don't put them in the desc but put them in as a separate item param
$rssTags = array('<georss:point>' => 'xmlns:georss="http://www.georss.org/georss"');
foreach ($rows as $group) {
foreach ($group as $row) {
// Get the content
$str2 = '';
$str = '<table style="margin-top:10px;padding-top:10px;">';
$title = '';
$item = new JFeedItem();
foreach ($aTableHeadings as $heading => $dbColName) {
if ($title == '') {
// Set a default title
$title = $row->{$dbColName}['colName'];
}
$rssContent = $row->{$dbColName}['colName'];
$found = false;
foreach ($rssTags as $rssTag => $namespace) {
if (strstr($rssContent, $rssTag)) {
$found = true;
if (!strstr($this->doc->_namespace, $namespace)) {
$rssTag = JString::substr($rssTag, 1, JString::strlen($rssTag) - 2);
$this->doc->_itemTags[] = $rssTag;
$this->doc->_namespace .= $namespace . "\n";
}
//.........这里部分代码省略.........
示例9: _loadTmplBottom
/**
* Create the form bottom hidden fields
*
* @param object &$form Object containing form view properties
*
* @return void
*/
protected function _loadTmplBottom(&$form)
{
$input = $this->app->input;
$itemId = FabrikWorker::itemId();
/** @var FabrikFEModelForm $model */
$model = $this->getModel();
$listModel = $model->getListModel();
$row = JArrayHelper::toObject($model->data);
$canDelete = $listModel->canDelete($row);
$params = $model->getParams();
$task = 'form.process';
$refer = $input->server->get('HTTP_REFERER', '', 'string');
// $$$rob - if returning from a failed validation then we should use the fabrik_referrer post var
$refer = str_replace('&', '&', $input->get('fabrik_referrer', $refer, 'string'));
$thisRowId = is_array($model->getRowId()) ? implode('|', $model->getRowId()) : $model->getRowId();
$fields = array();
$fields[] = '<input type="hidden" name="listid" value="' . $listModel->getId() . '" />';
$fields[] = '<input type="hidden" name="listref" value="' . $listModel->getId() . '" />';
$fields[] = '<input type="hidden" name="rowid" value="' . $thisRowId . '" />';
$fields[] = '<input type="hidden" name="Itemid" value="' . $itemId . '" />';
$fields[] = '<input type="hidden" name="option" value="com_' . $this->package . '" />';
$fields[] = '<input type="hidden" name="task" value="' . $task . '" />';
$fields[] = '<input type="hidden" name="isMambot" value="' . $this->isMambot . '" />';
$fields[] = '<input type="hidden" name="formid" value="' . $model->get('id') . '" />';
$fields[] = '<input type="hidden" name="returntoform" value="0" />';
$fields[] = '<input type="hidden" name="fabrik_referrer" value="' . $refer . '" />';
$fields[] = '<input type="hidden" name="fabrik_ajax" value="' . (int) $model->isAjax() . '" />';
$fields[] = '<input type="hidden" name="package" value="' . $this->app->getUserState('com_fabrik.package', 'fabrik') . '" />';
$fields[] = '<input type="hidden" name="packageId" value="' . $model->packageId . '" />';
if ($useKey = FabrikWorker::getMenuOrRequestVar('usekey', '')) {
// $$$rob v's been set from -1 to the actual row id - so ignore usekey not sure if we should comment this out
// see http://fabrikar.com/forums/showthread.php?t=10297&page=5
$fields[] = '<input type="hidden" name="usekey" value="' . $useKey . '" />';
$pk_val = FArrayHelper::getValue($model->data, $listModel->getPrimaryKey(true));
if (empty($pk_val)) {
$fields[] = '<input type="hidden" name="usekey_newrecord" value="1" />';
}
}
/** $$$ hugh - testing a fix for pagination issue when submitting a 'search form'.
* If this is a search form, we need to clear 'limitstart', otherwise ... say we
* were last on page 4 of the (unfiltered) target table, and the search yields less than 4 pages,
* we end up with a blank table 'cos the wrong LIMIT's are applied to the query
*/
$saveInSessions = $params->get('save_insession', '');
if (is_array($saveInSessions)) {
foreach ($saveInSessions as $saveInSession) {
if ($saveInSession == '1') {
$fields[] = '<input type="hidden" name="limitstart" value="0" />';
break;
}
}
}
$fields[] = JHTML::_('form.token');
$resetLabel = FText::_($params->get('reset_button_label'));
$resetIcon = $params->get('reset_icon', '');
$copyLabel = FText::_($params->get('copy_button_label'));
$copyIcon = $params->get('copy_icon', '');
$applyLabel = FText::_($params->get('apply_button_label'));
$applyIcon = $params->get('apply_icon', '');
$deleteLabel = FText::_($params->get('delete_button_label', 'Delete'));
$deleteIcon = $params->get('delete_icon', '');
$goBackLabel = FText::_($params->get('goback_button_label'));
$goBackIcon = $params->get('goback_icon', '');
$btnLayout = FabrikHelperHTML::getLayout('fabrik-button');
if ($resetIcon !== '') {
$resetIcon = FabrikHelperHTML::icon($resetIcon);
$before = $params->get('reset_icon_location', 'before') == 'before';
$resetLabel = $before ? $resetIcon . ' ' . $resetLabel : $resetLabel . ' ' . $resetIcon;
}
$layoutData = (object) array('type' => 'reset', 'class' => 'btn-warning button', 'name' => 'Reset', 'label' => $resetLabel);
$form->resetButton = $params->get('reset_button', 0) && $this->editable == '1' ? $btnLayout->render($layoutData) : '';
if ($copyIcon !== '') {
$copyIcon = FabrikHelperHTML::icon($copyIcon);
$copyLabel = $params->get('copy_icon_location', 'before') == 'before' ? $copyIcon . ' ' . $copyLabel : $copyLabel . ' ' . $copyIcon;
}
$layoutData = (object) array('type' => 'submit', 'class' => 'button', 'name' => 'Copy', 'label' => $copyLabel);
$form->copyButton = $params->get('copy_button', 0) && $this->editable && $model->getRowId() != '' ? $btnLayout->render($layoutData) : '';
if ($applyIcon !== '') {
$applyIcon = FabrikHelperHTML::icon($applyIcon);
$before = $params->get('apply_icon_location', 'before') == 'before';
$applyLabel = $before ? $applyIcon . ' ' . $applyLabel : $applyLabel . ' ' . $applyIcon;
}
$layoutData = (object) array('type' => $model->isAjax() ? 'button' : 'submit', 'class' => 'button', 'name' => 'apply', 'label' => $applyLabel);
$form->applyButton = $params->get('apply_button', 0) && $this->editable ? $btnLayout->render($layoutData) : '';
if ($deleteIcon !== '') {
$deleteIcon = FabrikHelperHTML::icon($deleteIcon);
$before = $params->get('delete_icon_location', 'before') == 'before';
$deleteLabel = $before ? $deleteIcon . ' ' . $deleteLabel : $deleteLabel . ' ' . $deleteIcon;
}
$layoutData = (object) array('type' => 'submit', 'class' => 'btn-danger button', 'name' => 'delete', 'label' => $deleteLabel);
$form->deleteButton = $params->get('delete_button', 0) && $canDelete && $this->editable && $thisRowId != '' ? $btnLayout->render($layoutData) : '';
if ($goBackIcon !== '') {
$goBackIcon = FabrikHelperHTML::icon($goBackIcon);
//.........这里部分代码省略.........
示例10: display
/**
* Display the Feed
*
* @param sting $tpl template
*
* @return void
*/
public function display($tpl = null)
{
$input = $this->app->input;
$itemId = FabrikWorker::itemId();
$model = $this->getModel();
$model->setOutPutFormat('feed');
$this->app->allowCache(true);
if (!parent::access($model)) {
exit;
}
$this->doc->_itemTags = array();
// $$$ hugh - modified this so you can enable QS filters on RSS links
// by setting &incfilters=1
$input->set('incfilters', $input->getInt('incfilters', 0));
$table = $model->getTable();
$model->render();
$params = $model->getParams();
if ($params->get('rss') == '0') {
return '';
}
$formModel = $model->getFormModel();
$form = $formModel->getForm();
$aJoinsToThisKey = $model->getJoinsToThisKey();
// Get headings
$aTableHeadings = array();
$groupModels = $formModel->getGroupsHiarachy();
$titleEl = $params->get('feed_title');
$dateEl = (int) $params->get('feed_date');
//$imageEl = $formModel->getElement($imageEl, true);
$titleEl = $formModel->getElement($titleEl, true);
$dateEl = $formModel->getElement($dateEl, true);
$titleElName = $titleEl === false ? '' : $titleEl->getFullName(true, false);
$dateElName = $dateEl === false ? '' : $dateEl->getFullName(true, false);
$dateElNameRaw = $dateElName . '_raw';
foreach ($groupModels as $groupModel) {
$elementModels = $groupModel->getPublishedElements();
foreach ($elementModels as $elementModel) {
$element = $elementModel->getElement();
$elParams = $elementModel->getParams();
if ($elParams->get('show_in_rss_feed') == '1') {
$heading = $element->label;
if ($elParams->get('show_label_in_rss_feed') == '1') {
$aTableHeadings[$heading]['label'] = $heading;
} else {
$aTableHeadings[$heading]['label'] = '';
}
$aTableHeadings[$heading]['colName'] = $elementModel->getFullName();
$aTableHeadings[$heading]['dbField'] = $element->name;
// $$$ hugh - adding enclosure stuff for podcasting
if ($element->plugin == 'fileupload' || $elParams->get('use_as_rss_enclosure', '0') == '1') {
$aTableHeadings[$heading]['enclosure'] = true;
} else {
$aTableHeadings[$heading]['enclosure'] = false;
}
}
}
}
foreach ($aJoinsToThisKey as $element) {
$element = $elementModel->getElement();
$elParams = new Registry($element->attribs);
if ($elParams->get('show_in_rss_feed') == '1') {
$heading = $element->label;
if ($elParams->get('show_label_in_rss_feed') == '1') {
$aTableHeadings[$heading]['label'] = $heading;
} else {
$aTableHeadings[$heading]['label'] = '';
}
$aTableHeadings[$heading]['colName'] = $element->db_table_name . "___" . $element->name;
$aTableHeadings[$heading]['dbField'] = $element->name;
// $$$ hugh - adding enclosure stuff for podcasting
if ($element->plugin == 'fileupload' || $elParams->get('use_as_rss_enclosure', '0') == '1') {
$aTableHeadings[$heading]['enclosure'] = true;
} else {
$aTableHeadings[$heading]['enclosure'] = false;
}
}
}
$w = new FabrikWorker();
$rows = $model->getData();
$this->doc->title = htmlspecialchars($w->parseMessageForPlaceHolder($table->label, $_REQUEST), ENT_COMPAT, 'UTF-8');
$this->doc->description = htmlspecialchars(trim(strip_tags($w->parseMessageForPlaceHolder($table->introduction, $_REQUEST))));
$this->doc->link = JRoute::_('index.php?option=com_' . $this->package . '&view=list&listid=' . $table->id . '&Itemid=' . $itemId);
$this->addImage($params);
// Check for a custom css file and include it if it exists
$tmpl = $input->get('layout', $table->template);
$cssPath = COM_FABRIK_FRONTEND . 'views/list/tmpl/' . $tmpl . '/feed.css';
if (file_exists($cssPath)) {
$this->doc->addStyleSheet(COM_FABRIK_LIVESITE . 'components/com_fabrik/views/list/tmpl/' . $tmpl . '/feed.css');
}
$view = $model->canEdit() ? 'form' : 'details';
// List of tags to look for in the row data
// If they are there don't put them in the desc but put them in as a separate item param
$rssTags = array('<georss:point>' => 'xmlns:georss="http://www.georss.org/georss"');
//.........这里部分代码省略.........
示例11: loadTabs
/**
* Set the List's tab HTML
*
* @return array Tabs
*/
public function loadTabs()
{
$this->tabs = array();
$tabs = $this->getTabCategories();
if (!is_array($tabs) || empty($tabs)) {
return $this->tabs;
}
$package = $this->app->getUserState('com_fabrik.package', 'fabrik');
$listId = $this->getId();
$tabsField = $this->getTabField();
$itemId = FabrikWorker::itemId();
$uri = JURI::getInstance();
$urlBase = $uri->toString(array('path'));
$urlBase .= '?option=com_' . $package . '&';
if ($this->app->isAdmin()) {
$urlBase .= 'task=list.view&';
} else {
$urlBase .= 'view=list&';
}
$urlBase .= 'listid=' . $listId . '&resetfilters=1';
$urlEquals = $urlBase . '&' . $tabsField . '=%s';
$urlRange = $urlBase . '&' . $tabsField . '[value][]=%s&' . $tabsField . '[value][]=%s&' . $tabsField . '[condition]=BETWEEN';
$uri = JURI::getInstance();
$thisUri = rawurldecode($uri->toString(array('path', 'query')));
foreach ($tabs as $i => $tabArray) {
$row = new stdClass();
list($label, $range) = $tabArray;
$row->label = $label;
if (is_null($range)) {
$row->href = $urlBase;
} elseif (!is_array($range)) {
$row->href = sprintf($urlEquals, $range);
} else {
list($low, $high) = $range;
$row->href = sprintf($urlEquals, sprintf($urlRange, $low, $high));
}
if ($itemId) {
$row->href .= '&Itemid=' . $itemId;
}
$row->id = 'list_tabs_' . $this->getId() . '_' . $i;
$row->js = false;
$row->class = $thisUri == $row->href ? 'active' : '';
$this->tabs[] = $row;
}
return $this->tabs;
}
示例12: getRedirectURL
/**
* Get redirect URL
*
* @param bool $incSession Set url in session?
* @param bool $isMambot Is Mambot
*
* @return array url: string Redirect url, baseRedirect (True: default redirect, False: plugin redirect)
*
* @since 3.0.6 (was in form controller)
*/
public function getRedirectURL($incSession = true, $isMambot = false)
{
$input = $this->app->input;
if ($this->app->isAdmin()) {
// Admin always uses option com_fabrik
if (array_key_exists('apply', $this->formData)) {
$url = 'index.php?option=com_fabrik&task=form.view&formid=' . $input->getInt('formid') . '&rowid=' . $input->getString('rowid', '', 'string');
} else {
$url = 'index.php?option=com_fabrik&task=list.view&listid=' . $this->getListModel()->getId();
}
} else {
if (array_key_exists('apply', $this->formData)) {
$url = 'index.php?option=com_' . $this->package . '&view=form&formid=' . $input->getInt('formid') . '&rowid=' . $input->getString('rowid', '', 'string') . '&listid=' . $input->getInt('listid');
} else {
if ($isMambot) {
// Return to the same page
$url = filter_var(ArrayHelper::getValue($_SERVER, 'HTTP_REFERER', 'index.php'), FILTER_SANITIZE_URL);
} else {
// Return to the page that called the form
$url = urldecode($input->post->get('fabrik_referrer', 'index.php', 'string'));
}
$itemId = (int) FabrikWorker::itemId();
if ($url == '') {
if ($itemId !== 0) {
$url = 'index.php?' . http_build_query($this->app->getMenu('site')->getActive()->query) . '&Itemid=' . $itemId;
} else {
// No menu link so redirect back to list view
$url = 'index.php?option=com_' . $this->package . '&view=list&listid=' . $input->getInt('listid');
}
}
}
if ($this->config->get('sef')) {
$url = JRoute::_($url);
}
}
// 3.0 need to distinguish between the default redirect and redirect plugin
$baseRedirect = true;
if (!$incSession) {
return array('url' => $url, 'baseRedirect' => $baseRedirect);
}
$formdata = $this->session->get('com_' . $this->package . '.form.data');
$context = $this->getRedirectContext();
// If the redirect plug-in has set a url use that in preference to the default url
$sUrl = $this->session->get($context . 'url', array());
if (!empty($sUrl)) {
$baseRedirect = false;
}
if (!is_array($sUrl)) {
$sUrl = array($sUrl);
}
if (empty($sUrl)) {
$sUrl[] = $url;
}
$url = array_shift($sUrl);
$this->session->set($context . 'url', $sUrl);
// Redirect URL which set prefilters of < were converted to < which then gave mySQL error
$url = htmlspecialchars_decode($url);
return array('url' => $url, 'baseRedirect' => $baseRedirect);
}
示例13: popUpFormUrl
/**
* Build Pop up form URL
*
* @return boolean|string
*/
protected function popUpFormUrl()
{
$app = JFactory::getApplication();
$package = $app->getUserState('com_fabrik.package', 'fabrik');
$params = $this->getParams();
$popupformid = (int) $params->get('databasejoin_popupform');
if ($popupformid === 0) {
return false;
}
$db = $this->getDb();
$query = $db->getQuery(true);
$query->select('id')->from('#__{package}_lists')->where('form_id =' . $popupformid);
$db->setQuery($query);
$listid = $db->loadResult();
$itemId = FabrikWorker::itemId($listid);
$task = $app->isAdmin() ? 'task=details.view' : 'view=details';
$url = 'index.php?option=com_' . $package . '&' . $task . '&formid=' . $popupformid . '&listid=' . $listid;
if (!$app->isAdmin()) {
$url .= '&Itemid=' . $itemId;
}
$url .= '&rowid=';
return $url;
}
示例14: getEvents
/**
* Query all tables linked to the calendar and return them
*
* @return string javascript array containing json objects
*/
public function getEvents()
{
$itemId = FabrikWorker::itemId();
$tzOffset = $this->config->get('offset');
$tz = new DateTimeZone($tzOffset);
$w = new FabrikWorker();
$this->setupEvents();
$jsEvents = array();
$input = $this->app->input;
$where = $input->get('where', array(), 'array');
foreach ($this->events as $listId => $record) {
$this_where = FArrayHelper::getValue($where, $listId, '');
$this_where = html_entity_decode($this_where, ENT_QUOTES);
/** @var FabrikFEModelList $listModel */
$listModel = JModelLegacy::getInstance('list', 'FabrikFEModel');
$listModel->setId($listId);
if (!$listModel->canView()) {
continue;
}
$table = $listModel->getTable();
$els = $listModel->getElements();
$formModel = $listModel->getFormModel();
foreach ($record as $data) {
$db = $listModel->getDb();
$startDate = trim($data['startdate']) !== '' ? FabrikString::safeColName($data['startdate']) : '\'\'';
if ($data['startdate'] == '') {
throw new RuntimeException('No start date selected ', 500);
return;
}
$startElement = $formModel->getElement($data['startdate']);
$endDate = trim($data['enddate']) !== '' ? FabrikString::safeColName($data['enddate']) : "''";
$endElement = trim($data['enddate']) !== '' ? $formModel->getElement($data['enddate']) : $startElement;
$startLocal = $store_as_local = (bool) $startElement->getParams()->get('date_store_as_local', false);
$endLocal = $store_as_local = (bool) $endElement->getParams()->get('date_store_as_local', false);
$label = trim($data['label']) !== '' ? FabrikString::safeColName($data['label']) : "''";
$customUrl = $data['customUrl'];
$qLabel = $label;
if (array_key_exists($qLabel, $els)) {
// If db join selected for the label we need to get the label element and not the value
if (method_exists($els[$qLabel], 'getJoinLabelColumn')) {
$label = $els[$qLabel]->getJoinLabelColumn();
} else {
$label = FabrikString::safeColName($els[$qLabel]->getOrderByName());
}
}
$pk = $listModel->getPrimaryKey();
$query = $db->getQuery(true);
$query = $listModel->buildQuerySelect('list', $query);
$status = trim($data['status']) !== '' ? FabrikString::safeColName($data['status']) : "''";
$query->select($pk . ' AS id, ' . $pk . ' AS rowid, ' . $startDate . ' AS startdate, ' . $endDate . ' AS enddate')->select('"" AS link, ' . $label . ' AS label, ' . $db->q($data['colour']) . ' AS colour, 0 AS formid')->select($status . ' AS status')->order($startDate . ' ASC');
$query = $listModel->buildQueryJoin($query);
//$this_where = trim(str_replace('WHERE', '', $this_where));
$this_where = FabrikString::ltrimiword($this_where, 'WHERE');
$query = $this_where === '' ? $listModel->buildQueryWhere(true, $query) : $query->where($this_where);
$db->setQuery($query);
$formData = $db->loadObjectList();
if (is_array($formData)) {
foreach ($formData as $row) {
if ($row->startdate != '') {
$defaultURL = 'index.php?option=com_' . $this->package . '&Itemid=' . $itemId . '&view=form&formid=' . $table->form_id . '&rowid=' . $row->id . '&tmpl=component';
$thisCustomUrl = $w->parseMessageForPlaceHolder($customUrl, $row);
$row->link = $thisCustomUrl !== '' ? $thisCustomUrl : $defaultURL;
$row->custom = $customUrl != '';
$row->_listid = $table->id;
$row->_canDelete = (bool) $listModel->canDelete();
$row->_canEdit = (bool) $listModel->canEdit($row);
$row->_canView = (bool) $listModel->canViewDetails();
//Format local dates toISO8601
$myDate = new DateTime($row->startdate);
$row->startdate_locale = $myDate->format(DateTime::RFC3339);
$myDate = new DateTime($row->enddate);
$row->enddate_locale = $myDate->format(DateTime::RFC3339);
// Added timezone offset
if ($row->startdate !== $db->getNullDate() && $data['startShowTime'] == true) {
$date = JFactory::getDate($row->startdate);
$row->startdate = $date->format('Y-m-d H:i:s', true);
if ($startLocal) {
//Format local dates toISO8601
$myDate = new DateTime($row->startdate);
$row->startdate_locale = $myDate->format(DateTime::RFC3339);
} else {
$date->setTimezone($tz);
$row->startdate_locale = $date->toISO8601(true);
}
}
if ($row->enddate !== $db->getNullDate() && (string) $row->enddate !== '') {
if ($data['endShowTime'] == true) {
$date = JFactory::getDate($row->enddate);
$row->enddate = $date->format('Y-m-d H:i:d');
if ($endLocal) {
//Format local dates toISO8601
$myDate = new DateTime($row->enddate);
$row->enddate_locale = $myDate->format(DateTime::RFC3339);
} else {
$date->setTimezone($tz);
//.........这里部分代码省略.........
示例15: printURL
/**
* Create print URL
*
* @param object $formModel form model
*
* @since 3.0.6
*
* @return string
*/
public static function printURL($formModel)
{
/**
* Comment this out for now, as it causes issues with multiple forms per page.
* We could always create a $sig for it, but that would need the info from the form and
* table models, which are probably the most 'expensive' aprt of this function anyway.
*/
/*
if (isset(self::$printURL))
{
return self::$printURL;
}
*/
$app = JFactory::getApplication();
$input = $app->input;
$form = $formModel->getForm();
$package = $app->getUserState('com_fabrik.package', 'fabrik');
$table = $formModel->getTable();
$url = COM_FABRIK_LIVESITE . 'index.php?option=com_' . $package . '&view=details&tmpl=component&formid=' . $form->id . '&listid=' . $table->id . '&rowid=' . $formModel->getRowId() . '&iframe=1&print=1';
$url .= '&Itemid=' . FabrikWorker::itemId();
/* $$$ hugh - @TODO - FIXME - if they were using rowid=-1, we don't need this, as rowid has already been transmogrified
* to the correct (PK based) rowid. but how to tell if original rowid was -1???
*/
if ($input->get('usekey') !== null) {
$url .= '&usekey=' . $input->get('usekey');
}
$url = JRoute::_($url);
// $$$ rob for some reason JRoute wasn't doing this ???
$url = str_replace('&', '&', $url);
self::$printURL = $url;
return self::$printURL;
}