We have now opened a commercial services section here on the forum for registered users. If you have a Fabrik project that you wish to have someone work on for you, post it under Help Wanted. If you are an application developer and wish to earn some money helping others, post your details under Fabrik Application Developers.
Both of these are unmoderated. It will be up to both parties to work out the details and come to an agreement.
For running J!5.1 you must https://fabrikar.com/forums/index.php?wiki/update-from-github/ or include the new file manually https://fabrikar.com/forums/index.php?threads/joomla-5-1-and-fabrik-cannot-find-files-error.54473/post-285151 See also Announcements
function eventOnClick(el) {
var repeatID = el.element.get('value');
jQuery.ajax({
url: "index.php?option=com_fabrik&format=raw&task=plugin.userAjax&method=getEventAttendees&rp_id=" + repeatID,
type: "POST",
dataType: "json",
beforeSend: function (){
jQuery("#loader").show();
},
complete: function(data) {
jQuery("#loader").hide();
},
success: function(data, status) {
jQuery('#___attendee').empty(); // Clear the existing options
jQuery('#___attendee').append('<option value="0">Please select</option>' + data);
},
error: function(data, status) {
alert("Data: " + data + "\nStatus: " + status);
}
});
}
public function getEventAttendees()
{
require_once(JPATH_SITE.'/custom_scripts/jevents/helper.php');
$app = JFactory::getApplication();
$input = $app->input;
$rp_id = $input->get('rp_id', '');
if (empty($rp_id)) {
echo json_encode("no repeat ID");
exit;
}
$attendees = get_primary_attendees(["repeatID"=>$rp_id]);
$options = [];
/* Convert to an array of names keyed by attendee ID */
foreach ($attendees as $attendee) {
$options[$attendee->id] = JFactory::getUser($attendee->user_id)->name;
}
/* Sort by name */
asort($options);
/* Now convert to an option string */
$optionString = "";
foreach ($options as $id => $name) {
$optionString .= '<option value="'.$id.'">'.$name.'</option>';
}
echo json_encode($optionString);
}
hello
achartier, thank you for help.
I use code, in javascript
----------------------------
var $datavksID = $('vks___datavks_cal');
var datavks = $datavksID.value;
var result;
if (datavks === '')
{
alert ('Select date');
}
else
{
alert (datavks);
var $hallID = $('vks___hall');
var hallvks = $hallID.value;
jQuery.ajax({
url: "index.php?option=com_fabrik&format=raw&task=plugin.userAjax&method=getStartTime",
type: "POST",
async: false,
data: {"hall": hallvks, "datavks": datavks },
dataType: "json",
error: function () {
alert( "Error :(" );},
});
alert (hallks);
}
---------------------------and php at the beginning
public function getStartTimes()
{$app = JFactory::getApplication();
$input = $app->input;
$hall = $input->get('hall', '');
$datavks = $input->get('datavks', '');
echo json_encode($hall,$datavks);
exit;
}
------------------------------------------------------------
but nothing work I got only error message
var $datavksID = $('vks___datavks_cal');
var datavks = $datavksID.value;
if (datavks === '')
{alert ('Select date');}
else
{
var $hallID = $('vks___hall');
var hall = $hallID.value;
jQuery.ajax({
url: "index.php?option=com_fabrik&for=plugin.userAjax&method=getStartTimes",
type: "POST",
data: { hall: hallvks, datavks: datavks },
dataType: "json",
error: function(data, status) {
alert("Data: " + data + "\nStatus: " + status);},
success: function(data, status) {
jQuery('vks___time1').empty();
jQuery('vks___time1').append('<option value="0">Please select</option>' + data);},
});
}
var $datavksID = $('vks___datavks_cal');
var datavks = $datavksID.value;
if (datavks === '')
{alert ('Select date');}
else
{
var $hallID = $('vks___hall');
var hallvks = $hallID.value;
jQuery.ajax({
url: "index.php?option=com_fabrik&format=raw&task=plugin.userAjax&method=getStartTimes",
type: "POST",
data: {'hall':hallvks, 'datavks':datavks},
dataType: "json",
error: function(data, status) {
alert(data);},
success: function(data, status) {
jQuery('vks___time1').append('<option value="0">Please select</option> + data');},
});
}
public function getStartTimes()
{ $starttime = 8;
$endtime = 19;
$stepmin = 30;
$lower = $starttime * 3600;
$upper = $endtime * 3600;
$step = $stepmin * 60;
$times = [];
foreach (range($lower, $upper, $step) as $increment)
{
$increment = gmdate('H:i', $increment);
list($hour, $minutes) = explode(':', $increment);
$date = new DateTime($hour.':'.$minutes);
$times[] = (string) $increment;
}
$optionString = "";
/* Convert to an array of times */
foreach ( $times as $key => $value ) {
$key = $key+1;
$id = (string) $key;
$optionString .= '<option value="'.$id.'">'.$value.'</option>';
}
echo json_encode($optionString);
}
<?php
/**
* User ajax example
*
* @package Joomla
* @subpackage Fabrik
* @copyright Copyright (C) 2005-2015 fabrikar.com - All rights reserved.
* @license GNU/GPL http://www.gnu.org/copyleft/gpl.html
*/
// No direct access
defined('_JEXEC') or die('Restricted access');
/**
* Define your userAjax class
*
* @package Joomla
* @subpackage Fabrik
* @since 3.0
*/
class UserAjax
{
/**
* This is the method that is run. You should echo out the result you which to return to the browser
*
* @return void
*/
public function getStartTimes()
{
$starttime = 8;
$endtime = 19;
$stepmin = 30;
$lower = $starttime * 3600;
$upper = $endtime * 3600;
$step = $stepmin * 60;
$times = [];
foreach (range($lower, $upper, $step) as $increment)
{
$increment = gmdate('H:i', $increment);
list($hour, $minutes) = explode(':', $increment);
$date = new DateTime($hour . ':' . $minutes);
$times[] = (string) $increment;
}
$optionString = "";
/* Convert to an array of times */
foreach ($times as $key => $value)
{
$key = $key + 1;
$id = (string) $key;
$optionString .= '<option value="' . $id . '">' . $value . '</option>';
}
echo json_encode($optionString);
}
}