예제 #1
0
 /**
  * Create a Destroy Link
  *
  * @return string
  */
 public function getDestroyLink()
 {
     $route = $this->getPrefix() . $this->getResourceName() . '.forcedestroy';
     if (Route::has($route)) {
         return Form::open(['route' => [$route, $this->id], 'method' => 'post', 'style' => 'display: inline;']) . Form::submit('Delete', ['class' => 'btn btn-xs btn-danger']) . Form::close();
     }
 }
예제 #2
0
 public function build($view = '')
 {
     $this->initJsWidget();
     $view == '' and $view = 'rapyd::datatree';
     $this->open = Form::open($this->attributes);
     $this->close = Form::hidden('save', 1) . Form::close();
     // we save on POST and only if the widget's own input variable is filled
     // because sometimes we have more than a tree widget on the same page
     // but just one save
     if (\Request::method() == 'POST' && \Input::get($this->name)) {
         $this->lockAndSave();
     }
     $this->data = $this->source->find($this->source->getKey())->getDescendants()->toHierarchy();
     Persistence::save();
     $this->rows = $this->makeRowsRecursive($this->data);
     return \View::make($view, array('dg' => $this, 'buttons' => $this->button_container, 'label' => $this->label));
 }
예제 #3
0
 public function prepareForm()
 {
     $form_attr = array('url' => $this->process_url, 'class' => "form-horizontal", 'role' => "form", 'method' => $this->method);
     $form_attr = array_merge($form_attr, $this->attributes);
     // See if we need a multipart form
     foreach ($this->fields as $field_obj) {
         if (in_array($field_obj->type, array('file', 'image'))) {
             $form_attr['files'] = 'true';
             break;
         }
     }
     // Set the form open and close
     if ($this->status == 'show') {
         $this->open = '<div class="form">';
         $this->close = '</div>';
     } else {
         $this->open = Form::open($form_attr);
         $this->close = Form::hidden('save', 1) . Form::close();
         if ($this->method == "GET") {
             $this->close = Form::hidden('search', 1) . Form::close();
         }
     }
     if (isset($this->validator)) {
         $this->errors = $this->validator->messages();
         $this->error .= implode('<br />', $this->errors->all());
     }
 }
예제 #4
0
 /**
  * return a form with a nested action button
  * @param $url
  * @param $method
  * @param $name
  * @param  string $position
  * @param  array  $attributes
  * @return $this
  */
 public function formButton($url, $method, $name, $position = "BL", $attributes = array())
 {
     $attributes = array_merge(array("class" => "btn btn-default"), $attributes);
     $this->button_container[$position][] = Form::open(array('url' => $url, 'method' => $method)) . Form::submit($name, $attributes) . Form::close();
     return $this;
 }