Permalink
Browse files

fix route changes

  • Loading branch information...
1 parent 9646d88 commit 6498b674b1e7bb0139162271308433074990380b @beezee committed Apr 7, 2012
Showing with 6 additions and 5 deletions.
  1. +2 −1 lib/baseModel.php
  2. +4 −4 lib/router.php
View
@@ -92,7 +92,8 @@ public function renderToForm($action, $instance=false)
{
foreach ($data['options'] as $value => $text)
{
- $propval = (is_object($instance->$property)) ? $instance->$property->id : $instance->$property;
+ if ($instance) $propval = (is_object($instance) and is_object($instance->$property)) ? $instance->$property->id : $instance->$property;
+ else $propval = '';
$selected = ($instance && $value == $propval) ? 'selected="selected"' : '';
$options .= $tpl->copy('option')
->replace('value', $value)
View
@@ -36,7 +36,7 @@ public function home()
public function modelAdd()
{
- $model = $this->app->model($this>get('PARAMS["model"]'), 'single');
+ $model = $this->app->model($this->get('PARAMS["model"]'), 'single');
if (!$model->scaffold()) $this->error(404);
echo $this->app->render($model->renderToForm('add'));
}
@@ -47,7 +47,7 @@ public function modelCreate()
if (!$model->scaffold()) $this->error(404);
$newModel = $model->processParams($model->create(), $_POST['params']);
$id = $model->store($newModel);
- $this->reroute($this->app->baseurl.$model->plural.'/all');
+ $this->reroute($this->app->baseurl.'all/'.$model->plural);
}
public function modelEdit()
@@ -66,7 +66,7 @@ public function modelUpdate()
if (!$model->scaffold()) $this->error(404);
$instance = $model->processParams($model->load($id), $_POST['params']);
$model->store($instance);
- $this->reroute($this->app->baseurl.$model->plural.'/all');
+ $this->reroute($this->app->baseurl.'all/'.$model->plural);
}
public function modelRemove()
@@ -75,7 +75,7 @@ public function modelRemove()
$model = $this->app->model($this->get('PARAMS["model"]'), 'single');
if (!$model->scaffold()) $this->error(404);
$model->remove($id);
- $this->reroute($this->app->baseurl.$model->plural.'/all');
+ $this->reroute($this->app->baseurl.'all/'.$model->plural);
}
public function modelView()

0 comments on commit 6498b67

Please sign in to comment.