|
|
@ -20,9 +20,8 @@ class ExtraField extends Model |
|
|
|
'changeable', |
|
|
|
'changeable', |
|
|
|
'filter', |
|
|
|
'filter', |
|
|
|
'extra_field_type', |
|
|
|
'extra_field_type', |
|
|
|
/* Enable this when field_loggeable is introduced as a table field (2.0) |
|
|
|
//Enable this when field_loggeable is introduced as a table field (2.0) |
|
|
|
'field_loggeable', |
|
|
|
//'field_loggeable', |
|
|
|
*/ |
|
|
|
|
|
|
|
'created_at' |
|
|
|
'created_at' |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
@ -137,7 +136,7 @@ class ExtraField extends Model |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$this->pageUrl = 'extra_fields.php?type='.$this->type; |
|
|
|
$this->pageUrl = 'extra_fields.php?type='.$this->type; |
|
|
|
// Example QuestionFields |
|
|
|
// Example QuestionFields |
|
|
|
$this->pageName = get_lang(ucwords($this->type).'Fields'); |
|
|
|
$this->pageName = get_lang(ucwords($this->type).'Fields'); |
|
|
|
} |
|
|
|
} |
|
|
@ -228,13 +227,14 @@ class ExtraField extends Model |
|
|
|
->orderBy($sidx, $sord) |
|
|
|
->orderBy($sidx, $sord) |
|
|
|
->setFirstResult($start) |
|
|
|
->setFirstResult($start) |
|
|
|
->setMaxResults($limit); |
|
|
|
->setMaxResults($limit); |
|
|
|
|
|
|
|
|
|
|
|
//echo $query->getQuery()->getSQL(); |
|
|
|
//echo $query->getQuery()->getSQL(); |
|
|
|
return $query->getQuery()->getArrayResult(); |
|
|
|
return $query->getQuery()->getArrayResult(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* @param array $conditions |
|
|
|
* @param array $conditions |
|
|
|
* @param null $order_field_options_by |
|
|
|
* @param null $order_field_options_by |
|
|
|
* |
|
|
|
* |
|
|
|
* @return array |
|
|
|
* @return array |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -759,7 +759,7 @@ class ExtraField extends Model |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* @param array $params |
|
|
|
* @param array $params |
|
|
|
* @param bool $show_query |
|
|
|
* @param bool $show_query |
|
|
|
* |
|
|
|
* |
|
|
|
* @return bool |
|
|
|
* @return bool |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -1029,7 +1029,8 @@ class ExtraField extends Model |
|
|
|
|
|
|
|
|
|
|
|
if ($optionsExists) { |
|
|
|
if ($optionsExists) { |
|
|
|
if (isset($userInfo['status']) && !empty($userInfo['status'])) { |
|
|
|
if (isset($userInfo['status']) && !empty($userInfo['status'])) { |
|
|
|
$fieldWorkFlow = $app['orm.em']->getRepository('ChamiloLMS\Entity\ExtraFieldOptionRelFieldOption') |
|
|
|
$fieldWorkFlow = $app['orm.em'] |
|
|
|
|
|
|
|
->getRepository('ChamiloLMS\Entity\ExtraFieldOptionRelFieldOption') |
|
|
|
->findBy( |
|
|
|
->findBy( |
|
|
|
array( |
|
|
|
array( |
|
|
|
'fieldId' => $field_details['id'], |
|
|
|
'fieldId' => $field_details['id'], |
|
|
@ -1075,8 +1076,8 @@ class ExtraField extends Model |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (isset($optionList[$defaultValueId])) { |
|
|
|
if (isset($optionList[$defaultValueId])) { |
|
|
|
if (isset($optionList[$defaultValueId]['option_value']) && |
|
|
|
if (isset($optionList[$defaultValueId]['option_value']) |
|
|
|
$optionList[$defaultValueId]['option_value'] == 'aprobada' |
|
|
|
&& $optionList[$defaultValueId]['option_value'] == 'aprobada' |
|
|
|
) { |
|
|
|
) { |
|
|
|
// @todo function don't exists api_is_question_manager |
|
|
|
// @todo function don't exists api_is_question_manager |
|
|
|
/*if (api_is_question_manager() == false) { |
|
|
|
/*if (api_is_question_manager() == false) { |
|
|
@ -1086,8 +1087,8 @@ class ExtraField extends Model |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Setting priority message |
|
|
|
// Setting priority message |
|
|
|
if (isset($optionList[$defaultValueId]) && |
|
|
|
if (isset($optionList[$defaultValueId]) |
|
|
|
isset($optionList[$defaultValueId]['priority']) |
|
|
|
&& isset($optionList[$defaultValueId]['priority']) |
|
|
|
) { |
|
|
|
) { |
|
|
|
if (!empty($optionList[$defaultValueId]['priority'])) { |
|
|
|
if (!empty($optionList[$defaultValueId]['priority'])) { |
|
|
|
$priorityId = $optionList[$defaultValueId]['priority']; |
|
|
|
$priorityId = $optionList[$defaultValueId]['priority']; |
|
|
@ -1289,7 +1290,9 @@ class ExtraField extends Model |
|
|
|
<div class="form-group "> |
|
|
|
<div class="form-group "> |
|
|
|
<div class="col-sm-12"> |
|
|
|
<div class="col-sm-12"> |
|
|
|
<div class="panel-separator"> |
|
|
|
<div class="panel-separator"> |
|
|
|
<h4 id="' . $field_details['variable'].'" class="form-separator">'.$field_details['display_text'].'</h4> |
|
|
|
<h4 id="'.$field_details['variable'].'" class="form-separator">' |
|
|
|
|
|
|
|
.$field_details['display_text'].' |
|
|
|
|
|
|
|
</h4> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
@ -1423,19 +1426,23 @@ class ExtraField extends Model |
|
|
|
break; |
|
|
|
break; |
|
|
|
case self::FIELD_TYPE_SOCIAL_PROFILE: |
|
|
|
case self::FIELD_TYPE_SOCIAL_PROFILE: |
|
|
|
// get the social network's favicon |
|
|
|
// get the social network's favicon |
|
|
|
$extra_data_variable = isset($extraData['extra_'.$field_details['variable']]) ? $extraData['extra_'.$field_details['variable']] : null; |
|
|
|
$extra_data_variable = isset($extraData['extra_'.$field_details['variable']]) |
|
|
|
$field_default_value = isset($field_details['field_default_value']) ? $field_details['field_default_value'] : null; |
|
|
|
? $extraData['extra_'.$field_details['variable']] |
|
|
|
|
|
|
|
: null; |
|
|
|
|
|
|
|
$field_default_value = isset($field_details['field_default_value']) |
|
|
|
|
|
|
|
? $field_details['field_default_value'] |
|
|
|
|
|
|
|
: null; |
|
|
|
$icon_path = UserManager::get_favicon_from_url( |
|
|
|
$icon_path = UserManager::get_favicon_from_url( |
|
|
|
$extra_data_variable, |
|
|
|
$extra_data_variable, |
|
|
|
$field_default_value |
|
|
|
$field_default_value |
|
|
|
); |
|
|
|
); |
|
|
|
// special hack for hi5 |
|
|
|
// special hack for hi5 |
|
|
|
$leftpad = '1.7'; |
|
|
|
$leftpad = '1.7'; |
|
|
|
$top = '0.4'; |
|
|
|
$top = '0.4'; |
|
|
|
$domain = parse_url($icon_path, PHP_URL_HOST); |
|
|
|
$domain = parse_url($icon_path, PHP_URL_HOST); |
|
|
|
if ($domain == 'www.hi5.com' or $domain == 'hi5.com') { |
|
|
|
if ($domain == 'www.hi5.com' or $domain == 'hi5.com') { |
|
|
|
$leftpad = '3'; |
|
|
|
$leftpad = '3'; |
|
|
|
$top = '0'; |
|
|
|
$top = '0'; |
|
|
|
} |
|
|
|
} |
|
|
|
// print the input field |
|
|
|
// print the input field |
|
|
|
$form->addElement( |
|
|
|
$form->addElement( |
|
|
@ -1443,8 +1450,16 @@ class ExtraField extends Model |
|
|
|
'extra_'.$field_details['variable'], |
|
|
|
'extra_'.$field_details['variable'], |
|
|
|
$field_details['display_text'], |
|
|
|
$field_details['display_text'], |
|
|
|
array( |
|
|
|
array( |
|
|
|
'size' => 60, |
|
|
|
'size' => 60, |
|
|
|
'style' => 'background-image: url(\''.$icon_path.'\'); background-repeat: no-repeat; background-position: 0.4em '.$top.'em; padding-left: '.$leftpad.'em; ' |
|
|
|
'size' => implode( |
|
|
|
|
|
|
|
'; ', |
|
|
|
|
|
|
|
[ |
|
|
|
|
|
|
|
"background-image: url('$icon_path')", |
|
|
|
|
|
|
|
'background-repeat: no-repeat', |
|
|
|
|
|
|
|
"background-position: 0.4em {$top}em", |
|
|
|
|
|
|
|
"padding-left: {$leftpad}em" |
|
|
|
|
|
|
|
] |
|
|
|
|
|
|
|
) |
|
|
|
) |
|
|
|
) |
|
|
|
); |
|
|
|
); |
|
|
|
$form->applyFilter('extra_'.$field_details['variable'], 'stripslashes'); |
|
|
|
$form->applyFilter('extra_'.$field_details['variable'], 'stripslashes'); |
|
|
@ -1551,8 +1566,8 @@ class ExtraField extends Model |
|
|
|
$field_details['display_text'] |
|
|
|
$field_details['display_text'] |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
if (is_array($extraData) && |
|
|
|
if (is_array($extraData) |
|
|
|
array_key_exists($fieldVariable, $extraData) |
|
|
|
&& array_key_exists($fieldVariable, $extraData) |
|
|
|
) { |
|
|
|
) { |
|
|
|
if (file_exists(api_get_path(SYS_UPLOAD_PATH).$extraData[$fieldVariable])) { |
|
|
|
if (file_exists(api_get_path(SYS_UPLOAD_PATH).$extraData[$fieldVariable])) { |
|
|
|
$fieldTexts[] = Display::url( |
|
|
|
$fieldTexts[] = Display::url( |
|
|
@ -1655,47 +1670,52 @@ class ExtraField extends Model |
|
|
|
$form->freeze('extra_'.$field_details['variable']); |
|
|
|
$form->freeze('extra_'.$field_details['variable']); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$form->addHtml( |
|
|
|
$form->addHtml(" |
|
|
|
'<script> |
|
|
|
<script> |
|
|
|
$(document).ready(function() { |
|
|
|
$(document).ready(function() { |
|
|
|
if (typeof google === "object") { |
|
|
|
if (typeof google === 'object') { |
|
|
|
var address = "' . $dataValue.'"; |
|
|
|
var address = '$dataValue'; |
|
|
|
initializeGeo'.$field_details['variable'].'(address, false); |
|
|
|
initializeGeo{$field_details['variable']}(address, false); |
|
|
|
|
|
|
|
|
|
|
|
$("#geolocalization_extra_'.$field_details['variable'].'").on("click", function() { |
|
|
|
$('#geolocalization_extra_{$field_details['variable']}').on('click', function() { |
|
|
|
var address = $("#extra_'.$field_details['variable'].'").val(); |
|
|
|
var address = $('#extra_{$field_details['variable']}').val(); |
|
|
|
initializeGeo'.$field_details['variable'].'(address, false); |
|
|
|
initializeGeo{$field_details['variable']}(address, false); |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
$("#myLocation_extra_'.$field_details['variable'].'").on("click", function() { |
|
|
|
$('#myLocation_extra_{$field_details['variable']}').on('click', function() { |
|
|
|
myLocation'.$field_details['variable'].'(); |
|
|
|
myLocation{$field_details['variable']}(); |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
$("#extra_'.$field_details['variable'].'").keypress(function (event) { |
|
|
|
$('#extra_{$field_details['variable']}').keypress(function(event) { |
|
|
|
if (event.which == 13) { |
|
|
|
if (event.which == 13) { |
|
|
|
$("#geolocalization_extra_'.$field_details['variable'].'").click(); |
|
|
|
$('#geolocalization_extra_{$field_details['variable']}').click(); |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
return; |
|
|
|
$("#map_extra_'.$field_details['variable'].'").html("<div class=\"alert alert-info\">'.get_lang('YouNeedToActivateTheGoogleMapsPluginInAdminPlatformToSeeTheMap').'</div>"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$('#map_extra_{$field_details['variable']}') |
|
|
|
|
|
|
|
.html('<div class=\"alert alert-info\">" |
|
|
|
|
|
|
|
.get_lang('YouNeedToActivateTheGoogleMapsPluginInAdminPlatformToSeeTheMap') |
|
|
|
|
|
|
|
."</div>'); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
function myLocation'.$field_details['variable'].'() { |
|
|
|
function myLocation{$field_details['variable']}() { |
|
|
|
if (navigator.geolocation) { |
|
|
|
if (navigator.geolocation) { |
|
|
|
var geoPosition = function(position) { |
|
|
|
var geoPosition = function(position) { |
|
|
|
var lat = position.coords.latitude; |
|
|
|
var lat = position.coords.latitude; |
|
|
|
var lng = position.coords.longitude; |
|
|
|
var lng = position.coords.longitude; |
|
|
|
var latLng = new google.maps.LatLng(lat, lng); |
|
|
|
var latLng = new google.maps.LatLng(lat, lng); |
|
|
|
initializeGeo'.$field_details['variable'].'(false, latLng) |
|
|
|
initializeGeo{$field_details['variable']}(false, latLng) |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
var geoError = function(error) { |
|
|
|
var geoError = function(error) { |
|
|
|
alert("Geocode ' . get_lang('Error').': " + error); |
|
|
|
console.log(error); |
|
|
|
|
|
|
|
alert('Geocode ".get_lang('Error').": ' + error); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
var geoOptions = { |
|
|
|
var geoOptions = { |
|
|
@ -1706,7 +1726,7 @@ class ExtraField extends Model |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function initializeGeo'.$field_details['variable'].'(address, latLng) { |
|
|
|
function initializeGeo{$field_details['variable']}(address, latLng) { |
|
|
|
var geocoder = new google.maps.Geocoder(); |
|
|
|
var geocoder = new google.maps.Geocoder(); |
|
|
|
var latlng = new google.maps.LatLng(-34.397, 150.644); |
|
|
|
var latlng = new google.maps.LatLng(-34.397, 150.644); |
|
|
|
var myOptions = { |
|
|
|
var myOptions = { |
|
|
@ -1720,49 +1740,62 @@ class ExtraField extends Model |
|
|
|
mapTypeId: google.maps.MapTypeId.ROADMAP |
|
|
|
mapTypeId: google.maps.MapTypeId.ROADMAP |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
map_'.$field_details['variable'].' = new google.maps.Map(document.getElementById("map_extra_'.$field_details['variable'].'"), myOptions); |
|
|
|
map_{$field_details['variable']} = new google.maps.Map( |
|
|
|
|
|
|
|
document.getElementById('map_extra_{$field_details['variable']}'), |
|
|
|
|
|
|
|
myOptions |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
var parameter = address ? { "address": address } : latLng ? { "latLng": latLng } : false; |
|
|
|
var parameter = address ? {'address': address} : latLng ? {'latLng': latLng} : false; |
|
|
|
|
|
|
|
|
|
|
|
if (geocoder && parameter) { |
|
|
|
if (geocoder && parameter) { |
|
|
|
geocoder.geocode(parameter, function(results, status) { |
|
|
|
geocoder.geocode(parameter, function(results, status) { |
|
|
|
if (status == google.maps.GeocoderStatus.OK) { |
|
|
|
if (status == google.maps.GeocoderStatus.OK) { |
|
|
|
if (status != google.maps.GeocoderStatus.ZERO_RESULTS) { |
|
|
|
if (status != google.maps.GeocoderStatus.ZERO_RESULTS) { |
|
|
|
map_'.$field_details['variable'].'.setCenter(results[0].geometry.location); |
|
|
|
map_{$field_details['variable']}.setCenter(results[0].geometry.location); |
|
|
|
if (!address) { |
|
|
|
if (!address) { |
|
|
|
$("#extra_'.$field_details['variable'].'").val(results[0].formatted_address); |
|
|
|
$('#extra_{$field_details['variable']}').val(results[0].formatted_address); |
|
|
|
} |
|
|
|
} |
|
|
|
var infowindow = new google.maps.InfoWindow({ |
|
|
|
var infowindow = new google.maps.InfoWindow({ |
|
|
|
content: "<b>" + $("#extra_'.$field_details['variable'].'").val() + "</b>", |
|
|
|
content: '<b>' + $('#extra_{$field_details['variable']}').val() + '</b>', |
|
|
|
size: new google.maps.Size(150, 50) |
|
|
|
size: new google.maps.Size(150, 50) |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
var marker = new google.maps.Marker({ |
|
|
|
var marker = new google.maps.Marker({ |
|
|
|
position: results[0].geometry.location, |
|
|
|
position: results[0].geometry.location, |
|
|
|
map: map_'.$field_details['variable'].', |
|
|
|
map: map_{$field_details['variable']}, |
|
|
|
title: $("#extra_'.$field_details['variable'].'").val() |
|
|
|
title: $('#extra_{$field_details['variable']}').val() |
|
|
|
}); |
|
|
|
}); |
|
|
|
google.maps.event.addListener(marker, "click", function() { |
|
|
|
google.maps.event.addListener(marker, 'click', function() { |
|
|
|
infowindow.open(map_'.$field_details['variable'].', marker); |
|
|
|
infowindow.open(map_{$field_details['variable']}, marker); |
|
|
|
}); |
|
|
|
}); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
alert("' . get_lang("NotFound").'"); |
|
|
|
alert('".get_lang('NotFound')."'); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
alert("Geocode ' . get_lang('Error').': '.get_lang("AddressField").' '.get_lang("NotFound").'"); |
|
|
|
alert('Geocode ".get_lang('Error').": ".get_lang("AddressField") |
|
|
|
|
|
|
|
." ".get_lang('NotFound')."'); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
</script> |
|
|
|
</script> |
|
|
|
'); |
|
|
|
"); |
|
|
|
$form->addHtml(' |
|
|
|
$form->addHtml(' |
|
|
|
<div class="form-group"> |
|
|
|
<div class="form-group"> |
|
|
|
<label for="geolocalization_extra_'.$field_details['variable'].'" class="col-sm-2 control-label"></label> |
|
|
|
<label for="geolocalization_extra_'.$field_details['variable'].'" |
|
|
|
|
|
|
|
class="col-sm-2 control-label"></label> |
|
|
|
<div class="col-sm-8"> |
|
|
|
<div class="col-sm-8"> |
|
|
|
<button class="null btn btn-default " id="geolocalization_extra_'.$field_details['variable'].'" name="geolocalization_extra_'.$field_details['variable'].'" type="submit"><em class="fa fa-map-marker"></em> '.get_lang('Geolocalization').'</button> |
|
|
|
<button class="null btn btn-default " |
|
|
|
<button class="null btn btn-default " id="myLocation_extra_'.$field_details['variable'].'" name="myLocation_extra_'.$field_details['variable'].'" type="submit"><em class="fa fa-crosshairs"></em> '.get_lang('MyLocation').'</button> |
|
|
|
id="geolocalization_extra_'.$field_details['variable'].'" |
|
|
|
|
|
|
|
name="geolocalization_extra_'.$field_details['variable'].'" |
|
|
|
|
|
|
|
type="submit"> |
|
|
|
|
|
|
|
<em class="fa fa-map-marker"></em> '.get_lang('Geolocalization').' |
|
|
|
|
|
|
|
</button> |
|
|
|
|
|
|
|
<button class="null btn btn-default " id="myLocation_extra_'.$field_details['variable'].'" |
|
|
|
|
|
|
|
name="myLocation_extra_'.$field_details['variable'].'" |
|
|
|
|
|
|
|
type="submit"> |
|
|
|
|
|
|
|
<em class="fa fa-crosshairs"></em> '.get_lang('MyLocation').' |
|
|
|
|
|
|
|
</button> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
'); |
|
|
|
'); |
|
|
@ -1773,7 +1806,8 @@ class ExtraField extends Model |
|
|
|
'.$field_details['display_text'].' - '.get_lang('Map').' |
|
|
|
'.$field_details['display_text'].' - '.get_lang('Map').' |
|
|
|
</label> |
|
|
|
</label> |
|
|
|
<div class="col-sm-8"> |
|
|
|
<div class="col-sm-8"> |
|
|
|
<div name="map_extra_'.$field_details['variable'].'" id="map_extra_'.$field_details['variable'].'" style="width:100%; height:300px;"> |
|
|
|
<div name="map_extra_'.$field_details['variable'].'" |
|
|
|
|
|
|
|
id="map_extra_'.$field_details['variable'].'" style="width:100%; height:300px;"> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
@ -1805,53 +1839,57 @@ class ExtraField extends Model |
|
|
|
$lng = $latLag[1]; |
|
|
|
$lng = $latLag[1]; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$form->addHtml( |
|
|
|
$form->addHtml(" |
|
|
|
'<script> |
|
|
|
<script> |
|
|
|
$(document).ready(function() { |
|
|
|
$(document).ready(function() { |
|
|
|
if (typeof google === "object") { |
|
|
|
if (typeof google === 'object') { |
|
|
|
|
|
|
|
var lat = '$lat'; |
|
|
|
var lat = "' . $lat.'"; |
|
|
|
var lng = '$lng'; |
|
|
|
var lng = "' . $lng.'"; |
|
|
|
|
|
|
|
var latLng = new google.maps.LatLng(lat, lng); |
|
|
|
var latLng = new google.maps.LatLng(lat, lng); |
|
|
|
initializeGeo'.$field_details['variable'].'(false, latLng); |
|
|
|
initializeGeo{$field_details['variable']}(false, latLng); |
|
|
|
|
|
|
|
|
|
|
|
$("#geolocalization_extra_'.$field_details['variable'].'").on("click", function() { |
|
|
|
$('#geolocalization_extra_{$field_details['variable']}').on('click', function() { |
|
|
|
var latLng = $("#extra_'.$field_details['variable'].'").val().split(","); |
|
|
|
var latLng = $('#extra_{$field_details['variable']}').val().split(','); |
|
|
|
var lat = latLng[0]; |
|
|
|
var lat = latLng[0]; |
|
|
|
var lng = latLng[1]; |
|
|
|
var lng = latLng[1]; |
|
|
|
var latLng = new google.maps.LatLng(lat, lng); |
|
|
|
var latLng = new google.maps.LatLng(lat, lng); |
|
|
|
initializeGeo'.$field_details['variable'].'(false, latLng); |
|
|
|
initializeGeo{$field_details['variable']}(false, latLng); |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
$("#myLocation_extra_'.$field_details['variable'].'").on("click", function() { |
|
|
|
$('#myLocation_extra_{$field_details['variable']}').on('click', function() { |
|
|
|
myLocation'.$field_details['variable'].'(); |
|
|
|
myLocation{$field_details['variable']}(); |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
$("#extra_'.$field_details['variable'].'").keypress(function (event) { |
|
|
|
$('#extra_{$field_details['variable']}').keypress(function (event) { |
|
|
|
if (event.which == 13) { |
|
|
|
if (event.which == 13) { |
|
|
|
$("#geolocalization_extra_'.$field_details['variable'].'").click(); |
|
|
|
$('#geolocalization_extra_{$field_details['variable']}').click(); |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
} else { |
|
|
|
|
|
|
|
$("#map_extra_'.$field_details['variable'].'").html("<div class=\"alert alert-info\">'.get_lang('YouNeedToActivateTheGoogleMapsPluginInAdminPlatformToSeeTheMap').'</div>"); |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$('#map_extra_{$field_details['variable']}') |
|
|
|
|
|
|
|
.html('<div class=\"alert alert-info\">" |
|
|
|
|
|
|
|
.get_lang('YouNeedToActivateTheGoogleMapsPluginInAdminPlatformToSeeTheMap') |
|
|
|
|
|
|
|
."</div>'); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
function myLocation'.$field_details['variable'].'() { |
|
|
|
function myLocation{$field_details['variable']}() { |
|
|
|
if (navigator.geolocation) { |
|
|
|
if (navigator.geolocation) { |
|
|
|
var geoPosition = function(position) { |
|
|
|
var geoPosition = function(position) { |
|
|
|
var lat = position.coords.latitude; |
|
|
|
var lat = position.coords.latitude; |
|
|
|
var lng = position.coords.longitude; |
|
|
|
var lng = position.coords.longitude; |
|
|
|
var latLng = new google.maps.LatLng(lat, lng); |
|
|
|
var latLng = new google.maps.LatLng(lat, lng); |
|
|
|
initializeGeo'.$field_details['variable'].'(false, latLng) |
|
|
|
initializeGeo{$field_details['variable']}(false, latLng) |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
var geoError = function(error) { |
|
|
|
var geoError = function(error) { |
|
|
|
alert("Geocode ' . get_lang('Error').': " + error); |
|
|
|
alert('Geocode ".get_lang('Error').": ' + error); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
var geoOptions = { |
|
|
|
var geoOptions = { |
|
|
@ -1862,7 +1900,7 @@ class ExtraField extends Model |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function initializeGeo'.$field_details['variable'].'(address, latLng) { |
|
|
|
function initializeGeo{$field_details['variable']}(address, latLng) { |
|
|
|
var geocoder = new google.maps.Geocoder(); |
|
|
|
var geocoder = new google.maps.Geocoder(); |
|
|
|
var latlng = new google.maps.LatLng(-34.397, 150.644); |
|
|
|
var latlng = new google.maps.LatLng(-34.397, 150.644); |
|
|
|
var myOptions = { |
|
|
|
var myOptions = { |
|
|
@ -1876,49 +1914,63 @@ class ExtraField extends Model |
|
|
|
mapTypeId: google.maps.MapTypeId.ROADMAP |
|
|
|
mapTypeId: google.maps.MapTypeId.ROADMAP |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
map_'.$field_details['variable'].' = new google.maps.Map(document.getElementById("map_extra_'.$field_details['variable'].'"), myOptions); |
|
|
|
map_{$field_details['variable']} = new google.maps.Map( |
|
|
|
|
|
|
|
document.getElementById('map_extra_{$field_details['variable']}'), |
|
|
|
|
|
|
|
myOptions |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
var parameter = address ? { "address": address } : latLng ? { "latLng": latLng } : false; |
|
|
|
var parameter = address ? {'address': address} : latLng ? {'latLng': latLng} : false; |
|
|
|
|
|
|
|
|
|
|
|
if (geocoder && parameter) { |
|
|
|
if (geocoder && parameter) { |
|
|
|
geocoder.geocode(parameter, function(results, status) { |
|
|
|
geocoder.geocode(parameter, function(results, status) { |
|
|
|
if (status == google.maps.GeocoderStatus.OK) { |
|
|
|
if (status == google.maps.GeocoderStatus.OK) { |
|
|
|
if (status != google.maps.GeocoderStatus.ZERO_RESULTS) { |
|
|
|
if (status != google.maps.GeocoderStatus.ZERO_RESULTS) { |
|
|
|
map_'.$field_details['variable'].'.setCenter(results[0].geometry.location); |
|
|
|
map_{$field_details['variable']}.setCenter(results[0].geometry.location); |
|
|
|
|
|
|
|
|
|
|
|
$("#extra_'.$field_details['variable'].'").val(results[0].geometry.location.lat() + "," + results[0].geometry.location.lng()); |
|
|
|
$('#extra_{$field_details['variable']}') |
|
|
|
|
|
|
|
.val(results[0].geometry.location.lat() + ',' + results[0].geometry.location.lng()); |
|
|
|
|
|
|
|
|
|
|
|
var infowindow = new google.maps.InfoWindow({ |
|
|
|
var infowindow = new google.maps.InfoWindow({ |
|
|
|
content: "<b>" + $("#extra_'.$field_details['variable'].'").val() + "</b>", |
|
|
|
content: '<b>' + $('#extra_{$field_details['variable']}').val() + '</b>', |
|
|
|
size: new google.maps.Size(150, 50) |
|
|
|
size: new google.maps.Size(150, 50) |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
var marker = new google.maps.Marker({ |
|
|
|
var marker = new google.maps.Marker({ |
|
|
|
position: results[0].geometry.location, |
|
|
|
position: results[0].geometry.location, |
|
|
|
map: map_'.$field_details['variable'].', |
|
|
|
map: map_{$field_details['variable']}, |
|
|
|
title: $("#extra_'.$field_details['variable'].'").val() |
|
|
|
title: $('#extra_{$field_details['variable']}').val() |
|
|
|
}); |
|
|
|
}); |
|
|
|
google.maps.event.addListener(marker, "click", function() { |
|
|
|
google.maps.event.addListener(marker, 'click', function() { |
|
|
|
infowindow.open(map_'.$field_details['variable'].', marker); |
|
|
|
infowindow.open(map_{$field_details['variable']}, marker); |
|
|
|
}); |
|
|
|
}); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
alert("' . get_lang("NotFound").'"); |
|
|
|
alert('".get_lang("NotFound")."'); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
alert("Geocode ' . get_lang('Error').': " + status); |
|
|
|
alert('Geocode ".get_lang('Error').": ' + status); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
</script> |
|
|
|
</script> |
|
|
|
'); |
|
|
|
"); |
|
|
|
$form->addHtml(' |
|
|
|
$form->addHtml(' |
|
|
|
<div class="form-group"> |
|
|
|
<div class="form-group"> |
|
|
|
<label for="geolocalization_extra_'.$field_details['variable'].'" class="col-sm-2 control-label"></label> |
|
|
|
<label for="geolocalization_extra_'.$field_details['variable'].'" |
|
|
|
|
|
|
|
class="col-sm-2 control-label"></label> |
|
|
|
<div class="col-sm-8"> |
|
|
|
<div class="col-sm-8"> |
|
|
|
<button class="null btn btn-default " id="geolocalization_extra_'.$field_details['variable'].'" name="geolocalization_extra_'.$field_details['variable'].'" type="submit"><em class="fa fa-map-marker"></em> '.get_lang('Geolocalization').'</button> |
|
|
|
<button class="null btn btn-default " |
|
|
|
<button class="null btn btn-default " id="myLocation_extra_'.$field_details['variable'].'" name="myLocation_extra_'.$field_details['variable'].'" type="submit"><em class="fa fa-crosshairs"></em> '.get_lang('MyLocation').'</button> |
|
|
|
id="geolocalization_extra_'.$field_details['variable'].'" |
|
|
|
|
|
|
|
name="geolocalization_extra_'.$field_details['variable'].'" |
|
|
|
|
|
|
|
type="submit"> |
|
|
|
|
|
|
|
<em class="fa fa-map-marker"></em> '.get_lang('Geolocalization').' |
|
|
|
|
|
|
|
</button> |
|
|
|
|
|
|
|
<button class="null btn btn-default" |
|
|
|
|
|
|
|
id="myLocation_extra_'.$field_details['variable'].'" |
|
|
|
|
|
|
|
name="myLocation_extra_'.$field_details['variable'].'" type="submit"> |
|
|
|
|
|
|
|
<em class="fa fa-crosshairs"></em> '.get_lang('MyLocation').' |
|
|
|
|
|
|
|
</button> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
'); |
|
|
|
'); |
|
|
@ -1929,7 +1981,9 @@ class ExtraField extends Model |
|
|
|
'.$field_details['display_text'].' - '.get_lang('Map').' |
|
|
|
'.$field_details['display_text'].' - '.get_lang('Map').' |
|
|
|
</label> |
|
|
|
</label> |
|
|
|
<div class="col-sm-8"> |
|
|
|
<div class="col-sm-8"> |
|
|
|
<div name="map_extra_'.$field_details['variable'].'" id="map_extra_'.$field_details['variable'].'" style="width:100%; height:300px;"> |
|
|
|
<div name="map_extra_'.$field_details['variable'].'" |
|
|
|
|
|
|
|
id="map_extra_'.$field_details['variable'].'" |
|
|
|
|
|
|
|
style="width:100%; height:300px;"> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
@ -2043,7 +2097,7 @@ class ExtraField extends Model |
|
|
|
'align' => 'left', |
|
|
|
'align' => 'left', |
|
|
|
'sortable' => 'true', |
|
|
|
'sortable' => 'true', |
|
|
|
), |
|
|
|
), |
|
|
|
array( |
|
|
|
array( |
|
|
|
'name' => 'visible_to_others', |
|
|
|
'name' => 'visible_to_others', |
|
|
|
'index' => 'visible_to_others', |
|
|
|
'index' => 'visible_to_others', |
|
|
|
'width' => '35', |
|
|
|
'width' => '35', |
|
|
@ -2089,7 +2143,7 @@ class ExtraField extends Model |
|
|
|
$form->addElement('hidden', 'id', $id); |
|
|
|
$form->addElement('hidden', 'id', $id); |
|
|
|
|
|
|
|
|
|
|
|
// Setting the form elements |
|
|
|
// Setting the form elements |
|
|
|
$header = get_lang('Add'); |
|
|
|
$header = get_lang('Add'); |
|
|
|
$defaults = array(); |
|
|
|
$defaults = array(); |
|
|
|
|
|
|
|
|
|
|
|
if ($action == 'edit') { |
|
|
|
if ($action == 'edit') { |
|
|
@ -2101,9 +2155,8 @@ class ExtraField extends Model |
|
|
|
$form->addElement('header', $header); |
|
|
|
$form->addElement('header', $header); |
|
|
|
|
|
|
|
|
|
|
|
if ($action == 'edit') { |
|
|
|
if ($action == 'edit') { |
|
|
|
$translateUrl = api_get_path(WEB_CODE_PATH).'extrafield/translate.php?'.http_build_query([ |
|
|
|
$translateUrl = api_get_path(WEB_CODE_PATH).'extrafield/translate.php?' |
|
|
|
'extra_field' => $id |
|
|
|
.http_build_query(['extra_field' => $id]); |
|
|
|
]); |
|
|
|
|
|
|
|
$translateButton = Display::toolbarButton(get_lang('TranslateThisTerm'), $translateUrl, 'language', 'link'); |
|
|
|
$translateButton = Display::toolbarButton(get_lang('TranslateThisTerm'), $translateUrl, 'language', 'link'); |
|
|
|
|
|
|
|
|
|
|
|
$form->addText( |
|
|
|
$form->addText( |
|
|
@ -2177,12 +2230,12 @@ class ExtraField extends Model |
|
|
|
$group[] = $form->createElement('radio', 'visible_to_others', null, get_lang('No'), 0); |
|
|
|
$group[] = $form->createElement('radio', 'visible_to_others', null, get_lang('No'), 0); |
|
|
|
$form->addGroup($group, '', get_lang('VisibleToOthers'), null, false); |
|
|
|
$form->addGroup($group, '', get_lang('VisibleToOthers'), null, false); |
|
|
|
|
|
|
|
|
|
|
|
$group = array(); |
|
|
|
$group = array(); |
|
|
|
$group[] = $form->createElement('radio', 'changeable', null, get_lang('Yes'), 1); |
|
|
|
$group[] = $form->createElement('radio', 'changeable', null, get_lang('Yes'), 1); |
|
|
|
$group[] = $form->createElement('radio', 'changeable', null, get_lang('No'), 0); |
|
|
|
$group[] = $form->createElement('radio', 'changeable', null, get_lang('No'), 0); |
|
|
|
$form->addGroup($group, '', get_lang('FieldChangeability'), null, false); |
|
|
|
$form->addGroup($group, '', get_lang('FieldChangeability'), null, false); |
|
|
|
|
|
|
|
|
|
|
|
$group = array(); |
|
|
|
$group = array(); |
|
|
|
$group[] = $form->createElement('radio', 'filter', null, get_lang('Yes'), 1); |
|
|
|
$group[] = $form->createElement('radio', 'filter', null, get_lang('Yes'), 1); |
|
|
|
$group[] = $form->createElement('radio', 'filter', null, get_lang('No'), 0); |
|
|
|
$group[] = $form->createElement('radio', 'filter', null, get_lang('No'), 0); |
|
|
|
$form->addGroup($group, '', get_lang('FieldFilter'), null, false); |
|
|
|
$form->addGroup($group, '', get_lang('FieldFilter'), null, false); |
|
|
@ -2260,8 +2313,8 @@ JAVASCRIPT; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* @param array $columns |
|
|
|
* @param array $columns |
|
|
|
* @param array $column_model |
|
|
|
* @param array $column_model |
|
|
|
* @param array $extraFields |
|
|
|
* @param array $extraFields |
|
|
|
* @return array |
|
|
|
* @return array |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public function getRules(&$columns, &$column_model, $extraFields = array(), $checkExtraFieldExistence = false) |
|
|
|
public function getRules(&$columns, &$column_model, $extraFields = array(), $checkExtraFieldExistence = false) |
|
|
@ -2277,18 +2330,19 @@ JAVASCRIPT; |
|
|
|
$rules = array(); |
|
|
|
$rules = array(); |
|
|
|
if (!empty($fields)) { |
|
|
|
if (!empty($fields)) { |
|
|
|
foreach ($fields as $field) { |
|
|
|
foreach ($fields as $field) { |
|
|
|
|
|
|
|
|
|
|
|
$search_options = array(); |
|
|
|
$search_options = array(); |
|
|
|
$type = 'text'; |
|
|
|
$type = 'text'; |
|
|
|
if (in_array($field['field_type'], array(self::FIELD_TYPE_SELECT, self::FIELD_TYPE_DOUBLE_SELECT))) { |
|
|
|
if (in_array($field['field_type'], array(self::FIELD_TYPE_SELECT, self::FIELD_TYPE_DOUBLE_SELECT))) { |
|
|
|
$type = 'select'; |
|
|
|
$type = 'select'; |
|
|
|
$search_options['sopt'] = array('eq', 'ne'); //equal not equal |
|
|
|
$search_options['sopt'] = array('eq', 'ne'); //equal not equal |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
$search_options['sopt'] = array('cn', 'nc'); //contains not contains |
|
|
|
$search_options['sopt'] = array('cn', 'nc'); //contains not contains |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$search_options['searchhidden'] = 'true'; |
|
|
|
$search_options['searchhidden'] = 'true'; |
|
|
|
$search_options['defaultValue'] = isset($search_options['field_default_value']) ? $search_options['field_default_value'] : null; |
|
|
|
$search_options['defaultValue'] = isset($search_options['field_default_value']) |
|
|
|
|
|
|
|
? $search_options['field_default_value'] |
|
|
|
|
|
|
|
: null; |
|
|
|
|
|
|
|
|
|
|
|
if ($field['field_type'] == self::FIELD_TYPE_DOUBLE_SELECT) { |
|
|
|
if ($field['field_type'] == self::FIELD_TYPE_DOUBLE_SELECT) { |
|
|
|
//Add 2 selects |
|
|
|
//Add 2 selects |
|
|
@ -2300,7 +2354,8 @@ JAVASCRIPT; |
|
|
|
foreach ($options as $option) { |
|
|
|
foreach ($options as $option) { |
|
|
|
foreach ($option as $sub_option) { |
|
|
|
foreach ($option as $sub_option) { |
|
|
|
if ($sub_option['option_value'] == 0) { |
|
|
|
if ($sub_option['option_value'] == 0) { |
|
|
|
$first_options[] = $sub_option['field_id'].'#'.$sub_option['id'].':'.$sub_option['display_text']; |
|
|
|
$first_options[] = $sub_option['field_id'].'#'.$sub_option['id'].':' |
|
|
|
|
|
|
|
.$sub_option['display_text']; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -2387,7 +2442,8 @@ JAVASCRIPT; |
|
|
|
$extra_field_info = $extra_field_obj->get($extra['id']); |
|
|
|
$extra_field_info = $extra_field_obj->get($extra['id']); |
|
|
|
$extra['extra_field_info'] = $extra_field_info; |
|
|
|
$extra['extra_field_info'] = $extra_field_info; |
|
|
|
|
|
|
|
|
|
|
|
if (isset($extra_field_info['field_type']) && in_array( |
|
|
|
if (isset($extra_field_info['field_type']) |
|
|
|
|
|
|
|
&& in_array( |
|
|
|
$extra_field_info['field_type'], |
|
|
|
$extra_field_info['field_type'], |
|
|
|
array( |
|
|
|
array( |
|
|
|
self::FIELD_TYPE_SELECT, |
|
|
|
self::FIELD_TYPE_SELECT, |
|
|
@ -2442,7 +2498,8 @@ JAVASCRIPT; |
|
|
|
$inject_joins .= " INNER JOIN $this->table_field_values fv$counter |
|
|
|
$inject_joins .= " INNER JOIN $this->table_field_values fv$counter |
|
|
|
ON (s.".$this->primaryKey." = fv$counter.".$this->handler_id.") "; |
|
|
|
ON (s.".$this->primaryKey." = fv$counter.".$this->handler_id.") "; |
|
|
|
// Add options |
|
|
|
// Add options |
|
|
|
if (isset($extra_field_info['field_type']) && in_array( |
|
|
|
if (isset($extra_field_info['field_type']) |
|
|
|
|
|
|
|
&& in_array( |
|
|
|
$extra_field_info['field_type'], |
|
|
|
$extra_field_info['field_type'], |
|
|
|
array( |
|
|
|
array( |
|
|
|
self::FIELD_TYPE_SELECT, |
|
|
|
self::FIELD_TYPE_SELECT, |
|
|
@ -2463,28 +2520,31 @@ JAVASCRIPT; |
|
|
|
fv$counter.value = fvo$counter.option_value |
|
|
|
fv$counter.value = fvo$counter.option_value |
|
|
|
) |
|
|
|
) |
|
|
|
"; |
|
|
|
"; |
|
|
|
} else if (isset($extra_field_info['field_type']) && |
|
|
|
|
|
|
|
$extra_field_info['field_type'] == self::FIELD_TYPE_TAG |
|
|
|
|
|
|
|
) { |
|
|
|
|
|
|
|
$options['where'] = str_replace( |
|
|
|
|
|
|
|
$extra_info['field'], |
|
|
|
|
|
|
|
'tag'.$counter.'.tag ', |
|
|
|
|
|
|
|
$options['where'] |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$inject_joins .= " |
|
|
|
|
|
|
|
INNER JOIN $this->table_field_rel_tag tag_rel$counter |
|
|
|
|
|
|
|
ON (tag_rel$counter.field_id = ".$extra_info['id']." AND tag_rel$counter.item_id = s.".$this->primaryKey.") |
|
|
|
|
|
|
|
INNER JOIN $this->table_field_tag tag$counter |
|
|
|
|
|
|
|
ON (tag$counter.id = tag_rel$counter.tag_id) |
|
|
|
|
|
|
|
"; |
|
|
|
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
//text, textarea, etc |
|
|
|
if (isset($extra_field_info['field_type']) |
|
|
|
$options['where'] = str_replace( |
|
|
|
&& $extra_field_info['field_type'] == self::FIELD_TYPE_TAG |
|
|
|
$extra_info['field'], |
|
|
|
) { |
|
|
|
'fv'.$counter.'.field_id = '.$extra_info['id'].' AND fv'.$counter.'.value', |
|
|
|
$options['where'] = str_replace( |
|
|
|
$options['where'] |
|
|
|
$extra_info['field'], |
|
|
|
); |
|
|
|
'tag'.$counter.'.tag ', |
|
|
|
|
|
|
|
$options['where'] |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$inject_joins .= " |
|
|
|
|
|
|
|
INNER JOIN $this->table_field_rel_tag tag_rel$counter |
|
|
|
|
|
|
|
ON (tag_rel$counter.field_id = ".$extra_info['id']." AND tag_rel$counter.item_id = s." |
|
|
|
|
|
|
|
.$this->primaryKey.") |
|
|
|
|
|
|
|
INNER JOIN $this->table_field_tag tag$counter |
|
|
|
|
|
|
|
ON (tag$counter.id = tag_rel$counter.tag_id) |
|
|
|
|
|
|
|
"; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
//text, textarea, etc |
|
|
|
|
|
|
|
$options['where'] = str_replace( |
|
|
|
|
|
|
|
$extra_info['field'], |
|
|
|
|
|
|
|
'fv'.$counter.'.field_id = '.$extra_info['id'].' AND fv'.$counter.'.value', |
|
|
|
|
|
|
|
$options['where'] |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$field_value_to_join[] = " fv$counter.$this->handler_id "; |
|
|
|
$field_value_to_join[] = " fv$counter.$this->handler_id "; |
|
|
@ -2603,7 +2663,9 @@ JAVASCRIPT; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (!isset($rule->data)) { |
|
|
|
if (!isset($rule->data)) { |
|
|
|
$condition_array[] = ' ('.$this->get_where_clause($rule->field, $rule->op, $rule->data).') '; |
|
|
|
$condition_array[] = ' (' |
|
|
|
|
|
|
|
.$this->get_where_clause($rule->field, $rule->op, $rule->data) |
|
|
|
|
|
|
|
.') '; |
|
|
|
$extra_fields[] = array('field' => $rule->field, 'id' => $field_option['id']); |
|
|
|
$extra_fields[] = array('field' => $rule->field, 'id' => $field_option['id']); |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
@ -2611,7 +2673,9 @@ JAVASCRIPT; |
|
|
|
if ($rule->data == -1) { |
|
|
|
if ($rule->data == -1) { |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
$condition_array[] = ' ('.$this->get_where_clause($rule->field, $rule->op, $rule->data).') '; |
|
|
|
$condition_array[] = ' (' |
|
|
|
|
|
|
|
.$this->get_where_clause($rule->field, $rule->op, $rule->data) |
|
|
|
|
|
|
|
.') '; |
|
|
|
$extra_fields[] = array( |
|
|
|
$extra_fields[] = array( |
|
|
|
'field' => $rule->field, |
|
|
|
'field' => $rule->field, |
|
|
|
'id' => $field_option['id'], |
|
|
|
'id' => $field_option['id'], |
|
|
|