本文整理汇总了PHP中FabrikString::safeColnameToArrayKey方法的典型用法代码示例。如果您正苦于以下问题:PHP FabrikString::safeColnameToArrayKey方法的具体用法?PHP FabrikString::safeColnameToArrayKey怎么用?PHP FabrikString::safeColnameToArrayKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FabrikString
的用法示例。
在下文中一共展示了FabrikString::safeColnameToArrayKey方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onCanSelectRow
function onCanSelectRow($params, $tableModel, $row)
{
// If $row is null, we were called from the table's canEdit() in a per-table rather than per-row context,
// and we don't have an opinion on per-table edit permissions, so just return true.
if (!is_object($row[0])) {
return true;
}
$field = $params->get('canselectrow_field');
$field = FabrikString::safeColnameToArrayKey($field);
// $$$ rob if no can edit field selected in admin return true
if (trim($field) == '') {
return true;
}
$value = $params->get('canselectrow_value');
return $row[0]->{$field} == $value;
}
示例2: onCanEdit
function onCanEdit($params, $tableModel, $row)
{
// If $row is null, we were called from the table's canEdit() in a per-table rather than per-row context,
// and we don't have an opinion on per-table edit permissions, so just return true.
if (is_null($row) || is_null($row[0])) {
return true;
}
if (is_array($row[0])) {
$data = JArrayHelper::toObject($row[0]);
} else {
$data = $row[0];
}
//$field = str_replace('.', '___', $params->get('caneditrow_field'));
$field = $params->get('caneditrow_field');
$field = FabrikString::safeColnameToArrayKey($field);
// $$$ rob if no can edit field selected in admin return true
if (trim($field) == '') {
return true;
}
// If they provided some PHP to eval, we ignore the other settings and just run their code
$caneditrow_eval = $params->get('caneditrow_eval', '');
if (!empty($caneditrow_eval)) {
$w = new FabrikWorker();
$data = JArrayHelper::fromObject($data);
$caneditrow_eval = $w->parseMessageForPlaceHolder($caneditrow_eval, $data);
$caneditrow_eval = @eval($caneditrow_eval);
FabrikWorker::logEval($caneditrow_eval, 'Caught exception on eval in can edit row : %s');
return $caneditrow_eval;
} else {
// No PHP given, so just do a simple match on the specified element and value settigns.
if ($params->get('caneditrow_useraw', '0') == '1') {
$field .= '_raw';
}
$value = $params->get('caneditrow_value');
return $data->{$field} == $value;
}
}