/** * @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; }
/** * 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; }
/** * 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; }
/** * 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; }