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


PHP eZPersistentObject::setAttribute方法代码示例

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


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

示例1: setAttribute

 function setAttribute($attr, $val)
 {
     switch ($attr) {
         case 'product_categories':
             $this->ProductCategories = $val;
             break;
         default:
             parent::setAttribute($attr, $val);
             break;
     }
 }
开发者ID:patrickallaert,项目名称:ezpublish-legacy-php7,代码行数:11,代码来源:ezvatrule.php

示例2: setAttribute

 function setAttribute($attr, $val)
 {
     switch ($attr) {
         case 'limit_value':
             $this->LimitValue = $val;
             break;
         default:
             parent::setAttribute($attr, $val);
             break;
     }
 }
开发者ID:nfrp,项目名称:ezpublish,代码行数:11,代码来源:ezpolicylimitation.php

示例3: setAttribute

    function setAttribute( $attr, $val )
    {
        switch( $attr )
        {
            case 'limit_value':
            {
                $this->LimitValue = $val;
            } break;

            default:
            {
                eZPersistentObject::setAttribute( $attr, $val );
            } break;
        }
    }
开发者ID:robinmuilwijk,项目名称:ezpublish,代码行数:15,代码来源:ezpolicylimitation.php

示例4: setAttribute

    function setAttribute( $attr, $val )
    {
        switch( $attr )
        {
            case 'product_categories':
            {
                $this->ProductCategories = $val;
            } break;

            default:
            {
                eZPersistentObject::setAttribute( $attr, $val );
            } break;
        }
    }
开发者ID:robinmuilwijk,项目名称:ezpublish,代码行数:15,代码来源:ezvatrule.php

示例5: setAttribute

 function setAttribute($attr, $val)
 {
     switch ($attr) {
         case 'is_enabled':
             if (!$val) {
                 $user = eZUser::fetch($this->UserID);
                 if ($user) {
                     eZUser::removeSessionData($this->UserID);
                 }
             }
             eZUser::purgeUserCacheByUserId($this->UserID);
             break;
     }
     parent::setAttribute($attr, $val);
 }
开发者ID:CG77,项目名称:ezpublish-legacy,代码行数:15,代码来源:ezusersetting.php

示例6: setAttribute

 /**
  * (non-PHPdoc)
  * @see kernel/classes/eZPersistentObject#setAttribute($attr, $val)
  */
 function setAttribute($attr, $value)
 {
     switch ($attr) {
         case 'status':
             if ($value === CjwNewsletterEditionSend::STATUS_MAILQUEUE_CREATED) {
                 $this->setAttribute('mailqueue_created', time());
             } elseif ($value === CjwNewsletterEditionSend::STATUS_MAILQUEUE_PROCESS_STARTED) {
                 $this->setAttribute('mailqueue_process_started', time());
             } elseif ($value === CjwNewsletterEditionSend::STATUS_MAILQUEUE_PROCESS_FINISHED) {
                 $this->setAttribute('mailqueue_process_finished', time());
             } elseif ($value === CjwNewsletterEditionSend::STATUS_ABORT) {
                 $this->setAttribute('mailqueue_process_aborted', time());
             }
             return eZPersistentObject::setAttribute($attr, $value);
             break;
         default:
             return eZPersistentObject::setAttribute($attr, $value);
     }
 }
开发者ID:heliopsis,项目名称:cjw_newsletter,代码行数:23,代码来源:cjwnewslettereditionsend.php

示例7: setAttribute

 function setAttribute($attr, $val)
 {
     switch ($attr) {
         case 'limit_identifier':
             if (!$this->LimitIdentifier) {
                 $this->LimitIdentifier = $val;
             }
             break;
         case 'limit_value':
             if (!$this->LimitValue) {
                 $this->LimitValue = $val;
             }
             break;
         case 'user_role_id':
             if (!$this->UserRoleID) {
                 $this->UserRoleID = $val;
             }
             break;
         default:
             parent::setAttribute($attr, $val);
             break;
     }
 }
开发者ID:mugoweb,项目名称:ezpublish-legacy,代码行数:23,代码来源:ezpolicy.php

