|
Revision 2, 1.4 kB
(checked in by fabien, 6 years ago)
|
initial import
|
- Property svn:mime-type set to
text/x-php
- Property svn:eol-style set to
native
- Property svn:keywords set to
Id
|
| Line | |
|---|
| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
require_once 'model/om/BaseSnippetSnippet.php'; |
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
class SnippetSnippet extends BaseSnippetSnippet |
|---|
| 18 |
{ |
|---|
| 19 |
public function getTags() |
|---|
| 20 |
{ |
|---|
| 21 |
return $this->getAllTags(); |
|---|
| 22 |
} |
|---|
| 23 |
|
|---|
| 24 |
public function setTags($phrase) |
|---|
| 25 |
{ |
|---|
| 26 |
$con = Propel::getConnection(); |
|---|
| 27 |
try |
|---|
| 28 |
{ |
|---|
| 29 |
$con->begin(); |
|---|
| 30 |
|
|---|
| 31 |
|
|---|
| 32 |
$c = new Criteria(); |
|---|
| 33 |
$c->add(SnippetTagPeer::USER_ID, $this->getUserId()); |
|---|
| 34 |
$c->add(SnippetTagPeer::SNIPPET_ID, $this->getId()); |
|---|
| 35 |
SnippetTagPeer::doDelete($c); |
|---|
| 36 |
|
|---|
| 37 |
|
|---|
| 38 |
$tags = TagTools::splitPhrase($phrase); |
|---|
| 39 |
foreach($tags as $word) |
|---|
| 40 |
{ |
|---|
| 41 |
$tag = new SnippetTag(); |
|---|
| 42 |
$tag->setUserId($this->getUserId()); |
|---|
| 43 |
$tag->setSnippetSnippet($this); |
|---|
| 44 |
$tag->setName(TagTools::normalize($word)); |
|---|
| 45 |
$tag->save($con); |
|---|
| 46 |
} |
|---|
| 47 |
|
|---|
| 48 |
$con->commit(); |
|---|
| 49 |
|
|---|
| 50 |
} |
|---|
| 51 |
catch (Exception $e) |
|---|
| 52 |
{ |
|---|
| 53 |
$con->rollback(); |
|---|
| 54 |
throw $e; |
|---|
| 55 |
} |
|---|
| 56 |
} |
|---|
| 57 |
|
|---|
| 58 |
public function getItemFeedDescription() |
|---|
| 59 |
{ |
|---|
| 60 |
return $this->getHtmlBody(); |
|---|
| 61 |
} |
|---|
| 62 |
|
|---|
| 63 |
public function setBody($body) |
|---|
| 64 |
{ |
|---|
| 65 |
parent::setBody($body); |
|---|
| 66 |
|
|---|
| 67 |
$this->setHtmlBody(myToolkit::transformToHtml($body)); |
|---|
| 68 |
} |
|---|
| 69 |
} |
|---|
| 70 |
|
|---|