本文整理汇总了PHP中FabrikString::safeNameQuote方法的典型用法代码示例。如果您正苦于以下问题:PHP FabrikString::safeNameQuote方法的具体用法?PHP FabrikString::safeNameQuote怎么用?PHP FabrikString::safeNameQuote使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FabrikString
的用法示例。
在下文中一共展示了FabrikString::safeNameQuote方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getMaxRowId
/**
* Get the max row id - used when requesting rowid=-2 to return the last recorded detailed view
*
* @return int max row id
*/
protected function getMaxRowId()
{
if (!$this->getForm()->record_in_database) {
return $this->rowId;
}
$listModel = $this->getListModel();
$fabrikDb = $listModel->getDb();
$item = $listModel->getTable();
$k = FabrikString::safeNameQuote($item->db_primary_key);
// @TODO JQuery this
$fabrikDb->setQuery("SELECT MAX({$k}) FROM " . FabrikString::safeColName($item->db_table_name) . $listModel->buildQueryWhere());
return $fabrikDb->loadResult();
}
示例2: buildQueryOrder
/**
* Get the part of the sql statement that orders the table data
* Since 3.0.7 caches the results as calling orderBy twice when using single ordering in admin module anules the user selected order by
*
* @param mixed $query False or a query object
*
* @throws ErrorException
*
* @return mixed string or query object - Ordering part of sql statement
*/
public function buildQueryOrder($query = false)
{
$sig = $query ? 1 : 0;
if (!isset($this->orderBy)) {
$this->orderBy = array();
}
if (array_key_exists($sig, $this->orderBy)) {
return $this->orderBy[$sig];
}
$package = $this->app->getUserState('com_fabrik.package', 'fabrik');
$params = $this->getParams();
$input = $this->app->input;
$formModel = $this->getFormModel();
$table = $this->getTable();
$db = $this->getDb();
$this->selectedOrderFields = array();
if ($this->outputFormat == 'fabrikfeed' || $this->outputFormat == 'feed') {
$dateColId = (int) $params->get('feed_date', 0);
$dateColElement = $formModel->getElement($dateColId, true);
$dateCol = $db->qn($dateColElement->getFullName(false, false, false));
if ($dateColId !== 0) {
$this->order_dir = 'DESC';
$this->order_by = $dateCol;
if (!$query) {
return "\n" . ' ORDER BY ' . $dateCol . ' DESC';
} else {
$query->order($dateCol . ' DESC');
return $query;
}
}
}
$strOrder = '';
/**
* When list reordered the controller runs order() and
* stores the order settings in the session by calling setOrderByAndDir()
* it then redirects to the list view and here all we need to do it get
* those order settings from the session
*/
$elements = $this->getElements();
// Build the order by statement from the session
$clearOrdering = (bool) $input->getInt('clearordering', false) && $input->get('task') !== 'order';
$singleOrdering = $this->singleOrdering();
foreach ($elements as $element) {
$context = 'com_' . $package . '.list' . $this->getRenderContext() . '.order.' . $element->getElement()->id;
if ($clearOrdering) {
$this->session->set($context, null);
} else {
// $$$tom Added single-ordering option
if (!$singleOrdering || $singleOrdering && $element->getElement()->id == $input->getInt('orderby')) {
$dir = $this->session->get($context);
if ($dir != '' && $dir != '-' && trim($dir) != 'Array') {
$strOrder == '' ? $strOrder = "\n ORDER BY " : ($strOrder .= ',');
$strOrder .= FabrikString::safeNameQuote($element->getOrderByName(), false) . ' ' . $dir;
$orderByName = FabrikString::safeNameQuote($element->getOrderByName(), false);
$this->orderEls[] = $orderByName;
$this->orderDirs[] = $dir;
$element->getAsField_html($this->selectedOrderFields, $aAsFields);
if ($query !== false && is_object($query)) {
$query->order($orderByName . ' ' . $dir);
}
}
} else {
$this->session->set($context, null);
}
}
}
$userHasOrdered = $strOrder == '' ? false : true;
// If nothing found in session use default ordering (or that set by querystring)
if (!$userHasOrdered) {
$orderBys = explode(',', $input->getString('order_by', $input->getString('orderby', '')));
if ($orderBys[0] == '') {
$orderBys = json_decode($table->order_by, true);
}
// $$$ not sure why, but sometimes $orderBys is NULL at this point.
if (!isset($orderBys)) {
$orderBys = array();
}
// Covert ids to names (were stored as names but then stored as ids)
foreach ($orderBys as &$orderBy) {
if (is_numeric($orderBy)) {
$elementModel = $formModel->getElement($orderBy, true);
$orderBy = $elementModel ? $elementModel->getOrderByName() : $orderBy;
}
}
$orderDirs = explode(',', $input->getString('order_dir', $input->getString('orderdir', '')));
if ($orderDirs[0] == '') {
$orderDirs = json_decode($table->order_dir, true);
}
$els = $this->getElements('filtername');
if (!empty($orderBys)) {
//.........这里部分代码省略.........
示例3: parseThisTable
/**
* @param string $string Search string
* @param FabrikTableJoin $join Join table
* @param string $alias Table alias - defaults to the join->table_join_alias
*
* @return mixed
*/
protected function parseThisTable($string, $join = null, $alias = null)
{
if (is_null($join)) {
$join = $this->getJoin();
}
if (is_null($alias)) {
$alias = $join->table_join_alias;
}
return str_replace('{thistable}', FabrikString::safeNameQuote($alias), $string);
}