[Slashdotjp-dev 1494] [1025] Add getJournalByDiscussion() and createJournalUrl() on plugins/ Journal/Journal.pm

Zurück zum Archiv-Index

svnno****@sourc***** svnno****@sourc*****
2009年 2月 20日 (金) 20:26:14 JST


Revision: 1025
          http://svn.sourceforge.jp/view?root=slashdotjp&view=rev&rev=1025
Author:   tach
Date:     2009-02-20 20:26:14 +0900 (Fri, 20 Feb 2009)

Log Message:
-----------
Add getJournalByDiscussion() and createJournalUrl() on plugins/Journal/Journal.pm

Modified Paths:
--------------
    slashjp/trunk/plugins/Journal/Journal.pm


-------------- next part --------------
Modified: slashjp/trunk/plugins/Journal/Journal.pm
===================================================================
--- slashjp/trunk/plugins/Journal/Journal.pm	2009-02-20 11:25:34 UTC (rev 1024)
+++ slashjp/trunk/plugins/Journal/Journal.pm	2009-02-20 11:26:14 UTC (rev 1025)
@@ -803,8 +803,26 @@
 	return $intro;
 } }
 
+sub getJournalByDiscussion {
+	my ($self, $discussion) = @_;
 
+	if (ref($discussion) eq "HASH") {
+		$discussion = $discussion->{dkid};
+	}
 
+	return $self->get($self->sqlSelect('id', 'journals', "discussion=$discussion"));
+}
+
+sub createJournalUrl {
+	my ($self, $journal) = @_;
+	my $ret = getCurrentStatic('rootdir');
+
+	$ret .= '/~';
+	$ret .= $self->getUser($journal->{uid}, 'nickname');
+	$ret .= '/journal/' . $journal->{id};
+	return $ret;
+}
+
 sub DESTROY {
 	my($self) = @_;
 	$self->{_dbh}->disconnect if !$ENV{GATEWAY_INTERFACE} && $self->{_dbh};



Slashdotjp-dev メーリングリストの案内
Zurück zum Archiv-Index