示例8: setAttribute

 function setAttribute($attr, $value)
 {
     $userData = eZUserSubscriptionData::fetch($this->attribute('email'));
     switch ($attr) {
         case 'email':
             if (!$userData) {
                 $userData = eZUserSubscriptionData::create('', '', '', $value);
             } else {
                 $userData->updateAttribute('email', $value);
                 $userData->store();
             }
             eZPersistentObject::setAttribute($attr, $value);
             break;
         case 'name':
             if ($userData) {
                 $userData->setAttribute($attr, $value);
                 $userData->store();
             }
             break;
         case 'firstname':
             if ($userData) {
                 $userData->setAttribute($attr, $value);
                 $userData->store();
             }
             break;
         case 'mobile':
             if ($userData) {
                 $userData->setAttribute($attr, $value);
                 $userData->store();
             }
             break;
         case 'password':
             if ($userData) {
                 $userData->setAttribute($attr, md5($value));
                 $userData->store();
             }
             break;
         case 'user_id':
             if ($this->attribute($attr) != $value && $value != 0) {
                 $user = eZUser::fetch($value);
                 if (!$user) {
                     return;
                 }
                 eZPersistentObject::setAttribute($attr, $value);
             } else {
                 if ($value == 0) {
                     eZPersistentObject::setAttribute($attr, $value);
                 }
             }
             break;
         case 'status':
             if ($this->attribute($attr) != $value) {
                 switch ($value) {
                     case eZSubscription::StatusConfirmed:
                         $this->setAttribute('confirmed', time());
                         break;
                     case eZSubscription::StatusApproved:
                         $this->setAttribute('approved', time());
                         break;
                     case eZSubscription::StatusRemovedAdmin:
                     case eZSubscription::StatusRemovedSelf:
                         $this->setAttribute('removed', time());
                         break;
                 }
                 eZPersistentObject::setAttribute($attr, $value);
             }
             break;
         default:
             eZPersistentObject::setAttribute($attr, $value);
             break;
     }
 }
开发者ID:EVE-Corp-Center,项目名称:ECC-Website,代码行数:72,代码来源:ezsubscription.php

示例9: setAttribute

 function setAttribute($name, $value)
 {
     parent::setAttribute($name, $value);
     if ($name == 'text') {
         $this->TextMD5 = md5(eZURLAliasML::strtolower($value));
     } else {
         if ($name == 'action') {
             $this->ActionType = null;
         }
     }
 }
开发者ID:patrickallaert,项目名称:ezpublish-legacy-php7,代码行数:11,代码来源:ezurlaliasml.php

示例10: setAttribute

 /**
  * (non-PHPdoc)
  * @see kernel/classes/eZPersistentObject#setAttribute($attr, $val)
  */
 function setAttribute($attr, $value)
 {
     switch ($attr) {
         case 'status':
             // only update timestamp and status if status id is changed
             if ($this->attribute('status') == $value) {
                 return;
             }
             $currentTimeStamp = time();
             // set status timestamps
             switch ($value) {
                 case CjwNewsletterSubscription::STATUS_CONFIRMED:
                     $this->setAttribute('removed', 0);
                     $this->setAttribute('confirmed', $currentTimeStamp);
                     $newsletterListAttributeContent = $this->attribute('newsletter_list_attribute_content');
                     // set approve automatically if defined in list config
                     if (is_object($newsletterListAttributeContent) and (int) $newsletterListAttributeContent->attribute('auto_approve_registered_user') == 1) {
                         $this->setAttribute('approved', $currentTimeStamp);
                         $value = CjwNewsletterSubscription::STATUS_APPROVED;
                     } else {
                         // if subscription status is changed from approved to confirmed the approved timestamp should be removed
                         $this->setAttribute('approved', 0);
                     }
                     break;
                 case CjwNewsletterSubscription::STATUS_APPROVED:
                     $this->setAttribute('approved', $currentTimeStamp);
                     $this->setAttribute('removed', 0);
                     break;
                 case CjwNewsletterSubscription::STATUS_REMOVED_ADMIN:
                 case CjwNewsletterSubscription::STATUS_REMOVED_SELF:
                     $this->setAttribute('removed', $currentTimeStamp);
                     break;
             }
             $this->setAttribute('modified', $currentTimeStamp);
             $statusOld = $this->attribute('status');
             $statusNew = $value;
             if ($statusOld != $statusNew) {
                 CjwNewsletterLog::writeNotice('CjwNewsletterSubscription::setAttribute', 'subscription', 'status', array('status_old' => $statusOld, 'status_new' => $statusNew, 'subscription_id' => $this->attribute('id'), 'list_id' => $this->attribute('list_contentobject_id'), 'nl_user' => $this->attribute('newsletter_user_id'), 'modifier' => eZUser::currentUserID()));
             } else {
                 CjwNewsletterLog::writeDebug('CjwNewsletterSubscription::setAttribute', 'subscription', 'status', array('status_old' => $statusOld, 'status_new' => $statusNew, 'subscription_id' => $this->attribute('id'), 'list_id' => $this->attribute('list_contentobject_id'), 'nl_user' => $this->attribute('newsletter_user_id'), 'modifier' => eZUser::currentUserID()));
             }
             eZPersistentObject::setAttribute($attr, $value);
             break;
         default:
             eZPersistentObject::setAttribute($attr, $value);
             break;
     }
 }
