本文整理汇总了PHP中modObjectGetListProcessor::prepareRow方法的典型用法代码示例。如果您正苦于以下问题:PHP modObjectGetListProcessor::prepareRow方法的具体用法?PHP modObjectGetListProcessor::prepareRow怎么用?PHP modObjectGetListProcessor::prepareRow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类modObjectGetListProcessor
的用法示例。
在下文中一共展示了modObjectGetListProcessor::prepareRow方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: prepareRow
/**
* Prepare the row for iteration
* @param xPDOObject $object
* @return array
*/
public function prepareRow(xPDOObject $object)
{
$resourceArray = parent::prepareRow($object);
foreach ($resourceArray as $field => $value) {
if (!in_array($field, array('id', 'pagetitle', 'published', 'deleted', 'hidemenu', 'isfolder', 'publishedon', 'context_key', 'properties'))) {
unset($resourceArray[$field]);
continue;
}
// avoid null on returns
$resourceArray[$field] = $resourceArray[$field] !== null ? $resourceArray[$field] : '';
}
$settings = $object->getProperties('gridclasskey');
if (is_array($settings) && !empty($settings)) {
foreach ($settings as $k => $v) {
$resourceArray['gridclasskey-property-' . $k] = $v;
}
}
if (isset($resourceArray['publishedon'])) {
$publishedon = strtotime($resourceArray['publishedon']);
$resourceArray['publishedon_date'] = strftime($this->modx->getOption('gridclasskey.mgr_date_format', null, '%b %d'), $publishedon);
$resourceArray['publishedon_time'] = strftime($this->modx->getOption('gridclasskey.mgr_time_format', null, '%H:%I %p'), $publishedon);
$resourceArray['publishedon'] = strftime('%b %d, %Y %H:%I %p', $publishedon);
}
$resourceArray['action_edit'] = '?a=' . $this->editAction . '&id=' . $resourceArray['id'];
$this->modx->getContext($resourceArray['context_key']);
$resourceArray['preview_url'] = $this->modx->makeUrl($resourceArray['id'], $resourceArray['context_key'], null, 'full');
$c = $this->modx->newQuery('modResource');
$c->where(array('parent' => $resourceArray['id']));
$c->limit(1);
$resourceArray['has_children'] = (bool) $this->modx->getCount('modResource', $c);
return $resourceArray;
}
示例2: prepareRow
/**
* @param xPDOObject $object
*
* @return array
*/
public function prepareRow(xPDOObject $object)
{
$array = parent::prepareRow($object);
if (empty($array['author'])) {
$array['author'] = $array['username'];
}
$this->modx->getContext($array['context_key']);
$array['preview_url'] = $this->modx->makeUrl($array['id'], $array['context_key']);
$icon = $this->_modx23 ? 'icon' : 'fa';
$array['actions'] = array();
// View
if (!empty($array['preview_url'])) {
$array['actions'][] = array('cls' => '', 'icon' => "{$icon} {$icon}-eye", 'title' => $this->modx->lexicon('tickets_action_view'), 'action' => 'viewTicket', 'button' => true, 'menu' => true);
}
// Edit
$array['actions'][] = array('cls' => '', 'icon' => "{$icon} {$icon}-edit", 'title' => $this->modx->lexicon('tickets_action_edit'), 'action' => 'editTicket', 'button' => false, 'menu' => true);
// Duplicate
$array['actions'][] = array('cls' => '', 'icon' => "{$icon} {$icon}-files-o", 'title' => $this->modx->lexicon('tickets_action_duplicate'), 'action' => 'duplicateTicket', 'button' => false, 'menu' => true);
// Publish
if (!$array['published']) {
$array['actions'][] = array('cls' => '', 'icon' => "{$icon} {$icon}-power-off action-green", 'title' => $this->modx->lexicon('tickets_action_publish'), 'multiple' => $this->modx->lexicon('tickets_action_publish'), 'action' => 'publishTicket', 'button' => true, 'menu' => true);
} else {
$array['actions'][] = array('cls' => '', 'icon' => "{$icon} {$icon}-power-off action-gray", 'title' => $this->modx->lexicon('tickets_action_unpublish'), 'multiple' => $this->modx->lexicon('tickets_action_unpublish'), 'action' => 'unpublishTicket', 'button' => true, 'menu' => true);
}
// Delete
if (!$array['deleted']) {
$array['actions'][] = array('cls' => '', 'icon' => "{$icon} {$icon}-trash-o action-red", 'title' => $this->modx->lexicon('tickets_action_delete'), 'multiple' => $this->modx->lexicon('tickets_action_delete'), 'action' => 'deleteTicket', 'button' => false, 'menu' => true);
} else {
$array['actions'][] = array('cls' => '', 'icon' => "{$icon} {$icon}-undo action-green", 'title' => $this->modx->lexicon('tickets_action_undelete'), 'multiple' => $this->modx->lexicon('tickets_action_undelete'), 'action' => 'undeleteTicket', 'button' => true, 'menu' => true);
}
// Menu
$array['actions'][] = array('cls' => '', 'icon' => "{$icon} {$icon}-cog actions-menu", 'menu' => false, 'button' => true, 'action' => 'showMenu', 'type' => 'menu');
return $array;
}
示例3: prepareRow
/**
* Prepare the row for iteration
*
* @param xPDOObject $object
*
* @return array
*/
public function prepareRow(xPDOObject $object)
{
if ($this->getProperty('combo')) {
return $object->get(array('id', 'name', 'pagetitle'));
}
$array = parent::prepareRow($object);
$icon = $this->_modx23 ? 'icon' : 'fa';
$array['actions'] = array();
// View
$array['actions'][] = array('cls' => '', 'icon' => "{$icon} {$icon}-comments-o", 'title' => $this->modx->lexicon('tickets_action_view'), 'action' => 'viewThread', 'button' => empty($array['deleted']) || empty($array['closed']), 'menu' => true);
// Publish
if (!$array['closed']) {
$array['actions'][] = array('cls' => '', 'icon' => "{$icon} {$icon}-power-off action-gray", 'title' => $this->modx->lexicon('tickets_action_close'), 'multiple' => $this->modx->lexicon('tickets_action_close'), 'action' => 'closeThread', 'button' => empty($array['deleted']), 'menu' => true);
} else {
$array['actions'][] = array('cls' => '', 'icon' => "{$icon} {$icon}-power-off action-green", 'title' => $this->modx->lexicon('tickets_action_open'), 'multiple' => $this->modx->lexicon('tickets_action_open'), 'action' => 'openThread', 'button' => true, 'menu' => true);
}
// Delete
if (!$array['deleted']) {
$array['actions'][] = array('cls' => '', 'icon' => "{$icon} {$icon}-trash-o action-yellow", 'title' => $this->modx->lexicon('tickets_action_delete'), 'multiple' => $this->modx->lexicon('tickets_action_delete'), 'action' => 'deleteThread', 'button' => false, 'menu' => true);
} else {
$array['actions'][] = array('cls' => '', 'icon' => "{$icon} {$icon}-undo action-green", 'title' => $this->modx->lexicon('tickets_action_undelete'), 'multiple' => $this->modx->lexicon('tickets_action_undelete'), 'action' => 'undeleteThread', 'button' => true, 'menu' => true);
}
$array['actions'][] = array('cls' => '', 'icon' => "{$icon} {$icon}-trash-o action-red", 'title' => $this->modx->lexicon('tickets_action_remove'), 'multiple' => $this->modx->lexicon('tickets_action_remove'), 'action' => 'removeThread', 'button' => false, 'menu' => true);
// Menu
$array['actions'][] = array('cls' => '', 'icon' => "{$icon} {$icon}-cog actions-menu", 'menu' => false, 'button' => true, 'action' => 'showMenu', 'type' => 'menu');
return $array;
}
示例4: prepareRow
public function prepareRow(xPDOObject $object)
{
$object = parent::prepareRow($object);
$menu = array();
$menu[] = array('text' => $this->modx->lexicon('xlexicon.contextMenu_setting_update'), 'handler' => 'this.updateProperty');
$menu[] = array('text' => $this->modx->lexicon('xlexicon.contextMenu_setting_remove'), 'handler' => 'this.removeProperty');
$object['menu'] = $menu;
return $object;
}
示例5: prepareRow
/**
* Prepare the row for iteration
* @param xPDOObject $object
* @return array
*/
public function prepareRow(xPDOObject $object)
{
$objectArray = parent::prepareRow($object);
$objectArray['action_edit'] = '?a=' . $this->editAction . '&id=' . $objectArray['resource_id'];
$resource = $this->modx->getObject('modResource', $objectArray['resource_id']);
if ($resource) {
$this->modx->getContext($resource->get('context_key'));
$objectArray['preview_url'] = $this->modx->makeUrl($objectArray['resource_id'], $resource->get('context_key'), null, 'full');
}
return $objectArray;
}
示例6: prepareRow
/**
* @param xPDOObject|R $object
*
* @return array
*/
public function prepareRow(xPDOObject $object)
{
$resourceArray = parent::prepareRow($object);
if (!empty($resourceArray['date'])) {
$resourceArray['publishedon_date'] = date('j M Y', $resourceArray['date']);
$resourceArray['publishedon_time'] = date('g:s A', $resourceArray['date']);
$resourceArray['actions'] = array();
$resourceArray['actions'][] = array('text' => $this->modx->lexicon('delete'));
}
return $resourceArray;
}
示例7: prepareRow
public function prepareRow(xPDOObject $object)
{
$groupId = $object->get('group');
if ($groupId) {
$getGroup = $this->modx->getObject('modxMinifyGroup', $groupId);
if ($getGroup) {
$groupName = $getGroup->get('name');
$object->set('group_name', $groupName);
}
}
$lastmodified = filemtime($this->modx->getOption('base_path') . $object->get('filename'));
$object->set('last_modified', date('Y-m-d H:i:s', $lastmodified));
return parent::prepareRow($object);
}
示例8: prepareRow
public function prepareRow(xPDOObject $object)
{
$resourceArray = parent::prepareRow($object);
$resourceArray = $this->prepareSupportFields($resourceArray);
$resourceArray = $this->prepareActions($resourceArray);
$resourceArray = $this->prepareMenuActions($resourceArray);
return $resourceArray;
}
示例9: prepareRow
/**
* @param xPDOObject|Article $object
* @return array
*/
public function prepareRow(xPDOObject $object)
{
$resourceArray = parent::prepareRow($object);
if (!empty($resourceArray['publishedon'])) {
$publishedon = strtotime($resourceArray['publishedon']);
$resourceArray['publishedon_date'] = strftime($this->modx->getOption('articles.mgr_date_format', null, '%b %d'), $publishedon);
$resourceArray['publishedon_time'] = strftime($this->modx->getOption('articles.mgr_time_format', null, '%H:%I %p'), $publishedon);
$resourceArray['publishedon'] = strftime('%b %d, %Y %H:%I %p', $publishedon);
}
$resourceArray['action_edit'] = '?a=' . $this->editAction . '&action=post/update&id=' . $resourceArray['id'];
if (!array_key_exists('comments', $resourceArray)) {
$resourceArray['comments'] = 0;
}
$this->modx->getContext($resourceArray['context_key']);
$resourceArray['preview_url'] = $this->modx->makeUrl($resourceArray['id'], $resourceArray['context_key']);
$trimLength = $this->modx->getOption('articles.mgr_article_content_preview_length', null, 300);
$resourceArray['content'] = strip_tags($this->ellipsis($object->getContent(), $trimLength));
$resourceArray['actions'] = array();
$resourceArray['actions'][] = array('className' => 'edit', 'text' => $this->modx->lexicon('edit'));
$resourceArray['actions'][] = array('className' => 'view', 'text' => $this->modx->lexicon('view'));
if (!empty($resourceArray['deleted'])) {
$resourceArray['actions'][] = array('className' => 'undelete', 'text' => $this->modx->lexicon('undelete'));
} else {
$resourceArray['actions'][] = array('className' => 'delete', 'text' => $this->modx->lexicon('delete'));
}
if (!empty($resourceArray['published'])) {
$resourceArray['actions'][] = array('className' => 'unpublish', 'text' => $this->modx->lexicon('unpublish'));
} else {
$resourceArray['actions'][] = array('className' => 'publish orange', 'text' => $this->modx->lexicon('publish'));
}
return $resourceArray;
}