Skip to content

Commit

Permalink
Update module
Browse files Browse the repository at this point in the history
  • Loading branch information
voltan committed Apr 11, 2015
1 parent d4ab3f4 commit be661a0
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
3 changes: 2 additions & 1 deletion src/Api/Question.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,15 @@ public function canonizeQuestion($question)
// Set tags
if (!empty($question['tag'])) {
$tags = Json::decode($question['tag']);
$tags = array_unique($tags);
foreach ($tags as $tag) {
$tagList[] = array(
'term' => $tag,
'url' => Pi::url(Pi::service('url')->assemble('ask', array(
'module' => $this->getModule(),
'controller' => 'tag',
'action' => 'term',
'slug' => urlencode($tag),
'slug' => $tag,
))),
);
}
Expand Down
6 changes: 4 additions & 2 deletions src/Controller/Front/IndexController.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,9 @@ public function askList($where)
public function askPaginator($template, $where)
{
$template['module'] = $this->params('module');
$template['order'] = $this->params('order');
//$template['order'] = $this->params('order');
$template['page'] = $this->params('page', 1);
$template['slug'] = $this->params('slug');
// get count
$columns = array('count' => new Expression('count(*)'));
$select = $this->getModel('question')->select()->where($where)->columns($columns);
Expand All @@ -84,7 +85,8 @@ public function askPaginator($template, $where)
'module' => $this->getModule(),
'controller' => $template['controller'],
'action' => $template['action'],
'order' => $template['order'],
//'order' => $template['order'],
'slug' => urlencode($template['slug']),
)),
));
return $paginator;
Expand Down
4 changes: 2 additions & 2 deletions src/Controller/Front/TagController.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function termAction()
// Check slug
if (!isset($slug) || empty($slug)) {
$url = array('', 'module' => $module, 'controller' => 'index', 'action' => 'index');
$this->jump($url, __('The tag not set.'), 'error');
//$this->jump($url, __('The tag not set.'), 'error');
}
// Get id from tag module
$tagId = array();
Expand All @@ -44,7 +44,7 @@ public function termAction()
// Check slug
if (empty($tagId)) {
$url = array('', 'module' => $module, 'controller' => 'index', 'action' => 'index');
$this->jump($url, __('The tag not found.'), 'error');
//$this->jump($url, __('The tag not found.'), 'error');
}
// Set question info
$where = array('status' => 1, 'type' => 'Q', 'id' => $tagId);
Expand Down
2 changes: 1 addition & 1 deletion src/Route/Ask.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public function assemble(
$url['action'] = $mergedParams['action'];
}
if (!empty($mergedParams['slug'])) {
$url['slug'] = $mergedParams['slug'];
$url['slug'] = urlencode($mergedParams['slug']);
}
if (!empty($mergedParams['order'])) {
$url['order'] = 'order' . $this->paramDelimiter . $mergedParams['order'];
Expand Down

0 comments on commit be661a0

Please sign in to comment.