本文整理匯總了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;
}