当前位置: 首页>>代码示例>>PHP>>正文


PHP modObjectGetListProcessor::prepareRow方法代码示例

本文整理汇总了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;
 }
开发者ID:RuGa,项目名称:GridClassKey,代码行数:37,代码来源:getlist.class.php

示例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;
 }
开发者ID:novosad,项目名称:denant,代码行数:39,代码来源:getlist.class.php

示例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;
 }
开发者ID:soulcreate,项目名称:Tickets,代码行数:34,代码来源:getlist.class.php

示例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;
 }
开发者ID:bendasvadim,项目名称:MODX.Xlexicon,代码行数:9,代码来源:getlist.class.php

示例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;
 }
开发者ID:DeFi-ManriquezLuis,项目名称:MTLTransfer,代码行数:16,代码来源:getlist.class.php

示例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;
 }
开发者ID:jolichter,项目名称:modxTalks,代码行数:16,代码来源:getlist.class.php

示例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);
 }
开发者ID:joeke,项目名称:modx-minify,代码行数:14,代码来源:getlist.class.php

示例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;
 }
开发者ID:Jako,项目名称:Collections,代码行数:8,代码来源:getlist.class.php

示例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;
 }
开发者ID:rafull6,项目名称:texno-service,代码行数:36,代码来源:getlist.class.php


注:本文中的modObjectGetListProcessor::prepareRow方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。