/**
  * Stores the content object state and its translations.
  *
  * Before storing a content object state, you should use
  * {@link eZContentObjectState::isValid()} to check its validness.
  *
  * @param array $fieldFilters
  */
 public function store($fieldFilters = null)
 {
     if ($fieldFilters === null) {
         $db = eZDB::instance();
         $db->begin();
         $languageMask = 1;
         // set language mask and always available bits
         foreach ($this->AllTranslations() as $translation) {
             if ($translation->hasData()) {
                 $languageID = $translation->attribute('language_id');
                 if (empty($this->DefaultLanguageID)) {
                     $this->DefaultLanguageID = $languageID & ~1;
                 }
                 // if default language, set always available flag
                 if ($languageID & $this->DefaultLanguageID) {
                     $translation->setAttribute('language_id', $languageID | 1);
                 } else {
                     if ($languageID & 1) {
                         $translation->setAttribute('language_id', $languageID & ~1);
                     }
                 }
                 $languageMask = $languageMask | $languageID;
             }
         }
         $assignToObjects = false;
         if (!isset($this->ID)) {
             $rows = $db->arrayQuery("SELECT MAX(priority) AS max_priority FROM ezcobj_state WHERE group_id=" . $this->GroupID);
             if (count($rows) > 0 && $rows[0]['max_priority'] !== null) {
                 $this->setAttribute('priority', $rows[0]['max_priority'] + 1);
             } else {
                 // this is the first state created in the state group
                 // make all content objects use this state
                 $assignToObjects = true;
             }
         }
         $this->setAttribute('language_mask', $languageMask);
         // store state
         eZPersistentObject::storeObject($this, $fieldFilters);
         // store or remove translations
         foreach ($this->AllTranslations as $translation) {
             if (!$translation->hasData()) {
                 // the name and description are empty
                 // so the translation needs to be removed if it was stored before
                 if ($translation->attribute('contentobject_state_id') !== null) {
                     $translation->remove();
                 }
             } else {
                 if ($translation->attribute('contentobject_state_id') != $this->ID) {
                     $translation->setAttribute('contentobject_state_id', $this->ID);
                 }
                 $translation->store();
             }
         }
         if ($assignToObjects) {
             $stateID = $this->ID;
             $db->query("INSERT INTO ezcobj_state_link (contentobject_id, contentobject_state_id) SELECT id, {$stateID} FROM ezcontentobject");
         }
         $db->commit();
     } else {
         parent::store($fieldFilters);
     }
 }
 /**
  * Stores the content object state group and its translations.
  *
  * Before storing a content object state group, you should use
  * {@link eZContentObjectStateGroup::isValid()} to check its validness.
  *
  * @param array $fieldFilters
  */
 public function store($fieldFilters = null)
 {
     $db = eZDB::instance();
     $db->begin();
     $languageMask = 1;
     // set language mask and always available bits
     foreach ($this->AllTranslations as $translation) {
         if ($translation->hasData()) {
             $languageID = $translation->attribute('real_language_id');
             if (empty($this->DefaultLanguageID)) {
                 $this->DefaultLanguageID = $languageID & ~1;
             }
             // if default language, set always available flag
             if ($languageID & $this->DefaultLanguageID) {
                 $translation->setAttribute('language_id', $languageID | 1);
             } else {
                 $translation->setAttribute('language_id', $languageID & ~1);
             }
             $languageMask = $languageMask | $languageID;
         }
     }
     $this->setAttribute('language_mask', $languageMask);
     // store state group
     eZPersistentObject::storeObject($this, $fieldFilters);
     // store or remove translations
     foreach ($this->AllTranslations as $translation) {
         if (!$translation->hasData()) {
             // the name and description are empty
             // so the translation needs to be removed if it was stored before
             if ($translation->attribute('contentobject_state_group_id') !== null) {
                 $translation->remove();
             }
         } else {
             if ($translation->attribute('contentobject_state_group_id') != $this->ID) {
                 $translation->setAttribute('contentobject_state_group_id', $this->ID);
             }
             $translation->store();
         }
     }
     $handler = eZExpiryHandler::instance();
     $handler->setTimestamp('state-limitations', time());
     $db->commit();
 }
 /**
  * reimplementation
  * update edtionObject modified date, so you can sort_by in admin interface
  *
  * @param unknown_type $fieldFilters
  * @return void
  */
 function store($fieldFilters = null)
 {
     $this->setEditionObjectModified();
     parent::storeObject($this, $fieldFilters);
 }
예제 #4
0
 function storeObjectAttribute($attribute)
 {
     if ($attribute->ID === null) {
         eZPersistentObject::storeObject($attribute);
     }
     $meta = $attribute->content();
     $xmlString = self::saveXML($meta);
     $attribute->setAttribute('data_text', $xmlString);
     // save keywords
     $keyword = new eZKeyword();
     $keyword->setKeywordArray($meta->keywords);
     $keyword->store($attribute);
 }
 /**
  * Stores the object in the database, uses storeObject() to do the actual
  * job and passes $fieldFilters to it.
  *
  * 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.
  *
  * @param array|null $fieldFilters
  * @return void
  */
 public function store($fieldFilters = null)
 {
     eZPersistentObject::storeObject($this, $fieldFilters);
 }
예제 #6
0
파일: log_item.php 프로젝트: nxc/responsys
 public function store($fieldFilters = null)
 {
     $this->setAttribute('backtrace', serialize($this->attribute('backtrace')));
     eZPersistentObject::storeObject($this, $fieldFilters);
     $this->setAttribute('backtrace', unserialize($this->attribute('backtrace')));
 }
 function store($fieldFilters = null)
 {
     /* New object ? */
     if (!isset($this->UUID)) {
         $this->UUID = self::UUID();
     }
     eZPersistentObject::storeObject($this, $fieldFilters);
 }
예제 #8
0
 function storeObjectAttribute($attribute)
 {
     if ($attribute->ID === null) {
         eZPersistentObject::storeObject($attribute);
     }
     $meta = $attribute->content();
     $xml = new DOMDocument("1.0", "UTF-8");
     $xmldom = $xml->createElement("MetaData");
     $node = $xml->createElement("title", htmlspecialchars($meta->title, ENT_QUOTES, 'UTF-8'));
     $xmldom->appendChild($node);
     $node = $xml->createElement("keywords", htmlspecialchars($meta->keywords, ENT_QUOTES, 'UTF-8'));
     $xmldom->appendChild($node);
     $node = $xml->createElement("description", htmlspecialchars($meta->description, ENT_QUOTES, 'UTF-8'));
     $xmldom->appendChild($node);
     $node = $xml->createElement("priority", htmlspecialchars($meta->priority, ENT_QUOTES, 'UTF-8'));
     $xmldom->appendChild($node);
     $node = $xml->createElement("change", htmlspecialchars($meta->change, ENT_QUOTES, 'UTF-8'));
     $xmldom->appendChild($node);
     $node = $xml->createElement("googlemap", htmlspecialchars($meta->googlemap, ENT_QUOTES, 'UTF-8'));
     $xmldom->appendChild($node);
     $xml->appendChild($xmldom);
     $node = $xml->createElement("urlsegment", htmlspecialchars($meta->urlsegment, ENT_QUOTES, 'UTF-8'));
     $xmldom->appendChild($node);
     $xml->appendChild($xmldom);
     $attribute->setAttribute('data_text', $xml->saveXML());
     // save keywords
     $keyword = new eZKeyword();
     $keyword->initializeKeyword($meta->keywords);
     $keyword->store($attribute);
 }