/**
  * Class constructor
  *
  * @param modX $modx - $modx object referrence
  * @param Helpers $helpers - $helpers object
  * @param $fields array - Object fields
  * @param int $mode - MODE_BOOTSTRAP, MODE_EXPORT
  */
 public function __construct(&$modx, $helpers, $fields, $mode = MODE_BOOTSTRAP)
 {
     $this->modx =& $modx;
     $this->helpers =& $helpers;
     if (!isset($fields['id'])) {
         $fields['id'] = '';
     }
     parent::__construct($modx, $helpers);
     if ($this->dbClass != 'modPropertySet') {
         $this->setPropertySetResolver($fields, $mode);
     }
     if (isset($fields['propertySets'])) {
         unset($fields['propertySets']);
     }
     if ($mode == MODE_BOOTSTRAP) {
         if (is_array($fields)) {
             $this->categoryName = $fields['category'];
             $this->fieldsToIds($fields);
             $this->myFields = $fields;
         }
     } elseif ($mode == MODE_EXPORT) {
         if ($this->dbClass !== 'modPropertySet') {
             $this->content = $fields['content'];
             unset($fields['content']);
         }
         $this->fieldsToNames($fields);
         $this->categoryName = $fields['category'];
         $this->myFields = $fields;
     }
     ObjectAdapter::$myObjects['ElementCategories'][$this->categoryName]['elements'][$this->dbClass][] = $fields;
 }
 public final function __construct(&$modx, &$helpers, $fields, $mode = MODE_BOOTSTRAP)
 {
     $this->modx =& $modx;
     $this->helpers =& $helpers;
     $this->myComponent =& $myComponent;
     if ($mode == MODE_BOOTSTRAP) {
         if (!isset($fields['namespace'])) {
             $fields['namespace'] = $this->helpers->props['packageNameLower'];
         }
         if (!isset($fields['name'])) {
             $fields['name'] = $fields['key'];
         }
         if (is_array($fields)) {
             $this->myFields =& $fields;
         }
         if (!isset($fields['area'])) {
             $fields['area'] = $this->myFields[$this->dbClassParentKey];
         }
     } elseif ($mode == MODE_EXPORT) {
         $this->modx->lexicon->load($fields['namespace'] . ':default');
         if (!isset($fields['name'])) {
             $fields['name'] = $this->modx->lexicon('setting_' . $fields['key']);
         }
         if (!isset($fields['description'])) {
             /* Hide this from LexiconHelper */
             $d = 'setting_' . $fields['key'] . '_desc';
             $fields['description'] = $this->modx->lexicon($d);
         }
         unset($fields['editedon']);
     }
     $this->name = $fields['key'];
     ObjectAdapter::$myObjects['newSystemSettings'][] = $fields;
     parent::__construct($modx, $helpers);
 }
 /**
  * Class constructor
  *
  * @param modX $modx - $modx object referrence
  * @param Helpers $helpers - $helpers object
  * @param $fields array - Object fields
  * @param int $mode - MODE_BOOTSTRAP, MODE_EXPORT
  */
 function __construct(&$modx, &$helpers, $fields, $mode = MODE_BOOTSTRAP)
 {
     /* @var $modx modX */
     /* @var $object modResource */
     parent::__construct($modx, $helpers);
     $this->name = $fields['pagetitle'];
     if (!isset($fields['id'])) {
         $fields['id'] = '';
     }
     if ($mode == MODE_BOOTSTRAP) {
         // Set defaults if they are not already set
         $this->defaults['published'] = $modx->getOption('publish_default', null);
         $this->defaults['richtext'] = $modx->getOption('richtext_default', null);
         $this->defaults['hidemenu'] = $modx->getOption('hidemenu_default', null);
         $this->defaults['cacheable'] = $modx->getOption('cache_default', null);
         $this->defaults['searchable'] = $modx->getOption('search_default', null);
         $this->defaults['context_key'] = $modx->getOption('default_context', null);
         if (!isset($fields['class_key'])) {
             $fields['class_key'] = 'modDocument';
         }
         foreach ($this->defaults as $field => $value) {
             $fields[$field] = isset($fields[$field]) ? $fields[$field] : $value;
         }
     } elseif ($mode == MODE_EXPORT) {
         $this->fieldsToNames($fields);
         $this->myFields = $fields;
     }
     $this->setResourceResolver($fields, $mode);
     $this->myFields = $fields;
     ObjectAdapter::$myObjects['resources'][] = $fields;
 }
 public final function __construct(&$modx, &$helpers, $fields, $mode = MODE_BOOTSTRAP)
 {
     parent::__construct($modx, $helpers);
     if (is_array($fields)) {
         $this->myFields = $fields;
     }
 }
 public final function __construct(&$modx, &$helpers, $fields, $mode = MODE_BOOTSTRAP)
 {
     $this->name = $fields['key'];
     parent::__construct($modx, $helpers);
     if (is_array($fields)) {
         $this->myFields = $fields;
     }
     ObjectAdapter::$myObjects['contexts'][] = $fields;
 }
