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


PHP modObjectUpdateProcessor类代码示例

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


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

示例1: fireAfterSaveEvent

 public function fireAfterSaveEvent()
 {
     // Clear the cache:
     $cacheRefreshOptions = array('system_settings' => array());
     $this->modx->cacheManager->refresh($cacheRefreshOptions);
     return parent::fireAfterSaveEvent();
 }
开发者ID:bendasvadim,项目名称:ulogin-ModX,代码行数:7,代码来源:updatefromcombos.class.php

示例2: beforeSet

 /** {@inheritDoc} */
 public function beforeSet()
 {
     if ($this->modx->getObject('up2Tabs', array('tab' => $this->getProperty('tab'), 'type' => $this->getProperty('type'), 'id:!=' => $this->getProperty('id')))) {
         $this->modx->error->addField('tab', $this->modx->lexicon('vp_err_ae'));
     }
     return parent::beforeSet();
 }
开发者ID:arimanr,项目名称:userprofile2,代码行数:8,代码来源:update.class.php

示例3: beforeSave

 public function beforeSave()
 {
     // Setting creator and time created
     $this->object->set('editedby', $this->modx->user->get('id'));
     $this->object->set('editedon', date('Y-m-d H:i:s', time()));
     return parent::beforeSave();
 }
开发者ID:doksec,项目名称:formz,代码行数:7,代码来源:update.class.php

示例4: beforeSet

 public function beforeSet()
 {
     if ($this->modx->getObject('mSkladProductProperty', array('source' => $this->getProperty('source'), 'id:!=' => $this->getProperty('id')))) {
         $this->modx->error->addField('source', $this->modx->lexicon('msklad_err_ae'));
     }
     return parent::beforeSet();
 }
开发者ID:svyatoslavteterin,项目名称:belton.by,代码行数:7,代码来源:update.class.php

示例5: 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

示例6: initialize

 public function initialize()
 {
     if (!$this->getProperty('username')) {
         return 'Не указан пользователь';
     }
     return parent::initialize();
 }
开发者ID:bendasvadim,项目名称:NewsModxBox,代码行数:7,代码来源:update.class.php

示例7: afterSave

 public function afterSave()
 {
     $this->updateTranslations($this->getProperties());
     $this->refreshURIs();
     $this->clearCache();
     return parent::afterSave();
 }
开发者ID:rosstimson,项目名称:revolution,代码行数:7,代码来源:update.class.php

示例8: beforeSave

 public function beforeSave()
 {
     $name = $this->getProperty('name');
     $alias = $this->getProperty('alias');
     if (empty($name)) {
         $this->addFieldError('name', $this->modx->lexicon('tagger.err.group_name_ns'));
     } else {
         if ($this->modx->getCount($this->classKey, array('name' => $name)) && $this->object->name != $name) {
             $this->addFieldError('name', $this->modx->lexicon('tagger.err.group_name_ae'));
         }
     }
     $fieldType = $this->getProperty('field_type');
     $showAutotag = (int) $this->getProperty('show_autotag', 0);
     if ($fieldType != 'tagger-field-tags') {
         $this->object->set('show_autotag', 0);
     }
     if ($showAutotag != 1) {
         $this->object->set('hide_input', 0);
     }
     if (!empty($alias)) {
         $alias = $this->object->cleanAlias($alias);
         if ($this->modx->getCount($this->classKey, array('alias' => $alias, 'id:!=' => $this->object->id)) > 0) {
             $this->addFieldError('alias', $this->modx->lexicon('tagger.err.group_alias_ae'));
         } else {
             $this->object->set('alias', $alias);
         }
     }
     return parent::beforeSave();
 }
开发者ID:hansek,项目名称:Tagger,代码行数:29,代码来源:update.class.php

示例9: afterSave

 public function afterSave()
 {
     /* now store the permissions into the modAccessPermission table */
     /* and cache the data into the policy table */
     $permissions = $this->getProperty('permissions', null);
     if ($permissions !== null) {
         $permissions = is_array($permissions) ? $permissions : $this->modx->fromJSON($permissions);
         /* first erase all prior permissions */
         $oldPermissions = $this->object->getMany('Permissions');
         /** @var modAccessPermission $permission */
         foreach ($oldPermissions as $permission) {
             $permission->remove();
         }
         $added = array();
         foreach ($permissions as $permissionArray) {
             if (in_array($permissionArray['name'], $added)) {
                 continue;
             }
             $permission = $this->modx->newObject('modAccessPermission');
             $permission->set('template', $this->object->get('id'));
             $permission->set('name', $permissionArray['name']);
             $permission->set('description', $permissionArray['description']);
             $permission->set('value', true);
             $permission->save();
             $added[] = $permissionArray['name'];
         }
     }
     return parent::afterSave();
 }
