本文整理汇总了PHP中modObjectCreateProcessor::beforeSave方法的典型用法代码示例。如果您正苦于以下问题:PHP modObjectCreateProcessor::beforeSave方法的具体用法?PHP modObjectCreateProcessor::beforeSave怎么用?PHP modObjectCreateProcessor::beforeSave使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类modObjectCreateProcessor
的用法示例。
在下文中一共展示了modObjectCreateProcessor::beforeSave方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: beforeSave
/** {@inheritDoc} */
public function beforeSave()
{
$q = $this->modx->newQuery($this->classKey);
$q->where(array('tab:=' => $this->getProperty('tab')));
$this->object->fromArray(array('rank' => $this->modx->getCount('up2Fields', $q)));
return parent::beforeSave();
}
示例2: beforeSave
public function beforeSave()
{
$formId = $this->getProperty('form_id');
$label = $this->getProperty('label');
$type = $this->getProperty('type');
$default = $this->getProperty('default');
if (empty($label)) {
$this->addFieldError('label', $this->modx->lexicon('formz.field_err_ns'));
} else {
if ($this->doesAlreadyExist(array('label' => $label, 'form_id' => $formId))) {
$this->addFieldError('label', $this->modx->lexicon('formz.field_err_ae'));
}
}
switch ($type) {
case 'select':
case 'checkbox':
case 'radio':
$values = $this->getProperty('values');
$this->validationType = false;
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();
}
示例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->doesAlreadyExist(array('tag' => $name, 'group' => $group))) {
$this->addFieldError('tag', $this->modx->lexicon('tagger.err.tag_name_ae'));
}
}
if (!empty($alias)) {
$alias = $this->object->cleanAlias($alias);
if ($this->doesAlreadyExist(array('alias' => $alias, 'group' => $group))) {
$this->addFieldError('alias', $this->modx->lexicon('tagger.err.tag_alias_ae'));
}
}
return parent::beforeSave();
}
示例4: beforeSave
/** {@inheritDoc} */
public function beforeSave()
{
$data = $this->modx->currencyrate->calcData($this->object->toArray());
$data['rank'] = $this->modx->getCount($this->classKey);
$this->object->fromArray($data);
return parent::beforeSave();
}
示例5: beforeSave
public function beforeSave()
{
if (!$this->object->get('name')) {
return 'Please, type project name';
}
return parent::beforeSave();
}
示例6: beforeSave
/**
* {@inheritDoc}
* @return boolean
*/
public function beforeSave()
{
$this->addProfile();
$this->addUserGroups();
$this->validator = new modUserValidation($this, $this->object, $this->profile);
$this->validator->validate();
return parent::beforeSave();
}
示例7: beforeSave
public function beforeSave()
{
if ($this->doesAlreadyExist(array('principal' => $this->getProperty('principal'), 'principal_class' => 'modUserGroup', 'target' => $this->getProperty('target'), 'policy' => $this->getProperty('policy'), 'context_key' => $this->getProperty('context_key')))) {
$this->addFieldError('target', $this->modx->lexicon('access_source_err_ae'));
}
$this->object->set('principal_class', 'modUserGroup');
return parent::beforeSave();
}
示例8: beforeSave
public function beforeSave()
{
$menuIndex = $this->modx->getCount($this->classKey, array('parent' => $this->getProperty('parent')));
$this->object->set('menuindex', $menuIndex);
$this->object->set('action', $this->getProperty('action_id'));
$this->object->set('text', $this->getProperty('text'));
return parent::beforeSave();
}
示例9: beforeSave
public function beforeSave()
{
$name = $this->getProperty('persons_name');
if (empty($name)) {
$this->addFieldError('persons_name', $this->modx->lexicon('Specify'));
}
return parent::beforeSave();
}
示例10: beforeSave
public function beforeSave()
{
/* User and Server info */
$data = array('ip_address' => $_SERVER['REMOTE_ADDR'], 'server_name' => $_SERVER['SERVER_NAME'], 'server_address' => $_SERVER['SERVER_ADDR'], 'user_agent' => $_SERVER['HTTP_USER_AGENT'], 'request_time' => $_SERVER['REQUEST_TIME']);
// set data and time created
$this->object->set('senton', date('Y-m-d H:i:s', time()));
$this->object->set('data', serialize($data));
return parent::beforeSave();
}
示例11: 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();
}
示例12: beforeSave
public function beforeSave()
{
$name = $this->getProperty('name');
if (empty($name)) {
$this->addFieldError('name', $this->modx->lexicon('namespace_err_ns_name'));
}
$this->object->set('name', $name);
$this->object->set('path', trim($this->object->get('path')));
return parent::beforeSave();
}
示例13: beforeSave
public function beforeSave()
{
$uloginid = $this->getProperty('uloginid');
if ($this->doesAlreadyExist(array('uloginid' => $uloginid))) {
$this->addFieldError('uloginid', $this->modx->lexicon('ulogin.widget_err_ae'));
// } elseif (empty($uloginid)) {
// $this->addFieldError('uloginid',$this->modx->lexicon('ulogin.widget_err_ns_uloginid'));
}
return parent::beforeSave();
}
示例14: beforeSave
/**
* {@inheritDoc}
* @return boolean
*/
public function beforeSave()
{
$this->addProfile();
$sudo = $this->getProperty('sudo', null);
if ($sudo !== null) {
$this->object->setSudo(!empty($sudo));
}
$this->validator = new modUserValidation($this, $this->object, $this->profile);
$this->validator->validate();
return parent::beforeSave();
}
示例15: beforeSave
public function beforeSave()
{
$c = array('target' => $this->object->get('target'), 'principal_class' => $this->object->get('principal_class'), 'principal' => $this->object->get('principal'), 'authority' => $this->object->get('authority'), 'policy' => $this->object->get('policy'));
if ($this->getProperty('context_key')) {
$c['context_key'] = $this->getProperty('context_key');
}
if ($this->doesAlreadyExist($c)) {
return $this->modx->lexicon($this->objectType . '_err_ae');
}
return parent::beforeSave();
}