开发者ID:heliopsis,项目名称:cjw_newsletter,代码行数:52,代码来源:cjwnewslettersubscription.php

示例11: setAttribute

 function setAttribute($attribute, $value)
 {
     $found = false;
     switch ($attribute) {
         case 'contentobjectattribute_id':
             $this->ContentObjectAttributeID = $this->contentobjectattributeID();
             $found = true;
             break;
     }
     if ($found === false) {
         parent::setAttribute($attribute, $value);
     }
 }
开发者ID:netbliss,项目名称:ezsurvey,代码行数:13,代码来源:ezsurveyquestion.php

示例12: updateAttribute

 function updateAttribute($attr, $value)
 {
     eZPersistentObject::setAttribute($attr, $value);
 }
开发者ID:EVE-Corp-Center,项目名称:ECC-Website,代码行数:4,代码来源:ezusersubscriptiondata.php

示例13: setAttribute

 /**
  * (non-PHPdoc)
  * @see kernel/classes/eZPersistentObject#setAttribute($attr, $val)
  */
 function setAttribute($attr, $value)
 {
     switch ($attr) {
         case 'status':
             switch ($value) {
                 case CjwNewsletterEditionSendItem::STATUS_NEW:
                     $this->setAttribute('created', time());
                     break;
                 case CjwNewsletterEditionSendItem::STATUS_SEND:
                     $this->setAttribute('processed', time());
                     break;
                 case CjwNewsletterEditionSendItem::STATUS_ABORT:
                     $this->setAttribute('processed', time());
                     break;
                 default:
                     break;
             }
             CjwNewsletterLog::writeDebug('set status - CjwNewsletterEditionSendItem::setAttribute', 'send_item', $this->attribute('id'), array('status_old' => $this->attribute('status'), 'status_new' => $value, 'nl_user' => $this->attribute('newsletter_user_id')));
             return eZPersistentObject::setAttribute($attr, $value);
             break;
         default:
             return eZPersistentObject::setAttribute($attr, $value);
     }
 }
开发者ID:heliopsis,项目名称:cjw_newsletter,代码行数:28,代码来源:cjwnewslettereditionsenditem.php

示例14: setAttribute

 /**
  *
  * @see kernel/classes/eZPersistentObject#setAttribute($attr, $val)
  */
 function setAttribute($attr, $value)
 {
     // TODO check if modified should be update every time a attribute is set
     // may be in store method better place to do this
     switch ($attr) {
         case 'email':
             $currentEmail = $this->attribute('email');
             $newEmail = $value;
             if ($currentEmail != $newEmail) {
                 CjwNewsletterLog::writeNotice('set new email CjwNewsletterUser::setAttribute', 'user', 'email', array('nl_user' => $this->attribute('id'), 'email_old' => $currentEmail, 'email_new' => $newEmail, 'status' => $this->attribute('status'), 'modifier' => eZUser::currentUserID()));
             }
             return eZPersistentObject::setAttribute($attr, $value);
             break;
         case 'status':
             $currentTimeStamp = time();
             switch ($value) {
                 case CjwNewsletterUser::STATUS_CONFIRMED:
                     $this->setAttribute('confirmed', $currentTimeStamp);
                     // if a user is confirmed reset bounce count
                     $this->resetBounceCount();
                     break;
                 case CjwNewsletterUser::STATUS_BOUNCED_SOFT:
                 case CjwNewsletterUser::STATUS_BOUNCED_HARD:
                     $this->setAttribute('bounced', $currentTimeStamp);
                     // set all subscriptions and all open senditems to bounced
                     // see
                     // setBounced
                     // setAllNewsletterUserRelatedItemsToStatus
                     break;
                 case CjwNewsletterUser::STATUS_REMOVED_ADMIN:
                 case CjwNewsletterUser::STATUS_REMOVED_SELF:
                     $this->setAttribute('removed', $currentTimeStamp);
                     // set all subscriptions and all open senditems to removed
                     //
                     break;
                 case CjwNewsletterUser::STATUS_BLACKLISTED:
                     $this->setAttribute('blacklisted', $currentTimeStamp);
                     // set all subscriptions and all open senditems to blacklisted
                     // see
                     // setBlacklisted
                     // setAllNewsletterUserRelatedItemsToStatus
                     break;
             }
             $statusOld = $this->attribute('status');
             $statusNew = $value;
             if ($statusOld != $statusNew) {
                 CjwNewsletterLog::writeNotice('set CjwNewsletterUser::setAttribute', 'user', 'status', array('nl_user' => $this->attribute('id'), 'status_old' => $statusOld, 'status_new' => $statusNew, 'modifier' => eZUser::currentUserID()));
             } else {
                 CjwNewsletterLog::writeDebug('set CjwNewsletterUser::setAttribute', 'user', 'status', array('nl_user' => $this->attribute('id'), 'status_old' => $statusOld, 'status_new' => $statusNew, 'modifier' => eZUser::currentUserID()));
             }
             return eZPersistentObject::setAttribute($attr, $value);
             break;
         default:
             return eZPersistentObject::setAttribute($attr, $value);
     }
 }
