Example #1
0
 /**
  * Clear the cache if specified
  * @return boolean
  */
 public function clearCache()
 {
     $clear = $this->getProperty('syncsite', false) || $this->getProperty('clearCache', false);
     if ($clear) {
         $this->modx->cacheManager->refresh(array('db' => array(), 'auto_publish' => array('contexts' => array($this->workingContext->get('key'))), 'context_settings' => array('contexts' => array($this->workingContext->get('key'))), 'resource' => array('contexts' => array($this->workingContext->get('key')))));
     }
     return $clear;
 }
Example #2
0
 /**
  * @return mixed
  */
 public function onRender()
 {
     $this->onContextFormRender = $this->modx->invokeEvent('OnContextFormRender', array('key' => $this->context->get('key'), 'context' => &$this->context, 'mode' => modSystemEvent::MODE_UPD));
     if (is_array($this->onContextFormRender)) {
         $this->onContextFormRender = implode('', $this->onContextFormRender);
     }
     $this->onContextFormRender = str_replace(array('"', "\n", "\r"), array('\\"', '', ''), $this->onContextFormRender);
     return $this->onContextFormRender;
 }
Example #3
0
 /**
  * Empty site cache if specified to do so
  * @return void
  */
 public function clearCache()
 {
     $syncSite = $this->getProperty('syncsite', false);
     $clearCache = $this->getProperty('clearCache', false);
     if (!empty($syncSite) || !empty($clearCache)) {
         $contexts = array($this->object->get('context_key'));
         if (!empty($this->oldContext)) {
             $contexts[] = $this->oldContext->get('key');
         }
         $this->modx->cacheManager->refresh(array('db' => array(), 'auto_publish' => array('contexts' => $contexts), 'context_settings' => array('contexts' => $contexts), 'resource' => array('contexts' => $contexts)));
     }
 }
Example #4
0
 /**
  * {@inheritDoc}
  * @return mixed
  */
 public function afterSave()
 {
     $this->setLexiconEntries($this->object->toArray());
     $this->modx->reloadConfig();
     $key = $this->getProperty('key');
     $value = $this->getProperty('value');
     $refreshURIs = false;
     if ($key === 'friendly_urls' && $value == '1') {
         $refreshURIs = true;
     }
     if ($key === 'use_alias_path') {
         $refreshURIs = true;
     }
     if ($key === 'container_suffix') {
         $refreshURIs = true;
     }
     if ($refreshURIs) {
         $this->context->config[$key] = $value;
         $this->modx->call('modResource', 'refreshURIs', array(&$this->modx, 0, array('contexts' => $this->context->get('key'))));
     }
     return true;
 }
 /**
  * Prepare a Context for being shown in the tree
  *
  * @param modContext $context
  * @return array
  */
 public function prepareContextNode(modContext $context)
 {
     $class = array('tree-pseudoroot-node');
     $createRoot = $this->modx->hasPermission('new_document_in_root');
     $class[] = !empty($this->permissions['edit_context']) ? $this->permissions['edit_context'] : '';
     $class[] = !empty($this->permissions['new_context']) ? $this->permissions['new_context'] : '';
     $class[] = !empty($this->permissions['delete_context']) ? $this->permissions['delete_context'] : '';
     $class[] = !empty($this->permissions['new_context_document']) && $createRoot ? $this->permissions['new_context_document'] : '';
     $class[] = !empty($this->permissions['new_context_symlink']) && $createRoot ? $this->permissions['new_context_symlink'] : '';
     $class[] = !empty($this->permissions['new_context_weblink']) && $createRoot ? $this->permissions['new_context_weblink'] : '';
     $class[] = !empty($this->permissions['new_context_static_resource']) && $createRoot ? $this->permissions['new_context_static_resource'] : '';
     $class[] = !empty($this->permissions['resource_quick_create']) && $createRoot ? $this->permissions['resource_quick_create'] : '';
     $context->prepare();
     return array('text' => $context->get('name') != '' ? $context->get('name') : $context->get('key'), 'id' => $context->get('key') . '_0', 'pk' => $context->get('key'), 'ctx' => $context->get('key'), 'settings' => array('default_template' => $context->getOption('default_template'), 'richtext_default' => $context->getOption('richtext_default'), 'hidemenu_default' => $context->getOption('hidemenu_default'), 'search_default' => $context->getOption('search_default'), 'cache_default' => $context->getOption('cache_default'), 'publish_default' => $context->getOption('publish_default'), 'default_content_type' => $context->getOption('default_content_type')), 'leaf' => false, 'cls' => implode(' ', $class), 'iconCls' => $this->modx->getOption('mgr_tree_icon_context', null, 'tree-context'), 'qtip' => $context->get('description') != '' ? strip_tags($context->get('description')) : '', 'type' => 'modContext', 'pseudoroot' => true);
 }
