aboutsummaryrefslogtreecommitdiff
path: root/h-source/Application/Models
diff options
context:
space:
mode:
authorAntonio Gallo <tonicucoz@gmail.com>2012-07-28 10:56:06 +0000
committerAntonio Gallo <tonicucoz@gmail.com>2012-07-28 10:56:06 +0000
commit3081877cf551efbf0da8a573f80606e04b629a38 (patch)
tree6534eb89b44346eec5037e98e864a53cbacf8438 /h-source/Application/Models
parenta214e6553572eaba8bab16e4234c6b0e345a2de1 (diff)
improved the way wiki pages are linked
Diffstat (limited to 'h-source/Application/Models')
-rw-r--r--h-source/Application/Models/WikiModel.php21
1 files changed, 16 insertions, 5 deletions
diff --git a/h-source/Application/Models/WikiModel.php b/h-source/Application/Models/WikiModel.php
index dd8d5a6..7357705 100644
--- a/h-source/Application/Models/WikiModel.php
+++ b/h-source/Application/Models/WikiModel.php
@@ -223,12 +223,23 @@ class WikiModel extends Model_Map {
}
//get the model name
- public function getTheModelName($id)
+ public function getTheModelName($id, $cleaned = false)
{
$clean['id'] = (int)$id;
$this->setWhereQueryClause(array('id_wiki' => $clean['id']));
- $res = $this->getFields('title');
- $name = count($res) > 0 ? $res[0]['wiki']['title'] : '';
+ $res = $this->getFields('title,title_clean');
+ $name = '';
+ if (count($res) > 0)
+ {
+ if ($cleaned)
+ {
+ $name = $res[0]['wiki']['title_clean'];
+ }
+ else
+ {
+ $name = $res[0]['wiki']['title'];
+ }
+ }
return $name;
}
@@ -297,8 +308,8 @@ class WikiModel extends Model_Map {
public function toWikiPage($id)
{
$clean['id'] = (int)$id;
- $title = $this->getTheModelName($clean['id']);
- return "http://".DOMAIN_NAME."/wiki/page/".Lang::$current."/".encodeUrl($title);
+ $title = $this->getTheModelName($clean['id'], true);
+ return "http://".DOMAIN_NAME."/wiki/page/".Lang::$current."/".$title;
}
public function getDiffArray($oldArray, $newArray)