feat(cadline): add Cadline-own modules

11 Cadline-only modules (mod_al_*, mod_alusers, mod_alworkshops, mod_course_list, mod_webinar*, mod_wsregister). Dropped webshells excluded (mod_al_upload/b8.php, mod_course_list/a1.php); legit module bases kept.

Signed-off-by: LÁZÁR Imre <imre@illusion.hu>
Assisted-by: claude-code@claude-opus-4-8
This commit is contained in:
LÁZÁR Imre AI Agent 2026-07-16 11:34:30 +02:00
parent 65518cce6b
commit 204bde8968
145 changed files with 12554 additions and 0 deletions

View File

@ -0,0 +1,10 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<a href="http://xdsoft.net/joomla/module_generator/">Joomla Module Generator</a>
</body>
</html>

View File

@ -0,0 +1,10 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<a href="http://xdsoft.net/joomla/module_generator/">Joomla Module Generator</a>
</body>
</html>

View File

@ -0,0 +1,10 @@
.past { background-color:#e6a8a8; opacity: 0.7; }
.present { background-color:#ffffff; border:2px solid #155215; }
.future { background-color:#71bf73; opacity: 0.9; }
.mb25 { margin-bottom:25px; }
.cimke { font-size: 90% !important;font-weight:bold !important; }
#alapplicationsContainer .controlls {margin-top:15px;}
#alapplicationsContainer a, #alapplicationsContainer a:hover {font-weight:bold;}
#alapplicationsContainer .past a, #alapplicationsContainer .future a {color:#003060;}
#alapplicationsContainer .past a:hover, #alapplicationsContainer .future a:hover {color:#ffffff;}

View File

@ -0,0 +1,10 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<a href="http://xdsoft.net/joomla/module_generator/">Joomla Module Generator</a>
</body>
</html>

View File

@ -0,0 +1,10 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<a href="http://xdsoft.net/joomla/module_generator/">Joomla Module Generator</a>
</body>
</html>

View File

@ -0,0 +1,127 @@
<?php
defined('_JEXEC') or die;
class ModAlapplicationsHelper
{
public static function getOtherApplications()
{
$db = JFactory::getDbo();
$db->setQuery("SELECT a.*,c.title,c.`price`,c.`min_attend`,c.`capacity`,c.`location`,c.`start_date`,c.`finish_date`,c.`start_time`,c.`finish_time`,s.`path` AS `path`,s.`alias` AS `alias`,s.`gepet_kerek` AS `s_gepet_kerek`,s.`berletem_van` AS `s_berletem_van`
FROM `alworkshops_application` a
LEFT OUTER JOIN `alworkshops_courses` c ON a.`course_id`=c.`id`
LEFT OUTER JOIN `alworkshops_switch` s ON c.`alias`=s.`alias`
WHERE s.`tanfsor` IS NULL AND c.`title` IS NOT NULL AND a.`published`='Y' AND a.`user_id`=" . JFactory::getUser()->id . "
ORDER BY c.start_date DESC;");
$result = $db->loadObjectList();
return (count($result) ? $result : array());
}
public static function getCourseSessions($course_id = 0)
{
if ((int)$course_id == 0) return;
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select(array('s.*'));
$query->from($db->quoteName('www_archline_hu.alworkshops_sessions', 's'));
$query->where($db->quoteName('s.courseid') . ' = ' . $db->quote($course_id));
$query->where($db->quoteName('s.published') . ' = ' . $db->quote('Y'));
$query->order('s.ordering ASC');
$db->setQuery($query);
$result = $db->loadObjectList();
return (count($result) ? $result : array());
}
public static function getPublishedApplication($course_id = 0)
{
if ((int)$course_id == 0) return;
$user = JFactory::getUser();
$result = FALSE;
if ((int)$user->id > 0) {
$db = JFactory::getDbo();
$db->setQuery("SELECT a.*,c.`title`
FROM `alworkshops_application` a
LEFT OUTER JOIN `alworkshops_courses` c ON a.course_id=c.id
WHERE a.`course_id`=" . (int)$course_id . " AND a.`user_id`=" . (int)$user->id . " AND a.`published`='Y';");
$result = $db->loadObjectList();
}
return (count($result) ? $result : FALSE);
}
public static function unPublishApplication($course_id = 0)
{
if ((int)$course_id == 0) return;
$user = JFactory::getUser();
$db = JFactory::getDbo();
$db->setQuery("UPDATE `alworkshops_application` SET `published`='N' WHERE `course_id`=" . (int)$course_id . " AND `user_id`=" . (int)$user->id . " AND `published`='Y' LIMIT 1;");
$db->execute();
return;
}
public static function getCourseTable($fields = "*")
{
$db = JFactory::getDbo();
$db->setQuery("SELECT s." . $fields . ",c.`title`
FROM `alworkshops_switch` s
LEFT OUTER JOIN (SELECT DISTINCT(title) AS `title`,`alias` FROM `alworkshops_courses`) c ON s.`alias`=c.`alias`
WHERE s.tanfsor>0 AND s.lang='" . self::getLang() . "' AND s.vizsga = 'Y' ORDER BY s.tanfsor ASC,s.level ASC;");
$result = $db->loadObjectList();
return (count($result) ? $result : array());
}
public static function getNextWorkshop($alias = "")
{
if ($alias == "") return (FALSE);
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select(array('c.*'));
$query->from($db->quoteName('www_archline_hu.alworkshops_courses', 'c'));
$query->where($db->quoteName('c.start_date') . ' >= ' . 'CURRENT_DATE');
$query->where($db->quoteName('c.alias') . ' = ' . $db->quote($alias));
$query->where($db->quoteName('c.published') . ' = ' . $db->quote('Y'));
$query->order('s.start_date ASC');
$db->setQuery($query);
$result = $db->loadObjectList();
return (count($result) ? $result[0] : FALSE);
}
public static function getNextWorkshopString($alias = "")
{
if ($alias == "") return (FALSE);
$res = self::getNextWorkshop($alias);
return ($res ? $res->start_date : JText::_('MOD_ALAPPLICATIONS_NODATE'));
}
public static function getWorkshopApplications($userid = 0, $switchid = 0)
{
if ((int)$userid === 0) return (array());
$db = JFactory::getDbo();
$db->setQuery("SELECT c.id as course_id,c.alias,c.start_date,c.finish_date,s.workshop,s.kurzus,
IF(sess.switchid IS NULL,s.id,sess.switchid) AS switchid,
IF(sess.session_date IS NULL,c.start_date,sess.session_date) AS session_date,
IF(sess.description IS NULL,c.title,sess.description) AS description
FROM www_archline_hu.alworkshops_courses c
LEFT OUTER JOIN www_archline_hu.alworkshops_switch s ON c.alias=s.alias
LEFT OUTER JOIN www_archline_hu.alworkshops_sessions sess ON c.id=sess.courseid
WHERE " . ((int)$switchid > 0 ? " (s.id=" . (int)$switchid . " OR sess.switchid=" . (int)$switchid . ") AND " : "") . "
c.id IN (SELECT course_id FROM www_archline_hu.alworkshops_application WHERE user_id=" . (int)$userid . " AND published='Y');");
$result = $db->loadObjectList();
return (count($result) ? $result : array());
}
public static function getLang()
{
return (JFactory::getLanguage()->getTag() == 'hu-HU' ? "hun" : "eng");
}
}

View File

@ -0,0 +1,10 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<a href="http://xdsoft.net/joomla/module_generator/">Joomla Module Generator</a>
</body>
</html>

View File

@ -0,0 +1,4 @@
MOD_ARCHLINE_APPLICATIONS_MODULE="ARCHLine Applications Module"
MOD_ARCHLINE_APPLICATIONS_MODULE_DESCRIPTION="ARCHLine Applications Module"
MOD_ALAPPLICATIONS_MUST_LOGIN="You must login to see the list"
MOD_ALAPPLICATIONS_APPLICATION="Applications"

View File

@ -0,0 +1,2 @@
MOD_ARCHLINE_APPLICATIONS_MODULE="ARCHLine Applications Module"
MOD_ARCHLINE_APPLICATIONS_MODULE_DESCRIPTION="ARCHLine Applications Module"

View File

@ -0,0 +1,4 @@
MOD_ARCHLINE_APPLICATIONS_MODULE="ARCHLine Applications Module"
MOD_ARCHLINE_APPLICATIONS_MODULE_DESCRIPTION="ARCHLine Applications Module"
MOD_ALAPPLICATIONS_MUST_LOGIN="A jelentkezések megtekintéséhez jelentkezz be"
MOD_ALAPPLICATIONS_APPLICATION="Jelentkezések"

View File

@ -0,0 +1,2 @@
MOD_ARCHLINE_APPLICATIONS_MODULE="ARCHLine Applications Module"
MOD_ARCHLINE_APPLICATIONS_MODULE_DESCRIPTION="ARCHLine Applications Module"

View File

@ -0,0 +1,32 @@
<?php
defined('_JEXEC') or die;
require_once($_SERVER['DOCUMENT_ROOT'] . '/maintenance/config.course.php');
require_once __DIR__ . '/helper.php'; // Include the ALWorkshops functions only once
$doc = JFactory::getDocument();
$doc->addStyleSheet("/modules/mod_al_applications/assets/css/style.css");
$doc->addScript("/modules/mod_al_applications/assets/js/script.js");
$_POST['course_id'] = isset($_POST['course_id']) ? $_POST['course_id'] : 0;
if (isset($_POST) && (int)$_POST['course_id'] > 0) {
$app = JFactory::getApplication();
$input = $app->input;
$course_id = $input->get('course_id', '', 'int');
$application = ModAlapplicationsHelper::getPublishedApplication($course_id);
if ($application) {
ModAlapplicationsHelper::unPublishApplication($course_id);
JFactory::getApplication()->enqueueMessage(JText::_(MOD_ALAPPLICATIONS_UNPUBLISHED) . ": " . $application[0]->title, 'message');
}
}
$applications = ModAlapplicationsHelper::getOtherApplications();
$level = array(
1 => JText::_('MOD_ALAPPLICATIONS_PRELIMINARY'),
2 => JText::_('MOD_ALAPPLICATIONS_INTERMEDIATE'),
3 => JText::_('MOD_ALAPPLICATIONS_TUTOR_EXAM'),
4 => JText::_('MOD_ALAPPLICATIONS_ADVANCED')
);
require JModuleHelper::getLayoutPath('mod_al_applications', $params->get('layout', 'default'));

View File

@ -0,0 +1,49 @@
<?xml version="1.0" encoding="utf-8"?>
<extension type="module" method="upgrade" client="site">
<name>MOD_ARCHLINE_APPLICATIONS_MODULE</name>
<creationDate>Nov 2017</creationDate>
<author>Zsolt Fekete</author>
<authorEmail>mcleod78@gmail.com</authorEmail>
<authorUrl>https://www.facbook.com/mcleod78</authorUrl>
<copyright>Copyright © 2017 - All rights reserved.</copyright>
<license>GNU General Public License v2.0</license>
<version>0.0.1</version>
<description>MOD_ARCHLINE_APPLICATIONS_MODULE_DESCRIPTION</description>
<files>
<filename module="mod_al_applications">mod_al_applications.php</filename>
<filename>mod_al_applications.xml</filename>
<filename>helper.php</filename>
<filename>index.html</filename>
<folder>language</folder>
<folder>tmpl</folder>
<folder>assets</folder>
</files>
<config>
<fields name="params">
<fieldset name="advanced">
<field name="layout" type="modulelayout" label="JFIELD_ALT_LAYOUT_LABEL" description="JFIELD_ALT_MODULE_LAYOUT_DESC" />
<field name="moduleclass_sfx" type="textarea" rows="3" label="COM_MODULES_FIELD_MODULECLASS_SFX_LABEL" description="COM_MODULES_FIELD_MODULECLASS_SFX_DESC" />
<field name="cache" type="list" default="1" label="COM_MODULES_FIELD_CACHING_LABEL" description="COM_MODULES_FIELD_CACHING_DESC">
<option value="1">JGLOBAL_USE_GLOBAL</option>
<option value="0">COM_MODULES_FIELD_VALUE_NOCACHING</option>
</field>
<field name="cache_time" type="text" default="900" label="COM_MODULES_FIELD_CACHE_TIME_LABEL" description="COM_MODULES_FIELD_CACHE_TIME_DESC" />
<field name="cachemode" type="hidden" default="static">
<option value="static"></option>
</field>
</fieldset>
</fields>
</config>
<languages folder="language">
<language tag="en-GB">en-GB/en-GB.mod_al_applications.sys.ini</language>
<language tag="en-GB">en-GB/en-GB.mod_al_applications.ini</language>
<language tag="hu-HU">hu-HU/hu-HU.mod_al_applications.sys.ini</language>
<language tag="hu-HU">hu-HU/hu-HU.mod_al_applications.ini</language>
</languages>
</extension>

View File

@ -0,0 +1,104 @@
<?php
defined('_JEXEC') or die;
jimport('joomla.access.access');
$user = JFactory::getUser();
$groups = JAccess::getGroupsByUser($user->id, false);
?>
<?php if ((int)$user->id == 0) : ?>
<p><?= JText::_('MOD_ALAPPLICATIONS_MUST_LOGIN') ?></p>
<?= JModuleHelper::renderModule(JModuleHelper::getModule('login', 'Felhasználó - Workshop Bejelentkezés')) ?>
<?php else : ?>
<style>
.smaller-text {
font-size: 18px !important;
}
.bigger-text {
font-size: 22px;
margin-top: 10px !important;
}
.app-row {
margin-top: 10px;
}
.cimke {
line-height: 32px !important;
}
.panel-info,
.panel-heading {
color: black !important;
border-color: #ecf0f1 !important;
}
.panel-heading {
background-color: #ecf0f1 !important;
}
</style>
<div id="alCoursesContainer" class="container">
<?php
$offset = 0;
$tanfolyam = ModAlapplicationsHelper::getCourseTable();
foreach ($tanfolyam as $k => $ws) : ?>
<?php if ($ws->level == 3 && !in_array(18, $groups)) continue; ?>
<?php if ($k == 0 || ($k > 0 && $tanfolyam[$k - 1]->level != $tanfolyam[$k]->level)) : ?>
<?php if ($k > 0) : ?>
<!--belso lezaras-->
</div>
</div>
<!--belso lezaras-->
<?php endif; ?>
<div class="panel panel-info">
<div class="panel-heading">
<h3 class="bigger-text"><?= $ws->title ?></h3>
</div>
<div class="panel-body">
<div class="row">
<div class="col col-6 col-sm-6 col-md-6 col-lg-6 col-xl-6 smaller-text"><strong><?= JText::_('MOD_ALAPPLICATIONS_SIGNED') ?></strong></div>
<div class="col col-6 col-sm-6 col-md-6 col-lg-6 col-xl-6 smaller-text"><strong><?= JText::_('MOD_ALAPPLICATIONS_CHANGE') ?></strong></div>
</div>
<?php endif; ?>
<div class="row app-row">
<?php $wsapplications = ModAlapplicationsHelper::getWorkshopApplications((int)$user->id, $ws->id); ?>
<div class="col col-6 col-sm-6 col-md-6 col-lg-6 col-xl-6">
<?php if (count($wsapplications)) : ?>
<?php foreach ($wsapplications as $wsapp) : ?>
<?php if ($wsapp->session_date < date('Y-m-d')) $class = "danger";
if ($wsapp->session_date <= date('Y-m-d') && $application->finish_date >= date('Y-m-d')) $class = "info";
if ($wsapp->session_date > date('Y-m-d')) $class = "success"; ?>
<span class="cimke label label-<?= $class ?> smaller-text"><?= $wsapp->session_date ?></span>&nbsp;
<?php endforeach; ?>
<?php endif; ?>
</div>
<div class="col col-6 col-sm-6 col-md-6 col-lg-6 col-xl-6">
<?php if (count($wsapplications)) : ?>
<a href="/<?= $ws->path ?>/<?= ($ws->alias2 > '' ? $ws->alias2 : $ws->alias) ?>" class="sppb-btn custom-al <?php if (date('Y-m-d', time() + 86400 * _RESIGN_DAYS_) <= $wsapp->session_date) : ?>active<?php else : ?>disabled<?php endif ?>" target="_self"><?= JText::_('MOD_ALAPPLICATIONS_CHANGE_2') ?></a><br />
<?php endif; ?>
</div>
</div>
<?php endforeach; ?>
<!--vegso lezaras-->
</div>
</div>
<!--vegso lezaras-->
</div>
<script type="text/javascript">
function resignation(id) {
jQuery('#course_id').val(id);
jQuery('#alapplicationsForm').submit();
}
</script>
<?php endif; ?>

View File

@ -0,0 +1,10 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<a href="http://xdsoft.net/joomla/module_generator/">Joomla Module Generator</a>
</body>
</html>

View File

@ -0,0 +1,75 @@
<?php
/**
* @package Joomla.Site
* @subpackage mod_login
*
* @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Helper for mod_login
*
* @since 1.5
*/
class ModLoginHelper
{
/**
* Retrieve the URL where the user should be returned after logging in
*
* @param \Joomla\Registry\Registry $params module parameters
* @param string $type return type
*
* @return string
*/
public static function getReturnUrl($params, $type)
{
$app = JFactory::getApplication();
$item = $app->getMenu()->getItem($params->get($type));
// Stay on the same page
$url = JUri::getInstance()->toString();
if ($item)
{
$lang = '';
if ($item->language !== '*' && JLanguageMultilang::isEnabled())
{
$lang = '&lang=' . $item->language;
}
$url = 'index.php?Itemid=' . $item->id . $lang;
}
return base64_encode($url);
}
/**
* Returns the current users type
*
* @return string
*/
public static function getType()
{
$user = JFactory::getUser();
return (!$user->get('guest')) ? 'logout' : 'login';
}
/**
* Get list of available two factor methods
*
* @return array
*
* @deprecated 4.0 Use JAuthenticationHelper::getTwoFactorMethods() instead.
*/
public static function getTwoFactorMethods()
{
JLog::add(__METHOD__ . ' is deprecated, use JAuthenticationHelper::getTwoFactorMethods() instead.', JLog::WARNING, 'deprecated');
return JAuthenticationHelper::getTwoFactorMethods();
}
}

View File

@ -0,0 +1,10 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<a href="http://xdsoft.net/joomla/module_generator/">Joomla Module Generator</a>
</body>
</html>

View File

@ -0,0 +1,33 @@
<?php
/**
* @package Joomla.Site
* @subpackage mod_login
*
* @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
// Include the login functions only once
JLoader::register('ModLoginHelper', __DIR__ . '/helper.php');
$params->def('greeting', 1);
$type = ModLoginHelper::getType();
$return = ModLoginHelper::getReturnUrl($params, $type);
$twofactormethods = JAuthenticationHelper::getTwoFactorMethods();
$user = JFactory::getUser();
$layout = $params->get('layout', 'default');
// Logged users must load the logout sublayout
if (!$user->guest)
{
$layout .= '_logout';
}
require JModuleHelper::getLayoutPath('mod_al_login', $layout);
$app = JFactory::getApplication();
$user_id = $user->get('id');
$app->logout( $user_id );

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<extension type="module" version="3.1.0" client="site" method="upgrade">
<name>AL Login</name>
<author>Nagy Máté</author>
<version>1.0.0</version>
<description>Login into ARCHLine</description>
<files>
<filename>mod_al_login.xml</filename>
<filename module="mod_al_login">mod_al_login.php</filename>
<filename>index.html</filename>
<filename>helper.php</filename>
<filename>tmpl/default.php</filename>
<filename>tmpl/index.html</filename>
</files>
<languages>
<language tag="en-GB">en-GB.mod_al_login.ini</language>
<language tag="en-GB">en-GB.mod_al_login.sys.ini</language>
</languages>
<config>
</config>
</extension>

View File

@ -0,0 +1,124 @@
<?php
/**
* @package Joomla.Site
* @subpackage mod_login
*
* @copyright Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
require_once JPATH_SITE . '/components/com_users/helpers/route.php';
JHtml::_('behavior.keepalive');
JHtml::_('bootstrap.tooltip');
?>
<form action="<?php echo JRoute::_('index.php', true, $params->get('usesecure')); ?>" method="post" id="login-form" class="form-inline">
<?php if ($params->get('pretext')) : ?>
<div class="pretext">
<p><?php echo $params->get('pretext'); ?></p>
</div>
<?php endif; ?>
<div class="userdata">
<div id="form-login-username" class="control-group">
<div class="controls">
<?php if (!$params->get('usetext')) : ?>
<div class="input-prepend">
<span class="add-on">
<span class="icon-user hasTooltip" title="<?php echo JText::_('MOD_LOGIN_VALUE_USERNAME') ?>"></span>
<label for="modlgn-username" class="element-invisible"><?php echo JText::_('MOD_LOGIN_VALUE_USERNAME'); ?></label>
</span>
<input id="modlgn-username" type="text" name="username" class="input-small" tabindex="0" size="18" placeholder="<?php echo JText::_('MOD_LOGIN_VALUE_USERNAME') ?>" />
</div>
<?php else: ?>
<label for="modlgn-username"><?php echo JText::_('MOD_LOGIN_VALUE_USERNAME') ?></label>
<input id="modlgn-username" type="text" name="username" class="input-small" tabindex="0" size="18" placeholder="<?php echo JText::_('MOD_LOGIN_VALUE_USERNAME') ?>" />
<?php endif; ?>
</div>
</div>
<div id="form-login-password" class="control-group">
<div class="controls">
<?php if (!$params->get('usetext')) : ?>
<div class="input-prepend">
<span class="add-on">
<span class="icon-lock hasTooltip" title="<?php echo JText::_('JGLOBAL_PASSWORD') ?>">
</span>
<label for="modlgn-passwd" class="element-invisible"><?php echo JText::_('JGLOBAL_PASSWORD'); ?>
</label>
</span>
<input id="modlgn-passwd" type="password" name="password" class="input-small" tabindex="0" size="18" placeholder="<?php echo JText::_('JGLOBAL_PASSWORD') ?>" />
</div>
<?php else: ?>
<label for="modlgn-passwd"><?php echo JText::_('JGLOBAL_PASSWORD') ?></label>
<input id="modlgn-passwd" type="password" name="password" class="input-small" tabindex="0" size="18" placeholder="<?php echo JText::_('JGLOBAL_PASSWORD') ?>" />
<?php endif; ?>
</div>
</div>
<?php if (count($twofactormethods) > 1): ?>
<div id="form-login-secretkey" class="control-group">
<div class="controls">
<?php if (!$params->get('usetext')) : ?>
<div class="input-prepend input-append">
<span class="add-on">
<span class="icon-star hasTooltip" title="<?php echo JText::_('JGLOBAL_SECRETKEY'); ?>">
</span>
<label for="modlgn-secretkey" class="element-invisible"><?php echo JText::_('JGLOBAL_SECRETKEY'); ?>
</label>
</span>
<input id="modlgn-secretkey" autocomplete="off" type="text" name="secretkey" class="input-small" tabindex="0" size="18" placeholder="<?php echo JText::_('JGLOBAL_SECRETKEY') ?>" />
<span class="btn width-auto hasTooltip" title="<?php echo JText::_('JGLOBAL_SECRETKEY_HELP'); ?>">
<span class="icon-help"></span>
</span>
</div>
<?php else: ?>
<label for="modlgn-secretkey"><?php echo JText::_('JGLOBAL_SECRETKEY') ?></label>
<input id="modlgn-secretkey" autocomplete="off" type="text" name="secretkey" class="input-small" tabindex="0" size="18" placeholder="<?php echo JText::_('JGLOBAL_SECRETKEY') ?>" />
<span class="btn width-auto hasTooltip" title="<?php echo JText::_('JGLOBAL_SECRETKEY_HELP'); ?>">
<span class="icon-help"></span>
</span>
<?php endif; ?>
</div>
</div>
<?php endif; ?>
<?php if (JPluginHelper::isEnabled('system', 'remember')) : ?>
<div id="form-login-remember" class="control-group checkbox">
<label for="modlgn-remember" class="control-label"><?php echo JText::_('MOD_LOGIN_REMEMBER_ME') ?></label> <input id="modlgn-remember" type="checkbox" name="remember" class="inputbox" value="yes"/>
</div>
<?php endif; ?>
<div id="form-login-submit" class="control-group">
<div class="controls">
<button type="submit" tabindex="0" name="Submit" class="btn btn-primary"><?php echo JText::_('JLOGIN') ?></button>
</div>
</div>
<?php
$usersConfig = JComponentHelper::getParams('com_users'); ?>
<ul class="unstyled">
<?php if ($usersConfig->get('allowUserRegistration')) : ?>
<li>
<a href="<?php echo JRoute::_('index.php?option=com_users&view=registration&Itemid=' . UsersHelperRoute::getRegistrationRoute()); ?>">
<?php echo JText::_('MOD_LOGIN_REGISTER'); ?> <span class="icon-arrow-right"></span></a>
</li>
<?php endif; ?>
<li>
<a href="<?php echo JRoute::_('index.php?option=com_users&view=remind&Itemid=' . UsersHelperRoute::getRemindRoute()); ?>">
<?php echo JText::_('MOD_LOGIN_FORGOT_YOUR_USERNAME'); ?></a>
</li>
<li>
<a href="<?php echo JRoute::_('index.php?option=com_users&view=reset&Itemid=' . UsersHelperRoute::getResetRoute()); ?>">
<?php echo JText::_('MOD_LOGIN_FORGOT_YOUR_PASSWORD'); ?></a>
</li>
</ul>
<input type="hidden" name="option" value="com_users" />
<input type="hidden" name="task" value="user.login" />
<input type="hidden" name="return" value="<?php echo $return; ?>" />
<?php echo JHtml::_('form.token'); ?>
</div>
<?php if ($params->get('posttext')) : ?>
<div class="posttext">
<p><?php echo $params->get('posttext'); ?></p>
</div>
<?php endif; ?>
</form>

View File

@ -0,0 +1,10 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<a href="http://xdsoft.net/joomla/module_generator/">Joomla Module Generator</a>
</body>
</html>

View File

@ -0,0 +1,87 @@
<?php
defined('_JEXEC') or die;
jimport('joomla.user.helper');
class ModAlNewsletterHelper
{
public static function insertUser($name, $email, $phone, $cntr, $prof)
{
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select(array('e.*'));
$query->from($db->quoteName('cl_hlusers.u_emails', 'e'));
$query->where($db->quoteName('e.email') . ' = ' . $db->quote($email));
// Reset the query using our newly populated query object.
$db->setQuery($query);
// Load the results as a list of stdClass objects (see later for more options on retrieving data).
$existingUser = $db->loadObject();
if (!empty($existingUser)) {
if ($existingUser->newsletter == 1)
return true;
$db->getQuery(true);
$query = "UPDATE cl_hlusers.u_emails SET newsletter = 1 WHERE u_emails_id = '{$existingUser->u_emails_id}'";
$db->setQuery($query);
$db->execute();
return true;
}
$old_db = (JFactory::getLanguage()->getTag() == 'hu-HU' ? "clusers" : "clusers_eng");
$ctrID = (JFactory::getLanguage()->getTag() == 'hu-HU' ? 36 : 0);
if ($phone != '') {
$phone = str_replace('-', '', $phone);
$phone = str_replace(' ', '', $phone);
$phone = str_replace('+', '', $phone);
$phone = str_replace('/', '', $phone);
$phone = str_replace('.', '', $phone);
$phone = str_replace(' ', '', $phone);
}
$user = new stdClass();
$user->strName = $name;
$user->strEMail = $email;
$user->nUserType = 0;
$user->nUserStatus = 0;
$user->nUserProf = 0;
$user->old_db = $old_db;
$user->nSchoolID = 0;
$user->nCtrID = $ctrID;
$user->strTel = $phone;
$user->nCtrID = $cntr;
$user->nUserProf = $prof;
JFactory::getDbo()->insertObject('cl_hlusers.users', $user);
$nUserID = $db->insertid();
$history = new stdClass();
$history->nUserID = $nUserID;
$history->nTopicID = (JFactory::getLanguage()->getTag() == 'hu-HU' ? 38 : 150);
$history->dateEvent = date('Y-m-d');
$history->insertDate = date('Y-m-d H:i:s');
$history->strPlace = 'web';
$history->nManagerID = 36;
JFactory::getDbo()->insertObject('cl_hlusers.u_history', $history);
$emails = new stdClass();
$emails->email = $email;
$emails->nUserID = $nUserID;
$emails->default = 1;
$emails->active = 1;
$emails->deleted = 0;
$emails->newsletter = 1;
JFactory::getDbo()->insertObject('cl_hlusers.u_emails', $emails);
return true;
}
}

View File

@ -0,0 +1,10 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<a href="http://xdsoft.net/joomla/module_generator/">Joomla Module Generator</a>
</body>
</html>

View File

@ -0,0 +1,10 @@
MOD_AL_NEWSLETTER_SUBSCRIBE_HEADER="Jetzt unseren wöchentlichen Newsletter abonnieren!"
MOD_AL_NEWSLETTER_SUBSCRIBE_TEXT="Werden Sie Mitglied in unserer Community und erhalten Sie die neuesten Tutorials, Angebote und Nachrichten direkt per E-Mail."
MOD_AL_NEWSLETTER_NAME="Name"
MOD_AL_NEWSLETTER_NAME_PLACEHOLDER="Your name"
MOD_AL_NEWSLETTER_EMAIL="Email"
MOD_AL_NEWSLETTER_EMAIL_PLACEHOLDER="E-mail Adresse"
MOD_AL_NEWSLETTER_SUBSCRIBE_BTN="Abonnieren"
MOD_AL_NEWSLETTER_DONE="Danke für Ihr Abonnement"
MOD_AL_NEWSLETTER_PHONE="Telefonnummer"
MOD_AL_NEWSLETTER_PHONE_DESC="Telefonnummer"

View File

@ -0,0 +1,7 @@
MOD_AL_NEWSLETTER_SUBSCRIBE_HEADER="GET OUR NEWSLETTER"
MOD_AL_NEWSLETTER_SUBSCRIBE_TEXT="Want the latest and greatest from our blog straight to your inbox? Chucks us your details and get a sweet weekly email."
MOD_AL_NEWSLETTER_NAME="Name"
MOD_AL_NEWSLETTER_NAME_PLACEHOLDER="Your name"
MOD_AL_NEWSLETTER_EMAIL="Email"
MOD_AL_NEWSLETTER_EMAIL_PLACEHOLDER="Your email address"
MOD_AL_NEWSLETTER_SUBSCRIBE_BTN="Subscribe"

View File

@ -0,0 +1,8 @@
MOD_AL_NEWSLETTER_SUBSCRIBE_HEADER="Subscribe to our weekly newsletter!"
MOD_AL_NEWSLETTER_SUBSCRIBE_TEXT="Join our community to get the latest tutorials, offers and news delivered directly in your inbox."
MOD_AL_NEWSLETTER_NAME="Name"
MOD_AL_NEWSLETTER_NAME_PLACEHOLDER="Your name"
MOD_AL_NEWSLETTER_EMAIL="Email"
MOD_AL_NEWSLETTER_EMAIL_PLACEHOLDER="Your email address"
MOD_AL_NEWSLETTER_SUBSCRIBE_BTN="Subscribe"
MOD_AL_NEWSLETTER_DONE="Thank you for subscribing"

View File

@ -0,0 +1,7 @@
MOD_AL_NEWSLETTER_SUBSCRIBE_HEADER="GET OUR NEWSLETTER"
MOD_AL_NEWSLETTER_SUBSCRIBE_TEXT="Want the latest and greatest from our blog straight to your inbox? Chucks us your details and get a sweet weekly email."
MOD_AL_NEWSLETTER_NAME="Name"
MOD_AL_NEWSLETTER_NAME_PLACEHOLDER="Your name"
MOD_AL_NEWSLETTER_EMAIL="Email"
MOD_AL_NEWSLETTER_EMAIL_PLACEHOLDER="Your email address"
MOD_AL_NEWSLETTER_SUBSCRIBE_BTN="Subscribe"

View File

@ -0,0 +1,10 @@
MOD_AL_NEWSLETTER_SUBSCRIBE_HEADER="Iratkozz fel heti hírlevelünkre!"
MOD_AL_NEWSLETTER_SUBSCRIBE_TEXT="Csatlakozz az ARCHLine.XP közösségéhez, értesülj elsők között oktatóvideóinkról, akcióinkről és híreinkről! "
MOD_AL_NEWSLETTER_NAME="Név"
MOD_AL_NEWSLETTER_NAME_PLACEHOLDER="Név"
MOD_AL_NEWSLETTER_EMAIL="Email"
MOD_AL_NEWSLETTER_EMAIL_PLACEHOLDER="Email"
MOD_AL_NEWSLETTER_SUBSCRIBE_BTN="Feliratkozom"
MOD_AL_NEWSLETTER_DONE="Köszönjük, hogy feliratkozott hírlevelünkre"
MOD_AL_NEWSLETTER_PHONE="Telefonszám"
MOD_AL_NEWSLETTER_PHONE_DESC="Telefonszám"

View File

@ -0,0 +1,7 @@
MOD_AL_NEWSLETTER_SUBSCRIBE_HEADER="Iratkozzon fel hírlevelünkre"
MOD_AL_NEWSLETTER_SUBSCRIBE_TEXT="Szeretné a legújabb és legjobb híreket blogunkról egyenesen a postaládájába? Elküldi nekünk az adatait, és kap egy kedves heti e-mailt."
MOD_AL_NEWSLETTER_NAME="Név"
MOD_AL_NEWSLETTER_NAME_PLACEHOLDER="A neve"
MOD_AL_NEWSLETTER_EMAIL="Email"
MOD_AL_NEWSLETTER_EMAIL_PLACEHOLDER="Az email címe"
MOD_AL_NEWSLETTER_SUBSCRIBE_BTN="Feliratkozás"

View File

@ -0,0 +1,72 @@
<?php
defined('_JEXEC') or die;
require_once dirname(__FILE__) . '/helper.php';
if (isset($_POST['action']) && $_POST['action'] == 'subscribe') {
$app = JFactory::getApplication();
if ($_POST['name'] != '' || $_POST['email'] != '') {
$datetime = new \DateTime('');
$date = $datetime->format('c');
$ip = $_SERVER['REMOTE_ADDR'];
$browser = $_SERVER['HTTP_USER_AGENT'];
if (isset($_POST['g-recaptcha-response']) && !empty($_POST['g-recaptcha-response'])) {
$api_url = 'https://www.google.com/recaptcha/api/siteverify';
$resq_data = array(
'secret' => '6Le1o70lAAAAAE125nVz9KQYBX1h2-o5kmlx4tJw',
'response' => $_POST['g-recaptcha-response'],
'remoteip' => $_SERVER['REMOTE_ADDR']
);
$curlConfig = array(
CURLOPT_URL => $api_url,
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POSTFIELDS => $resq_data
);
$ch = curl_init();
curl_setopt_array($ch, $curlConfig);
$response = curl_exec($ch);
curl_close($ch);
$responseData = json_decode($response);
if (!$responseData->success) {
$log = "{$date} capchaID: 'web-registration-v3' verdict: 'FAILURE' IP: '{$ip}' Browser: '{$browser}'" . PHP_EOL;
error_log($log, 3, $_SERVER['DOCUMENT_ROOT'] . '/logs/captchaErrorLog.log');
$app->enqueueMessage('Captcha failed', 'error');
}
$log = "{$date} capchaID: 'web-registration-v3' verdict: 'SUCCESS' IP: '{$ip}' Browser: '{$browser}'" . PHP_EOL;
error_log($log, 3, $_SERVER['DOCUMENT_ROOT'] . '/logs/captchaErrorLog.log');
$input = $app->input;
$name = $input->get('name', '', 'string');
$email = $input->get('email', '', 'string');
$phone = $input->get('phone', '', 'string');
$cntr = $input->get('cntr', '', 'int');
$prof = $input->get('prof', '', 'int');
$user = ModAlNewsletterHelper::insertUser($name, $email, $phone, $cntr, $prof);
unset($_POST['subscribe-newsletter-btn']);
unset($_POST['name']);
unset($_POST['email']);
if ($user) {
$app->enqueueMessage(JText::_('MOD_AL_NEWSLETTER_DONE'));
}
} else {
$log = "{$date} capchaID: 'web-registration-v3' verdict: 'FAILURE' IP: '{$ip}' Browser: '{$browser}'" . PHP_EOL;
error_log($log, 3, $_SERVER['DOCUMENT_ROOT'] . '/logs/captchaErrorLog.log');
}
}
}
if ($_GET['Itemid'] != 744 && $_GET['Itemid'] != 745)
require JModuleHelper::getLayoutPath('mod_al_newsletter', $params->get('layout', 'default'));

View File

@ -0,0 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
<extension type="module" method="upgrade" client="site">
<name>mod_al_newsletter</name>
<creationDate>August 2022</creationDate>
<author>Nagy Máté</author>
<authorEmail>mate.nagy@cadline.hu</authorEmail>
<copyright>Copyright © 2021 - All rights reserved.</copyright>
<version>0.0.1</version>
<description>Create a newsletter subscription popup modal</description>
<files>
<filename module="mod_al_newsletter">mod_al_newsletter.php</filename>
<filename>mod_al_newsletter.xml</filename>
<filename>index.html</filename>
<filename>helper.php</filename>
<folder>language</folder>
<folder>tmpl</folder>
</files>
<config>
<fields name="params">
<fieldset name="advanced">
<field name="layout" type="modulelayout" label="JFIELD_ALT_LAYOUT_LABEL" description="JFIELD_ALT_MODULE_LAYOUT_DESC" />
<field name="moduleclass_sfx" type="textarea" rows="3" label="COM_MODULES_FIELD_MODULECLASS_SFX_LABEL" description="COM_MODULES_FIELD_MODULECLASS_SFX_DESC" />
<field name="cache" type="list" default="1" label="COM_MODULES_FIELD_CACHING_LABEL" description="COM_MODULES_FIELD_CACHING_DESC">
<option value="1">JGLOBAL_USE_GLOBAL</option>
<option value="0">COM_MODULES_FIELD_VALUE_NOCACHING</option>
</field>
<field name="cache_time" type="text" default="900" label="COM_MODULES_FIELD_CACHE_TIME_LABEL" description="COM_MODULES_FIELD_CACHE_TIME_DESC" />
<field name="cachemode" type="hidden" default="static">
<option value="static"></option>
</field>
</fieldset>
</fields>
</config>
<languages folder="language">
<language tag="en-GB">en-GB/en-GB.mod_al_newsletter.sys.ini</language>
<language tag="en-GB">en-GB/en-GB.mod_al_newsletter.ini</language>
<language tag="hu-HU">hu-HU/hu-HU.mod_al_newsletter.sys.ini</language>
<language tag="hu-HU">hu-HU/hu-HU.mod_al_newsletter.ini</language>
<language tag="de-DE">de-DE/de-DE.mod_al_newsletter.sys.ini</language>
<language tag="de-DE">de-DE/de-DE.mod_al_newsletter.ini</language>
</languages>
</extension>

View File

@ -0,0 +1,299 @@
<?php defined('_JEXEC') or die; ?>
<!-- <script src="https://www.google.com/recaptcha/api.js"></script> -->
<!-- Modal -->
<!--
<div id="newsLetterSubscribeModal" class="modal fade" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title"><?= JText::_('MOD_AL_NEWSLETTER_SUBSCRIBE_HEADER') ?></h4>
</div>
<div class="modal-body">
<p><?= JText::_('MOD_AL_NEWSLETTER_SUBSCRIBE_TEXT') ?></p>
<hr>
<form id="newsletter-form" action="" method="post">
<div class="form-group">
<label for="name"><b><?= JText::_('MOD_AL_NEWSLETTER_NAME') ?>:</b></label>
<input type="text" class="form-control" id="name" placeholder="<?= JText::_('MOD_AL_NEWSLETTER_NAME_PLACEHOLDER') ?>" name="name" required>
</div>
<div class="form-group">
<label for="email"><b><?= JText::_('MOD_AL_NEWSLETTER_EMAIL') ?>:</b></label>
<input type="email" class="form-control" id="email" placeholder="<?= JText::_('MOD_AL_NEWSLETTER_EMAIL_PLACEHOLDER') ?>" name="email" required>
</div>
<div class="form-group">
<label for="profession"><b>Profession:</b></label>
<select class="form-control" id="prof" name="prof" required="">
<option selected="selected" value="">Select</option>
<option value="19">Not professional</option>
<option value="1">Professional - Architect</option>
<option value="4">Professional - Interior Designer</option>
<option value="18">Professional - Other</option>
<option value="10">Student Architect</option>
<option value="11">Student Interior Designer</option>
</select>
</div>
<div class="form-group">
<label for="country"><b>Country:</b></label>
<select class="form-control" id="cntr" name="cntr" required="">
<option value="" selected="selected">--- Please select an option ---</option>
<option value="355">Albania</option>
<option value="213">Algeria</option>
<option value="1251">Andorra</option>
<option value="1252">Angola</option>
<option value="1253">Antigua and Barbuda</option>
<option value="54">Argentina</option>
<option value="1255">Armenia</option>
<option value="61">Australia</option>
<option value="43">Austria</option>
<option value="41">Austria-Dealer</option>
<option value="1258">Azerbaijan</option>
<option value="1259">Bahamas</option>
<option value="1260">Bahrain</option>
<option value="1261">Bangladesh</option>
<option value="1262">Barbados</option>
<option value="1263">Belarus</option>
<option value="32">Belgium</option>
<option value="1265">Belize</option>
<option value="1266">Benin</option>
<option value="1267">Bhutan</option>
<option value="92">BIMLadder registered</option>
<option value="1268">Bolivia</option>
<option value="387">Bosnia and Herzegovina</option>
<option value="1270">Botswana</option>
<option value="55">Brazil</option>
<option value="1272">Brunei</option>
<option value="1273">Bulgaria</option>
<option value="1274">Burkina Faso</option>
<option value="1275">Burundi</option>
<option value="1276">Cambodia</option>
<option value="1277">Cameroon</option>
<option value="2">Canada</option>
<option value="1279">Cape Verde</option>
<option value="1280">Central African Republic</option>
<option value="1281">Chad</option>
<option value="1282">Chile</option>
<option value="1283">China</option>
<option value="1284">Colombia</option>
<option value="1285">Comoros</option>
<option value="1286">Congo</option>
<option value="506">Costa Rica</option>
<option value="1288">Cote d'Ivoire</option>
<option value="38">Croatia</option>
<option value="1290">Cuba</option>
<option value="196">Cyprus</option>
<option value="42">Czech Republic</option>
<option value="45">Denmark</option>
<option value="1294">Djibouti</option>
<option value="1295">Dominica</option>
<option value="1297">East Timor (Timor Timur)</option>
<option value="1298">Ecuador</option>
<option value="20">Egypt</option>
<option value="1300">El Salvador</option>
<option value="1301">Equatorial Guinea</option>
<option value="1302">Eritrea</option>
<option value="1303">Estonia</option>
<option value="1304">Ethiopia</option>
<option value="1305">Fiji</option>
<option value="1306">Finland</option>
<option value="33">France</option>
<option value="1308">Gabon</option>
<option value="1309">Gambia, The</option>
<option value="1310">Georgia</option>
<option value="49">Germany</option>
<option value="492">Germany (Alpha-Software)</option>
<option value="495">Germany (Breeze Media)</option>
<option value="494">Germany (Encee)</option>
<option value="493">Germany (Hannes S&uuml;er)</option>
<option value="490">Germany (IT-Concept)</option>
<option value="491">Germany (POLZIN Systemhaus)</option>
<option value="233">Ghana</option>
<option value="44">Great Britain</option>
<option value="30">Greece</option>
<option value="301">Greece (EASYCAD)</option>
<option value="1314">Grenada</option>
<option value="1315">Guatemala</option>
<option value="1316">Guinea</option>
<option value="1317">Guinea-Bissau</option>
<option value="1318">Guyana</option>
<option value="1319">Haiti</option>
<option value="1320">Honduras</option>
<option value="36">Hungary</option>
<option value="1322">Iceland</option>
<option value="91">India</option>
<option value="969">Indonesia</option>
<option value="1325">Iran</option>
<option value="1326">Iraq</option>
<option value="35">Ireland</option>
<option value="73">Israel</option>
<option value="39">Italy</option>
<option value="1330">Jamaica</option>
<option value="81">Japan</option>
<option value="1332">Jordan</option>
<option value="1333">Kazakhstan</option>
<option value="1334">Kenya</option>
<option value="1335">Kiribati</option>
<option value="82">Korea</option>
<option value="1336">Korea, North</option>
<option value="1337">Korea, South</option>
<option value="78">Kuwait</option>
<option value="1339">Kyrgyzstan</option>
<option value="1340">Laos</option>
<option value="71">Latvia</option>
<option value="961">Lebanon</option>
<option value="1343">Lesotho</option>
<option value="1344">Liberia</option>
<option value="1345">Libya</option>
<option value="1346">Liechtenstein</option>
<option value="1347">Lithuania</option>
<option value="1348">Luxembourg</option>
<option value="1349">Macedonia</option>
<option value="1350">Madagascar</option>
<option value="1351">Malawi</option>
<option value="60">Malaysia</option>
<option value="1353">Maldives</option>
<option value="1354">Mali</option>
<option value="356">Malta</option>
<option value="1356">Marshall Islands</option>
<option value="1357">Mauritania</option>
<option value="1358">Mauritius</option>
<option value="52">Mexico</option>
<option value="1360">Micronesia</option>
<option value="1361">Moldova</option>
<option value="1362">Monaco</option>
<option value="1363">Mongolia</option>
<option value="1364">Montenegro</option>
<option value="978">MOROCCO</option>
<option value="1366">Mozambique</option>
<option value="1367">Myanmar</option>
<option value="1368">Namibia</option>
<option value="94">Namirial registered</option>
<option value="93">Namirial trial</option>
<option value="1369">Nauru</option>
<option value="1370">Nepal</option>
<option value="31">Netherland</option>
<option value="975">NEW ZEALAND</option>
<option value="64">New Zealand</option>
<option value="1373">Nicaragua</option>
<option value="1374">Niger</option>
<option value="74">Nigeria</option>
<option value="99">Non-profit</option>
<option value="47">Norway</option>
<option value="1377">Oman</option>
<option value="0">Other</option>
<option value="1378">Pakistan</option>
<option value="1379">Palau</option>
<option value="1380">Panama</option>
<option value="1381">Papua New Guinea</option>
<option value="1382">Paraguay</option>
<option value="13">Peru</option>
<option value="63">Philippines</option>
<option value="48">Poland</option>
<option value="51">Portugal</option>
<option value="1387">Qatar</option>
<option value="40">Romania</option>
<option value="401">Romania</option>
<option value="402">Romania</option>
<option value="7">Russia</option>
<option value="1390">Rwanda</option>
<option value="1391">Saint Kitts and Nevis</option>
<option value="1392">Saint Lucia</option>
<option value="1393">Saint Vincent</option>
<option value="1394">Samoa</option>
<option value="1395">San Marino</option>
<option value="1396">Sao Tome and Principe</option>
<option value="966">Saudi Arabia</option>
<option value="1397">Saudi Arabia</option>
<option value="1398">Senegal</option>
<option value="1400">Seychelles</option>
<option value="1401">Sierra Leone</option>
<option value="1402">Singapore</option>
<option value="65">Singapore</option>
<option value="421">Slovakia</option>
<option value="86">Slovenia</option>
<option value="861">Slovenia</option>
<option value="95">Software license</option>
<option value="1405">Solomon Islands</option>
<option value="1406">Somalia</option>
<option value="27">South Africa</option>
<option value="34">Spain</option>
<option value="1409">Sri Lanka</option>
<option value="1410">Sudan</option>
<option value="1411">Suriname</option>
<option value="1412">Swaziland</option>
<option value="1413">Sweden</option>
<option value="46">Sweden</option>
<option value="1414">Switzerland</option>
<option value="1415">Syria</option>
<option value="381">Szerbia</option>
<option value="88">Taiwan</option>
<option value="1417">Tajikistan</option>
<option value="1418">Tanzania</option>
<option value="1419">Thailand</option>
<option value="1420">Togo</option>
<option value="1421">Tonga</option>
<option value="96">Trial / Reader</option>
<option value="1422">Trinidad and Tobago</option>
<option value="1423">Tunisia</option>
<option value="90">Turkey</option>
<option value="1425">Turkmenistan</option>
<option value="1426">Tuvalu</option>
<option value="1427">Uganda</option>
<option value="1428">Ukraine</option>
<option value="973">UNITED ARAB EMIRATES</option>
<option value="11">United States of America</option>
<option value="1432">Uruguay</option>
<option value="1433">Uzbekistan</option>
<option value="1434">Vanuatu</option>
<option value="1435">Vatican City</option>
<option value="1436">Venezuela</option>
<option value="1437">Vietnam</option>
<option value="84">Vietnam</option>
<option value="1438">Yemen</option>
<option value="1439">Zambia</option>
<option value="1440">Zimbabwe</option>
</select>
</div>
<br>
<button type="submit" name="subscribe-newsletter-btn" class="btn btn-primary g-recaptcha" data-sitekey="6Le1o70lAAAAAAyKS0PSXpNnU8YfFzpKOUqxB6We" data-callback='onCatpchaSubmit' data-action='submit'>
<?= JText::_('MOD_AL_NEWSLETTER_SUBSCRIBE_BTN') ?>
</button>
<input type="hidden" name="action" value="subscribe">
</form>
</div>
</div>
</div>
</div>
-->
<script>
jQuery(document).ready(function() {
const domain = window.location.hostname;
var button = domain == 'www.archlinexp.com' ? 'Subscribe' : 'Hírlevél feliratkozás';
var btnUrl = domain == 'www.archlinexp.com' ? '/contact/subscribe-to-our-newsletter' : '#';
//jQuery('#alNewsletterBtn').after('<button id="newsletter-btn" class="btn btn-primary" data-toggle="modal" data-target="#newsLetterSubscribeModal"><b>' + button + '</b></button>');
jQuery('#alNewsletterBtn').after('<a id="newsletter-btn" class="btn btn-primary" href="' + btnUrl + '"><b>' + button + '</b></a>');
/*if (localStorage.getItem('al_newsletter') == null)
jQuery("#newsLetterSubscribeModal").modal();
jQuery('#newsLetterSubscribeModal').on('shown.bs.modal', function(e) {
if (localStorage.getItem('al_newsletter') == null)
localStorage.setItem('al_newsletter', true);
});*/
});
/*function onCatpchaSubmit(token) {
document.getElementById("newsletter-form").submit();
}*/
</script>

View File

@ -0,0 +1,10 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<a href="http://xdsoft.net/joomla/module_generator/">Joomla Module Generator</a>
</body>
</html>

View File

@ -0,0 +1,12 @@
<?php
defined('_JEXEC') or die;
jimport('joomla.user.helper');
class ModAlUploadHelper
{
public static function isImage($img)
{
return (bool)getimagesize($img);
}
}

View File

@ -0,0 +1,10 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<a href="http://xdsoft.net/joomla/module_generator/">Joomla Module Generator</a>
</body>
</html>

View File

@ -0,0 +1,4 @@
MOD_AL_UPLOAD_SUCCESS="Thank you for participating in the poll, your vote was valid. <br>
Best regards, CadLine Kft."
MOD_AL_UPLOAD_VOTE="Vote"
MOD_AL_UPLOAD_VOTE_2="I vote"

View File

@ -0,0 +1,7 @@
MOD_AL_NEWSLETTER_SUBSCRIBE_HEADER="GET OUR NEWSLETTER"
MOD_AL_NEWSLETTER_SUBSCRIBE_TEXT="Want the latest and greatest from our blog straight to your inbox? Chucks us your details and get a sweet weekly email."
MOD_AL_NEWSLETTER_NAME="Name"
MOD_AL_NEWSLETTER_NAME_PLACEHOLDER="Your name"
MOD_AL_NEWSLETTER_EMAIL="Email"
MOD_AL_NEWSLETTER_EMAIL_PLACEHOLDER="Your email address"
MOD_AL_NEWSLETTER_SUBSCRIBE_BTN="Subscribe"

View File

@ -0,0 +1,4 @@
MOD_AL_UPLOAD_SUCCESS="Köszönjük, hogy részt vettél a szavazáson, leadott szavazatod érvényes volt. <br>
Üdvözlettel, CadLine Kft."
MOD_AL_UPLOAD_VOTE="Szavazat"
MOD_AL_UPLOAD_VOTE_2="Szavazok"

View File

@ -0,0 +1,7 @@
MOD_AL_NEWSLETTER_SUBSCRIBE_HEADER="Iratkozzon fel hírlevelünkre"
MOD_AL_NEWSLETTER_SUBSCRIBE_TEXT="Szeretné a legújabb és legjobb híreket blogunkról egyenesen a postaládájába? Elküldi nekünk az adatait, és kap egy kedves heti e-mailt."
MOD_AL_NEWSLETTER_NAME="Név"
MOD_AL_NEWSLETTER_NAME_PLACEHOLDER="A neve"
MOD_AL_NEWSLETTER_EMAIL="Email"
MOD_AL_NEWSLETTER_EMAIL_PLACEHOLDER="Az email címe"
MOD_AL_NEWSLETTER_SUBSCRIBE_BTN="Feliratkozás"

View File

@ -0,0 +1,156 @@
<?php
defined('_JEXEC') or die;
require_once dirname(__FILE__) . '/helper.php';
require_once($_SERVER['DOCUMENT_ROOT'] . '/maintenance/libraries/phpmailer/PHPMailerAutoload.php');
require_once($_SERVER['DOCUMENT_ROOT'] . '/maintenance/config.mail.php');
if (isset($_POST['fileUploadSubmit']) && count($_FILES['fileToUpload']['tmp_name']) > 0) {
$user = JFactory::getUser();
$app = JFactory::getApplication();
$errorMsg = '';
$successMsg = '';
$needEmail = false;
$dir = 'userupload/az_ev_legjobb_vizsgamunkaja_2025/' . $user->id;
$needSuccessEmail = false;
$needDoc = false;
$docFiles = '';
$imgFiles = '';
$imgError = false;
$target_dir = $_SERVER['DOCUMENT_ROOT'] . '/public/' . $dir;
if (!file_exists($target_dir)) {
mkdir($target_dir, 0777, true);
}
$files = scandir($target_dir);
$pngImages = glob($target_dir . "/*.png");
$jpgImages = glob($target_dir . "/*.jpg");
$jpegImages = glob($target_dir . "/*.jpeg");
$images = array_merge($pngImages, $jpgImages, $jpegImages);
if (count($images) >= 4) {
$app->enqueueMessage('A feltöltött képek száma meghaladja a megengedett limitet.', 'error');
$imgError = true;
}
if ($imgError == false) {
for ($i = 0; $i <= count($_FILES['fileToUpload']['tmp_name']); $i++) {
$file = $_FILES['fileToUpload']['tmp_name'][$i];
if ($file == '')
continue;
if (ModAlUploadHelper::isImage($file)) {
$data = getimagesize($file);
$width = $data[0];
$height = $data[1];
if ($width < 1920 || $height < 1080) {
$errorMsg .= '- A kép mérete nem haladja meg az 1920x1080-as méretet: <b>' . basename($_FILES["fileToUpload"]["name"][$i]) . '</b><br>';
$imgFiles .= '- <b>' . basename($_FILES["fileToUpload"]["name"][$i]) . '</b><br>';
continue;
} else {
$successMsg .= '- <b>' . basename($_FILES["fileToUpload"]["name"][$i]) . '</b><br>';
}
} else {
$docFiles .= '- <b>' . basename($_FILES["fileToUpload"]["name"][$i]) . '</b><br>';
$needDoc = true;
}
$target_file = $target_dir . '/' . basename($user->id . '_' . $_FILES["fileToUpload"]["name"][$i]);
$path_parts = pathinfo($target_file);
$j = 1;
while (file_exists($target_file)) {
$target_file = $target_dir . '/' . $path_parts['filename'] . '_' . $j . '.' . $path_parts['extension'];
$j++;
}
move_uploaded_file($file, $target_file);
$needSuccessEmail = true;
}
if ($errorMsg != '') {
$app->enqueueMessage('Az alábbi képek nem lettek feltöltve: <br>' . $errorMsg, 'error');
}
if ($needSuccessEmail) {
$userMessage = 'Kedves ' . $user->name . '! <br><br>
Köszönjük, hogy feltöltötte pályázati anyagát a rendszerünkbe. A feltöltés sikeresen megtörtént.';
$userSuccess = '';
if ($successMsg != '') {
$userSuccess .= $successMsg;
}
if ($docFiles != '') {
$userSuccess .= $docFiles;
}
if ($userSuccess != '') {
$userMessage .= '<br><br> Az alábbi fájlokat rendszerünk rögzítette: <br><br>' . $userSuccess;
}
if ($imgFiles != '') {
$userMessage .= '<br><br> Az alábbi fájlokat nem találtuk a feltöltésben:<br><br>' . $imgFiles;
}
$userMessage .= '<br><br>
Kérjük, amennyiben valamelyik dokumentum hiányzik, pótolhatja a megadott határidőig: 2025. október 10. déli 12:00 óra. <br><br>
Amennyiben minden szükséges fájl feltöltésre került, a pályázati anyag teljesnek tekinthető, és a későbbiekben már nincs lehetőség módosításra vagy cserére. <br><br>
Üdvözlettel, <br>
CadLine Kft.
';
if ($userSuccess != '') {
$mail = new PHPMailer();
$mail->isSMTP();
$mail->CharSet = 'UTF-8';
$mail->Host = $mailconfig['Host'];
$mail->Port = $mailconfig['Port'];
$mail->SMTPAuth = true;
$mail->Username = $mailconfig['Username'];
$mail->Password = $mailconfig['Password'];
$mail->FromName = 'www.archline.hu';
$mail->From = 'marketing@cadline.hu';
$mail->AddAddress($user->email);
$mail->AddCC('marketing@cadline.hu');
$mail->IsHTML(true);
$mail->Subject = 'Sikeres pályázati anyag feltöltés visszaigazolás';
$mail->Body = $userMessage;
$mail->Send();
}
}
$msg = '';
if ($successMsg != '') {
$msg .= 'Az alábbi képek sikeresen fel lettek töltve: <br>' . $successMsg . '<br>';
}
if ($needDoc) {
$msg .= 'A dokumentumok sikeresen fel lettek töltve';
}
if ($successMsg != '' || $needDoc) {
$app->enqueueMessage($msg, 'success');
}
}
}
require JModuleHelper::getLayoutPath('mod_al_upload', $params->get('layout', 'default'));

View File

@ -0,0 +1,42 @@
<?xml version="1.0" encoding="utf-8"?>
<extension type="module" method="upgrade" client="site">
<name>mod_al_upload</name>
<creationDate>August 2022</creationDate>
<author>Nagy Máté</author>
<authorEmail>mate.nagy@cadline.hu</authorEmail>
<copyright>Copyright © 2021 - All rights reserved.</copyright>
<version>0.0.1</version>
<description>Create a file uploader modul</description>
<files>
<filename module="mod_al_upload">mod_al_upload.php</filename>
<filename>mod_al_upload.xml</filename>
<filename>index.html</filename>
<filename>helper.php</filename>
<folder>language</folder>
<folder>tmpl</folder>
</files>
<config>
<fields name="params">
<fieldset name="advanced">
<field name="layout" type="modulelayout" label="JFIELD_ALT_LAYOUT_LABEL" description="JFIELD_ALT_MODULE_LAYOUT_DESC" />
<field name="moduleclass_sfx" type="textarea" rows="3" label="COM_MODULES_FIELD_MODULECLASS_SFX_LABEL" description="COM_MODULES_FIELD_MODULECLASS_SFX_DESC" />
<field name="cache" type="list" default="1" label="COM_MODULES_FIELD_CACHING_LABEL" description="COM_MODULES_FIELD_CACHING_DESC">
<option value="1">JGLOBAL_USE_GLOBAL</option>
<option value="0">COM_MODULES_FIELD_VALUE_NOCACHING</option>
</field>
<field name="cache_time" type="text" default="900" label="COM_MODULES_FIELD_CACHE_TIME_LABEL" description="COM_MODULES_FIELD_CACHE_TIME_DESC" />
<field name="cachemode" type="hidden" default="static">
<option value="static"></option>
</field>
</fieldset>
</fields>
</config>
<languages folder="language">
<language tag="en-GB">en-GB/en-GB.mod_al_upload.sys.ini</language>
<language tag="en-GB">en-GB/en-GB.mod_al_upload.ini</language>
<language tag="hu-HU">hu-HU/hu-HU.mod_al_upload.sys.ini</language>
<language tag="hu-HU">hu-HU/hu-HU.mod_al_upload.ini</language>
</languages>
</extension>

View File

@ -0,0 +1,141 @@
<?php
defined('_JEXEC') or die('Restricted access');
?>
<style>
.alert-error {
color: #a94442;
background-color: #f2dede;
border-color: #ebccd1;
}
.sppb-addon-title {
text-transform: none !important;
}
.smaller-text {
font-size: 18px !important;
line-height: 26px !important;
}
.sppb-addon-content {
margin-top: 10px;
}
</style>
<form id="al_upload_form" action="" method="post" enctype="multipart/form-data">
<div id="sppb-addon-wrapper-1684832986382" class="sppb-addon-wrapper">
<div id="sppb-addon-1684832986382" class="clearfix ">
<div class="sppb-addon sppb-addon-text-block ">
<div class="sppb-addon-content">
<p class="smaller-text"><b>1. Bemutatkozás elérhetőséggel WORD formátumban:</b></p>
<ul>
<li class="smaller-text">34 mondat + név, e-mail, telefonszám</li>
</ul>
</div>
</div>
</div>
<input type="file" name="fileToUpload[]" id="fileToUpload[]" accept=".doc,.docx" style="margin-top:1px; margin-bottom:1px;" class="smaller-text">
</div>
<br>
<!--
<div id="sppb-addon-wrapper-1684833130123" class="sppb-addon-wrapper">
<div id="sppb-addon-1684833130123" class="clearfix ">
<div class="sppb-addon sppb-addon-text-block ">
<div class="sppb-addon-content">
<p class="smaller-text"><b>2. Projekt leírás feltöltése WORD formátumban:</b></p>
<ul>
<li class="smaller-text">Mik voltak a megrendelői igények?</li>
<li class="smaller-text">Mik voltak a szakmai elvárások?</li>
<li class="smaller-text">Mi volt a tervezés során a legnagyobb kihívás?</li>
<li class="smaller-text">Az ARCHLine.XP program használatakor melyik funkció volt a leghasznosabb?</li>
</ul>
</div>
</div>
</div>
<input type="file" name="fileToUpload[]" id="fileToUpload[]" accept=".doc,.docx" style="margin-top:1px; margin-bottom:1px;" class="smaller-text">
</div>
<br>
-->
<div id="sppb-addon-wrapper-1684833130135" class="sppb-addon-wrapper">
<div id="sppb-addon-1684833130135" class="clearfix ">
<div class="sppb-addon sppb-addon-text-block ">
<div class="sppb-addon-content smaller-text">
<p class="smaller-text"><b>2. PDF formátumú már elbírált vizsgamunka:</b></p>
</div>
</div>
</div>
<ul>
<li class="smaller-text">Nagy fájlméret lehetséges kérjük, figyelj a feltöltésre!</li>
<li class="smaller-text">Sikertelen feltöltés esetén küldd el a fájlt <a href="https://wetransfer.com/">WeTransferen</a> keresztül a marketing@cadline.hu címre.</li>
</ul>
<input type="file" name="fileToUpload[]" id="fileToUpload[]" accept="application/pdf" style="margin-top:1px; margin-bottom:1px;" class="smaller-text">
<br>
<!--<input type="file" name="fileToUpload[]" id="fileToUpload[]" accept="application/pdf" style="margin-top:1px; margin-bottom:1px;" class="smaller-text">
<br>
<input type="file" name="fileToUpload[]" id="fileToUpload[]" accept="application/pdf" style="margin-top:1px; margin-bottom:1px;" class="smaller-text">-->
</div>
<br>
<div id="sppb-addon-wrapper-1684833130129" class="sppb-addon-wrapper">
<div id="sppb-addon-1684833130129" class="clearfix ">
<div class="sppb-addon sppb-addon-text-block ">
<div class="sppb-addon-content">
<p class="smaller-text"><b>3. Render képek:</b></p>
<ul>
<li class="smaller-text">1920x1080 px méretben, maximum 3 db (opcionális, de a szakmai és közönségdíj elbírálásához javasolt)</li>
</ul>
</div>
</div>
</div>
<input type="file" class="smaller-text" name="fileToUpload[]" id="fileToUpload[]" accept="image/gif,image/jpg,image/jpeg,image/bmp,image/png" style="margin-top:1px; margin-bottom:1px;">
<br>
<input type="file" class="smaller-text" name="fileToUpload[]" id="fileToUpload[]" accept="image/gif,image/jpg,image/jpeg,image/bmp,image/png" style="margin-top:1px; margin-bottom:1px;">
<br>
<input type="file" class="smaller-text" name="fileToUpload[]" id="fileToUpload[]" accept="image/gif,image/jpg,image/jpeg,image/bmp,image/png" style="margin-top:1px; margin-bottom:1px;">
<!--<br>
<input type="file" class="smaller-text" name="fileToUpload[]" id="fileToUpload[]" accept="image/gif,image/jpg,image/jpeg,image/bmp,image/png" style="margin-top:1px; margin-bottom:1px;">
<br>
<input type="file" class="smaller-text" name="fileToUpload[]" id="fileToUpload[]" accept="image/gif,image/jpg,image/jpeg,image/bmp,image/png" style="margin-top:1px; margin-bottom:1px;">-->
</div>
<br>
<div id="sppb-addon-wrapper-1684918102659" class="sppb-addon-wrapper">
<div id="sppb-addon-1684918102659" class="clearfix ">
<div class="sppb-addon sppb-addon-text-block ">
<div class="sppb-addon-content">
<p class="smaller-text"><b>4. Profilkép</b></p>
<ul>
<li class="smaller-text">Minimum full HD felbontás (1920 x 1080px) vagy 3Mb-nál nagyobb fájlméretű JPG, JPEG, PNG.</li>
</ul>
</div>
</div>
</div>
<input type="file" class="smaller-text" name="fileToUpload[]" id="fileToUpload[]" accept="image/gif,image/jpg,image/jpeg,image/bmp,image/png" style="margin-top:1px; margin-bottom:1px;">
</div>
<br>
<input id="file_upload_btn" class="btn custom-al" type="submit" name="fileUploadSubmit" value="Fájlok feltöltése">
<button id="hidden_upload" class="btn custom-al hidden" type="button" disabled>Fájlok feltöltése</button>
</form>
<script>
jQuery('#al_upload_form').submit(function() {
jQuery('#file_upload_btn').hide();
jQuery('#hidden_upload').removeClass('hidden');
});
</script>

View File

@ -0,0 +1,10 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<a href="http://xdsoft.net/joomla/module_generator/">Joomla Module Generator</a>
</body>
</html>

View File

@ -0,0 +1,170 @@
<?php
defined('_JEXEC') or die;
jimport('joomla.user.helper');
class ModAlVoteHelper
{
public static function getItem($albumId = 4)
{
$result = array();
$user = JFactory::getUser();
try {
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->select('a.*')
->from('www_archline_hu.jml_speasyimagegallery_albums as a')
->where($db->quoteName('a.id') . ' = ' . $db->quote($albumId));
$query->select('l.title AS language_title')
->leftJoin($db->quoteName('#__languages') . ' AS l ON l.lang_code = a.language');
$query->select('ua.name AS author_name')
->leftJoin('#__users AS ua ON ua.id = a.created_by');
// Filter by published state.
$query->where('a.published = 1');
$db->setQuery($query);
$data = $db->loadObject();
if (isset($data->id) && $data->id) {
$data->images = self::getImages($data->id);
}
if (empty($data)) {
return JError::raiseError(404, JText::_('COM_SPEASYIMAGEGALLERY_ERROR_ALBUM_NOT_FOUND'));
}
$user = JFactory::getUser();
$groups = $user->getAuthorisedViewLevels();
if (!in_array($data->access, $groups)) {
return JError::raiseError(404, JText::_('COM_SPEASYIMAGEGALLERY_ERROR_ALBUM_NOT_AUTHORISED'));
}
$result[$albumId] = $data;
} catch (Exception $e) {
if ($e->getCode() == 404) {
JError::raiseError(404, $e->getMessage());
} else {
$result[$albumId] = false;
}
}
return $result[$albumId];
}
public static function isVoted($pictureId, $albumId, $userId)
{
$db = JFactory::getDbo();
$query = "SELECT id FROM www_archline_hu.al_picture_vote
WHERE picture_id = {$pictureId} AND album_id = {$albumId} AND nUserID = {$userId}";
$db->setQuery($query);
$existingVote = $db->loadObject();
return !empty($existingVote);
}
public static function getImages($album_id)
{
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select(array('a.*', 'b.picture_id', 'count(b.userID) AS voteCount'));
$query->from($db->quoteName('www_archline_hu.jml_speasyimagegallery_images', 'a'));
$query->join('LEFT', $db->quoteName('www_archline_hu.al_picture_vote', 'b') . ' ON ' . $db->quoteName('a.id') . ' = ' . $db->quoteName('b.picture_id'));
$query->where($db->quoteName('a.album_id') . ' = ' . $db->quote($album_id));
$query->where($db->quoteName('a.state') . ' = ' . $db->quote(1));
$query->order('a.title ASC');
$query->group($db->quoteName('a.id'));
$db->setQuery($query);
return $db->loadObjectList();
}
public static function votePicture($pictureId, $albumId, $userId, $nUserID, $info)
{
$db = JFactory::getDbo();
$query = "SELECT id FROM www_archline_hu.al_picture_vote
WHERE picture_id = {$pictureId} AND album_id = {$albumId} AND nUserID = {$nUserID}";
$db->setQuery($query);
$existingVote = $db->loadObject();
if (!empty($existingVote))
return false;
$vote = new stdClass();
$vote->picture_id = $pictureId;
$vote->album_id = $albumId;
$vote->userID = $userId;
$vote->nUserID = $nUserID;
JFactory::getDbo()->insertObject('www_archline_hu.al_picture_vote', $vote);
if ($nUserID != null && $nUserID != '') {
$topic = (JFactory::getLanguage()->getTag() == 'hu-HU' ? 322 : 153);
$query = "SELECT * FROM cl_hlusers.u_history
WHERE nUserID = {$nUserID} AND nTopicID = {$topic} AND strPlace = '{$info}'";
$db->setQuery($query);
$existingVote = $db->loadObject();
if (empty($existingVote)) {
$history = new stdClass();
$history->nUserID = $nUserID;
$history->nTopicID = $topic;
$history->dateEvent = date('Y-m-d');
$history->strPlace = $info;
$history->strInfo = $info;
$history->nManagerID = 36;
JFactory::getDbo()->insertObject('cl_hlusers.u_history', $history);
}
}
return true;
}
public static function getAlbumInfo()
{
$info = array();
$uri = JUri::getInstance();
switch ($uri->getPath()) {
case '/palyazatok/rendering-palyazat-2023':
$info['albumID'] = 4;
$info['endDate'] = '2023-02-14 00:01:00';
$info['voteDate'] = '2023-02-29';
$info['strInfo'] = 'Rendering pályázat 2023 szavazás';
break;
default:
$info['albumID'] = 5;
$info['endDate'] = '2024-06-01 00:01:00';
$info['voteDate'] = '2024-06-02';
$info['strInfo'] = 'Rendering pályázat 2024 szavazás';
break;
}
return $info;
}
public static function getWinnerPictures($album_id)
{
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select(array('a.*', 'b.*', 'count(b.userID) AS voteCount'));
$query->from($db->quoteName('www_archline_hu.jml_speasyimagegallery_images', 'a'));
$query->join('LEFT', $db->quoteName('www_archline_hu.al_picture_vote', 'b') . ' ON ' . $db->quoteName('a.id') . ' = ' . $db->quoteName('b.picture_id'));
$query->where($db->quoteName('a.album_id') . ' = ' . $db->quote($album_id));
$query->where($db->quoteName('a.state') . ' = ' . $db->quote(1));
$query->order('count(b.userID) DESC');
$query->group($db->quoteName('a.id'));
$db->setQuery($query);
$winners = $db->loadObjectList();
for ($i = 0; $i < count($winners); $i++)
$winners[$i]->source = json_decode($winners[$i]->images);
return $winners;
}
}

View File

@ -0,0 +1,10 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<a href="http://xdsoft.net/joomla/module_generator/">Joomla Module Generator</a>
</body>
</html>

View File

@ -0,0 +1,4 @@
MOD_AL_VOTE_SUCCESS="Thank you for participating in the poll, your vote was valid. <br>
Best regards, CadLine Kft."
MOD_AL_VOTE_VOTE="Vote"
MOD_AL_VOTE_VOTE_2="I vote"

View File

@ -0,0 +1,7 @@
MOD_AL_NEWSLETTER_SUBSCRIBE_HEADER="GET OUR NEWSLETTER"
MOD_AL_NEWSLETTER_SUBSCRIBE_TEXT="Want the latest and greatest from our blog straight to your inbox? Chucks us your details and get a sweet weekly email."
MOD_AL_NEWSLETTER_NAME="Name"
MOD_AL_NEWSLETTER_NAME_PLACEHOLDER="Your name"
MOD_AL_NEWSLETTER_EMAIL="Email"
MOD_AL_NEWSLETTER_EMAIL_PLACEHOLDER="Your email address"
MOD_AL_NEWSLETTER_SUBSCRIBE_BTN="Subscribe"

View File

@ -0,0 +1,4 @@
MOD_AL_VOTE_SUCCESS="Köszönjük, hogy részt vettél a szavazáson, leadott szavazatod érvényes volt. <br>
Üdvözlettel, CadLine Kft."
MOD_AL_VOTE_VOTE="Szavazat"
MOD_AL_VOTE_VOTE_2="Szavazok"

View File

@ -0,0 +1,7 @@
MOD_AL_NEWSLETTER_SUBSCRIBE_HEADER="Iratkozzon fel hírlevelünkre"
MOD_AL_NEWSLETTER_SUBSCRIBE_TEXT="Szeretné a legújabb és legjobb híreket blogunkról egyenesen a postaládájába? Elküldi nekünk az adatait, és kap egy kedves heti e-mailt."
MOD_AL_NEWSLETTER_NAME="Név"
MOD_AL_NEWSLETTER_NAME_PLACEHOLDER="A neve"
MOD_AL_NEWSLETTER_EMAIL="Email"
MOD_AL_NEWSLETTER_EMAIL_PLACEHOLDER="Az email címe"
MOD_AL_NEWSLETTER_SUBSCRIBE_BTN="Feliratkozás"

View File

@ -0,0 +1,24 @@
<?php
defined('_JEXEC') or die;
require_once dirname(__FILE__) . '/helper.php';
$user = JFactory::getUser();
$albumInfo = ModAlVoteHelper::getAlbumInfo();
$winners = ModAlVoteHelper::getWinnerPictures($albumInfo['albumID']);
if (isset($_POST['picture_vote_btn'])) {
$input = $app->input;
$pictureID = $input->get('picture_id', '', 'int');
if ($albumInfo['endDate'] >= date('Y-m-d H:i:s')) {
$vote = ModAlVoteHelper::votePicture($pictureID, $albumInfo['albumID'], $user->id, $user->nUserID, $albumInfo['strInfo']);
if ($vote)
JFactory::getApplication()->enqueueMessage(JText::_('MOD_AL_VOTE_SUCCESS'), 'message');
}
}
$album = ModAlVoteHelper::getItem($albumInfo['albumID']);
require JModuleHelper::getLayoutPath('mod_al_vote', $params->get('layout', 'default'));

View File

@ -0,0 +1,42 @@
<?xml version="1.0" encoding="utf-8"?>
<extension type="module" method="upgrade" client="site">
<name>mod_al_vote</name>
<creationDate>August 2022</creationDate>
<author>Nagy Máté</author>
<authorEmail>mate.nagy@cadline.hu</authorEmail>
<copyright>Copyright © 2021 - All rights reserved.</copyright>
<version>0.0.1</version>
<description>Create a picture vote modul</description>
<files>
<filename module="mod_al_vote">mod_al_vote.php</filename>
<filename>mod_al_vote.xml</filename>
<filename>index.html</filename>
<filename>helper.php</filename>
<folder>language</folder>
<folder>tmpl</folder>
</files>
<config>
<fields name="params">
<fieldset name="advanced">
<field name="layout" type="modulelayout" label="JFIELD_ALT_LAYOUT_LABEL" description="JFIELD_ALT_MODULE_LAYOUT_DESC" />
<field name="moduleclass_sfx" type="textarea" rows="3" label="COM_MODULES_FIELD_MODULECLASS_SFX_LABEL" description="COM_MODULES_FIELD_MODULECLASS_SFX_DESC" />
<field name="cache" type="list" default="1" label="COM_MODULES_FIELD_CACHING_LABEL" description="COM_MODULES_FIELD_CACHING_DESC">
<option value="1">JGLOBAL_USE_GLOBAL</option>
<option value="0">COM_MODULES_FIELD_VALUE_NOCACHING</option>
</field>
<field name="cache_time" type="text" default="900" label="COM_MODULES_FIELD_CACHE_TIME_LABEL" description="COM_MODULES_FIELD_CACHE_TIME_DESC" />
<field name="cachemode" type="hidden" default="static">
<option value="static"></option>
</field>
</fieldset>
</fields>
</config>
<languages folder="language">
<language tag="en-GB">en-GB/en-GB.mod_al_vote.sys.ini</language>
<language tag="en-GB">en-GB/en-GB.mod_al_vote.ini</language>
<language tag="hu-HU">hu-HU/hu-HU.mod_al_vote.sys.ini</language>
<language tag="hu-HU">hu-HU/hu-HU.mod_al_vote.ini</language>
</languages>
</extension>

View File

@ -0,0 +1,133 @@
<?php
defined('_JEXEC') or die('Restricted access');
JHtml::_('jquery.framework');
$doc = JFactory::getDocument();
$doc->addScript(JURI::base(true) . '/public/js/lightbox_2.js');
$doc->addStylesheet(JURI::base(true) . '/public/css/lightbox_2.css');
?>
<style>
.vote-form {
margin-top: 5px;
margin-bottom: 10px;
text-align: center;
}
.btn-vote {
background-color: #e67e22;
border-color: #e67e22;
font-weight: bold;
}
.btn-vote:hover {
background-color: rgba(230, 126, 34, 0.75) !important;
border-color: rgba(230, 126, 34, 0.75) !important;
}
.winner-text {
text-align: center;
font-size: 18px;
text-transform: uppercase;
}
</style>
<div class="container">
<!-- Winners -->
<?php if (date('Y-m-d') >= $info['voteDate']) : ?>
<div class="row">
<div class="image-row">
<div class="col-md-2"></div>
<div class="col-md-8">
<div class="winner-text">
<b><?= JText::_('MOD_AL_VOTE_FIRST_PLACE') ?></b>
</div>
<a class="example-image-link" href="<?php echo $winners[0]->source->original; ?>" data-title="<?php echo $winners[0]->title; ?>" data-lightbox="example-1"><img class="example-image" src="<?php echo $winners[0]->source->original; ?>"></a>
<?= JText::_('MOD_AL_VOTE_VOTE') ?>: <?= $winners[0]->voteCount ?>
</div>
<div class="col-md-2"></div>
</div>
</div>
<br>
<div class="row">
<div class="image-row">
<div class="col-md-2"></div>
<div class="col-md-4">
<div class="winner-text">
<b><?= JText::_('MOD_AL_VOTE_SECOND_PLACE') ?></b>
</div>
<a class="example-image-link" href="<?php echo $winners[1]->source->original; ?>" data-title="<?php echo $winners[1]->title; ?>" data-lightbox="example-1"><img class="example-image" src="<?php echo $winners[1]->source->original; ?>"></a>
<?= JText::_('MOD_AL_VOTE_VOTE') ?>: <?= $winners[1]->voteCount ?>
</div>
<div class="col-md-4">
<div class="winner-text">
<b><?= JText::_('MOD_AL_VOTE_THIRD_PLACE') ?></b>
</div>
<a class="example-image-link" href="<?php echo $winners[2]->source->original; ?>" data-title="<?php echo $winners[2]->title; ?>" data-lightbox="example-1"><img class="example-image" src="<?php echo $winners[2]->source->original; ?>"></a>
<?= JText::_('MOD_AL_VOTE_VOTE') ?>: <?= $winners[2]->voteCount ?>
</div>
<div class="col-md-2"></div>
</div>
</div>
<br>
<br>
<?php endif; ?>
<div class="row">
<div class="winner-text">
<b><?= JText::_('MOD_AL_VOTE_MORE_PICTURES') ?></b>
</div>
<br>
<div class="image-row">
<?php $i = 0; ?>
<?php foreach ($album->images as $key => $item->image) : ?>
<?php $source = json_decode($item->image->images); ?>
<?php if ($i % 4 == 0) : ?>
<div class="row">
<?php endif; ?>
<div class="col-md-3">
<a class="example-image-link" href="<?php echo $source->original; ?>" data-title="<?php echo $item->image->title; ?>" data-lightbox="example-1"><img class="example-image" src="<?php echo $source->thumb; ?>"></a>
<?php echo $item->image->title; ?>
<br>
<?= JText::_('MOD_AL_VOTE_VOTE') ?>: <?= $item->image->voteCount ?>
<?php if ($user->id > 0 && !ModAlVoteHelper::isVoted($item->image->id, $album->id, $user->nUserID) && $albumInfo['endDate'] >= date('Y-m-d H:i:s')) : ?>
<form class="vote-form" action="<?= JUri::current(); ?>" method="post">
<input type="hidden" name="picture_id" value="<?= $item->image->id ?>">
<input type="submit" class="btn btn-success btn-vote" name="picture_vote_btn" value="<?= JText::_('MOD_AL_VOTE_VOTE_2') ?>">
</form>
<?php else : ?>
<!--<div class="vote-form">
<button class="btn btn-success btn-vote disabled" disabled><?= JText::_('MOD_AL_VOTE_VOTE_2') ?></button>
</div>-->
<?php endif; ?>
</div>
<?php if ($i % 4 == 3) : ?>
</div>
<?php endif; ?>
<?php $i++; ?>
<?php endforeach; ?>
</div>
</div>
</div>
<script>
lightbox.option({
'resizeDuration': 700,
'wrapAround': true,
'alwaysShowNavOnTouchDevices': true
});
</script>

View File

@ -0,0 +1,10 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<a href="http://xdsoft.net/joomla/module_generator/">Joomla Module Generator</a>
</body>
</html>

View File

@ -0,0 +1,10 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<a href="http://xdsoft.net/joomla/module_generator/">Joomla Module Generator</a>
</body>
</html>

View File

@ -0,0 +1,10 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<a href="http://xdsoft.net/joomla/module_generator/">Joomla Module Generator</a>
</body>
</html>

View File

@ -0,0 +1,6 @@
.alusers .aktiv {color: #1E90FF;}
.alusers .inaktiv {color: #FF0000;}
.alusers dt {display:inline-block;margin-right:20px;min-width:150px;vertical-align:top;}
.alusers dd {display:inline-block;vertical-align:top;}
.btn-info, .btn-success, .btn-primary {background-color: #1E90FF !important; border-color: #1E90FF !important;}
.btn-info:hover, .btn-success:hover, .btn-primary:hover {background-color: #6495ED !important; border-color: #6495ED !important;}

View File

@ -0,0 +1,4 @@
.alusers .aktiv {color: #009900;}
.alusers .inaktiv {color: #FF0000;}
.alusers dt {display:inline-block;margin-right:20px;min-width:150px;vertical-align:top;}
.alusers dd {display:inline-block;vertical-align:top;}

View File

@ -0,0 +1,10 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<a href="http://xdsoft.net/joomla/module_generator/">Joomla Module Generator</a>
</body>
</html>

View File

@ -0,0 +1,10 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<a href="http://xdsoft.net/joomla/module_generator/">Joomla Module Generator</a>
</body>
</html>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,10 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<a href="http://xdsoft.net/joomla/module_generator/">Joomla Module Generator</a>
</body>
</html>

View File

@ -0,0 +1,4 @@
MOD_ARCHLINE_USERS="ARCHLine users"
MOD__P___ARCHLINE_USERS___P_="<p>
ARCHLine users
</p>"

View File

@ -0,0 +1,4 @@
MOD_ARCHLINE_USERS="ARCHLine users"
MOD__P___ARCHLINE_USERS___P_="<p>
ARCHLine users
</p>"

View File

@ -0,0 +1,4 @@
MOD_ARCHLINE_USERS="ARCHLine users"
MOD__P___ARCHLINE_USERS___P_="<p>
ARCHLine users
</p>"

View File

@ -0,0 +1,4 @@
MOD_ARCHLINE_USERS="ARCHLine users"
MOD__P___ARCHLINE_USERS___P_="<p>
ARCHLine users
</p>"

View File

@ -0,0 +1,178 @@
<?php
/**
* @copyright Copyright © 2017 - All rights reserved.
* @license GNU General Public License v2.0
* @generator http://xdsoft/joomla-module-generator/
*/
error_reporting(E_ERROR | E_PARSE);
defined('_JEXEC') or die;
require_once __DIR__ . '/helper.php'; // Include the helper functions only once
require_once(JPATH_BASE . '/maintenance/config.php');
$app = JFactory::getApplication();
$doc = JFactory::getDocument();
$doc->addStyleSheet("/modules/mod_alusers/assets/css/newstyle.css");
$doc->addScript("/modules/mod_alusers/assets/js/script.js");
$path = JFactory::getURI()->getPath();
$arr = explode('/', $path);
$alias = end($arr);
$user = JFactory::getUser();
$profile = JUserHelper::getProfile($user->id);
$lang = JFactory::getLanguage()->getTag();
$crmUser = ModAlusersHelper::getUserFromCRM((int)$user->nUserID);
$policy = ModAlusersHelper::getPrivacyPolicy((int)$user->nUserID);
$isStudent = ModAlusersHelper::isStudent((int)$user->nUserID);
$groups = $user->get('groups');
$input = $app->input;
if (in_array(2, $groups)) $pdf = ModAlusersHelper::getUserPDF((int)$user->nUserID);
if ((int)$user->nUserID > 0) {
$value = $app->input->cookie->get('alSessionID', null); // Get the cookie
if ($value == null) // If there's no cookie value, manually set it
{
$app->input->cookie->set('alSessionID', md5((int)$user->nUserID), (time() + 30), $app->get('cookie_path', '/'), $app->get('cookie_domain'), $app->isSSLConnection()); // Set the cookie
$app->input->cookie->set('alUserName', $user->name, (time() + 30), $app->get('cookie_path', '/'), $app->get('cookie_domain'), $app->isSSLConnection()); // Set the cookie
}
}
// ha még új a user, és nincs benne a crm rendszerben, akkor megpróbál egy user szinkronizációt
if ($user->nUserID === NULL) {
file_get_contents("http://www.archline.hu/maintenance/sync_user.php");
$res = ModAlusersHelper::getIdFromEmail($user->username);
if ((int)$res > 0) $user->nUserID = $res;
}
// hírlevél beállítások mentése
if (isset($_POST) && !empty($_POST) && isset($_POST['nl'])) {
if ((int)$_POST['del_email'] == 0 && trim($_POST['new_email']) == '') ModAlusersHelper::saveNewsletters($user->nUserID, $_POST['newsletter']);
ModAlusersHelper::newEmail($user->nUserID, $_POST['new_email']);
ModAlusersHelper::delEmail($user->nUserID, (int)$_POST['del_email']);
$user = JFactory::getUser(); // újra beolvassa az adatbázisból a rekordot mentés után
$crmUser = ModAlusersHelper::getUserFromCRM((int)$user->nUserID); // újra beolvassa az adatbázisból a rekordot mentés után
JFactory::getApplication()->enqueueMessage(JText::_('MOD_ARCHLINE_NEWSLETTER_SETTINGS_SUCCESS'), 'message');
}
// személyes adatok mentése
if (isset($_POST) && !empty($_POST) && isset($_POST['ps'])) {
ModAlusersHelper::savePersonalSettings($user->nUserID, $_POST);
$user = JFactory::getUser(); // újra beolvassa az adatbázisból a rekordot mentés után
$crmUser = ModAlusersHelper::getUserFromCRM((int)$user->nUserID); // újra beolvassa az adatbázisból a rekordot mentés után
JFactory::getApplication()->enqueueMessage(JText::_('MOD_ARCHLINE_PERSONAL_DATA_SUCCESS'), 'message');
}
// személyes adatok és hírlevél beállítások mentése
if (isset($_POST) && !empty($_POST) && isset($_POST['psSettings']) && in_array(2, $groups)) {
if ((int)$_POST['del_email'] == 0 && trim($_POST['new_email']) == '') ModAlusersHelper::saveNewsletters($user->nUserID, $_POST['newsletter']);
ModAlusersHelper::newEmail($user->nUserID, $_POST['new_email']);
ModAlusersHelper::delEmail($user->nUserID, (int)$_POST['del_email']);
ModAlusersHelper::savePersonalSettings($user->nUserID, $_POST);
$user = JFactory::getUser(); // újra beolvassa az adatbázisból a rekordot mentés után
$crmUser = ModAlusersHelper::getUserFromCRM((int)$user->nUserID); // újra beolvassa az adatbázisból a rekordot mentés után
JFactory::getApplication()->enqueueMessage(JText::_('MOD_ARCHLINE_PERSONAL_DATA_SUCCESS'), 'message');
}
// számlázási adatok mentése
if (isset($_POST) && !empty($_POST) && isset($_POST['invoiceSettings']) && in_array(2, $groups)) {
ModAlusersHelper::saveInvoiceSettings($user->nUserID, $app->input->post);
$user = JFactory::getUser(); // újra beolvassa az adatbázisból a rekordot mentés után
$crmUser = ModAlusersHelper::getUserFromCRM((int)$user->nUserID); // újra beolvassa az adatbázisból a rekordot mentés után
JFactory::getApplication()->enqueueMessage(JText::_('MOD_ARCHLINE_INVOICE_DATA_SUCCESS'), 'message');
}
// új jelszó mentése
if (isset($_POST) && !empty($_POST) && isset($_POST['pw'])) {
$pass1 = trim(addslashes($_POST['password1']));
$pass2 = trim(addslashes($_POST['password2']));
if ($pass1 != $pass2) {
JFactory::getApplication()->enqueueMessage(JText::_('MOD_ARCHLINE_PASSWORD_CHANGE_ERROR'), 'error');
} elseif (strlen($pass1) < 6 || strlen($pass1) > 32) {
JFactory::getApplication()->enqueueMessage(JText::_('MOD_ARCHLINE_PASSWORD_CHANGE_ERROR2'), 'error');
} else {
ModAlusersHelper::savePassword($user->id, $pass1);
JFactory::getApplication()->enqueueMessage(JText::_('MOD_ARCHLINE_PASSWORD_CHANGE_SUCCESS'), 'message');
}
}
if (isset($_POST) && !empty($_POST) && isset($_POST['privacy_policy_value'])) {
$db = JFactory::getDbo();
$db->setQuery("SELECT * FROM `" . CRMADATBAZIS . "`.`users` WHERE privacy_policy = 1 AND nUserID = '" . $user->nUserID . "';");
$result = $db->loadObjectList();
if (empty($result)) {
$db->setQuery("UPDATE cl_hlusers.users SET privacy_policy = 1, privacy_date = '" . date('Y-m-d') . "', nUserStatus = 7 WHERE nUserID = " . $user->nUserID . " LIMIT 1;");
$db->execute();
$db->setQuery("SELECT * FROM `" . CRMADATBAZIS . "`.`u_history` WHERE nTopicID = 102 AND nUserID = '" . $user->nUserID . "' ORDER BY nEventID DESC;");
$result2 = $db->loadObjectList();
$newStrInfo = $result2[0]->strInfo;
$newStrInfo = "<br/> Elfogadta: <b>Igen</b> Dátum: " . date('Y-m-d');
$db->setQuery("UPDATE cl_hlusers.u_history SET strInfo = '" . $newStrInfo . "' WHERE nEventID = " . $result2[0]->nEventID . " LIMIT 1;");
$db->execute();
}
if (isset($_POST['al_xp']))
header("Location: https://www.archline.hu/index.php?option=com_phocadownload&view=category&download=6779&id=6");
/*if (isset($_POST['al_live']))
header("Location: https://www.archline.hu/index.php?option=com_phocadownload&view=category&download=355&id=21");*/
exit();
}
$newsletterEmails = ModAlusersHelper::getNewsletterEmails($user->nUserID);
$ids[] = $user->nUserID;
$emails = ModAlusersHelper::getEmails($user->email);
if ($emails && count($emails) > 0) {
foreach ($emails as $tmp) {
$ids[] = $tmp->nUserID;
}
}
if (!empty($ids))
$kulcsok = ModAlusersHelper::getAllKeyData($ids);
if ($alias == 'aikreditek' || $alias == 'aicredits') {
$creditHistory = ModAlusersHelper::getCredits($user->nUserID);
$remainingCredits = ModAlusersHelper::getRemainingCredits($user->nUserID);
$dateFormat = $alias == 'aikreditek' ? 'Y.m.d.' : 'd.m.Y';
}
if ($alias == 'licenszek' || $alias == 'licenses') {
$supportArray = array();
$userData = ModAlusersHelper::getUserData($user->nUserID);
if (isset($_POST) && !empty($_POST) && isset($_POST['privacyPolicyBtn'])) {
$programData = ModAlusersHelper::getProgramData($_POST['prID']);
if ($programData->maintenance_valid == 1) {
if ($_POST['maintenance_privacy_policy_value'] != '1') {
JFactory::getApplication()->enqueueMessage(JText::_('MOD_ARCHLINE_MAINTENANCE_PRIVACY_POLICY_ERROR'), 'error');
} else {
ModAlusersHelper::sendMaintenanceEmail($user->nUserID, $userData->strName, $userData->email, $_POST['prID']);
JFactory::getApplication()->enqueueMessage(JText::_('MOD_ARCHLINE_MAINTENANCE_SUCCESS'), 'success');
}
}
}
$currentVer = ModAlusersHelper::getCurrentVersion();
$latestVerID = ModAlusersHelper::getLatestVersion($user->nUserID, $ids);
$latestPrograms = ModAlusersHelper::getLatestPrograms($user->nUserID, $latestVerID, $ids);
$olderPrograms = ModAlusersHelper::getOlderPrograms($user->nUserID, $latestVerID, $ids);
$liveVerID = 23;
$latestLive = array();
$latestArray = array();
$updateLink = $lang == 'hu-HU' ? '/vasarlas/frissites-karbantartas' : '/buy/upgrade';
}
if (!$kulcsok && !$user->guest) {
$ids[] = $user->nUserID;
if (!empty($ids) && $user->nUserID > 0) $kulcsok = ModAlusersHelper::getAllKeyData($ids);
}
require JModuleHelper::getLayoutPath('mod_alusers', $params->get('layout', 'default'));

View File

@ -0,0 +1,151 @@
<?xml version="1.0" encoding="utf-8"?><!--
/**
* @copyright Copyright © 2017 - All rights reserved.
* @license GNU General Public License v2.0
* @generator http://xdsoft/joomla-module-generator/
*/
-->
<extension type="module" method="upgrade" client="site">
<name>MOD_ARCHLINE_USERS</name>
<creationDate>Apr 2017</creationDate>
<author>Zsolt Fekete</author>
<authorEmail>zsolt.fekete@cadline.hu</authorEmail>
<authorUrl>https://www.facbook.com/mcleod78</authorUrl>
<copyright>Copyright © 2017 - All rights reserved.</copyright>
<license>GNU General Public License v2.0</license>
<version>0.0.1</version>
<description>MOD__P___ARCHLINE_USERS___P_</description>
<files>
<filename module="mod_alusers">mod_alusers.php</filename>
<filename>mod_alusers.xml</filename>
<filename>index.html</filename>
<folder>language</folder>
<folder>tmpl</folder>
<folder>assets</folder>
</files>
<config>
<fields name="params">
<fieldset
name="advanced">
<field
name="layout"
type="modulelayout"
label="JFIELD_ALT_LAYOUT_LABEL"
description="JFIELD_ALT_MODULE_LAYOUT_DESC" />
<field
name="moduleclass_sfx"
type="textarea" rows="3"
label="COM_MODULES_FIELD_MODULECLASS_SFX_LABEL"
description="COM_MODULES_FIELD_MODULECLASS_SFX_DESC" />
<field
name="cache"
type="list"
default="1"
label="COM_MODULES_FIELD_CACHING_LABEL"
description="COM_MODULES_FIELD_CACHING_DESC">
<option
value="1">JGLOBAL_USE_GLOBAL</option>
<option
value="0">COM_MODULES_FIELD_VALUE_NOCACHING</option>
</field>
<field
name="cache_time"
type="text"
default="900"
label="COM_MODULES_FIELD_CACHE_TIME_LABEL"
description="COM_MODULES_FIELD_CACHE_TIME_DESC" />
<field
name="cachemode"
type="hidden"
default="static">
<option
value="static"></option>
</field>
</fieldset>
</fields>
<!--
########################################################################################
The following are a list of all the different types of fields you can add to this file
They are here for copy pasting - neat eh?
Full list https://docs.joomla.org/Standard_form_field_types
########################################################################################
https://docs.joomla.org/Calendar_form_field_type
<field name="mycalendar" type="calendar" default="5-10-2008" label="Select a date" description="" format="%d-%m-%Y" />
https://docs.joomla.org/Category_form_field_type
<field name="mycategory" type="category" label="Select a category" description="" section="3" />
https://docs.joomla.org/Editor_form_field_type
<field name="myeditor" type="editors" default="none" label="Select an editor" />
https://docs.joomla.org/Filelist_form_field_type
<field name="myfile" type="filelist" default="" label="Select a file" description="" directory="administrator" filter="" exclude="" stripext="" />
https://docs.joomla.org/Folderlist_form_field_type
<field name="myfolder" type="folderlist" default="" label="Select a folder" directory="administrator" filter="" exclude="" stripext="" />
https://docs.joomla.org/Helpsite_form_field_type
<field name="myhelpsite" type="helpsites" default="" label="Select a help site" description="" />
https://docs.joomla.org/Hidden_form_field_type
<field name="mysecretvariable" type="hidden" default="" />
https://docs.joomla.org/Imagelist_form_field_type
<field name="myimage" type="imagelist" default="" label="Select an image" description="" directory="" exclude="" stripext="" />
https://docs.joomla.org/Language_form_field_type
<field name="mylanguage" type="languages" client="site" default="en-GB" label="Select a language" description="" />
https://docs.joomla.org/List_form_field_type
<field name="mylistvalue" type="list" default="" label="Select an option" description="">
<option value="0">Option 1</option>
<option value="1">Option 2</option>
</field>
https://docs.joomla.org/Menu_form_field_type
<field name="mymenu" type="menu" default="mainmenu" label="Select a menu" description="Select a menu" />
https://docs.joomla.org/Menuitem_form_field_type
<field name="mymenuitem" type="menuitem" default="45" label="Select a menu item" description="Select a menu item" />
https://docs.joomla.org/Password_form_field_type
<field name="mypassword" type="password" default="secret" label="Enter a password" description="" size="5" />
https://docs.joomla.org/Radio_form_field_type
<field name="myradiovalue" type="radio" default="0" label="Select an option" description="" class="btn-group btn-group-yesno">
<option value="0">JYES</option>
<option value="1">JNO</option>
</field>
https://docs.joomla.org/Spacer_form_field_type
<field type="spacer" default="&lt;b&gt;Advanced parameters&lt;/b&gt;" />
<field type="spacer" name="myspacer" hr="true" />
https://docs.joomla.org/SQL_form_field_type
<field name="myfield" type="sql" default="10" label="Select an article" query="SELECT id, title FROM #__content" key_field="id" value_field="title" />
https://docs.joomla.org/Text_form_field_type
<field name="mytextvalue" type="text" default="Some text" label="Enter some text" description="" size="10" />
https://docs.joomla.org/Textarea_form_field_type
<field name="mytextarea" type="textarea" default="default" label="Enter some text" description="" rows="10" cols="5" />
https://docs.joomla.org/Timezone_form_field_type
<field name="mytimezone" type="timezones" default="-10" label="Select a timezone" description="" />
https://docs.joomla.org/Usergroup_form_field_type
<field name="myusergroups" type="usergroup" default="" label="Select a user group" description="" />
-->
</config>
<languages folder="language">
<language tag="en-GB">en-GB/en-GB.mod_alusers.sys.ini</language>
<language tag="en-GB">en-GB/en-GB.mod_alusers.ini</language>
<language tag="hu-HU">hu-HU/hu-HU.mod_alusers.sys.ini</language>
<language tag="hu-HU">hu-HU/hu-HU.mod_alusers.ini</language>
</languages>
</extension>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,10 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<a href="http://xdsoft.net/joomla/module_generator/">Joomla Module Generator</a>
</body>
</html>

View File

@ -0,0 +1,26 @@
<?php
session_start();
require_once($_SERVER['DOCUMENT_ROOT']."/modules/mod_alworkshops/helpers/MySqlHelper.class.php");
abstract class BaseController
{
private static $instance;
public function __construct() {}
public function __destruct() {}
public function procEvent() {}
public function run()
{
$this->procEvent();
}
public function printSession($key="")
{
print "<pre>".print_r(($key=="" ? $_SESSION : $_SESSION[$key]),true)."</pre>";
}
}
?>

View File

@ -0,0 +1,502 @@
<?php
error_reporting(E_ERROR | E_PARSE);
require_once('BaseController.class.php');
require_once($_SERVER['DOCUMENT_ROOT'] . '/maintenance/config.course.php');
require_once($_SERVER['DOCUMENT_ROOT'] . '/maintenance/libraries/phpmailer/PHPMailerAutoload.php');
if (!class_exists('crm_users')) require_once($_SERVER['DOCUMENT_ROOT'] . "/common_cadline_libraries/crm_users.class.php");
class Controller extends BaseController
{
public $transid = '';
public $passthrough;
public $c;
public $_LANG;
public $customCourses = array(
'belter',
'kulter',
'photoshop',
'interior',
'aranyi-klaudia-kezdo-tanfolyam',
'aranyi-klaudia-halado-tanfolyam',
'aranyi-klaudia-teto-es-lepcso-szerkesztes-tanfolyam',
'd5-render',
'aranyi-klaudia-kiviteli-terv-tanfolyam',
'ferenczi-eva-tanfolyam',
'd5-render-halado',
'd5-render-alap',
'd5-render-3-0-ujdonsagok'
);
protected $lang;
protected $component = 'mod_alworkshops';
protected $arrLang = array('hun', 'eng');
protected $arrLC = array('hun' => 'hu-HU', 'eng' => 'en-GB');
protected $arrWebinarTopic = array('hun' => _WEBINAR_HUNGARIAN_, 'eng' => _WEBINAR_ENGLISH_);
public function procEvent()
{
$message = array();
$this->transid = md5(_TIME_);
// $nUserID=0;
if ($this->auth() == FALSE) die();
// nyelvi file betöltése
$this->lang = (isset($_POST['lang']) && in_array(trim(strtolower($_GET['lang'])), $this->arrLang) ? trim(strtolower($_GET['lang'])) : $this->getLang());
$this->_LANG = parse_ini_file($_SERVER['DOCUMENT_ROOT'] . "/language/" . $this->arrLC[$this->lang] . "/" . $this->arrLC[$this->lang] . "." . $this->component . ".ini");
// kurzus lekérdezése
MySqlHelper::getInstance()->query("SELECT s.`level`,s.`tanfsor`,s.`id` as switch_id,c.* FROM `alworkshops_courses` c LEFT OUTER JOIN `alworkshops_switch` s ON c.alias=s.alias WHERE c.`published`='Y' AND c.`id`=" . (int)$_POST['course_id'] . " LIMIT 1;");
$course = MySqlHelper::getInstance()->fetchAssoc();
$course = $course[0];
// switch lekérdezése
MySqlHelper::getInstance()->query("SELECT * FROM `alworkshops_switch` WHERE id=" . $course['switch_id'] . " LIMIT 1;");
$switch = MySqlHelper::getInstance()->fetchAssoc();
$switch = $switch[0];
// user lekérdezése
MySqlHelper::getInstance()->query("SELECT * FROM `jml_users` WHERE id=" . (int)$_POST['user_id'] . " LIMIT 1;");
$user = MySqlHelper::getInstance()->fetchAssoc();
$user = $user[0];
if ($switch['level'] == 4 && $switch['vizsga'] == 'Y') {
$query = "SELECT * FROM tcexam.tce_users WHERE user_email = ?";
Database::getInstance()->query($query, array('s', trim($user['email'])));
$res4 = Database::getInstance()->fetchNext();
$query = "DELETE FROM tcexam.tce_usrgroups WHERE usrgrp_user_id = ?";
Database::getInstance()->query($query, array('i', $res4['user_id']));
$tceGroup = array(
'usrgrp_user_id' => $res4['user_id'],
'usrgrp_group_id' => 3
);
Database::getInstance()->insert("tcexam.tce_usrgroups", $tceGroup, 'ii');
}
// ha tanfolyamot vásárolt, akkor a további fizetos workshop foglalások ingyenesek
$currentLease = crm_users::GetValidLease($user['nUserID'], (int)$switch['level']);
if ($switch['workshop'] == 'Y' && $currentLease && $course['price'] > 0 && $course['start_date'] >= $currentLease['validFrom'] && $course['start_date'] <= $currentLease['validThrough'] && (int)$course['tanfsor'] > 0) {
$course['price'] = 0;
$course['vat'] = 0;
}
// application adatok összeállítása
$app = array(
'course_id' => (int)$_POST['course_id'],
'user_id' => (int)$_POST['user_id'],
'attendees' => (int)$_POST['attendees'],
'price_per_attendee' => $course['price'],
'price_total' => $course['price'] * (int)$_POST['attendees'],
'price_vat' => $course['vat'],
'gepet_kerek' => (isset($_POST['gepet_kerek']) ? 'Y' : 'N'),
'berletem_van' => (isset($_POST['berletem_van']) ? 'Y' : 'N'),
'date' => date('Y-m-d H:i:s', _TIME_),
'published' => 'Y',
);
$this->c = $course;
/**********************************************
* WEBINAIR SIGNUP
**********************************************/
if (($switch['esemeny'] == 'Y' || $switch['webinair'] == 'Y') && isset($_POST['usr']) && isset($_POST['email'])) {
// if ($switch['alias']!='archline-klub' && $switch['alias']!='oktatoi-nap' )
if ($switch['login'] == 'N') {
if (trim($_POST['usr']) == '') {
print $this->_LANG['MOD_ARCHLINE_NAME_MISSING'];
exit();
}
if (trim($_POST['email']) == '') {
print $this->_LANG['MOD_ARCHLINE_EMAIL_MISSING'];
exit();
}
if (!filter_var(trim($_POST['email']), FILTER_VALIDATE_EMAIL)) {
print $this->_LANG['MOD_ARCHLINE_EMAIL_INVALID'];
exit();
}
$_POST['country'] = 0;
if ((int)$_POST['prof'] == 0) {
print $this->_LANG['MOD_ARCHLINE_PROF_MISSING'];
exit();
}
}
if ($course['capacity'] < (int)$_POST['applications'] + (int)$_POST['attendees']) {
print "<script>alert('" . $this->_LANG['MOD_ARCHLINE_NOT_ENOUGHT_CAPACITY'] . "');</script>";
exit();
}
$nUserID = crm_users::AddUser(
array(
'strName' => trim(addslashes(ucwords($_POST['usr']))),
'strEMail' => trim(addslashes($_POST['email'])),
'strTel' => trim(addslashes($_POST['phone'])),
'nUserProf' => (int)$_POST['prof'],
'nCtrID' => (int)$_POST['country']
),
1,
'sssii'
);
if ((int)$nUserID > 0) {
MySqlHelper::getInstance()->query("SELECT * FROM `www_archline_hu`.`alworkshops_application` WHERE `course_id`=" . $course['id'] . " AND `email`='" . trim(addslashes($_POST['email'])) . "' AND `published`='Y';");
$exist = MySqlHelper::getInstance()->fetchAssoc();
if (!$exist) {
if ($switch['esemeny'] == 'Y' && $switch['alias'] == 'archline-klub') $nTopicID = _ARCHLINE_KLUB_;
if ($switch['esemeny'] == 'Y' && $switch['alias'] != 'archline-klub') $nTopicID = _EVENT_REGISTRATION_;
if ($switch['webinair'] == 'Y') $nTopicID = $this->arrWebinarTopic[$this->lang];
if ($switch['esemeny'] == 'Y' && (in_array($switch['alias'], $this->customCourses))) {
$nTopicID = $_SERVER['SERVER_NAME'] == 'www.archlinexp.com' ? 333 : 123;
$info = date('Y.m.d.') . ': ' . str_replace("-", ".", $course['start_date']) . ' - ' . str_replace("-", ".", $course['finish_date']);
}
if ($switch['webinair'] == 'Y') {
MySqlHelper::getInstance()->query("SELECT * FROM `cl_hlusers`.`users` WHERE `nUserID`=" . $nUserID . ";");
$usr = MySqlHelper::getInstance()->fetchAssoc();
$nTopicID = $usr[0]['old_db'] == 'clusers' ? 336 : 333;
//$info = $course['id'] == 1108 ? 'Online középfokú tanfolyam' : 'Online alapfokú tanfolyam';
if ($course['id'] == 1114) {
$info = 'Online felsőfokú tanfolyam';
}
}
if (is_null($course['course_info']) == false && $course['course_info'] != '')
$info = $course['course_info'];
crm_users::AddUserHistory(
array(
'nUserID' => $nUserID,
'nTopicID' => $nTopicID,
'dateEvent' => $course['start_date'],
'strPlace' => $course['title'],
'strInfo' => $info
)
);
} else {
//print $this->_LANG['MOD_ARCHLINE_EVENT_ALREADY_EXIST']; exit();
$already = $this->_LANG['MOD_ARCHLINE_EVENT_ALREADY_EXIST'];
print "<script>alert('$already');</script>";
exit();
}
// application rekord mentés
$app['user_id'] = $_POST['hidden_id'];
$app['name'] = trim(addslashes(ucwords($_POST['usr'])));
$app['email'] = trim(addslashes($_POST['email']));
MySqlHelper::getInstance()->insert('alworkshops_application', $app);
$newID = MySqlHelper::getInstance()->getInsertedId();
// level kuldes
$this->sendEmail($app['course_id'], 0, $newID, $nUserID);
$success = $this->_LANG['MOD_ARCHLINE_SUCCESS'];
print "<script>alert('$success');</script>";
//print $this->_LANG['MOD_ARCHLINE_SUCCESS'];
}
}
/**********************************************
* WORKSHOP SIGNUP
**********************************************/
else if (($switch['kurzus'] == 'Y' || $switch['workshop'] == 'Y' || $switch['vizsga'] == 'Y') && (int)$_POST['user_id'] > 0 && !isset($_POST['usr']) && !isset($_POST['email'])) {
MySqlHelper::getInstance()->query("SELECT * FROM alworkshops_application WHERE published='Y' AND user_id=" . $app['user_id'] . " AND course_id=" . $app['course_id'] . " LIMIT 1;");
$exist = MySqlHelper::getInstance()->fetchAssoc();
// hibaüzenetek
if (!($switch['kurzus'] === 'Y' && $switch['level'] == 2) && count($exist)) {
$message[] = $this->_LANG['MOD_ARCHLINE_ALREADY_EXIST'];
}
if ($switch['alias'] != 'tanulocsoportok') {
if (!($switch['kurzus'] === 'Y' && $switch['level'] == 2) && $course['capacity'] < (int)$_POST['applications'] + (int)$_POST['attendees']) {
$message[] = $this->_LANG['MOD_ARCHLINE_NOT_ENOUGHT_CAPACITY'];
}
} else {
crm_database::getInstance()->query("SELECT * FROM `www_archline_hu`.`alworkshops_application` WHERE `course_id`=" . $app['course_id'] . " AND published = 'Y';");
$exist = crm_database::getInstance()->fetchAssoc();
$capacity = $course['capacity'] - count($exist);
if ($capacity <= 0) $message[] = $this->_LANG['MOD_ARCHLINE_NOT_ENOUGHT_CAPACITY'];
}
if (count($message)) {
foreach ($message as $mess) {
print $mess . "<br />";
}
exit();
}
// átjelentkezési lehetőség ellenőrzése
MySqlHelper::getInstance()->query("SELECT a.id AS application_id,a.course_id,s.id AS switch_id,a.user_id,a.published,a.transaction_id,a.price_total,a.pay_id,c.title,c.alias,c.start_date,c.start_time,c.finish_date,c.finish_time
FROM `alworkshops_application` a
LEFT OUTER JOIN `alworkshops_courses` c ON a.course_id=c.id
LEFT OUTER JOIN `alworkshops_switch` s ON c.alias=s.alias
WHERE user_id=" . $app['user_id'] . " AND s.id=" . $course['switch_id'] . " AND `start_date`>'" . date('Y-m-d', _TIME_ - (_RESIGN_DAYS_ * 86400)) . "'
ORDER BY a.id DESC
LIMIT 1;");
$this->passthrough = MySqlHelper::getInstance()->fetchAssoc();
if (count($this->passthrough)) // átjelentkezés meglévő application rekordra
{
$this->transid = $this->passthrough[0]['transaction_id'];
$newID = $this->passthrough[0]['application_id'];
MySqlHelper::getInstance()->update('alworkshops_application', $app, array('id' => $newID));
// alapfoku tanfolyam kezdo datumanak atallitasa a crm-ben
if ($switch['kurzus'] == 'Y' && (int)$switch['level'] == 1) {
$topic = _COURSE_PRICE_PRELIMINARY_;
$info = '';
if ($switch['alias'] == 'tanulocsoportok') {
$topic = 380;
$info = $switch['title'];
}
MySqlHelper::getInstance()->query("SELECT * FROM `cl_hlusers`.`u_history` WHERE nUserID=" . $user['nUserID'] . " AND nTopicID=" . $topic . " AND applicationID=" . $newID . " ORDER BY insertDate DESC LIMIT 1;");
$exist = MySqlHelper::getInstance()->fetchAssoc();
if (count($exist)) {
if ($info == '') $info = $exist[0]['strInfo'];
$uHistory['nTopicID'] = $topic;
$uHistory['dateEvent'] = $course['start_date'];
$uHistory['strInfo'] = $info;
MySqlHelper::getInstance()->update(CRMADATBAZIS . ".u_history", $uHistory, array('nEventID' => $exist[0]['nEventID']));
}
}
// kozepfoku workshop kezdo datumanak atallitasa a crm-ben
if ($switch['workshop'] == 'Y' && (int)$switch['level'] == 2) {
MySqlHelper::getInstance()->query("SELECT * FROM `cl_hlusers`.`u_history` WHERE nUserID=" . $user['nUserID'] . " AND nTopicID=" . _WORKSHOP_PRICE_ . " AND applicationID=" . $newID . " ORDER BY insertDate DESC LIMIT 1;");
$exist = MySqlHelper::getInstance()->fetchAssoc();
if (count($exist)) {
crm_users::UpdateUserHistory(
array(
'dateEvent' => $course['start_date']
),
$exist[0]['nEventID'],
's'
);
}
}
} else // új application rekord mentés
{
$app['transaction_id'] = $this->transid;
MySqlHelper::getInstance()->insert('alworkshops_application', $app);
$newID = MySqlHelper::getInstance()->getInsertedId();
}
if ($switch['kurzus'] == 'Y') {
$strPlace = 'Tanfolyam';
$nTopicID = _WORKSHOP_APPLICATION_;
}
if ($switch['workshop'] == 'Y') {
$strPlace = 'Workshop';
$nTopicID = _WORKSHOP_APPLICATION_;
}
if ($switch['vizsga'] == 'Y') {
$strPlace = 'Vizsga';
$nTopicID = _EXAM_APPLICATION_;
}
if ($switch['alias'] == 'tanulocsoportok') {
$strPlace = $switch['title'];
$nTopicID = 379;
}
$datumok = array();
if ($switch['kurzus'] == 'Y') {
// sessionok lekérdezése
MySqlHelper::getInstance()->query("SELECT * FROM `alworkshops_sessions` WHERE `published`='Y' AND `courseid`=" . (int)$_POST['course_id'] . ";");
$sessions = MySqlHelper::getInstance()->fetchAssoc();
foreach ($sessions as $sess) {
$datumok[] = array('datum' => $sess['session_date'], 'hely' => $sess['description']);
}
} else {
$datumok[] = array('datum' => $course['start_date'], 'hely' => $course['title']);
}
$info = (trim($app['berletem_van']) == 'Y' ? ' <b>Tanfolyam</b>,' : '') . (trim($app['gepet_kerek']) == 'Y' ? ' <b>Gépet kér</b>,' : '');
$place = $strPlace . ' - ' . $datum['hely'];
if ($switch['alias'] == 'tanulocsoportok') {
if ($switch['level'] == 1) $info = 'Alapfok';
else $info = 'Középfok';
$place = $strPlace;
$info .= ' ' . $course['start_date'] . ' - ' . $course['finish_date'];
}
foreach ($datumok as $datum) {
$u_history = array(
'nUserID' => $user['nUserID'],
'nTopicID' => $nTopicID,
'dateEvent' => $datum['datum'],
'strPlace' => $strPlace . ' - ' . $datum['hely'],
'strInfo' => $info,
'nManagerID' => _MANAGER_,
'applicationID' => $newID,
);
MySqlHelper::getInstance()->query("SELECT * FROM `cl_hlusers`.`u_history` WHERE applicationID=" . $newID . " AND strPlace LIKE '%" . trim($datum['hely']) . "%' LIMIT 1;");
$exist = MySqlHelper::getInstance()->fetchAssoc();
if (empty($exist)) {
crm_users::AddUserHistory($u_history);
} else {
crm_users::UpdateUserHistory($u_history, $exist[0]['nEventID'], 'iisssii');
}
}
// user status átállítás
crm_users::SetUserStatus($user['nUserID'], 5);
// level kuldes, CSAK HA INGYENES - a fizetos foglalasokrol a sync_fizetes.php kuldi ki a levelet
if ($course['price'] == 0 || ($course['price'] > 0 && count($this->passthrough))) {
$this->sendEmail($app['course_id'], $app['user_id'], $newID, $user['nUserID']);
}
if (count($this->passthrough)) {
print ($switch['kurzus'] === 'Y' && $switch['level'] == 2 ? $this->_LANG['MOD_ARCHLINE_SUCCESS_TITLE'] : $this->_LANG['MOD_ARCHLINE_PASSTHROUGH_SUCCESS']) . ".";
} else {
print($course['price'] == 0 ? $this->_LANG['MOD_ARCHLINE_SUCCESS'] : $this->_LANG['MOD_ARCHLINE_SUCCESS_TITLE'] . '. ' . $this->_LANG['MOD_ARCHLINE_SUCCESS_TEXT']);
}
}
}
public function sendEmail($courseid = 0, $userid = 0, $applicationID = 0, $nUserID = 0)
{
if ($courseid == 0 || $applicationID == 0) return (FALSE);
if (!isset($mailconfig)) require_once($_SERVER['DOCUMENT_ROOT'] . '/maintenance/config.mail.php');
// application rekord lekérdezése
MySqlHelper::getInstance()->query("SELECT * FROM alworkshops_application WHERE published='Y' AND id=" . $applicationID . " LIMIT 1;");
$app = MySqlHelper::getInstance()->fetchAssoc();
$app = $app[0];
// course rekord lekérdezése
MySqlHelper::getInstance()->query("SELECT * FROM alworkshops_courses WHERE published='Y' AND id=" . $courseid . " LIMIT 1;");
$course = MySqlHelper::getInstance()->fetchAssoc();
$course = $course[0];
// switch rekord lekérdezése
MySqlHelper::getInstance()->query("SELECT * FROM `alworkshops_switch` WHERE alias='" . $course['alias'] . "' LIMIT 1;");
$switch = MySqlHelper::getInstance()->fetchAssoc();
$switch = $switch[0];
// user név és email cím lekérdezése
MySqlHelper::getInstance()->query($userid == 0 && (int)$nUserID > 0 ?
"SELECT `strName` AS `name`,`strEmail` AS `email`, `strTel` AS `strTel` FROM `cl_hlusers`.`users` WHERE nUserID=" . (int)$nUserID . " LIMIT 1;" :
"SELECT `name`,`email` FROM `jml_users` WHERE id=" . (int)$userid . " LIMIT 1;");
$user = MySqlHelper::getInstance()->fetchAssoc();
$user = $user[0];
if (is_array($course) && count($course) && is_array($user) && count($user)) {
MySqlHelper::getInstance()->query("SELECT * FROM " . ($this->getLang() == 'hun' ? 'jml' : 'eng') . "_content WHERE id=" . (int)$course['email_template'] . " LIMIT 1;");
$tmpl = MySqlHelper::getInstance()->fetchAssoc();
$tmpl = $tmpl[0];
$mit = array('{NAME}', '{TITLE}', '{START_DATE}', '{START_TIME}', '{FINISH_DATE}', '{FINISH_TIME}', '{LOCATION}', '{ATTENDEES}', '{PRICE}', '{PRICE_TOTAL}', '{VAT}');
$mire = array(
$user['name'],
$course['title'],
($switch['kurzus'] === 'Y' && (int)$switch['level'] == 2 ? date("Y-m-d", _TIME_) : $course['start_date']),
($switch['kurzus'] === 'Y' && (int)$switch['level'] == 2 ? "" : $course['start_time']),
($switch['kurzus'] === 'Y' && (int)$switch['level'] == 2 ? date("Y-m-d", _TIME_ + (_LEASE_VALID_DAYS_ * 86400)) : $course['finish_date']),
($switch['kurzus'] === 'Y' && (int)$switch['level'] == 2 ? "" : $course['finish_time']),
$course['location'],
$app['attendees'],
$course['price'],
$app['price_total'],
$course['vat']
);
$msg = str_replace($mit, $mire, $tmpl['introtext'] . $tmpl['fulltext']);
if ($switch['esemeny'] == 'Y' && (in_array($switch['alias'], $this->customCourses))) {
$tel = substr($user['strTel'], 0, 1) == ';' ? substr($user['strTel'], 1) : $user['strTel'];
$msg = str_replace('{EMAIL}', $user['email'], $msg);
$msg = str_replace('{PHONE}', $tel, $msg);
}
$mail = new PHPMailer;
$mail->CharSet = 'UTF-8';
$mail->isSMTP();
$mail->Host = $mailconfig['Host'];
$mail->SMTPAuth = true;
$mail->Username = $mailconfig['Username'];
$mail->Password = $mailconfig['Password'];
$mail->SMTPSecure = $mailconfig['SMTPSecure'];
$mail->Port = $mailconfig['Port'];
$mail->isHTML(TRUE);
$mail->setFrom($mailconfig['from_hu']);
$mail->addAddress($user['email']);
//$mail->addBCC('zsolt.fekete@cadline.hu');
$mail->addBCC('info@cadline.hu');
if ($switch['esemeny'] == 'Y' && ($switch['alias'] == 'belter' || $switch['alias'] == 'd5-render' || $switch['alias'] == 'd5-render-alap' || $switch['alias'] == 'd5-render-3-0-ujdonsagok' || $switch['alias'] == 'interior' || $switch['alias'] == 'kulter' || $switch['alias'] == 'photoshop' || $switch['alias'] == 'd5-render-halado')) {
$mail->addCC('info@krisztinaharosi.it');
}
if ($switch['esemeny'] == 'Y' && ($switch['alias'] == 'aranyi-klaudia-kiviteli-terv-tanfolyam' || $switch['alias'] == 'aranyi-klaudia-kezdo-tanfolyam' || $switch['alias'] == 'aranyi-klaudia-halado-tanfolyam' || $switch['alias'] == 'aranyi-klaudia-teto-es-lepcso-szerkesztes-tanfolyam')) {
$mail->addCC('info@akdesign.hu');
}
if ($switch['esemeny'] == 'Y' && $switch['alias'] == 'ferenczi-eva-tanfolyam') {
$mail->addCC('eva@studiotrendinterior.com');
}
$mail->Subject = $tmpl['title'];
$mail->msgHTML($msg);
$mail->AltBody = strip_tags($msg);
$mail->send();
unset($mail);
return ($user['email']);
}
}
public function auth()
{
MySqlHelper::getInstance()->query("
(SELECT * FROM jml_session where session_id='" . trim(addslashes($_POST['sess'])) . "' LIMIT 1)
UNION
(SELECT * FROM eng_session where session_id='" . trim(addslashes($_POST['sess'])) . "' LIMIT 1);");
$sess = MySqlHelper::getInstance()->fetchAssoc();
return (count($sess) ? TRUE : FALSE);
}
public function getLang()
{
if (!isset($this->lang)) {
$this->lang = (strpos($_SERVER['HTTP_HOST'], ".com") ? "eng" : "hun");
}
return $this->lang;
}
} // end of class
$controller = new Controller();
$controller->run();
?>
<script type="text/javascript">
jQuery('#capacity_' + <?= (int)$_POST['course_id'] ?>).html("<?= (int)$_POST['capacity'] - ((int)$_POST['applications'] + (int)$_POST['attendees']) ?>");
jQuery('#gepigeny_' + <?= (int)$_POST['course_id'] ?>).html("<?= (int)$_POST['maxgepigeny'] - ((int)$_POST['gepigeny'] + (isset($_POST['gepet_kerek']) ? 1 : 0)) ?>");
jQuery('#reserved_' + <?= (int)$_POST['course_id'] ?>).css("display", "block");
<?php if (count($controller->passthrough) && $controller->passthrough[0]['price_total'] > 0 && trim($controller->passthrough[0]['pay_id']) > '') : ?>
jQuery('#paid_' + <?= (int)$_POST['course_id'] ?>).css("display", "block");
<?php endif; ?>
<?php if (count($controller->passthrough) && $controller->c['id'] != $controller->passthrough[0]['course_id']) : ?>
jQuery('#reserved_' + <?= $controller->passthrough[0]['course_id'] ?>).hide("fast");
jQuery('#paid_' + <?= $controller->passthrough[0]['course_id'] ?>).hide("fast");
<?php endif; ?>
jQuery('#btnReserve').removeClass('active').addClass('disabled');
jQuery('#lnkPay').removeClass('disabled').addClass('active');
jQuery('#lnkPay').attr("href", "https://pay.archline.hu/sale/workshop.php?transid=<?= $controller->transid ?>");
jQuery('#lnkPay2').attr("href", "https://pay.archline.hu/sale/workshop.php?transid=<?= $controller->transid ?>");
jQuery('#controlls').hide("fast");
jQuery('#trid_<?= (int)$_POST['course_id'] ?>').val('<?= $controller->transid ?>');
<?php if ((int)$controller->c['price'] > 0 && empty($controller->passthrough)) : ?>fizetesDialog();
<?php endif; ?>
</script>

View File

@ -0,0 +1,271 @@
<?php
require_once('BaseController.class.php');
require_once($_SERVER['DOCUMENT_ROOT'].'/maintenance/libraries/phpmailer/PHPMailerAutoload.php');
//error_reporting(E_ALL & ~E_NOTICE);
class Controller extends BaseController
{
public $transid='';
public $_LANG;
protected $lang;
protected $component='mod_alworkshops';
protected $arrLang=array('hun','eng');
protected $arrLC=array('hun'=>'hu-HU','eng'=>'en-GB');
protected $arrWebinarTopic=array('hun'=>336,'eng'=>333);
public function procEvent()
{
$message=array();
$nUserID=0;
if ($this->auth()==FALSE) die();
// nyelvi file betöltése
$this->lang=(isset($_POST['lang']) && in_array(trim(strtolower($_GET['lang'])),$this->arrLang) ? trim(strtolower($_GET['lang'])) : $this->getLang());
$this->_LANG=parse_ini_file($_SERVER['DOCUMENT_ROOT']."/language/".$this->arrLC[$this->lang]."/".$this->arrLC[$this->lang].".".$this->component.".ini");
// adott kurzus lekérdezése
MySqlHelper::getInstance()->query("SELECT * FROM alworkshops_courses WHERE published='Y' AND id=".(int)$_POST['course_id']." LIMIT 1;");
$course=MySqlHelper::getInstance()->fetchAssoc();
$course=$course[0];
// adott switch lekérdezése
MySqlHelper::getInstance()->query("SELECT * FROM alworkshops_switch WHERE alias='".$course['alias']."' LIMIT 1;");
$switch=MySqlHelper::getInstance()->fetchAssoc();
$switch=$switch[0];
// application adatok összeállítása
$this->transid=md5(time());
$app=array(
'course_id'=>(int)$_POST['course_id'],
'user_id'=>(int)$_POST['user_id'],
'attendees'=>(int)$_POST['attendees'],
'price_per_attendee'=>$course['price'],
'price_total'=>$course['price']*(int)$_POST['attendees'],
'price_vat'=>$course['vat'],
'gepet_kerek'=>(isset($_POST['gepet_kerek']) ? 'Y' : 'N'),
'berletem_van'=>(isset($_POST['berletem_van']) ? 'Y' : 'N'),
'date'=>date('Y-m-d H:i:s',time()),
'transaction_id'=>$this->transid,
'wsdatetime'=>(isset($_POST['datepicker']) ? trim(addslashes($_POST['datepicker'])) : NULL)
);
/**********************************************
* WEBINAIR SIGNUP
**********************************************/
if (isset($_POST['usr']) && isset($_POST['email']))
{
if (trim($_POST['usr'])=='') { print $this->_LANG['MOD_ARCHLINE_NAME_MISSING']; exit(); }
if (trim($_POST['email'])=='') { print $this->_LANG['MOD_ARCHLINE_EMAIL_MISSING']; exit(); }
if (!filter_var(trim($_POST['email']), FILTER_VALIDATE_EMAIL)) { print $this->_LANG['MOD_ARCHLINE_EMAIL_INVALID']; exit(); }
$_POST['country']=0;
if ((int)$_POST['prof']==0) { print $this->_LANG['MOD_ARCHLINE_PROF_MISSING']; exit(); }
if ($course['capacity']<(int)$_POST['applications']+(int)$_POST['attendees']) { print $this->_LANG['MOD_ARCHLINE_NOT_ENOUGHT_CAPACITY']; exit(); }
MySqlHelper::getInstance()->query("SELECT * FROM `cl_hlusers`.`u_emails` WHERE `email`='".trim(addslashes($_POST['email']))."' LIMIT 1;");
$exist=MySqlHelper::getInstance()->fetchAssoc();
if (!$exist)
{
// ha nincs a crm-ben user rekordja, akkor létrehozza
if (trim($_POST['usr'])>'' && trim($_POST['email'])>'')
{
MySqlHelper::getInstance()->insert("`cl_hlusers`.`users`",array(
'strName'=>trim(addslashes(ucwords($_POST['usr']))),
'strEMail'=>trim(addslashes($_POST['email'])),
'strTel'=>trim(addslashes($_POST['phone'])),
'nUserProf'=>(int)$_POST['prof'],
'nCtrID'=>(int)$_POST['country'],
'dateInsert'=>time(),
'old_db'=>'clusers_eng'));
$nUserID=MySqlHelper::getInstance()->getInsertedId();
MySqlHelper::getInstance()->insert("`cl_hlusers`.`u_emails`",array('email'=>trim(addslashes($_POST['email'])),'nUserID'=>$nUserID));
}
}
else
{
$nUserID=$exist[0]['nUserID'];
}
if ((int)$nUserID>0)
{
$nTopicID=($switch['esemeny']=='Y' ? 337 : $this->arrWebinarTopic[$this->lang]);
MySqlHelper::getInstance()->query("SELECT * FROM `www_archline_hu`.`alworkshops_application` WHERE `course_id`=".$course['id']." AND `email`='".trim(addslashes($_POST['email']))."' AND `published`='Y' LIMIT 1;");
$exist=MySqlHelper::getInstance()->fetchAssoc();
if (!$exist)
{
MySqlHelper::getInstance()->insert("`cl_hlusers`.`u_history`",array(
'nUserID'=>$nUserID,
'nTopicID'=>$nTopicID,
'dateEvent'=>$course['start_date'],
'strPlace'=>$course['title'],
'strInfo'=>'',
'nManagerID'=>36,
'insertDate'=>date("Y-m-d H:i:s",time()),
));
}
else
{
print $this->_LANG['MOD_ARCHLINE_ALREADY_EXIST']; exit();
}
// application rekord mentés
$app['name']=trim(addslashes(ucwords($_POST['usr'])));
$app['email']=trim(addslashes($_POST['email']));
MySqlHelper::getInstance()->insert('alworkshops_application',$app);
$newID=MySqlHelper::getInstance()->getInsertedId();
// level kuldes
$this->sendEmail($app['course_id'],0,$newID,$nUserID);
print $this->_LANG['MOD_ARCHLINE_SUCCESS'];
}
}
/**********************************************
* WORKSHOP SIGNUP
**********************************************/
if ((int)$_POST['user_id']>0 && !isset($_POST['usr']) && !isset($_POST['email']))
{
// user lekérdezése
MySqlHelper::getInstance()->query("SELECT * FROM `jml_users` WHERE id=".(int)$_POST['user_id']." LIMIT 1;");
$user=MySqlHelper::getInstance()->fetchAssoc();
$user=$user[0];
$tomb2=array(
'nUserID'=>$user['nUserID'],
'nTopicID'=>226,
'dateEvent'=>trim(addslashes($_POST['datepicker'])),
'strPlace'=>$course['title'],
'strInfo'=>trim("(web): ".$course['title']." ".$app['wsdatetime']),
'nManagerID'=>'36',
'insertDate'=>date('Y-m-d H:i:s',time()),
);
MySqlHelper::getInstance()->query("SELECT * FROM cl_hlusers.u_history WHERE nUserID=".$tomb2['nUserID']." AND dateEvent='".$tomb2['dateEvent']."' AND strInfo='".$tomb2['strInfo']."' LIMIT 1;");
$exist=MySqlHelper::getInstance()->fetchAssoc();
if (empty($exist))
{
MySqlHelper::getInstance()->insert("cl_hlusers.`u_history`",$tomb2);
MySqlHelper::getInstance()->query("SELECT * FROM cl_hlusers.users WHERE nUserID=".$user['nUserID']." LIMIT 1");
$crm=MySqlHelper::getInstance()->fetchAssoc();
if (!empty($crm)) // nUserStatus beallitas
{
if (in_array($crm[0]['nUserStatus'], array(-5,-4,-3,-2,-1,0,1,2,3,4,99)))
{
MySqlHelper::getInstance()->query("UPDATE cl_hlusers.users SET nUserStatus=5 WHERE nUserID=".$user['nUserID']." LIMIT 1;");
MySqlHelper::getInstance()->insert("cl_hlusers.`u_userstatus_history`", array(
'nUserID'=>$user['nUserID'],
'val'=>5,
'changeDate'=>date('Y-m-d H:i:s'),
'nManagerID'=>36,
));
}
}
}
MySqlHelper::getInstance()->query("SELECT * FROM alworkshops_application WHERE published='Y' AND user_id=".$app['user_id']." AND course_id=".$app['course_id']." LIMIT 1;");
$exist=MySqlHelper::getInstance()->fetchAssoc();
// hibaüzenetek; exit;
if (count($exist)) { $message[]=$this->_LANG['MOD_ARCHLINE_ALREADY_EXIST']; }
if (count($message)) { foreach ($message as $mess) { print $mess."<br />"; } exit(); }
// application rekord mentés
MySqlHelper::getInstance()->insert('alworkshops_application',$app);
$newID=MySqlHelper::getInstance()->getInsertedId();
// level kuldes
$this->sendEmail($app['course_id'],$app['user_id'],$newID);
print $this->_LANG['MOD_ARCHLINE_SUCCESS'];
}
}
public function sendEmail($courseid=0,$userid=0,$applicationID=0,$nUserID=0)
{
if ($courseid==0 || $applicationID==0) return (FALSE);
require_once($_SERVER['DOCUMENT_ROOT'].'/maintenance/config.mail.php');
MySqlHelper::getInstance()->query("SELECT * FROM alworkshops_application WHERE published='Y' AND id=".$applicationID." LIMIT 1;");
$app=MySqlHelper::getInstance()->fetchAssoc();
$app=$app[0];
MySqlHelper::getInstance()->query("SELECT * FROM alworkshops_courses WHERE published='Y' AND id=".$courseid." LIMIT 1;");
$course=MySqlHelper::getInstance()->fetchAssoc();
$course=$course[0];
$sql=($userid==0 && (int)$nUserID>0 ?
"SELECT `strName` AS `name`,`strEmail` AS `email` FROM `cl_hlusers`.`users` WHERE nUserID=".(int)$nUserID." LIMIT 1;" :
"SELECT `name`,`email` FROM `jml_users` WHERE id=".(int)$userid." LIMIT 1;");
MySqlHelper::getInstance()->query($sql);
$user=MySqlHelper::getInstance()->fetchAssoc();
$user=$user[0];
if (is_array($course) && count($course) && is_array($user) && count($user))
{
MySqlHelper::getInstance()->query("SELECT * FROM ".($this->getLang()=='hun' ? 'jml' : 'eng')."_content WHERE id=".(int)$course['email_template']." LIMIT 1;");
$tmpl=MySqlHelper::getInstance()->fetchAssoc();
$tmpl=$tmpl[0];
$mit=array('{NAME}','{TITLE}','{START_DATE}','{START_TIME}','{FINISH_DATE}','{FINISH_TIME}','{LOCATION}','{ATTENDEES}','{PRICE}','{PRICE_TOTAL}','{VAT}');
$mire=array($user['name'],$course['title'],$course['start_date'],$course['start_time'],$course['finish_date'],$course['finish_time'],$course['location'],$app['attendees'],$course['price'],$app['price_total'],$course['vat']);
$msg=str_replace($mit, $mire, $tmpl['introtext'].$tmpl['fulltext']);
$mail=new PHPMailer;
$mail->CharSet='UTF-8';
$mail->isSMTP();
$mail->Host = $mailconfig['Host'];
$mail->SMTPAuth = true;
$mail->Username = $mailconfig['Username'];
$mail->Password = $mailconfig['Password'];
$mail->SMTPSecure = $mailconfig['SMTPSecure'];
$mail->Port = $mailconfig['Port'];
$mail->isHTML(TRUE);
$mail->setFrom($mailconfig['from_hu']);
$mail->addAddress($user['email']);
$mail->addBCC('zsolt.fekete@cadline.hu');
$mail->addBCC('marketing@cadline.hu');
$mail->Subject=$tmpl['title'];
$mail->msgHTML($msg);
$mail->AltBody=strip_tags($msg);
$mail->send();
unset($mail);
return ($user['email']);
}
}
public function auth()
{
MySqlHelper::getInstance()->query("
SELECT * FROM jml_session where session_id='".trim(addslashes($_POST['sess']))."' LIMIT 1
UNION
SELECT * FROM eng_session where session_id='".trim(addslashes($_POST['sess']))."' LIMIT 1;");
$sess=MySqlHelper::getInstance()->fetchAssoc();
return(count($sess) ? TRUE : FALSE);
}
public function getLang()
{
if (!isset($this->lang)) { $this->lang=(strpos($_SERVER['HTTP_HOST'],".com") ? "eng" : "hun"); }
return $this->lang;
}
} // end of class
$controller=new Controller();
$controller->run();
?>
<script type="text/javascript">
<?php if ((int)$_POST['firstid']>0 && (int)$_POST['firstid']==(int)$_POST['course_id']) : ?>
jQuery('#kiemeltLetszam').html("<?=(int)$_POST['capacity']-((int)$_POST['applications']+(int)$_POST['attendees'])?>");
<?php endif; ?>
jQuery('#btnReserve').removeClass('active').addClass('disabled');
jQuery('#trid_<?=(int)$_POST['course_id']?>').val('<?=$controller->transid?>');
</script>

View File

@ -0,0 +1,10 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<a href="http://xdsoft.net/joomla/module_generator/">Joomla Module Generator</a>
</body>
</html>

View File

@ -0,0 +1,10 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<a href="http://xdsoft.net/joomla/module_generator/">Joomla Module Generator</a>
</body>
</html>

View File

@ -0,0 +1,41 @@
#alworshopContainer {
background-color: #2D3036;
padding: 10px;
}
#alworshopContainer h3,
#alworshopContainer td,
#alworshopContainer span {
color: #FFFFF0;
}
#alworshopContainer label,
#alworshopContainer div,
#alworshopContainer span,
#alworshopContainer p {
color: #fffff0;
}
#alworshopContainer .sppb-btn {
font-weight: bold;
}
#alworshopContainer hr {
margin: 5px 0px 5px 0px;
}
#alworshopContainer h3 {
margin: 10px 0px 10px 0px;
}
#alworshopContainer .figyelmeztet {
color: #FFFF00;
}
#alworshopContainer .vastag {
font-weight: bold;
}
#alworshopContainer .kattintos {
cursor: pointer;
}

View File

@ -0,0 +1,10 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<a href="http://xdsoft.net/joomla/module_generator/">Joomla Module Generator</a>
</body>
</html>

View File

@ -0,0 +1,10 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<a href="http://xdsoft.net/joomla/module_generator/">Joomla Module Generator</a>
</body>
</html>

View File

@ -0,0 +1,19 @@
#alworshopContainer { background-color:#2D3036;padding:10px; }
#alworshopContainer h3, #alworshopContainer td, #alworshopContainer span { color:#FFFFF0; }
#alworshopContainer label,#alworshopContainer div,#alworshopContainer span,#alworshopContainer p {color:#fffff0;}
#alworshopContainer .sppb-btn { font-weight:bold; }
#alworshopContainer hr {margin:5px 0px 5px 0px;}
#alworshopContainer h3 {margin:10px 0px 10px 0px;}
#alworshopContainer .figyelmeztet {color: #FFFF00; }
#alworshopContainer .vastag {font-weight:bold;}
#alworshopContainer .kattintos {cursor:pointer;}
.alworshopContainer { background-color:#2D3036;padding:10px; }
.alworshopContainer h3, #alworshopContainer td, #alworshopContainer span { color:#FFFFF0; }
.alworshopContainer label,#alworshopContainer div,#alworshopContainer span,#alworshopContainer p {color:#fffff0;}
.alworshopContainer .sppb-btn { font-weight:bold; }
.alworshopContainer hr {margin:5px 0px 5px 0px;}
.alworshopContainer h3 {margin:10px 0px 10px 0px;}
.alworshopContainer .figyelmeztet {color: #FFFF00; }
.alworshopContainer .vastag {font-weight:bold;}
.alworshopContainer .kattintos {cursor:pointer;}

View File

@ -0,0 +1,531 @@
<?php
defined('_JEXEC') or die;
class ModAlworkshopsHelper
{
public static function getSwitch($alias = '')
{
$db = JFactory::getDbo();
$db->setQuery("SELECT * FROM alworkshops_switch where alias = '{$alias}' LIMIT 1;");
$result = $db->loadObjectList();
return (count($result) ? $result[0] : FALSE);
}
public static function getLevelString($level)
{
switch ($level) {
case 1:
return 'Alapfokú tanfolyam';
break;
case 2:
return 'Középfokú tanfolyam';
break;
case 3:
return 'Felsőfokú tanfolyam';
break;
default:
return '';
break;
}
}
public static function getWorkshops($alias = '', $start_date = '', $finish_date = '')
{
$limit = $alias == 'archline-konzultacio' ? 15 : 4;
$result = array();
if ($alias > '') {
$db = JFactory::getDbo();
$db->setQuery("SELECT `id`, `alias`, `title`, `start_date`, `start_time`, `finish_date`, `finish_time`, `capacity`, `price`, `location`,
(SELECT SUM(attendees) AS applications FROM alworkshops_application WHERE published = 'Y' AND course_id = alworkshops_courses.id) AS applications,
(SELECT SUM(IF(gepet_kerek = 'Y', 1, 0)) AS gepigeny FROM alworkshops_application WHERE published = 'Y' AND course_id = alworkshops_courses.id) AS gepigeny
FROM alworkshops_courses
WHERE published = 'Y' AND alias LIKE '{$alias}%' AND
start_date >= " . ($start_date > '' ? "'" . $start_date . "'" : "CURRENT_DATE") . " " . ($finish_date > '' ? " AND `finish_date`<='" . $finish_date . "'" : '') . "
ORDER BY start_date,start_time LIMIT " . $limit . ";");
$result = $db->loadObjectList();
}
return (count($result) ? $result : FALSE);
}
public static function getOnlineSessions($id)
{
$result = array();
$db = JFactory::getDbo();
$db->setQuery("SELECT SUBSTRING(s.session_date, 3) AS session_date, s.title, SUBSTRING(s.start_time, 1, CHAR_LENGTH(s.start_time) - 3) AS start_time,
SUBSTRING(s.finish_time, 1, CHAR_LENGTH(s.finish_time) - 3) AS finish_time
FROM alworkshops_online_sessions s
WHERE s.courseid = {$id} AND s.published = 'Y' ORDER BY s.session_date ASC;");
$result = $db->loadObjectList();
return (count($result) ? $result : FALSE);
}
public static function getWorkshopsByGroup($alias = '')
{
$result = array();
if ($alias > '') {
$db = JFactory::getDbo();
$db->setQuery("SELECT c.*
FROM alworkshops_courses c
LEFT OUTER JOIN alworkshops_switch s ON s.alias = c.alias
WHERE c.published = 'Y' AND s.alias2 = '{$alias}';");
$result = $db->loadObjectList();
}
return (count($result) ? $result : FALSE);
}
public static function getCourses($alias = '', $date = '')
{
$result = array();
if ($alias > '') {
$db = JFactory::getDbo();
$db->setQuery("SELECT id, `alias`, `title`, `start_date`, `start_time`, `finish_date`, `finish_time`, `capacity`, `price`, `location`,
(SELECT SUM(attendees) AS applications FROM alworkshops_application WHERE published='Y' AND course_id=alworkshops_courses.id) AS applications,
(SELECT SUM(IF(gepet_kerek='Y',1,0)) AS gepigeny FROM alworkshops_application WHERE published='Y' AND course_id=alworkshops_courses.id) AS gepigeny
FROM alworkshops_courses
WHERE published = 'Y' AND start_date <= '{$date}' and finish_date >= '{$date}' AND alias LIKE '{$alias}%'
ORDER BY start_date;");
$result = $db->loadObjectList();
}
return (count($result) ? $result : FALSE);
}
public static function getCourse($alias = '')
{
$switch = self::getSwitch($alias);
$limit = $switch->alias == 'archline-konzultacio' ? 10 : 4;
$date = date('Y-m-d');
$db = JFactory::getDbo();
$db->setQuery("SELECT `course_level`, `id`, `alias`, `title`, `start_date`, `start_time`, `finish_date`, `finish_time`, `capacity`, `price`, `location`, " . ($switch->comment === 'Y' ? "`comment`," : "") . "
(SELECT SUM(attendees) AS applications FROM alworkshops_application WHERE published='Y' AND course_id=alworkshops_courses.id) AS applications,
(SELECT SUM(IF(gepet_kerek='Y',1,0)) AS gepigeny FROM alworkshops_application WHERE published='Y' AND course_id=alworkshops_courses.id) AS gepigeny
FROM alworkshops_courses
WHERE published = 'Y' AND finish_date >= '{$date}' AND alias LIKE '{$alias}%'
ORDER BY start_date LIMIT {$limit};");
$kurzusok = $db->loadObjectList();
if (is_array($kurzusok) && count($kurzusok) && $switch->webinair == 'N' && $switch->esemeny == 'N') {
foreach ($kurzusok as $kurzus) {
$felt = "";
if ($switch->alias2 > '' || $switch->alias3 > '' || $switch->alias4 > '' || $switch->alias5 > '' || $switch->alias6 > '') {
$felt .= " AND (0 " . ($switch->alias2 > '' ? " OR alias LIKE '" . $switch->alias2 . "%'" : "") . "
" . ($switch->alias3 > '' ? " OR alias LIKE '" . $switch->alias3 . "%'" : "") . "
" . ($switch->alias4 > '' ? " OR alias LIKE '" . $switch->alias4 . "%'" : "") . "
" . ($switch->alias5 > '' ? " OR alias LIKE '" . $switch->alias5 . "%'" : "") . "
" . ($switch->alias6 > '' ? " OR alias LIKE '" . $switch->alias6 . "%'" : "") . " ) ";
}
$sql = "SELECT id, `alias`, `title`, `start_date`, `start_time`, `finish_date`, `finish_time`, `capacity`, `price`, `location`,
(SELECT SUM(attendees) AS applications FROM alworkshops_application WHERE published = 'Y' AND course_id = alworkshops_courses.id) AS applications,
(SELECT SUM(IF(gepet_kerek = 'Y', 1, 0)) AS gepigeny FROM alworkshops_application WHERE published = 'Y' AND course_id = alworkshops_courses.id) AS gepigeny
FROM alworkshops_courses
WHERE published = 'Y' AND start_date >= '{$kurzus->start_date}' AND finish_date <= '{$kurzus->finish_date}' AND
alias NOT LIKE '{$alias}%' " . $felt . "
ORDER BY start_date,start_time";
$db->setQuery($sql);
$workshopok = $db->loadObjectList();
if (count($workshopok)) {
$maxCapacity = $kurzus->capacity;
$app = $kurzus->applications;
$gep = $kurzus->gepigeny;
foreach ($workshopok as $ws) {
$tmp = $kurzus->applications + $ws->applications;
if ($tmp > $app) $app = $tmp;
$tmp = $kurzus->gepigeny + $ws->gepigeny;
if ($tmp > $gep) $gep = $tmp;
}
$kurzus->applications = $app;
$kurzus->gepigeny = $gep;
if ($kurzus->applications > $maxCapacity) $kurzus->applications = $maxCapacity;
if ($kurzus->gepigeny > _MAX_COMPUTERSTATION_) $kurzus->gepigeny = _MAX_COMPUTERSTATION_;
}
}
}
return ($kurzusok);
}
public static function getOtherWorkshops($level = 0, $except = 0)
{
if ((int)$level == 0) return;
$db = JFactory::getDbo();
$db->setQuery("SELECT * FROM alworkshops_switch WHERE 1 " . ((int)$except > 0 ? " AND `id` != " . (int)$except : "") . " AND `workshop` = 'Y' AND `level` = {$level} AND `tanfsor` > 0 ORDER BY tanfsor ASC;");
$result = $db->loadObjectList();
return (count($result) ? $result : FALSE);
}
public static function getSessions($id = 0)
{
if ((int)$id == 0) return;
$db = JFactory::getDbo();
$db->setQuery("SELECT * FROM alworkshops_sessions WHERE published = 'Y' AND courseid = {$id} ORDER BY ordering;");
$result = $db->loadObjectList();
return (count($result) ? $result : FALSE);
}
public static function getAppSign($courseid = 0)
{
$user = JFactory::getUser();
if ($user->id == 0 || $courseid == 0) return false;
$db = JFactory::getDbo();
$db->setQuery("SELECT * FROM alworkshops_application WHERE published = 'Y' AND user_id = {$user->id} AND course_id = {$courseid} LIMIT 1;");
$result = $db->loadObjectList();
return (count($result) ? TRUE : FALSE);
}
public static function getApplication($user_id = 0, $courseid = 0)
{
if ($user_id == 0 || $courseid == 0) return (0);
$db = JFactory::getDbo();
$db->setQuery("SELECT * FROM alworkshops_application WHERE published = 'Y' AND user_id = {$user_id} AND course_id = {$courseid} LIMIT 1;");
$result = $db->loadObjectList();
return (count($result) ? $result[0] : FALSE);
}
public static function getTCEUserGroup()
{
$db = JFactory::getDbo();
$user = JFactory::getUser();
$tceUser = FALSE;
$db->setQuery("SELECT * FROM `tcexam`.`tce_users` WHERE `user_email`='" . trim($user->email) . "' LIMIT 1;");
$tceUser = $db->loadObjectList();
if (empty($tceUser)) return false;
$tceUser = $tceUser[0];
$db->setQuery("SELECT * FROM `tcexam`.`tce_usrgroups` WHERE usrgrp_user_id = {$tceUser->user_id}");
$userGroup = $db->loadObjectList();
return $userGroup[0];
}
public static function setTCEUser($group_id = 0)
{
if ((int)$group_id == 0) return false;
$db = JFactory::getDbo();
$user = JFactory::getUser();
$tceUser = FALSE;
if ((int)$user->id > 0) {
$db->setQuery("SELECT * FROM `tcexam`.`tce_users` WHERE `user_email`='" . trim($user->email) . "' LIMIT 1;");
$tceUser = $db->loadObjectList();
if (!count($tceUser)) { // ha nincs meg a user, akkor létre kell hozni
$pos = strpos($user->name, " ");
$tomb = array(
'user_name' => $user->email,
'user_email' => $user->email,
'user_regdate' => date('Y-m-d H:i:s', time()),
'user_ip' => $_SERVER['REMOTE_ADDR'],
'user_firstname' => ($pos ? trim(substr($user->name, $pos)) : $user->name),
'user_lastname' => ($pos ? trim(substr($user->name, 0, $pos)) : ''),
'user_regnumber' => $user->nUserID,
'user_level' => 3
);
foreach ($tomb as $v) $values[] = (is_null($v) ? 'NULL' : $db->quote($v));
$query = $db->getQuery(true);
$query->insert('`tcexam`.`tce_users`')->columns($db->quoteName(array_keys($tomb)))->values(implode(',', $values));
$db->setQuery($query);
$db->execute();
$db->setQuery("SELECT * FROM `tcexam`.`tce_users` WHERE `user_email`='" . trim($user->email) . "' LIMIT 1;");
$tceUser = $db->loadObjectList();
}
// ha megvan a user, akkor csak a pwdt és groupot kell megcsinálni
$tceUser = $tceUser[0];
$tceUser->password = substr(md5(uniqid(mt_rand(), true)), 0, 8); // olvasható, random 8 karakteres jelszó
$tceUser->user_password = md5($tceUser->password); // titkosított, adatbázisba elmentett string
$db->setQuery("UPDATE `tcexam`.`tce_users` SET `user_password` = '{$tceUser->user_password}', `user_verifycode` = NULL WHERE user_id = {$tceUser->user_id} LIMIT 1;");
$db->execute();
$db->setQuery("DELETE FROM `tcexam`.`tce_usrgroups` WHERE usrgrp_user_id = {$tceUser->user_id};");
$db->execute();
// a group besorolást minden esetben meg kell csinálni
$db->setQuery("INSERT INTO `tcexam`.`tce_usrgroups` SET usrgrp_user_id = {$tceUser->user_id}, usrgrp_group_id = {$group_id};");
$db->execute();
}
return ($tceUser);
}
public static function getValidLease($level = 0)
{
$nTopicID = 0;
$lease = FALSE;
$db = JFactory::getDbo();
$user = JFactory::getUser();
switch ((int)$level) {
case 1: {
$nTopicID = _COURSE_PRICE_PRELIMINARY_;
break;
}
case 2: {
$nTopicID = _COURSE_PRICE_INTERMEDIATE_;
break;
}
}
if ((int)$user->id == 0 || (int)$level == 0 || (int)$nTopicID == 0) return false;
$db->setQuery("SELECT *,`dateEvent` AS `validFrom`,DATE_ADD(`dateEvent`, INTERVAL " . _LEASE_VALID_DAYS_ . " DAY) AS validThrough FROM `cl_hlusers`.`u_history` WHERE `nUserID` = {$user->nUserID} AND `nTopicID` = {$nTopicID} AND DATE_ADD(`dateEvent`, INTERVAL " . _LEASE_VALID_DAYS_ . " DAY)>='" . date('Y-m-d', time()) . "' ORDER BY nEventID DESC LIMIT 1;");
$lease = $db->loadObjectList();
return (($lease && count($lease)) ? $lease[0] : FALSE);
}
public function getLastWorkshop($level = 0)
{
$db = JFactory::getDbo();
$user = JFactory::getUser();
if ((int)$user->id == 0 || (int)$level == 0) return false;
$db->setQuery("SELECT MAX(c.`start_date`) AS lastDate,DATE_ADD(MAX(c.`start_date`), INTERVAL 1 DAY) AS nextDay
FROM www_archline_hu.alworkshops_application a
LEFT OUTER JOIN www_archline_hu.alworkshops_courses c ON c.id = a.course_id
LEFT OUTER JOIN www_archline_hu.alworkshops_switch s ON s.alias = c.alias
WHERE s.`workshop` = 'Y' AND s.`level` = {$level} AND user_id = {$user->id};");
$lastWorkshop = $db->loadObjectList();
return (($lastWorkshop && count($lastWorkshop)) ? $lastWorkshop[0] : FALSE);
}
public static function getWorkshopApplications($userid = 0, $switchid = 0)
{
if ((int)$userid === 0) return (array());
$db = JFactory::getDbo();
$db->setQuery("SELECT c.id as course_id, c.alias, c.start_date, c.finish_date, s.workshop, s.kurzus,
IF(sess.switchid IS NULL, s.id, sess.switchid) AS switchid,
IF(sess.session_date IS NULL, c.start_date, sess.session_date) AS session_date,
IF(sess.description IS NULL,c.title,sess.description) AS description
FROM www_archline_hu.alworkshops_courses c
LEFT OUTER JOIN www_archline_hu.alworkshops_switch s ON c.alias = s.alias
LEFT OUTER JOIN www_archline_hu.alworkshops_sessions sess ON c.id = sess.courseid
WHERE " . ((int)$switchid > 0 ? " (s.id=" . (int)$switchid . " OR sess.switchid = " . (int)$switchid . ") AND " : "") . "
c.id IN (SELECT course_id FROM www_archline_hu.alworkshops_application WHERE user_id = " . (int)$userid . " AND published = 'Y');");
$result = $db->loadObjectList();
return (count($result) ? $result : array());
}
public static function getCourseParts($level = 0, $field = 'alias')
{
if ((int)$level === 0) return (array());
$result = array();
$db = JFactory::getDbo();
$db->setQuery("SELECT " . $field . " FROM `www_archline_hu`.`alworkshops_switch` WHERE `level` = {$level} AND `workshop` = 'Y' AND `tanfsor` > 0;");
$res = $db->loadObjectList();
if (count($res)) {
foreach ($res as $sor) $result[$sor->$field] = 0;
}
return (count($result) ? $result : array());
}
public static function getCertificate($level, $nUserID)
{
if ($level == 2)
$topicID = 354;
else
return false;
$query = "SELECT nEventID FROM cl_hlusers.u_history where nUserID = {$nUserID} AND nTopicID = {$topicID}";
$db = JFactory::getDbo();
$db->setQuery($query);
$res = $db->loadObjectList();
return !empty($res);
}
public function getOnlineExamPermit($level = 0)
{
$user = JFactory::getUser();
if ((int)$user->id == 0 || (int)$level <= 0) return false;
if ((int)$level == 1) return true;
$prev_level = $level == 4 ? $level - 2 : $level - 1;
$query = "SELECT *
FROM www_archline_hu.alworkshops_application a
LEFT JOIN www_archline_hu.alworkshops_courses c ON c.id = a.course_id
LEFT JOIN www_archline_hu.alworkshops_switch s ON s.alias = c.alias
WHERE a.user_id = {$user->id} AND s.vizsga = 'Y' AND s.level = {$prev_level} AND a.published = 'Y' LIMIT 1";
$db = JFactory::getDbo();
$db->setQuery($query);
$res = $db->loadObjectList();
if (!empty($res)) return true;
if (empty($res) && $level == '4') {
$query = "SELECT *
FROM cl_hlusers.u_history t
WHERE t.nUserID = {$user->nUserID} AND t.nTopicID = 373 LIMIT 1";
$db = JFactory::getDbo();
$db->setQuery($query);
$res = $db->loadObjectList();
if (!empty($res)) return true;
}
if (empty($res) && $level == 4) {
$query2 = "SELECT * FROM cl_hlusers.u_history
WHERE strInfo LIKE '%Felsőfokú vizsga Oktatói minősítéssel%'
AND nUserID = '{$user->nUserID}'";
$db = JFactory::getDbo();
$db->setQuery($query2);
$res2 = $db->loadObjectList();
if (!empty($res2)) return true;
}
if (self::getCertificate($level, $user->nUserID))
return true;
return false;
}
public function getExamPermit($level = 0)
{
$user = JFactory::getUser();
if ((int)$user->id == 0 || (int)$level <= 0) return false;
if ((int)$level < 3) {
$wsApps = self::getWorkshopApplications((int)$user->id);
$courseParts = self::getCourseParts((int)$level, "id");
if (count($wsApps) == 0 || count($courseParts) == 0) return false;
foreach ($wsApps as $wsApp) $courseParts[$wsApp->switchid]++;
foreach ($courseParts as $switchid => $wscount) {
if ($wscount == 0) return false;
}
}
return (TRUE);
}
public function getExamLogin($level = 0)
{
if ((int)$level <= 0) return false;
$examResults = self::getExamResults();
switch ($level) {
case 1: {
$vizsga_dij = (int)$examResults->alap_vizsga_dij;
$sikeres = (int)$examResults->alap_vizsga_sikeres;
$sikertelen = (int)$examResults->alap_vizsga_sikertelen;
break;
}
case 2: {
$vizsga_dij = (int)$examResults->kozep_vizsga_dij;
$sikeres = (int)$examResults->kozep_vizsga_sikeres;
$sikertelen = (int)$examResults->kozep_vizsga_sikertelen;
break;
}
case 3: {
$vizsga_dij = (int)$examResults->oktatoi_vizsga_dij;
$sikeres = (int)$examResults->oktatoi_vizsga_sikeres;
$sikertelen = (int)$examResults->oktatoi_vizsga_sikertelen;
break;
}
case 4: {
$vizsga_dij = (int)$examResults->oktatoi_vizsga_dij;
$sikeres = (int)$examResults->oktatoi_vizsga_sikeres;
$sikertelen = (int)$examResults->oktatoi_vizsga_sikertelen;
break;
}
}
if (($level == 3 || $level == 4) && $vizsga_dij == 0) return true;
if ($vizsga_dij == 0) return false;
if ($sikeres + $sikeretelen >= $vizsga_dij * _EXAM_RETRY_) return false;
return true;
}
public static function payed($courseid)
{
$db = JFactory::getDbo();
$user = JFactory::getUser();
$userID = (int)$user->id;
$db->setQuery("SELECT * FROM www_archline_hu.alworkshops_application where course_id = {$courseid} AND user_id = {$userID} AND pay_id != '' LIMIT 1;");
$result = $db->loadObjectList();
return count($result) > 0;
}
public static function getExamResults()
{
$db = JFactory::getDbo();
$user = JFactory::getUser();
if ((int)$user->id == 0 || (int)$user->id == 0) return false;
$db->setQuery("SELECT
(SELECT MAX(datePaydate) FROM `cl_hlusers`.`u_history` WHERE nTopicID=" . _COURSE_EXAM_PRICE_PRELIMINARY_ . " AND nUserID=" . (int)$user->nUserID . ") AS `alap_vizsga_dij_utolso`,
(SELECT COUNT(*) FROM `cl_hlusers`.`u_history` WHERE nTopicID=" . _COURSE_EXAM_PRICE_PRELIMINARY_ . " AND nUserID=" . (int)$user->nUserID . ") AS `alap_vizsga_dij`,
(SELECT COUNT(*) FROM `cl_hlusers`.`u_history` WHERE nTopicID=" . _EXAM_PRELIMINARY_ . " AND nUserID=" . (int)$user->nUserID . ") AS `alap_vizsga_sikeres`,
(SELECT COUNT(*) FROM `cl_hlusers`.`u_history` WHERE nTopicID=" . _EXAM_FAIL_PRELIMINARY_ . " AND nUserID=" . (int)$user->nUserID . ") AS `alap_vizsga_sikertelen`,
(SELECT COUNT(*) FROM `cl_hlusers`.`u_history` WHERE nTopicID=" . _DIPLOMA_PRELIMINARY_ . " AND nUserID=" . (int)$user->nUserID . ") AS `alap_oklevel`,
(SELECT MAX(datePaydate) FROM `cl_hlusers`.`u_history` WHERE nTopicID=" . _COURSE_EXAM_PRICE_INTERMEDIATE_ . " AND nUserID=" . (int)$user->nUserID . ") AS `kozep_vizsga_dij_utolso`,
(SELECT COUNT(*) FROM `cl_hlusers`.`u_history` WHERE nTopicID=" . _COURSE_EXAM_PRICE_INTERMEDIATE_ . " AND nUserID=" . (int)$user->nUserID . ") AS `kozep_vizsga_dij`,
(SELECT COUNT(*) FROM `cl_hlusers`.`u_history` WHERE nTopicID=" . _EXAM_INTERMEDIATE_ . " AND nUserID=" . (int)$user->nUserID . ") AS `kozep_vizsga_sikeres`,
(SELECT COUNT(*) FROM `cl_hlusers`.`u_history` WHERE nTopicID=" . _EXAM_FAIL_INTERMEDIATE_ . " AND nUserID=" . (int)$user->nUserID . ") AS `kozep_vizsga_sikertelen`,
(SELECT COUNT(*) FROM `cl_hlusers`.`u_history` WHERE nTopicID=" . _DIPLOMA_INTERMEDIATE_ . " AND nUserID=" . (int)$user->nUserID . ") AS `kozep_oklevel`,
(SELECT MAX(datePaydate) FROM `cl_hlusers`.`u_history` WHERE nTopicID=" . _TUTOR_EXAM_PRICE_ . " AND nUserID=" . (int)$user->nUserID . ") AS `oktatoi_vizsga_dij_utolso`,
(SELECT COUNT(*) FROM `cl_hlusers`.`u_history` WHERE nTopicID=" . _TUTOR_EXAM_PRICE_ . " AND nUserID=" . (int)$user->nUserID . ") AS `oktatoi_vizsga_dij`,
(SELECT COUNT(*) FROM `cl_hlusers`.`u_history` WHERE nTopicID=" . _TUTOR_EXAM_ . " AND nUserID=" . (int)$user->nUserID . ") AS `oktatoi_vizsga_sikeres`,
(SELECT COUNT(*) FROM `cl_hlusers`.`u_history` WHERE nTopicID=" . _TUTOR_EXAM_FAIL_ . " AND nUserID=" . (int)$user->nUserID . ") AS `oktatoi_vizsga_sikertelen`;");
$result = $db->loadObjectList();
return (count($result) ? $result[0] : array());
}
public static function getDayName($date)
{
if (self::getLang() == 'hun') {
$dayOfWeek = date('w', strtotime($date));
switch ($dayOfWeek) {
case 6:
return 'Szombat';
case 0:
return 'Vasárnap';
case 1:
return 'Hétfő';
case 2:
return 'Kedd';
case 3:
return 'Szerda';
case 4:
return 'Csütörtök';
case 5:
return 'Péntek';
default:
return '';
}
} else
return date('l', strtotime($date));
}
public static function getLang()
{
return (JFactory::getLanguage()->getTag() == 'hu-HU' ? "hun" : "eng");
}
}

View File

@ -0,0 +1,212 @@
<?php
include($_SERVER['DOCUMENT_ROOT']."/components/com_mightysites/configuration/default.php");
class MySqlHelper
{
public static $msh;
private $host;
private $name;
private $user;
private $pass;
private $connection;
private $queryString;
private $queryResult;
public function __construct()
{
$this->config=New JConfig();
$this->connection=false;
$this->host='';
$this->user='';
$this->pass='';
$this->name='';
}
public static function getInstance()
{
if(!empty(self::$msh)) return self::$msh;
self::$msh=new MySqlHelper();
self::$msh->init();
return self::$msh;
}
public function init($host="", $name="", $user="", $pass="")
{
$this->host=($host>"" ? $host : $this->config->host);
$this->name=($name>"" ? $name : $this->config->db);
$this->user=($user>"" ? $user : $this->config->user);
$this->pass=($pass>"" ? $pass : $this->config->password);
}
private function connect()
{
if($this->connection) return;
$this->connection=mysqli_connect($this->host, $this->user, $this->pass);
if(false===$this->connection) throw new Exception('Can\'t connect to db');
mysqli_select_db($this->connection,$this->name);
mysqli_query($this->connection, 'SET CHARACTER SET UTF8');
mysqli_query($this->connection, 'SET NAMES \'UTF8\' ');
mysqli_set_charset($this->connection, 'utf8');
if(mysqli_error($this->connection)) throw new Exception(mysql_error($this->connection));
}
public function query($query) {
$this->connect();
$this->queryString=$query;
$this->queryResult=mysqli_query($this->connection, $query);
if(mysqli_error($this->connection)) throw new Exception(mysqli_error($this->connection).' Query: '.$this->queryString);
}
public function fetchNext() {
$back=array();
if($row=mysqli_fetch_assoc($this->queryResult)) {
foreach($row as $key => $value) {
$row[$key]=stripslashes($value);
}
$back=$row;
return $back;
}
return false;
}
public function fetchAssoc() {
$back=array();
while($row=mysqli_fetch_assoc($this->queryResult)) {
foreach($row as $key => $value) {
$row[$key]=stripslashes($value);
}
$back[]=$row;
}
return $back;
}
public function getInsertedId() {
return mysqli_insert_id($this->connection);
}
public function select($table, $where=false, $offset=false, $limit=false, $order=false) {
$whereStr='';
$limitStr='';
$orderStr='';
if(is_array($where)) $whereStr='WHERE '.$this->whereMakerPriv($where);
elseif($where) $whereStr='WHERE '.$where;
if(($offset!==false and $offset!==null)&&($limit!==false and $limit!==null)) {
$limitStr='LIMIT '.$offset.', '.$limit;
}
if(is_array($order)) {
$orderStr='ORDER BY ';
foreach($order as $key => $value) {
$orderStr.=$key.' '.$value.' ';
}
}
elseif($order) $orderStr='ORDER BY '.$order;
return $this->query('SELECT * FROM '.$table.' '.$whereStr.' '.$orderStr.' '.$limitStr);
}
public function getProp($table, $func, $field, $where=false) {
$whereStr='';
if(is_array($where)) $whereStr='WHERE '.$this->whereMakerPriv($where);
elseif($where) $whereStr='WHERE '.$where;
$this->query('SELECT '.$func.'('.$field.') as p FROM '.$table.' '.$whereStr);
$arr=$this->fetchAssoc();
return $arr[0]['p'];
}
public function getCount($table, $field='id', $where=false) {
return $this->getProp($table, 'COUNT', $field, $where);
}
public function getSum($table, $field='id', $where=false) {
return $this->getProp($table, 'SUM', $field, $where);
}
public function getAvg($table, $field='id', $where=false) {
return $this->getProp($table, 'AVG', $field, $where);
}
public function delete($table, $where=false) {
$whereStr='';
if(is_array($where)) $whereStr='WHERE '.$this->whereMakerPriv($where);
elseif($where) $whereStr='WHERE '.$where;
return $this->query('DELETE FROM '.$table.' '.$whereStr);
}
public function update($table, $infoArr, $where=false) {
if(!is_array($infoArr)) {
return false;
}
$whereStr='';
$dataArr=array();
$data='';
if(is_array($where)) $whereStr='WHERE '.$this->whereMakerPriv($where);
elseif($where) $whereStr='WHERE '.$where;
foreach($infoArr as $key => $value) {
$dataArr[]='`'.$key.'`="'.mysqli_real_escape_string($this->connection, $value).'" ';
}
$data=implode(',',$dataArr);
return $this->query('UPDATE '.$table.' SET '.$data.' '.$whereStr);
}
public function insert($table, $infoArr) {
$this->connect();
$columArr=array();
$valueArr=array();
$colums='';
$values='';
foreach($infoArr as $key => $value) {
$columArr[]='`'.$key.'`';
$valueArr[]='"'.mysqli_real_escape_string($this->connection, $value).'"';
}
$colums=implode(',',$columArr);
$values=implode(',', $valueArr);
return $this->query('INSERT INTO '.$table.' ('.$colums.') VALUES ('.$values.')');
}
public function affectedRows() {
return mysqli_affected_rows($this->connection);
}
public function whereMakerPriv($where) {
if(!is_array($where)) return 1;
$this->connect();
$back='1 ';
foreach($where as $key=>$value) {
if(is_array($value)) $back.='AND `'.$key.'`'.$value[0].'"'.$value[1].'" ';
else $back.='AND `'.$key.'`="'.mysqli_real_escape_string($this->connection, $value).'" ';
}
return $back;
}
public static function whereMaker($where) {
if(!is_array($where)) return 1;
$back='1 ';
foreach($where as $key=>$value) {
if(is_array($value)) $back.='AND `'.$key.'`'.$value[0].'"'.$value[1].'" ';
else $back.='AND `'.$key.'`="'.$value.'" ';
}
return $back;
}
}
?>

View File

@ -0,0 +1,10 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<a href="http://xdsoft.net/joomla/module_generator/">Joomla Module Generator</a>
</body>
</html>

View File

@ -0,0 +1,2 @@
MOD_ARCHLINE_WORKSHOPS="ARCHLine Workshops"
MOD__P_FRONT_ENDEN_MEGJELENITI_A="<p>Front-enden megjeleníti a workshop időpontokat</p>"

View File

@ -0,0 +1,2 @@
MOD_ARCHLINE_WORKSHOPS="ARCHLine Workshops"
MOD__P_FRONT_ENDEN_MEGJELENITI_A="<p>Front-enden megjeleníti a workshop időpontokat</p>"

View File

@ -0,0 +1,4 @@
MOD_ARCHLINE_WORKSHOPS="ARCHLine Workshops"
MOD__P_FRONT_ENDEN_MEGJELENITI_A="<p>Front-enden megjeleníti a workshop időpontokat</p>"
MOD_ARCHLINE_NEXT="Következő időpont"
MOD_ARCHLINE_MY_APPLICATIONS="Jelentkezéseim"

View File

@ -0,0 +1,2 @@
MOD_ARCHLINE_WORKSHOPS="ARCHLine Workshops"
MOD__P_FRONT_ENDEN_MEGJELENITI_A="<p>Front-enden megjeleníti a workshop időpontokat</p>"

View File

@ -0,0 +1,51 @@
<?php
error_reporting(E_ERROR | E_PARSE);
defined('_JEXEC') or die;
require_once($_SERVER['DOCUMENT_ROOT'] . '/maintenance/config.course.php');
require_once __DIR__ . '/helper.php'; // Include the ALWorkshops functions only once
$doc = JFactory::getDocument(); // Include assets
$doc->addStyleSheet("/modules/mod_alworkshops/assets/css/style.css");
$doc->addScript("/modules/mod_alworkshops/assets/js/script.js");
$tmp = explode('/', JFactory::getURI()->getPath());
$alias = end($tmp);
$switch = ModAlworkshopsHelper::getSwitch($alias);
JFactory::getDocument()->addStyleSheet('/templates/shaper_helix3/css/jquery-ui-smoothness.css');
JFactory::getDocument()->addScript('/templates/shaper_helix3/js/jquery-ui.1.12.1.min.js');
if ($alias > '') {
if (ModAlworkshopsHelper::getLang() == 'hun') { // Magyar oldal
$validLease = ModAlworkshopsHelper::getValidLease($switch->level);
$examResults = ModAlworkshopsHelper::getExamResults();
// workshopok
if ($switch->kurzus == 'Y' || $switch->esemeny == 'Y' || $switch->webinair == 'Y') $workshopok = ModAlworkshopsHelper::getCourse($alias);
elseif ($switch->vizsga == 'Y') { // vizsga
$tceUser = ModAlworkshopsHelper::setTCEUser($switch->vizsga_csoport);
$examPermit = ModAlworkshopsHelper::getExamPermit($switch->level);
$onlineExamPermit = ModAlworkshopsHelper::getOnlineExamPermit($switch->level);
$lastWorkshop = ModAlworkshopsHelper::getLastWorkshop($switch->level);
$workshopok = ModAlworkshopsHelper::getWorkshops($alias, ($lastWorkshop ? (date('Y-m-d', _TIME_) >= $lastWorkshop->nextDay ? date('Y-m-d', _TIME_) : $lastWorkshop->nextDay) : ''));
if ($switch->level == 4) {
$appsign = ModAlworkshopsHelper::getAppSign($workshopok[0]->id);
$tceGroup = ModAlworkshopsHelper::getTCEUserGroup();
}
} else // bármi egyéb (csak a workshopok maradtak)
$workshopok = ModAlworkshopsHelper::getWorkshops($alias, ($validLease ? (date('Y-m-d', _TIME_) > $validLease->validFrom ? date('Y-m-d', _TIME_) : $validLease->validFrom) : ''), ($validLease ? $validLease->validThrough : ''));
$payed = $workshopok ? ModAlworkshopsHelper::payed($workshopok[0]->id) : false;
require JModuleHelper::getLayoutPath('mod_alworkshops', $params->get('layout', 'default'));
}
if (ModAlworkshopsHelper::getLang() == 'eng') { // Angol oldal
if ($switch->webinair == 'Y' || $switch->esemeny == 'Y') $workshopok = ModAlworkshopsHelper::getCourse($alias);
else $workshopok = ModAlworkshopsHelper::getWorkshopsByGroup($alias);
require JModuleHelper::getLayoutPath('mod_alworkshops', 'eng');
}
}

View File

@ -0,0 +1,151 @@
<?xml version="1.0" encoding="utf-8"?><!--
/**
* @copyright Copyright © 2017 - All rights reserved.
* @license GNU General Public License v2.0
* @generator http://xdsoft/joomla-module-generator/
*/
-->
<extension type="module" method="upgrade" client="site">
<name>MOD_ARCHLINE_WORKSHOPS</name>
<creationDate>Mar 2017</creationDate>
<author>Zsolt Fekete</author>
<authorEmail>zsolt.fekete@cadline.hu</authorEmail>
<authorUrl>https://www.facbook.com/mcleod78</authorUrl>
<copyright>Copyright © 2017 - All rights reserved.</copyright>
<license>GNU General Public License v2.0</license>
<version>0.0.1</version>
<description>MOD__P_FRONT_ENDEN_MEGJELENITI_A</description>
<files>
<filename module="mod_alworkshops">mod_alworkshops.php</filename>
<filename>mod_alworkshops.xml</filename>
<filename>index.html</filename>
<folder>language</folder>
<folder>tmpl</folder>
<folder>assets</folder>
</files>
<config>
<fields name="params">
<fieldset
name="advanced">
<field
name="layout"
type="modulelayout"
label="JFIELD_ALT_LAYOUT_LABEL"
description="JFIELD_ALT_MODULE_LAYOUT_DESC" />
<field
name="moduleclass_sfx"
type="textarea" rows="3"
label="COM_MODULES_FIELD_MODULECLASS_SFX_LABEL"
description="COM_MODULES_FIELD_MODULECLASS_SFX_DESC" />
<field
name="cache"
type="list"
default="1"
label="COM_MODULES_FIELD_CACHING_LABEL"
description="COM_MODULES_FIELD_CACHING_DESC">
<option
value="1">JGLOBAL_USE_GLOBAL</option>
<option
value="0">COM_MODULES_FIELD_VALUE_NOCACHING</option>
</field>
<field
name="cache_time"
type="text"
default="900"
label="COM_MODULES_FIELD_CACHE_TIME_LABEL"
description="COM_MODULES_FIELD_CACHE_TIME_DESC" />
<field
name="cachemode"
type="hidden"
default="static">
<option
value="static"></option>
</field>
</fieldset>
</fields>
<!--
########################################################################################
The following are a list of all the different types of fields you can add to this file
They are here for copy pasting - neat eh?
Full list https://docs.joomla.org/Standard_form_field_types
########################################################################################
https://docs.joomla.org/Calendar_form_field_type
<field name="mycalendar" type="calendar" default="5-10-2008" label="Select a date" description="" format="%d-%m-%Y" />
https://docs.joomla.org/Category_form_field_type
<field name="mycategory" type="category" label="Select a category" description="" section="3" />
https://docs.joomla.org/Editor_form_field_type
<field name="myeditor" type="editors" default="none" label="Select an editor" />
https://docs.joomla.org/Filelist_form_field_type
<field name="myfile" type="filelist" default="" label="Select a file" description="" directory="administrator" filter="" exclude="" stripext="" />
https://docs.joomla.org/Folderlist_form_field_type
<field name="myfolder" type="folderlist" default="" label="Select a folder" directory="administrator" filter="" exclude="" stripext="" />
https://docs.joomla.org/Helpsite_form_field_type
<field name="myhelpsite" type="helpsites" default="" label="Select a help site" description="" />
https://docs.joomla.org/Hidden_form_field_type
<field name="mysecretvariable" type="hidden" default="" />
https://docs.joomla.org/Imagelist_form_field_type
<field name="myimage" type="imagelist" default="" label="Select an image" description="" directory="" exclude="" stripext="" />
https://docs.joomla.org/Language_form_field_type
<field name="mylanguage" type="languages" client="site" default="en-GB" label="Select a language" description="" />
https://docs.joomla.org/List_form_field_type
<field name="mylistvalue" type="list" default="" label="Select an option" description="">
<option value="0">Option 1</option>
<option value="1">Option 2</option>
</field>
https://docs.joomla.org/Menu_form_field_type
<field name="mymenu" type="menu" default="mainmenu" label="Select a menu" description="Select a menu" />
https://docs.joomla.org/Menuitem_form_field_type
<field name="mymenuitem" type="menuitem" default="45" label="Select a menu item" description="Select a menu item" />
https://docs.joomla.org/Password_form_field_type
<field name="mypassword" type="password" default="secret" label="Enter a password" description="" size="5" />
https://docs.joomla.org/Radio_form_field_type
<field name="myradiovalue" type="radio" default="0" label="Select an option" description="" class="btn-group btn-group-yesno">
<option value="0">JYES</option>
<option value="1">JNO</option>
</field>
https://docs.joomla.org/Spacer_form_field_type
<field type="spacer" default="&lt;b&gt;Advanced parameters&lt;/b&gt;" />
<field type="spacer" name="myspacer" hr="true" />
https://docs.joomla.org/SQL_form_field_type
<field name="myfield" type="sql" default="10" label="Select an article" query="SELECT id, title FROM #__content" key_field="id" value_field="title" />
https://docs.joomla.org/Text_form_field_type
<field name="mytextvalue" type="text" default="Some text" label="Enter some text" description="" size="10" />
https://docs.joomla.org/Textarea_form_field_type
<field name="mytextarea" type="textarea" default="default" label="Enter some text" description="" rows="10" cols="5" />
https://docs.joomla.org/Timezone_form_field_type
<field name="mytimezone" type="timezones" default="-10" label="Select a timezone" description="" />
https://docs.joomla.org/Usergroup_form_field_type
<field name="myusergroups" type="usergroup" default="" label="Select a user group" description="" />
-->
</config>
<languages folder="language">
<language tag="en-GB">en-GB/en-GB.mod_alworkshops2.sys.ini</language>
<language tag="en-GB">en-GB/en-GB.mod_alworkshops.ini</language>
<language tag="hu-HU">hu-HU/hu-HU.mod_alworkshops2.sys.ini</language>
<language tag="hu-HU">hu-HU/hu-HU.mod_alworkshops.ini</language>
</languages>
</extension>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,10 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<a href="http://xdsoft.net/joomla/module_generator/">Joomla Module Generator</a>
</body>
</html>

View File

@ -0,0 +1,78 @@
<?php
defined('_JEXEC') or die;
jimport('joomla.user.helper');
class ModCourseListHelper
{
public static function getCourses()
{
$lang = self::getLang();
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select(array('c.*'));
$query->from($db->quoteName('www_archline_hu.aleducation_courses', 'c'));
$query->where($db->quoteName('c.lang') . ' = ' . $db->quote($lang));
$query->where($db->quoteName('c.published') . ' = ' . $db->quote('Y'));
$query->order('c.ordering ASC');
// Reset the query using our newly populated query object.
$db->setQuery($query);
return $db->loadObjectList();
}
public static function getApplicationPercentage($courseId, $userId)
{
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select(array('e.*'));
$query->from($db->quoteName('www_archline_hu.aleducation_applications', 'e'));
$query->where($db->quoteName('e.user_id') . ' = ' . $db->quote($userId));
$query->where($db->quoteName('e.course_id') . ' = ' . $db->quote($courseId));
$db->setQuery($query);
$result = $db->loadObject();
return empty($result) ? 0 : $result->percentage;
}
public static function getApplications($userId)
{
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select(array('e.*'));
$query->from($db->quoteName('www_archline_hu.aleducation_applications', 'e'));
$query->where($db->quoteName('e.user_id') . ' = ' . $db->quote($userId));
$db->setQuery($query);
return $db->loadObjectList();
}
public static function getColor()
{
return self::getLang() == "hun" ? "#f0c317" : "#f0c317";
}
public static function getLang()
{
$lang = JFactory::getLanguage()->getTag();
if ($lang == 'de-DE')
return 'de';
if ($lang == 'hu-HU')
return 'hun';
return 'eng';
}
}

View File

@ -0,0 +1,10 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<a href="http://xdsoft.net/joomla/module_generator/">Joomla Module Generator</a>
</body>
</html>

View File

@ -0,0 +1,4 @@
MOD_ARCHLINE_USERS="ARCHLine users"
MOD__P___ARCHLINE_USERS___P_="<p>
ARCHLine users
</p>"

View File

@ -0,0 +1,4 @@
MOD_ARCHLINE_USERS="ARCHLine users"
MOD__P___ARCHLINE_USERS___P_="<p>
ARCHLine users
</p>"

View File

@ -0,0 +1,4 @@
MOD_ARCHLINE_USERS="ARCHLine users"
MOD__P___ARCHLINE_USERS___P_="<p>
ARCHLine users
</p>"

View File

@ -0,0 +1,4 @@
MOD_ARCHLINE_USERS="ARCHLine users"
MOD__P___ARCHLINE_USERS___P_="<p>
ARCHLine users
</p>"

View File

@ -0,0 +1,12 @@
<?php
defined('_JEXEC') or die;
require_once dirname(__FILE__) . '/helper.php';
$lang = JFactory::getLanguage()->getTag();
$user = JFactory::getUser();
$courses = ModCourseListHelper::getCourses();
$color = ModCourseListHelper::getColor();
$applications = ModCourseListHelper::getApplications($user->id);
require JModuleHelper::getLayoutPath('mod_course_list', $params->get('layout', 'default'));

Some files were not shown because too many files have changed in this diff Show More