Skip to content
This repository has been archived by the owner on Jan 20, 2024. It is now read-only.

Commit

Permalink
Stores journal entry keywords in searchindexes, further built out com…
Browse files Browse the repository at this point in the history
…ponent.
  • Loading branch information
michaelchisari authored and The Appleseed Project committed Nov 29, 2010
1 parent 0060c24 commit ddfd08f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
8 changes: 8 additions & 0 deletions components/journal/controllers/entry.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,14 @@ public function Save ( ) {

$location = '/profile/' . $this->_Focus->Username . '/journal/' . $this->Model->Get ( 'Identifier' );

$id = $this->Model->Get ( 'Entry_PK' );
$context = 'journal';

// First 200 characters of the text, without formatting.
$text = substr ( strip_tags ( $this->GetSys ( 'Render' )->Format ( $Body ) ), 0, 200 );

$this->Talk ( 'Search', 'Index', array ( 'text' => $text, 'context' => $context, 'id' => $id ) );

header ( 'Location: ' . $location );
exit;
}
Expand Down
8 changes: 7 additions & 1 deletion components/journal/models/journal.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,13 @@ public function Store ( $pUserId, $pIdentifier, $pTitle, $pBody ) {

if ( !$pIdentifier ) {
$pIdentifier = $this->CreateUniqueIdentifier();
} else {
$this->Retrieve ( array ( 'Owner_FK' => $pUserId, 'Identifier' => $pIdentifier ) );
if ( $this->Get ( 'Total' ) > 0 ) {
$this->Fetch();
} else {
$this->Set ( 'Created', NOW() );
}
}

if ( !$pUserId ) return ( false );
Expand All @@ -58,7 +65,6 @@ public function Store ( $pUserId, $pIdentifier, $pTitle, $pBody ) {
$this->Set ( 'Identifier', $pIdentifier );
$this->Set ( 'Title', $pTitle );
$this->Set ( 'Body', $pBody );
$this->Set ( 'Created', NOW() );
$this->Set ( 'Updated', NOW() );

$this->Save();
Expand Down

0 comments on commit ddfd08f

Please sign in to comment.