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(); }
/** * Resets all references to other model objects or collections of model objects. * * This method is a user-space workaround for PHP's inability to garbage collect * objects with circular references (even in PHP 5.3). This is currently necessary * when using Propel in certain daemon or large-volume/high-memory operations. * * @param boolean $deep Whether to also clear the references on all referrer objects. */ public function clearAllReferences($deep = false) { if ($deep && !$this->alreadyInClearAllReferencesDeep) { $this->alreadyInClearAllReferencesDeep = true; if ($this->aJournalEntry instanceof Persistent) { $this->aJournalEntry->clearAllReferences($deep); } if ($this->aDocument instanceof Persistent) { $this->aDocument->clearAllReferences($deep); } if ($this->aUserRelatedByCreatedBy instanceof Persistent) { $this->aUserRelatedByCreatedBy->clearAllReferences($deep); } if ($this->aUserRelatedByUpdatedBy instanceof Persistent) { $this->aUserRelatedByUpdatedBy->clearAllReferences($deep); } $this->alreadyInClearAllReferencesDeep = false; } // if ($deep) $this->aJournalEntry = null; $this->aDocument = null; $this->aUserRelatedByCreatedBy = null; $this->aUserRelatedByUpdatedBy = null; }
/** * 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'); } }
$errorPage->Render(); return; } } switch ($path[2]) { case "journals": if ($path[4] == "entries.rss" || $path[4] == "entries.atom") { require "journal/detail.inc.php"; return; } else { if ($path[4] == "entries" && $path[6] == "comment") { $journal = Journal::GetByIDOrName($path[3]); if ($journal == null) { return; } $entry = JournalEntry::GetByIDOrName($path[5]); $entryUrl = System::ExpandRelativePath("~/community/members/" . $thisuser->ShortName . "/journals/" . $journal->Name . "/entries/" . $entry->Name); switch ($path[6]) { case "comment": if ($_SERVER["REQUEST_METHOD"] == "POST") { $reply_to = null; if ($_POST["reply_comment_id"] != null) { $reply_to = JournalEntryComment::GetByID($_POST["reply_comment_id"]); } $title = $_POST["comment_title"]; $content = $_POST["comment_content"]; if (!$entry->AddComment($title, $content, $reply_to)) { $page = new ErrorPage(); $page->ErrorCode = mysql_errno(); $page->ErrorDescription = mysql_error(); $page->Render();
/** * @param JournalEntry $journalEntry The journalEntry object to add. */ protected function doAddJournalEntry($journalEntry) { $this->collJournalEntrys[] = $journalEntry; $journalEntry->setJournal($this); }
<?php if ($_POST["attempt"] != null && $_POST["entry_name"] != null) { $validate_entry_name = JournalEntry::ValidateName($_POST["entry_name"]); } if ($validate_entry_name == null && $_POST["attempt"] != null && $_POST["entry_name"] != null && $_POST["entry_title"] != null) { $result = $entry->Modify($_POST["entry_name"], $_POST["entry_title"], $_POST["entry_content"]); if (!$result) { page_begin("Error"); ?> <p> <?php echo mysql_errno() . ": " . mysql_error(); ?> </p> <p style="text-align: center;"> <a href="/community/members/<?php echo $thisuser->Name; ?> /journals/<?php echo $journal->Name; ?> /entries/create.mmo">Return to Create Entry</a> </p> <?php page_end(); return; } header("Location: /community/members/" . $thisuser->ShortName . "/journals/" . $journal->Name . "/entries/" . $_POST["entry_name"]); return; }
/** * 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; } }
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; }
/** * Filter the query by a related JournalEntry object * * @param JournalEntry|PropelObjectCollection $journalEntry the related object to use as filter * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return JournalQuery 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(JournalPeer::ID, $journalEntry->getJournalId(), $comparison); } elseif ($journalEntry instanceof PropelObjectCollection) { return $this->useJournalEntryQuery()->filterByPrimaryKeys($journalEntry->getPrimaryKeys())->endUse(); } else { throw new PropelException('filterByJournalEntry() only accepts arguments of type JournalEntry or PropelCollection'); } }
/** * 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; }
public function saveData($aData) { $oJournalEntry = JournalEntryPeer::retrieveByPK($this->iJournalEntryId); if ($oJournalEntry === null) { $oJournalEntry = new JournalEntry(); $oJournalEntry->setJournalId($this->iJournalId); } $this->validate($aData); if (!Flash::noErrors()) { throw new ValidationException(); } $oJournalEntry->setJournalId($aData['journal_id']); $oJournalEntry->setTitle($aData['title']); $oJournalEntry->setIsPublished($aData['is_published']); $oJournalEntry->setPublishAt($aData['publish_at'] == null ? date('c') : $aData['publish_at']); $oRichtextUtil = new RichtextUtil(); $oRichtextUtil->setTrackReferences($oJournalEntry); $oJournalEntry->setText($oRichtextUtil->getTagParser($aData['text'])); $oJournalEntry->save(); $oResult = new StdClass(); if ($this->iJournalEntryId === null) { $oResult->inserted = true; } else { $oResult->updated = true; } $oResult->id = $this->iCategoryId = $oJournalEntry->getId(); return $oResult; }
public static function GetByAssoc($values) { $comment = new JournalEntryComment(); $comment->ID = $values["comment_id"]; $comment->ParentComment = JournalEntryComment::GetByID($values["comment_parent_id"]); $comment->Author = User::GetByID($values["author_id"]); $comment->ParentJournalEntry = JournalEntry::GetByID($values["journal_entry_id"]); $comment->Title = $values["comment_title"]; $comment->Content = $values["comment_content"]; $comment->TimestampCreated = $values["comment_timestamp_created"]; return $comment; }
$response = fopen('php://stdin', 'r'); $line = fgets($response); if (trim($line) != 'Today') { echo "Please enter the date you would like to use in the format dd/mm/yy: "; $message = fopen('php://stdin', 'r'); $line2 = fgets($message); $date = $line2; fclose($message); } else { $date = date('d/m/Y'); //php date for todays date } return $date; fclose($response); //echo $date; } function spacer() { for ($x = 0; $x < 150; $x++) { echo "-"; } echo "\n"; } } $entry = new JournalEntry(); $entry->spacer(); echo "Welcome to your personal Training Journal v1.0. I will help you log your kickass workouts at the gym in a text file for you to review later \n"; echo "You will be prompted to enter some information about your exercises, the weight you have lifted and the number of sets and reps. \n"; $entry->spacer(); $entry->getDate(); $entry->entry();