public function initialize() { $initialized = parent::initialize(); $this->setDefaultProperties(array('key' => false, 'namespace' => false, 'area' => false)); $this->dateFormat = $this->modx->getOption('manager_date_format') . ', ' . $this->modx->getOption('manager_time_format'); return $initialized; }
/** {@inheritDoc} */ public function outputArray(array $array, $count = false) { if ($this->getProperty('addall')) { $array = array_merge_recursive(array(array('id' => 0, 'name' => 'Мсу')), $array); } return parent::outputArray($array, $count); }
/** * @param xPDOQuery $c * * @return xPDOQuery */ public function prepareQueryBeforeCount(xPDOQuery $c) { if ($tid = $this->getProperty('tid')) { $c->where(array('tid' => $tid)); } return parent::prepareQueryBeforeCount($c); }
/** {@inheritDoc} */ public function initialize() { if (!$this->getProperty('limit')) { $this->setProperty('limit', 20); } return parent::initialize(); }
/** * @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; }
public function initialize() { $this->setDefaultProperties(array('profile' => 0, 'search' => '')); $this->canEdit = $this->modx->hasPermission('save'); $this->canRemove = $this->modx->hasPermission('remove'); return parent::initialize(); }
public function prepareQueryBeforeCount(xPDOQuery $c) { $c->leftJoin($this->classKey, 'Children'); $c->where(array($this->classKey . '.parent' => $this->getProperty('id'))); $c->groupby($this->classKey . '.text'); return parent::prepareQueryBeforeCount($c); }
/** * 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; }
/** {@inheritDoc} */ public function initialize() { if (!$this->modx->hasPermission($this->permission)) { return $this->modx->lexicon('access_denied'); } return parent::initialize(); }
/** * 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; }
/** {@inheritDoc} */ public function outputArray(array $array, $count = false) { if ($this->getProperty('addall')) { $array = array_merge_recursive(array(array('id' => 0, 'name' => $this->modx->lexicon('mlmsystem_all'))), $array); } return parent::outputArray($array, $count); }
/** * @return bool */ public function initialize() { $parent = parent::initialize(); /** @var msDiscount $msDiscount */ $msDiscount = $this->modx->getService('msDiscount'); $this->_modx23 = $msDiscount->systemVersion(); return $parent; }
public function initialize() { $this->editAction = $this->modx->getObject('modAction', array('namespace' => 'core', 'controller' => 'resource/update')); if (!$this->getProperty('limit')) { $this->setProperty('limit', 20); } return parent::initialize(); }
public function beforeQuery() { $tagId = (int) $this->getProperty('tagId'); if (empty($tagId) || $tagId == 0) { return $this->modx->lexicon('tagger.err.tag_assigned_resources_tag_ns'); } return parent::beforeQuery(); }
/** * {@inheritDoc} * @return boolean */ public function initialize() { $props = $this->getProperties(); if (empty($props['contexts'])) { return $this->modx->lexicon($this->objectType . '_err_ns'); } return parent::initialize(); }
public function initialize() { $this->setDefaultProperties(array('album' => false)); if (!$this->getProperty('album', false)) { return false; } return parent::initialize(); }
public function initialize() { $initialized = parent::initialize(); $this->setDefaultProperties(array('search' => '', 'exclude' => '')); $this->canEdit = $this->modx->hasPermission('edit_context'); $this->canRemove = $this->modx->hasPermission('delete_context'); return $initialized; }
/** {@inheritDoc} */ public function initialize() { $this->ms2 = $this->modx->getService('miniShop2'); if (!$this->modx->hasPermission($this->permission)) { return $this->modx->lexicon('access_denied'); } return parent::initialize(); }
public function initialize() { $this->setDefaultProperties(array('limit' => 10, 'target' => 0, 'principal_class' => 'modUserGroup', 'principal' => 0)); $this->classKey = $this->getProperty('type'); if (!$this->classKey) { return $this->modx->lexicon('access_type_err_ns'); } return parent::initialize(); }
/** * @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; }
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; }
/** * {@inheritDoc} * @return boolean */ public function initialize() { $props = $this->getProperties(); if (empty($props['ids'])) { return $this->modx->lexicon($this->objectType . '_err_ns'); } $this->setProperty('ids', json_decode($props['ids']), true); return parent::initialize(); }
public function initialize() { $initialized = parent::initialize(); $this->setDefaultProperties(array('usergroup' => 0, 'resourceGroup' => false, 'policy' => false)); $usergroup = $this->getProperty('usergroup', false); if (!empty($usergroup)) { $this->userGroup = $this->modx->getObject('modUserGroup', $usergroup); } return $initialized; }
public function initialize() { $initialized = parent::initialize(); $this->setDefaultProperties(array('addNone' => false)); if ($this->getProperty('sort') == 'rolename_link') { $this->setProperty('sort', 'name'); } $this->canRemove = $this->modx->hasPermission('delete_role'); return $initialized; }
/** * @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; }
/** * 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; }
public function initialize() { $initialized = parent::initialize(); $this->setDefaultProperties(array('usergroup' => false, 'query' => '')); if ($this->getProperty('sort') == 'username_link') { $this->setProperty('sort', 'username'); } if ($this->getProperty('sort') == 'id') { $this->setProperty('sort', 'modUser.id'); } return $initialized; }
public function initialize() { $this->setDefaultProperties(array('start' => 0, 'limit' => 20, 'sort' => $this->defaultSortField . ':' . $this->defaultSortDirection, 'combo' => false, 'query' => '')); $selection = intval($this->getProperty('selection', 0)); if ($selection > 0) { $selection = $this->modx->getObject('modResource', $selection); if ($selection && $selection->class_key == 'SelectionContainer') { $this->selection = $selection; $this->collectionTemplate = $this->modx->collections->getCollectionsView($this->selection); } } return parent::initialize(); }
public function initialize() { switch ($this->getProperty('type')) { case 'users': $this->linkedKey1 = 'msdUserGroup'; $this->linkedKey2 = 'modUserGroup'; break; case 'products': $this->linkedKey1 = 'msdProductGroup'; $this->linkedKey2 = 'modResourceGroup'; break; } return parent::initialize(); }
/** * {@inheritDoc} * @return boolean */ public function initialize() { $this->setDefaultProperties(array('limit' => 10)); $user = (int) $this->getProperty('user', 0); if (!$user) { return $this->modx->lexicon($this->objectType . '_err_ns'); } /** @var modUser $user */ $this->object = $this->modx->getObject('modUser', $user); if (!$this->object) { return $this->modx->lexicon($this->objectType . '_err_nf'); } return parent::initialize(); }