public static function newPost($iBlogId, $sUserName, $sPassword, $aPublish)
 {
     if (!self::checkLogin($sUserName, $sPassword)) {
         return self::loginError();
     }
     $oJournalEntry = new JournalEntry();
     $oJournalEntry->setJournalId($iBlogId);
     $oJournalEntry->fillFromRssAttributes($aPublish);
     $oJournalEntry->save();
     return $oJournalEntry->getId();
 }
 /**
  * Filter the query by a related JournalEntry object
  *
  * @param   JournalEntry|PropelObjectCollection $journalEntry The related object(s) to use as filter
  * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @return                 JournalEntryImageQuery The current query, for fluid interface
  * @throws PropelException - if the provided filter is invalid.
  */
 public function filterByJournalEntry($journalEntry, $comparison = null)
 {
     if ($journalEntry instanceof JournalEntry) {
         return $this->addUsingAlias(JournalEntryImagePeer::JOURNAL_ENTRY_ID, $journalEntry->getId(), $comparison);
     } elseif ($journalEntry instanceof PropelObjectCollection) {
         if (null === $comparison) {
             $comparison = Criteria::IN;
         }
         return $this->addUsingAlias(JournalEntryImagePeer::JOURNAL_ENTRY_ID, $journalEntry->toKeyValue('PrimaryKey', 'Id'), $comparison);
     } else {
         throw new PropelException('filterByJournalEntry() only accepts arguments of type JournalEntry or PropelCollection');
     }
 }
 /**
  * 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 JournalEntry $obj A JournalEntry 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
         JournalEntryPeer::$instances[$key] = $obj;
     }
 }
 /**
  * Declares an association between this object and a JournalEntry object.
  *
  * @param                  JournalEntry $v
  * @return JournalComment The current object (for fluent API support)
  * @throws PropelException
  */
 public function setJournalEntry(JournalEntry $v = null)
 {
     if ($v === null) {
         $this->setJournalEntryId(NULL);
     } else {
         $this->setJournalEntryId($v->getId());
     }
     $this->aJournalEntry = $v;
     // Add binding for other direction of this n:n relationship.
     // If this object has already been added to the JournalEntry object, it will not be re-added.
     if ($v !== null) {
         $v->addJournalComment($this);
     }
     return $this;
 }
 private function renderEntry(JournalEntry $oEntry, Template $oEntryTemplate, $bIsAjax = false)
 {
     $oCommentQuery = JournalCommentQuery::create()->excludeUnverified();
     $oEntryTemplate->replaceIdentifier('journal_title', $oEntry->getJournal()->getName());
     $oEntryTemplate->replaceIdentifier('slug', $oEntry->getSlug());
     $oEntryTemplate->replaceIdentifier('name', $oEntry->getSlug());
     $oEntryTemplate->replaceIdentifier('user_name', $oEntry->getUserRelatedByCreatedBy()->getFullName());
     $oEntryTemplate->replaceIdentifier('id', $oEntry->getId());
     $oEntryTemplate->replaceIdentifier('date', LocaleUtil::localizeDate($oEntry->getPublishAtTimestamp()));
     $oEntryTemplate->replaceIdentifier('title', $oEntry->getTitle());
     $oEntryTemplate->replaceIdentifier('comment_count', $oEntry->countJournalComments($oCommentQuery));
     // Manager in link has to be set manually for the case when it's called asynchroneously in preview
     $sDetailLink = LinkUtil::link($oEntry->getLink($this->oPage), $this->bIsPreview ? 'PreviewManager' : 'FrontendManager');
     $oEntryTemplate->replaceIdentifier('link', LinkUtil::absoluteLink($sDetailLink), null, LinkUtil::isSSL());
     $oEntryTemplate->replaceIdentifier('detail_link_title', TranslationPeer::getString('journal_entry.add_comment_title', null, null, array('title' => $oEntry->getTitle())));
     if ($oEntryTemplate->hasIdentifier('text')) {
         $oEntryTemplate->replaceIdentifier('text', RichtextUtil::parseStorageForFrontendOutput($oEntry->getText()));
     }
     if ($oEntryTemplate->hasIdentifier('text_short')) {
         $oEntryTemplate->replaceIdentifier('text_short', RichtextUtil::parseStorageForFrontendOutput($oEntry->getTextShort()));
     }
     if ($this->oEntry !== null && $this->oEntry == $oEntry) {
         $oEntryTemplate->replaceIdentifier('current_class', ' class="current"', null, Template::NO_HTML_ESCAPE);
     }
     if ($oEntryTemplate->hasIdentifier('tags')) {
         $aTagInstances = TagInstanceQuery::create()->filterByModelName('JournalEntry')->filterByTaggedItemId($oEntry->getId())->joinTag()->find();
         foreach ($aTagInstances as $i => $oTagInstance) {
             if ($i > 0) {
                 $oEntryTemplate->replaceIdentifierMultiple('tags', ', ', null, Template::NO_NEWLINE | Template::NO_NEW_CONTEXT);
             }
             $oEntryTemplate->replaceIdentifierMultiple('tags', $oTagInstance->getTag()->getReadableName(), null, Template::NO_NEW_CONTEXT | Template::NO_NEWLINE);
         }
     }
     if ($oEntryTemplate->hasIdentifier('journal_comments')) {
         $oEntryTemplate->replaceIdentifier('journal_comments', $this->renderComments($oEntry->getJournalComments($oCommentQuery), $oEntry, $oEntry === $this->oEntry));
     }
     if ($oEntryTemplate->hasIdentifier('journal_gallery') && $oEntry->countJournalEntryImages() > 0) {
         $oEntryTemplate->replaceIdentifier('journal_gallery', $this->renderGallery($oEntry));
     }
     if ($this->bIsPreview && !$bIsAjax) {
         $oEntryTemplate = TagWriter::quickTag('div', array('class' => 'journal_entry-container filled-container', 'data-entry-id' => $oEntry->getId(), 'data-is-not-shown' => $oEntry->isNotShown(), 'data-template' => $oEntryTemplate->getTemplateName()), $oEntryTemplate);
     }
     return $oEntryTemplate;
 }
 /**
  * Exclude object from result
  *
  * @param   JournalEntry $journalEntry Object to remove from the list of results
  *
  * @return JournalEntryQuery The current query, for fluid interface
  */
 public function prune($journalEntry = null)
 {
     if ($journalEntry) {
         $this->addUsingAlias(JournalEntryPeer::ID, $journalEntry->getId(), Criteria::NOT_EQUAL);
     }
     return $this;
 }