/**
  * Adds an object to the instance pool.
  *
  * Propel keeps cached copies of objects in an instance pool when they are retrieved
  * from the database.  In some cases -- especially when you override doSelect*()
  * methods in your stub classes -- you may need to explicitly add objects
  * to the cache in order to ensure that the same objects are always returned by doSelect*()
  * and retrieveByPK*() calls.
  *
  * @param Documentation $obj A Documentation object.
  * @param      string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
  */
 public static function addInstanceToPool($obj, $key = null)
 {
     if (Propel::isInstancePoolingEnabled()) {
         if ($key === null) {
             $key = (string) $obj->getId();
         }
         // if key === null
         DocumentationPeer::$instances[$key] = $obj;
     }
 }
 /**
  * Declares an association between this object and a Documentation object.
  *
  * @param                  Documentation $v
  * @return DocumentationPart The current object (for fluent API support)
  * @throws PropelException
  */
 public function setDocumentation(Documentation $v = null)
 {
     if ($v === null) {
         $this->setDocumentationId(NULL);
     } else {
         $this->setDocumentationId($v->getId());
     }
     $this->aDocumentation = $v;
     // Add binding for other direction of this n:n relationship.
     // If this object has already been added to the Documentation object, it will not be re-added.
     if ($v !== null) {
         $v->addDocumentationPart($this);
     }
     return $this;
 }
 public function renderDetail(Documentation $oDocumentation = null)
 {
     if (self::$DOCUMENTATION_PARTS == null) {
         self::$DOCUMENTATION_PARTS = DocumentationPartQuery::create()->filterByDocumentationId($oDocumentation->getId())->filterByIsPublished(true)->orderBySort()->find();
     }
     if ($oDocumentation) {
         $sName = $oDocumentation->getName();
         $sEmbedUrl = $oDocumentation->getYoutubeUrl();
         $sDescription = RichtextUtil::parseStorageForFrontendOutput(stream_get_contents($oDocumentation->getDescription()));
     } else {
         $sName = TranslationPeer::getString('documentations.uncategorized');
         $sEmbedUrl = null;
         $sDescription = null;
     }
     $oTemplate = $this->constructTemplate('documentation');
     // render video if exists
     if ($sEmbedUrl != null) {
         $this->embedVideo($oTemplate, $sEmbedUrl);
     }
     $oTemplate->replaceIdentifier('documentation_name', $sName);
     $oTemplate->replaceIdentifier('description', $sDescription);
     // render parts
     $oPartTmpl = $this->constructTemplate('part');
     $sLinkToSelf = LinkUtil::linkToSelf();
     $bRequiresQuicklinks = count(self::$DOCUMENTATION_PARTS) > 1;
     $oPartLinkPrototype = $this->constructTemplate('part_link');
     foreach (self::$DOCUMENTATION_PARTS as $sKey => $mPart) {
         if ($mPart === true) {
             $mPart = DocumentationPartQuery::create()->filterByKey($sKey)->findOne();
         }
         $bIsOverview = false;
         if ($mPart instanceof DocumentationPart) {
             //Internal documentation
             $sBody = RichtextUtil::parseStorageForFrontendOutput(stream_get_contents($mPart->getBody()));
             $sLinkText = $mPart->getName();
             $sTitle = $mPart->getTitle();
             $sImageUrl = null;
             if ($mPart->getDocument()) {
                 $sImageUrl = $mPart->getDocument()->getDisplayUrl();
                 if (RichtextUtil::$USE_ABSOLUTE_LINKS) {
                     $sImageUrl = LinkUtil::absoluteLink($sImageUrl);
                 }
             }
             $sKey = $mPart->getKey();
             $bIsOverview = $mPart->getIsOverview();
             $sExternalLink = null;
         } else {
             //External documentation
             $aData = DocumentationProviderTypeModule::dataForPart($sKey, Session::language());
             $sBody = new Template($aData['content'], null, true);
             $sLinkText = $aData['title'];
             $sTitle = null;
             $sImageUrl = null;
             $sExternalLink = $aData['url'];
         }
         // Add quick links
         if ($bRequiresQuicklinks) {
             $oPartLink = clone $oPartLinkPrototype;
             $oPartLink->replaceIdentifier('href', $sLinkToSelf . '#' . $sKey);
             $oPartLink->replaceIdentifier('link_text', $sLinkText);
             if ($sTitle != null) {
                 $oPartLink->replaceIdentifier('title', $sTitle);
             }
             $oTemplate->replaceIdentifierMultiple('part_links', $oPartLink, null, Template::NO_NEW_CONTEXT);
         }
         // Add documentation part
         $oPartTemplate = clone $oPartTmpl;
         $oPartTemplate->replaceIdentifier('name', $sLinkText);
         $oPartTemplate->replaceIdentifier('anchor', $sKey);
         $oPartTemplate->replaceIdentifier('href_top', $sLinkToSelf . "#top_of_page");
         $oPartTemplate->replaceIdentifier('external_link', $sExternalLink);
         if ($sImageUrl) {
             $oPartTemplate->replaceIdentifier('image', TagWriter::quickTag('img', array('class' => !$bIsOverview ? 'image_float' : "image_fullwidth", 'src' => $sImageUrl, 'alt' => 'Bildschirmfoto von ' . $sLinkText)));
             $oPartTemplate->replaceIdentifier('margin_left_class', $bIsOverview ? '' : ' margin_left_class');
         }
         $oPartTemplate->replaceIdentifier('content', $sBody);
         $oTemplate->replaceIdentifierMultiple('part', $oPartTemplate);
     }
     return $oTemplate;
 }
 /**
  * Filter the query by a related Documentation object
  *
  * @param   Documentation|PropelObjectCollection $documentation The related object(s) to use as filter
  * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @return                 DocumentationPartQuery The current query, for fluid interface
  * @throws PropelException - if the provided filter is invalid.
  */
 public function filterByDocumentation($documentation, $comparison = null)
 {
     if ($documentation instanceof Documentation) {
         return $this->addUsingAlias(DocumentationPartPeer::DOCUMENTATION_ID, $documentation->getId(), $comparison);
     } elseif ($documentation instanceof PropelObjectCollection) {
         if (null === $comparison) {
             $comparison = Criteria::IN;
         }
         return $this->addUsingAlias(DocumentationPartPeer::DOCUMENTATION_ID, $documentation->toKeyValue('PrimaryKey', 'Id'), $comparison);
     } else {
         throw new PropelException('filterByDocumentation() only accepts arguments of type Documentation or PropelCollection');
     }
 }
 /**
  * Exclude object from result
  *
  * @param   Documentation $documentation Object to remove from the list of results
  *
  * @return DocumentationQuery The current query, for fluid interface
  */
 public function prune($documentation = null)
 {
     if ($documentation) {
         $this->addUsingAlias(DocumentationPeer::ID, $documentation->getId(), Criteria::NOT_EQUAL);
     }
     return $this;
 }