Esempio n. 6
0
 public final function __construct(&$modx, &$helpers, $fields, $mode = MODE_BOOTSTRAP)
 {
     parent::__construct($modx, $helpers);
     if (is_array($fields)) {
         if (isset($fields['lang_topics']) && empty($fields['lang_topics'])) {
             $fields['lang_topics'] = $this->helpers->props['packageNameLower'] . ':default';
         }
     }
     $this->myFields = $fields;
 }
 function __construct(&$modx, &$helpers, $fields, $createChildren = false)
 {
     /* @var $helpers Helpers */
     $this->myComponent =& $component;
     $this->modx =& $modx;
     $this->helpers =& $helpers;
     $this->myFields = $fields;
     $this->name = $fields['name'];
     ObjectAdapter::$myObjects['nameSpaces'][] = $fields;
     parent::__construct($modx, $helpers);
 }
 public final function __construct(&$modx, &$helpers, $fields, $mode = MODE_BOOTSTRAP)
 {
     parent::__construct($modx, $helpers);
     $this->name = $fields['name'];
     if ($mode == MODE_BOOTSTRAP) {
         if (empty($fields['groupname'])) {
             $fields['groupname'] = $this->helpers->props['packageName'];
         }
         if (empty($fields['service'])) {
             $fields['service'] = 1;
         }
     }
     ObjectAdapter::$myObjects['newSystemEvents'][] = $fields;
     $this->myFields = $fields;
 }
 public final function __construct(&$modx, &$helpers, $fields, $mode = MODE_BOOTSTRAP)
 {
     /* @var $modx modX */
     $this->modx =& $modx;
     $this->helpers =& $helpers;
     $this->name = $fields['category'];
     if ($mode == MODE_BOOTSTRAP) {
         if (!isset($fields['parent']) || empty($fields['parent'])) {
             $fields['parent'] = '0';
         }
     }
     $this->myFields = $fields;
     ObjectAdapter::$myObjects['categories'][$fields['category']] = $fields;
     parent::__construct($modx, $helpers);
 }
Esempio n. 10
0
 public final function __construct(&$modx, $helpers, $fields, $mode = MODE_BOOTSTRAP)
 {
     /* @var $modx modX */
     /* @var $helpers Helpers */
     parent::__construct($modx, $helpers);
     if (is_array($fields)) {
         if (!isset($fields['namespace'])) {
             $fields['namespace'] = $this->helpers->getProp('packageNameLower');
         }
         $this->myFields = $fields;
         $actionFields = $modx->getOption('action', $fields, array());
         if (empty($actionFields)) {
             $helpers->sendLog(modX::LOG_LEVEL_ERROR, '    ' . $this->modx->lexicon('mc_menu_has_no_action'));
             return;
         }
         if (empty($actionFields['namespace'])) {
             $helpers->sendLog(modX::LOG_LEVEL_ERROR, '    ' . $this->modx->lexicon('mc_menu_action_no_namespace'));
             return;
         }
         ObjectAdapter::$myObjects['menus'][] = $fields;
         $this->myFields = $fields;
     }
 }