开发者ID:ChrstnMgcn,项目名称:revolution,代码行数:29,代码来源:update.class.php

示例10: 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

示例11: beforeSet

 public function beforeSet()
 {
     $content = '';
     $classKey = $this->getProperty('class_key');
     switch ($classKey) {
         case 'sSnippetTask':
             $content = $this->getProperty('snippet-content');
             if (empty($content)) {
                 $this->addFieldError('snippet-content', $this->modx->lexicon('scheduler.error.no-snippet-content'));
                 return false;
             }
             break;
         case 'sProcessorTask':
             $content = $this->getProperty('processor-content');
             if (empty($content)) {
                 $this->addFieldError('processor-content', $this->modx->lexicon('scheduler.error.no-processor-content'));
                 return false;
             }
             break;
         case 'sFileTask':
         default:
             $content = $this->getProperty('file-content');
             if (empty($content)) {
                 $this->addFieldError('file-content', $this->modx->lexicon('scheduler.error.no-file-content'));
                 return false;
             }
             break;
     }
     $this->setProperty('content', $content);
     return parent::beforeSet();
 }
开发者ID:sebastian-marinescu,项目名称:Scheduler,代码行数:31,代码来源:update.class.php

示例12: initialize

 public function initialize()
 {
     $user_code = $this->getProperty('user_code');
     //check if code not empty
     if (empty($user_code) or $user_code == '') {
         return $this->modx->lexicon('ep_sms_code_is_empty');
     }
     $query = $this->modx->newQuery('epValidateNum');
     /*get row with select all from max row with max createdon  */
     $query->select('id as id,createdon as createdon,code as code,validate as validate,phone as phone');
     $query->limit(1);
     $query->sortby('createdon', 'desc');
     $query->where(array('user_id:=' => $this->modx->user->id));
     //get data array
     if ($query->prepare() && $query->stmt->execute()) {
         $this->data = $query->stmt->fetch(PDO::FETCH_ASSOC);
     }
     //check for current code validate status for this user
     if ($this->data['validate'] == 1) {
         return $this->modx->lexicon('ep_sms_validate_already_done');
     }
     //if code is correct - set update time and validate status
     if ($this->data['code'] == $user_code) {
         $this->setProperties(array('validate' => 1, 'updatedon' => date('Y-m-d H:i:s'), 'id' => $this->data['id']));
     } else {
         return $this->modx->lexicon('ep_sms_check_code_wrong');
     }
     return parent::initialize();
 }
开发者ID:bendasvadim,项目名称:ePochta,代码行数:29,代码来源:update.class.php

示例13: beforeSet

 public function beforeSet()
 {
     $this->setCheckbox('uri', false);
     $this->setCheckbox('override', false);
     $this->setCheckbox('active', false);
     return parent::beforeSet();
 }
开发者ID:svyatoslavteterin,项目名称:belton.by,代码行数:7,代码来源:update.class.php

示例14: beforeSet

 /**
  * @return bool
  */
 public function beforeSet()
 {
     $id = (int) $this->getProperty('id');
     $rid = $this->getProperty('rid');
     list($type, $principal) = explode('-', $this->getProperty('principal'));
     if ($this->modx->getCount($this->classKey, array('rid' => $rid, 'principal_type' => $type, 'principal' => $principal, 'id:!=' => $id))) {
         $this->modx->error->addField('principal', $this->modx->lexicon('admintools_permissions_err_ae'));
         return parent::beforeSet();
     }
     switch ($type) {
         case 'all':
             $weight = 0;
             break;
         case 'gst':
             $weight = 1;
             break;
         case 'grp':
             $weight = 10;
             break;
         case 'usr':
             $weight = 100;
             break;
         default:
             $weight = 0;
             break;
     }
     if ($type != 'grp') {
         $this->setProperty('priority', 0);
     }
     $this->setProperty('weight', $weight);
     $this->setProperty('principal_type', $type);
     $this->setProperty('principal', $principal);
     return parent::beforeSet();
 }
开发者ID:sergant210,项目名称:AdminTools,代码行数:37,代码来源:update.class.php

示例15: 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


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