public function redirect_to($url, $flash = NULL)
 {
     if ($url instanceof ORM) {
         $url = Route::url_for($url);
     }
     if ($flash !== NULL) {
         Flash::message($flash);
     }
     $this->redirect($url);
 }
Example #2
0
 public static function model($model, array $attributes = NULL)
 {
     static::$model = $model;
     static::$model_name = $model->object_name();
     static::$model_id = $model->pk();
     $prefix = 'edit_';
     $postfix = '_' . static::$model_id;
     if (!$model->loaded()) {
         $prefix = 'new_';
         $postfix = '';
     }
     if (!isset($attributes['class'])) {
         $attributes['class'] = $prefix . static::$model_name;
     }
     if (!isset($attributes['id'])) {
         $attributes['id'] = $prefix . static::$model_name . $postfix;
     }
     if (isset($attributes['url'])) {
         $url = $attributes['url'];
     } else {
         $url = Route::url_for($model);
     }
     return Form::open($url, $attributes);
 }
Example #3
0
 public static function link_to($text, $url, array $attributes = NULL)
 {
     if ($url instanceof ORM || is_array($url)) {
         $url = Route::url_for($url, 'path');
     }
     return HTML::anchor($url, $text, $attributes);
 }