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
Please see our announcement here.
<?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()
{ $app = JFactory::getApplication();
$input = $app->input;
$hall = $input->get('hall', '');
$vksdate = $input->get('datavks', '');
$ind = $input->get('ind', '');
switch ($hall) {
case '1':
$hall1 = 'hall1';
break;
case '2':
$hall1 = 'hall2';
break;
}
/*Time array hall works from 8 a.m.to 19 p.m.*/
$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;
}
/*Date transformation to Y-m-d format */
$vksdate1 = new DateTime($vksdate);
$vksdate_fin = $vksdate1->format('Y-m-d');
/*Count times for date and hall user choose in the database */
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('COUNT(*)');
$query->from($db->quoteName('vks'));
$query->where($db->quoteName('datavks')." = ".$db->quote($vksdate_fin).' AND '.$db->quoteName('hall')." = ".$db->quote($hall1).' AND '.$db->quoteName('status')." = ".$db->quote('ok'));
$db->setQuery($query);
$count = $db->loadResult();
/*if where is no date */
if ($count == 0)
{$optionString = '<option value="0">Choose time</option>';
/* Convert to an array of times */
foreach ($times as $key => $value)
{
$key = $key + 1;
$id = $key;
$optionString .= '<option value="' . $value . '">' . $value . '</option>';
}
echo json_encode($optionString);}
else
{$query = $db->getQuery(true);
$query->select($db->quoteName(array('start','end')))->from($db->quoteName('vks'))->where($db->quoteName('datavks')." = ".$db->quote($vksdate_fin).' AND '.$db->quoteName('hall')." = ".$db->quote($hall1).' AND '.$db->quoteName('status')." = ".$db->quote('ok'));
$db->setQuery($query);
$column= $db->loadAssocList();
$i=0;
foreach ($column as $raw)
{ $key1 = array_search($raw['start'],$times);
$key2 = array_search($raw['end'],$times);
while ($key1 <= $key2)
{
$times2[$i] = $times[$key1];
$key1++;
$i++;}
}
$result = array_unique($times2);
sort ($result,SORT_STRING);
$times1 = array_diff($times,$result);
if (!empty($times1))
{ $optionString = '<option value="0">Choose time</option>';
/* Convert to an array of times */
foreach ($times1 as $value)
{ $optionString .= '<option value="' . $value . '">' . $value . '</option>';
}}
else
{ $optionString = '<option value="0">choose other hall!</option>';}
echo json_encode($optionString);
}
}
public function getfioorg()
{
$app = JFactory::getApplication();
$input = $app->input;
$org = $input->get('org', '');
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select($db->quoteName(array('fio','phone', 'email')))
->from($db->quoteName('orgcontact'))
->where($db->quoteName('org1'));
$db->setQuery($query);
$list= $db->loadRowList();
echo json_encode($list;}
}
}
public function getfioorg()
{
$app = JFactory::getApplication();
$input = $app->input;
$org = $input->get('org', '');
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select($db->quoteName(array('fio','phone', 'email')))
->from($db->quoteName('orgcontact'))
->where($db->quoteName('org1'));
$db->setQuery($query);
$list= $db->loadRowList();
echo json_encode($list);
}