Hello Fabrik Community
Fabrik is now in the hands of the development team that brought you Fabrik for Joomla 4. We have recently transitioned the Fabrik site over to a new server and are busy trying to clean it up. We have upgraded the site to Joomla 4 and are running the latest version of Fabrik 4. We have also upgraded the Xenforo forum software to the latest version. Many of the widgets you might have been used to on the forum are no longer operational, many abandoned by the developers. We hope to bring back some of the important ones as we have time.
Exciting times to be sure.
The Fabrik 4.0 Official release is now available. In addition, the Fabrik codebase is now available in a public repository. See the notices about these in the announcements section
We wish to shout out a very big Thank You to all of you who have made donations. They have really helped. But we can always use more...wink..wink..
Also a big Thank You to those of you who have been assisting others in the forum. This takes a very big burden off of us as we work on bugs, the website and the future of Fabrik.
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);
}
}