开发者ID:hudri,项目名称:cjw_newsletter,代码行数:60,代码来源:cjwnewsletteruser.php

示例15: storeObject

 /**
  * Stores the data in $obj to database.
  *
  * Note: Transaction unsafe. If you call several transaction unsafe methods
  * you must enclose the calls within a db transaction; thus within db->begin
  * and db->commit.
  *
  * @todo Change the actual access to protected instead of just marking it as such
  * @access protected
  * @param eZPersistentObject $obj
  * @param array|null $fieldFilters If specified only certain fields will be stored.
  * @return void
  */
 public static function storeObject($obj, $fieldFilters = null)
 {
     $db = eZDB::instance();
     $useFieldFilters = isset($fieldFilters) && is_array($fieldFilters) && $fieldFilters;
     $def = $obj->definition();
     $fields = $def["fields"];
     $keys = $def["keys"];
     $table = $def["name"];
     $relations = isset($def["relations"]) ? $def["relations"] : null;
     $insert_object = false;
     $exclude_fields = array();
     foreach ($keys as $key) {
         $value = $obj->attribute($key);
         if ($value === null) {
             $insert_object = true;
             $exclude_fields[] = $key;
         }
     }
     if ($useFieldFilters) {
         $insert_object = false;
     }
     $use_fields = array_diff(array_keys($fields), $exclude_fields);
     // If we filter out some of the fields we need to intersect it with $use_fields
     if (is_array($fieldFilters)) {
         $use_fields = array_intersect($use_fields, $fieldFilters);
     }
     $doNotEscapeFields = array();
     $changedValueFields = array();
     $numericDataTypes = array('integer', 'float', 'double');
     foreach ($use_fields as $field_name) {
         $field_def = $fields[$field_name];
         $value = $obj->attribute($field_name);
         if ($value === null) {
             if (!is_array($field_def)) {
                 $exclude_fields[] = $field_name;
             } else {
                 if (array_key_exists('default', $field_def) && ($field_def['default'] !== null || $field_name == 'data_int' && array_key_exists('required', $field_def) && $field_def['required'] == false)) {
                     $obj->setAttribute($field_name, $field_def['default']);
                 } else {
                     //if ( in_array( $field_def['datatype'], $numericDataTypes )
                     $exclude_fields[] = $field_name;
                 }
             }
         }
         if (strlen($value) == 0 && is_array($field_def) && in_array($field_def['datatype'], $numericDataTypes) && array_key_exists('default', $field_def) && ($field_def['default'] === null || is_numeric($field_def['default']))) {
             $obj->setAttribute($field_name, $field_def['default']);
         }
         if ($value !== null && $field_def['datatype'] === 'string' && array_key_exists('max_length', $field_def) && $field_def['max_length'] > 0) {
             $obj->setAttribute($field_name, $db->truncateString($value, $field_def['max_length'], $field_name));
         }
         $bindDataTypes = array('text');
         if ($db->bindingType() != eZDBInterface::BINDING_NO && $db->countStringSize($value) > 2000 && is_array($field_def) && in_array($field_def['datatype'], $bindDataTypes)) {
             $boundValue = $db->bindVariable($value, $field_def);
             //                $obj->setAttribute( $field_name, $value );
             $doNotEscapeFields[] = $field_name;
             $changedValueFields[$field_name] = $boundValue;
         }
     }
     $key_conds = array();
     foreach ($keys as $key) {
         $value = $obj->attribute($key);
         $key_conds[$key] = $value;
     }
     unset($value);
     $important_keys = $keys;
     if (is_array($relations)) {
         //            $important_keys = array();
         foreach ($relations as $relation => $relation_data) {
             if (!in_array($relation, $keys)) {
                 $important_keys[] = $relation;
             }
         }
     }
     if (count($important_keys) == 0 && !$useFieldFilters) {
         $insert_object = true;
     } else {
         if (!$insert_object) {
             $rows = eZPersistentObject::fetchObjectList($def, $keys, $key_conds, array(), null, false, null, null);
             if (count($rows) == 0) {
                 /* If we only want to update some fields in a record
                  * and that records does not exist, then we should do nothing, only return.
                  */
                 if ($useFieldFilters) {
                     return;
                 }
                 $insert_object = true;
             }
//.........这里部分代码省略.........
开发者ID:mugoweb,项目名称:ezpublish-legacy,代码行数:101,代码来源:ezpersistentobject.php


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