public function prepareRow(xPDOObject $object) { $objectArray = $object->toArray(); $objectArray['sender_name'] = $object->get('sender_username'); $objectArray['read'] = $object->get('read') ? true : false; return $objectArray; }
public function prepareRow(xPDOObject $object) { $core = array('Resource', 'Object', 'Administrator', 'Load Only', 'Load, List and View'); $policyArray = $object->toArray(); $permissions = array(); $cls = 'pedit'; if (!in_array($object->get('name'), $core)) { $cls .= ' premove'; } $policyArray['cls'] = $cls; if (!empty($policyArray['total_permissions'])) { $data = $object->get('data'); $ct = 0; if (!empty($data)) { foreach ($data as $k => $v) { if (!empty($v)) { $permissions[] = $k; $ct++; } } } $policyArray['active_permissions'] = $ct; $policyArray['active_of'] = $this->modx->lexicon('active_of', array('active' => $policyArray['active_permissions'], 'total' => $policyArray['total_permissions'])); $policyArray['permissions'] = $permissions; } unset($policyArray['data']); return $policyArray; }
public function prepareRow(xPDOObject $object) { $fields = array_map('trim', explode(',', $this->modx->getOption('ms2_order_product_fields', null, ''))); $fields = array_values(array_unique(array_merge($fields, array('id', 'product_id', 'product_pagetitle')))); $data = array(); foreach ($fields as $v) { $data[$v] = $object->get($v); if ($v == 'product_price' || $v == 'product_old_price') { $data[$v] = round($data[$v], 2); } else { if ($v == 'product_weight') { $data[$v] = round($data[$v], 3); } } } $options = $object->get('options'); if (!empty($options) && is_array($options)) { $tmp = array(); foreach ($options as $k => $v) { $tmp[] = $this->modx->lexicon('ms2_' . $k) . ': ' . $v; $data['option_' . $k] = $v; } $data['options'] = implode('; ', $tmp); } return $data; }
public function prepareRow(xPDOObject $object) { $objectArray = $object->toArray(); $objectArray['name'] = $object->get('name') . ' - ' . $object->get('authority'); $objectArray['id'] = $object->get('authority'); return $objectArray; }
/** {@inheritDoc} */ public function prepareRow(xPDOObject $object) { if ($this->getProperty('combo')) { $array = array('id' => $object->get('id'), 'pagetitle' => $object->get('pagetitle')); } else { $array = $object->toArray(); } return $array; }
/** {@inheritDoc} */ public function prepareRow(xPDOObject $object) { if ($this->getProperty('combo')) { $array = array('id' => $object->get('id'), 'name' => '(' . $object->id . ') ' . $object->get('templatename')); } else { $array = $object->toArray(); } return $array; }
/** {@inheritDoc} */ public function prepareRow(xPDOObject $object) { if ($this->getProperty('combo')) { $array = array('name' => $this->modx->lexicon('mlmsystem_class_' . $object->get('class')), 'value' => $object->get('class')); } else { $array = $object->toArray(); } return $array; }
/** {@inheritDoc} */ public function prepareRow(xPDOObject $object) { if ($this->getProperty('combo')) { $array = array('name' => $object->get('level'), 'value' => $object->get('level')); } else { $array = $object->toArray(); } return $array; }
/** * {@inheritdoc} * @param xPDOObject $object * @return array|mixed */ public function prepareRow(xPDOObject $object) { $tvArray = $object->get(array('id', 'name', 'description', 'tv_rank', 'category_name')); $tvArray['access'] = (bool) $object->get('access'); $tvArray['perm'] = array(); if ($this->modx->hasPermission('edit_tv')) { $tvArray['perm'][] = 'pedit'; } return $tvArray; }
public function prepareRow(xPDOObject $object) { $arr = $object->toArray(); $arr['pagetitle'] .= ' (' . $object->get('context_key') . ', ' . $object->get('id') . ')'; // figure out if resource is a site-start resource $siteStart = $this->modx->getObject('modSystemSetting', array('key' => 'site_start', 'value' => $object->get('id'))); if (empty($siteStart)) { $siteStart = $this->modx->getObject('modContextSetting', array('key' => 'site_start', 'value' => $object->get('id'), 'context_key' => $object->get('context_key'))); } $arr['site_start'] = !empty($siteStart) && is_object($siteStart) ? true : false; return $arr; }
public function prepareRow(xPDOObject $object) { $objectArray = $object->toArray(); $isCoreRole = $object->get('id') == 1 || $object->get('id') == 2 || $object->get('name') == 'Super User' || $object->get('name') == 'Member'; $perm = array(); if (!$isCoreRole) { $perm[] = 'edit'; if ($this->canRemove) { $perm[] = 'remove'; } } $objectArray['perm'] = implode(' ', $perm); return $objectArray; }
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); }
public function prepareRow(xPDOObject $object) { $objectArray = $object->get(array('name', 'description')); $lexicon = $object->get('lexicon'); if (!empty($lexicon)) { if (strpos($lexicon, ':') !== false) { $this->modx->lexicon->load($lexicon); } else { $this->modx->lexicon->load('core:' . $lexicon); } } $objectArray['description'] = $this->modx->lexicon($objectArray['description']); return $objectArray; }
public function prepareRow(xPDOObject $object) { $arr = $object->toArray(); $arr['failure_msg'] = ''; $arr['valid'] = true; // find out if pattern URI exists $criteria = array('uri' => $object->get('pattern'), 'published' => true, 'deleted' => false); if (!empty($arr['context_key'])) { $criteria['context_key'] = $object->get('context_key'); } $resource = $this->modx->getObject('modResource', $criteria); if (!empty($resource) && is_object($resource)) { $arr['failure_msg'] .= '(!) ' . $this->modx->lexicon('redirector.pattern') . ' ' . $this->modx->lexicon('redirector.redirect_err_ae_uri', array('id' => $resource->get('id'), 'context' => $resource->get('context_key'))); $arr['valid'] = false; } // OR target not exists $target = $this->getProperty('target'); if (strpos($target, '$') === false) { // parse link & MODX tags if (stripos($target, '[[') !== false) { $this->modx->parser->processElementTags('', $target, true, true); } if (!empty($target)) { // checking full links if (strpos($target, '://') !== false) { $headers = @get_headers($target); if (empty($headers)) { $this->addFieldError('target', $this->modx->lexicon('redirector.redirect_err_ne_target')); } } else { $criteria = array('uri' => $target); if (!empty($context)) { $criteria['context_key'] = $context; } $resource = $this->modx->getObject('modResource', $criteria); if (empty($resource) || !is_object($resource)) { // check if could be a file? $basePath = $this->modx->getOption('base_path'); if (!file_exists($basePath . $target)) { $this->addFieldError('target', $this->modx->lexicon('redirector.redirect_err_ne_target')); } } } } else { $this->addFieldError('target', $this->modx->lexicon('redirector.redirect_err_ne_target')); } } return $arr; }
/** {@inheritDoc} */ public function prepareRow(xPDOObject $object) { if ($this->getProperty('combo')) { $title = $object->get('title'); if (empty($title)) { $title = $object->get('name'); } else { $title = $title . ' (' . $object->get('name') . ')'; } $array = array('id' => $object->get('id'), 'title' => $object->id . ' - ' . $title); } else { $array = $object->toArray(); } return $array; }
/** * 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; }
public function prepareRow(xPDOObject $object) { $objectArray = $object->toArray(); $constraint = $object->get('constraint'); if (!empty($constraint)) { $objectArray['constraint_data'] = $object->get('constraint_class') . '.' . $object->get('constraint_field') . ' = ' . $constraint; } $objectArray['perm'] = array(); if ($this->canEdit) { $objectArray['perm'][] = 'pedit'; } if ($this->canRemove) { $objectArray['perm'][] = 'premove'; } return $objectArray; }
/** * 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; }
public function prepareRow(xPDOObject $object) { $objectArray = $object->toArray(); $objectArray['category_name'] = $object->get('category_name'); unset($objectArray['content']); return $objectArray; }
/** * * @param <type> $k * @param <type> $format * @param <type> $formatTemplate * @return <type> */ public function get($k, $format = null, $formatTemplate = null) { $v = parent::get($k, $format, $formatTemplate); if ($k == 'path') { $v = str_replace(array('{core_path}', '{base_path}', '{assets_path}'), array($this->xpdo->getOption('core_path', null, MODX_CORE_PATH), $this->xpdo->getOption('base_path', null, MODX_BASE_PATH), $this->xpdo->getOption('assets_path', null, MODX_ASSETS_PATH)), $v); } return $v; }
/** * Prepare the row for iteration * @param xPDOObject $object * @return array */ public function prepareRow(xPDOObject $object) { $objectArray = $object->toArray(); $objectArray['blocked'] = $object->get('blocked') ? true : false; $objectArray['cls'] = 'pupdate premove pcopy'; unset($objectArray['password'], $objectArray['cachepwd'], $objectArray['salt']); return $objectArray; }
public function prepareRow(xPDOObject $object) { $itemArray = $object->toArray(); $itemArray['album'] = $this->getProperty('album'); $itemArray['filename'] = basename($object->get('filename')); $imagePath = $object->get('image_path'); $size = @getimagesize($imagePath); if (is_array($size)) { $itemArray['image_width'] = $size[0]; $itemArray['image_height'] = $size[1]; $itemArray['image_type'] = $size[2]; } $c = array(); $c['h'] = $this->modx->getOption('gallery.backend_thumb_height', null, 60); $c['w'] = $this->modx->getOption('gallery.backend_thumb_width', null, 80); $c['zc'] = $this->modx->getOption('gallery.backend_thumb_zoomcrop', null, 1); $c['far'] = $this->modx->getOption('gallery.backend_thumb_far', null, 'C'); $itemArray['thumbnail'] = $object->get('thumbnail', $c); $itemArray['image'] = $object->get('image'); $itemArray['relativeImage'] = $object->get('relativeImage'); $itemArray['absoluteImage'] = $object->get('absoluteImage'); $itemArray['filesize'] = $object->get('filesize'); $itemArray['menu'] = array(); $itemArray['menu'][] = array('text' => $this->modx->lexicon('gallery.item_update'), 'handler' => 'this.updateItem'); $itemArray['menu'][] = '-'; $itemArray['menu'][] = array('text' => $this->modx->lexicon('gallery.item_delete'), 'handler' => 'this.deleteItem'); return $itemArray; }
public function prepareRow(xPDOObject $object) { $object->set('encrypted', 1); $values = $object->get('values'); $object->set('values', $object->encrypt($values)); $object->save(); $ff = $object->toArray(); return $ff; }
public function prepareRow(xPDOObject $object) { $controller = $object->get('action'); $namespace = $object->get('namespace'); if (!in_array($namespace, array('core', '', null))) { $this->modx->lexicon->load($namespace . ':default'); } $text = $this->modx->lexicon($object->get('text')); $objectArray = array('text' => $text . ($controller != '' ? ' <i>(' . $namespace . ':' . $controller . ')</i>' : ''), 'id' => 'n_' . $object->get('text'), 'cls' => 'icon-menu', 'iconCls' => 'icon icon-' . ($object->get('childrenCount') > 0 ? $object->get('parent') === '' ? 'navicon' : 'folder' : 'terminal'), 'type' => 'menu', 'pk' => $object->get('text'), 'leaf' => $object->get('childrenCount') > 0 ? false : true, 'data' => $object->toArray()); return $objectArray; }
public function prepareRow(xPDOObject $object) { $object->set('startymd', date('Y-m-d', $object->get('start'))); $object->set('starthis', date('g:i A', $object->get('start'))); $object->set('endymd', date('Y-m-d', $object->get('end'))); $object->set('endhis', date('g:i A', $object->get('end'))); $object->set('startRAW', $object->get('start')); $object->set('start', date('Y-m-d g:i A', $object->get('start'))); $object->set('end', date('Y-m-d g:i A', $object->get('end'))); $object->set('ad', $object->get('ad') == 1 ? true : false); return $object->toArray(); }
public function prepareRow(xPDOObject $object) { $objectArray = $object->toArray(); $namespace = $object->get('namespace'); if (!in_array($namespace, array('core', '', null))) { $this->modx->lexicon->load($namespace . ':default'); } $objectArray['text_lex'] = $this->modx->lexicon($objectArray['text']); return $objectArray; }
public function prepareRow(xPDOObject $object) { $controller = $object->get('action'); $namespace = $object->get('namespace'); if (!in_array($namespace, array('core', '', null))) { $this->modx->lexicon->load($namespace . ':default'); } $text = $this->modx->lexicon($object->get('text')); $desc = $this->modx->lexicon($object->get('description')); $objectArray = array('text' => $text . ($controller != '' ? ' <i>(' . $namespace . ':' . $controller . ')</i>' : ''), 'id' => 'n_' . $object->get('text'), 'cls' => 'icon-menu', 'iconCls' => 'icon icon-' . ($object->get('childrenCount') > 0 ? $object->get('parent') === '' ? 'navicon' : 'folder' : 'terminal'), 'type' => 'menu', 'pk' => $object->get('text'), 'leaf' => false, 'data' => $object->toArray(), 'qtip' => strip_tags($desc)); if ($object->get('childrenCount') < 1) { // Workaround for leaf record not to display "arrows" $objectArray['loaded'] = true; } return $objectArray; }
/** * @param xPDOObject $object * @return array */ public function prepareRow(xPDOObject $object) { $timeFormat = $this->getProperty('timeFormat', '%a %b %d, %Y'); $offset = $this->getProperty('offset', 0); $objectArray = $object->toArray(); unset($objectArray['content']); if (!in_array($object->get('pub_date'), array('', '1969-12-31 00:00:00'))) { $pubDate = strtotime($object->get('pub_date')) + $offset; $objectArray['pub_date'] = strftime($timeFormat, $pubDate); } else { $objectArray['pub_date'] = ''; } if (!in_array($object->get('unpub_date'), array('', '1969-12-31 00:00:00'))) { $unpubDate = strtotime($object->get('unpub_date')) + $offset; $objectArray['unpub_date'] = strftime($timeFormat, $unpubDate); } else { $objectArray['unpub_date'] = ''; } return $objectArray; }
public function prepareRow(xPDOObject $object) { $principal = $this->modx->getObject($object->get('principal_class'), $object->get('principal')); if (!$principal) { $principal = $this->modx->newObject($object->get('principal_class'), array('name' => '(anonymous)')); } $policyName = !empty($object->Policy) ? $object->Policy->get('name') : $this->modx->lexicon('no_policy_option'); if ($object->Target) { $targetName = $this->classKey == 'modAccessContext' ? $object->Target->get('key') : $object->Target->get('name'); } else { $targetName = '(anonymous)'; } $objArray = array('id' => $object->get('id'), 'target' => $object->get('target'), 'target_name' => $targetName, 'principal_class' => $object->get('principal_class'), 'principal' => $object->get('principal'), 'principal_name' => $principal->get('name'), 'authority' => $object->get('authority'), 'policy' => $object->get('policy'), 'policy_name' => $policyName); if (isset($object->_fieldMeta['context_key'])) { $objArray['context_key'] = $object->get('context_key'); } // Prevent default Admin ACL from edit and remove $objArray['cls'] = $object->get('target') == 'mgr' && $principal->get('name') == 'Administrator' && $policyName == 'Administrator' && $object->get('authority') == 0 ? '' : 'pedit premove'; return $objArray; }
public function prepareRow(xPDOObject $object) { if ($tmp = $this->modx->getObject('modUser', $object->get('uid'))) { $user = $tmp->getOne('Profile')->get('fullname'); if (empty($user)) { $user = $tmp->get('username'); } $object->set('username', $user); } if ($tmp = $this->modx->getObject('mpStatus', $object->get('status'))) { $status = '<span style="color:#' . $tmp->get('color') . ';">' . $tmp->get('name') . '</span>'; $object->set('statusname', $status); } if ($tmp = $this->modx->getObject('mpMethod', $object->get('method'))) { $method = $tmp->get('name'); $object->set('methodname', $method); } $array = $object->toArray(); return $array; }