/**
  * updateMultiplyRegionData
  * @param string $strType,
  * @param string $strTypeId,
  * @param integer $intTypeVersion
  * @author Thomas Schedler <*****@*****.**>
  * @version 1.0
  */
 protected final function updateMultiplyRegionData($strType, $strTypeId, $intTypeVersion)
 {
     try {
         if (count($this->setup->MultiplyRegionIds()) > 0) {
             /**
              * start transaction
              */
             $this->core->dbh->beginTransaction();
             try {
                 /**
                  * for each multiply region, insert data
                  */
                 foreach ($this->setup->MultiplyRegionIds() as $intRegionId) {
                     $objRegion = $this->setup->getRegion($intRegionId);
                     $objGenTable = $this->getModelGenericData()->getGenericTable($strType . '-' . $this->setup->getFormId() . '-' . $this->setup->getFormVersion() . '-Region' . $objRegion->getRegionId() . '-Instances');
                     $strWhere = $objGenTable->getAdapter()->quoteInto($strType . 'Id = ?', $strTypeId);
                     $strWhere .= $objGenTable->getAdapter()->quoteInto(' AND version = ?', $intTypeVersion);
                     $strWhere .= $objGenTable->getAdapter()->quoteInto(' AND idLanguages = ?', $this->setup->getLanguageId());
                     $objGenTable->delete($strWhere);
                     if ($objRegion instanceof GenericElementRegion) {
                         $intRegionPosition = 0;
                         foreach ($objRegion->RegionInstanceIds() as $intRegionInstanceId) {
                             $intRegionPosition++;
                             $this->insertMultiplyRegionInstanceData($objRegion, $intRegionInstanceId, $intRegionPosition, $strType, $strTypeId, $intTypeVersion);
                         }
                     }
                 }
                 /**
                  * commit transaction
                  */
                 $this->core->dbh->commit();
             } catch (Exception $exc) {
                 /**
                  * roll back
                  */
                 $this->core->dbh->rollBack();
                 $this->core->logger->err($exc);
             }
         }
     } catch (Exception $exc) {
         $this->core->logger->err($exc);
     }
 }
 /**
  * updateSpecificFieldValues
  * @author Thomas Schedler <*****@*****.**>
  * @version 1.0
  */
 public function updateSpecificFieldValues()
 {
     try {
         if (count($this->setup->SpecialFields()) > 0) {
             foreach ($this->setup->SpecialFields() as $objField) {
                 $this->getSubForm(self::SUB_FROM_ID_PREFIX . $this->arrFieldSubForm[$objField->name])->getElement($objField->name)->setValue($objField->getValue());
                 if (count($objField->getProperties()) > 0) {
                     foreach ($objField->getProperties() as $strProperty => $mixedPropertyValue) {
                         if (in_array($strProperty, self::$FIELD_PROPERTIES_TO_IMPART)) {
                             $this->getSubForm(self::SUB_FROM_ID_PREFIX . $this->arrFieldSubForm[$objField->name])->getElement($objField->name)->{$strProperty} = $mixedPropertyValue;
                         }
                     }
                 }
             }
         }
         if (count($this->setup->FileFilterFields()) > 0) {
             foreach ($this->setup->FileFilterFields() as $objField) {
                 $this->getSubForm(self::SUB_FROM_ID_PREFIX . $this->arrFieldSubForm[$objField->name])->getElement($objField->name)->setValue($objField->getValue());
             }
         }
         if (count($this->setup->MultiplyRegionIds()) > 0) {
             foreach ($this->setup->MultiplyRegionIds() as $intRegionId) {
                 $objRegion = $this->setup->getRegion($intRegionId);
                 if (count($objRegion->FileFilterFieldNames()) > 0) {
                     foreach ($objRegion->FileFilterFieldNames() as $strFildeName) {
                         foreach ($objRegion->RegionInstanceIds() as $intRegionInstanceId) {
                             $this->getSubForm(self::SUB_FROM_ID_PREFIX . $this->arrFieldSubForm[$strFildeName])->getElement($strFildeName . '_' . $intRegionInstanceId)->setValue($objRegion->getField($strFildeName)->getInstanceValue($intRegionInstanceId));
                         }
                     }
                 }
             }
         }
     } catch (Exception $exc) {
         $this->core->logger->err($exc);
     }
 }
 /**
  * addToIndex
  * @param string $strIndexPath
  * @param string $strKey
  * @param PageContainer $objParentPageContainer
  * @author Thomas Schedler <*****@*****.**>
  * @version 1.0
  */
 protected final function addToIndex($strIndexPath, $strKey, $objParentPageContainer = null, $arrParentFolderIds = array())
 {
     try {
         $this->core->logger->debug('massiveart->generic->data->types->GenericDataTypeAbstract->addToIndex(' . $strIndexPath . ', ' . $strKey . ')');
         if (!is_object($this->objIndex) || !$this->objIndex instanceof Zend_Search_Lucene) {
             if (count(scandir($strIndexPath)) > 2) {
                 $this->objIndex = Zend_Search_Lucene::open($strIndexPath);
             } else {
                 $this->objIndex = Zend_Search_Lucene::create($strIndexPath);
             }
         }
         Zend_Search_Lucene_Analysis_Analyzer::setDefault(new Zend_Search_Lucene_Analysis_Analyzer_Common_Utf8Num_CaseInsensitive());
         $objDoc = new Zend_Search_Lucene_Document();
         $objDoc->addField(Zend_Search_Lucene_Field::keyword('key', $strKey));
         if ($this->setup->getLanguageFallbackId() > 0 && $this->setup->getLanguageFallbackId() != $this->setup->getLanguageId()) {
             $objDoc->addField(Zend_Search_Lucene_Field::keyword('languageId', $this->setup->getLanguageFallbackId()));
         } else {
             $objDoc->addField(Zend_Search_Lucene_Field::keyword('languageId', $this->setup->getLanguageId()));
         }
         $objDoc->addField(Zend_Search_Lucene_Field::keyword('rootLevelId', $this->setup->getRootLevelId()));
         $objDoc->addField(Zend_Search_Lucene_Field::unIndexed('date', $this->setup->getPublishDate('d.m.Y')));
         $objDoc->addField(Zend_Search_Lucene_Field::unIndexed('elementTypeId', $this->setup->getElementTypeId()));
         if ($objParentPageContainer !== null && $objParentPageContainer instanceof PageContainer) {
             if (count($objParentPageContainer->getEntries()) > 0) {
                 $objDoc->addField(Zend_Search_Lucene_Field::unIndexed('parentPages', serialize($objParentPageContainer->getEntries())));
                 $objDoc->addField(Zend_Search_Lucene_Field::keyword('rootLevelId', end($objParentPageContainer->getEntries())->rootLevelId));
             }
         }
         if (count($arrParentFolderIds) > 0) {
             $objDoc->addField(Zend_Search_Lucene_Field::unStored('parentFolderIds', implode(',', $arrParentFolderIds)));
         }
         /**
          * index fields
          */
         foreach ($this->setup->FieldNames() as $strField => $intFieldType) {
             $objField = $this->setup->getField($strField);
             if (is_object($objField) && $objField->idSearchFieldTypes != Search::FIELD_TYPE_NONE) {
                 $this->indexFieldNow($objField, $strField, $intFieldType, $objField->getValue(), $objDoc);
             }
         }
         foreach ($this->setup->MultiplyRegionIds() as $intRegionId) {
             $objRegion = $this->setup->getRegion($intRegionId);
             if ($objRegion instanceof GenericElementRegion) {
                 $intRegionPosition = 0;
                 foreach ($objRegion->RegionInstanceIds() as $intRegionInstanceId) {
                     $intRegionPosition++;
                     foreach ($objRegion->FieldNames() as $strField => $intFieldType) {
                         $objField = $objRegion->getField($strField);
                         if (is_object($objField) && $objField->idSearchFieldTypes != Search::FIELD_TYPE_NONE) {
                             $this->indexFieldNow($objField, $objField->name . '_' . $intRegionPosition, $intFieldType, $objField->getInstanceValue($intRegionInstanceId), $objDoc);
                         }
                     }
                 }
             }
         }
         // Add document to the index.
         $this->objIndex->addDocument($objDoc);
         unset($objDoc);
         $this->objIndex->optimize();
     } catch (Exception $exc) {
         $this->core->logger->err($exc);
     }
 }