コード例 #1
0
ファイル: getlist.class.php プロジェクト: RuGa/GridClassKey
 /**
  * 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
0
ファイル: getlist.class.php プロジェクト: novosad/denant
 /**
  * @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
0
ファイル: getlist.class.php プロジェクト: soulcreate/Tickets
 /**
  * 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
0
 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
0
ファイル: getlist.class.php プロジェクト: soulcreate/Tickets
 /**
  * @param xPDOObject $object
  *
  * @return array
  */
 public function prepareRow(xPDOObject $object)
 {
     $array = parent::prepareRow($object);
     if (empty($array['fullname'])) {
         $array['fullname'] = $array['username'];
     }
     $array['stars'] = $array['stars_tickets'] + $array['stars_comments'];
     return $array;
 }
コード例 #6
0
 /**
  * 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;
 }
コード例 #7
0
ファイル: getlist.class.php プロジェクト: jolichter/modxTalks
 /**
  * @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;
 }
コード例 #8
0
ファイル: getlist.class.php プロジェクト: joeke/modx-minify
 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);
 }
コード例 #9
0
ファイル: getlist.class.php プロジェクト: jolichter/modxTalks
 /**
  * @param xPDOObject|R $object
  *
  * @return array
  */
 public function prepareRow(xPDOObject $object)
 {
     $email = parent::prepareRow($object);
     if ($email['intro'] === null) {
         $email['intro'] = '';
     }
     if (!empty($email['date'])) {
         $email['publishedon_date'] = date('j M Y', $email['date']);
         $email['publishedon_time'] = date('g:s A', $email['date']);
         $email['actions'] = array();
         $email['actions'][] = array('text' => $this->modx->lexicon('delete'));
     }
     return $email;
 }
コード例 #10
0
 public function prepareRow(xPDOObject $object)
 {
     $object = parent::prepareRow($object);
     $menu = array();
     $menu[] = array('text' => $this->modx->lexicon('xlexicon.contextMenu_language_update'), 'handler' => 'this.updateLanguage');
     /*
         future feature
         $menu[] = array(
           'text' => $this->modx->lexicon('xlexicon.contextMenu_language_prop')    
           ,'handler' => 'this.propLanguage'
         );*/
     $menu[] = array('text' => $this->modx->lexicon('xlexicon.contextMenu_language_remove'), 'handler' => 'this.removeLanguage');
     $object['menu'] = $menu;
     return $object;
 }
コード例 #11
0
ファイル: getlist.class.php プロジェクト: soulcreate/Tickets
 /**
  * @param xPDOObject $object
  *
  * @return array
  */
 public function prepareRow(xPDOObject $object)
 {
     $array = parent::prepareRow($object);
     $array['text'] = strip_tags(html_entity_decode($array['text'], ENT_QUOTES, 'UTF-8'));
     if (!empty($array['fullname'])) {
         $array['name'] = $array['fullname'];
     } elseif (!empty($array['username'])) {
         $array['name'] = $array['username'];
     }
     if (!empty($array['properties']['threadUrl'])) {
         $array['preview_url'] = $array['properties']['threadUrl'];
     } elseif (!empty($array['resource'])) {
         $this->modx->getContext($array['context_key']);
         $array['preview_url'] = $this->modx->makeUrl($array['resource'], $array['context_key']);
     }
     unset($array['properties']);
     $icon = $this->_modx23 ? 'icon' : 'fa';
     $array['actions'] = array();
     // Edit
     $array['actions'][] = array('cls' => '', 'icon' => "{$icon} {$icon}-edit", 'title' => $this->modx->lexicon('tickets_action_edit'), 'action' => 'editComment', 'button' => empty($array['deleted']) || !empty($array['published']), 'menu' => true);
     // View
     if (!empty($array['preview_url']) && !empty($array['published']) && empty($array['deleted'])) {
         $array['actions'][] = array('cls' => '', 'icon' => "{$icon} {$icon}-eye", 'title' => $this->modx->lexicon('tickets_action_view'), 'action' => 'viewComment', 'button' => true, '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' => 'publishComment', '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' => 'unpublishComment', 'button' => false, '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' => 'deleteComment', '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' => 'undeleteComment', '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' => 'removeComment', '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;
 }
コード例 #12
0
ファイル: getlist.class.php プロジェクト: Jako/Collections
 public function prepareRow(xPDOObject $object)
 {
     $resourceArray = parent::prepareRow($object);
     $resourceArray = $this->prepareSupportFields($resourceArray);
     $resourceArray = $this->prepareActions($resourceArray);
     $resourceArray = $this->prepareMenuActions($resourceArray);
     return $resourceArray;
 }
コード例 #13
0
 /**
  * @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;
 }