Skip to content

Commit

Permalink
Merge branch 'HassanKanj-master'
Browse files Browse the repository at this point in the history
  • Loading branch information
zofe committed Jan 8, 2015
2 parents 5817e77 + 64b52e6 commit d53b5a4
Show file tree
Hide file tree
Showing 22 changed files with 556 additions and 117 deletions.
2 changes: 1 addition & 1 deletion src/Zofe/Rapyd/DataEdit/DataEdit.php
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ protected function buildButtons()

/**
* just an alias for getForm()
* @param string $view
* @param string $view
* @return string the form output
*/
public function getEdit($view = '')
Expand Down
19 changes: 9 additions & 10 deletions src/Zofe/Rapyd/DataForm/DataForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ class DataForm extends Widget

public $model;
public $model_relations;
public $validator;
public $validator;

public $output = "";
public $fields = array();
public $hash = "";
Expand Down Expand Up @@ -273,8 +273,7 @@ protected function isValid()
$attributes[$field->name] = $field->label;
}
}
if (isset($this->validator))
{
if (isset($this->validator)) {
return !$this->validator->fails();
}
if (isset($rules)) {
Expand Down Expand Up @@ -591,22 +590,22 @@ public function passed(\Closure $callable)
*/
public function set($field, $value = null , $insert = true, $update = true)
{

if (is_array($field)) {
foreach( $field as $key=>$val) {
foreach ($field as $key=>$val) {
$this->set($key, $val, $insert, $update);
}
}

$this->add($field, '', 'auto');
if ($insert)
$this->field($field)->insertValue($value);

if ($update)
$this->field($field)->updateValue($value);

}

/**
* Magic method to catch all appends
*
Expand All @@ -623,9 +622,9 @@ public function __call($name, $arguments)

$classname = '\Zofe\Rapyd\DataForm\Field\\'.ucfirst($name);

if (class_exists($classname))
{
if (class_exists($classname)) {
array_push($arguments, $name);

return call_user_func_array(array($this, "add"), $arguments);
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/Zofe/Rapyd/DataForm/Field/Autocomplete.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ public function build()
$output = Form::text("auto_".$this->name, $autocomplete, array_merge($this->attributes, array('id'=>"auto_".$this->name)))."\n";
$output .= Form::hidden($this->name, $this->value, array('id'=>$this->name));
$output = '<span id="th_'.$this->name.'">'.$output.'</span>';

if ($this->remote) {
$script = <<<acp
Expand Down Expand Up @@ -221,7 +221,7 @@ function (e,data) {

default:;
}

$this->output = "\n".$output."\n". $this->extra_output."\n";
}

Expand Down
3 changes: 1 addition & 2 deletions src/Zofe/Rapyd/DataForm/Field/Checkbox.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ class Checkbox extends Field
public function getValue()
{
parent::getValue();
if (\Request::isMethod('post') && !\Input::exists($this->name))
{
if (\Request::isMethod('post') && !\Input::exists($this->name)) {
$this->value = $this->unchecked_value;
}
$this->checked = (bool) ($this->value == $this->checked_value);
Expand Down
7 changes: 4 additions & 3 deletions src/Zofe/Rapyd/DataForm/Field/Field.php
Original file line number Diff line number Diff line change
Expand Up @@ -451,9 +451,9 @@ public function autoUpdate($save = false)
|| $this->model->hasSetMutator($this->db_name))
|| is_a($this->relation, 'Illuminate\Database\Eloquent\Relations\HasOne')
) {

$self = $this; //fix old 5.3 you can't pass this in a closure
$this->model->saved(function () use($self) {
$this->model->saved(function () use ($self) {
$self->updateRelations();
});

Expand Down Expand Up @@ -595,9 +595,10 @@ public function has_error($error='class="has-error"')
if ($this->has_error) {
return $error;
}

return '';
}

public function all()
{
$output = "<label for=\"{$this->name}\" class=\"{$this->req}\">{$this->label}</label>";
Expand Down
52 changes: 26 additions & 26 deletions src/Zofe/Rapyd/DataForm/Field/Map.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,43 +86,43 @@ public function build()

// <script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script>
<script>
function initialize()
{
function initialize()
{
var $latitude = document.getElementById('latitude');
var $longitude = document.getElementById('longitude');
var latitude = 50.715591133433854
var longitude = -3.53485107421875;
var zoom = 7;
var longitude = -3.53485107421875;
var zoom = 7;

var LatLng = new google.maps.LatLng(latitude, longitude);
var LatLng = new google.maps.LatLng(latitude, longitude);

var mapOptions = {
var mapOptions = {
zoom: zoom,
center: LatLng,
panControl: false,
zoomControl: false,
scaleControl: true,
mapTypeId: google.maps.MapTypeId.ROADMAP
}

var map = new google.maps.Map(document.getElementById('map'),mapOptions);

var marker = new google.maps.Marker({
position: LatLng,
map: map,
title: 'Drag Me!',
draggable: true
});

google.maps.event.addListener(marker, 'dragend', function (marker) {
center: LatLng,
panControl: false,
zoomControl: false,
scaleControl: true,
mapTypeId: google.maps.MapTypeId.ROADMAP
}

var map = new google.maps.Map(document.getElementById('map'),mapOptions);

var marker = new google.maps.Marker({
position: LatLng,
map: map,
title: 'Drag Me!',
draggable: true
});

google.maps.event.addListener(marker, 'dragend', function (marker) {
var latLng = marker.latLng;
$latitude.value = latLng.lat();
$longitude.value = latLng.lng();
});

}
initialize();
</script>
}
initialize();
</script>


break;
Expand Down
4 changes: 2 additions & 2 deletions src/Zofe/Rapyd/DataForm/Field/Password.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ public function build()
case "disabled":
case "show":

if ($this->type =='hidden' || $this->value == "") {
if ($this->type =='hidden' || $this->value == "") {
$output = "";
} elseif ( (!isset($this->value)) ) {
} elseif ( (!isset($this->value)) ) {
$output = $this->layout['null_label'];
} else {
$output = "********";
Expand Down
4 changes: 2 additions & 2 deletions src/Zofe/Rapyd/DataForm/Field/Redactor.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ public function build()
case "disabled":
case "show":

if ($this->type =='hidden' || $this->value == "") {
if ($this->type =='hidden' || $this->value == "") {
$output = "";
} elseif ( (!isset($this->value)) ) {
} elseif ( (!isset($this->value)) ) {
$output = $this->layout['null_label'];
} else {
$output = nl2br(htmlspecialchars($this->value));
Expand Down
4 changes: 2 additions & 2 deletions src/Zofe/Rapyd/DataForm/Field/Text.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ public function build()
case "disabled":
case "show":

if ($this->type =='hidden' || $this->value == "") {
if ($this->type =='hidden' || $this->value == "") {
$output = "";
} elseif ( (!isset($this->value)) ) {
} elseif ( (!isset($this->value)) ) {
$output = $this->layout['null_label'];
} else {
$output = nl2br(htmlspecialchars($this->value));
Expand Down
4 changes: 2 additions & 2 deletions src/Zofe/Rapyd/DataForm/Field/Textarea.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ public function build()
case "disabled":
case "show":

if ($this->type =='hidden' || $this->value == "") {
if ($this->type =='hidden' || $this->value == "") {
$output = "";
} elseif ( (!isset($this->value)) ) {
} elseif ( (!isset($this->value)) ) {
$output = $this->layout['null_label'];
} else {
$output = nl2br(htmlspecialchars($this->value));
Expand Down
7 changes: 3 additions & 4 deletions src/Zofe/Rapyd/DataSet.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

class DataSet extends Widget
{

public $cid;
public $source;

Expand All @@ -18,10 +17,10 @@ class DataSet extends Widget
* @var \Illuminate\Database\Query\Builder
*/
public $query;
public $url ;
public $data = array();
public $hash = '';
public $url;
public $key = 'id';
public $key = 'id';

/**
* @var \Illuminate\Pagination\Paginator
Expand All @@ -43,7 +42,7 @@ class DataSet extends Widget
*/
public static function source($source)
{
$ins = new static();
$ins = new static();
$ins->source = $source;

//inherit cid from datafilter
Expand Down
Loading

0 comments on commit d53b5a4

Please sign in to comment.