本文整理汇总了PHP中modObjectCreateProcessor::afterSave方法的典型用法代码示例。如果您正苦于以下问题:PHP modObjectCreateProcessor::afterSave方法的具体用法?PHP modObjectCreateProcessor::afterSave怎么用?PHP modObjectCreateProcessor::afterSave使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类modObjectCreateProcessor
的用法示例。
在下文中一共展示了modObjectCreateProcessor::afterSave方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: afterSave
public function afterSave()
{
$categories = $this->getCategories();
$categories = $this->object->setCategories($categories);
$this->object->set('categories', $categories);
return parent::afterSave();
}
示例2: afterSave
public function afterSave()
{
$contexts = $this->getProperty('access_contexts', '');
$contexts = is_array($contexts) ? $contexts : explode(',', $contexts);
$contexts = array_unique($contexts);
if (!empty($contexts)) {
$flush = false;
if ($this->getProperty('access_admin')) {
if ($this->addAdminAccess($contexts)) {
$flush = true;
}
}
if ($this->getProperty('access_anon')) {
if ($this->addAnonymousAccess($contexts)) {
$flush = true;
}
}
if ($this->getProperty('access_parallel')) {
if ($this->addParallelUserGroup($contexts)) {
$flush = true;
}
}
$userGroups = $this->getProperty('access_usergroups');
if (!empty($userGroups)) {
$userGroups = is_array($userGroups) ? $userGroups : explode(',', $userGroups);
if ($this->addOtherUserGroups($userGroups, $contexts)) {
$flush = true;
}
}
if ($flush) {
$this->flushPermissions();
}
}
return parent::afterSave();
}
示例3: afterSave
public function afterSave()
{
/** @var xPDOFileCache $provider */
$provider = $this->modx->cacheManager->getCacheProvider('oauth2server');
$provider->flush();
return parent::afterSave();
}
示例4: afterSave
public function afterSave()
{
$this->saveRequired();
if ($this->validationType) {
$this->saveValidation();
}
return parent::afterSave();
}
示例5: afterSave
public function afterSave()
{
$widgets = $this->getProperty('widgets', null);
if ($widgets != null) {
$this->assignWidgets($widgets);
}
return parent::afterSave();
}
示例6: afterSave
public function afterSave()
{
$this->setContexts();
if ($this->modx->hasPermission('usergroup_user_edit')) {
$this->setResourceGroups();
}
return parent::afterSave();
}
示例7: afterSave
/** {@inheritDoc} */
public function afterSave()
{
$eventId = $this->object->get('event');
if ($event = $this->modx->getObject('vpEvent', $eventId)) {
$eventName = $event->get('name');
// set event
$this->modx->virtualpage->doEvent('create', $eventName, 'vpEvent', 10);
}
return parent::afterSave();
}
示例8: afterSave
/** {@inheritDoc} */
public function afterSave()
{
$this->thread->updateLastMessage();
/* @var ecMessage $m */
if ($m = $this->modx->getObject('ecMessage', $this->getProperty('id'))) {
if ($m->notifyUser()) {
$m->set('notify', 0);
$m->set('notify_date', date('Y-m-d H:i:s'));
$m->save();
}
}
return parent::afterSave();
}
示例9: afterSave
/** {@inheritDoc} */
public function afterSave()
{
$delivery_id = $this->object->get('id');
/* @var msDeliveryMember $entry */
$payments = $this->getProperty('payments');
if (!empty($payments) && is_array($payments)) {
foreach ($payments as $payment => $v) {
if ($v == 1) {
$entry = $this->modx->newObject('msDeliveryMember');
$entry->fromArray(array('delivery_id' => $delivery_id, 'payment_id' => $payment), '', true);
$entry->save();
}
}
}
return parent::afterSave();
}
示例10: afterSave
public function afterSave()
{
$urlHistory = new UrlHistory($this->modx);
$short = $urlHistory->encodeId($this->object->id);
while ($this->modx->getObject('modResource', array('alias' => $short))) {
$newObject = $this->modx->newObject('UrlHistoryItem');
$newObject->set('url', $this->object->url);
$newObject->save();
$short = $urlHistory->encodeId($newObject->id, true);
$newObject->set('short', $short);
$newObject->save();
$this->object->remove();
$this->object = $newObject;
}
$siteUrl = $this->modx->getOption('site_url');
$this->object->set('short', $siteUrl . $short);
$this->object->save();
return parent::afterSave();
}
示例11: afterSave
public function afterSave()
{
$this->setContexts();
if ($this->modx->hasPermission('usergroup_user_edit')) {
$this->setResourceGroups();
}
/* access wizard stuff */
$flush = false;
$users = $this->getProperty('aw_users', '');
if (!empty($users)) {
$this->addUsersViaWizard($users);
}
$contexts = $this->getProperty('aw_contexts', '');
if (!empty($contexts)) {
$contexts = is_array($contexts) ? $contexts : explode(',', $contexts);
$contexts = array_unique($contexts);
$adminPolicy = trim($this->getProperty('aw_manager_policy', 0));
if (!empty($adminPolicy)) {
$this->addManagerContextAccessViaWizard($adminPolicy);
}
$policy = trim($this->getProperty('aw_contexts_policy', 0));
if ($this->addContextAccessViaWizard($contexts, $policy)) {
$flush = true;
}
$resourceGroups = $this->getProperty('aw_resource_groups', '');
if (!empty($resourceGroups)) {
$this->addResourceGroupsViaWizard($resourceGroups, $contexts);
}
$categories = $this->getProperty('aw_categories', '');
if (!empty($categories)) {
$this->addElementCategoriesViaWizard($categories, $contexts);
}
$parallel = $this->getProperty('aw_parallel', false);
if ($parallel) {
$this->addParallelResourceGroup($contexts);
}
}
if ($flush) {
$this->flushPermissions();
}
return parent::afterSave();
}
示例12: afterSave
/**
* @return bool
*/
public function afterSave()
{
$assetsPath = $this->modx->getOption('msgiftsrusynch_assets_path', null, $this->modx->getOption('assets_path') . 'components/msgiftsrusynch/');
$path = $assetsPath . 'xml_files/' . $this->object->get('id') . '/';
mkdir($path);
for ($i = 0; $i < count($this->xmlFiles); $i++) {
$ch = curl_init($this->url_gifts_api . $this->xmlFiles[$i]);
$fp = fopen($path . $this->xmlFiles[$i], 'w+b');
curl_setopt($ch, CURLOPT_FILE, $fp);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_exec($ch);
curl_close($ch);
fclose($fp);
/*$this->object->set('description',
$path . $this->xmlFiles[$i] .' '.
$this->url_gifts_api . $this->xmlFiles[$i] .', '.
$this->object->get('description')
);
$this->object->save();*/
}
return parent::afterSave();
}
示例13: afterSave
/**
* Ensure that Admin UserGroup always has access to this context, if not adding Admin ACL
* @return bool
*/
public function afterSave()
{
$adminGroup = $this->modx->getObject('modUserGroup', array('name' => 'Administrator'));
if ($adminGroup && $this->object->get('principal') !== $adminGroup->get('id')) {
$adminContextPolicy = $this->modx->getObject('modAccessPolicy', array('name' => 'Context'));
if ($adminContextPolicy) {
$adminContextAccess = $this->modx->getObject($this->classKey, array('principal' => $adminGroup->get('id'), 'principal_class' => 'modUserGroup', 'target' => $this->object->get('target')));
if (!$adminContextAccess) {
$adminContextAccess = $this->modx->newObject('modAccessContext');
$adminContextAccess->set('principal', $adminGroup->get('id'));
$adminContextAccess->set('principal_class', 'modUserGroup');
$adminContextAccess->set('target', $this->object->get('target'));
$adminContextAccess->set('policy', $adminContextPolicy->get('id'));
$adminContextAccess->save();
}
}
}
if ($this->modx->getUser()) {
$this->modx->user->getAttributes(array(), '', true);
}
return parent::afterSave();
}
示例14: afterSave
public function afterSave()
{
$_SESSION['comment_time'] = time();
/**
* Refresh comment and conversation cache
*/
if ($this->modx->modxtalks->mtCache === true) {
if (!$this->modx->modxtalks->cacheComment($this->object)) {
$this->modx->log(xPDO::LOG_LEVEL_ERROR, '[modxTalks web/comment/create] Error cache the comment with ID ' . $this->object->id);
}
if (!$this->modx->modxtalks->cacheConversation($this->theme)) {
$this->modx->log(xPDO::LOG_LEVEL_ERROR, '[modxTalks web/comment/create] Error cache the conversation with ID ' . $this->theme->id);
}
}
/**
* Send Notify to conversation moderators
*/
$success = false;
if (!$this->modx->modxtalks->isDisabledFunction('exec') && $this->modx->modxtalks->sendMail($this->object->id)) {
$success = true;
} elseif ($this->modx->modxtalks->notifyModerators($this->object)) {
$success = true;
}
if (!$success) {
$this->failure($this->modx->lexicon('modxtalks.error_try_again'));
return false;
}
return parent::afterSave();
}
示例15: afterSave
public function afterSave()
{
$this->modx->cacheManager->refresh(array('default' => array('qsb' => array())));
return parent::afterSave();
}