当前位置: 首页>>代码示例>>PHP>>正文


PHP modObjectUpdateProcessor::beforeSave方法代码示例

本文整理汇总了PHP中modObjectUpdateProcessor::beforeSave方法的典型用法代码示例。如果您正苦于以下问题:PHP modObjectUpdateProcessor::beforeSave方法的具体用法?PHP modObjectUpdateProcessor::beforeSave怎么用?PHP modObjectUpdateProcessor::beforeSave使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在modObjectUpdateProcessor的用法示例。


在下文中一共展示了modObjectUpdateProcessor::beforeSave方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: beforeSet

 /**
  * Override in your derivative class to do functionality before save() is run
  * @return boolean
  */
 public function beforeSet()
 {
     if ($this->merged) {
         $smarttagTagresources = $this->merged->getMany('Tagresources');
         if ($smarttagTagresources) {
             $params = array();
             foreach ($smarttagTagresources as $smarttagTagresource) {
                 $params[] = array('tag_id' => $this->object->get('id'), 'tmplvar_id' => $smarttagTagresource->get('tmplvar_id'), 'resource_id' => $smarttagTagresource->get('resource_id'));
             }
             $this->modx->removeCollection('smarttagTagresources', array('tag_id' => $this->merged->get('id')));
             foreach ($params as $param) {
                 $smarttagTagresource = $this->modx->newObject('smarttagTagresources');
                 $smarttagTagresource->fromArray($param, '', true, true);
                 if ($smarttagTagresource->save() === false) {
                     $this->modx->log(modX::LOG_LEVEL_ERROR, __FILE__ . ' ');
                     $this->modx->log(modX::LOG_LEVEL_ERROR, __METHOD__ . ' ');
                     $this->modx->log(modX::LOG_LEVEL_ERROR, __LINE__ . ': Could not save new data ' . print_r($param, 1));
                 } else {
                     $this->updateTVResourceValue($smarttagTagresource);
                 }
             }
         }
     }
     $smarttagTagresources = $this->object->getMany('Tagresources');
     if ($smarttagTagresources) {
         foreach ($smarttagTagresources as $smarttagTagresource) {
             $this->updateTVResourceValue($smarttagTagresource);
         }
     }
     return parent::beforeSave();
 }
开发者ID:ExcaliburKG,项目名称:SmartTag,代码行数:35,代码来源:update.class.php

示例2: beforeSave

 public function beforeSave()
 {
     $hasLayout = (bool) $this->getProperty('haslayout');
     $this->object->set('haslayout', $hasLayout);
     $controller = $this->getProperty('controller');
     if (empty($controller)) {
         $this->addFieldError('controller', $this->modx->lexicon('controller_err_ns'));
     }
     /* verify parent */
     $parent = $this->getProperty('parent', null);
     if (!empty($parent)) {
         $parent = $this->modx->getObject('modAction', $parent);
         if (empty($parent)) {
             $this->addFieldError('parent', $this->modx->lexicon('action_parent_err_nf'));
         }
     }
     /* verify namespace */
     $namespace = $this->getProperty('namespace');
     if (empty($namespace)) {
         $this->addFieldError('namespace', $this->modx->lexicon('namespace_err_nf'));
     }
     $namespace = $this->modx->getObject('modNamespace', $namespace);
     if (empty($namespace)) {
         $this->addFieldError('namespace', $this->modx->lexicon('namespace_err_nf'));
     }
     return parent::beforeSave();
 }
开发者ID:rosstimson,项目名称:revolution,代码行数:27,代码来源:update.class.php

示例3: beforeSave

 public function beforeSave()
 {
     $name = $this->getProperty('tag');
     $group = $this->getProperty('group');
     $alias = $this->getProperty('alias');
     if (empty($name) || empty($group)) {
         if (empty($group)) {
             $this->addFieldError('group', $this->modx->lexicon('tagger.err.group_name_ns'));
         }
         if (empty($name)) {
             $this->addFieldError('tag', $this->modx->lexicon('tagger.err.tag_name_ns'));
         }
     } else {
         if ($this->object->group != $group) {
             $this->addFieldError('group', $this->modx->lexicon('tagger.err.tag_group_changed'));
         }
         if ($this->modx->getCount($this->classKey, array('tag' => $name, 'group' => $group, 'id:!=' => $this->object->id)) > 0) {
             $this->addFieldError('tag', $this->modx->lexicon('tagger.err.tag_name_ae'));
         }
     }
     if (!empty($alias)) {
         $alias = $this->object->cleanAlias($alias);
         if ($this->modx->getCount($this->classKey, array('alias' => $alias, 'group' => $group, 'id:!=' => $this->object->id)) > 0) {
             $this->addFieldError('alias', $this->modx->lexicon('tagger.err.tag_alias_ae'));
         } else {
             $this->object->set('alias', $alias);
         }
     }
     return parent::beforeSave();
 }
开发者ID:hansek,项目名称:Tagger,代码行数:30,代码来源:update.class.php

示例4: beforeSave

 public function beforeSave()
 {
     $label = $this->getProperty('label');
     $type = $this->getProperty('type');
     $default = $this->getProperty('default');
     switch ($type) {
         case 'select':
         case 'checkbox':
         case 'radio':
             $values = $this->getProperty('values');
             break;
         default:
             // textbox
             $values = '';
             $this->validationType = true;
     }
     $settings = array('label' => $label);
     if (!empty($default)) {
         $settings['default'] = $default;
     }
     if (!empty($values)) {
         $settings['values'] = $values;
     }
     $this->object->set('settings', $this->modx->toJSON($settings));
     return parent::beforeSave();
 }
开发者ID:doksec,项目名称:formz,代码行数:26,代码来源:update.class.php

