本文整理匯總了PHP中FabrikHelperHTML::debug方法的典型用法代碼示例。如果您正苦於以下問題:PHP FabrikHelperHTML::debug方法的具體用法?PHP FabrikHelperHTML::debug怎麽用?PHP FabrikHelperHTML::debug使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類FabrikHelperHTML
的用法示例。
在下文中一共展示了FabrikHelperHTML::debug方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: display
function display($tmpl = 'default')
{
FabrikHelperHTML::debug($this, 'view');
$records = JRequest::getVar('ids', array());
$renderOrder = JRequest::getVar('renderOrder');
$tableid = JRequest::getVar('id', 0);
$this->assign('recordcount', count($records));
$this->assign('renderOrder', $renderOrder);
$this->assign('recordids', implode(',', $records));
$this->assign('tableid', $tableid);
$this->assign('fieldList', $this->get('ElementList', 'form'));
JHTML::stylesheet('template.css', 'components/com_fabrik/plugins/table/emailtableplus/views/emailtableplus/tmpl/', true);
//ensure we don't have an incorrect version of mootools loaded
FabrikHelperHTML::cleanMootools();
if ($this->_isMambot) {
return $this->loadTemplate();
} else {
parent::display();
}
}
示例2: display
function display($tmpl = 'default')
{
FabrikHelperHTML::debug($this, 'view');
$records = JRequest::getVar('ids', array());
$renderOrder = JRequest::getVar('renderOrder');
$tableid = JRequest::getVar('id', 0);
$this->assign('recordcount', count($records));
$this->assign('renderOrder', $renderOrder);
$this->assign('recordids', implode(',', $records));
$this->assign('tableid', $tableid);
$this->assign('fieldList', $this->get('ElementList', 'form'));
$this->assign('chown_to_select', JHTML::_('select.genericlist', $this->chown_to_options, 'chown_to_val', 'class="fabrikinput inputbox" size="1"', 'value', 'text', '', 'chown_to_val'));
JHTML::stylesheet('template.css', 'components/com_fabrik/plugins/table/chown/views/chown/tmpl/', true);
//ensure we don't have an incorrect version of mootools loaded
FabrikHelperHTML::cleanMootools();
if ($this->_isMambot) {
return $this->loadTemplate();
} else {
parent::display();
}
}
示例3: _buildQuery
//.........這裏部分代碼省略.........
$no_join_watch_raw = $elementModel->getFullName(false, true, false) . '_raw';
if (isset($data[$no_join_watch_raw])) {
$whereval = $data[$no_join_watch_raw];
} else {
// $$$ hugh - if watched element has no value, we have been selecting all rows from CDD table
// but should probably select none.
$whereval = '';
}
}
}
}
continue 2;
}
}
}
$where = '';
$wherekey = $params->get('cascadingdropdown_key');
if (!is_null($whereval) && $wherekey != '') {
$whereBits = explode('___', $wherekey);
$wherekey = array_pop($whereBits);
$where = $wherekey . ' = ' . $db->quote($whereval);
}
$filter = $params->get('cascadingdropdown_filter');
/* $$$ hugh - temporary hack to work around this issue:
* http://fabrikar.com/forums/showthread.php?p=71288#post71288
* ... which is basically that if they are using {placeholders} in their
* filter query, there's no point trying to apply that filter if we
* aren't in form view, for instance when building a search filter
* or in table view when the cdd is in a repeat group, 'cos there won't
* be any {placeholder} data to use.
* So ... for now, if the filter contains {...}, and view!=form ... skip it
* $$$ testing fix for the bandaid, ccd JS should not be submitting data from form
*/
if (trim($filter) != '') {
$where .= $where == '' ? ' ' : ' AND ';
$where .= $filter;
}
$w = new FabrikWorker();
// $$$ hugh - add some useful stuff to search data
if (!is_null($whereval)) {
$placeholders = array('whereval' => $whereval, 'wherekey' => $wherekey);
} else {
$placeholders = array();
}
$join = $this->getJoin();
$where = str_replace("{thistable}", $join->table_join_alias, $where);
if (!empty($this->_autocomplete_where)) {
$where .= $where == '' ? ' AND ' . $this->_autocomplete_where : $this->_autocomplete_where;
}
$data = array_merge($data, $placeholders);
$where = $w->parseMessageForPlaceHolder($where, $data);
$table = $this->getDbName();
$key = FabrikString::safeColName($params->get('cascadingdropdown_id'));
$key = str_replace($db->quoteName($table), $db->quoteName($join->table_join_alias), $key);
$orderby = 'text';
$tables = $this->getForm()->getLinkedFabrikLists($params->get('join_db_name'));
$listModel = JModel::getInstance('List', 'FabrikFEModel');
$val = $params->get('cascadingdropdown_label_concat');
if (!empty($val)) {
$val = str_replace("{thistable}", $join->table_join_alias, $val);
$val = $w->parseMessageForPlaceHolder($val, $data);
$val = 'CONCAT(' . $val . ')';
$orderby = $val;
} else {
$val = FabrikString::safeColName($params->get($this->labelParam));
$val = preg_replace("#^`({$table})`\\.#", $db->quoteName($join->table_join_alias) . '.', $val);
foreach ($tables as $tid) {
$listModel->setId($tid);
$listModel->getTable();
$formModel = $this->getForm();
$formModel->getGroupsHiarachy();
$orderby = $val;
// See if any of the tables elements match the db joins val/text
foreach ($groups as $groupModel) {
$elementModels = $groupModel->getPublishedElements();
foreach ($elementModels as $elementModel) {
$element = $elementModel->_element;
if ($element->name == $val) {
$val = $elementModel->modifyJoinQuery($val);
}
}
}
}
}
$val = str_replace($db->quoteName($table), $db->quoteName($join->table_join_alias), $val);
$query = $db->getQuery(true);
$query->select('DISTINCT(' . $key . ') AS value, ' . $val . 'AS text');
$desc = $params->get('cdd_desc_column', '');
if ($desc !== '') {
$query->select(FabrikString::safeColName($desc) . ' AS description');
}
$query->from($db->quoteName($table) . ' AS ' . $db->quoteName($join->table_join_alias));
$query->where(FabrikString::rtrimword($where));
if (!JString::stristr($where, 'order by')) {
$query->order($orderby . ' ASC');
}
$this->_sql[$sig] = $query;
FabrikHelperHTML::debug($this->_sql[$sig]);
return $this->_sql[$sig];
}
示例4: getJSIcons
//.........這裏部分代碼省略.........
$titleElement = JArrayHelper::getValue($titleElements, $c, '');
$title = $titleElement == '' ? '' : strip_tags($row->{$titleElement});
// $$$ hugh - if they provided a template, lets assume they will handle the link themselves.
// http://fabrikar.com/forums/showthread.php?p=41550#post41550
// $$$ hugh - at some point the fabrik_view / fabrik_edit links became optional
if (empty($html) && (array_key_exists('fabrik_view', $rowdata) || array_key_exists('fabrik_edit', $rowdata))) {
$html .= "<br />";
// use edit link by preference
if (array_key_exists('fabrik_edit', $rowdata)) {
$html .= $rowdata['fabrik_edit'];
} else {
$html .= $rowdata['fabrik_view'];
}
}
$html = str_replace(array("\n\r"), "<br />", $html);
$html = str_replace(array("\n", "\r"), "<br />", $html);
$html = str_replace("'", '"', $html);
$this->txt[] = $html;
if ($iconImg == '') {
$iconImg = JArrayHelper::getValue($markerImages, $c, '');
if ($iconImg != '') {
$iconImg = JArrayHelper::getValue($rowdata, $iconImg, '');
//get the src
preg_match('/src=["|\'](.*?)["|\']/', $iconImg, $matches);
if (array_key_exists(1, $matches)) {
$iconImg = $matches[1];
//check file exists
$path = str_replace(COM_FABRIK_LIVESITE, '', $iconImg);
if (JFile::exists(JPATH_BASE . $path)) {
$customimagefound = true;
}
}
}
if ($iconImg != '') {
list($width, $height) = $this->markerSize($iconImg);
} else {
//standard google map icon size
$width = 20;
$height = 34;
}
} else {
//standard google map icon size
list($width, $height) = $this->markerSize(JPATH_SITE . DS . 'images' . DS . 'stories' . DS . $iconImg);
}
//just for moosehunt!
$radomize = $_SERVER['HTTP_HOST'] == 'moosehunt.mobi' ? true : false;
$groupKey = strip_tags($groupKey);
$gClass = JArrayHelper::getValue($groupClass, 0, '');
if (!empty($gClass)) {
$gClass .= '_raw';
$gClass = isset($row->{$gClass}) ? $row->{$gClass} : '';
}
if (array_key_exists($v[0] . $v[1], $icons)) {
$existingIcon = $icons[$v[0] . $v[1]];
if ($existingIcon['groupkey'] == $groupKey) {
// $$$ hugh - this inserts label between multiple record $html, but not at the top.
// If they want to insert label, they can do it themselves in the template.
// $icons[$v[0].$v[1]][2] = $icons[$v[0].$v[1]][2] . "<h6>$table->label</h6>" . $html;
$icons[$v[0] . $v[1]][2] = $icons[$v[0] . $v[1]][2] . "<br />" . $html;
if ($customimagefound) {
//$icons[$v[0].$v[1]][3] = "<br />" . $iconImg;
$icons[$v[0] . $v[1]][3] = $iconImg;
}
} else {
$groupedIcons[] = array($v[0], $v[1], $html, $iconImg, $width, $height, 'groupkey' => $groupKey, 'listid' => $listid, 'title' => $title, 'groupClass' => 'type' . $gClass);
}
} else {
//default icon - lets see if we need to use a letterd icon instead
if (JArrayHelper::getValue($letters, $c, '') != '') {
$iconImg = $uri->getScheme() . '://www.google.com/mapfiles/marker' . strtoupper($letters[$c]) . '.png';
}
$icons[$v[0] . $v[1]] = array($v[0], $v[1], $html, $iconImg, $width, $height, 'groupkey' => $groupKey, 'listid' => $listid, 'title' => $title, 'groupClass' => 'type' . $gClass);
}
$this->recordCount++;
$k++;
}
}
//replace last icon?
$iconImg = JArrayHelper::getValue($aLastIcons, $c, '');
if ($iconImg != '') {
list($width, $height) = $this->markerSize(JPATH_SITE . '/media/com_fabrik/images/' . $iconImg);
$icons[$v[0] . $v[1]][3] = $iconImg;
$icons[$v[0] . $v[1]][4] = $width;
$icons[$v[0] . $v[1]][5] = $height;
}
$c++;
}
$icons = array_values($icons);
//replace coord keys with numeric keys
$icons = array_merge($icons, $groupedIcons);
if ($maxMarkers != 0 && $maxMarkers < count($icons)) {
$icons = array_slice($icons, -$maxMarkers);
}
$limitMessageShown = !($k >= $recLimit);
if (!$limitMessageShown && $recLimit !== 0 && $limitMessage != '') {
$app->enqueueMessage($limitMessage);
}
FabrikHelperHTML::debug($icons, 'map');
return $icons;
}
示例5: display
/**
* Main setup routine for displaying the form/detail view
*
* @param string $tpl template
*
* @return void
*/
public function display($tpl = null)
{
$profiler = JProfiler::getInstance('Application');
$input = $this->app->input;
$w = new FabrikWorker();
/** @var FabrikFEModelForm $model */
$model = $this->getModel('form');
if (!$model) {
// Dodgy URL - can't find the form name see https://github.com/Fabrik/fabrik/issues/1248
return;
}
$model->isMambot = $this->isMambot;
$form = $model->getForm();
if ($model->render() === false) {
return false;
}
$this->isMultiPage = $model->isMultiPage();
list($this->plugintop, $this->pluginbottom, $this->pluginend) = $model->getFormPluginHTML();
$listModel = $model->getlistModel();
if (!$model->canPublish()) {
if (!$this->app->isAdmin()) {
echo FText::_('COM_FABRIK_FORM_NOT_PUBLISHED');
return false;
}
}
$this->rowid = $model->getRowId();
$this->access = $model->checkAccessFromListSettings();
if ($this->access == 0) {
$this->app->enqueueMessage(FText::_('JERROR_ALERTNOAUTHOR'), 'error');
return false;
}
JDEBUG ? $profiler->mark('form view before join group ids got') : null;
if (!$listModel->noTable()) {
$joins = $listModel->getJoins();
$model->getJoinGroupIds($joins);
}
$params = $model->getParams();
$this->setTitle($w, $params);
$this->setCanonicalLink($model);
FabrikHelperHTML::debug($params->get('note'), 'note');
$params->def('icons', $this->app->get('icons'));
$params->set('popup', $input->get('tmpl') == 'component' ? 1 : 0);
$this->editable = $model->isEditable();
$form->label = FText::_($model->getLabel());
$form->intro = FText::_($model->getIntro());
$form->outro = FText::_($model->getOutro());
$form->action = $model->getAction();
$form->class = $model->getFormClass();
$form->formid = $model->isEditable() ? 'form_' . $model->getId() : 'details_' . $model->getId();
$form->name = 'form_' . $model->getId();
if ((string) $this->rowid !== '') {
$form->formid .= '_' . $this->rowid;
}
$form->error = $form->error === '' ? FText::_('COM_FABRIK_FAILED_VALIDATION') : FText::_($form->error);
if (!empty($model->formErrorMsg)) {
$form->error .= '<br />' . $model->formErrorMsg;
}
$form->origerror = $form->error;
$clearErrors = false;
// Module rendered without ajax, we need to assign the session errors back into the model
if ($model->isMambot) {
$this->package = $this->app->getUserState('com_fabrik.package', 'fabrik');
$context = 'com_' . $this->package . '.form.' . $form->id . '.' . $this->rowid . '.';
$model->errors = $this->session->get($context . 'errors', array());
$clearErrors = true;
}
$form->error = $model->hasErrors() ? $form->error : '';
JDEBUG ? $profiler->mark('form view before validation classes loaded') : null;
$tmpl = $model->getTmpl();
$this->tmpl = $tmpl;
$this->_addButtons();
JDEBUG ? $profiler->mark('form view before group view got') : null;
$this->groups = $model->getGroupView($tmpl);
$btnData = new stdClass();
$l = FabrikHelperHTML::getLayout('form.fabrik-repeat-group-delete');
$this->removeRepeatGroupButton = $l->render($btnData);
$l = FabrikHelperHTML::getLayout('form.fabrik-repeat-group-add');
$this->addRepeatGroupButton = $l->render($btnData);
JDEBUG ? $profiler->mark('form view after group view got') : null;
$this->data = $model->tmplData;
$this->params = $params;
$this->tipLocation = $params->get('tiplocation');
FabrikHelperHTML::debug($this->groups, 'form:view:groups');
// Force front end templates
$this->_basePath = COM_FABRIK_FRONTEND . '/views';
$this->_addJavascript($listModel->getId());
JDEBUG ? $profiler->mark('form view: after add js') : null;
$this->_loadTmplBottom($form);
JDEBUG ? $profiler->mark('form view: after tmpl bottom loaded') : null;
$form->attribs = ' class="' . $form->class . '" name="' . $form->name . '" id="' . $form->formid . '" enctype="' . $model->getFormEncType() . '"';
$this->form = $form;
JDEBUG ? $profiler->mark('form view: form assigned as ref') : null;
$list = new stdClass();
//.........這裏部分代碼省略.........
示例6: getData
/**
* main method to get the data to insert into the form
* @return array form's data
*/
function getData()
{
//if already set return it. If not was causing issues with the juser form plugin
// when it tried to modify the form->_data info, from within its onLoad method, when sync user option turned on.
if (isset($this->_data)) {
return $this->_data;
}
$profiler = JProfiler::getInstance('Application');
$this->_data = array();
$data = array(FArrayHelper::toObject(JRequest::get('request')));
$form = $this->getForm();
$aGroups = $this->getGroupsHiarachy();
JDEBUG ? $profiler->mark('formmodel getData: groups loaded') : null;
if (!$form->record_in_database) {
FabrikHelperHTML::debug($data, 'form:getData from $_REQUEST');
$data = JRequest::get('request');
} else {
$listModel = $this->getListModel();
$fabrikDb = $listModel->getDb();
JDEBUG ? $profiler->mark('formmodel getData: db created') : null;
$item = $listModel->getTable();
JDEBUG ? $profiler->mark('formmodel getData: table row loaded') : null;
$this->_aJoinObjs =& $listModel->getJoins();
JDEBUG ? $profiler->mark('formmodel getData: joins loaded') : null;
if (!empty($this->_arErrors)) {
// $$$ hugh - if we're a mambot, reload the form session state we saved in
// process() when it banged out.
if ($this->isMambot) {
$srow = $this->getSessionData();
$this->sessionModel->last_page = 0;
if ($srow->data != '') {
$data = FArrayHelper::toObject(unserialize($srow->data), 'stdClass', false);
JFilterOutput::objectHTMLSafe($data);
$data = array($data);
FabrikHelperHTML::debug($data, 'form:getData from session (form in Mambot and errors)');
}
} else {
// $$$ rob - use setFormData rather than JRequest::get()
//as it applies correct input filtering to data as defined in article manager parameters
$data = $this->setFormData();
$data = FArrayHelper::toObject($data, 'stdClass', false);
//$$$rob ensure "<tags>text</tags>" that are entered into plain text areas are shown correctly
JFilterOutput::objectHTMLSafe($data);
$data = array($data);
FabrikHelperHTML::debug($data, 'form:getData from POST (form not in Mambot and errors)');
}
} else {
//test if its a resumed paged form
$srow = $this->getSessionData();
JDEBUG ? $profiler->mark('formmodel getData: session data loaded') : null;
if ($this->saveMultiPage() && $srow->data != '') {
$data = array(FArrayHelper::toObject(array_merge(unserialize($srow->data), JArrayHelper::fromObject($data[0]))));
FabrikHelperHTML::debug($data, 'form:getData from session (form not in Mambot and no errors');
} else {
// only try and get the row data if its an active record
//use !== 0 as rowid may be alphanumeric
// $$$ hugh - when 'usekey', rowid can actually be 0 (like if using userid and this is guest access)
// so go ahead and try and load the row, if it doesn't exist, we'll supress the warning
$usekey = FabrikWorker::getMenuOrRequestVar('usekey', '', $this->isMambot);
if (!empty($usekey) || (int) $this->_rowId !== 0 || !is_numeric($this->_rowId) && $this->_rowId != '') {
// $$$ hugh - once we have a few join elements, our select statements are
// getting big enough to hit default select length max in MySQL.
$listModel->setBigSelects();
//otherwise lets get the table record
$sql = $this->_buildQuery();
$fabrikDb->setQuery($sql);
FabrikHelperHTML::debug($fabrikDb->getQuery(), 'form:render');
$rows = $fabrikDb->loadObjectList();
if (is_null($rows)) {
JError::raiseWarning(500, $fabrikDb->getErrorMsg());
}
JDEBUG ? $profiler->mark('formmodel getData: rows data loaded') : null;
//$$$ rob Ack above didnt work for joined data where there would be n rows rerutned frho "this rowid = $this->_rowId \n";
if (!empty($rows)) {
// only do this if the query returned some rows (it wont if usekey on and userid = 0 for example)
$data = array();
foreach ($rows as &$row) {
if (empty($data)) {
//if loading in a rowid=-1 set the row id to the actual row id
$this->_rowId = isset($row->__pk_val) ? $row->__pk_val : $this->_rowId;
}
$row = empty($row) ? array() : JArrayHelper::fromObject($row);
$data[] = FArrayHelper::toObject(array_merge($row, JRequest::get('request')));
}
}
FabrikHelperHTML::debug($data, 'form:getData from querying rowid= ' . $this->_rowId . ' (form not in Mambot and no errors)');
// if empty data return and trying to edit a record then show error
//occurs if user trying to edit a record forbidden by a prefilter rull
if (empty($data) && $this->_rowId != '') {
// $$$ hugh - special case when using -1, if user doesn't have a record yet
if (FabrikWorker::getMenuOrRequestVar('rowid', '', $this->isMambot) == '-1') {
return;
} else {
// if no key found set rowid to 0 so we can insert a new record.
if (empty($usekey) && !$this->isMambot) {
$this->_rowId = 0;
//.........這裏部分代碼省略.........
示例7: getData
/**
* Main method to get the data to insert into the form
*
* @return array Form's data
*/
public function getData()
{
// If already set return it. If not was causing issues with the juser form plugin
// when it tried to modify the form->data info, from within its onLoad method, when sync user option turned on.
if (isset($this->data)) {
return $this->data;
}
$this->getRowId();
$input = $this->app->input;
$profiler = JProfiler::getInstance('Application');
JDEBUG ? $profiler->mark('formmodel getData: start') : null;
$this->data = array();
$f = JFilterInput::getInstance();
/*
* $$$ hugh - we need to remove any elements from the query string,
* if the user doesn't have access, otherwise ACL's on elements can
* be bypassed by just setting value on form load query string!
*/
$clean_request = $f->clean($_REQUEST, 'array');
foreach ($clean_request as $key => $value) {
$test_key = FabrikString::rtrimword($key, '_raw');
$elementModel = $this->getElement($test_key, false, false);
if ($elementModel !== false) {
if (!$elementModel->canUse()) {
unset($clean_request[$key]);
}
}
}
$data = $clean_request;
$form = $this->getForm();
$this->getGroupsHiarachy();
JDEBUG ? $profiler->mark('formmodel getData: groups loaded') : null;
if (!$form->record_in_database) {
FabrikHelperHTML::debug($data, 'form:getData from $_REQUEST');
$data = $f->clean($_REQUEST, 'array');
} else {
JDEBUG ? $profiler->mark('formmodel getData: start get list model') : null;
$listModel = $this->getListModel();
JDEBUG ? $profiler->mark('formmodel getData: end get list model') : null;
$fabrikDb = $listModel->getDb();
JDEBUG ? $profiler->mark('formmodel getData: db created') : null;
$listModel->getTable();
JDEBUG ? $profiler->mark('formmodel getData: table row loaded') : null;
$this->aJoinObjs = $listModel->getJoins();
JDEBUG ? $profiler->mark('formmodel getData: joins loaded') : null;
if ($this->hasErrors()) {
// $$$ hugh - if we're a mambot, reload the form session state we saved in
// process() when it banged out.
if ($this->isMambot) {
$sessionRow = $this->getSessionData();
$this->sessionModel->last_page = 0;
if ($sessionRow->data != '') {
$sData = unserialize($sessionRow->data);
$data = FArrayHelper::toObject($sData, 'stdClass', false);
JFilterOutput::objectHTMLSafe($data);
$data = array($data);
FabrikHelperHTML::debug($data, 'form:getData from session (form in Mambot and errors)');
}
} else {
// $$$ rob - use setFormData rather than $_GET
// as it applies correct input filtering to data as defined in article manager parameters
$data = $this->setFormData();
$data = FArrayHelper::toObject($data, 'stdClass', false);
// $$$rob ensure "<tags>text</tags>" that are entered into plain text areas are shown correctly
JFilterOutput::objectHTMLSafe($data);
$data = ArrayHelper::fromObject($data);
FabrikHelperHTML::debug($data, 'form:getData from POST (form not in Mambot and errors)');
}
} else {
$sessionLoaded = false;
// Test if its a resumed paged form
if ($this->saveMultiPage()) {
$sessionRow = $this->getSessionData();
JDEBUG ? $profiler->mark('formmodel getData: session data loaded') : null;
if ($sessionRow->data != '') {
$sessionLoaded = true;
/*
* $$$ hugh - this chunk should probably go in setFormData, but don't want to risk any side effects just now
* problem is that later failed validation, non-repeat join element data is not formatted as arrays,
* but from this point on, code is expecting even non-repeat join data to be arrays.
*/
$tmp_data = unserialize($sessionRow->data);
$groups = $this->getGroupsHiarachy();
foreach ($groups as $groupModel) {
if ($groupModel->isJoin() && !$groupModel->canRepeat()) {
foreach ($tmp_data['join'][$groupModel->getJoinId()] as &$el) {
$el = array($el);
}
}
}
$bits = $data;
$bits = array_merge($tmp_data, $bits);
//$data = array(FArrayHelper::toObject($bits));
$data = $bits;
FabrikHelperHTML::debug($data, 'form:getData from session (form not in Mambot and no errors');
//.........這裏部分代碼省略.........
示例8: filter
/**
* Filter the list data
*
* @return null
*/
public function filter()
{
$app = JFactory::getApplication();
$input = $app->input;
$modelName = $input->get('view', 'list');
$model = $this->getModel($modelName, 'FabrikFEModel');
$model->setId($input->getInt('listid'));
FabrikHelperHTML::debug('', 'list model: getRequestData');
$request = $model->getRequestData();
$model->storeRequestData($request);
// $$$ rob pass in the model otherwise display() rebuilds it and the request data is rebuilt
return $this->display($model);
}
示例9: filterValueList_All
/**
* Create an array of label/values which will be used to populate the elements filter dropdown
* returns all possible options
*
* @param bool $normal do we render as a normal filter or as an advanced search filter
* @param string $tableName table name to use - defaults to element's current table
* @param string $label field to use, defaults to element name
* @param string $id field to use, defaults to element name
* @param bool $incjoin include join
*
* @return array filter value and labels
*/
protected function filterValueList_All($normal, $tableName = '', $label = '', $id = '', $incjoin = true)
{
if ($this->isJoin()) {
$rows = array_values($this->checkboxRows());
return $rows;
}
/*
* list of all tables that have been joined to -
* if duplicated then we need to join using a table alias
*/
$listModel = $this->getlistModel();
$table = $listModel->getTable();
$origTable = $table->db_table_name;
$fabrikDb = $listModel->getDb();
$params = $this->getParams();
$joinTable = $params->get('join_db_name');
$joinKey = $this->getJoinValueColumn();
$joinVal = $this->getJoinLabelColumn();
$join = $this->getJoin();
$joinTableName = $join->table_join_alias;
if ($joinTable == '') {
$joinTable = $joinTableName;
}
// $$$ hugh - select all values for performance gain over selecting distinct records from recorded data
$sql = "SELECT DISTINCT( {$joinVal} ) AS text, {$joinKey} AS value \n FROM " . $fabrikDb->quoteName($joinTable) . ' AS ' . $fabrikDb->quoteName($joinTableName) . " \n ";
$where = $this->buildQueryWhere(array(), true, null, array('mode' => 'filter'));
// Ensure table prefilter is applied to query
$prefilterWhere = $listModel->buildQueryPrefilterWhere($this);
$elementName = FabrikString::safeColName($this->getFullName(false, false));
$prefilterWhere = str_replace($elementName, $joinKey, $prefilterWhere);
if (trim($where) == '') {
/* $$$ hugh - Sanity check - won't this screw things up if we have a complex prefilter with multiple filters using AND grouping? */
$prefilterWhere = str_replace('AND', 'WHERE', $prefilterWhere);
}
$where .= $prefilterWhere;
$sql .= $where;
if (!JString::stristr($where, 'order by')) {
$sql .= $this->getOrderBy('filter');
}
$sql = $listModel->pluginQuery($sql);
$fabrikDb->setQuery($sql);
FabrikHelperHTML::debug($fabrikDb->getQuery(), 'fabrikdatabasejoin getFilter');
return $fabrikDb->loadObjectList();
}
示例10: getPostFilters
//.........這裏部分代碼省略.........
if ($index !== false) {
$usedMerges[] = $elid;
}
//rob empty post filters SHOULD overwrite previous filters, as the user has submitted
// this filter with nothing selected
/*if (is_string($value) && trim($value) == '') {
continue;
}
*/
// $$$ rob set a var for empty value - regardless of whether its an array or string
$emptyValue = is_string($value) && trim($value) == '' || is_array($value) && trim(implode('', $value)) == '';
// $$rob ok the above meant that require filters stopped working as soon as you submitted
// an empty search!
// So now add in the empty search IF there is NOT a previous filter in the search data
if ($emptyValue && $index === false) {
continue;
}
// $$$ rob if we are posting an empty value then we really have to clear the filter out from the
// session. Otherwise the filter is run as "where field = ''"
if ($emptyValue && $index !== false) {
// $$ $rob - if the filter has been added from search all then don't remove it
if (JArrayHelper::getValue($searchTypes, $index) != 'searchall') {
$this->clearAFilter($filters, $index);
}
// $$$ rob - regardless of whether the filter was added by search all or not - don't overwrite it with post filter
continue;
}
$elementModel = $elements[$elid];
if (!is_a($elementModel, 'plgFabrik_Element')) {
continue;
}
//if the request key is already in the filter array - unset it
if ($index !== false) {
foreach ($filterkeys as $fkey) {
if (is_array($filters[$fkey]) && array_key_exists($index, $filters[$fkey])) {
// don't unset search all filters when the value is empty and continue so we dont add in a new filter
//if (array_key_exists($index, $filters['search_type']) && ($filters['search_type'][$index] == 'searchall' && $value == '')) {
if (JArrayHelper::getValue($searchTypes, $index) == 'searchall' && $value == '') {
continue 2;
}
//$$$rob we DO need to unset
unset($filters[$fkey][$index]);
}
}
}
//empty ranged data test
// $$$ hugh - was getting single value array when testing AJAX nav, so 'undefined index 1' warning.
if (is_array($value) && $value[0] == '' && (!isset($value[1]) || $value[1] == '')) {
continue;
}
$eval = is_array($value) ? JArrayHelper::getValue($value, 'eval', FABRIKFILTER_TEXT) : FABRIKFILTER_TEXT;
if (!is_a($elementModel, 'plgFabrik_ElementDatabasejoin')) {
$fieldDesc = $elementModel->getFieldDescription();
if (JString::stristr($fieldDesc, 'INT')) {
if (is_numeric($value) && $request['condition'][$i] == '=') {
$eval = FABRKFILTER_NOQUOTES;
}
}
}
// $$$ rob - search all and dropdown filter: Search first on searchall = usa, then select dropdown to usa.
// post filter query overwrites search all query, but uses add so = where id REGEX 'USA' AND country LIKE '%USA'
// this code swaps the first
$joinMode = strtolower($request['join'][$i]) != 'where' ? $request['join'][$i] : 'AND';
if (!empty($filters)) {
if ($i == 0) {
$joinMode = array_pop(JArrayHelper::getValue($filters, 'join', array('AND')));
// $$$ rob - If search all made, then the post filters should filter further the results
$lastSearchType = array_pop(JArrayHelper::getValue($filters, 'search_type', array('normal')));
if ($lastSearchType == 'searchall') {
$joinMode = 'AND';
}
}
}
//add request filter to end of filter array
$element = $elementModel->getElement();
$elparams = $elementModel->getParams();
$filters['value'][] = $value;
$filters['condition'][] = urldecode($request['condition'][$i]);
$filters['join'][] = $joinMode;
$filters['no-filter-setup'][] = $element->filter_type == '' ? 1 : 0;
$filters['hidden'][] = $element->filter_type == '' ? 1 : 0;
$filters['key'][] = urldecode($key);
$filters['search_type'][] = JArrayHelper::getValue($request['search_type'], $i, 'normal');
$filters['match'][] = $element->filter_exact_match;
$filters['full_words_only'][] = $elparams->get('full_words_only');
$filters['eval'][] = $eval;
$filters['required'][] = $elparams->get('filter_required');
$filters['access'][] = $elparams->get('filter_access');
$filters['grouped_to_previous'][] = JArrayHelper::getValue($request['grouped_to_previous'], $i, '0');
$filters['label'][] = $elparams->get('alt_list_heading') == '' ? $element->label : $elparams->get('alt_list_heading');
$filters['elementid'][] = $elid;
$filters['raw'][] = false;
}
}
$this->listModel->tmpFilters = $filters;
FabrikHelperHTML::debug($filters, 'filter array: before onGetPostFilter');
FabrikWorker::getPluginManager()->runPlugins('onGetPostFilter', $this->listModel, 'list', $filters);
FabrikHelperHTML::debug($filters, 'filter array: after onGetPostFilter');
$filters = $this->listModel->tmpFilters;
}
示例11: display
/**
* Main setup routine for displaying the form/detail view
*
* @param string $tpl template
*
* @return void
*/
public function display($tpl = null)
{
$profiler = JProfiler::getInstance('Application');
$app = JFactory::getApplication();
$w = new FabrikWorker();
$config = JFactory::getConfig();
$model = $this->getModel('form');
$document = JFactory::getDocument();
$model->isMambot = $this->isMambot;
$form = $model->getForm();
if ($model->render() === false) {
return false;
}
$this->isMultiPage = $model->isMultiPage();
list($this->plugintop, $this->pluginbottom, $this->pluginend) = $this->get('FormPluginHTML');
$listModel = $model->getlistModel();
$table = $listModel->noTable() ? null : $listModel->getTable();
if (!$model->canPublish()) {
if (!$app->isAdmin()) {
echo JText::_('COM_FABRIK_FORM_NOT_PUBLISHED');
return false;
}
}
$this->assign('rowid', $model->_rowId);
$this->assign('access', $model->checkAccessFromListSettings());
if ($this->access == 0) {
return JError::raiseWarning(500, JText::_('JERROR_ALERTNOAUTHOR'));
}
JDEBUG ? $profiler->mark('form view before join group ids got') : null;
if (!$listModel->noTable()) {
$joins = $listModel->getJoins();
$model->getJoinGroupIds($joins);
}
$params = $model->getParams();
$this->setTitle($w, $params, $model);
FabrikHelperHTML::debug($params->get('note'), 'note');
$params->def('icons', $app->getCfg('icons'));
$params->set('popup', JRequest::getVar('tmpl') == 'component' ? 1 : 0);
$this->editable = $model->isEditable();
$form->label = $this->get('label');
$form->intro = $model->getIntro();
$form->outro = $model->getOutro();
$form->action = $this->get('Action');
$form->formid = $model->isEditable() ? 'form_' . $model->getId() : 'details_' . $model->getId();
$form->name = 'form_' . $model->getId();
if ($form->error === '') {
$form->error = JText::_('COM_FABRIK_FAILED_VALIDATION');
}
$form->origerror = $form->error;
$form->error = $model->hasErrors() ? $form->error : '';
JDEBUG ? $profiler->mark('form view before validation classes loaded') : null;
$tmpl = $this->get('tmpl');
$this->assign('tmpl', $tmpl);
$this->_addButtons();
JDEBUG ? $profiler->mark('form view before group view got') : null;
$this->groups = $model->getGroupView($tmpl);
JDEBUG ? $profiler->mark('form view after group view got') : null;
$this->assignRef('data', $model->data);
$this->assignRef('modeldata', $model->_data);
$this->assignRef('params', $params);
$this->assign('tipLocation', $params->get('tiplocation'));
FabrikHelperHTML::debug($this->groups, 'form:view:groups');
// Cck in admin?
$this->cck();
JDEBUG ? $profiler->mark('form view: after cck') : null;
// Force front end templates
$this->_basePath = COM_FABRIK_FRONTEND . '/views';
$this->_addJavascript($listModel->getId());
JDEBUG ? $profiler->mark('form view: after add js') : null;
$this->_loadTmplBottom($form);
JDEBUG ? $profiler->mark('form view: after tmpl bottom loaded') : null;
if ($model->isEditable()) {
$form->startTag = '<form action="' . $form->action . '" class="fabrikForm" method="post" name="' . $form->name . '" id="' . $form->formid . '" enctype="' . $model->getFormEncType() . '">';
$form->endTag = '</form>';
$form->fieldsetTag = 'fieldset';
$form->legendTag = 'legend';
} else {
$form->startTag = '<div class="fabrikForm fabrikDetails" id="' . $form->formid . '">';
$form->endTag = '</div>';
$form->fieldsetTag = 'div';
$form->legendTag = 'h3';
}
$this->assignRef('form', $form);
JDEBUG ? $profiler->mark('form view: form assigned as ref') : null;
$list = new stdClass();
$list->id = $form->record_in_database ? $model->getListModel()->getTable()->id : 0;
$this->assignRef('list', $list);
JDEBUG ? $profiler->mark('form view: before getRelatedTables()') : null;
$this->linkedTables = $this->get('RelatedTables');
JDEBUG ? $profiler->mark('form view: after getRelatedTables()') : null;
$this->setMessage();
$this->addTemplatePath($this->_basePath . '/' . $this->_name . '/tmpl/' . $tmpl);
$root = $app->isAdmin() ? JPATH_ADMINISTRATOR : JPATH_SITE;
//.........這裏部分代碼省略.........
示例12: buildQuery
//.........這裏部分代碼省略.........
$whereKey = $params->get('cascadingdropdown_key');
if (!is_null($whereVal) && $whereKey != '') {
$whereBits = strstr($whereKey, '___') ? explode('___', $whereKey) : explode('.', $whereKey);
$whereKey = array_pop($whereBits);
if (is_array($whereVal)) {
foreach ($whereVal as &$v) {
// Jaanus: Solving bug: imploded arrays when chbx in repeated group
if (is_array($v)) {
foreach ($v as &$vchild) {
$vchild = FabrikString::safeQuote($vchild);
}
$v = implode(',', $v);
} else {
$v = FabrikString::safeQuote($v);
}
}
// Jaanus: if count of where values is 0 or if there are no letters or numbers, only commas in imploded array
$where .= count($whereVal) == 0 || !preg_match('/\\w/', implode(',', $whereVal)) ? '4 = -4' : $whereKey . ' IN ' . '(' . str_replace(',,', ',\'\',', implode(',', $whereVal)) . ')';
} else {
$where .= $whereKey . ' = ' . $db->quote($whereVal);
}
}
$filter = $params->get('cascadingdropdown_filter');
if (!empty($this->autocomplete_where)) {
$where .= $where !== '' ? ' AND ' . $this->autocomplete_where : $this->autocomplete_where;
}
/* $$$ hugh - temporary hack to work around this issue:
* http://fabrikar.com/forums/showthread.php?p=71288#post71288
* ... which is basically that if they are using {placeholders} in their
* filter query, there's no point trying to apply that filter if we
* aren't in form view, for instance when building a search filter
* or in table view when the cdd is in a repeat group, 'cos there won't
* be any {placeholder} data to use.
* So ... for now, if the filter contains {...}, and view!=form ... skip it
* $$$ testing fix for the bandaid, ccd JS should not be submitting data from form
*/
if (trim($filter) != '') {
$where .= $where == '' ? ' ' : ' AND ';
$where .= $filter;
}
$w = new FabrikWorker();
// $$$ hugh - add some useful stuff to search data
$placeholders = is_null($whereVal) ? array() : array('whereval' => $whereVal, 'wherekey' => $whereKey);
$join = $this->getJoin();
$where = $this->parseThisTable($where, $join);
$data = array_merge($data, $placeholders);
$where = $w->parseMessageForRepeats($where, $data, $this, $repeatCounter);
$where = $w->parseMessageForPlaceHolder($where, $data);
$table = $this->getDbName();
$key = $this->queryKey();
$orderBy = 'text';
$tables = $this->getFormModel()->getLinkedFabrikLists($params->get('join_db_name'));
$listModel = JModelLegacy::getInstance('List', 'FabrikFEModel');
$val = $params->get('cascadingdropdown_label_concat');
if (!empty($val)) {
$val = $this->parseThisTable($val, $join);
$val = $w->parseMessageForPlaceHolder($val, $data);
$val = 'CONCAT_WS(\'\', ' . $val . ')';
$orderBy = $val;
} else {
$val = FabrikString::safeColName($params->get($this->labelParam));
$val = preg_replace("#^`({$table})`\\.#", $db->qn($join->table_join_alias) . '.', $val);
foreach ($tables as $tid) {
$listModel->setId($tid);
$listModel->getTable();
$formModel = $this->getFormModel();
$formModel->getGroupsHiarachy();
$orderBy = $val;
// See if any of the tables elements match the db joins val/text
foreach ($groups as $groupModel) {
$elementModels = $groupModel->getPublishedElements();
foreach ($elementModels as $elementModel) {
$element = $elementModel->element;
if ($element->name == $val) {
$val = $elementModel->modifyJoinQuery($val);
}
}
}
}
}
$val = str_replace($db->qn($table), $db->qn($join->table_join_alias), $val);
$query = $db->getQuery(true);
$query->select('DISTINCT(' . $key . ') AS value, ' . $val . 'AS text');
$desc = $params->get('cdd_desc_column', '');
if ($desc !== '') {
$query->select(FabrikString::safeColName($desc) . ' AS description');
}
$query->from($db->qn($table) . ' AS ' . $db->qn($join->table_join_alias));
$query = $this->buildQueryJoin($query);
$where = FabrikString::rtrimword($where);
if ($where !== '') {
$query->where($where);
}
if (!JString::stristr($where, 'order by')) {
$query->order($orderBy . ' ASC');
}
$this->sql[$sig] = $query;
FabrikHelperHTML::debug((string) $this->sql[$sig]);
return $this->sql[$sig];
}
示例13: formatForJoins
/**
* $$$ rob 19/10/2011 now called before formatData() from getData() as otherwise element tips (created in element->renderListData())
* only contained first merged records data and not all merged records
*
* Collapses 'repeated joined' rows into a single row.
* If a group is not repeating we just use the first row's data (as subsequent rows will contain the same data
* Otherwise if the group is repeating we append each repeated record's data into the first row's data
* All rows execpt the first row for each group are then unset (as unique subsequent row's data will be contained within
* the first row)
* @param array $data
*/
function formatForJoins(&$data)
{
$merge = $this->mergeJoinedData();
if (empty($merge)) {
return;
}
$listid = $this->getTable()->id;
$dbprimaryKey = FabrikString::safeColNameToArrayKey($this->getTable()->db_primary_key);
$formModel = $this->getFormModel();
FabrikHelperHTML::debug($data, 'render:before formatForJoins');
$count = count($data);
$last_pk = '';
$last_i = 0;
$count = count($data);
$can_repeats = array();
$can_repeats_tables = array();
$can_repeats_keys = array();
$can_repeats_pk_vals = array();
$remove = array();
// First, go round first row of data, and prep some stuff.
// Basically, if doing a "reduce data" merge (merge == 2), we need to know what the
// PK element is for each joined group (well, for each element, really)
foreach ($data[0] as $key => $val) {
$origKey = $key;
$tmpkey = FabrikString::rtrimword($key, '_raw');
// $$$ hugh - had to cache this stuff, because if you have a lot of rows and a lot of elements,
// doing this many hundreds of times causes huge slowdown, exceeding max script execution time!
// And we really only need to do it once for the first row.
if (!isset($can_repeats[$tmpkey])) {
$elementModel = $formModel->getElement($tmpkey);
// $$$ rob - testing for linking join which is repeat but linked join which is not - still need separate info from linked to join
//$can_repeats[$tmpkey] = $elementModel ? ($elementModel->getGroup()->canRepeat()) : 0;
if ($merge == 2 && $elementModel) {
if ($elementModel->getGroup()->canRepeat() || $elementModel->getGroup()->isJoin()) {
// We need to work out the PK of the joined table.
// So first, get the table name.
$group = $elementModel->getGroup();
$join = $group->getJoinModel()->getJoin();
$join_table_name = $join->table_join;
// We have the table name, so see if we already have it cached ...
if (!isset($can_repeats_tables[$join_table_name])) {
// We don't have it yet, so grab the PK
$keys = $this->getPrimaryKeyAndExtra($join_table_name);
if (!empty($keys) && array_key_exists('key', $keys[0])) {
// OK, now we have the PK for the table
$can_repeats_tables[$join_table_name] = $keys[0];
}
}
// Hopefully we now have the PK
if (isset($can_repeats_tables[$join_table_name])) {
$can_repeats_keys[$tmpkey] = $join_table_name . '___' . $can_repeats_tables[$join_table_name]['colname'];
}
// Create the array if it doesn't exist
if (!isset($can_repeats_pk_vals[$can_repeats_keys[$tmpkey]])) {
$can_repeats_pk_vals[$can_repeats_keys[$tmpkey]] = array();
}
// Now store the
if (!isset($can_repeats_pk_vals[$can_repeats_keys[$tmpkey]][0])) {
$can_repeats_pk_vals[$can_repeats_keys[$tmpkey]][0] = $data[0]->{$can_repeats_keys}[$tmpkey];
}
}
}
$can_repeats[$tmpkey] = $elementModel ? $elementModel->getGroup()->canRepeat() || $elementModel->getGroup()->isJoin() : 0;
}
}
for ($i = 0; $i < $count; $i++) {
// $$$rob if rendering J article in PDF format __pk_val not in pdf table view
//$next_pk = isset($data[$groupk][$i]->__pk_val) ? $data[$groupk][$i]->__pk_val : $data[$groupk][$i]->id;
$next_pk = isset($data[$i]->__pk_val) ? $data[$i]->__pk_val : $data[$i]->{$dbprimaryKey};
if (!empty($last_pk) && $last_pk == $next_pk) {
foreach ($data[$i] as $key => $val) {
$origKey = $key;
$tmpkey = FabrikString::rtrimword($key, '_raw');
if (isset($data[$last_i]->{$key}) && $can_repeats[$tmpkey]) {
if ($merge == 2 && !isset($can_repeats_pk_vals[$can_repeats_keys[$tmpkey]][$i])) {
$can_repeats_pk_vals[$can_repeats_keys[$tmpkey]][$i] = $data[$i]->{$can_repeats_keys}[$tmpkey];
}
// $$$ rob - what about data like yes/no where each viewable option needs to be shown?
// $$$ rob - yeah commenting this out, not a good idea - as other cols for this record may have
// different data so you end up with this col having 3 entries and the next col having four and you can't
// see the correlation between the two sets of data.
//if ($data[$groupk][$last_i]->$key != $val) {
// $$$ rob meant that only one link to details was shown in admin - dont see the point in that
//if (preg_match("#\W+fabrik___rowlink.*\W+listid=$listid\W#",$val)) {
//continue;
//}
if ($origKey == $tmpkey) {
// $$$ rob - this was just appending data with a <br> but as we do thie before the data is formatted
// it was causing all sorts of issues for list rendering of links, dates etc. So now turn the data into
//.........這裏部分代碼省略.........
示例14: display
/**
* main setup routine for displaying the form/detail view
* @param string template
*/
function display($tpl = null)
{
$profiler = JProfiler::getInstance('Application');
FabrikHelperHTML::framework();
$app = JFactory::getApplication();
$w = new FabrikWorker();
$config = JFactory::getConfig();
$model = $this->getModel('form');
$document = JFactory::getDocument();
$model->isMambot = $this->isMambot;
$form = $model->getForm();
if ($model->render() === false) {
return false;
}
$this->isMultiPage = $model->isMultiPage();
list($this->plugintop, $this->pluginbottom, $this->pluginend) = $this->get('FormPluginHTML');
$listModel = $model->getlistModel();
$table = $listModel->noTable() ? null : $listModel->getTable();
if (!$model->canPublish()) {
if (!$app->isAdmin()) {
echo JText::_('COM_FABRIK_FORM_NOT_PUBLISHED');
return false;
}
}
$this->assign('rowid', $model->_rowId);
$this->assign('access', $model->checkAccessFromListSettings());
if ($this->access == 0) {
return JError::raiseWarning(500, JText::_('JERROR_ALERTNOAUTHOR'));
}
JDEBUG ? $profiler->mark('form view before join group ids got') : null;
if (!$listModel->noTable()) {
$joins = $listModel->getJoins();
$model->getJoinGroupIds($joins);
}
$params = $model->getParams();
$this->setTitle($w, $params);
FabrikHelperHTML::debug($params->get('note'), 'note');
$params->def('icons', $app->getCfg('icons'));
$params->set('popup', JRequest::getVar('tmpl') == 'component' ? 1 : 0);
$this->editable = $model->_editable;
$form->label = $this->get('label');
$form->intro = $this->get('Intro');
$form->action = $this->get('Action');
$form->formid = $model->_editable ? "form_" . $model->getId() : 'details_' . $model->getId();
$form->name = "form_" . $model->getId();
if ($form->error === '') {
$form->error = JText::_('COM_FABRIK_FAILED_VALIDATION');
}
//if errors made when submitting from a J plugin they are stored in the session
$errors = $this->get('Errors');
$form->origerror = $form->error;
$form->error = count($errors) > 0 ? $form->error : '';
$this->_addButtons();
JDEBUG ? $profiler->mark('form view before validation classes loaded') : null;
$tmpl = $this->get('tmpl');
$this->assign('tmpl', $tmpl);
JDEBUG ? $profiler->mark('form view before group view got') : null;
$this->groups = $model->getGroupView($tmpl);
JDEBUG ? $profiler->mark('form view after group view got') : null;
$this->assignRef('data', $model->data);
$this->assignRef('modeldata', $model->_data);
$this->assignRef('params', $params);
$this->assign('tipLocation', $params->get('tiplocation'));
FabrikHelperHTML::debug($this->groups, 'form:view:groups');
//cck in admin?
$this->cck();
JDEBUG ? $profiler->mark('form view: after cck') : null;
//force front end templates
$this->_basePath = COM_FABRIK_FRONTEND . DS . 'views';
$this->_addJavascript($listModel->getId());
JDEBUG ? $profiler->mark('form view: after add js') : null;
$this->_loadTmplBottom($form);
JDEBUG ? $profiler->mark('form view: after tmpl bottom loaded') : null;
if ($model->_editable) {
$form->startTag = '<form action="' . $form->action . '" class="fabrikForm" method="post" name="' . $form->name . '" id="' . $form->formid . '" enctype="' . $model->getFormEncType() . '">';
$form->endTag = '</form>';
} else {
$form->startTag = '<div class="fabrikForm fabrikDetails" id="' . $form->formid . '">';
$form->endTag = '</div>';
}
$form->endTag .= $this->pluginend;
$this->assignRef('form', $form);
JDEBUG ? $profiler->mark('form view: form assigned as ref') : null;
$list = new stdClass();
$list->id = $form->record_in_database ? $model->getListModel()->getTable()->id : 0;
$this->assignRef('list', $list);
JDEBUG ? $profiler->mark('form view: before getRelatedTables()') : null;
$this->assignRef('linkedTables', $this->get('RelatedTables'));
JDEBUG ? $profiler->mark('form view: after getRelatedTables()') : null;
$this->setMessage();
$this->addTemplatePath($this->_basePath . DS . $this->_name . DS . 'tmpl' . DS . $tmpl);
$this->addTemplatePath(JPATH_SITE . DS . 'templates' . DS . $app->getTemplate() . DS . 'html' . DS . 'com_fabrik' . DS . 'form' . DS . $tmpl);
JDEBUG ? $profiler->mark('form view before template load') : null;
$text = $this->loadTemplate();
if ($params->get('process-jplugins') == 1 || $params->get('process-jplugins') == 2 && $model->_editable === false) {
$opt = JRequest::getVar('option');
//.........這裏部分代碼省略.........
示例15: getJSIcons
//.........這裏部分代碼省略.........
$html = str_replace("'", '"', $html);
$this->txt[] = $html;
if ($iconImg == '') {
$iconImg = JArrayHelper::getValue($markerImages, $c, '');
if ($iconImg != '') {
$iconImg = JArrayHelper::getValue($rowdata, $iconImg, '');
// Get the src
preg_match('/src=["|\'](.*?)["|\']/', $iconImg, $matches);
if (array_key_exists(1, $matches)) {
$iconImg = $matches[1];
// Check file exists
$path = str_replace(COM_FABRIK_LIVESITE, '', $iconImg);
if (JFile::exists(JPATH_BASE . $path)) {
$customimagefound = true;
}
}
}
if ($iconImg != '') {
list($width, $height) = $this->markerSize($iconImg);
} else {
// Standard google map icon size
$width = 20;
$height = 34;
}
} else {
// Standard google map icon size
list($width, $height) = $this->markerSize(JPATH_SITE . '/images/stories/' . $iconImg);
}
$gClass = JArrayHelper::getValue($groupClass, 0, '');
if (!empty($gClass)) {
$gClass .= '_raw';
$gClass = isset($row->{$gClass}) ? $row->{$gClass} : '';
}
if (array_key_exists($v[0] . $v[1], $icons)) {
$existingIcon = $icons[$v[0] . $v[1]];
if ($existingIcon['groupkey'] == $groupKey) {
/* $$$ hugh - this inserts label between multiple record $html, but not at the top.
* If they want to insert label, they can do it themselves in the template.
* $icons[$v[0].$v[1]][2] = $icons[$v[0].$v[1]][2] . "<h6>$table->label</h6>" . $html;
* Don't insert linebreaks in empty bubble
*/
if ($html != '') {
$html = "<br />" . $html;
}
$icons[$v[0] . $v[1]][2] = $icons[$v[0] . $v[1]][2] . $html;
if ($customimagefound) {
$icons[$v[0] . $v[1]][3] = $iconImg;
}
} else {
$groupedIcons[] = array($v[0], $v[1], $html, $iconImg, $width, $height, 'groupkey' => $groupKey, 'listid' => $listid, 'title' => $title, 'groupClass' => 'type' . $gClass);
}
} else {
// Default icon - lets see if we need to use a letter icon instead
if (JArrayHelper::getValue($letters, $c, '') != '') {
$iconImg = $uri->getScheme() . '://www.google.com/mapfiles/marker' . JString::strtoupper($letters[$c]) . '.png';
}
$icons[$v[0] . $v[1]] = array($v[0], $v[1], $html, $iconImg, $width, $height, 'groupkey' => $groupKey, 'listid' => $listid, 'title' => $title, 'groupClass' => 'type' . $gClass);
}
if ($params->get('fb_gm_use_radius', '0') == '1') {
$radiusElement = JArrayHelper::getValue($radiusElements, $c, '');
$radiusUnits = JArrayHelper::getValue($radiusUnits, $c, 'k');
$radiusMeters = $radiusUnits == 'k' ? 1000 : 1609.34;
if (!empty($radiusElement)) {
$radius = (double) $row->{$radiusElement};
$radius *= $radiusMeters;
$icons[$v[0] . $v[1]]['radius'] = $radius;
} else {
$default = (double) JArrayHelper::getvalue($radiusDefaults, $c, 50);
$default *= $radiusMeters;
$icons[$v[0] . $v[1]]['radius'] = $default;
}
}
$icons[$v[0] . $v[1]]['c'] = $c;
$this->recordCount++;
$k++;
}
}
// Replace last icon?
$iconImg = JArrayHelper::getValue($aLastIcons, $c, '');
if ($iconImg != '') {
list($width, $height) = $this->markerSize(JPATH_SITE . '/media/com_fabrik/images/' . $iconImg);
$icons[$v[0] . $v[1]][3] = $iconImg;
$icons[$v[0] . $v[1]][4] = $width;
$icons[$v[0] . $v[1]][5] = $height;
}
$c++;
}
// Replace coord keys with numeric keys
$icons = array_values($icons);
$icons = array_merge($icons, $groupedIcons);
if ($maxMarkers != 0 && $maxMarkers < count($icons)) {
$icons = array_slice($icons, -$maxMarkers);
}
$limitMessageShown = !($k >= $recLimit);
if (!$limitMessageShown && $recLimit !== 0 && $limitMessage != '') {
$app->enqueueMessage($limitMessage);
}
FabrikHelperHTML::debug($icons, 'map');
return $icons;
}