Server : Apache System : Linux indy02.toastserver.com 3.10.0-962.3.2.lve1.5.85.el7.x86_64 #1 SMP Thu Apr 18 15:18:36 UTC 2024 x86_64 User : palandch ( 1163) PHP Version : 7.1.33 Disable Function : NONE Directory : /home/palandch/www/core/model/modx/processors/workspace/lexicon/ |
<?php /** * Updates a lexicon entry from a grid * * @package modx * @subpackage processors.workspace.lexicon */ class modLexiconEntryCreateProcessor extends modProcessor { /** @var modLexiconEntry $entry */ public $entry; public function checkPermissions() { return $this->modx->hasPermission('lexicons'); } public function getLanguageTopics() { return array('lexicon'); } public function process() { if ($this->alreadyExists()) { return $this->failure($this->modx->lexicon('entry_err_ae')); } $this->entry = $this->modx->newObject('modLexiconEntry'); $this->entry->fromArray($this->getProperties()); $this->entry->set('editedon',date('Y-m-d h:i:s')); if ($this->entry->save() == false) { return $this->failure($this->modx->lexicon('entry_err_save')); } return $this->success(); } public function alreadyExists() { return $this->modx->getCount('modLexiconEntry',array( 'name' => $this->getProperty('name'), 'namespace' => $this->getProperty('namespace'), 'language' => $this->getProperty('language'), 'topic' => $this->getProperty('topic'), )) > 0; } public function logManagerAction() { $this->modx->logManagerAction('lexicon_entry_create','modLexiconEntry',$this->entry->get('id')); } } return 'modLexiconEntryCreateProcessor';