示例5: beforeSave

 public function beforeSave()
 {
     /*print_r($this->object->toArray());
       
       exit;*/
     return parent::beforeSave();
 }
开发者ID:bendasvadim,项目名称:NewsModxBox,代码行数:7,代码来源:update.class.php

示例6: beforeSave

 public function beforeSave()
 {
     $policyId = $this->getProperty('policy');
     $principalId = $this->getProperty('principal');
     $target = $this->getProperty('target');
     if ($principalId == null) {
         $this->addFieldError('principal', $this->modx->lexicon('usergroup_err_ns'));
     }
     if (empty($policyId)) {
         $this->addFieldError('policy', $this->modx->lexicon('access_policy_err_ns'));
     }
     /* validate for invalid data */
     if (!empty($target)) {
         /** @var modMediaSource $mediaSource */
         $mediaSource = $this->modx->getObject('sources.modMediaSource', $target);
         if (empty($mediaSource)) {
             $this->addFieldError('target', $this->modx->lexicon('source_err_nf'));
         }
         if (!$mediaSource->checkPolicy('view')) {
             $this->addFieldError('target', $this->modx->lexicon('access_denied'));
         }
     }
     $policy = $this->modx->getObject('modAccessPolicy', $policyId);
     if (empty($policy)) {
         $this->addFieldError('policy', $this->modx->lexicon('access_policy_err_nf'));
     }
     $alreadyExists = $this->modx->getObject('modAccessCategory', array('principal' => $principalId, 'principal_class' => 'modUserGroup', 'target' => $target, 'policy' => $policyId, 'context_key' => $this->getProperty('context_key'), 'id:!=' => $this->object->get('id')));
     if ($alreadyExists) {
         $this->addFieldError('context_key', $this->modx->lexicon('access_source_err_ae'));
     }
     $this->object->set('principal_class', 'modUserGroup');
     return parent::beforeSave();
 }
开发者ID:rossng,项目名称:revolution,代码行数:33,代码来源:update.class.php

示例7: beforeSave

 public function beforeSave()
 {
     $active = $this->getProperty('active', null);
     if ($active !== null) {
         $this->object->set('active', (bool) $active);
     }
     return parent::beforeSave();
 }
开发者ID:ChrstnMgcn,项目名称:revolution,代码行数:8,代码来源:update.class.php

示例8: beforeSave

 public function beforeSave()
 {
     if ($this->object->get('recipient') != $this->modx->user->get('id')) {
         return $this->modx->lexicon($this->objectType . '_err_nfs');
     }
     $this->object->set('read', true);
     return parent::beforeSave();
 }
开发者ID:OptimusCrime,项目名称:revolution,代码行数:8,代码来源:read.class.php

示例9: beforeSave

 public function beforeSave()
 {
     $name = $this->getProperty('name');
     if (empty($name)) {
         $this->addFieldError('name', $this->modx->lexicon('role_err_ns_name'));
     }
     return parent::beforeSave();
 }
开发者ID:ChrstnMgcn,项目名称:revolution,代码行数:8,代码来源:update.class.php

示例10: beforeSave

 public function beforeSave()
 {
     $this->setProfile();
     $this->setRemoteData();
     $this->validator = new modUserValidation($this, $this->object, $this->profile);
     $this->validator->validate();
     return parent::beforeSave();
 }
开发者ID:rosstimson,项目名称:revolution,代码行数:8,代码来源:update.class.php

示例11: beforeSave

 /**
  * @return bool
  */
 public function beforeSave()
 {
     $text = $this->getProperty('text');
     /** @var Tickets $Tickets */
     if ($Tickets = $this->modx->getService('Tickets')) {
         $this->object->fromArray(array('editedon' => time(), 'editedby' => $this->modx->user->id, 'text' => $Tickets->Jevix($text, 'Comment'), 'raw' => $text));
     }
     return parent::beforeSave();
 }
开发者ID:soulcreate,项目名称:Tickets,代码行数:12,代码来源:update.class.php

示例12: beforeSave

 public function beforeSave()
 {
     $this->object->set('constraint_class', 'modResource');
     $actionId = $this->getProperty('action_id', null);
     if ($actionId !== null) {
         $this->object->set('action', $actionId);
     }
     return parent::beforeSave();
 }
开发者ID:rosstimson,项目名称:revolution,代码行数:9,代码来源:update.class.php

示例13: beforeSave

 /** {inheritDoc} */
 public function beforeSave()
 {
     /** @var modProcessorResponse $response */
     $response = $this->modx->runProcessor('security/group/update', $this->getProperties());
     if ($response->isError()) {
         return $response->response;
     }
     return parent::beforeSave();
 }
开发者ID:Homchenkokostya,项目名称:msDiscount,代码行数:10,代码来源:update.class.php

示例14: beforeSave

 public function beforeSave()
 {
     if (!$this->verifyIdentity()) {
         return "Неверный ключ или пароль был изменен ранее";
     }
     // else
     $this->eraseCache();
     $this->object->Profile->set('password', $this->getProperty('password'));
     return parent::beforeSave();
 }
开发者ID:bendasvadim,项目名称:NewsModxBox,代码行数:10,代码来源:reset.class.php

示例15: beforeSave

 public function beforeSave()
 {
     /* проверка на кружева */
     if ($this->parent != $this->getProperty('parent', $this->object->get('parent'))) {
         if (!$this->MlmSystem->Tools->checkClientParent($this->object, $this->getProperty('parent'))) {
             $this->addFieldError('parent', $this->MlmSystem->lexicon('err_parent'));
         }
     }
     return parent::beforeSave();
 }
开发者ID:vgrish,项目名称:mlmsystem,代码行数:10,代码来源:update.class.php


注:本文中的modObjectUpdateProcessor::beforeSave方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。