Example #6
0
 /** {@inheritDoc} */
 public function prepareContextNode(modContext $context)
 {
     $context->prepare();
     return array('text' => $context->get('key'), 'id' => $context->get('key') . '_0', 'pk' => $context->get('key'), 'ctx' => $context->get('key'), 'leaf' => false, 'cls' => 'icon-context', 'iconCls' => $this->modx->getOption('mgr_tree_icon_context', null, 'tree-context'), 'qtip' => $context->get('description') != '' ? strip_tags($context->get('description')) : '', 'type' => 'modContext');
 }
Example #7
0
 /**
  * Prepare a Context for being shown in the tree
  *
  * @param modContext $context
  * @return array
  */
 public function prepareContextNode(modContext $context)
 {
     $class = array();
     $class[] = 'icon-context';
     $class[] = !empty($this->permissions['edit_context']) ? $this->permissions['edit_context'] : '';
     $class[] = !empty($this->permissions['new_context']) ? $this->permissions['new_context'] : '';
     $class[] = !empty($this->permissions['delete_context']) ? $this->permissions['delete_context'] : '';
     $class[] = !empty($this->permissions['new_context_document']) ? $this->permissions['new_context_document'] : '';
     $class[] = !empty($this->permissions['new_context_symlink']) ? $this->permissions['new_context_symlink'] : '';
     $class[] = !empty($this->permissions['new_context_weblink']) ? $this->permissions['new_context_weblink'] : '';
     $class[] = !empty($this->permissions['new_context_static_resource']) ? $this->permissions['new_context_static_resource'] : '';
     $class[] = !empty($this->permissions['resource_quick_create']) ? $this->permissions['resource_quick_create'] : '';
     $context->prepare();
     return array('text' => $context->get('key'), 'id' => $context->get('key') . '_0', 'pk' => $context->get('key'), 'ctx' => $context->get('key'), 'settings' => array('default_template' => $context->getOption('default_template'), 'richtext_default' => $context->getOption('richtext_default'), 'hidemenu_default' => $context->getOption('hidemenu_default'), 'search_default' => $context->getOption('search_default'), 'cache_default' => $context->getOption('cache_default'), 'publish_default' => $context->getOption('publish_default'), 'default_content_type' => $context->getOption('default_content_type')), 'leaf' => false, 'cls' => implode(' ', $class), 'qtip' => $context->get('description') != '' ? strip_tags($context->get('description')) : '', 'type' => 'modContext', 'page' => !$this->getProperty('noHref') ? '?a=' . $this->actions['context/update'] . '&key=' . $context->get('key') : '');
 }
 /**
  * Log the manager action of updating this Context
  * @return void
  */
 public function logManagerAction()
 {
     $this->modx->logManagerAction('context_update', 'modContext', $this->context->get('id'));
 }
Example #9
0
 /**
  * Reassign context for children if changed on main Resource
  * @return void
  */
 public function checkContextOfChildren()
 {
     if (is_object($this->oldContext) && $this->oldContext instanceof modContext && $this->oldContext->get('key') !== $this->workingContext->get('key')) {
         $this->modx->call($this->object->get('class_key'), 'updateContextOfChildren', array(&$this->modx, $this->object));
     }
 }
Example #10
0
 /**
  * Clear the context settings cache
  * @return void
  */
 public function clearCache()
 {
     $this->modx->cacheManager->refresh(array('db' => array(), 'context_settings' => array('contexts' => array($this->context->get('key'))), 'resource' => array('contexts' => array($this->context->get('key')))));
 }