本文整理汇总了PHP中xPDOObject::checkPolicy方法的典型用法代码示例。如果您正苦于以下问题:PHP xPDOObject::checkPolicy方法的具体用法?PHP xPDOObject::checkPolicy怎么用?PHP xPDOObject::checkPolicy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类xPDOObject
的用法示例。
在下文中一共展示了xPDOObject::checkPolicy方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: prepareRow
/**
* @param xPDOObject|quipThread $object
* @return boolean
*/
public function prepareRow(xPDOObject $object)
{
if (!$object->checkPolicy('view')) {
return false;
}
$threadArray = $object->toArray();
$resourceTitle = $object->get('pagetitle');
if (!empty($resourceTitle)) {
$threadArray['url'] = $object->makeUrl();
}
$cls = '';
$cls .= $object->checkPolicy('truncate') ? ' truncate' : '';
$cls .= $object->checkPolicy('remove') ? ' remove' : '';
$threadArray['perm'] = $cls;
return $threadArray;
}
示例2: prepareRow
/**
* Prepare the source for iteration and output
*
* @param xPDOObject|modAccessibleObject $object
* @return array
*/
public function prepareRow(xPDOObject $object)
{
$canEdit = $this->modx->hasPermission('source_edit');
$canSave = $this->modx->hasPermission('source_save');
$canRemove = $this->modx->hasPermission('source_delete');
$objectArray = $object->toArray();
$cls = array();
if ($object->checkPolicy('save') && $canSave && $canEdit) {
$cls[] = 'pupdate';
}
if ($object->checkPolicy('remove') && $canRemove) {
$cls[] = 'premove';
}
if ($object->checkPolicy('copy') && $canSave) {
$cls[] = 'pduplicate';
}
$objectArray['cls'] = implode(' ', $cls);
return $objectArray;
}
示例3: prepareRow
/**
* Prepare the source for iteration and output
*
* @param xPDOObject|modAccessibleObject|modMediaSource $object
* @return array
*/
public function prepareRow(xPDOObject $object)
{
$canEdit = $this->modx->hasPermission('source_edit');
$canSave = $this->modx->hasPermission('source_save');
$canRemove = $this->modx->hasPermission('source_delete');
$objectArray = $object->toArray();
$objectArray['iconCls'] = $this->modx->getOption('mgr_source_icon', null, 'icon-folder-open-o');
$props = $object->getPropertyList();
if (isset($props['iconCls']) && !empty($props['iconCls'])) {
$objectArray['iconCls'] = $props['iconCls'];
}
$cls = array();
if ($object->checkPolicy('save') && $canSave && $canEdit) {
$cls[] = 'pupdate';
}
if ($object->checkPolicy('remove') && $canRemove) {
$cls[] = 'premove';
}
if ($object->checkPolicy('copy') && $canSave) {
$cls[] = 'pduplicate';
}
$objectArray['cls'] = implode(' ', $cls);
return $objectArray;
}
示例4: prepareRow
/**
* Prepare the row for iteration
* @param xPDOObject $object
* @return array
*/
public function prepareRow(xPDOObject $object)
{
if (!$object->checkPolicy('view')) {
return array();
}
$resourceArray = $object->get(array('id', 'pagetitle', 'description', 'published', 'deleted', 'context_key'));
$resourceArray['menu'] = array();
$resourceArray['menu'][] = array('text' => $this->modx->lexicon('resource_view'), 'params' => array('a' => 'resource/data', 'id' => $object->get('id')));
if ($this->modx->hasPermission('edit_document')) {
$resourceArray['menu'][] = array('text' => $this->modx->lexicon('resource_edit'), 'params' => array('a' => 'resource/update', 'id' => $object->get('id')));
}
$resourceArray['menu'][] = '-';
$resourceArray['menu'][] = array('text' => $this->modx->lexicon('resource_preview'), 'handler' => 'this.preview');
return $resourceArray;
}