Skip to content

Commit

Permalink
Update json
Browse files Browse the repository at this point in the history
  • Loading branch information
voltan committed Nov 20, 2014
1 parent b9039af commit 7af2ed4
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 15 deletions.
4 changes: 2 additions & 2 deletions src/Controller/Front/IndexController.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public function storyJsonList($where)
{
// Set info
$story = array();
$limit = 10;
$limit = 150;
$page = $this->params('page', 1);
$module = $this->params('module');
$offset = (int)($page - 1) * $limit;
Expand All @@ -120,7 +120,7 @@ public function storyJsonList($where)
$select = $this->getModel('story')->select()->where($where)->order($order);
$rowset = $this->getModel('story')->selectWith($select);
foreach ($rowset as $row) {
$story[$row->id] = Pi::api('story', 'news')->canonizeStoryJson($row);
$story[] = Pi::api('story', 'news')->canonizeStoryJson($row);
}
// return story
return $story;
Expand Down
4 changes: 2 additions & 2 deletions src/Controller/Front/JsonController.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public function storySingleAction()
} else {
$storySingle = $story;
// Attached
if ($config['show_attach'] && $story['attach']) {
/* if ($config['show_attach'] && $story['attach']) {
$attach = Pi::api('story', 'news')->AttachList($story['id']);
$storySingle['attachList'] = $attach;
} else {
Expand All @@ -154,7 +154,7 @@ public function storySingleAction()
$storySingle['extraList'] = $extra;
} else {
$storySingle['extraList'] = array();
}
} */
}
// Set view
$this->view()->setTemplate(false)->setLayout('layout-content');
Expand Down
21 changes: 11 additions & 10 deletions src/Route/News.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,39 +138,40 @@ public function assemble(
if (!empty($mergedParams['module'])) {
$url['module'] = $mergedParams['module'];
}

if (!empty($mergedParams['controller']) && $mergedParams['controller'] != 'index') {
$url['controller'] = $mergedParams['controller'];
}

if (!empty($mergedParams['action']) && $mergedParams['action'] != 'index') {
$url['action'] = $mergedParams['action'];
}

if (!empty($mergedParams['year'])) {
$url['year'] = $mergedParams['year'];
}

if (!empty($mergedParams['month'])) {
$url['month'] = $mergedParams['month'];
}

if (!empty($mergedParams['slug'])) {
$url['slug'] = $mergedParams['slug'];
}
if (!empty($mergedParams['id'])) {

if (!empty($mergedParams['id']) && $mergedParams['controller'] == 'json') {
$url['id'] = 'id' . $this->paramDelimiter . $mergedParams['id'];
} elseif(!empty($mergedParams['id'])) {
$url['id'] = $mergedParams['id'];
}

if (!empty($mergedParams['start'])) {
$url['start'] = 'start' . $this->paramDelimiter . $mergedParams['start'];
}

if (!empty($mergedParams['limit'])) {
$url['limit'] = 'limit' . $this->paramDelimiter . $mergedParams['limit'];
}
/* if (!empty($mergedParams['page'])) {
$url['page'] = 'page' . $this->paramDelimiter . $mergedParams['page'];
}
if (!empty($mergedParams['topic'])) {
$url['topic'] = 'topic' . $this->paramDelimiter . $mergedParams['topic'];
}
if (!empty($mergedParams['status'])) {
$url['status'] = 'status' . $this->paramDelimiter . $mergedParams['status'];
} */

// Make url
$url = implode($this->paramDelimiter, $url);
Expand Down
2 changes: 1 addition & 1 deletion template/admin/topic_index.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<a class="btn btn-primary" title="<?php _e('All stories'); ?>" href="<?php echo $this->url('', array('controller' => 'story', 'action' => 'index', 'topic' => $topic['id'])); ?>"><i class="fa fa-eye"></i> <?php _e('All stories'); ?></a>
<a class="btn btn-primary" title="<?php _e('Edit'); ?>" href="<?php echo $this->url('', array('action' => 'update', 'id' => $topic['id'])); ?>"><i class="fa fa-edit"></i> <?php _e('Edit'); ?></a>
<?php if($config['admin_json']) { ?>
<a class="btn btn-primary" title="<?php _e('Json'); ?>" href="<?php echo $this->url('news', array('module' => $module, 'controller' => 'json', 'id' => $this->escape($topic['id']))); ?>"><i class="fa fa-code"></i> <?php _e('Json'); ?></a>
<a class="btn btn-primary" title="<?php _e('Json'); ?>" href="<?php echo $this->url('news', array('module' => $module, 'controller' => 'json', 'action' => 'storyTopic', 'id' => $this->escape($topic['id']))); ?>"><i class="fa fa-code"></i> <?php _e('Json'); ?></a>
<?php } ?>
<!-- <a class="btn btn-danger" title="<?php _e('Delete'); ?>" href="<?php echo $this->url('', array('action' => 'delete', 'id' => $topic['id'])); ?>"><i class="fa fa-trash-o"></i> <?php _e('Delete'); ?></a> -->
</td>
Expand Down

0 comments on commit 7af2ed4

Please sign in to comment.