diff --git a/.editorconfig b/.editorconfig
new file mode 100755
index 0000000..d6a08a1
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,15 @@
+# top-most EditorConfig file
+root = true
+
+# Unix-style newlines with a newline ending every file
+[*]
+end_of_line = lf
+insert_final_newline = true
+
+# Matches multiple files with brace expansion notation
+# Set default charset
+[*]
+charset = utf-8
+
+# Tab indentation (no size specified)
+indent_style = tab
diff --git a/.gitignore b/.gitignore
new file mode 100755
index 0000000..e9a3b23
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,32 @@
+.DS_Store
+
+application/cache/*
+!application/cache/index.html
+
+application/logs/*
+!application/logs/index.html
+
+!application/*/.htaccess
+
+composer.lock
+tests/mocks/database/ci_test.sqlite
+
+user_guide_src/build/*
+user_guide_src/cilexer/build/*
+user_guide_src/cilexer/dist/*
+user_guide_src/cilexer/pycilexer.egg-info/*
+/vendor/
+
+# IDE Files
+#-------------------------
+/nbproject/
+.idea/*
+
+## Sublime Text cache files
+*.tmlanguage.cache
+*.tmPreferences.cache
+*.stTheme.cache
+*.sublime-workspace
+*.sublime-project
+/tests/tests/
+/tests/results/
diff --git a/.htaccess b/.htaccess
new file mode 100755
index 0000000..eedac10
--- /dev/null
+++ b/.htaccess
@@ -0,0 +1,15 @@
+
+
+ RewriteEngine on
+ RewriteCond %{REQUEST_FILENAME} !-f
+ RewriteCond %{REQUEST_FILENAME} !-d
+
+
+ RewriteRule ^(.*)$ index.php/$1 [L]
+
+
+
+ RewriteRule ^(.*)$ index.php?/$1 [L]
+
+
+
\ No newline at end of file
diff --git a/application/.htaccess b/application/.htaccess
new file mode 100755
index 0000000..83097d2
--- /dev/null
+++ b/application/.htaccess
@@ -0,0 +1,6 @@
+
+ Require all denied
+
+
+ Deny from all
+
\ No newline at end of file
diff --git a/application/cache/index.html b/application/cache/index.html
new file mode 100755
index 0000000..b48b490
--- /dev/null
+++ b/application/cache/index.html
@@ -0,0 +1,11 @@
+
+
+
+ Directory access is forbidden.
+
+
+
diff --git a/application/config/autoload.php b/application/config/autoload.php
new file mode 100755
index 0000000..dd4098c
--- /dev/null
+++ b/application/config/autoload.php
@@ -0,0 +1,135 @@
+ 'ua');
+*/
+$autoload['libraries'] = array();
+
+/*
+| -------------------------------------------------------------------
+| Auto-load Drivers
+| -------------------------------------------------------------------
+| These classes are located in system/libraries/ or in your
+| application/libraries/ directory, but are also placed inside their
+| own subdirectory and they extend the CI_Driver_Library class. They
+| offer multiple interchangeable driver options.
+|
+| Prototype:
+|
+| $autoload['drivers'] = array('cache');
+|
+| You can also supply an alternative property name to be assigned in
+| the controller:
+|
+| $autoload['drivers'] = array('cache' => 'cch');
+|
+*/
+$autoload['drivers'] = array();
+
+/*
+| -------------------------------------------------------------------
+| Auto-load Helper Files
+| -------------------------------------------------------------------
+| Prototype:
+|
+| $autoload['helper'] = array('url', 'file');
+*/
+$autoload['helper'] = array();
+
+/*
+| -------------------------------------------------------------------
+| Auto-load Config files
+| -------------------------------------------------------------------
+| Prototype:
+|
+| $autoload['config'] = array('config1', 'config2');
+|
+| NOTE: This item is intended for use ONLY if you have created custom
+| config files. Otherwise, leave it blank.
+|
+*/
+$autoload['config'] = array();
+
+/*
+| -------------------------------------------------------------------
+| Auto-load Language files
+| -------------------------------------------------------------------
+| Prototype:
+|
+| $autoload['language'] = array('lang1', 'lang2');
+|
+| NOTE: Do not include the "_lang" part of your file. For example
+| "codeigniter_lang.php" would be referenced as array('codeigniter');
+|
+*/
+$autoload['language'] = array();
+
+/*
+| -------------------------------------------------------------------
+| Auto-load Models
+| -------------------------------------------------------------------
+| Prototype:
+|
+| $autoload['model'] = array('first_model', 'second_model');
+|
+| You can also supply an alternative model name to be assigned
+| in the controller:
+|
+| $autoload['model'] = array('first_model' => 'first');
+*/
+$autoload['model'] = array();
diff --git a/application/config/config.php b/application/config/config.php
new file mode 100755
index 0000000..bb2aeec
--- /dev/null
+++ b/application/config/config.php
@@ -0,0 +1,537 @@
+]+$/i
+|
+| DO NOT CHANGE THIS UNLESS YOU FULLY UNDERSTAND THE REPERCUSSIONS!!
+|
+*/
+$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-';
+
+/*
+|--------------------------------------------------------------------------
+| Enable Query Strings
+|--------------------------------------------------------------------------
+|
+| By default CodeIgniter uses search-engine friendly segment based URLs:
+| example.com/who/what/where/
+|
+| You can optionally enable standard query string based URLs:
+| example.com?who=me&what=something&where=here
+|
+| Options are: TRUE or FALSE (boolean)
+|
+| The other items let you set the query string 'words' that will
+| invoke your controllers and its functions:
+| example.com/index.php?c=controller&m=function
+|
+| Please note that some of the helpers won't work as expected when
+| this feature is enabled, since CodeIgniter is designed primarily to
+| use segment based URLs.
+|
+*/
+$config['enable_query_strings'] = FALSE;
+$config['controller_trigger'] = 'c';
+$config['function_trigger'] = 'm';
+$config['directory_trigger'] = 'd';
+
+/*
+|--------------------------------------------------------------------------
+| Allow $_GET array
+|--------------------------------------------------------------------------
+|
+| By default CodeIgniter enables access to the $_GET array. If for some
+| reason you would like to disable it, set 'allow_get_array' to FALSE.
+|
+| WARNING: This feature is DEPRECATED and currently available only
+| for backwards compatibility purposes!
+|
+*/
+$config['allow_get_array'] = TRUE;
+
+/*
+|--------------------------------------------------------------------------
+| Error Logging Threshold
+|--------------------------------------------------------------------------
+|
+| You can enable error logging by setting a threshold over zero. The
+| threshold determines what gets logged. Threshold options are:
+|
+| 0 = Disables logging, Error logging TURNED OFF
+| 1 = Error Messages (including PHP errors)
+| 2 = Debug Messages
+| 3 = Informational Messages
+| 4 = All Messages
+|
+| You can also pass an array with threshold levels to show individual error types
+|
+| array(2) = Debug Messages, without Error Messages
+|
+| For a live site you'll usually only enable Errors (1) to be logged otherwise
+| your log files will fill up very fast.
+|
+*/
+$config['log_threshold'] = 1;
+
+/*
+|--------------------------------------------------------------------------
+| Error Logging Directory Path
+|--------------------------------------------------------------------------
+|
+| Leave this BLANK unless you would like to set something other than the default
+| application/logs/ directory. Use a full server path with trailing slash.
+|
+*/
+$config['log_path'] = '';
+
+/*
+|--------------------------------------------------------------------------
+| Log File Extension
+|--------------------------------------------------------------------------
+|
+| The default filename extension for log files. The default 'php' allows for
+| protecting the log files via basic scripting, when they are to be stored
+| under a publicly accessible directory.
+|
+| Note: Leaving it blank will default to 'php'.
+|
+*/
+$config['log_file_extension'] = '';
+
+/*
+|--------------------------------------------------------------------------
+| Log File Permissions
+|--------------------------------------------------------------------------
+|
+| The file system permissions to be applied on newly created log files.
+|
+| IMPORTANT: This MUST be an integer (no quotes) and you MUST use octal
+| integer notation (i.e. 0700, 0644, etc.)
+*/
+$config['log_file_permissions'] = 0644;
+
+/*
+|--------------------------------------------------------------------------
+| Date Format for Logs
+|--------------------------------------------------------------------------
+|
+| Each item that is logged has an associated date. You can use PHP date
+| codes to set your own date formatting
+|
+*/
+$config['log_date_format'] = 'Y-m-d H:i:s';
+
+/*
+|--------------------------------------------------------------------------
+| Error Views Directory Path
+|--------------------------------------------------------------------------
+|
+| Leave this BLANK unless you would like to set something other than the default
+| application/views/errors/ directory. Use a full server path with trailing slash.
+|
+*/
+$config['error_views_path'] = '';
+
+/*
+|--------------------------------------------------------------------------
+| Cache Directory Path
+|--------------------------------------------------------------------------
+|
+| Leave this BLANK unless you would like to set something other than the default
+| application/cache/ directory. Use a full server path with trailing slash.
+|
+*/
+$config['cache_path'] = '';
+
+/*
+|--------------------------------------------------------------------------
+| Cache Include Query String
+|--------------------------------------------------------------------------
+|
+| Whether to take the URL query string into consideration when generating
+| output cache files. Valid options are:
+|
+| FALSE = Disabled
+| TRUE = Enabled, take all query parameters into account.
+| Please be aware that this may result in numerous cache
+| files generated for the same page over and over again.
+| array('q') = Enabled, but only take into account the specified list
+| of query parameters.
+|
+*/
+$config['cache_query_string'] = FALSE;
+
+/*
+|--------------------------------------------------------------------------
+| Encryption Key
+|--------------------------------------------------------------------------
+|
+| If you use the Encryption class, you must set an encryption key.
+| See the user guide for more info.
+|
+| https://codeigniter.com/userguide3/libraries/encryption.html
+|
+*/
+$config['encryption_key'] = '';
+
+/*
+|--------------------------------------------------------------------------
+| Session Variables
+|--------------------------------------------------------------------------
+|
+| 'sess_driver'
+|
+| The storage driver to use: files, database, redis, memcached
+|
+| 'sess_cookie_name'
+|
+| The session cookie name, must contain only [0-9a-z_-] characters
+|
+| 'sess_samesite'
+|
+| Session cookie SameSite attribute: Lax (default), Strict or None
+|
+| 'sess_expiration'
+|
+| The number of SECONDS you want the session to last.
+| Setting to 0 (zero) means expire when the browser is closed.
+|
+| 'sess_save_path'
+|
+| The location to save sessions to, driver dependent.
+|
+| For the 'files' driver, it's a path to a writable directory.
+| WARNING: Only absolute paths are supported!
+|
+| For the 'database' driver, it's a table name.
+| Please read up the manual for the format with other session drivers.
+|
+| IMPORTANT: You are REQUIRED to set a valid save path!
+|
+| 'sess_match_ip'
+|
+| Whether to match the user's IP address when reading the session data.
+|
+| WARNING: If you're using the database driver, don't forget to update
+| your session table's PRIMARY KEY when changing this setting.
+|
+| 'sess_time_to_update'
+|
+| How many seconds between CI regenerating the session ID.
+|
+| 'sess_regenerate_destroy'
+|
+| Whether to destroy session data associated with the old session ID
+| when auto-regenerating the session ID. When set to FALSE, the data
+| will be later deleted by the garbage collector.
+|
+| Other session cookie settings are shared with the rest of the application,
+| except for 'cookie_prefix' and 'cookie_httponly', which are ignored here.
+|
+*/
+$config['sess_driver'] = 'files';
+$config['sess_cookie_name'] = 'ci_session';
+$config['sess_samesite'] = 'Lax';
+$config['sess_expiration'] = 7200;
+$config['sess_save_path'] = NULL;
+$config['sess_match_ip'] = FALSE;
+$config['sess_time_to_update'] = 300;
+$config['sess_regenerate_destroy'] = FALSE;
+
+/*
+|--------------------------------------------------------------------------
+| Cookie Related Variables
+|--------------------------------------------------------------------------
+|
+| 'cookie_prefix' = Set a cookie name prefix if you need to avoid collisions
+| 'cookie_domain' = Set to .your-domain.com for site-wide cookies
+| 'cookie_path' = Typically will be a forward slash
+| 'cookie_secure' = Cookie will only be set if a secure HTTPS connection exists.
+| 'cookie_httponly' = Cookie will only be accessible via HTTP(S) (no javascript)
+| 'cookie_samesite' = Cookie's samesite attribute (Lax, Strict or None)
+|
+| Note: These settings (with the exception of 'cookie_prefix' and
+| 'cookie_httponly') will also affect sessions.
+|
+*/
+$config['cookie_prefix'] = '';
+$config['cookie_domain'] = '';
+$config['cookie_path'] = '/';
+$config['cookie_secure'] = FALSE;
+$config['cookie_httponly'] = FALSE;
+$config['cookie_samesite'] = 'Lax';
+
+/*
+|--------------------------------------------------------------------------
+| Standardize newlines
+|--------------------------------------------------------------------------
+|
+| Determines whether to standardize newline characters in input data,
+| meaning to replace \r\n, \r, \n occurrences with the PHP_EOL value.
+|
+| WARNING: This feature is DEPRECATED and currently available only
+| for backwards compatibility purposes!
+|
+*/
+$config['standardize_newlines'] = FALSE;
+
+/*
+|--------------------------------------------------------------------------
+| Global XSS Filtering
+|--------------------------------------------------------------------------
+|
+| Determines whether the XSS filter is always active when GET, POST or
+| COOKIE data is encountered
+|
+| WARNING: This feature is DEPRECATED and currently available only
+| for backwards compatibility purposes!
+|
+*/
+$config['global_xss_filtering'] = TRUE;
+
+/*
+|--------------------------------------------------------------------------
+| Cross Site Request Forgery
+|--------------------------------------------------------------------------
+| Enables a CSRF cookie token to be set. When set to TRUE, token will be
+| checked on a submitted form. If you are accepting user data, it is strongly
+| recommended CSRF protection be enabled.
+|
+| 'csrf_token_name' = The token name
+| 'csrf_cookie_name' = The cookie name
+| 'csrf_expire' = The number in seconds the token should expire.
+| 'csrf_regenerate' = Regenerate token on every submission
+| 'csrf_exclude_uris' = Array of URIs which ignore CSRF checks
+*/
+$config['csrf_protection'] = FALSE;
+$config['csrf_token_name'] = 'csrf_test_name';
+$config['csrf_cookie_name'] = 'csrf_cookie_name';
+$config['csrf_expire'] = 7200;
+$config['csrf_regenerate'] = TRUE;
+$config['csrf_exclude_uris'] = array();
+
+/*
+|--------------------------------------------------------------------------
+| Output Compression
+|--------------------------------------------------------------------------
+|
+| Enables Gzip output compression for faster page loads. When enabled,
+| the output class will test whether your server supports Gzip.
+| Even if it does, however, not all browsers support compression
+| so enable only if you are reasonably sure your visitors can handle it.
+|
+| Only used if zlib.output_compression is turned off in your php.ini.
+| Please do not use it together with httpd-level output compression.
+|
+| VERY IMPORTANT: If you are getting a blank page when compression is enabled it
+| means you are prematurely outputting something to your browser. It could
+| even be a line of whitespace at the end of one of your scripts. For
+| compression to work, nothing can be sent before the output buffer is called
+| by the output class. Do not 'echo' any values with compression enabled.
+|
+*/
+$config['compress_output'] = FALSE;
+
+/*
+|--------------------------------------------------------------------------
+| Master Time Reference
+|--------------------------------------------------------------------------
+|
+| Options are 'local' or any PHP supported timezone. This preference tells
+| the system whether to use your server's local time as the master 'now'
+| reference, or convert it to the configured one timezone. See the 'date
+| helper' page of the user guide for information regarding date handling.
+|
+*/
+$config['time_reference'] = 'local';
+
+/*
+|--------------------------------------------------------------------------
+| Rewrite PHP Short Tags
+|--------------------------------------------------------------------------
+|
+| If your PHP installation does not have short tag support enabled CI
+| can rewrite the tags on-the-fly, enabling you to utilize that syntax
+| in your view files. Options are TRUE or FALSE (boolean)
+|
+| Note: You need to have eval() enabled for this to work.
+|
+*/
+$config['rewrite_short_tags'] = FALSE;
+
+/*
+|--------------------------------------------------------------------------
+| Reverse Proxy IPs
+|--------------------------------------------------------------------------
+|
+| If your server is behind a reverse proxy, you must whitelist the proxy
+| IP addresses from which CodeIgniter should trust headers such as
+| HTTP_X_FORWARDED_FOR and HTTP_CLIENT_IP in order to properly identify
+| the visitor's IP address.
+|
+| You can use both an array or a comma-separated list of proxy addresses,
+| as well as specifying whole subnets. Here are a few examples:
+|
+| Comma-separated: '10.0.1.200,192.168.5.0/24'
+| Array: array('10.0.1.200', '192.168.5.0/24')
+*/
+$config['proxy_ips'] = '';
diff --git a/application/config/constants.php b/application/config/constants.php
new file mode 100755
index 0000000..9b667b0
--- /dev/null
+++ b/application/config/constants.php
@@ -0,0 +1,85 @@
+db->last_query() and profiling of DB queries.
+| When you run a query, with this setting set to TRUE (default),
+| CodeIgniter will store the SQL statement for debugging purposes.
+| However, this may cause high memory usage, especially if you run
+| a lot of SQL queries ... disable this to avoid that problem.
+|
+| The $active_group variable lets you choose which connection group to
+| make active. By default there is only one group (the 'default' group).
+|
+| The $query_builder variables lets you determine whether or not to load
+| the query builder class.
+*/
+$active_group = 'default';
+$query_builder = TRUE;
+
+$db['default'] = array(
+ 'dsn' => '',
+ 'hostname' => 'localhost',
+ //'username' => 'root',
+ 'username' => 'gzsgtetc_beve',
+ //'password' => '',
+ 'password' => 'v6B5YzhHDks#',
+ //'database' => 'studiobeve',
+ 'database' => 'gzsgtetc_studiobeve',
+ 'dbdriver' => 'mysqli',
+ 'dbprefix' => '',
+ 'pconnect' => FALSE,
+ 'db_debug' => (ENVIRONMENT !== 'production'),
+ 'cache_on' => FALSE,
+ 'cachedir' => '',
+ 'char_set' => 'utf8',
+ 'dbcollat' => 'utf8_general_ci',
+ 'swap_pre' => '',
+ 'encrypt' => FALSE,
+ 'compress' => FALSE,
+ 'stricton' => FALSE,
+ 'failover' => array(),
+ 'save_queries' => TRUE
+);
diff --git a/application/config/doctypes.php b/application/config/doctypes.php
new file mode 100755
index 0000000..f95451b
--- /dev/null
+++ b/application/config/doctypes.php
@@ -0,0 +1,24 @@
+ '',
+ 'xhtml1-strict' => '',
+ 'xhtml1-trans' => '',
+ 'xhtml1-frame' => '',
+ 'xhtml-basic11' => '',
+ 'html5' => '',
+ 'html4-strict' => '',
+ 'html4-trans' => '',
+ 'html4-frame' => '',
+ 'mathml1' => '',
+ 'mathml2' => '',
+ 'svg10' => '',
+ 'svg11' => '',
+ 'svg11-basic' => '',
+ 'svg11-tiny' => '',
+ 'xhtml-math-svg-xh' => '',
+ 'xhtml-math-svg-sh' => '',
+ 'xhtml-rdfa-1' => '',
+ 'xhtml-rdfa-2' => ''
+);
diff --git a/application/config/foreign_chars.php b/application/config/foreign_chars.php
new file mode 100755
index 0000000..520f35d
--- /dev/null
+++ b/application/config/foreign_chars.php
@@ -0,0 +1,114 @@
+ 'ae',
+ '/ö|œ/' => 'oe',
+ '/ü/' => 'ue',
+ '/Ä/' => 'Ae',
+ '/Ü/' => 'Ue',
+ '/Ö/' => 'Oe',
+ '/À|Á|Â|Ã|Ä|Å|Ǻ|Ā|Ă|Ą|Ǎ|Α|Ά|Ả|Ạ|Ầ|Ẫ|Ẩ|Ậ|Ằ|Ắ|Ẵ|Ẳ|Ặ|А/' => 'A',
+ '/à|á|â|ã|å|ǻ|ā|ă|ą|ǎ|ª|α|ά|ả|ạ|ầ|ấ|ẫ|ẩ|ậ|ằ|ắ|ẵ|ẳ|ặ|а/' => 'a',
+ '/Б/' => 'B',
+ '/б/' => 'b',
+ '/Ç|Ć|Ĉ|Ċ|Č/' => 'C',
+ '/ç|ć|ĉ|ċ|č/' => 'c',
+ '/Д|Δ/' => 'D',
+ '/д|δ/' => 'd',
+ '/Ð|Ď|Đ/' => 'Dj',
+ '/ð|ď|đ/' => 'dj',
+ '/È|É|Ê|Ë|Ē|Ĕ|Ė|Ę|Ě|Ε|Έ|Ẽ|Ẻ|Ẹ|Ề|Ế|Ễ|Ể|Ệ|Е|Э/' => 'E',
+ '/è|é|ê|ë|ē|ĕ|ė|ę|ě|έ|ε|ẽ|ẻ|ẹ|ề|ế|ễ|ể|ệ|е|э/' => 'e',
+ '/Ф/' => 'F',
+ '/ф/' => 'f',
+ '/Ĝ|Ğ|Ġ|Ģ|Γ|Г|Ґ/' => 'G',
+ '/ĝ|ğ|ġ|ģ|γ|г|ґ/' => 'g',
+ '/Ĥ|Ħ/' => 'H',
+ '/ĥ|ħ/' => 'h',
+ '/Ì|Í|Î|Ï|Ĩ|Ī|Ĭ|Ǐ|Į|İ|Η|Ή|Ί|Ι|Ϊ|Ỉ|Ị|И|Ы/' => 'I',
+ '/ì|í|î|ï|ĩ|ī|ĭ|ǐ|į|ı|η|ή|ί|ι|ϊ|ỉ|ị|и|ы|ї/' => 'i',
+ '/Ĵ/' => 'J',
+ '/ĵ/' => 'j',
+ '/Θ/' => 'TH',
+ '/θ/' => 'th',
+ '/Ķ|Κ|К/' => 'K',
+ '/ķ|κ|к/' => 'k',
+ '/Ĺ|Ļ|Ľ|Ŀ|Ł|Λ|Л/' => 'L',
+ '/ĺ|ļ|ľ|ŀ|ł|λ|л/' => 'l',
+ '/М/' => 'M',
+ '/м/' => 'm',
+ '/Ñ|Ń|Ņ|Ň|Ν|Н/' => 'N',
+ '/ñ|ń|ņ|ň|ʼn|ν|н/' => 'n',
+ '/Ò|Ó|Ô|Õ|Ō|Ŏ|Ǒ|Ő|Ơ|Ø|Ǿ|Ο|Ό|Ω|Ώ|Ỏ|Ọ|Ồ|Ố|Ỗ|Ổ|Ộ|Ờ|Ớ|Ỡ|Ở|Ợ|О/' => 'O',
+ '/ò|ó|ô|õ|ō|ŏ|ǒ|ő|ơ|ø|ǿ|º|ο|ό|ω|ώ|ỏ|ọ|ồ|ố|ỗ|ổ|ộ|ờ|ớ|ỡ|ở|ợ|о/' => 'o',
+ '/П/' => 'P',
+ '/п/' => 'p',
+ '/Ŕ|Ŗ|Ř|Ρ|Р/' => 'R',
+ '/ŕ|ŗ|ř|ρ|р/' => 'r',
+ '/Ś|Ŝ|Ş|Ș|Š|Σ|С/' => 'S',
+ '/ś|ŝ|ş|ș|š|ſ|σ|ς|с/' => 's',
+ '/Ț|Ţ|Ť|Ŧ|Τ|Т/' => 'T',
+ '/ț|ţ|ť|ŧ|τ|т/' => 't',
+ '/Þ|þ/' => 'th',
+ '/Ù|Ú|Û|Ũ|Ū|Ŭ|Ů|Ű|Ų|Ư|Ǔ|Ǖ|Ǘ|Ǚ|Ǜ|Ũ|Ủ|Ụ|Ừ|Ứ|Ữ|Ử|Ự|У/' => 'U',
+ '/ù|ú|û|ũ|ū|ŭ|ů|ű|ų|ư|ǔ|ǖ|ǘ|ǚ|ǜ|υ|ύ|ϋ|ủ|ụ|ừ|ứ|ữ|ử|ự|у/' => 'u',
+ '/Ƴ|Ɏ|Ỵ|Ẏ|Ӳ|Ӯ|Ў|Ý|Ÿ|Ŷ|Υ|Ύ|Ϋ|Ỳ|Ỹ|Ỷ|Ỵ|Й/' => 'Y',
+ '/ẙ|ʏ|ƴ|ɏ|ỵ|ẏ|ӳ|ӯ|ў|ý|ÿ|ŷ|ỳ|ỹ|ỷ|ỵ|й/' => 'y',
+ '/В/' => 'V',
+ '/в/' => 'v',
+ '/Ŵ/' => 'W',
+ '/ŵ/' => 'w',
+ '/Φ/' => 'F',
+ '/φ/' => 'f',
+ '/Χ/' => 'CH',
+ '/χ/' => 'ch',
+ '/Ź|Ż|Ž|Ζ|З/' => 'Z',
+ '/ź|ż|ž|ζ|з/' => 'z',
+ '/Æ|Ǽ/' => 'AE',
+ '/ß/' => 'ss',
+ '/IJ/' => 'IJ',
+ '/ij/' => 'ij',
+ '/Œ/' => 'OE',
+ '/ƒ/' => 'f',
+ '/Ξ/' => 'KS',
+ '/ξ/' => 'ks',
+ '/Π/' => 'P',
+ '/π/' => 'p',
+ '/Β/' => 'V',
+ '/β/' => 'v',
+ '/Μ/' => 'M',
+ '/μ/' => 'm',
+ '/Ψ/' => 'PS',
+ '/ψ/' => 'ps',
+ '/Ё/' => 'Yo',
+ '/ё/' => 'yo',
+ '/Є/' => 'Ye',
+ '/є/' => 'ye',
+ '/Ї/' => 'Yi',
+ '/Ж/' => 'Zh',
+ '/ж/' => 'zh',
+ '/Х/' => 'Kh',
+ '/х/' => 'kh',
+ '/Ц/' => 'Ts',
+ '/ц/' => 'ts',
+ '/Ч/' => 'Ch',
+ '/ч/' => 'ch',
+ '/Ш/' => 'Sh',
+ '/ш/' => 'sh',
+ '/Щ/' => 'Shch',
+ '/щ/' => 'shch',
+ '/Ъ|ъ|Ь|ь/' => '',
+ '/Ю/' => 'Yu',
+ '/ю/' => 'yu',
+ '/Я/' => 'Ya',
+ '/я/' => 'ya'
+);
diff --git a/application/config/hooks.php b/application/config/hooks.php
new file mode 100755
index 0000000..7bde890
--- /dev/null
+++ b/application/config/hooks.php
@@ -0,0 +1,13 @@
+
+
+
+ Directory access is forbidden.
+
+
+
diff --git a/application/config/memcached.php b/application/config/memcached.php
new file mode 100755
index 0000000..e710b17
--- /dev/null
+++ b/application/config/memcached.php
@@ -0,0 +1,19 @@
+ array(
+ 'hostname' => '127.0.0.1',
+ 'port' => '11211',
+ 'weight' => '1',
+ ),
+);
diff --git a/application/config/migration.php b/application/config/migration.php
new file mode 100755
index 0000000..e26f361
--- /dev/null
+++ b/application/config/migration.php
@@ -0,0 +1,84 @@
+migration->current() this is the version that schema will
+| be upgraded / downgraded to.
+|
+*/
+$config['migration_version'] = 0;
+
+/*
+|--------------------------------------------------------------------------
+| Migrations Path
+|--------------------------------------------------------------------------
+|
+| Path to your migrations folder.
+| Typically, it will be within your application path.
+| Also, writing permission is required within the migrations path.
+|
+*/
+$config['migration_path'] = APPPATH.'migrations/';
diff --git a/application/config/mimes.php b/application/config/mimes.php
new file mode 100755
index 0000000..43e8630
--- /dev/null
+++ b/application/config/mimes.php
@@ -0,0 +1,186 @@
+ array('application/mac-binhex40', 'application/mac-binhex', 'application/x-binhex40', 'application/x-mac-binhex40'),
+ 'cpt' => 'application/mac-compactpro',
+ 'csv' => array('text/x-comma-separated-values', 'text/comma-separated-values', 'application/octet-stream', 'application/vnd.ms-excel', 'application/x-csv', 'text/x-csv', 'text/csv', 'application/csv', 'application/excel', 'application/vnd.msexcel', 'text/plain'),
+ 'bin' => array('application/macbinary', 'application/mac-binary', 'application/octet-stream', 'application/x-binary', 'application/x-macbinary'),
+ 'dms' => 'application/octet-stream',
+ 'lha' => 'application/octet-stream',
+ 'lzh' => 'application/octet-stream',
+ 'exe' => array('application/octet-stream', 'application/x-msdownload'),
+ 'class' => 'application/octet-stream',
+ 'psd' => array('application/x-photoshop', 'image/vnd.adobe.photoshop'),
+ 'so' => 'application/octet-stream',
+ 'sea' => 'application/octet-stream',
+ 'dll' => 'application/octet-stream',
+ 'oda' => 'application/oda',
+ 'pdf' => array('application/pdf', 'application/force-download', 'application/x-download', 'binary/octet-stream'),
+ 'ai' => array('application/pdf', 'application/postscript'),
+ 'eps' => 'application/postscript',
+ 'ps' => 'application/postscript',
+ 'smi' => 'application/smil',
+ 'smil' => 'application/smil',
+ 'mif' => 'application/vnd.mif',
+ 'xls' => array('application/vnd.ms-excel', 'application/msexcel', 'application/x-msexcel', 'application/x-ms-excel', 'application/x-excel', 'application/x-dos_ms_excel', 'application/xls', 'application/x-xls', 'application/excel', 'application/download', 'application/vnd.ms-office', 'application/msword'),
+ 'ppt' => array('application/powerpoint', 'application/vnd.ms-powerpoint', 'application/vnd.ms-office', 'application/msword'),
+ 'pptx' => array('application/vnd.openxmlformats-officedocument.presentationml.presentation', 'application/x-zip', 'application/zip'),
+ 'wbxml' => 'application/wbxml',
+ 'wmlc' => 'application/wmlc',
+ 'dcr' => 'application/x-director',
+ 'dir' => 'application/x-director',
+ 'dxr' => 'application/x-director',
+ 'dvi' => 'application/x-dvi',
+ 'gtar' => 'application/x-gtar',
+ 'gz' => 'application/x-gzip',
+ 'gzip' => 'application/x-gzip',
+ 'php' => array('application/x-httpd-php', 'application/php', 'application/x-php', 'text/php', 'text/x-php', 'application/x-httpd-php-source'),
+ 'php4' => 'application/x-httpd-php',
+ 'php3' => 'application/x-httpd-php',
+ 'phtml' => 'application/x-httpd-php',
+ 'phps' => 'application/x-httpd-php-source',
+ 'js' => array('application/x-javascript', 'text/plain'),
+ 'swf' => 'application/x-shockwave-flash',
+ 'sit' => 'application/x-stuffit',
+ 'tar' => 'application/x-tar',
+ 'tgz' => array('application/x-tar', 'application/x-gzip-compressed'),
+ 'z' => 'application/x-compress',
+ 'xhtml' => 'application/xhtml+xml',
+ 'xht' => 'application/xhtml+xml',
+ 'zip' => array('application/x-zip', 'application/zip', 'application/x-zip-compressed', 'application/s-compressed', 'multipart/x-zip'),
+ 'rar' => array('application/x-rar', 'application/rar', 'application/x-rar-compressed'),
+ 'mid' => 'audio/midi',
+ 'midi' => 'audio/midi',
+ 'mpga' => 'audio/mpeg',
+ 'mp2' => 'audio/mpeg',
+ 'mp3' => array('audio/mpeg', 'audio/mpg', 'audio/mpeg3', 'audio/mp3'),
+ 'aif' => array('audio/x-aiff', 'audio/aiff'),
+ 'aiff' => array('audio/x-aiff', 'audio/aiff'),
+ 'aifc' => 'audio/x-aiff',
+ 'ram' => 'audio/x-pn-realaudio',
+ 'rm' => 'audio/x-pn-realaudio',
+ 'rpm' => 'audio/x-pn-realaudio-plugin',
+ 'ra' => 'audio/x-realaudio',
+ 'rv' => 'video/vnd.rn-realvideo',
+ 'wav' => array('audio/x-wav', 'audio/wave', 'audio/wav'),
+ 'bmp' => array('image/bmp', 'image/x-bmp', 'image/x-bitmap', 'image/x-xbitmap', 'image/x-win-bitmap', 'image/x-windows-bmp', 'image/ms-bmp', 'image/x-ms-bmp', 'application/bmp', 'application/x-bmp', 'application/x-win-bitmap'),
+ 'gif' => 'image/gif',
+ 'jpeg' => array('image/jpeg', 'image/pjpeg'),
+ 'jpg' => array('image/jpeg', 'image/pjpeg'),
+ 'jpe' => array('image/jpeg', 'image/pjpeg'),
+ 'jp2' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
+ 'j2k' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
+ 'jpf' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
+ 'jpg2' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
+ 'jpx' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
+ 'jpm' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
+ 'mj2' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
+ 'mjp2' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
+ 'png' => array('image/png', 'image/x-png'),
+ 'tiff' => 'image/tiff',
+ 'tif' => 'image/tiff',
+ 'heic' => 'image/heic',
+ 'heif' => 'image/heif',
+ 'css' => array('text/css', 'text/plain'),
+ 'html' => array('text/html', 'text/plain'),
+ 'htm' => array('text/html', 'text/plain'),
+ 'shtml' => array('text/html', 'text/plain'),
+ 'txt' => 'text/plain',
+ 'text' => 'text/plain',
+ 'log' => array('text/plain', 'text/x-log'),
+ 'rtx' => 'text/richtext',
+ 'rtf' => 'text/rtf',
+ 'xml' => array('application/xml', 'text/xml', 'text/plain'),
+ 'xsl' => array('application/xml', 'text/xsl', 'text/xml'),
+ 'mpeg' => 'video/mpeg',
+ 'mpg' => 'video/mpeg',
+ 'mpe' => 'video/mpeg',
+ 'qt' => 'video/quicktime',
+ 'mov' => 'video/quicktime',
+ 'avi' => array('video/x-msvideo', 'video/msvideo', 'video/avi', 'application/x-troff-msvideo'),
+ 'movie' => 'video/x-sgi-movie',
+ 'doc' => array('application/msword', 'application/vnd.ms-office'),
+ 'docx' => array('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/zip', 'application/msword', 'application/x-zip'),
+ 'dot' => array('application/msword', 'application/vnd.ms-office'),
+ 'dotx' => array('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/zip', 'application/msword'),
+ 'xlsx' => array('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'application/zip', 'application/vnd.ms-excel', 'application/msword', 'application/x-zip'),
+ 'word' => array('application/msword', 'application/octet-stream'),
+ 'xl' => 'application/excel',
+ 'eml' => 'message/rfc822',
+ 'json' => array('application/json', 'text/json'),
+ 'pem' => array('application/x-x509-user-cert', 'application/x-pem-file', 'application/octet-stream'),
+ 'p10' => array('application/x-pkcs10', 'application/pkcs10'),
+ 'p12' => 'application/x-pkcs12',
+ 'p7a' => 'application/x-pkcs7-signature',
+ 'p7c' => array('application/pkcs7-mime', 'application/x-pkcs7-mime'),
+ 'p7m' => array('application/pkcs7-mime', 'application/x-pkcs7-mime'),
+ 'p7r' => 'application/x-pkcs7-certreqresp',
+ 'p7s' => 'application/pkcs7-signature',
+ 'crt' => array('application/x-x509-ca-cert', 'application/x-x509-user-cert', 'application/pkix-cert'),
+ 'crl' => array('application/pkix-crl', 'application/pkcs-crl'),
+ 'der' => 'application/x-x509-ca-cert',
+ 'kdb' => 'application/octet-stream',
+ 'pgp' => 'application/pgp',
+ 'gpg' => 'application/gpg-keys',
+ 'sst' => 'application/octet-stream',
+ 'csr' => 'application/octet-stream',
+ 'rsa' => 'application/x-pkcs7',
+ 'cer' => array('application/pkix-cert', 'application/x-x509-ca-cert'),
+ '3g2' => 'video/3gpp2',
+ '3gp' => array('video/3gp', 'video/3gpp'),
+ 'mp4' => 'video/mp4',
+ 'm4a' => 'audio/x-m4a',
+ 'f4v' => array('video/mp4', 'video/x-f4v'),
+ 'flv' => 'video/x-flv',
+ 'webm' => 'video/webm',
+ 'aac' => array('audio/x-aac', 'audio/aac'),
+ 'm4u' => 'application/vnd.mpegurl',
+ 'm3u' => 'text/plain',
+ 'xspf' => 'application/xspf+xml',
+ 'vlc' => 'application/videolan',
+ 'wmv' => array('video/x-ms-wmv', 'video/x-ms-asf'),
+ 'au' => 'audio/x-au',
+ 'ac3' => 'audio/ac3',
+ 'flac' => 'audio/x-flac',
+ 'ogg' => array('audio/ogg', 'video/ogg', 'application/ogg'),
+ 'kmz' => array('application/vnd.google-earth.kmz', 'application/zip', 'application/x-zip'),
+ 'kml' => array('application/vnd.google-earth.kml+xml', 'application/xml', 'text/xml'),
+ 'ics' => 'text/calendar',
+ 'ical' => 'text/calendar',
+ 'zsh' => 'text/x-scriptzsh',
+ '7z' => array('application/x-7z-compressed', 'application/x-compressed', 'application/x-zip-compressed', 'application/zip', 'multipart/x-zip'),
+ '7zip' => array('application/x-7z-compressed', 'application/x-compressed', 'application/x-zip-compressed', 'application/zip', 'multipart/x-zip'),
+ 'cdr' => array('application/cdr', 'application/coreldraw', 'application/x-cdr', 'application/x-coreldraw', 'image/cdr', 'image/x-cdr', 'zz-application/zz-winassoc-cdr'),
+ 'wma' => array('audio/x-ms-wma', 'video/x-ms-asf'),
+ 'jar' => array('application/java-archive', 'application/x-java-application', 'application/x-jar', 'application/x-compressed'),
+ 'svg' => array('image/svg+xml', 'image/svg', 'application/xml', 'text/xml'),
+ 'vcf' => 'text/x-vcard',
+ 'srt' => array('text/srt', 'text/plain'),
+ 'vtt' => array('text/vtt', 'text/plain'),
+ 'ico' => array('image/x-icon', 'image/x-ico', 'image/vnd.microsoft.icon'),
+ 'odc' => 'application/vnd.oasis.opendocument.chart',
+ 'otc' => 'application/vnd.oasis.opendocument.chart-template',
+ 'odf' => 'application/vnd.oasis.opendocument.formula',
+ 'otf' => 'application/vnd.oasis.opendocument.formula-template',
+ 'odg' => 'application/vnd.oasis.opendocument.graphics',
+ 'otg' => 'application/vnd.oasis.opendocument.graphics-template',
+ 'odi' => 'application/vnd.oasis.opendocument.image',
+ 'oti' => 'application/vnd.oasis.opendocument.image-template',
+ 'odp' => 'application/vnd.oasis.opendocument.presentation',
+ 'otp' => 'application/vnd.oasis.opendocument.presentation-template',
+ 'ods' => 'application/vnd.oasis.opendocument.spreadsheet',
+ 'ots' => 'application/vnd.oasis.opendocument.spreadsheet-template',
+ 'odt' => 'application/vnd.oasis.opendocument.text',
+ 'odm' => 'application/vnd.oasis.opendocument.text-master',
+ 'ott' => 'application/vnd.oasis.opendocument.text-template',
+ 'oth' => 'application/vnd.oasis.opendocument.text-web'
+);
diff --git a/application/config/profiler.php b/application/config/profiler.php
new file mode 100755
index 0000000..121c46f
--- /dev/null
+++ b/application/config/profiler.php
@@ -0,0 +1,14 @@
+ my_controller/index
+| my-controller/my-method -> my_controller/my_method
+*/
+//public pages
+$route['default_controller'] = 'pages/index';
+$route['404_override'] = '';
+$route['translate_uri_dashes'] = FALSE;
+
+$route['home'] = 'pages/index';
+$route['dashboard'] = 'admin/dashboard';
+$route['profile'] = 'pages/profile';
+$route['log-monitor'] = 'Pages/log_monitor';
+$route['(:any)/barber'] = 'pages/barber/$1';
+$route['(:any)/beauty'] = 'pages/beauty/$1';
+$route['(:any)/booking/(:any)'] = 'pages/booking/$1/$2';
+$route['(:any)/booking-finished/(:any)'] = 'pages/booking_finished/$1/$2';
+$route['email-verification'] = 'pages/email_verification';
+$route['ajax'] = 'pages/ajax';
+$route['module-management'] = 'ModuleManagement/index';
+$route['booking-process'] = 'pages/booking_process';
+
+//admin portal
+$route['login'] = 'Login/index';
+$route['users'] = 'admin/users';
+$route['user-management'] = 'UserManagement/index';
+$route['add-new-user'] = 'UserManagement/add_new_user';
+$route['modify-user/(:any)'] = 'UserManagement/modify_user/$1';
+$route['user-process'] = 'UserManagement/user_process';
+
+$route['services'] = 'admin/services';
+$route['services/add-service'] = 'admin/add_service';
+$route['services/update-service/(:any)'] = 'admin/update_service/$1';
+$route['services/service-process'] = 'admin/service_process';
+
+$route['service-categories'] = 'admin/service_categories';
+$route['services/add-service-category'] = 'admin/add_service_category';
+$route['services/update-service-category/(:any)'] = 'admin/update_service_category/$1';
+$route['services/service-category-process'] = 'admin/service_category_process';
+
+$route['workers'] = 'admin/workers';
+$route['workers/add-worker'] = 'admin/add_worker';
+$route['workers/update-worker/(:any)'] = 'admin/update_worker/$1';
+$route['workers/worker-process'] = 'admin/worker_process';
+
+$route['bookings'] = 'admin/bookings';
+$route['bookings/add-booking'] = 'admin/add_booking';
+$route['bookings/update-booking/(:any)'] = 'admin/update_booking/$1';
+$route['bookings/booking-process'] = 'admin/booking_process';
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/application/config/routes_20240401.php b/application/config/routes_20240401.php
new file mode 100755
index 0000000..ac766ee
--- /dev/null
+++ b/application/config/routes_20240401.php
@@ -0,0 +1,109 @@
+ my_controller/index
+| my-controller/my-method -> my_controller/my_method
+*/
+//public pages
+$route['default_controller'] = 'pages/index';
+$route['404_override'] = '';
+$route['translate_uri_dashes'] = FALSE;
+
+$route['home'] = 'pages/index';
+$route['(:any)/barber'] = 'pages/barber/$1';
+$route['(:any)/beauty'] = 'pages/beauty/$1';
+$route['(:any)/booking/(:any)'] = 'pages/booking/$1/$2';
+$route['(:any)/booking-finished/(:any)'] = 'pages/booking_finished/$1/$2';
+$route['email-verification'] = 'pages/email_verification';
+$route['ajax'] = 'pages/ajax';
+
+//admin portal
+$route['login'] = 'admin/login';
+$route['users'] = 'admin/users';
+$route['create-user'] = 'admin/create_user';
+$route['update-user'] = 'admin/update_user';
+$route['user-process'] = 'admin/user_process';
+
+$route['services'] = 'admin/services';
+$route['add-service'] = 'admin/add_service';
+$route['update-service'] = 'admin/update_service';
+$route['service-process'] = 'admin/service_process';
+
+$route['workers'] = 'admin/workers';
+$route['add-worker'] = 'admin/add_worker';
+$route['update-worker'] = 'admin/update_worker';
+$route['worker-process'] = 'admin/worker_process';
+
+$route['booking-process'] = 'pages/booking_process';
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/application/config/routes_20250312.php b/application/config/routes_20250312.php
new file mode 100755
index 0000000..3b3fc3a
--- /dev/null
+++ b/application/config/routes_20250312.php
@@ -0,0 +1,118 @@
+ my_controller/index
+| my-controller/my-method -> my_controller/my_method
+*/
+//public pages
+$route['default_controller'] = 'pages/index';
+$route['404_override'] = '';
+$route['translate_uri_dashes'] = FALSE;
+
+$route['home'] = 'pages/index';
+$route['dashboard'] = 'admin/dashboard';
+$route['profile'] = 'pages/profile';
+$route['log-monitor'] = 'Pages/log_monitor';
+$route['(:any)/barber'] = 'pages/barber/$1';
+$route['(:any)/beauty'] = 'pages/beauty/$1';
+$route['(:any)/booking/(:any)'] = 'pages/booking/$1/$2';
+$route['(:any)/booking-finished/(:any)'] = 'pages/booking_finished/$1/$2';
+$route['email-verification'] = 'pages/email_verification';
+$route['ajax'] = 'pages/ajax';
+$route['module-management'] = 'ModuleManagement/index';
+$route['booking-process'] = 'pages/booking_process';
+
+//admin portal
+$route['login'] = 'Login/index';
+$route['users'] = 'admin/users';
+$route['user-management'] = 'UserManagement/index';
+$route['add-new-user'] = 'UserManagement/add_new_user';
+$route['modify-user/(:any)'] = 'UserManagement/modify_user/$1';
+$route['user-process'] = 'UserManagement/user_process';
+
+$route['services'] = 'admin/services';
+$route['services/add-service'] = 'admin/add_service';
+$route['services/update-service/(:any)'] = 'admin/update_service/$1';
+$route['services/service-process'] = 'admin/service_process';
+
+$route['workers'] = 'admin/workers';
+$route['workers/add-worker'] = 'admin/add_worker';
+$route['workers/update-worker/(:any)'] = 'admin/update_worker/$1';
+$route['workers/worker-process'] = 'admin/worker_process';
+
+$route['bookings'] = 'admin/bookings';
+$route['bookings/add-booking'] = 'admin/add_booking';
+$route['bookings/update-booking/(:any)'] = 'admin/update_booking/$1';
+$route['bookings/booking-process'] = 'admin/booking_process';
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/application/config/smileys.php b/application/config/smileys.php
new file mode 100755
index 0000000..7ae311a
--- /dev/null
+++ b/application/config/smileys.php
@@ -0,0 +1,64 @@
+ array('grin.gif', '19', '19', 'grin'),
+ ':lol:' => array('lol.gif', '19', '19', 'LOL'),
+ ':cheese:' => array('cheese.gif', '19', '19', 'cheese'),
+ ':)' => array('smile.gif', '19', '19', 'smile'),
+ ';-)' => array('wink.gif', '19', '19', 'wink'),
+ ';)' => array('wink.gif', '19', '19', 'wink'),
+ ':smirk:' => array('smirk.gif', '19', '19', 'smirk'),
+ ':roll:' => array('rolleyes.gif', '19', '19', 'rolleyes'),
+ ':-S' => array('confused.gif', '19', '19', 'confused'),
+ ':wow:' => array('surprise.gif', '19', '19', 'surprised'),
+ ':bug:' => array('bigsurprise.gif', '19', '19', 'big surprise'),
+ ':-P' => array('tongue_laugh.gif', '19', '19', 'tongue laugh'),
+ '%-P' => array('tongue_rolleye.gif', '19', '19', 'tongue rolleye'),
+ ';-P' => array('tongue_wink.gif', '19', '19', 'tongue wink'),
+ ':P' => array('raspberry.gif', '19', '19', 'raspberry'),
+ ':blank:' => array('blank.gif', '19', '19', 'blank stare'),
+ ':long:' => array('longface.gif', '19', '19', 'long face'),
+ ':ohh:' => array('ohh.gif', '19', '19', 'ohh'),
+ ':grrr:' => array('grrr.gif', '19', '19', 'grrr'),
+ ':gulp:' => array('gulp.gif', '19', '19', 'gulp'),
+ '8-/' => array('ohoh.gif', '19', '19', 'oh oh'),
+ ':down:' => array('downer.gif', '19', '19', 'downer'),
+ ':red:' => array('embarrassed.gif', '19', '19', 'red face'),
+ ':sick:' => array('sick.gif', '19', '19', 'sick'),
+ ':shut:' => array('shuteye.gif', '19', '19', 'shut eye'),
+ ':-/' => array('hmm.gif', '19', '19', 'hmmm'),
+ '>:(' => array('mad.gif', '19', '19', 'mad'),
+ ':mad:' => array('mad.gif', '19', '19', 'mad'),
+ '>:-(' => array('angry.gif', '19', '19', 'angry'),
+ ':angry:' => array('angry.gif', '19', '19', 'angry'),
+ ':zip:' => array('zip.gif', '19', '19', 'zipper'),
+ ':kiss:' => array('kiss.gif', '19', '19', 'kiss'),
+ ':ahhh:' => array('shock.gif', '19', '19', 'shock'),
+ ':coolsmile:' => array('shade_smile.gif', '19', '19', 'cool smile'),
+ ':coolsmirk:' => array('shade_smirk.gif', '19', '19', 'cool smirk'),
+ ':coolgrin:' => array('shade_grin.gif', '19', '19', 'cool grin'),
+ ':coolhmm:' => array('shade_hmm.gif', '19', '19', 'cool hmm'),
+ ':coolmad:' => array('shade_mad.gif', '19', '19', 'cool mad'),
+ ':coolcheese:' => array('shade_cheese.gif', '19', '19', 'cool cheese'),
+ ':vampire:' => array('vampire.gif', '19', '19', 'vampire'),
+ ':snake:' => array('snake.gif', '19', '19', 'snake'),
+ ':exclaim:' => array('exclaim.gif', '19', '19', 'exclaim'),
+ ':question:' => array('question.gif', '19', '19', 'question')
+
+);
diff --git a/application/config/user_agents.php b/application/config/user_agents.php
new file mode 100755
index 0000000..32e1cd4
--- /dev/null
+++ b/application/config/user_agents.php
@@ -0,0 +1,222 @@
+ 'Windows 10',
+ 'windows nt 6.3' => 'Windows 8.1',
+ 'windows nt 6.2' => 'Windows 8',
+ 'windows nt 6.1' => 'Windows 7',
+ 'windows nt 6.0' => 'Windows Vista',
+ 'windows nt 5.2' => 'Windows 2003',
+ 'windows nt 5.1' => 'Windows XP',
+ 'windows nt 5.0' => 'Windows 2000',
+ 'windows nt 4.0' => 'Windows NT 4.0',
+ 'winnt4.0' => 'Windows NT 4.0',
+ 'winnt 4.0' => 'Windows NT',
+ 'winnt' => 'Windows NT',
+ 'windows 98' => 'Windows 98',
+ 'win98' => 'Windows 98',
+ 'windows 95' => 'Windows 95',
+ 'win95' => 'Windows 95',
+ 'windows phone' => 'Windows Phone',
+ 'windows' => 'Unknown Windows OS',
+ 'android' => 'Android',
+ 'blackberry' => 'BlackBerry',
+ 'iphone' => 'iOS',
+ 'ipad' => 'iOS',
+ 'ipod' => 'iOS',
+ 'os x' => 'Mac OS X',
+ 'ppc mac' => 'Power PC Mac',
+ 'freebsd' => 'FreeBSD',
+ 'ppc' => 'Macintosh',
+ 'linux' => 'Linux',
+ 'debian' => 'Debian',
+ 'sunos' => 'Sun Solaris',
+ 'beos' => 'BeOS',
+ 'apachebench' => 'ApacheBench',
+ 'aix' => 'AIX',
+ 'irix' => 'Irix',
+ 'osf' => 'DEC OSF',
+ 'hp-ux' => 'HP-UX',
+ 'netbsd' => 'NetBSD',
+ 'bsdi' => 'BSDi',
+ 'openbsd' => 'OpenBSD',
+ 'gnu' => 'GNU/Linux',
+ 'unix' => 'Unknown Unix OS',
+ 'symbian' => 'Symbian OS'
+);
+
+
+// The order of this array should NOT be changed. Many browsers return
+// multiple browser types so we want to identify the sub-type first.
+$browsers = array(
+ 'OPR' => 'Opera',
+ 'Flock' => 'Flock',
+ 'Edge' => 'Edge',
+ 'Chrome' => 'Chrome',
+ // Opera 10+ always reports Opera/9.80 and appends Version/ to the user agent string
+ 'Opera.*?Version' => 'Opera',
+ 'Opera' => 'Opera',
+ 'MSIE' => 'Internet Explorer',
+ 'Internet Explorer' => 'Internet Explorer',
+ 'Trident.* rv' => 'Internet Explorer',
+ 'Shiira' => 'Shiira',
+ 'Firefox' => 'Firefox',
+ 'Chimera' => 'Chimera',
+ 'Phoenix' => 'Phoenix',
+ 'Firebird' => 'Firebird',
+ 'Camino' => 'Camino',
+ 'Netscape' => 'Netscape',
+ 'OmniWeb' => 'OmniWeb',
+ 'Safari' => 'Safari',
+ 'Mozilla' => 'Mozilla',
+ 'Konqueror' => 'Konqueror',
+ 'icab' => 'iCab',
+ 'Lynx' => 'Lynx',
+ 'Links' => 'Links',
+ 'hotjava' => 'HotJava',
+ 'amaya' => 'Amaya',
+ 'IBrowse' => 'IBrowse',
+ 'Maxthon' => 'Maxthon',
+ 'Ubuntu' => 'Ubuntu Web Browser'
+);
+
+$mobiles = array(
+ // legacy array, old values commented out
+ 'mobileexplorer' => 'Mobile Explorer',
+// 'openwave' => 'Open Wave',
+// 'opera mini' => 'Opera Mini',
+// 'operamini' => 'Opera Mini',
+// 'elaine' => 'Palm',
+ 'palmsource' => 'Palm',
+// 'digital paths' => 'Palm',
+// 'avantgo' => 'Avantgo',
+// 'xiino' => 'Xiino',
+ 'palmscape' => 'Palmscape',
+// 'nokia' => 'Nokia',
+// 'ericsson' => 'Ericsson',
+// 'blackberry' => 'BlackBerry',
+// 'motorola' => 'Motorola'
+
+ // Phones and Manufacturers
+ 'motorola' => 'Motorola',
+ 'nokia' => 'Nokia',
+ 'nexus' => 'Nexus',
+ 'palm' => 'Palm',
+ 'iphone' => 'Apple iPhone',
+ 'ipad' => 'iPad',
+ 'ipod' => 'Apple iPod Touch',
+ 'sony' => 'Sony Ericsson',
+ 'ericsson' => 'Sony Ericsson',
+ 'blackberry' => 'BlackBerry',
+ 'cocoon' => 'O2 Cocoon',
+ 'blazer' => 'Treo',
+ 'lg' => 'LG',
+ 'amoi' => 'Amoi',
+ 'xda' => 'XDA',
+ 'mda' => 'MDA',
+ 'vario' => 'Vario',
+ 'htc' => 'HTC',
+ 'samsung' => 'Samsung',
+ 'sharp' => 'Sharp',
+ 'sie-' => 'Siemens',
+ 'alcatel' => 'Alcatel',
+ 'benq' => 'BenQ',
+ 'ipaq' => 'HP iPaq',
+ 'mot-' => 'Motorola',
+ 'playstation portable' => 'PlayStation Portable',
+ 'playstation 3' => 'PlayStation 3',
+ 'playstation vita' => 'PlayStation Vita',
+ 'hiptop' => 'Danger Hiptop',
+ 'nec-' => 'NEC',
+ 'panasonic' => 'Panasonic',
+ 'philips' => 'Philips',
+ 'sagem' => 'Sagem',
+ 'sanyo' => 'Sanyo',
+ 'spv' => 'SPV',
+ 'zte' => 'ZTE',
+ 'sendo' => 'Sendo',
+ 'nintendo dsi' => 'Nintendo DSi',
+ 'nintendo ds' => 'Nintendo DS',
+ 'nintendo 3ds' => 'Nintendo 3DS',
+ 'wii' => 'Nintendo Wii',
+ 'open web' => 'Open Web',
+ 'openweb' => 'OpenWeb',
+ 'meizu' => 'Meizu',
+ 'huawei' => 'Huawei',
+ 'xiaomi' => 'Xiaomi',
+ 'oppo' => 'Oppo',
+ 'vivo' => 'Vivo',
+ 'infinix' => 'Infinix',
+
+ // Operating Systems
+ 'android' => 'Android',
+ 'symbian' => 'Symbian',
+ 'SymbianOS' => 'SymbianOS',
+ 'elaine' => 'Palm',
+ 'series60' => 'Symbian S60',
+ 'windows ce' => 'Windows CE',
+
+ // Browsers
+ 'obigo' => 'Obigo',
+ 'netfront' => 'Netfront Browser',
+ 'openwave' => 'Openwave Browser',
+ 'mobilexplorer' => 'Mobile Explorer',
+ 'operamini' => 'Opera Mini',
+ 'opera mini' => 'Opera Mini',
+ 'opera mobi' => 'Opera Mobile',
+ 'fennec' => 'Firefox Mobile',
+
+ // Other
+ 'digital paths' => 'Digital Paths',
+ 'avantgo' => 'AvantGo',
+ 'xiino' => 'Xiino',
+ 'novarra' => 'Novarra Transcoder',
+ 'vodafone' => 'Vodafone',
+ 'docomo' => 'NTT DoCoMo',
+ 'o2' => 'O2',
+
+ // Fallback
+ 'mobile' => 'Generic Mobile',
+ 'wireless' => 'Generic Mobile',
+ 'j2me' => 'Generic Mobile',
+ 'midp' => 'Generic Mobile',
+ 'cldc' => 'Generic Mobile',
+ 'up.link' => 'Generic Mobile',
+ 'up.browser' => 'Generic Mobile',
+ 'smartphone' => 'Generic Mobile',
+ 'cellphone' => 'Generic Mobile'
+);
+
+// There are hundreds of bots but these are the most common.
+$robots = array(
+ 'googlebot' => 'Googlebot',
+ 'msnbot' => 'MSNBot',
+ 'baiduspider' => 'Baiduspider',
+ 'bingbot' => 'Bing',
+ 'slurp' => 'Inktomi Slurp',
+ 'yahoo' => 'Yahoo',
+ 'ask jeeves' => 'Ask Jeeves',
+ 'fastcrawler' => 'FastCrawler',
+ 'infoseek' => 'InfoSeek Robot 1.0',
+ 'lycos' => 'Lycos',
+ 'yandex' => 'YandexBot',
+ 'mediapartners-google' => 'MediaPartners Google',
+ 'CRAZYWEBCRAWLER' => 'Crazy Webcrawler',
+ 'adsbot-google' => 'AdsBot Google',
+ 'feedfetcher-google' => 'Feedfetcher Google',
+ 'curious george' => 'Curious George',
+ 'ia_archiver' => 'Alexa Crawler',
+ 'MJ12bot' => 'Majestic-12',
+ 'Uptimebot' => 'Uptimebot',
+ 'UptimeRobot' => 'UptimeRobot'
+);
diff --git a/application/controllers/Admin.php b/application/controllers/Admin.php
new file mode 100755
index 0000000..8107ff0
--- /dev/null
+++ b/application/controllers/Admin.php
@@ -0,0 +1,1149 @@
+
+ * @see https://codeigniter.com/userguide3/general/urls.html
+ */
+ public function dashboard(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+ $this->load->model('Module_model');
+
+ if(isset($_SESSION['username'])){
+ $data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
+ $data['pageTitle'] = 'Vezérlőpult';
+ $data['message'] = '';
+ $data['message_class'] = '';
+ if($this->User_model->is_user_admin($_SESSION['username'])){
+ $data['activeModules'] = $this->Module_model->getAllModule();
+ }
+ else{
+ $data['activeModules'] = $this->Module_model->getUserModules($data['currentUser']->user_id);
+ }
+
+ $this->load->view('admin/dashboard', $data);
+ }
+ else{
+ header("Location:".SITEURL."login");
+ }
+ }
+
+ public function services(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+ $this->load->model('Module_model');
+
+ if(isset($_SESSION['username'])){
+ $data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
+ $data['pageTitle'] = 'Szolgáltatások';
+ $data['message'] = '';
+ $data['message_class'] = '';
+ if($this->User_model->is_user_admin($_SESSION['username'])){
+ $data['activeModules'] = $this->Module_model->getAllModule();
+ }
+ else{
+ $data['activeModules'] = $this->Module_model->getUserModules($data['currentUser']->user_id);
+ }
+
+ $data['results'] = $this->Service_model->getAllServices();
+
+ $this->load->view('admin/services', $data);
+ }
+ else{
+ header("Location:".SITEURL."login");
+ }
+ }
+
+ public function add_service(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+ $this->load->model('Module_model');
+
+ if(isset($_SESSION['username'])){
+ $data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
+ $data['pageTitle'] = 'Szolgáltatás hozzáadás';
+ $data['message'] = '';
+ $data['message_class'] = '';
+ if($this->User_model->is_user_admin($_SESSION['username'])){
+ $data['activeModules'] = $this->Module_model->getAllModule();
+ }
+ else{
+ $data['activeModules'] = $this->Module_model->getUserModules($data['currentUser']->user_id);
+ }
+
+ $data['serviceCategories'] = $this->Service_model->getAllServiceCategories();
+ $this->load->view('admin/add-service', $data);
+ }
+ else{
+ header("Location:".SITEURL."login");
+ }
+ }
+
+ public function worker_schedule() {
+ $this->load->helper('url');
+ $this->load->model('Service_model');
+ $this->load->model('User_model');
+ $this->load->model('Module_model');
+
+ if (!isset($_SESSION['username'])) {
+ header("Location:".SITEURL."login");
+ exit;
+ }
+
+ $data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
+
+ if ($this->User_model->is_user_admin($_SESSION['username'])) {
+ $data['activeModules'] = $this->Module_model->getAllModule();
+ } else {
+ $data['activeModules'] = $this->Module_model->getUserModules($data['currentUser']->user_id);
+ }
+
+ $data['workers'] = $this->Service_model->getAllWorkers();
+
+ $worker_id = $this->input->get('worker_id');
+ if ($worker_id) {
+ $data['selectedWorkerId'] = $worker_id;
+ $data['schedule'] = $this->Service_model->getWorkerSchedule($worker_id);
+ } else {
+ $data['selectedWorkerId'] = null;
+ $data['schedule'] = [];
+ }
+
+ $this->load->view('admin/worker_schedule', $data);
+ }
+
+ public function worker_schedule_overrides() {
+ $this->load->model('Service_model');
+ $data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
+ $data['workerSchedules'] = $this->Service_model->getWorkerScheduleOverrides();
+ $data['workers'] = $this->Service_model->getAllWorkers();
+ $data['pageTitle'] = 'Dolgozói egyedi munkaidők';
+ $this->load->view('admin/worker_schedule_overrides', $data);
+ }
+
+ public function admin_worker_schedule() {
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+
+ $data['pageTitle'] = 'Munkarend beállítása';
+ $data['workers'] = $this->Service_model->getAllWorkers();
+
+ if ($this->input->post('storeSchedule')) {
+ $this->load->database();
+ $this->db->where('worker_id', $_POST['worker_id']);
+ $this->db->delete('worker_schedule');
+
+ foreach ($_POST['weekday'] as $i => $day) {
+ $insert = [
+ 'worker_id' => $_POST['worker_id'],
+ 'weekday' => $day,
+ 'start_time' => $_POST['start_time'][$i],
+ 'end_time' => $_POST['end_time'][$i],
+ 'is_alternate_week' => isset($_POST['is_alternate_week'][$i]) ? 1 : 0
+ ];
+ $this->db->insert('worker_schedule', $insert);
+ }
+ }
+
+ if (!empty($_GET['worker_id'])) {
+ $this->load->database();
+ $worker_id = $_GET['worker_id'];
+ $data['selectedWorkerId'] = $worker_id;
+ $data['schedule'] = $this->db->query("SELECT * FROM worker_schedule WHERE worker_id = '$worker_id'")->result();
+ }
+
+ $this->load->view('admin/worker_schedule', $data);
+ }
+
+ public function store_worker_schedule() {
+ $this->load->model('Service_model');
+ $this->load->helper('url');
+
+ $worker_id = $this->input->post('worker_id');
+
+ if (!$worker_id) {
+ show_error('Dolgozó nincs kiválasztva.');
+ return;
+ }
+
+ // Clear existing schedule
+ $this->Service_model->clearWorkerSchedule($worker_id);
+
+ // Loop through submitted times
+ for ($i = 0; $i <= 6; $i++) {
+ $start = $this->input->post("start_time[$i]");
+ $end = $this->input->post("end_time[$i]");
+ $alt = $this->input->post("alternate_week[$i]") ? 1 : 0;
+
+ if (!empty($start) && !empty($end)) {
+ $this->Service_model->addWorkerSchedule([
+ 'worker_id' => $worker_id,
+ 'weekday' => $i,
+ 'start_time' => $start,
+ 'end_time' => $end,
+ 'is_alternate_week' => $alt
+ ]);
+ }
+ }
+
+ redirect('admin/worker_schedule');
+ }
+
+
+
+ public function admin_worker_override() {
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+
+ $data['pageTitle'] = 'Egyedi napok kezelése';
+ $data['workers'] = $this->Service_model->getAllWorkers();
+
+ if ($this->input->post('storeOverride')) {
+ $this->load->database();
+ $insert = [
+ 'worker_id' => $_POST['worker_id'],
+ 'date' => $_POST['date'],
+ 'is_day_off' => isset($_POST['is_day_off']) ? 1 : 0,
+ 'start_time' => $_POST['start_time'],
+ 'end_time' => $_POST['end_time']
+ ];
+
+ $existing = $this->db->query("SELECT * FROM worker_schedule_overrides WHERE worker_id = '{$insert['worker_id']}' AND date = '{$insert['date']}'")->row();
+ if ($existing) {
+ $this->db->where('id', $existing->id)->update('worker_schedule_overrides', $insert);
+ } else {
+ $this->db->insert('worker_schedule_overrides', $insert);
+ }
+ }
+
+ if (!empty($_GET['worker_id'])) {
+ $this->load->database();
+ $worker_id = $_GET['worker_id'];
+ $data['selectedWorkerId'] = $worker_id;
+ $data['overrides'] = $this->db->query("SELECT * FROM worker_schedule_overrides WHERE worker_id = '$worker_id' ORDER BY date ASC")->result();
+ }
+
+ $this->load->view('admin/worker_override', $data);
+ }
+
+
+ public function manage_worker_schedule($worker_id = null) {
+ $this->load->model('Service_model');
+ $data['workers'] = $this->Service_model->getAllWorkers();
+ $data['selectedWorker'] = null;
+ $data['schedule'] = [];
+
+ if ($worker_id) {
+ $data['selectedWorker'] = $this->Service_model->getWorkerById($worker_id);
+ $data['schedule'] = $this->Service_model->getWorkerSchedule($worker_id);
+ }
+
+ $this->load->view('admin/manage_worker_schedule', $data);
+ }
+
+ public function save_worker_schedule() {
+ $this->load->model('Service_model');
+
+ $worker_id = $this->input->post('worker_id');
+ $this->Service_model->clearWorkerSchedule($worker_id);
+
+ foreach ($_POST['weekday'] as $index => $day) {
+ if (!empty($_POST['start_time'][$index]) && !empty($_POST['end_time'][$index])) {
+ $this->Service_model->addWorkerSchedule([
+ 'worker_id' => $worker_id,
+ 'weekday' => $day,
+ 'start_time' => $_POST['start_time'][$index],
+ 'end_time' => $_POST['end_time'][$index],
+ 'is_alternate_week' => isset($_POST['is_alternate_week'][$index]) ? 1 : 0
+ ]);
+ }
+ }
+
+ redirect('admin/manage_worker_schedule/' . $worker_id);
+ }
+
+
+ public function update_service($service_id){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+ $this->load->model('Module_model');
+
+ if(isset($_SESSION['username'])){
+ $data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
+ $data['pageTitle'] = 'Szolgáltatás módosítása (#'.$service_id.')';
+ $data['message'] = '';
+ $data['message_class'] = '';
+ if($this->User_model->is_user_admin($_SESSION['username'])){
+ $data['activeModules'] = $this->Module_model->getAllModule();
+ }
+ else{
+ $data['activeModules'] = $this->Module_model->getUserModules($data['currentUser']->user_id);
+ }
+
+ $data['selectedItem'] = $this->Service_model->getServiceById($service_id);
+ $data['serviceCategories'] = $this->Service_model->getAllServiceCategories();
+ $this->load->view('admin/update-service', $data);
+ }
+ else{
+ header("Location:".SITEURL."login");
+ }
+ }
+
+ public function service_process(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+ $this->load->model('Log_model');
+
+ if(isset($_SESSION['username'])){
+ $data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
+ $data['pageTitle'] = '';
+ $data['message'] = '';
+ $data['message_class'] = '';
+
+ if(isset($_GET['delete-service'])){
+ $selected_service = $this->Service_model->getServiceById($_GET['delete-service']);
+ $serviceArray = array(
+ 'is_deleted' => '1'
+ );
+
+ $this->Service_model->updateService($_GET['delete-service'], $serviceArray);
+ $this->Log_model->addLog('services', $data['currentUser']->username.' törölte a(z) '.$_GET['delete-service'].' számú szolgáltatást ('.$selected_service->service_name_hu.')', $data['currentUser']->username);
+
+ }
+
+ if(isset($_POST['addNewService'])){
+ $serviceArray = array(
+ 'service_type' => $_POST['service_type'],
+ 'service_category_no' => $_POST['service_category_no'],
+ 'service_category_en' => $_POST['service_category_en'],
+ 'service_category_hu' => $_POST['service_category_hu'],
+ 'service_name_no' => $_POST['service_name_no'],
+ 'service_name_en' => $_POST['service_name_en'],
+ 'service_name_hu' => $_POST['service_name_hu'],
+ 'service_description_no' => $_POST['service_description_no'],
+ 'service_description_en' => $_POST['service_description_en'],
+ 'service_description_hu' => $_POST['service_description_hu'],
+ 'service_price' => $_POST['service_price'],
+ 'service_time' => $_POST['service_time'],
+ 'service_category_id' => $_POST['service_category_id'],
+ 'is_enabled' => $_POST['is_enabled']
+ );
+
+ $this->Log_model->addLog('services', $data['currentUser']->username.' hozzáadta a(z) '.$_POST['service_name_hu'].' szolgáltatást ('.implode(',',$serviceArray).')', $data['currentUser']->username);
+ $this->Service_model->createService($serviceArray);
+ }
+
+ if(isset($_POST['updateService'])){
+ $serviceArray = array(
+ 'service_type' => $_POST['service_type'],
+ 'service_category_no' => $_POST['service_category_no'],
+ 'service_category_en' => $_POST['service_category_en'],
+ 'service_category_hu' => $_POST['service_category_hu'],
+ 'service_name_no' => $_POST['service_name_no'],
+ 'service_name_en' => $_POST['service_name_en'],
+ 'service_name_hu' => $_POST['service_name_hu'],
+ 'service_description_no' => $_POST['service_description_no'],
+ 'service_description_en' => $_POST['service_description_en'],
+ 'service_description_hu' => $_POST['service_description_hu'],
+ 'service_price' => $_POST['service_price'],
+ 'service_time' => $_POST['service_time'],
+ 'service_category_id' => $_POST['service_category_id'],
+ 'is_enabled' => $_POST['is_enabled']
+ );
+
+ $this->Log_model->addLog('services', $data['currentUser']->username.' módosította a(z) '.$_POST['service_name_hu'].' szolgáltatást ('.implode(',',$serviceArray).')', $data['currentUser']->username);
+ $this->Service_model->updateService($_POST['service_id'], $serviceArray);
+ }
+
+ header('Location:'.SITEURL.'services');
+ $this->load->view('admin/service-process', $data);
+ }
+ }
+
+ public function service_categories(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+ $this->load->model('Module_model');
+
+ if(isset($_SESSION['username'])){
+ $data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
+ $data['pageTitle'] = 'Szolgáltatás kategóriák';
+ $data['message'] = '';
+ $data['message_class'] = '';
+ if($this->User_model->is_user_admin($_SESSION['username'])){
+ $data['activeModules'] = $this->Module_model->getAllModule();
+ }
+ else{
+ $data['activeModules'] = $this->Module_model->getUserModules($data['currentUser']->user_id);
+ }
+
+ $data['results'] = $this->Service_model->getAllServiceCategories();
+
+ $this->load->view('admin/service-categories', $data);
+ }
+ else{
+ header("Location:".SITEURL."login");
+ }
+ }
+
+ public function add_service_category(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+ $this->load->model('Module_model');
+
+ if(isset($_SESSION['username'])){
+ $data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
+ $data['pageTitle'] = 'Szolgáltatás kategória hozzáadása';
+ $data['message'] = '';
+ $data['message_class'] = '';
+ if($this->User_model->is_user_admin($_SESSION['username'])){
+ $data['activeModules'] = $this->Module_model->getAllModule();
+ }
+ else{
+ $data['activeModules'] = $this->Module_model->getUserModules($data['currentUser']->user_id);
+ }
+
+
+ $this->load->view('admin/add-service-category', $data);
+ }
+ else{
+ header("Location:".SITEURL."login");
+ }
+ }
+
+ public function update_service_category($service_category_id){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+ $this->load->model('Module_model');
+
+ if(isset($_SESSION['username'])){
+ $data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
+ $data['pageTitle'] = 'Szolgáltatás módosítása (#'.$service_category_id.')';
+ $data['message'] = '';
+ $data['message_class'] = '';
+ if($this->User_model->is_user_admin($_SESSION['username'])){
+ $data['activeModules'] = $this->Module_model->getAllModule();
+ }
+ else{
+ $data['activeModules'] = $this->Module_model->getUserModules($data['currentUser']->user_id);
+ }
+
+ $data['selectedItem'] = $this->Service_model->getServiceCategoryById($service_category_id);
+ $this->load->view('admin/update-service-category', $data);
+ }
+ else{
+ header("Location:".SITEURL."login");
+ }
+ }
+
+ public function service_category_process(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+ $this->load->model('Log_model');
+
+ if(isset($_SESSION['username'])){
+ $data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
+ $data['pageTitle'] = '';
+ $data['message'] = '';
+ $data['message_class'] = '';
+
+ if(isset($_GET['delete-service-category'])){
+ $selected_service = $this->Service_model->getServiceCategoryById($_GET['delete-service-category']);
+ $serviceArray = array(
+ 'is_deleted' => '1'
+ );
+
+ $this->Service_model->updateServiceCategory($_GET['delete-service-category'], $serviceArray);
+
+ }
+
+ if(isset($_POST['addNewServiceCategory'])){
+ $serviceCategoryArray = array(
+ 'serv_cat_slug' => $_POST['serv_cat_slug'],
+ 'serv_cat_name' => $_POST['serv_cat_name']
+ );
+
+ $this->Service_model->createServiceCategory($serviceCategoryArray);
+ }
+
+ if(isset($_POST['updateServiceCategory'])){
+ $serviceCategoryArray = array(
+ 'serv_cat_slug' => $_POST['serv_cat_slug'],
+ 'serv_cat_name' => $_POST['serv_cat_name']
+ );
+
+ $this->Service_model->updateServiceCategory($_POST['service_category_id'], $serviceCategoryArray);
+ }
+
+ header('Location:'.SITEURL.'service-categories');
+ $this->load->view('admin/service-category-process', $data);
+ }
+ }
+ public function workers(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+ $this->load->model('Module_model');
+
+ if(isset($_SESSION['username'])){
+ $data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
+ $data['pageTitle'] = 'Dolgozók';
+ $data['message'] = '';
+ $data['message_class'] = '';
+ if($this->User_model->is_user_admin($_SESSION['username'])){
+ $data['activeModules'] = $this->Module_model->getAllModule();
+ }
+ else{
+ $data['activeModules'] = $this->Module_model->getUserModules($data['currentUser']->user_id);
+ }
+
+ $data['results'] = $this->Service_model->getAllWorkers();
+
+ $this->load->view('admin/workers', $data);
+ }
+ else{
+ header("Location:".SITEURL."login");
+ }
+ }
+
+ public function add_worker(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+ $this->load->model('Module_model');
+
+ if(isset($_SESSION['username'])){
+ $data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
+ $data['pageTitle'] = 'Dolgozó hozzáadása';
+ $data['message'] = '';
+ $data['message_class'] = '';
+ if($this->User_model->is_user_admin($_SESSION['username'])){
+ $data['activeModules'] = $this->Module_model->getAllModule();
+ }
+ else{
+ $data['activeModules'] = $this->Module_model->getUserModules($data['currentUser']->user_id);
+ }
+
+ $data['serviceCategories'] = $this->Service_model->getAllServiceCategories();
+ $this->load->view('admin/add-worker', $data);
+ }
+ else{
+ header("Location:".SITEURL."login");
+ }
+ }
+
+ public function update_worker($worker_id){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+ $this->load->model('Module_model');
+
+ if(isset($_SESSION['username'])){
+ $data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
+ $data['pageTitle'] = 'Dolgozó módosítása (#'.$worker_id.')';
+ $data['message'] = '';
+ $data['message_class'] = '';
+ if($this->User_model->is_user_admin($_SESSION['username'])){
+ $data['activeModules'] = $this->Module_model->getAllModule();
+ }
+ else{
+ $data['activeModules'] = $this->Module_model->getUserModules($data['currentUser']->user_id);
+ }
+
+ $data['serviceCategories'] = $this->Service_model->getAllServiceCategories();
+ $data['selectedItem'] = $this->Service_model->getWorkerById($worker_id);
+ $this->load->view('admin/update-worker', $data);
+ }
+ else{
+ header("Location:".SITEURL."login");
+ }
+ }
+
+ public function worker_process(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+ $this->load->model('Log_model');
+
+ if(isset($_SESSION['username'])){
+ $data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
+ $data['pageTitle'] = '';
+ $data['message'] = '';
+ $data['message_class'] = '';
+
+ if(isset($_GET['delete-worker'])){
+ $selected_worker = $this->Service_model->getWorkerById($_GET['delete-worker']);
+ $workerArray = array(
+ 'is_deleted' => '1'
+ );
+
+ $this->Service_model->updateWorker($_GET['delete-worker'], $workerArray);
+ $this->Log_model->addLog('workers', $data['currentUser']->username.' törölte a(z) '.$_GET['delete-worker'].' számú dolgozót ('.$selected_worker->worker_name.')', $data['currentUser']->username);
+ }
+
+
+ if(isset($_POST['addNewWorker'])){
+
+ $data['worker_img'] = '';
+
+ if($_FILES["worker_img"]["tmp_name"] != ''){
+ $target_dir = getcwd()."/assets/img/";
+ $target_file = $target_dir . 'worker_'.str_replace(' ','_', $_POST['worker_name']);
+ $imageFileType = strtolower(pathinfo(basename($_FILES["worker_img"]["name"]),PATHINFO_EXTENSION));
+
+ if (move_uploaded_file($_FILES["worker_img"]["tmp_name"], $target_file.'.'.$imageFileType)) {
+ $data['message'] = 'A profilkép sikeresen feltöltve!';
+ $data['message_class'] = 'successMessage';
+ $data['worker_img'] = 'worker_'.str_replace(' ','_', $_POST['worker_name']).'.'.$imageFileType;
+
+ } else {
+ $data['message'] = 'Hiba a feltöltés közben!';
+ $data['message_class'] = 'errorMessage';
+ }
+
+ }
+
+ $workerArray = array(
+ 'worker_name' => $_POST['worker_name'],
+ 'worker_info' => $_POST['worker_info'],
+ 'is_beauty' => $_POST['is_beauty'],
+ 'is_barber' => $_POST['is_barber'],
+ 'worker_profile_img' => $data['worker_img'],
+ 'service_category_id' => $data['service_category_id'],
+ 'is_active' => $_POST['is_active']
+ );
+
+ $this->Log_model->addLog('workers', $data['currentUser']->username.' létrehozta a(z) '.$_POST['worker_name'].' nevű dolgozót ('.implode(',',$workerArray).')', $data['currentUser']->username);
+ $this->Service_model->createWorker($workerArray);
+ }
+
+ if(isset($_POST['updateWorker'])){
+ $workerArray = array(
+ 'worker_name' => $_POST['worker_name'],
+ 'worker_info' => $_POST['worker_info'],
+ 'is_beauty' => $_POST['is_beauty'],
+ 'is_barber' => $_POST['is_barber'],
+ 'service_category_id' => $_POST['service_category_id'],
+ 'is_active' => $_POST['is_active']
+ );
+ $this->Service_model->updateWorker($_POST['worker_id'], $workerArray);
+ $this->Log_model->addLog('workers', $data['currentUser']->username.' módosította a(z) '.$_POST['worker_name'].' nevű dolgozót ('.implode(',',$workerArray).')', $data['currentUser']->username);
+
+ if($_FILES["worker_img"]["tmp_name"] != ''){
+ $target_dir = getcwd()."/assets/img/";
+ $target_file = $target_dir . 'worker_'.str_replace(' ','_', $_POST['worker_name']);
+ $imageFileType = strtolower(pathinfo(basename($_FILES["worker_img"]["name"]),PATHINFO_EXTENSION));
+
+ if (move_uploaded_file($_FILES["worker_img"]["tmp_name"], $target_file.'.'.$imageFileType)) {
+ $data['message'] = 'A profilkép sikeresen feltöltve!';
+ $data['message_class'] = 'successMessage';
+ $data['worker_img'] = 'worker_'.str_replace(' ','_', $_POST['worker_name']).'.'.$imageFileType;
+ $workerArray = array(
+ 'worker_profile_img' => $data['worker_img']
+ );
+
+ $this->Log_model->addLog('workers', $data['currentUser']->username.' profilképet állított be a(z) '.$_POST['worker_name'].' nevű dolgozóhoz', $data['currentUser']->username);
+ $this->Service_model->updateWorker($_POST['worker_id'], $workerArray);
+
+ } else {
+ $data['message'] = 'Hiba a feltöltés közben!';
+ $data['message_class'] = 'errorMessage';
+ }
+
+ }
+ }
+ header("Location:".SITEURL."workers");
+ $this->load->view('admin/worker-process', $data);
+ }
+ }
+
+ public function bookings(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+ $this->load->model('Module_model');
+
+ if(isset($_SESSION['username'])){
+ $data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
+ $data['pageTitle'] = 'Foglalások';
+ $data['message'] = '';
+ $data['message_class'] = '';
+ if($this->User_model->is_user_admin($_SESSION['username'])){
+ $data['activeModules'] = $this->Module_model->getAllModule();
+ }
+ else{
+ $data['activeModules'] = $this->Module_model->getUserModules($data['currentUser']->user_id);
+ }
+
+ $data['workers'] = $this->Service_model->getActiveWorkers();
+
+ if(isset($_GET['worker'])){
+ $data['results'] = $this->Service_model->getActualBookingsByWorkerID($_GET['worker']);
+ }
+ else{
+ $data['results'] = $this->Service_model->getActualBookings();
+ }
+
+
+ $this->load->view('admin/bookings', $data);
+ }
+ else{
+ header("Location:".SITEURL."login");
+ }
+ }
+
+ public function add_booking(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+ $this->load->model('Module_model');
+
+ if(isset($_SESSION['username'])){
+ $data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
+ $data['pageTitle'] = 'Foglalás hozzáadása';
+ $data['message'] = '';
+ $data['message_class'] = '';
+ if($this->User_model->is_user_admin($_SESSION['username'])){
+ $data['activeModules'] = $this->Module_model->getAllModule();
+ }
+ else{
+ $data['activeModules'] = $this->Module_model->getUserModules($data['currentUser']->user_id);
+ }
+
+ $available_services = $this->Service_model->getAvailableServices();
+
+ $serviceFile = fopen("load_services.json", "w") or die("Unable to open file!");
+ fwrite($serviceFile, json_encode($available_services));
+ fclose($serviceFile);
+
+ $data['workers'] = $this->Service_model->getAllWorkers();
+ $this->load->view('admin/add-booking', $data);
+ }
+ else{
+ header("Location:".SITEURL."login");
+ }
+ }
+
+ public function update_booking($booking_id){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+ $this->load->model('Module_model');
+
+ if(isset($_SESSION['username'])){
+ $data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
+ $data['pageTitle'] = 'Foglalás módosítása (#'.$booking_id.')';
+ $data['message'] = '';
+ $data['message_class'] = '';
+ if($this->User_model->is_user_admin($_SESSION['username'])){
+ $data['activeModules'] = $this->Module_model->getAllModule();
+ }
+ else{
+ $data['activeModules'] = $this->Module_model->getUserModules($data['currentUser']->user_id);
+ }
+
+ $available_services = $this->Service_model->getAvailableServices();
+
+ $serviceFile = fopen("load_services.json", "w") or die("Unable to open file!");
+ fwrite($serviceFile, json_encode($available_services));
+ fclose($serviceFile);
+
+ $data['workers'] = $this->Service_model->getAllWorkers();
+ $data['selectedItem'] = $this->Service_model->getBookingById($booking_id);
+ $this->load->view('admin/update-booking', $data);
+ }
+ else{
+ header("Location:".SITEURL."login");
+ }
+ }
+
+ public function booking_process(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+ $this->load->model('Log_model');
+
+ if(isset($_SESSION['username'])){
+ $data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
+ $data['pageTitle'] = '';
+ $data['message'] = '';
+ $data['message_class'] = '';
+
+ if(isset($_GET['delete-booking'])){
+ $selectedBooking = $this->Service_model->getBookingById($_GET['delete-booking']);
+ $this->Service_model->deleteBooking($_GET['delete-booking']);
+ $this->Log_model->addLog('bookings', $data['currentUser']->username.' törölte a(z) '.$_GET['delete-booking'].' számú foglalást ('.$selectedBooking->guest_name.', '.$selectedBooking->guest_email.', '.$selectedBooking->guest_phone.', '.$selectedBooking->booking_date.', '.$selectedBooking->booking_start_time.', '.$selectedBooking->booking_finish_time.', '.$selectedBooking->service_ids.')', $data['currentUser']->username);
+ header('Location:'.SITEURL.'bookings');
+ }
+
+ if(isset($_POST['addNewBookingManual'])){
+ $booking_date = new DateTime(date('Y-m-d', strtotime($_POST['booking_date'])));
+ $end_booking_date = new DateTime(date('Y-m-d', strtotime($_POST['end_booking_date'])));
+ $diff = $booking_date->diff($end_booking_date);
+
+ $selectedServiceArray = array();
+
+ if($_POST['service_ids'] != ''){
+ $selectedServiceArray = explode(',', $_POST['service_ids']);
+
+ }
+
+ if($_POST['booking_date'] != $_POST['end_booking_date'] && $booking_date <= $end_booking_date){
+ for($index = 0; $index <= $diff->days; $index++){
+ $selectedDate = date('Y-m-d', strtotime($_POST['booking_date']. ' + '.$index.' days'));
+
+
+ $bookingArray = array(
+ 'guest_name' => $_POST['guest_name'],
+ 'guest_email' => $_POST['guest_email'],
+ 'guest_phone' => $_POST['guest_phone'],
+ 'worker_id' => $_POST['worker_id'],
+ 'booking_date' => $selectedDate,
+ 'booking_start_time' => $_POST['booking_start_time'],
+ 'booking_finish_time' => $_POST['booking_finish_time'],
+ 'service_ids' => serialize($selectedServiceArray),
+ 'guest_confirmed' => '0',
+ 'guest_confirm_code' => '1234',
+ );
+
+ $this->Service_model->createBooking($bookingArray);
+ }
+ }
+ else{
+ $bookingArray = array(
+ 'guest_name' => $_POST['guest_name'],
+ 'guest_email' => $_POST['guest_email'],
+ 'guest_phone' => $_POST['guest_phone'],
+ 'worker_id' => $_POST['worker_id'],
+ 'booking_date' => $_POST['booking_date'],
+ 'booking_start_time' => $_POST['booking_start_time'],
+ 'booking_finish_time' => $_POST['booking_finish_time'],
+ 'service_ids' => serialize($selectedServiceArray),
+ 'guest_confirmed' => '0',
+ 'guest_confirm_code' => '1234',
+ );
+ $this->Log_model->addLog('bookings', $data['currentUser']->username.' létrehoza a(z) '.$_POST['guest_name'].' nevű vendég foglalást ('.implode(', ', $bookingArray).')', $data['currentUser']->username);
+ $this->Service_model->createBooking($bookingArray);
+ }
+
+ if($_POST['send_notification']){
+ $worker = $this->Service_model->getWorkerById($bookingArray['worker_id']);
+
+ $services = unserialize($bookingArray['service_ids']);
+ $serviceArray = array();
+ $emailArray = array();
+
+ if(is_array($services)){
+ foreach($services as $serviceItem){
+ $selectedService = $this->Service_model->getServiceById($serviceItem);
+ if(is_object($selectedService)){
+ $serviceArray[] = $selectedService;
+ }
+ }
+ }
+
+ $content = '';
+
+ switch($_POST['lang']){
+ case 'no':
+ $content = 'Kjære gjest, ';
+ $content .= 'Takk for din bestilling! ';
+ $content .= ' ';
+ $content .= '';
+ $content .= 'Navn: '.$bookingArray['guest_name'].' ';
+ $content .= 'E-post: '.$bookingArray['guest_email'].' ';
+ $content .= 'Telefon: '.$bookingArray['guest_phone'].' ';
+ $content .= 'Arbeider: '.$worker->worker_name.' ';
+ $content .= 'Dato: '.$bookingArray['booking_date'].' ';
+ $content .= 'Tid: '.$bookingArray['booking_start_time'].' - '.$bookingArray['booking_finish_time'].' ';
+ $content .= 'Tjenester: ';
+ $totalServicePrice = 0;
+ foreach($serviceArray as $serviceArrayItem){
+ $totalServicePrice += $serviceArrayItem->service_price;
+ $content .= ''.$serviceArrayItem->service_name_no.' '.$serviceArrayItem->service_price.' kr ';
+ }
+ $content .= '
';
+ $content .= 'Totalpris: '.$totalServicePrice.' kr ';
+ $content .= '
';
+ $content .= ' STUDIOBEVE';
+ $this->Log_model->addLog('bookings', $data['currentUser']->username.' új foglalásról norvég nyelvű értesítést küldött a(z) '.$bookingArray['guest_email'].' email címre ('.implode(', ', $bookingArray).')', $data['currentUser']->username);
+ break;
+ case 'en':
+ $content = 'Dear Guest, ';
+ $content .= 'Thank you for your booking! ';
+ $content .= ' ';
+ $content .= '';
+ $content .= 'Name: '.$bookingArray['guest_name'].' ';
+ $content .= 'Email: '.$bookingArray['guest_email'].' ';
+ $content .= 'Phone: '.$bookingArray['guest_phone'].' ';
+ $content .= 'Worker: '.$worker->worker_name.' ';
+ $content .= 'Date: '.$bookingArray['booking_date'].' ';
+ $content .= 'Time: '.$bookingArray['booking_start_time'].' - '.$bookingArray['booking_finish_time'].' ';
+ $content .= 'Services: ';
+ $totalServicePrice = 0;
+ foreach($serviceArray as $serviceArrayItem){
+ $totalServicePrice += $serviceArrayItem->service_price;
+ $content .= ''.$serviceArrayItem->service_name_en.' '.$serviceArrayItem->service_price.' kr ';
+ }
+ $content .= '
';
+ $content .= 'Total price: '.$totalServicePrice.' kr ';
+ $content .= '
';
+ $content .= ' STUDIOBEVE';
+ $this->Log_model->addLog('bookings', $data['currentUser']->username.' új foglalásról angol nyelvű értesítést küldött a(z) '.$bookingArray['guest_email'].' email címre ('.implode(', ', $bookingArray).')', $data['currentUser']->username);
+ break;
+ case 'hu':
+ $content = 'Kedves Vendégünk, ';
+ $content .= 'Köszönettel fogadtuk a foglalását! ';
+ $content .= ' ';
+ $content .= '';
+ $content .= 'Név: '.$bookingArray['guest_name'].' ';
+ $content .= 'Email: '.$bookingArray['guest_email'].' ';
+ $content .= 'Telefon: '.$bookingArray['guest_phone'].' ';
+ $content .= 'Dolgozó: '.$worker->worker_name.' ';
+ $content .= 'Dátum: '.$bookingArray['booking_date'].' ';
+ $content .= 'Időpont: '.$bookingArray['booking_start_time'].' - '.$bookingArray['booking_finish_time'].' ';
+ $content .= 'Szolgáltatás(ok): ';
+ $totalServicePrice = 0;
+ foreach($serviceArray as $serviceArrayItem){
+ $totalServicePrice += $serviceArrayItem->service_price;
+ $content .= ''.$serviceArrayItem->service_name_hu.' '.$serviceArrayItem->service_price.' kr ';
+ }
+ $content .= '
';
+ $content .= 'Összesen fizetendő: '.$totalServicePrice.' kr ';
+ $content .= '
';
+ $content .= ' STUDIOBEVE';
+ $this->Log_model->addLog('bookings', $data['currentUser']->username.' új foglalásról magyar nyelvű értesítést küldött a(z) '.$bookingArray['guest_email'].' email címre ('.implode(', ', $bookingArray).')', $data['currentUser']->username);
+ break;
+ }
+
+ $data['selectedLang'] = $_POST['lang'];
+
+ $emailItem = array(
+ 'addressee_email' => $bookingArray['guest_email'],
+ 'addressee_name' => $bookingArray['guest_name'],
+ 'subject' => '[studiobeve] Your booking has arrived',
+ 'content' => $content,
+ 'attachments' => array()
+ );
+ $emailArray[] = $emailItem;
+
+
+ $this->User_model->sendEmail($emailArray, $_POST['lang'], '');
+ }
+ header('Location:'.SITEURL.'bookings');
+ }
+
+ if(isset($_POST['updateBookingManual'])){
+ $booking_date = new DateTime(date('Y-m-d', strtotime($_POST['booking_date'])));
+ $end_booking_date = new DateTime(date('Y-m-d', strtotime($_POST['end_booking_date'])));
+ $diff = $booking_date->diff($end_booking_date);
+
+ $selectedServiceArray = array();
+
+ if($_POST['service_ids'] != ''){
+ $selectedServiceArray = explode(',', $_POST['service_ids']);
+
+ }
+
+ if($_POST['booking_date'] != $_POST['end_booking_date'] && $booking_date <= $end_booking_date){
+ for($index = 0; $index <= $diff->days; $index++){
+ $selectedDate = date('Y-m-d', strtotime($_POST['booking_date']. ' + '.$index.' days'));
+
+
+ $bookingArray = array(
+ 'guest_name' => $_POST['guest_name'],
+ 'guest_email' => $_POST['guest_email'],
+ 'guest_phone' => $_POST['guest_phone'],
+ 'worker_id' => $_POST['worker_id'],
+ 'booking_date' => $selectedDate,
+ 'booking_start_time' => $_POST['booking_start_time'],
+ 'booking_finish_time' => $_POST['booking_finish_time'],
+ 'service_ids' => serialize($selectedServiceArray),
+ 'guest_confirmed' => '0',
+ 'guest_confirm_code' => '1234'
+ );
+
+ $this->Service_model->createBooking($bookingArray);
+ }
+ }
+ else{
+ $bookingArray = array(
+ 'guest_name' => $_POST['guest_name'],
+ 'guest_email' => $_POST['guest_email'],
+ 'guest_phone' => $_POST['guest_phone'],
+ 'worker_id' => $_POST['worker_id'],
+ 'booking_date' => $_POST['booking_date'],
+ 'booking_start_time' => $_POST['booking_start_time'],
+ 'booking_finish_time' => $_POST['booking_finish_time'],
+ 'service_ids' => serialize($selectedServiceArray),
+ 'guest_confirmed' => '0',
+ 'guest_confirm_code' => '1234'
+ );
+
+ $this->Service_model->updateBooking($_POST['booking_id'], $bookingArray);
+ $this->Log_model->addLog('bookings', $data['currentUser']->username.' módosította a foglalását a(z) '.$bookingArray['guest_name'].' nevű vendégnek ('.implode(', ', $bookingArray).')', $data['currentUser']->username);
+ }
+
+ if($_POST['send_notification']){
+ $worker = $this->Service_model->getWorkerById($bookingArray['worker_id']);
+
+ $services = unserialize($bookingArray['service_ids']);
+ $serviceArray = array();
+ $emailArray = array();
+
+ if(is_array($services)){
+ foreach($services as $serviceItem){
+ $selectedService = $this->Service_model->getServiceById($serviceItem);
+ if(is_object($selectedService)){
+ $serviceArray[] = $selectedService;
+ }
+ }
+ }
+
+ $content = '';
+
+ $email_subject ='';
+
+ switch($_POST['lang']){
+ case 'no':
+ $email_subject ='[studiobeve] Din reservasjon er endret';
+ $content = 'Kjære gjest, ';
+ $content .= 'Vi vil gjerne informere deg om at din reservasjon er endret. ';
+ $content .= ' ';
+ $content .= '';
+ $content .= 'Navn: '.$bookingArray['guest_name'].' ';
+ $content .= 'E-post: '.$bookingArray['guest_email'].' ';
+ $content .= 'Telefon: '.$bookingArray['guest_phone'].' ';
+ $content .= 'Arbeider: '.$worker->worker_name.' ';
+ $content .= 'Dato: '.$bookingArray['booking_date'].' ';
+ $content .= 'Tid: '.$bookingArray['booking_start_time'].' - '.$bookingArray['booking_finish_time'].' ';
+ $content .= 'Tjenester: ';
+ $totalServicePrice = 0;
+ foreach($serviceArray as $serviceArrayItem){
+ $totalServicePrice += $serviceArrayItem->service_price;
+ $content .= ''.$serviceArrayItem->service_name_no.' '.$serviceArrayItem->service_price.' kr ';
+ }
+ $content .= '
';
+ $content .= 'Totalpris: '.$totalServicePrice.' kr ';
+ $content .= '
';
+ $content .= ' STUDIOBEVE';
+ $this->Log_model->addLog('bookings', $data['currentUser']->username.' foglalás módosításról norvég nyelvű értesítést küldött a(z) '.$bookingArray['guest_email'].' email címre ('.implode(', ', $bookingArray).')', $data['currentUser']->username);
+ break;
+ case 'en':
+ $email_subject ='[studiobeve] Your booking has changed';
+ $content = 'Dear Guest, ';
+ $content .= 'We inform you that your booking has changed. ';
+ $content .= ' ';
+ $content .= '';
+ $content .= 'Name: '.$bookingArray['guest_name'].' ';
+ $content .= 'Email: '.$bookingArray['guest_email'].' ';
+ $content .= 'Phone: '.$bookingArray['guest_phone'].' ';
+ $content .= 'Worker: '.$worker->worker_name.' ';
+ $content .= 'Date: '.$bookingArray['booking_date'].' ';
+ $content .= 'Time: '.$bookingArray['booking_start_time'].' - '.$bookingArray['booking_finish_time'].' ';
+ $content .= 'Services: ';
+ $totalServicePrice = 0;
+ foreach($serviceArray as $serviceArrayItem){
+ $totalServicePrice += $serviceArrayItem->service_price;
+ $content .= ''.$serviceArrayItem->service_name_en.' '.$serviceArrayItem->service_price.' kr ';
+ }
+ $content .= '
';
+ $content .= 'Total price: '.$totalServicePrice.' kr ';
+ $content .= '
';
+ $content .= ' STUDIOBEVE';
+ $this->Log_model->addLog('bookings', $data['currentUser']->username.' foglalás módosításról angol nyelvű értesítést küldött a(z) '.$bookingArray['guest_email'].' email címre ('.implode(', ', $bookingArray).')', $data['currentUser']->username);
+ break;
+ case 'hu':
+ $email_subject ='[studiobeve] A foglalása módosult';
+ $content = 'Kedves Vendégünk, ';
+ $content .= 'Tájékoztatjuk, hogy a foglalása módosult. ';
+ $content .= ' ';
+ $content .= '';
+ $content .= 'Név: '.$bookingArray['guest_name'].' ';
+ $content .= 'Email: '.$bookingArray['guest_email'].' ';
+ $content .= 'Telefon: '.$bookingArray['guest_phone'].' ';
+ $content .= 'Dolgozó: '.$worker->worker_name.' ';
+ $content .= 'Dátum: '.$bookingArray['booking_date'].' ';
+ $content .= 'Időpont: '.$bookingArray['booking_start_time'].' - '.$bookingArray['booking_finish_time'].' ';
+ $content .= 'Szolgáltatás(ok): ';
+ $totalServicePrice = 0;
+ foreach($serviceArray as $serviceArrayItem){
+ $totalServicePrice += $serviceArrayItem->service_price;
+ $content .= ''.$serviceArrayItem->service_name_hu.' '.$serviceArrayItem->service_price.' kr ';
+ }
+ $content .= '
';
+ $content .= 'Összesen fizetendő: '.$totalServicePrice.' kr ';
+ $content .= '
';
+ $content .= ' STUDIOBEVE';
+ $this->Log_model->addLog('bookings', $data['currentUser']->username.' foglalás módosításról magyar nyelvű értesítést küldött a(z) '.$bookingArray['guest_email'].' email címre ('.implode(', ', $bookingArray).')', $data['currentUser']->username);
+ break;
+ }
+
+ $data['selectedLang'] = $_POST['lang'];
+
+ $emailItem = array(
+ 'addressee_email' => $bookingArray['guest_email'],
+ 'addressee_name' => $bookingArray['guest_name'],
+ 'subject' => $email_subject,
+ 'content' => $content,
+ 'attachments' => array()
+ );
+ $emailArray[] = $emailItem;
+
+ $this->User_model->sendEmail($emailArray, $_POST['lang'], '');
+ }
+ header('Location:'.SITEURL.'bookings');
+ }
+
+ $this->load->view('admin/booking-process', $data);
+ }
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+}
diff --git a/application/controllers/Admin_20250312.php b/application/controllers/Admin_20250312.php
new file mode 100755
index 0000000..c87a394
--- /dev/null
+++ b/application/controllers/Admin_20250312.php
@@ -0,0 +1,822 @@
+
+ * @see https://codeigniter.com/userguide3/general/urls.html
+ */
+ public function dashboard(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+ $this->load->model('Module_model');
+
+ if(isset($_SESSION['username'])){
+ $data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
+ $data['pageTitle'] = 'Vezérlőpult';
+ $data['message'] = '';
+ $data['message_class'] = '';
+ if($this->User_model->is_user_admin($_SESSION['username'])){
+ $data['activeModules'] = $this->Module_model->getAllModule();
+ }
+ else{
+ $data['activeModules'] = $this->Module_model->getUserModules($data['currentUser']->user_id);
+ }
+
+ $this->load->view('admin/dashboard', $data);
+ }
+ else{
+ header("Location:".SITEURL."login");
+ }
+ }
+
+ public function services(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+ $this->load->model('Module_model');
+
+ if(isset($_SESSION['username'])){
+ $data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
+ $data['pageTitle'] = 'Szolgáltatások';
+ $data['message'] = '';
+ $data['message_class'] = '';
+ if($this->User_model->is_user_admin($_SESSION['username'])){
+ $data['activeModules'] = $this->Module_model->getAllModule();
+ }
+ else{
+ $data['activeModules'] = $this->Module_model->getUserModules($data['currentUser']->user_id);
+ }
+
+ $data['results'] = $this->Service_model->getAllServices();
+
+ $this->load->view('admin/services', $data);
+ }
+ else{
+ header("Location:".SITEURL."login");
+ }
+ }
+
+ public function add_service(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+ $this->load->model('Module_model');
+
+ if(isset($_SESSION['username'])){
+ $data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
+ $data['pageTitle'] = 'Szolgáltatás hozzáadás';
+ $data['message'] = '';
+ $data['message_class'] = '';
+ if($this->User_model->is_user_admin($_SESSION['username'])){
+ $data['activeModules'] = $this->Module_model->getAllModule();
+ }
+ else{
+ $data['activeModules'] = $this->Module_model->getUserModules($data['currentUser']->user_id);
+ }
+
+
+ $this->load->view('admin/add-service', $data);
+ }
+ else{
+ header("Location:".SITEURL."login");
+ }
+ }
+
+ public function update_service($service_id){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+ $this->load->model('Module_model');
+
+ if(isset($_SESSION['username'])){
+ $data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
+ $data['pageTitle'] = 'Szolgáltatás módosítása (#'.$service_id.')';
+ $data['message'] = '';
+ $data['message_class'] = '';
+ if($this->User_model->is_user_admin($_SESSION['username'])){
+ $data['activeModules'] = $this->Module_model->getAllModule();
+ }
+ else{
+ $data['activeModules'] = $this->Module_model->getUserModules($data['currentUser']->user_id);
+ }
+
+ $data['selectedItem'] = $this->Service_model->getServiceById($service_id);
+ $this->load->view('admin/update-service', $data);
+ }
+ else{
+ header("Location:".SITEURL."login");
+ }
+ }
+
+ public function service_process(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+ $this->load->model('Log_model');
+
+ if(isset($_SESSION['username'])){
+ $data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
+ $data['pageTitle'] = '';
+ $data['message'] = '';
+ $data['message_class'] = '';
+
+ if(isset($_GET['delete-service'])){
+ $selected_service = $this->Service_model->getServiceById($_GET['delete-service']);
+ $serviceArray = array(
+ 'is_deleted' => '1'
+ );
+
+ $this->Service_model->updateService($_GET['delete-service'], $serviceArray);
+ $this->Log_model->addLog('services', $data['currentUser']->username.' törölte a(z) '.$_GET['delete-service'].' számú szolgáltatást ('.$selected_service->service_name_hu.')', $data['currentUser']->username);
+
+ }
+
+ if(isset($_POST['addNewService'])){
+ $serviceArray = array(
+ 'service_type' => $_POST['service_type'],
+ 'service_category_no' => $_POST['service_category_no'],
+ 'service_category_en' => $_POST['service_category_en'],
+ 'service_category_hu' => $_POST['service_category_hu'],
+ 'service_name_no' => $_POST['service_name_no'],
+ 'service_name_en' => $_POST['service_name_en'],
+ 'service_name_hu' => $_POST['service_name_hu'],
+ 'service_description_no' => $_POST['service_description_no'],
+ 'service_description_en' => $_POST['service_description_en'],
+ 'service_description_hu' => $_POST['service_description_hu'],
+ 'service_price' => $_POST['service_price'],
+ 'service_time' => $_POST['service_time'],
+ 'is_enabled' => $_POST['is_enabled']
+ );
+
+ $this->Log_model->addLog('services', $data['currentUser']->username.' hozzáadta a(z) '.$_POST['service_name_hu'].' szolgáltatást ('.implode(',',$serviceArray).')', $data['currentUser']->username);
+ $this->Service_model->createService($serviceArray);
+ }
+
+ if(isset($_POST['updateService'])){
+ $serviceArray = array(
+ 'service_type' => $_POST['service_type'],
+ 'service_category_no' => $_POST['service_category_no'],
+ 'service_category_en' => $_POST['service_category_en'],
+ 'service_category_hu' => $_POST['service_category_hu'],
+ 'service_name_no' => $_POST['service_name_no'],
+ 'service_name_en' => $_POST['service_name_en'],
+ 'service_name_hu' => $_POST['service_name_hu'],
+ 'service_description_no' => $_POST['service_description_no'],
+ 'service_description_en' => $_POST['service_description_en'],
+ 'service_description_hu' => $_POST['service_description_hu'],
+ 'service_price' => $_POST['service_price'],
+ 'service_time' => $_POST['service_time'],
+ 'is_enabled' => $_POST['is_enabled']
+ );
+
+ $this->Log_model->addLog('services', $data['currentUser']->username.' módosította a(z) '.$_POST['service_name_hu'].' szolgáltatást ('.implode(',',$serviceArray).')', $data['currentUser']->username);
+ $this->Service_model->updateService($_POST['service_id'], $serviceArray);
+ }
+
+ header('Location:'.SITEURL.'services');
+ $this->load->view('admin/service-process', $data);
+ }
+ }
+
+ public function workers(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+ $this->load->model('Module_model');
+
+ if(isset($_SESSION['username'])){
+ $data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
+ $data['pageTitle'] = 'Dolgozók';
+ $data['message'] = '';
+ $data['message_class'] = '';
+ if($this->User_model->is_user_admin($_SESSION['username'])){
+ $data['activeModules'] = $this->Module_model->getAllModule();
+ }
+ else{
+ $data['activeModules'] = $this->Module_model->getUserModules($data['currentUser']->user_id);
+ }
+
+ $data['results'] = $this->Service_model->getAllWorkers();
+
+ $this->load->view('admin/workers', $data);
+ }
+ else{
+ header("Location:".SITEURL."login");
+ }
+ }
+
+ public function add_worker(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+ $this->load->model('Module_model');
+
+ if(isset($_SESSION['username'])){
+ $data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
+ $data['pageTitle'] = 'Dolgozó hozzáadása';
+ $data['message'] = '';
+ $data['message_class'] = '';
+ if($this->User_model->is_user_admin($_SESSION['username'])){
+ $data['activeModules'] = $this->Module_model->getAllModule();
+ }
+ else{
+ $data['activeModules'] = $this->Module_model->getUserModules($data['currentUser']->user_id);
+ }
+
+
+ $this->load->view('admin/add-worker', $data);
+ }
+ else{
+ header("Location:".SITEURL."login");
+ }
+ }
+
+ public function update_worker($worker_id){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+ $this->load->model('Module_model');
+
+ if(isset($_SESSION['username'])){
+ $data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
+ $data['pageTitle'] = 'Dolgozó módosítása (#'.$worker_id.')';
+ $data['message'] = '';
+ $data['message_class'] = '';
+ if($this->User_model->is_user_admin($_SESSION['username'])){
+ $data['activeModules'] = $this->Module_model->getAllModule();
+ }
+ else{
+ $data['activeModules'] = $this->Module_model->getUserModules($data['currentUser']->user_id);
+ }
+
+ $data['selectedItem'] = $this->Service_model->getWorkerById($worker_id);
+ $this->load->view('admin/update-worker', $data);
+ }
+ else{
+ header("Location:".SITEURL."login");
+ }
+ }
+
+ public function worker_process(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+ $this->load->model('Log_model');
+
+ if(isset($_SESSION['username'])){
+ $data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
+ $data['pageTitle'] = '';
+ $data['message'] = '';
+ $data['message_class'] = '';
+
+ if(isset($_GET['delete-worker'])){
+ $selected_worker = $this->Service_model->getWorkerById($_GET['delete-worker']);
+ $workerArray = array(
+ 'is_deleted' => '1'
+ );
+
+ $this->Service_model->updateWorker($_GET['delete-worker'], $workerArray);
+ $this->Log_model->addLog('workers', $data['currentUser']->username.' törölte a(z) '.$_GET['delete-worker'].' számú dolgozót ('.$selected_worker->worker_name.')', $data['currentUser']->username);
+ }
+
+
+ if(isset($_POST['addNewWorker'])){
+
+ $data['worker_img'] = '';
+
+ if($_FILES["worker_img"]["tmp_name"] != ''){
+ $target_dir = getcwd()."/assets/img/";
+ $target_file = $target_dir . 'worker_'.str_replace(' ','_', $_POST['worker_name']);
+ $imageFileType = strtolower(pathinfo(basename($_FILES["worker_img"]["name"]),PATHINFO_EXTENSION));
+
+ if (move_uploaded_file($_FILES["worker_img"]["tmp_name"], $target_file.'.'.$imageFileType)) {
+ $data['message'] = 'A profilkép sikeresen feltöltve!';
+ $data['message_class'] = 'successMessage';
+ $data['worker_img'] = 'worker_'.str_replace(' ','_', $_POST['worker_name']).'.'.$imageFileType;
+
+ } else {
+ $data['message'] = 'Hiba a feltöltés közben!';
+ $data['message_class'] = 'errorMessage';
+ }
+
+ }
+
+ $workerArray = array(
+ 'worker_name' => $_POST['worker_name'],
+ 'worker_info' => $_POST['worker_info'],
+ 'worker_profile_img' => $data['worker_img'],
+ 'is_active' => $_POST['is_active']
+ );
+
+ $this->Log_model->addLog('workers', $data['currentUser']->username.' létrehozta a(z) '.$_POST['worker_name'].' nevű dolgozót ('.implode(',',$workerArray).')', $data['currentUser']->username);
+ $this->Service_model->createWorker($workerArray);
+ }
+
+ if(isset($_POST['updateWorker'])){
+ $workerArray = array(
+ 'worker_name' => $_POST['worker_name'],
+ 'worker_info' => $_POST['worker_info'],
+ 'is_active' => $_POST['is_active']
+ );
+ $this->Service_model->updateWorker($_POST['worker_id'], $workerArray);
+ $this->Log_model->addLog('workers', $data['currentUser']->username.' módosította a(z) '.$_POST['worker_name'].' nevű dolgozót ('.implode(',',$workerArray).')', $data['currentUser']->username);
+
+ if($_FILES["worker_img"]["tmp_name"] != ''){
+ $target_dir = getcwd()."/assets/img/";
+ $target_file = $target_dir . 'worker_'.str_replace(' ','_', $_POST['worker_name']);
+ $imageFileType = strtolower(pathinfo(basename($_FILES["worker_img"]["name"]),PATHINFO_EXTENSION));
+
+ if (move_uploaded_file($_FILES["worker_img"]["tmp_name"], $target_file.'.'.$imageFileType)) {
+ $data['message'] = 'A profilkép sikeresen feltöltve!';
+ $data['message_class'] = 'successMessage';
+ $data['worker_img'] = 'worker_'.str_replace(' ','_', $_POST['worker_name']).'.'.$imageFileType;
+ $workerArray = array(
+ 'worker_profile_img' => $data['worker_img']
+ );
+
+ $this->Log_model->addLog('workers', $data['currentUser']->username.' profilképet állított be a(z) '.$_POST['worker_name'].' nevű dolgozóhoz', $data['currentUser']->username);
+ $this->Service_model->updateWorker($_POST['worker_id'], $workerArray);
+
+ } else {
+ $data['message'] = 'Hiba a feltöltés közben!';
+ $data['message_class'] = 'errorMessage';
+ }
+
+ }
+ }
+ header("Location:".SITEURL."workers");
+ $this->load->view('admin/worker-process', $data);
+ }
+ }
+
+ public function bookings(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+ $this->load->model('Module_model');
+
+ if(isset($_SESSION['username'])){
+ $data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
+ $data['pageTitle'] = 'Foglalások';
+ $data['message'] = '';
+ $data['message_class'] = '';
+ if($this->User_model->is_user_admin($_SESSION['username'])){
+ $data['activeModules'] = $this->Module_model->getAllModule();
+ }
+ else{
+ $data['activeModules'] = $this->Module_model->getUserModules($data['currentUser']->user_id);
+ }
+
+ $data['results'] = $this->Service_model->getActualBookings();
+
+ $this->load->view('admin/bookings', $data);
+ }
+ else{
+ header("Location:".SITEURL."login");
+ }
+ }
+
+ public function add_booking(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+ $this->load->model('Module_model');
+
+ if(isset($_SESSION['username'])){
+ $data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
+ $data['pageTitle'] = 'Foglalás hozzáadása';
+ $data['message'] = '';
+ $data['message_class'] = '';
+ if($this->User_model->is_user_admin($_SESSION['username'])){
+ $data['activeModules'] = $this->Module_model->getAllModule();
+ }
+ else{
+ $data['activeModules'] = $this->Module_model->getUserModules($data['currentUser']->user_id);
+ }
+
+ $available_services = $this->Service_model->getAvailableServices();
+
+ $serviceFile = fopen("load_services.json", "w") or die("Unable to open file!");
+ fwrite($serviceFile, json_encode($available_services));
+ fclose($serviceFile);
+
+ $data['workers'] = $this->Service_model->getAllWorkers();
+ $this->load->view('admin/add-booking', $data);
+ }
+ else{
+ header("Location:".SITEURL."login");
+ }
+ }
+
+ public function update_booking($booking_id){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+ $this->load->model('Module_model');
+
+ if(isset($_SESSION['username'])){
+ $data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
+ $data['pageTitle'] = 'Foglalás módosítása (#'.$booking_id.')';
+ $data['message'] = '';
+ $data['message_class'] = '';
+ if($this->User_model->is_user_admin($_SESSION['username'])){
+ $data['activeModules'] = $this->Module_model->getAllModule();
+ }
+ else{
+ $data['activeModules'] = $this->Module_model->getUserModules($data['currentUser']->user_id);
+ }
+
+ $available_services = $this->Service_model->getAvailableServices();
+
+ $serviceFile = fopen("load_services.json", "w") or die("Unable to open file!");
+ fwrite($serviceFile, json_encode($available_services));
+ fclose($serviceFile);
+
+ $data['workers'] = $this->Service_model->getAllWorkers();
+ $data['selectedItem'] = $this->Service_model->getBookingById($booking_id);
+ $this->load->view('admin/update-booking', $data);
+ }
+ else{
+ header("Location:".SITEURL."login");
+ }
+ }
+
+ public function booking_process(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+ $this->load->model('Log_model');
+
+ if(isset($_SESSION['username'])){
+ $data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
+ $data['pageTitle'] = '';
+ $data['message'] = '';
+ $data['message_class'] = '';
+
+ if(isset($_GET['delete-booking'])){
+ $selectedBooking = $this->Service_model->getBookingById($_GET['delete-booking']);
+ $this->Service_model->deleteBooking($_GET['delete-booking']);
+ $this->Log_model->addLog('bookings', $data['currentUser']->username.' törölte a(z) '.$_GET['delete-booking'].' számú foglalást ('.$selectedBooking->guest_name.', '.$selectedBooking->guest_email.', '.$selectedBooking->guest_phone.', '.$selectedBooking->booking_date.', '.$selectedBooking->booking_start_time.', '.$selectedBooking->booking_finish_time.', '.$selectedBooking->service_ids.')', $data['currentUser']->username);
+ header('Location:'.SITEURL.'bookings');
+ }
+
+ if(isset($_POST['addNewBookingManual'])){
+ $booking_date = new DateTime(date('Y-m-d', strtotime($_POST['booking_date'])));
+ $end_booking_date = new DateTime(date('Y-m-d', strtotime($_POST['end_booking_date'])));
+ $diff = $booking_date->diff($end_booking_date);
+
+ $selectedServiceArray = array();
+
+ if($_POST['service_ids'] != ''){
+ $selectedServiceArray = explode(',', $_POST['service_ids']);
+
+ }
+
+ if($_POST['booking_date'] != $_POST['end_booking_date'] && $booking_date <= $end_booking_date){
+ for($index = 0; $index <= $diff->days; $index++){
+ $selectedDate = date('Y-m-d', strtotime($_POST['booking_date']. ' + '.$index.' days'));
+
+
+ $bookingArray = array(
+ 'guest_name' => $_POST['guest_name'],
+ 'guest_email' => $_POST['guest_email'],
+ 'guest_phone' => $_POST['guest_phone'],
+ 'worker_id' => $_POST['worker_id'],
+ 'booking_date' => $selectedDate,
+ 'booking_start_time' => $_POST['booking_start_time'],
+ 'booking_finish_time' => $_POST['booking_finish_time'],
+ 'service_ids' => serialize($selectedServiceArray),
+ 'guest_confirmed' => '0',
+ 'guest_confirm_code' => '1234',
+ );
+
+ $this->Service_model->createBooking($bookingArray);
+ }
+ }
+ else{
+ $bookingArray = array(
+ 'guest_name' => $_POST['guest_name'],
+ 'guest_email' => $_POST['guest_email'],
+ 'guest_phone' => $_POST['guest_phone'],
+ 'worker_id' => $_POST['worker_id'],
+ 'booking_date' => $_POST['booking_date'],
+ 'booking_start_time' => $_POST['booking_start_time'],
+ 'booking_finish_time' => $_POST['booking_finish_time'],
+ 'service_ids' => serialize($selectedServiceArray),
+ 'guest_confirmed' => '0',
+ 'guest_confirm_code' => '1234',
+ );
+ $this->Log_model->addLog('bookings', $data['currentUser']->username.' létrehoza a(z) '.$_POST['guest_name'].' nevű vendég foglalást ('.implode(', ', $bookingArray).')', $data['currentUser']->username);
+ $this->Service_model->createBooking($bookingArray);
+ }
+
+ if($_POST['send_notification']){
+ $worker = $this->Service_model->getWorkerById($bookingArray['worker_id']);
+
+ $services = unserialize($bookingArray['service_ids']);
+ $serviceArray = array();
+ $emailArray = array();
+
+ if(is_array($services)){
+ foreach($services as $serviceItem){
+ $selectedService = $this->Service_model->getServiceById($serviceItem);
+ if(is_object($selectedService)){
+ $serviceArray[] = $selectedService;
+ }
+ }
+ }
+
+ $content = '';
+
+ switch($_POST['lang']){
+ case 'no':
+ $content = 'Kjære gjest, ';
+ $content .= 'Takk for din bestilling! ';
+ $content .= ' ';
+ $content .= '';
+ $content .= 'Navn: '.$bookingArray['guest_name'].' ';
+ $content .= 'E-post: '.$bookingArray['guest_email'].' ';
+ $content .= 'Telefon: '.$bookingArray['guest_phone'].' ';
+ $content .= 'Arbeider: '.$worker->worker_name.' ';
+ $content .= 'Dato: '.$bookingArray['booking_date'].' ';
+ $content .= 'Tid: '.$bookingArray['booking_start_time'].' - '.$bookingArray['booking_finish_time'].' ';
+ $content .= 'Tjenester: ';
+ $totalServicePrice = 0;
+ foreach($serviceArray as $serviceArrayItem){
+ $totalServicePrice += $serviceArrayItem->service_price;
+ $content .= ''.$serviceArrayItem->service_name_no.' '.$serviceArrayItem->service_price.' kr ';
+ }
+ $content .= '
';
+ $content .= 'Totalpris: '.$totalServicePrice.' kr ';
+ $content .= '
';
+ $content .= ' STUDIOBEVE';
+ $this->Log_model->addLog('bookings', $data['currentUser']->username.' új foglalásról norvég nyelvű értesítést küldött a(z) '.$bookingArray['guest_email'].' email címre ('.implode(', ', $bookingArray).')', $data['currentUser']->username);
+ break;
+ case 'en':
+ $content = 'Dear Guest, ';
+ $content .= 'Thank you for your booking! ';
+ $content .= ' ';
+ $content .= '';
+ $content .= 'Name: '.$bookingArray['guest_name'].' ';
+ $content .= 'Email: '.$bookingArray['guest_email'].' ';
+ $content .= 'Phone: '.$bookingArray['guest_phone'].' ';
+ $content .= 'Worker: '.$worker->worker_name.' ';
+ $content .= 'Date: '.$bookingArray['booking_date'].' ';
+ $content .= 'Time: '.$bookingArray['booking_start_time'].' - '.$bookingArray['booking_finish_time'].' ';
+ $content .= 'Services: ';
+ $totalServicePrice = 0;
+ foreach($serviceArray as $serviceArrayItem){
+ $totalServicePrice += $serviceArrayItem->service_price;
+ $content .= ''.$serviceArrayItem->service_name_en.' '.$serviceArrayItem->service_price.' kr ';
+ }
+ $content .= '
';
+ $content .= 'Total price: '.$totalServicePrice.' kr ';
+ $content .= '
';
+ $content .= ' STUDIOBEVE';
+ $this->Log_model->addLog('bookings', $data['currentUser']->username.' új foglalásról angol nyelvű értesítést küldött a(z) '.$bookingArray['guest_email'].' email címre ('.implode(', ', $bookingArray).')', $data['currentUser']->username);
+ break;
+ case 'hu':
+ $content = 'Kedves Vendégünk, ';
+ $content .= 'Köszönettel fogadtuk a foglalását! ';
+ $content .= ' ';
+ $content .= '';
+ $content .= 'Név: '.$bookingArray['guest_name'].' ';
+ $content .= 'Email: '.$bookingArray['guest_email'].' ';
+ $content .= 'Telefon: '.$bookingArray['guest_phone'].' ';
+ $content .= 'Dolgozó: '.$worker->worker_name.' ';
+ $content .= 'Dátum: '.$bookingArray['booking_date'].' ';
+ $content .= 'Időpont: '.$bookingArray['booking_start_time'].' - '.$bookingArray['booking_finish_time'].' ';
+ $content .= 'Szolgáltatás(ok): ';
+ $totalServicePrice = 0;
+ foreach($serviceArray as $serviceArrayItem){
+ $totalServicePrice += $serviceArrayItem->service_price;
+ $content .= ''.$serviceArrayItem->service_name_hu.' '.$serviceArrayItem->service_price.' kr ';
+ }
+ $content .= '
';
+ $content .= 'Összesen fizetendő: '.$totalServicePrice.' kr ';
+ $content .= '
';
+ $content .= ' STUDIOBEVE';
+ $this->Log_model->addLog('bookings', $data['currentUser']->username.' új foglalásról magyar nyelvű értesítést küldött a(z) '.$bookingArray['guest_email'].' email címre ('.implode(', ', $bookingArray).')', $data['currentUser']->username);
+ break;
+ }
+
+ $data['selectedLang'] = $_POST['lang'];
+
+ $emailItem = array(
+ 'addressee_email' => $bookingArray['guest_email'],
+ 'addressee_name' => $bookingArray['guest_name'],
+ 'subject' => '[studiobeve] Your booking has arrived',
+ 'content' => $content,
+ 'attachments' => array()
+ );
+ $emailArray[] = $emailItem;
+
+
+ $this->User_model->sendEmail($emailArray, $_POST['lang'], '');
+ }
+ header('Location:'.SITEURL.'bookings');
+ }
+
+ if(isset($_POST['updateBookingManual'])){
+ $booking_date = new DateTime(date('Y-m-d', strtotime($_POST['booking_date'])));
+ $end_booking_date = new DateTime(date('Y-m-d', strtotime($_POST['end_booking_date'])));
+ $diff = $booking_date->diff($end_booking_date);
+
+ $selectedServiceArray = array();
+
+ if($_POST['service_ids'] != ''){
+ $selectedServiceArray = explode(',', $_POST['service_ids']);
+
+ }
+
+ if($_POST['booking_date'] != $_POST['end_booking_date'] && $booking_date <= $end_booking_date){
+ for($index = 0; $index <= $diff->days; $index++){
+ $selectedDate = date('Y-m-d', strtotime($_POST['booking_date']. ' + '.$index.' days'));
+
+
+ $bookingArray = array(
+ 'guest_name' => $_POST['guest_name'],
+ 'guest_email' => $_POST['guest_email'],
+ 'guest_phone' => $_POST['guest_phone'],
+ 'worker_id' => $_POST['worker_id'],
+ 'booking_date' => $selectedDate,
+ 'booking_start_time' => $_POST['booking_start_time'],
+ 'booking_finish_time' => $_POST['booking_finish_time'],
+ 'service_ids' => serialize($selectedServiceArray),
+ 'guest_confirmed' => '0',
+ 'guest_confirm_code' => '1234'
+ );
+
+ $this->Service_model->createBooking($bookingArray);
+ }
+ }
+ else{
+ $bookingArray = array(
+ 'guest_name' => $_POST['guest_name'],
+ 'guest_email' => $_POST['guest_email'],
+ 'guest_phone' => $_POST['guest_phone'],
+ 'worker_id' => $_POST['worker_id'],
+ 'booking_date' => $_POST['booking_date'],
+ 'booking_start_time' => $_POST['booking_start_time'],
+ 'booking_finish_time' => $_POST['booking_finish_time'],
+ 'service_ids' => serialize($selectedServiceArray),
+ 'guest_confirmed' => '0',
+ 'guest_confirm_code' => '1234'
+ );
+
+ $this->Service_model->updateBooking($_POST['booking_id'], $bookingArray);
+ $this->Log_model->addLog('bookings', $data['currentUser']->username.' módosította a foglalását a(z) '.$bookingArray['guest_name'].' nevű vendégnek ('.implode(', ', $bookingArray).')', $data['currentUser']->username);
+ }
+
+ if($_POST['send_notification']){
+ $worker = $this->Service_model->getWorkerById($bookingArray['worker_id']);
+
+ $services = unserialize($bookingArray['service_ids']);
+ $serviceArray = array();
+ $emailArray = array();
+
+ if(is_array($services)){
+ foreach($services as $serviceItem){
+ $selectedService = $this->Service_model->getServiceById($serviceItem);
+ if(is_object($selectedService)){
+ $serviceArray[] = $selectedService;
+ }
+ }
+ }
+
+ $content = '';
+
+ $email_subject ='';
+
+ switch($_POST['lang']){
+ case 'no':
+ $email_subject ='[studiobeve] Din reservasjon er endret';
+ $content = 'Kjære gjest, ';
+ $content .= 'Vi vil gjerne informere deg om at din reservasjon er endret. ';
+ $content .= ' ';
+ $content .= '';
+ $content .= 'Navn: '.$bookingArray['guest_name'].' ';
+ $content .= 'E-post: '.$bookingArray['guest_email'].' ';
+ $content .= 'Telefon: '.$bookingArray['guest_phone'].' ';
+ $content .= 'Arbeider: '.$worker->worker_name.' ';
+ $content .= 'Dato: '.$bookingArray['booking_date'].' ';
+ $content .= 'Tid: '.$bookingArray['booking_start_time'].' - '.$bookingArray['booking_finish_time'].' ';
+ $content .= 'Tjenester: ';
+ $totalServicePrice = 0;
+ foreach($serviceArray as $serviceArrayItem){
+ $totalServicePrice += $serviceArrayItem->service_price;
+ $content .= ''.$serviceArrayItem->service_name_no.' '.$serviceArrayItem->service_price.' kr ';
+ }
+ $content .= '
';
+ $content .= 'Totalpris: '.$totalServicePrice.' kr ';
+ $content .= '
';
+ $content .= ' STUDIOBEVE';
+ $this->Log_model->addLog('bookings', $data['currentUser']->username.' foglalás módosításról norvég nyelvű értesítést küldött a(z) '.$bookingArray['guest_email'].' email címre ('.implode(', ', $bookingArray).')', $data['currentUser']->username);
+ break;
+ case 'en':
+ $email_subject ='[studiobeve] Your booking has changed';
+ $content = 'Dear Guest, ';
+ $content .= 'We inform you that your booking has changed. ';
+ $content .= ' ';
+ $content .= '';
+ $content .= 'Name: '.$bookingArray['guest_name'].' ';
+ $content .= 'Email: '.$bookingArray['guest_email'].' ';
+ $content .= 'Phone: '.$bookingArray['guest_phone'].' ';
+ $content .= 'Worker: '.$worker->worker_name.' ';
+ $content .= 'Date: '.$bookingArray['booking_date'].' ';
+ $content .= 'Time: '.$bookingArray['booking_start_time'].' - '.$bookingArray['booking_finish_time'].' ';
+ $content .= 'Services: ';
+ $totalServicePrice = 0;
+ foreach($serviceArray as $serviceArrayItem){
+ $totalServicePrice += $serviceArrayItem->service_price;
+ $content .= ''.$serviceArrayItem->service_name_en.' '.$serviceArrayItem->service_price.' kr ';
+ }
+ $content .= '
';
+ $content .= 'Total price: '.$totalServicePrice.' kr ';
+ $content .= '
';
+ $content .= ' STUDIOBEVE';
+ $this->Log_model->addLog('bookings', $data['currentUser']->username.' foglalás módosításról angol nyelvű értesítést küldött a(z) '.$bookingArray['guest_email'].' email címre ('.implode(', ', $bookingArray).')', $data['currentUser']->username);
+ break;
+ case 'hu':
+ $email_subject ='[studiobeve] A foglalása módosult';
+ $content = 'Kedves Vendégünk, ';
+ $content .= 'Tájékoztatjuk, hogy a foglalása módosult. ';
+ $content .= ' ';
+ $content .= '';
+ $content .= 'Név: '.$bookingArray['guest_name'].' ';
+ $content .= 'Email: '.$bookingArray['guest_email'].' ';
+ $content .= 'Telefon: '.$bookingArray['guest_phone'].' ';
+ $content .= 'Dolgozó: '.$worker->worker_name.' ';
+ $content .= 'Dátum: '.$bookingArray['booking_date'].' ';
+ $content .= 'Időpont: '.$bookingArray['booking_start_time'].' - '.$bookingArray['booking_finish_time'].' ';
+ $content .= 'Szolgáltatás(ok): ';
+ $totalServicePrice = 0;
+ foreach($serviceArray as $serviceArrayItem){
+ $totalServicePrice += $serviceArrayItem->service_price;
+ $content .= ''.$serviceArrayItem->service_name_hu.' '.$serviceArrayItem->service_price.' kr ';
+ }
+ $content .= '
';
+ $content .= 'Összesen fizetendő: '.$totalServicePrice.' kr ';
+ $content .= '
';
+ $content .= ' STUDIOBEVE';
+ $this->Log_model->addLog('bookings', $data['currentUser']->username.' foglalás módosításról magyar nyelvű értesítést küldött a(z) '.$bookingArray['guest_email'].' email címre ('.implode(', ', $bookingArray).')', $data['currentUser']->username);
+ break;
+ }
+
+ $data['selectedLang'] = $_POST['lang'];
+
+ $emailItem = array(
+ 'addressee_email' => $bookingArray['guest_email'],
+ 'addressee_name' => $bookingArray['guest_name'],
+ 'subject' => $email_subject,
+ 'content' => $content,
+ 'attachments' => array()
+ );
+ $emailArray[] = $emailItem;
+
+ $this->User_model->sendEmail($emailArray, $_POST['lang'], '');
+ }
+ header('Location:'.SITEURL.'bookings');
+ }
+
+ $this->load->view('admin/booking-process', $data);
+ }
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+}
diff --git a/application/controllers/Admin_20250524.php b/application/controllers/Admin_20250524.php
new file mode 100755
index 0000000..bf200b2
--- /dev/null
+++ b/application/controllers/Admin_20250524.php
@@ -0,0 +1,963 @@
+
+ * @see https://codeigniter.com/userguide3/general/urls.html
+ */
+ public function dashboard(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+ $this->load->model('Module_model');
+
+ if(isset($_SESSION['username'])){
+ $data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
+ $data['pageTitle'] = 'Vezérlőpult';
+ $data['message'] = '';
+ $data['message_class'] = '';
+ if($this->User_model->is_user_admin($_SESSION['username'])){
+ $data['activeModules'] = $this->Module_model->getAllModule();
+ }
+ else{
+ $data['activeModules'] = $this->Module_model->getUserModules($data['currentUser']->user_id);
+ }
+
+ $this->load->view('admin/dashboard', $data);
+ }
+ else{
+ header("Location:".SITEURL."login");
+ }
+ }
+
+ public function services(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+ $this->load->model('Module_model');
+
+ if(isset($_SESSION['username'])){
+ $data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
+ $data['pageTitle'] = 'Szolgáltatások';
+ $data['message'] = '';
+ $data['message_class'] = '';
+ if($this->User_model->is_user_admin($_SESSION['username'])){
+ $data['activeModules'] = $this->Module_model->getAllModule();
+ }
+ else{
+ $data['activeModules'] = $this->Module_model->getUserModules($data['currentUser']->user_id);
+ }
+
+ $data['results'] = $this->Service_model->getAllServices();
+
+ $this->load->view('admin/services', $data);
+ }
+ else{
+ header("Location:".SITEURL."login");
+ }
+ }
+
+ public function add_service(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+ $this->load->model('Module_model');
+
+ if(isset($_SESSION['username'])){
+ $data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
+ $data['pageTitle'] = 'Szolgáltatás hozzáadás';
+ $data['message'] = '';
+ $data['message_class'] = '';
+ if($this->User_model->is_user_admin($_SESSION['username'])){
+ $data['activeModules'] = $this->Module_model->getAllModule();
+ }
+ else{
+ $data['activeModules'] = $this->Module_model->getUserModules($data['currentUser']->user_id);
+ }
+
+ $data['serviceCategories'] = $this->Service_model->getAllServiceCategories();
+ $this->load->view('admin/add-service', $data);
+ }
+ else{
+ header("Location:".SITEURL."login");
+ }
+ }
+
+ public function update_service($service_id){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+ $this->load->model('Module_model');
+
+ if(isset($_SESSION['username'])){
+ $data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
+ $data['pageTitle'] = 'Szolgáltatás módosítása (#'.$service_id.')';
+ $data['message'] = '';
+ $data['message_class'] = '';
+ if($this->User_model->is_user_admin($_SESSION['username'])){
+ $data['activeModules'] = $this->Module_model->getAllModule();
+ }
+ else{
+ $data['activeModules'] = $this->Module_model->getUserModules($data['currentUser']->user_id);
+ }
+
+ $data['selectedItem'] = $this->Service_model->getServiceById($service_id);
+ $data['serviceCategories'] = $this->Service_model->getAllServiceCategories();
+ $this->load->view('admin/update-service', $data);
+ }
+ else{
+ header("Location:".SITEURL."login");
+ }
+ }
+
+ public function service_process(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+ $this->load->model('Log_model');
+
+ if(isset($_SESSION['username'])){
+ $data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
+ $data['pageTitle'] = '';
+ $data['message'] = '';
+ $data['message_class'] = '';
+
+ if(isset($_GET['delete-service'])){
+ $selected_service = $this->Service_model->getServiceById($_GET['delete-service']);
+ $serviceArray = array(
+ 'is_deleted' => '1'
+ );
+
+ $this->Service_model->updateService($_GET['delete-service'], $serviceArray);
+ $this->Log_model->addLog('services', $data['currentUser']->username.' törölte a(z) '.$_GET['delete-service'].' számú szolgáltatást ('.$selected_service->service_name_hu.')', $data['currentUser']->username);
+
+ }
+
+ if(isset($_POST['addNewService'])){
+ $serviceArray = array(
+ 'service_type' => $_POST['service_type'],
+ 'service_category_no' => $_POST['service_category_no'],
+ 'service_category_en' => $_POST['service_category_en'],
+ 'service_category_hu' => $_POST['service_category_hu'],
+ 'service_name_no' => $_POST['service_name_no'],
+ 'service_name_en' => $_POST['service_name_en'],
+ 'service_name_hu' => $_POST['service_name_hu'],
+ 'service_description_no' => $_POST['service_description_no'],
+ 'service_description_en' => $_POST['service_description_en'],
+ 'service_description_hu' => $_POST['service_description_hu'],
+ 'service_price' => $_POST['service_price'],
+ 'service_time' => $_POST['service_time'],
+ 'service_category_id' => $_POST['service_category_id'],
+ 'is_enabled' => $_POST['is_enabled']
+ );
+
+ $this->Log_model->addLog('services', $data['currentUser']->username.' hozzáadta a(z) '.$_POST['service_name_hu'].' szolgáltatást ('.implode(',',$serviceArray).')', $data['currentUser']->username);
+ $this->Service_model->createService($serviceArray);
+ }
+
+ if(isset($_POST['updateService'])){
+ $serviceArray = array(
+ 'service_type' => $_POST['service_type'],
+ 'service_category_no' => $_POST['service_category_no'],
+ 'service_category_en' => $_POST['service_category_en'],
+ 'service_category_hu' => $_POST['service_category_hu'],
+ 'service_name_no' => $_POST['service_name_no'],
+ 'service_name_en' => $_POST['service_name_en'],
+ 'service_name_hu' => $_POST['service_name_hu'],
+ 'service_description_no' => $_POST['service_description_no'],
+ 'service_description_en' => $_POST['service_description_en'],
+ 'service_description_hu' => $_POST['service_description_hu'],
+ 'service_price' => $_POST['service_price'],
+ 'service_time' => $_POST['service_time'],
+ 'service_category_id' => $_POST['service_category_id'],
+ 'is_enabled' => $_POST['is_enabled']
+ );
+
+ $this->Log_model->addLog('services', $data['currentUser']->username.' módosította a(z) '.$_POST['service_name_hu'].' szolgáltatást ('.implode(',',$serviceArray).')', $data['currentUser']->username);
+ $this->Service_model->updateService($_POST['service_id'], $serviceArray);
+ }
+
+ header('Location:'.SITEURL.'services');
+ $this->load->view('admin/service-process', $data);
+ }
+ }
+
+ public function service_categories(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+ $this->load->model('Module_model');
+
+ if(isset($_SESSION['username'])){
+ $data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
+ $data['pageTitle'] = 'Szolgáltatás kategóriák';
+ $data['message'] = '';
+ $data['message_class'] = '';
+ if($this->User_model->is_user_admin($_SESSION['username'])){
+ $data['activeModules'] = $this->Module_model->getAllModule();
+ }
+ else{
+ $data['activeModules'] = $this->Module_model->getUserModules($data['currentUser']->user_id);
+ }
+
+ $data['results'] = $this->Service_model->getAllServiceCategories();
+
+ $this->load->view('admin/service-categories', $data);
+ }
+ else{
+ header("Location:".SITEURL."login");
+ }
+ }
+
+ public function add_service_category(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+ $this->load->model('Module_model');
+
+ if(isset($_SESSION['username'])){
+ $data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
+ $data['pageTitle'] = 'Szolgáltatás kategória hozzáadása';
+ $data['message'] = '';
+ $data['message_class'] = '';
+ if($this->User_model->is_user_admin($_SESSION['username'])){
+ $data['activeModules'] = $this->Module_model->getAllModule();
+ }
+ else{
+ $data['activeModules'] = $this->Module_model->getUserModules($data['currentUser']->user_id);
+ }
+
+
+ $this->load->view('admin/add-service-category', $data);
+ }
+ else{
+ header("Location:".SITEURL."login");
+ }
+ }
+
+ public function update_service_category($service_category_id){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+ $this->load->model('Module_model');
+
+ if(isset($_SESSION['username'])){
+ $data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
+ $data['pageTitle'] = 'Szolgáltatás módosítása (#'.$service_category_id.')';
+ $data['message'] = '';
+ $data['message_class'] = '';
+ if($this->User_model->is_user_admin($_SESSION['username'])){
+ $data['activeModules'] = $this->Module_model->getAllModule();
+ }
+ else{
+ $data['activeModules'] = $this->Module_model->getUserModules($data['currentUser']->user_id);
+ }
+
+ $data['selectedItem'] = $this->Service_model->getServiceCategoryById($service_category_id);
+ $this->load->view('admin/update-service-category', $data);
+ }
+ else{
+ header("Location:".SITEURL."login");
+ }
+ }
+
+ public function service_category_process(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+ $this->load->model('Log_model');
+
+ if(isset($_SESSION['username'])){
+ $data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
+ $data['pageTitle'] = '';
+ $data['message'] = '';
+ $data['message_class'] = '';
+
+ if(isset($_GET['delete-service-category'])){
+ $selected_service = $this->Service_model->getServiceCategoryById($_GET['delete-service-category']);
+ $serviceArray = array(
+ 'is_deleted' => '1'
+ );
+
+ $this->Service_model->updateServiceCategory($_GET['delete-service-category'], $serviceArray);
+
+ }
+
+ if(isset($_POST['addNewServiceCategory'])){
+ $serviceCategoryArray = array(
+ 'serv_cat_slug' => $_POST['serv_cat_slug'],
+ 'serv_cat_name' => $_POST['serv_cat_name']
+ );
+
+ $this->Service_model->createServiceCategory($serviceCategoryArray);
+ }
+
+ if(isset($_POST['updateServiceCategory'])){
+ $serviceCategoryArray = array(
+ 'serv_cat_slug' => $_POST['serv_cat_slug'],
+ 'serv_cat_name' => $_POST['serv_cat_name']
+ );
+
+ $this->Service_model->updateServiceCategory($_POST['service_category_id'], $serviceCategoryArray);
+ }
+
+ header('Location:'.SITEURL.'service-categories');
+ $this->load->view('admin/service-category-process', $data);
+ }
+ }
+ public function workers(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+ $this->load->model('Module_model');
+
+ if(isset($_SESSION['username'])){
+ $data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
+ $data['pageTitle'] = 'Dolgozók';
+ $data['message'] = '';
+ $data['message_class'] = '';
+ if($this->User_model->is_user_admin($_SESSION['username'])){
+ $data['activeModules'] = $this->Module_model->getAllModule();
+ }
+ else{
+ $data['activeModules'] = $this->Module_model->getUserModules($data['currentUser']->user_id);
+ }
+
+ $data['results'] = $this->Service_model->getAllWorkers();
+
+ $this->load->view('admin/workers', $data);
+ }
+ else{
+ header("Location:".SITEURL."login");
+ }
+ }
+
+ public function add_worker(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+ $this->load->model('Module_model');
+
+ if(isset($_SESSION['username'])){
+ $data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
+ $data['pageTitle'] = 'Dolgozó hozzáadása';
+ $data['message'] = '';
+ $data['message_class'] = '';
+ if($this->User_model->is_user_admin($_SESSION['username'])){
+ $data['activeModules'] = $this->Module_model->getAllModule();
+ }
+ else{
+ $data['activeModules'] = $this->Module_model->getUserModules($data['currentUser']->user_id);
+ }
+
+ $data['serviceCategories'] = $this->Service_model->getAllServiceCategories();
+ $this->load->view('admin/add-worker', $data);
+ }
+ else{
+ header("Location:".SITEURL."login");
+ }
+ }
+
+ public function update_worker($worker_id){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+ $this->load->model('Module_model');
+
+ if(isset($_SESSION['username'])){
+ $data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
+ $data['pageTitle'] = 'Dolgozó módosítása (#'.$worker_id.')';
+ $data['message'] = '';
+ $data['message_class'] = '';
+ if($this->User_model->is_user_admin($_SESSION['username'])){
+ $data['activeModules'] = $this->Module_model->getAllModule();
+ }
+ else{
+ $data['activeModules'] = $this->Module_model->getUserModules($data['currentUser']->user_id);
+ }
+
+ $data['serviceCategories'] = $this->Service_model->getAllServiceCategories();
+ $data['selectedItem'] = $this->Service_model->getWorkerById($worker_id);
+ $this->load->view('admin/update-worker', $data);
+ }
+ else{
+ header("Location:".SITEURL."login");
+ }
+ }
+
+ public function worker_process(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+ $this->load->model('Log_model');
+
+ if(isset($_SESSION['username'])){
+ $data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
+ $data['pageTitle'] = '';
+ $data['message'] = '';
+ $data['message_class'] = '';
+
+ if(isset($_GET['delete-worker'])){
+ $selected_worker = $this->Service_model->getWorkerById($_GET['delete-worker']);
+ $workerArray = array(
+ 'is_deleted' => '1'
+ );
+
+ $this->Service_model->updateWorker($_GET['delete-worker'], $workerArray);
+ $this->Log_model->addLog('workers', $data['currentUser']->username.' törölte a(z) '.$_GET['delete-worker'].' számú dolgozót ('.$selected_worker->worker_name.')', $data['currentUser']->username);
+ }
+
+
+ if(isset($_POST['addNewWorker'])){
+
+ $data['worker_img'] = '';
+
+ if($_FILES["worker_img"]["tmp_name"] != ''){
+ $target_dir = getcwd()."/assets/img/";
+ $target_file = $target_dir . 'worker_'.str_replace(' ','_', $_POST['worker_name']);
+ $imageFileType = strtolower(pathinfo(basename($_FILES["worker_img"]["name"]),PATHINFO_EXTENSION));
+
+ if (move_uploaded_file($_FILES["worker_img"]["tmp_name"], $target_file.'.'.$imageFileType)) {
+ $data['message'] = 'A profilkép sikeresen feltöltve!';
+ $data['message_class'] = 'successMessage';
+ $data['worker_img'] = 'worker_'.str_replace(' ','_', $_POST['worker_name']).'.'.$imageFileType;
+
+ } else {
+ $data['message'] = 'Hiba a feltöltés közben!';
+ $data['message_class'] = 'errorMessage';
+ }
+
+ }
+
+ $workerArray = array(
+ 'worker_name' => $_POST['worker_name'],
+ 'worker_info' => $_POST['worker_info'],
+ 'is_beauty' => $_POST['is_beauty'],
+ 'is_barber' => $_POST['is_barber'],
+ 'worker_profile_img' => $data['worker_img'],
+ 'service_category_id' => $data['service_category_id'],
+ 'is_active' => $_POST['is_active']
+ );
+
+ $this->Log_model->addLog('workers', $data['currentUser']->username.' létrehozta a(z) '.$_POST['worker_name'].' nevű dolgozót ('.implode(',',$workerArray).')', $data['currentUser']->username);
+ $this->Service_model->createWorker($workerArray);
+ }
+
+ if(isset($_POST['updateWorker'])){
+ $workerArray = array(
+ 'worker_name' => $_POST['worker_name'],
+ 'worker_info' => $_POST['worker_info'],
+ 'is_beauty' => $_POST['is_beauty'],
+ 'is_barber' => $_POST['is_barber'],
+ 'service_category_id' => $_POST['service_category_id'],
+ 'is_active' => $_POST['is_active']
+ );
+ $this->Service_model->updateWorker($_POST['worker_id'], $workerArray);
+ $this->Log_model->addLog('workers', $data['currentUser']->username.' módosította a(z) '.$_POST['worker_name'].' nevű dolgozót ('.implode(',',$workerArray).')', $data['currentUser']->username);
+
+ if($_FILES["worker_img"]["tmp_name"] != ''){
+ $target_dir = getcwd()."/assets/img/";
+ $target_file = $target_dir . 'worker_'.str_replace(' ','_', $_POST['worker_name']);
+ $imageFileType = strtolower(pathinfo(basename($_FILES["worker_img"]["name"]),PATHINFO_EXTENSION));
+
+ if (move_uploaded_file($_FILES["worker_img"]["tmp_name"], $target_file.'.'.$imageFileType)) {
+ $data['message'] = 'A profilkép sikeresen feltöltve!';
+ $data['message_class'] = 'successMessage';
+ $data['worker_img'] = 'worker_'.str_replace(' ','_', $_POST['worker_name']).'.'.$imageFileType;
+ $workerArray = array(
+ 'worker_profile_img' => $data['worker_img']
+ );
+
+ $this->Log_model->addLog('workers', $data['currentUser']->username.' profilképet állított be a(z) '.$_POST['worker_name'].' nevű dolgozóhoz', $data['currentUser']->username);
+ $this->Service_model->updateWorker($_POST['worker_id'], $workerArray);
+
+ } else {
+ $data['message'] = 'Hiba a feltöltés közben!';
+ $data['message_class'] = 'errorMessage';
+ }
+
+ }
+ }
+ header("Location:".SITEURL."workers");
+ $this->load->view('admin/worker-process', $data);
+ }
+ }
+
+ public function bookings(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+ $this->load->model('Module_model');
+
+ if(isset($_SESSION['username'])){
+ $data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
+ $data['pageTitle'] = 'Foglalások';
+ $data['message'] = '';
+ $data['message_class'] = '';
+ if($this->User_model->is_user_admin($_SESSION['username'])){
+ $data['activeModules'] = $this->Module_model->getAllModule();
+ }
+ else{
+ $data['activeModules'] = $this->Module_model->getUserModules($data['currentUser']->user_id);
+ }
+
+ $data['workers'] = $this->Service_model->getActiveWorkers();
+
+ if(isset($_GET['worker'])){
+ $data['results'] = $this->Service_model->getActualBookingsByWorkerID($_GET['worker']);
+ }
+ else{
+ $data['results'] = $this->Service_model->getActualBookings();
+ }
+
+
+ $this->load->view('admin/bookings', $data);
+ }
+ else{
+ header("Location:".SITEURL."login");
+ }
+ }
+
+ public function add_booking(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+ $this->load->model('Module_model');
+
+ if(isset($_SESSION['username'])){
+ $data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
+ $data['pageTitle'] = 'Foglalás hozzáadása';
+ $data['message'] = '';
+ $data['message_class'] = '';
+ if($this->User_model->is_user_admin($_SESSION['username'])){
+ $data['activeModules'] = $this->Module_model->getAllModule();
+ }
+ else{
+ $data['activeModules'] = $this->Module_model->getUserModules($data['currentUser']->user_id);
+ }
+
+ $available_services = $this->Service_model->getAvailableServices();
+
+ $serviceFile = fopen("load_services.json", "w") or die("Unable to open file!");
+ fwrite($serviceFile, json_encode($available_services));
+ fclose($serviceFile);
+
+ $data['workers'] = $this->Service_model->getAllWorkers();
+ $this->load->view('admin/add-booking', $data);
+ }
+ else{
+ header("Location:".SITEURL."login");
+ }
+ }
+
+ public function update_booking($booking_id){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+ $this->load->model('Module_model');
+
+ if(isset($_SESSION['username'])){
+ $data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
+ $data['pageTitle'] = 'Foglalás módosítása (#'.$booking_id.')';
+ $data['message'] = '';
+ $data['message_class'] = '';
+ if($this->User_model->is_user_admin($_SESSION['username'])){
+ $data['activeModules'] = $this->Module_model->getAllModule();
+ }
+ else{
+ $data['activeModules'] = $this->Module_model->getUserModules($data['currentUser']->user_id);
+ }
+
+ $available_services = $this->Service_model->getAvailableServices();
+
+ $serviceFile = fopen("load_services.json", "w") or die("Unable to open file!");
+ fwrite($serviceFile, json_encode($available_services));
+ fclose($serviceFile);
+
+ $data['workers'] = $this->Service_model->getAllWorkers();
+ $data['selectedItem'] = $this->Service_model->getBookingById($booking_id);
+ $this->load->view('admin/update-booking', $data);
+ }
+ else{
+ header("Location:".SITEURL."login");
+ }
+ }
+
+ public function booking_process(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+ $this->load->model('Log_model');
+
+ if(isset($_SESSION['username'])){
+ $data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
+ $data['pageTitle'] = '';
+ $data['message'] = '';
+ $data['message_class'] = '';
+
+ if(isset($_GET['delete-booking'])){
+ $selectedBooking = $this->Service_model->getBookingById($_GET['delete-booking']);
+ $this->Service_model->deleteBooking($_GET['delete-booking']);
+ $this->Log_model->addLog('bookings', $data['currentUser']->username.' törölte a(z) '.$_GET['delete-booking'].' számú foglalást ('.$selectedBooking->guest_name.', '.$selectedBooking->guest_email.', '.$selectedBooking->guest_phone.', '.$selectedBooking->booking_date.', '.$selectedBooking->booking_start_time.', '.$selectedBooking->booking_finish_time.', '.$selectedBooking->service_ids.')', $data['currentUser']->username);
+ header('Location:'.SITEURL.'bookings');
+ }
+
+ if(isset($_POST['addNewBookingManual'])){
+ $booking_date = new DateTime(date('Y-m-d', strtotime($_POST['booking_date'])));
+ $end_booking_date = new DateTime(date('Y-m-d', strtotime($_POST['end_booking_date'])));
+ $diff = $booking_date->diff($end_booking_date);
+
+ $selectedServiceArray = array();
+
+ if($_POST['service_ids'] != ''){
+ $selectedServiceArray = explode(',', $_POST['service_ids']);
+
+ }
+
+ if($_POST['booking_date'] != $_POST['end_booking_date'] && $booking_date <= $end_booking_date){
+ for($index = 0; $index <= $diff->days; $index++){
+ $selectedDate = date('Y-m-d', strtotime($_POST['booking_date']. ' + '.$index.' days'));
+
+
+ $bookingArray = array(
+ 'guest_name' => $_POST['guest_name'],
+ 'guest_email' => $_POST['guest_email'],
+ 'guest_phone' => $_POST['guest_phone'],
+ 'worker_id' => $_POST['worker_id'],
+ 'booking_date' => $selectedDate,
+ 'booking_start_time' => $_POST['booking_start_time'],
+ 'booking_finish_time' => $_POST['booking_finish_time'],
+ 'service_ids' => serialize($selectedServiceArray),
+ 'guest_confirmed' => '0',
+ 'guest_confirm_code' => '1234',
+ );
+
+ $this->Service_model->createBooking($bookingArray);
+ }
+ }
+ else{
+ $bookingArray = array(
+ 'guest_name' => $_POST['guest_name'],
+ 'guest_email' => $_POST['guest_email'],
+ 'guest_phone' => $_POST['guest_phone'],
+ 'worker_id' => $_POST['worker_id'],
+ 'booking_date' => $_POST['booking_date'],
+ 'booking_start_time' => $_POST['booking_start_time'],
+ 'booking_finish_time' => $_POST['booking_finish_time'],
+ 'service_ids' => serialize($selectedServiceArray),
+ 'guest_confirmed' => '0',
+ 'guest_confirm_code' => '1234',
+ );
+ $this->Log_model->addLog('bookings', $data['currentUser']->username.' létrehoza a(z) '.$_POST['guest_name'].' nevű vendég foglalást ('.implode(', ', $bookingArray).')', $data['currentUser']->username);
+ $this->Service_model->createBooking($bookingArray);
+ }
+
+ if($_POST['send_notification']){
+ $worker = $this->Service_model->getWorkerById($bookingArray['worker_id']);
+
+ $services = unserialize($bookingArray['service_ids']);
+ $serviceArray = array();
+ $emailArray = array();
+
+ if(is_array($services)){
+ foreach($services as $serviceItem){
+ $selectedService = $this->Service_model->getServiceById($serviceItem);
+ if(is_object($selectedService)){
+ $serviceArray[] = $selectedService;
+ }
+ }
+ }
+
+ $content = '';
+
+ switch($_POST['lang']){
+ case 'no':
+ $content = 'Kjære gjest, ';
+ $content .= 'Takk for din bestilling! ';
+ $content .= ' ';
+ $content .= '';
+ $content .= 'Navn: '.$bookingArray['guest_name'].' ';
+ $content .= 'E-post: '.$bookingArray['guest_email'].' ';
+ $content .= 'Telefon: '.$bookingArray['guest_phone'].' ';
+ $content .= 'Arbeider: '.$worker->worker_name.' ';
+ $content .= 'Dato: '.$bookingArray['booking_date'].' ';
+ $content .= 'Tid: '.$bookingArray['booking_start_time'].' - '.$bookingArray['booking_finish_time'].' ';
+ $content .= 'Tjenester: ';
+ $totalServicePrice = 0;
+ foreach($serviceArray as $serviceArrayItem){
+ $totalServicePrice += $serviceArrayItem->service_price;
+ $content .= ''.$serviceArrayItem->service_name_no.' '.$serviceArrayItem->service_price.' kr ';
+ }
+ $content .= '
';
+ $content .= 'Totalpris: '.$totalServicePrice.' kr ';
+ $content .= '
';
+ $content .= ' STUDIOBEVE';
+ $this->Log_model->addLog('bookings', $data['currentUser']->username.' új foglalásról norvég nyelvű értesítést küldött a(z) '.$bookingArray['guest_email'].' email címre ('.implode(', ', $bookingArray).')', $data['currentUser']->username);
+ break;
+ case 'en':
+ $content = 'Dear Guest, ';
+ $content .= 'Thank you for your booking! ';
+ $content .= ' ';
+ $content .= '';
+ $content .= 'Name: '.$bookingArray['guest_name'].' ';
+ $content .= 'Email: '.$bookingArray['guest_email'].' ';
+ $content .= 'Phone: '.$bookingArray['guest_phone'].' ';
+ $content .= 'Worker: '.$worker->worker_name.' ';
+ $content .= 'Date: '.$bookingArray['booking_date'].' ';
+ $content .= 'Time: '.$bookingArray['booking_start_time'].' - '.$bookingArray['booking_finish_time'].' ';
+ $content .= 'Services: ';
+ $totalServicePrice = 0;
+ foreach($serviceArray as $serviceArrayItem){
+ $totalServicePrice += $serviceArrayItem->service_price;
+ $content .= ''.$serviceArrayItem->service_name_en.' '.$serviceArrayItem->service_price.' kr ';
+ }
+ $content .= '
';
+ $content .= 'Total price: '.$totalServicePrice.' kr ';
+ $content .= '
';
+ $content .= ' STUDIOBEVE';
+ $this->Log_model->addLog('bookings', $data['currentUser']->username.' új foglalásról angol nyelvű értesítést küldött a(z) '.$bookingArray['guest_email'].' email címre ('.implode(', ', $bookingArray).')', $data['currentUser']->username);
+ break;
+ case 'hu':
+ $content = 'Kedves Vendégünk, ';
+ $content .= 'Köszönettel fogadtuk a foglalását! ';
+ $content .= ' ';
+ $content .= '';
+ $content .= 'Név: '.$bookingArray['guest_name'].' ';
+ $content .= 'Email: '.$bookingArray['guest_email'].' ';
+ $content .= 'Telefon: '.$bookingArray['guest_phone'].' ';
+ $content .= 'Dolgozó: '.$worker->worker_name.' ';
+ $content .= 'Dátum: '.$bookingArray['booking_date'].' ';
+ $content .= 'Időpont: '.$bookingArray['booking_start_time'].' - '.$bookingArray['booking_finish_time'].' ';
+ $content .= 'Szolgáltatás(ok): ';
+ $totalServicePrice = 0;
+ foreach($serviceArray as $serviceArrayItem){
+ $totalServicePrice += $serviceArrayItem->service_price;
+ $content .= ''.$serviceArrayItem->service_name_hu.' '.$serviceArrayItem->service_price.' kr ';
+ }
+ $content .= '
';
+ $content .= 'Összesen fizetendő: '.$totalServicePrice.' kr ';
+ $content .= '
';
+ $content .= ' STUDIOBEVE';
+ $this->Log_model->addLog('bookings', $data['currentUser']->username.' új foglalásról magyar nyelvű értesítést küldött a(z) '.$bookingArray['guest_email'].' email címre ('.implode(', ', $bookingArray).')', $data['currentUser']->username);
+ break;
+ }
+
+ $data['selectedLang'] = $_POST['lang'];
+
+ $emailItem = array(
+ 'addressee_email' => $bookingArray['guest_email'],
+ 'addressee_name' => $bookingArray['guest_name'],
+ 'subject' => '[studiobeve] Your booking has arrived',
+ 'content' => $content,
+ 'attachments' => array()
+ );
+ $emailArray[] = $emailItem;
+
+
+ $this->User_model->sendEmail($emailArray, $_POST['lang'], '');
+ }
+ header('Location:'.SITEURL.'bookings');
+ }
+
+ if(isset($_POST['updateBookingManual'])){
+ $booking_date = new DateTime(date('Y-m-d', strtotime($_POST['booking_date'])));
+ $end_booking_date = new DateTime(date('Y-m-d', strtotime($_POST['end_booking_date'])));
+ $diff = $booking_date->diff($end_booking_date);
+
+ $selectedServiceArray = array();
+
+ if($_POST['service_ids'] != ''){
+ $selectedServiceArray = explode(',', $_POST['service_ids']);
+
+ }
+
+ if($_POST['booking_date'] != $_POST['end_booking_date'] && $booking_date <= $end_booking_date){
+ for($index = 0; $index <= $diff->days; $index++){
+ $selectedDate = date('Y-m-d', strtotime($_POST['booking_date']. ' + '.$index.' days'));
+
+
+ $bookingArray = array(
+ 'guest_name' => $_POST['guest_name'],
+ 'guest_email' => $_POST['guest_email'],
+ 'guest_phone' => $_POST['guest_phone'],
+ 'worker_id' => $_POST['worker_id'],
+ 'booking_date' => $selectedDate,
+ 'booking_start_time' => $_POST['booking_start_time'],
+ 'booking_finish_time' => $_POST['booking_finish_time'],
+ 'service_ids' => serialize($selectedServiceArray),
+ 'guest_confirmed' => '0',
+ 'guest_confirm_code' => '1234'
+ );
+
+ $this->Service_model->createBooking($bookingArray);
+ }
+ }
+ else{
+ $bookingArray = array(
+ 'guest_name' => $_POST['guest_name'],
+ 'guest_email' => $_POST['guest_email'],
+ 'guest_phone' => $_POST['guest_phone'],
+ 'worker_id' => $_POST['worker_id'],
+ 'booking_date' => $_POST['booking_date'],
+ 'booking_start_time' => $_POST['booking_start_time'],
+ 'booking_finish_time' => $_POST['booking_finish_time'],
+ 'service_ids' => serialize($selectedServiceArray),
+ 'guest_confirmed' => '0',
+ 'guest_confirm_code' => '1234'
+ );
+
+ $this->Service_model->updateBooking($_POST['booking_id'], $bookingArray);
+ $this->Log_model->addLog('bookings', $data['currentUser']->username.' módosította a foglalását a(z) '.$bookingArray['guest_name'].' nevű vendégnek ('.implode(', ', $bookingArray).')', $data['currentUser']->username);
+ }
+
+ if($_POST['send_notification']){
+ $worker = $this->Service_model->getWorkerById($bookingArray['worker_id']);
+
+ $services = unserialize($bookingArray['service_ids']);
+ $serviceArray = array();
+ $emailArray = array();
+
+ if(is_array($services)){
+ foreach($services as $serviceItem){
+ $selectedService = $this->Service_model->getServiceById($serviceItem);
+ if(is_object($selectedService)){
+ $serviceArray[] = $selectedService;
+ }
+ }
+ }
+
+ $content = '';
+
+ $email_subject ='';
+
+ switch($_POST['lang']){
+ case 'no':
+ $email_subject ='[studiobeve] Din reservasjon er endret';
+ $content = 'Kjære gjest, ';
+ $content .= 'Vi vil gjerne informere deg om at din reservasjon er endret. ';
+ $content .= ' ';
+ $content .= '';
+ $content .= 'Navn: '.$bookingArray['guest_name'].' ';
+ $content .= 'E-post: '.$bookingArray['guest_email'].' ';
+ $content .= 'Telefon: '.$bookingArray['guest_phone'].' ';
+ $content .= 'Arbeider: '.$worker->worker_name.' ';
+ $content .= 'Dato: '.$bookingArray['booking_date'].' ';
+ $content .= 'Tid: '.$bookingArray['booking_start_time'].' - '.$bookingArray['booking_finish_time'].' ';
+ $content .= 'Tjenester: ';
+ $totalServicePrice = 0;
+ foreach($serviceArray as $serviceArrayItem){
+ $totalServicePrice += $serviceArrayItem->service_price;
+ $content .= ''.$serviceArrayItem->service_name_no.' '.$serviceArrayItem->service_price.' kr ';
+ }
+ $content .= '
';
+ $content .= 'Totalpris: '.$totalServicePrice.' kr ';
+ $content .= '
';
+ $content .= ' STUDIOBEVE';
+ $this->Log_model->addLog('bookings', $data['currentUser']->username.' foglalás módosításról norvég nyelvű értesítést küldött a(z) '.$bookingArray['guest_email'].' email címre ('.implode(', ', $bookingArray).')', $data['currentUser']->username);
+ break;
+ case 'en':
+ $email_subject ='[studiobeve] Your booking has changed';
+ $content = 'Dear Guest, ';
+ $content .= 'We inform you that your booking has changed. ';
+ $content .= ' ';
+ $content .= '';
+ $content .= 'Name: '.$bookingArray['guest_name'].' ';
+ $content .= 'Email: '.$bookingArray['guest_email'].' ';
+ $content .= 'Phone: '.$bookingArray['guest_phone'].' ';
+ $content .= 'Worker: '.$worker->worker_name.' ';
+ $content .= 'Date: '.$bookingArray['booking_date'].' ';
+ $content .= 'Time: '.$bookingArray['booking_start_time'].' - '.$bookingArray['booking_finish_time'].' ';
+ $content .= 'Services: ';
+ $totalServicePrice = 0;
+ foreach($serviceArray as $serviceArrayItem){
+ $totalServicePrice += $serviceArrayItem->service_price;
+ $content .= ''.$serviceArrayItem->service_name_en.' '.$serviceArrayItem->service_price.' kr ';
+ }
+ $content .= '
';
+ $content .= 'Total price: '.$totalServicePrice.' kr ';
+ $content .= '
';
+ $content .= ' STUDIOBEVE';
+ $this->Log_model->addLog('bookings', $data['currentUser']->username.' foglalás módosításról angol nyelvű értesítést küldött a(z) '.$bookingArray['guest_email'].' email címre ('.implode(', ', $bookingArray).')', $data['currentUser']->username);
+ break;
+ case 'hu':
+ $email_subject ='[studiobeve] A foglalása módosult';
+ $content = 'Kedves Vendégünk, ';
+ $content .= 'Tájékoztatjuk, hogy a foglalása módosult. ';
+ $content .= ' ';
+ $content .= '';
+ $content .= 'Név: '.$bookingArray['guest_name'].' ';
+ $content .= 'Email: '.$bookingArray['guest_email'].' ';
+ $content .= 'Telefon: '.$bookingArray['guest_phone'].' ';
+ $content .= 'Dolgozó: '.$worker->worker_name.' ';
+ $content .= 'Dátum: '.$bookingArray['booking_date'].' ';
+ $content .= 'Időpont: '.$bookingArray['booking_start_time'].' - '.$bookingArray['booking_finish_time'].' ';
+ $content .= 'Szolgáltatás(ok): ';
+ $totalServicePrice = 0;
+ foreach($serviceArray as $serviceArrayItem){
+ $totalServicePrice += $serviceArrayItem->service_price;
+ $content .= ''.$serviceArrayItem->service_name_hu.' '.$serviceArrayItem->service_price.' kr ';
+ }
+ $content .= '
';
+ $content .= 'Összesen fizetendő: '.$totalServicePrice.' kr ';
+ $content .= '
';
+ $content .= ' STUDIOBEVE';
+ $this->Log_model->addLog('bookings', $data['currentUser']->username.' foglalás módosításról magyar nyelvű értesítést küldött a(z) '.$bookingArray['guest_email'].' email címre ('.implode(', ', $bookingArray).')', $data['currentUser']->username);
+ break;
+ }
+
+ $data['selectedLang'] = $_POST['lang'];
+
+ $emailItem = array(
+ 'addressee_email' => $bookingArray['guest_email'],
+ 'addressee_name' => $bookingArray['guest_name'],
+ 'subject' => $email_subject,
+ 'content' => $content,
+ 'attachments' => array()
+ );
+ $emailArray[] = $emailItem;
+
+ $this->User_model->sendEmail($emailArray, $_POST['lang'], '');
+ }
+ header('Location:'.SITEURL.'bookings');
+ }
+
+ $this->load->view('admin/booking-process', $data);
+ }
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+}
diff --git a/application/controllers/Login.php b/application/controllers/Login.php
new file mode 100755
index 0000000..1aef59c
--- /dev/null
+++ b/application/controllers/Login.php
@@ -0,0 +1,95 @@
+
+ * @see https://codeigniter.com/user_guide/general/urls.html
+ */
+ public function index(){
+ $this->load->helper('url');
+ $this->load->helper('cookie');
+ $this->load->model('User_model');
+ $this->load->model('Log_model');
+
+ $data['message'] = '';
+ $data['message_class'] = '';
+
+ $data['username'] = '';
+ $data['password'] = '';
+
+ if(isset($_GET['logout']) && isset($_SESSION['username'])){
+ $this->Log_model->addLog('logout', 'Sikeres kijelentkezés - '.$_SESSION['username'],$_SESSION['username']);
+ unset($_SESSION['username']);
+ unset($_SESSION['password']);
+ $data['message'] = 'Sikeres kijelentkezés!';
+ $data['message_class'] = 'success';
+ }
+
+ elseif(isset($_POST['sendLogin'])){
+ if($this->User_model->userCanLogin($_POST['username'], $_POST['password'])){
+ if($_POST['remember'] == 'on'){
+ $cookie = array(
+ 'name' => 'username',
+ 'value' => $_POST['username'],
+ 'expire' => '300',
+ 'secure' => TRUE
+ );
+ $this->input->set_cookie($cookie);
+
+ $cookie = array(
+ 'name' => 'password',
+ 'value' => $_POST['password'],
+ 'expire' => '300',
+ 'secure' => TRUE
+ );
+ $this->input->set_cookie($cookie);
+
+ }
+ else{
+ delete_cookie("username");
+ delete_cookie("password");
+ }
+
+ $this->Log_model->addLog('login', 'Sikeres bejelentkezés - '.$_POST['username'],$_POST['username']);
+ $_SESSION['username'] = $_POST['username'];
+ $_SESSION['password'] = $_POST['password'];
+ $data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
+
+ header('location:'.base_url().'dashboard');
+
+ }
+ else{
+ $this->Log_model->addLog('login', 'Sikertelen bejelentkezési kísérlet - '.$_POST['username'].' / '.$_POST['password'],$_POST['username']);
+ $data['message'] = 'Sikertelen bejelentkezés!';
+ $data['message_class'] = 'error';
+ }
+ }
+
+ $data['username'] = get_cookie('username');
+ $data['password'] = get_cookie('password');
+
+ $data['pageTitle'] = 'Bejelentkezés';
+ $this->load->view('login',$data);
+ }
+
+
+
+
+}
+
+
+
+?>
diff --git a/application/controllers/ModuleManagement.php b/application/controllers/ModuleManagement.php
new file mode 100755
index 0000000..8787004
--- /dev/null
+++ b/application/controllers/ModuleManagement.php
@@ -0,0 +1,182 @@
+
+ * @see https://codeigniter.com/user_guide/general/urls.html
+ */
+ public function index()
+ {
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Log_model');
+ $this->load->model('Module_model');
+
+ if(isset($_SESSION['username'])){
+ $data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
+
+ //check module is available for user
+ $currentModule = $this->Module_model->getModuleBySlug('module-management');
+
+ if($this->User_model->is_user_admin($_SESSION['username']) || $this->Module_model->is_module_available($currentModule->module_id, $data['currentUser']->user_id)){
+ $data['users'] = $this->User_model->getAllUser();
+ $data['modules'] = $this->Module_model->getAllModule();
+ $data['privileges'] = $this->User_model->getAllUserGroup();
+
+ if(isset($_POST['updatePermission'])){
+
+ //set user privileges
+ foreach($data['modules'] as $moduleItem){
+ $moduleUserArray = array();
+ foreach($data['users'] as $userItem){
+ if($_POST['module_'.$moduleItem->module_id.'_user_'.$userItem->user_id]){
+ $moduleUserArray[] = $userItem->user_id;
+ }
+ }
+
+ if(is_array($moduleUserArray)){
+ $this->Module_model->updateModule('permission_ids', $moduleItem->module_id, $moduleUserArray);
+ $usernames = array();
+ foreach($moduleUserArray as $moduleUserItem){
+ $usernames[] = $this->User_model->getUserById($moduleUserItem)->username;
+ }
+
+ if(!empty($usernames)){
+ $this->Log_model->addLog('change_module_privileges', 'Módosult a '.$moduleItem->module_name.' felhasználó szintű jogosultság kiosztás('.implode(', ', $usernames).') felhasználókra', $_SESSION['username']);
+ }
+ else{
+ $this->Log_model->addLog('change_module_privileges', 'Módosult a '.$moduleItem->module_name.' felhasználó szintű jogosultság kiosztása, jelenleg nincs megosztva', $_SESSION['username']);
+ }
+ }
+
+ }
+
+ //set group privilegies
+ foreach($data['modules'] as $moduleItem){
+ $moduleGroupArray = array();
+ foreach($data['privileges'] as $groupItem){
+
+ if($_POST['module_'.$moduleItem->module_id.'_group_'.$groupItem->permission_id]){
+ $moduleGroupArray[] = $groupItem->permission_id;
+ }
+ }
+
+ if(is_array($moduleGroupArray)){
+ $this->Module_model->updateModule('permission_group_ids',$moduleItem->module_id, $moduleGroupArray);
+ $groupNames = array();
+ foreach($moduleGroupArray as $moduleGroupItem){
+ $groupNames[] = $this->User_model->getpermissionById($moduleGroupItem)->permission_name;
+ }
+ if(!empty($groupNames)){
+ $this->Log_model->addLog('change_module_privileges', 'Módosult a '.$moduleItem->module_name.' csoport szintű jogosultság kiosztás ('.(implode(', ',$groupNames)).') csoportokra', $_SESSION['username']);
+ }
+ else{
+ $this->Log_model->addLog('change_module_privileges', 'Módosult a '.$moduleItem->module_name.' csoport szintű jogosultság kiosztása, jelenleg nincs megosztva', $_SESSION['username']);
+ }
+ }
+
+ }
+ }
+
+ //usersPrivilegesView
+ $userIndex = 1;
+ if(is_array($data['users'])){
+ $data['usersPrivilegesView'] = '';
+ foreach($data['users'] as $userItem){
+
+ $data['usersPrivilegesView'] .= '';
+ $data['usersPrivilegesView'] .= ''.$userIndex.'. ';
+ $data['usersPrivilegesView'] .= ''.$userItem->fullname.' ';
+ $data['usersPrivilegesView'] .= ''.$userItem->username.' ';
+
+ if(is_array($data['modules'])){
+ foreach($data['modules'] as $moduleItem){
+ if($userItem->permission_slug == 'admin'){
+ $data['usersPrivilegesView'] .= ' ';
+
+ }
+ else{
+ $data['usersPrivilegesView'] .= ' Module_model->is_userId_available_in_module($moduleItem->module_id, $userItem->user_id)?'checked':'';
+ $data['usersPrivilegesView'] .= '/> ';
+
+ }
+ }
+ }
+ $userIndex++;
+ $data['usersPrivilegesView'] .= ' ';
+
+ }
+ }
+
+
+ //groupModuleView
+ $groupIndex = 1;
+ foreach($data['privileges'] as $privilegeItem){
+ if($privilegeItem->permission_slug == 'admin'){
+ $data['groupModuleView'] = '';
+ $data['groupModuleView'] .= ''.$groupIndex.'. ';
+ $data['groupModuleView'] .= ''.$privilegeItem->permission_name.' ';
+
+ if(is_array($data['modules'])){
+ foreach($data['modules'] as $moduleItem){
+ $data['groupModuleView'] .= ' ';
+ }
+ }
+ $groupIndex++;
+ $data['groupModuleView'] .= ' ';
+ }
+ else{
+ $data['groupModuleView'] .= '';
+ $data['groupModuleView'] .= ''.$groupIndex.'. ';
+ $data['groupModuleView'] .= ''.$privilegeItem->permission_name.' ';
+ if(is_array($data['modules'])){
+ foreach($data['modules'] as $moduleItem){
+ $data['groupModuleView'] .= ' Module_model->is_groupId_available_in_module($moduleItem->module_id,$privilegeItem->permission_id)?' checked':'';
+ $data['groupModuleView'] .= '/> ';
+ }
+ }
+ $groupIndex++;
+ $data['groupModuleView'] .= ' ';
+ }
+
+ }
+
+
+ //get available modules for menu
+ if($this->User_model->is_user_admin($_SESSION['username'])){
+ $data['activeModules'] = $this->Module_model->getAllModule();
+ }
+ else{
+ $data['activeModules'] = $this->Module_model->getUserModules($data['currentUser']->user_id);
+ }
+
+ $this->load->view('modules/module-management/module-management', $data);
+ }
+ else{
+ header('Location:'.site_url().'404-page-not-found');
+ }
+
+
+ }
+ else{
+ header("Location:".SITEURL."login");
+
+ }
+ }
+
+}
diff --git a/application/controllers/Pages.php b/application/controllers/Pages.php
new file mode 100755
index 0000000..05be793
--- /dev/null
+++ b/application/controllers/Pages.php
@@ -0,0 +1,682 @@
+
+ * @see https://codeigniter.com/userguide3/general/urls.html
+ */
+ public function index(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+
+ $data['pageTitle'] = '';
+ $this->load->view('pages/home', $data);
+ }
+
+ public function barber($lang){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+ $data['pageTitle'] = '';
+ $data['selectedLang'] = $lang;
+
+ $data['services'] = $this->Service_model->getAllServiceByServiceType('barber', $lang);
+ $this->load->view('pages/barber', $data);
+ }
+
+ public function beauty($lang){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+ $data['pageTitle'] = '';
+ $data['selectedLang'] = $lang;
+
+ $data['services'] = $this->Service_model->getAllServiceByServiceType('beauty', $lang);
+ $this->load->view('pages/beauty', $data);
+ }
+
+ public function booking($lang, $subpage){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+
+ $data['pageTitle'] = '';
+ $data['selectedLang'] = $lang;
+ $data['subpage'] = $subpage;
+
+ $data['services'] = $this->Service_model->getAllServiceByServiceType($subpage, $lang);
+ $data['workers'] = $this->Service_model->getActiveWorkers($subpage);
+
+ switch($subpage){
+ case 'barber':
+ $this->load->view('pages/barber-booking', $data);
+ break;
+ case 'beauty':
+ $this->load->view('pages/beauty-booking', $data);
+ break;
+ default:
+ header('Location:'.SITEURL);
+ }
+ }
+
+ public function booking_finished($lang, $subpage){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+ $data['pageTitle'] = '';
+ $data['selectedLang'] = $lang;
+
+ switch($subpage){
+ case 'barber':
+ $this->load->view('pages/barber-booking-finished', $data);
+ break;
+ case 'beauty':
+ $this->load->view('pages/beauty-booking-finished', $data);
+ break;
+ default:
+ header('Location:'.SITEURL);
+ }
+ }
+
+ public function email_verification(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+ $this->load->model('Log_model');
+
+ $data['pageTitle'] = '';
+ $this->load->view('pages/email-verification', $data);
+ }
+
+ public function ajax(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+ $this->load->model('Log_model');
+
+ $data['pageTitle'] = '';
+
+ if(isset($_POST['action']) && $_POST['action'] == 'getAvailableWorkersByServiceCategory' && isset($_POST['serv_cat_slug'])){
+ $workers = $this->Service_model->getWorkersByCategorySlug($_POST['serv_cat_slug']);
+ $returnedWorkers = '';
+ $workerIndex = 0;
+ $workerListShow = '';
+
+ if(is_array($workers)){
+ foreach($workers as $workerItem){
+ $workerListShow .= '';
+ $workerListShow .= '';
+ $workerListShow .= '
';
+ $workerListShow .= '
';
+ $workerListShow .= '
';
+ $workerListShow .= '
'.$workerItem->worker_name.'
';
+ $workerListShow .= '
'.$workerItem->worker_info.'
';
+ $workerListShow .= '
';
+ $workerListShow .= '
';
+ $workerListShow .= ' ';
+ /*
+ ?>
+
+
+
>
+
+
+
worker_name;?>
+
worker_info;?>
+
+
+
+ $workers,
+ 'workerListShow' => $workerListShow
+ );
+
+ echo json_encode($responseArray);
+ }
+
+ if(isset($_POST['action']) && $_POST['action'] == 'calculate_service_length' && isset($_POST['service_ids'])){
+ if($_POST['service_ids'] != ''){
+ $explodedServiceIds = explode(',', $_POST['service_ids']);
+ $totalLength = '00:00:00';
+ if(!empty($explodedServiceIds)){
+ foreach($explodedServiceIds as $explodedServiceIdItem){
+ $currentService = $this->Service_model->getServiceById($explodedServiceIdItem);
+ $time = $totalLength;
+ $time2 = $currentService->service_time;
+
+ $secs = strtotime($time2)-strtotime("00:00:00");
+ $addedTotal = date("H:i:s",strtotime($time)+$secs);
+ $totalLength = $addedTotal;
+ }
+
+ }
+ echo $totalLength;
+ }
+ }
+
+ if(isset($_POST['action']) && $_POST['action'] == 'getAvailableTimeOptions' && isset($_POST['selectedDate'])){
+ $results = $this->Service_model->getAvailableTimes($_POST['worker_id'], $_POST['selectedDate'], $_POST['servicelength']);
+
+ $rowIndex = 1;
+ if(is_array($results)){
+ foreach($results as $resultIem){
+ ?>
+
+ Service_model->getAvailableTimes($_POST['worker_id'], $_POST['selectedDate'], $_POST['servicelength']);
+
+ $timeIsAvailable = 0;
+ if(is_array($results)){
+ foreach($results as $resultIem){
+ if(date('H:i:s', strtotime($resultIem)) == $_POST['selectedTime']){
+ $timeIsAvailable = 1;
+ }
+ }
+
+ echo $timeIsAvailable;
+ }
+ else{
+ echo 0;
+ }
+ }
+
+ if(isset($_POST['action']) && $_POST['action'] == 'getAvailableTimes' && isset($_POST['selectedDate'])){
+ $results = $this->Service_model->getAvailableTimes($_POST['worker_id'], $_POST['selectedDate'], $_POST['servicelength'].':00');
+
+ $rowIndex = 1;
+ if(!empty($results)){
+ foreach($results as $resultIem){
+ ?>
+
+ Service_model->getWorkerById($_POST['worker_id']);
+
+ if(is_object($result)){
+ ?>
+
+ worker_name;?>
+ User_model->getUserById($_POST['user_id']);
+ $userArray = array(
+ 'is_enabled' => $_POST['newValue']
+ );
+ $this->User_model->updateUser($_POST['user_id'], $userArray);
+ $this->Log_model->addLog('change_user_status', $data['currentUser']->username.' státusza változott - '.($_POST['newValue']?'aktív':'letiltva').' állapotra', $_POST['operator']);
+ }
+
+ if(isset($_POST['action']) && $_POST['action'] == 'checkUser'){
+ echo $this->User_model->isUsernameAvailable($_POST['username']);
+ }
+
+ if(isset($_POST['action']) && $_POST['action'] == 'refreshLogMonitor'){
+ $logInfoArray = $this->Log_model->getAllLoginfo();
+ $logrow = '';
+ foreach($logInfoArray as $logInfoItem){
+ $logDateTime = new datetime($logInfoItem->event_datetime);
+ $logrow .= date_format($logDateTime,"Y-m-d H:i").' '.$logInfoItem->username.' '.$logInfoItem->event_content.'
';
+ }
+ echo $logrow;
+ }
+
+
+
+ $this->load->view('pages/ajax', $data);
+ }
+
+
+ public function booking_process(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+
+ $data['pageTitle'] = '';
+ $data['subpage'] = '';
+
+ if(isset($_POST['sendBooking'])){
+ //calculate finish time
+ $serviceStartTime = date("H:i:s", strtotime($_POST['booking_start_time']));
+ $serviceLengthTime = date("H:i:s", strtotime($_POST['servicelength']));
+ $secs = strtotime($serviceLengthTime)-strtotime("00:00:00");
+ $serviceFinishTime = date("H:i:s",strtotime($serviceStartTime)+$secs);
+
+ $data['services'] = $this->Service_model->getAllServiceByServiceType($_POST['subpage'], $_POST['lang']);
+ $data['workers'] = $this->Service_model->getAllWorkers();
+ $data['selectedLang'] = 'en';
+ $selectedServiceArray = array();
+
+
+ //find selected services
+ if(is_array($data['services'])){
+ foreach($data['services'] as $serviceItem){
+ if(isset($_POST['service_'.$serviceItem->service_id])){
+ if($_POST['service_'.$serviceItem->service_id]){
+ $selectedServiceArray[] = $serviceItem->service_id;
+ }
+ }
+ }
+ }
+
+ // 1. Build selected service array
+ $selectedServiceArray = array();
+ $totalLengthSeconds = 0;
+
+ foreach ($_POST as $key => $value) {
+ if (strpos($key, 'service_') === 0 && $value == '1') {
+ $serviceId = str_replace('service_', '', $key);
+ $selectedServiceArray[] = $serviceId;
+
+ $service = $this->Service_model->getServiceById($serviceId);
+ if ($service) {
+ $parts = explode(':', $service->service_time);
+ $totalLengthSeconds += ($parts[0] * 3600) + ($parts[1] * 60);
+ }
+ }
+ }
+
+ // 2. Convert total time to H:i format
+ $servicelength = gmdate('H:i:s', $totalLengthSeconds);
+
+ // 3. Build booking array
+ $bookingArray = array(
+ 'guest_name' => $_POST['guest_name'],
+ 'guest_email' => $_POST['guest_email'],
+ 'guest_phone' => $_POST['guest_phone'],
+ 'worker_id' => $_POST['worker_id'],
+ 'booking_date' => $_POST['booking_date'],
+ 'booking_start_time' => $_POST['booking_start_time'],
+ 'booking_finish_time' => '', // optional
+ 'service_ids' => serialize($selectedServiceArray),
+ 'guest_confirmed' => '0',
+ 'guest_confirm_code' => '1234',
+ );
+
+ $bookingDate = $bookingArray['booking_date'];
+ $bookingTime = $bookingArray['booking_start_time'];
+ $weekday = date('w', strtotime($bookingDate));
+ $schedule = $this->Service_model->getWorkerScheduleByDay($bookingArray['worker_id'], $weekday);
+
+ if (!$schedule) {
+ $this->output
+ ->set_status_header(403)
+ ->set_content_type('application/json')
+ ->set_output(json_encode(['error' => 'Worker is not available on this day.']));
+ return;
+ }
+
+ if ($bookingTime < $schedule->start_time || $bookingTime >= $schedule->end_time) {
+ $this->output
+ ->set_status_header(403)
+ ->set_content_type('application/json')
+ ->set_output(json_encode(['error' => 'Booking time is outside worker schedule.']));
+ return;
+ }
+
+ if (!$this->Service_model->isWorkerAvailableThisWeek($bookingArray['worker_id'], $bookingDate)) {
+ $this->output
+ ->set_status_header(403)
+ ->set_content_type('application/json')
+ ->set_output(json_encode(['error' => 'Worker only works every second week.']));
+ return;
+ }
+
+ // 4. Validate: available slot with correct length
+ $available = $this->Service_model->getAvailableTimes(
+ $bookingArray['worker_id'],
+ $bookingArray['booking_date'],
+ $servicelength
+ );
+
+ if (!is_array($available) || !in_array($bookingArray['booking_start_time'], $available)) {
+ $this->output
+ ->set_status_header(409)
+ ->set_content_type('application/json')
+ ->set_output(json_encode([
+ 'error' => 'Conflict. Timeslot is taken or does not fit the service.'
+ ]));
+ return;
+ }
+
+ // 5. Validate: booking doesn't go past 18:00
+ $bookingStart = new DateTime($bookingArray['booking_start_time']);
+ $bookingLength = new DateTime($servicelength);
+ $bookingEnd = clone $bookingStart;
+ $bookingEnd->add(new DateInterval('PT' . intval($bookingLength->format('H')) . 'H'));
+ $bookingEnd->add(new DateInterval('PT' . intval($bookingLength->format('i')) . 'M'));
+
+ $bookingArray['booking_finish_time'] = $bookingEnd->format('H:i:s');
+
+ $closingTime = new DateTime('18:00');
+
+ if ($bookingEnd > $closingTime) {
+ $this->output
+ ->set_status_header(403)
+ ->set_content_type('application/json')
+ ->set_output(json_encode([
+ 'error' => 'Selected time exceeds business hours.'
+ ]));
+ return;
+ }
+
+ // 6. Create booking
+ $this->Service_model->createBooking($bookingArray);
+
+ $worker = $this->Service_model->getWorkerById($bookingArray['worker_id']);
+
+ $services = unserialize($bookingArray['service_ids']);
+ $serviceArray = array();
+ $emailArray = array();
+
+ if(is_array($services)){
+ foreach($services as $serviceItem){
+ $selectedService = $this->Service_model->getServiceById($serviceItem);
+ if(is_object($selectedService)){
+ $serviceArray[] = $selectedService;
+ }
+ }
+ }
+
+ $content = '';
+
+ switch($_POST['lang']){
+ case 'no':
+ $content = 'Kjære gjest, ';
+ $content .= 'Takk for din bestilling! ';
+ $content .= ' ';
+ $content .= '';
+ $content .= 'Navn: '.$bookingArray['guest_name'].' ';
+ $content .= 'E-post: '.$bookingArray['guest_email'].' ';
+ $content .= 'Telefon: '.$bookingArray['guest_phone'].' ';
+ $content .= 'Arbeider: '.$worker->worker_name.' ';
+ $content .= 'Dato: '.$bookingArray['booking_date'].' ';
+ $content .= 'Tid: '.$bookingArray['booking_start_time'].' - '.$bookingArray['booking_finish_time'].' ';
+ $content .= 'Tjenester: ';
+ $totalServicePrice = 0;
+ foreach($serviceArray as $serviceArrayItem){
+ $totalServicePrice += $serviceArrayItem->service_price;
+ $content .= ''.$serviceArrayItem->service_name_no.' '.$serviceArrayItem->service_price.' kr ';
+ }
+ $content .= '
';
+ $content .= 'Totalpris: '.$totalServicePrice.' kr ';
+ $content .= '
';
+ $content .= ' STUDIOBEVE';
+ break;
+ case 'en':
+ $content = 'Dear Guest, ';
+ $content .= 'Thank you for your booking! ';
+ $content .= ' ';
+ $content .= '';
+ $content .= 'Name: '.$bookingArray['guest_name'].' ';
+ $content .= 'Email: '.$bookingArray['guest_email'].' ';
+ $content .= 'Phone: '.$bookingArray['guest_phone'].' ';
+ $content .= 'Worker: '.$worker->worker_name.' ';
+ $content .= 'Date: '.$bookingArray['booking_date'].' ';
+ $content .= 'Time: '.$bookingArray['booking_start_time'].' - '.$bookingArray['booking_finish_time'].' ';
+ $content .= 'Services: ';
+ $totalServicePrice = 0;
+ foreach($serviceArray as $serviceArrayItem){
+ $totalServicePrice += $serviceArrayItem->service_price;
+ $content .= ''.$serviceArrayItem->service_name_en.' '.$serviceArrayItem->service_price.' kr ';
+ }
+ $content .= '
';
+ $content .= 'Total price: '.$totalServicePrice.' kr ';
+ $content .= '
';
+ $content .= ' STUDIOBEVE';
+ break;
+ case 'hu':
+ $content = 'Kedves Vendégünk, ';
+ $content .= 'Köszönettel fogadtuk a foglalását! ';
+ $content .= ' ';
+ $content .= '';
+ $content .= 'Név: '.$bookingArray['guest_name'].' ';
+ $content .= 'Email: '.$bookingArray['guest_email'].' ';
+ $content .= 'Telefon: '.$bookingArray['guest_phone'].' ';
+ $content .= 'Dolgozó: '.$worker->worker_name.' ';
+ $content .= 'Dátum: '.$bookingArray['booking_date'].' ';
+ $content .= 'Időpont: '.$bookingArray['booking_start_time'].' - '.$bookingArray['booking_finish_time'].' ';
+ $content .= 'Szolgáltatás(ok): ';
+ $totalServicePrice = 0;
+ foreach($serviceArray as $serviceArrayItem){
+ $totalServicePrice += $serviceArrayItem->service_price;
+ $content .= ''.$serviceArrayItem->service_name_hu.' '.$serviceArrayItem->service_price.' kr ';
+ }
+ $content .= '
';
+ $content .= 'Összesen fizetendő: '.$totalServicePrice.' kr ';
+ $content .= '
';
+ $content .= ' STUDIOBEVE';
+ break;
+ }
+
+ $data['selectedLang'] = $_POST['lang'];
+
+ $emailItem = array(
+ 'addressee_email' => $bookingArray['guest_email'],
+ 'addressee_name' => $bookingArray['guest_name'],
+ 'subject' => '[studiobeve] Your booking has arrived',
+ 'content' => $content,
+ 'attachments' => array()
+ );
+ $emailArray[] = $emailItem;
+ header('Location:'.SITEURL.$_POST['lang'].'/booking-finished/'.$_POST['subpage']);
+ }
+
+ $this->User_model->sendEmail($emailArray, $_POST['lang'], $_POST['subpage']);
+ $this->load->view('pages/booking-process', $data);
+ }
+
+ public function profile(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Log_model');
+ $this->load->model('Module_model');
+ $data['message'] = '';
+ $data['message_class'] = '';
+ $data['fullname'] = '';
+ $data['password'] = '';
+ $data['profile_img_url'] = '';
+
+ if(isset($_SESSION['username'])){
+ $data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
+
+ $data['message'] = '';
+ $data['message_class'] = '';
+ $data['pageTitle'] = 'Profil szerkesztése';
+
+ if($this->User_model->is_user_admin($_SESSION['username'])){
+ $data['activeModules'] = $this->Module_model->getAllModule();
+ }
+ else{
+ $data['activeModules'] = $this->Module_model->getUserModules($data['currentUser']->user_id);
+ }
+
+ if(isset($_POST["storeProfile"])) {
+
+ if($_POST['fullname'] != $data['currentUser']->fullname){
+ $userArray = array(
+ 'fullname' => $_POST['fullname']
+ );
+ $this->User_model->updateUser($data['currentUser']->user_id, $userArray);
+ $this->Log_model->addLog('profile', 'A felhasználó módosította a teljes nevét: '.$data['currentUser']->fullname.' => '.$_POST['fullname'],$_SESSION['username']);
+ }
+
+ if($_POST['password'] != ''){
+ $userArray = array(
+ 'password' => hash('sha256', $_POST['password'])
+ );
+ $this->User_model->updateUser($data['currentUser']->user_id, $userArray);
+ $this->Log_model->addLog('profile', 'A felhasználó módosította a jelszavát',$_SESSION['username']);
+ }
+
+
+ //upload profile image
+ if($_FILES["profile_img"]["tmp_name"] != ''){
+ $target_dir = getcwd()."/assets/img/profiles/";
+ $target_file = $target_dir . str_replace('.','_', str_replace('@','_',$_SESSION['username']));
+ $imageFileType = strtolower(pathinfo(basename($_FILES["profile_img"]["name"]),PATHINFO_EXTENSION));
+
+ if (move_uploaded_file($_FILES["profile_img"]["tmp_name"], $target_file.'.'.$imageFileType)) {
+ $data['message'] = 'A profilkép sikeresen feltöltve!';
+ $data['message_class'] = 'successMessage';
+ $data['profile_img_url'] = 'assets/img/profiles/'.str_replace('.','_', str_replace('@','_',$_SESSION['username'])).'.'.$imageFileType;
+ $userArray = array(
+ 'profile_img_url' => $data['profile_img_url']
+ );
+ $this->User_model->updateUser($data['currentUser']->user_id, $userArray);
+ $this->Log_model->addLog('profile', 'A felhasználó lecserélte a profilképét ',$_SESSION['username']);
+ } else {
+ $data['message'] = 'Hiba a feltöltés közben!';
+ $data['message_class'] = 'errorMessage';
+ }
+
+ }
+
+ $data['message'] = 'A profil sikeresen módosítva!';
+ $data['message_class'] = 'successMessage';
+ }
+
+
+ $data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
+ $this->load->view('pages/profile', $data);
+
+ }
+ else{
+ header("Location:".SITEURL."login");
+ }
+ }
+
+ public function log_monitor(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Log_model');
+ $this->load->model('Module_model');
+
+ if(isset($_SESSION['username'])){
+ $data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
+ $data['message'] = '';
+ $data['message_class'] = '';
+ $data['pageTitle'] = 'Rendszermonitor';
+ $data['logInfoLink'] = '';
+
+ if($this->User_model->is_user_admin($_SESSION['username'])){
+ $data['activeModules'] = $this->Module_model->getAllModule();
+ }
+ else{
+ $data['activeModules'] = $this->Module_model->getUserModules($data['currentUser']->user_id);
+ }
+
+ $selectedModule = $this->Module_model->getModuleBySlug('log-monitor');
+ if($this->Module_model->is_module_available($selectedModule->module_id, $data['currentUser']->user_id)){
+
+ if(isset($_POST['exportToFile'])){
+ $logInfoArray = $this->Log_model->getAllLoginfo();
+ $logrow = '';
+ $logTxt = fopen(getcwd()."/documents/loginfo.csv", "w") or die("Hiba a fájl mentésekor!");
+ $row = '"Esemény ideje";'.'"Esemény típusa";'.'"Felhasználónév";"Bejegyzés tartalma";'.PHP_EOL;
+ $string_encoded = iconv( mb_detect_encoding( $row ), 'ISO-8859-2', $row );
+ fwrite($logTxt, $string_encoded);
+
+ foreach($logInfoArray as $logInfoItem){
+ $logDateTime = new datetime($logInfoItem->event_datetime);
+ $row = date_format($logDateTime,"Y-m-d H:i").';"'.$logInfoItem->event_type.'";"'.$logInfoItem->username.'";"'.$logInfoItem->event_content.'";'.PHP_EOL;
+ $string_encoded = iconv( mb_detect_encoding( $row ), 'ISO-8859-2', $row );
+ fwrite($logTxt, $string_encoded);
+ }
+ fclose($logTxt);
+ $data['logInfoLink'] = 'A loginfo.csv fájl letöltése ';
+ }
+
+ $this->load->view('log-monitor', $data);
+
+ }
+ else{
+ header("Location:".SITEURL."home");
+ }
+
+
+ }
+ else{
+ header("Location:".SITEURL."login");
+ }
+
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+}
diff --git a/application/controllers/Pages_20240706.php b/application/controllers/Pages_20240706.php
new file mode 100755
index 0000000..733325b
--- /dev/null
+++ b/application/controllers/Pages_20240706.php
@@ -0,0 +1,529 @@
+
+ * @see https://codeigniter.com/userguide3/general/urls.html
+ */
+ public function index(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+
+ $data['pageTitle'] = '';
+ $this->load->view('pages/home', $data);
+ }
+
+ public function barber($lang){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+ $data['pageTitle'] = '';
+ $data['selectedLang'] = $lang;
+
+ $data['services'] = $this->Service_model->getAllServiceByServiceType('barber', $lang);
+ $this->load->view('pages/barber', $data);
+ }
+
+ public function beauty($lang){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+ $data['pageTitle'] = '';
+ $data['selectedLang'] = $lang;
+
+ $data['services'] = $this->Service_model->getAllServiceByServiceType('beauty', $lang);
+ $this->load->view('pages/beauty', $data);
+ }
+
+ public function booking($lang, $subpage){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+
+ $data['pageTitle'] = '';
+ $data['selectedLang'] = $lang;
+ $data['subpage'] = $subpage;
+
+ $data['services'] = $this->Service_model->getAllServiceByServiceType($subpage, $lang);
+ $data['workers'] = $this->Service_model->getActiveWorkers();
+
+ switch($subpage){
+ case 'barber':
+ $this->load->view('pages/barber-booking', $data);
+ break;
+ case 'beauty':
+ $this->load->view('pages/beauty-booking', $data);
+ break;
+ default:
+ header('Location:'.SITEURL);
+ }
+ }
+
+ public function booking_finished($lang, $subpage){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+ $data['pageTitle'] = '';
+ $data['selectedLang'] = $lang;
+
+ switch($subpage){
+ case 'barber':
+ $this->load->view('pages/barber-booking-finished', $data);
+ break;
+ case 'beauty':
+ $this->load->view('pages/beauty-booking-finished', $data);
+ break;
+ default:
+ header('Location:'.SITEURL);
+ }
+ }
+
+ public function email_verification(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+ $this->load->model('Log_model');
+
+ $data['pageTitle'] = '';
+ $this->load->view('pages/email-verification', $data);
+ }
+
+ public function ajax(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+ $this->load->model('Log_model');
+
+ $data['pageTitle'] = '';
+
+ if(isset($_POST['action']) && $_POST['action'] == 'calculate_service_length' && isset($_POST['service_ids'])){
+ if($_POST['service_ids'] != ''){
+ $explodedServiceIds = explode(',', $_POST['service_ids']);
+ $totalLength = '00:00:00';
+ if(!empty($explodedServiceIds)){
+ foreach($explodedServiceIds as $explodedServiceIdItem){
+ $currentService = $this->Service_model->getServiceById($explodedServiceIdItem);
+ $time = $totalLength;
+ $time2 = $currentService->service_time;
+
+ $secs = strtotime($time2)-strtotime("00:00:00");
+ $addedTotal = date("H:i:s",strtotime($time)+$secs);
+ $totalLength = $addedTotal;
+ }
+
+ }
+ echo $totalLength;
+ }
+ }
+
+ if(isset($_POST['action']) && $_POST['action'] == 'getAvailableTimeOptions' && isset($_POST['selectedDate'])){
+ $results = $this->Service_model->getAvailableTimes($_POST['worker_id'], $_POST['selectedDate'], $_POST['servicelength']);
+
+ $rowIndex = 1;
+ if(is_array($results)){
+ foreach($results as $resultIem){
+ ?>
+
+ Service_model->getAvailableTimes($_POST['worker_id'], $_POST['selectedDate'], $_POST['servicelength'].':00');
+
+ $rowIndex = 1;
+ if(!empty($results)){
+ foreach($results as $resultIem){
+ ?>
+
+ Service_model->getWorkerById($_POST['worker_id']);
+
+ if(is_object($result)){
+ ?>
+
+ worker_name;?>
+ User_model->getUserById($_POST['user_id']);
+ $userArray = array(
+ 'is_enabled' => $_POST['newValue']
+ );
+ $this->User_model->updateUser($_POST['user_id'], $userArray);
+ $this->Log_model->addLog('change_user_status', $data['currentUser']->username.' státusza változott - '.($_POST['newValue']?'aktív':'letiltva').' állapotra', $_POST['operator']);
+ }
+
+ if(isset($_POST['action']) && $_POST['action'] == 'checkUser'){
+ echo $this->User_model->isUsernameAvailable($_POST['username']);
+ }
+
+ if(isset($_POST['action']) && $_POST['action'] == 'refreshLogMonitor'){
+ $logInfoArray = $this->Log_model->getAllLoginfo();
+ $logrow = '';
+ foreach($logInfoArray as $logInfoItem){
+ $logDateTime = new datetime($logInfoItem->event_datetime);
+ $logrow .= date_format($logDateTime,"Y-m-d H:i").' '.$logInfoItem->username.' '.$logInfoItem->event_content.'
';
+ }
+ echo $logrow;
+ }
+
+
+
+ $this->load->view('pages/ajax', $data);
+ }
+
+
+ public function booking_process(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+
+ $data['pageTitle'] = '';
+ $data['subpage'] = '';
+
+ if(isset($_POST['sendBooking'])){
+ //calculate finish time
+ $serviceStartTime = date("H:i:s", strtotime($_POST['booking_start_time']));
+ $serviceLengthTime = date("H:i:s", strtotime($_POST['servicelength']));
+ $secs = strtotime($serviceLengthTime)-strtotime("00:00:00");
+ $serviceFinishTime = date("H:i:s",strtotime($serviceStartTime)+$secs);
+
+ $data['services'] = $this->Service_model->getAllServiceByServiceType($_POST['subpage'], $_POST['lang']);
+ $data['workers'] = $this->Service_model->getAllWorkers();
+ $data['selectedLang'] = 'en';
+ $selectedServiceArray = array();
+
+ //find selected services
+ if(is_array($data['services'])){
+ foreach($data['services'] as $serviceItem){
+ if(isset($_POST['service_'.$serviceItem->service_id])){
+ if($_POST['service_'.$serviceItem->service_id]){
+ $selectedServiceArray[] = $serviceItem->service_id;
+ }
+ }
+ }
+ }
+
+ $bookingArray = array(
+ 'guest_name' => $_POST['guest_name'],
+ 'guest_email' => $_POST['guest_email'],
+ 'guest_phone' => $_POST['guest_phone'],
+ 'worker_id' => $_POST['worker_id'],
+ 'booking_date' => $_POST['booking_date'],
+ 'booking_start_time' => $_POST['booking_start_time'],
+ 'booking_finish_time' => $serviceFinishTime,
+ 'service_ids' => serialize($selectedServiceArray),
+ 'guest_confirmed' => '0',
+ 'guest_confirm_code' => '1234',
+ );
+
+ $this->Service_model->createBooking($bookingArray);
+ $worker = $this->Service_model->getWorkerById($bookingArray['worker_id']);
+
+ $services = unserialize($bookingArray['service_ids']);
+ $serviceArray = array();
+ $emailArray = array();
+
+ if(is_array($services)){
+ foreach($services as $serviceItem){
+ $selectedService = $this->Service_model->getServiceById($serviceItem);
+ if(is_object($selectedService)){
+ $serviceArray[] = $selectedService;
+ }
+ }
+ }
+
+ $content = '';
+
+ switch($_POST['lang']){
+ case 'no':
+ $content = 'Kjære gjest, ';
+ $content .= 'Takk for din bestilling! ';
+ $content .= ' ';
+ $content .= '';
+ $content .= 'Navn: '.$bookingArray['guest_name'].' ';
+ $content .= 'E-post: '.$bookingArray['guest_email'].' ';
+ $content .= 'Telefon: '.$bookingArray['guest_phone'].' ';
+ $content .= 'Arbeider: '.$worker->worker_name.' ';
+ $content .= 'Dato: '.$bookingArray['booking_date'].' ';
+ $content .= 'Tid: '.$bookingArray['booking_start_time'].' - '.$bookingArray['booking_finish_time'].' ';
+ $content .= 'Tjenester: ';
+ $totalServicePrice = 0;
+ foreach($serviceArray as $serviceArrayItem){
+ $totalServicePrice += $serviceArrayItem->service_price;
+ $content .= ''.$serviceArrayItem->service_name_no.' '.$serviceArrayItem->service_price.' kr ';
+ }
+ $content .= '
';
+ $content .= 'Totalpris: '.$totalServicePrice.' kr ';
+ $content .= '
';
+ $content .= ' STUDIOBEVE';
+ break;
+ case 'en':
+ $content = 'Dear Guest, ';
+ $content .= 'Thank you for your booking! ';
+ $content .= ' ';
+ $content .= '';
+ $content .= 'Name: '.$bookingArray['guest_name'].' ';
+ $content .= 'Email: '.$bookingArray['guest_email'].' ';
+ $content .= 'Phone: '.$bookingArray['guest_phone'].' ';
+ $content .= 'Worker: '.$worker->worker_name.' ';
+ $content .= 'Date: '.$bookingArray['booking_date'].' ';
+ $content .= 'Time: '.$bookingArray['booking_start_time'].' - '.$bookingArray['booking_finish_time'].' ';
+ $content .= 'Services: ';
+ $totalServicePrice = 0;
+ foreach($serviceArray as $serviceArrayItem){
+ $totalServicePrice += $serviceArrayItem->service_price;
+ $content .= ''.$serviceArrayItem->service_name_en.' '.$serviceArrayItem->service_price.' kr ';
+ }
+ $content .= '
';
+ $content .= 'Total price: '.$totalServicePrice.' kr ';
+ $content .= '
';
+ $content .= ' STUDIOBEVE';
+ break;
+ case 'hu':
+ $content = 'Kedves Vendégünk, ';
+ $content .= 'Köszönettel fogadtuk a foglalását! ';
+ $content .= ' ';
+ $content .= '';
+ $content .= 'Név: '.$bookingArray['guest_name'].' ';
+ $content .= 'Email: '.$bookingArray['guest_email'].' ';
+ $content .= 'Telefon: '.$bookingArray['guest_phone'].' ';
+ $content .= 'Dolgozó: '.$worker->worker_name.' ';
+ $content .= 'Dátum: '.$bookingArray['booking_date'].' ';
+ $content .= 'Időpont: '.$bookingArray['booking_start_time'].' - '.$bookingArray['booking_finish_time'].' ';
+ $content .= 'Szolgáltatás(ok): ';
+ $totalServicePrice = 0;
+ foreach($serviceArray as $serviceArrayItem){
+ $totalServicePrice += $serviceArrayItem->service_price;
+ $content .= ''.$serviceArrayItem->service_name_hu.' '.$serviceArrayItem->service_price.' kr ';
+ }
+ $content .= '
';
+ $content .= 'Összesen fizetendő: '.$totalServicePrice.' kr ';
+ $content .= '
';
+ $content .= ' STUDIOBEVE';
+ break;
+ }
+
+ $data['selectedLang'] = $_POST['lang'];
+
+ $emailItem = array(
+ 'addressee_email' => $bookingArray['guest_email'],
+ 'addressee_name' => $bookingArray['guest_name'],
+ 'subject' => '[studiobeve] Your booking has arrived',
+ 'content' => $content,
+ 'attachments' => array()
+ );
+ $emailArray[] = $emailItem;
+ header('Location:'.SITEURL.$_POST['lang'].'/booking-finished/'.$_POST['subpage']);
+ }
+
+ $this->User_model->sendEmail($emailArray, $_POST['lang'], $_POST['subpage']);
+ $this->load->view('pages/booking-process', $data);
+ }
+
+ public function profile(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Log_model');
+ $this->load->model('Module_model');
+ $data['message'] = '';
+ $data['message_class'] = '';
+ $data['fullname'] = '';
+ $data['password'] = '';
+ $data['profile_img_url'] = '';
+
+ if(isset($_SESSION['username'])){
+ $data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
+
+ $data['message'] = '';
+ $data['message_class'] = '';
+ $data['pageTitle'] = 'Profil szerkesztése';
+
+ if($this->User_model->is_user_admin($_SESSION['username'])){
+ $data['activeModules'] = $this->Module_model->getAllModule();
+ }
+ else{
+ $data['activeModules'] = $this->Module_model->getUserModules($data['currentUser']->user_id);
+ }
+
+ if(isset($_POST["storeProfile"])) {
+
+ if($_POST['fullname'] != $data['currentUser']->fullname){
+ $userArray = array(
+ 'fullname' => $_POST['fullname']
+ );
+ $this->User_model->updateUser($data['currentUser']->user_id, $userArray);
+ $this->Log_model->addLog('profile', 'A felhasználó módosította a teljes nevét: '.$data['currentUser']->fullname.' => '.$_POST['fullname'],$_SESSION['username']);
+ }
+
+ if($_POST['password'] != ''){
+ $userArray = array(
+ 'password' => hash('sha256', $_POST['password'])
+ );
+ $this->User_model->updateUser($data['currentUser']->user_id, $userArray);
+ $this->Log_model->addLog('profile', 'A felhasználó módosította a jelszavát',$_SESSION['username']);
+ }
+
+
+ //upload profile image
+ if($_FILES["profile_img"]["tmp_name"] != ''){
+ $target_dir = getcwd()."/assets/img/profiles/";
+ $target_file = $target_dir . str_replace('.','_', str_replace('@','_',$_SESSION['username']));
+ $imageFileType = strtolower(pathinfo(basename($_FILES["profile_img"]["name"]),PATHINFO_EXTENSION));
+
+ if (move_uploaded_file($_FILES["profile_img"]["tmp_name"], $target_file.'.'.$imageFileType)) {
+ $data['message'] = 'A profilkép sikeresen feltöltve!';
+ $data['message_class'] = 'successMessage';
+ $data['profile_img_url'] = 'assets/img/profiles/'.str_replace('.','_', str_replace('@','_',$_SESSION['username'])).'.'.$imageFileType;
+ $userArray = array(
+ 'profile_img_url' => $data['profile_img_url']
+ );
+ $this->User_model->updateUser($data['currentUser']->user_id, $userArray);
+ $this->Log_model->addLog('profile', 'A felhasználó lecserélte a profilképét ',$_SESSION['username']);
+ } else {
+ $data['message'] = 'Hiba a feltöltés közben!';
+ $data['message_class'] = 'errorMessage';
+ }
+
+ }
+
+ $data['message'] = 'A profil sikeresen módosítva!';
+ $data['message_class'] = 'successMessage';
+ }
+
+
+ $data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
+ $this->load->view('pages/profile', $data);
+
+ }
+ else{
+ header("Location:".SITEURL."login");
+ }
+ }
+
+ public function log_monitor(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Log_model');
+ $this->load->model('Module_model');
+
+ if(isset($_SESSION['username'])){
+ $data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
+ $data['message'] = '';
+ $data['message_class'] = '';
+ $data['pageTitle'] = 'Rendszermonitor';
+ $data['logInfoLink'] = '';
+
+ if($this->User_model->is_user_admin($_SESSION['username'])){
+ $data['activeModules'] = $this->Module_model->getAllModule();
+ }
+ else{
+ $data['activeModules'] = $this->Module_model->getUserModules($data['currentUser']->user_id);
+ }
+
+ $selectedModule = $this->Module_model->getModuleBySlug('log-monitor');
+ if($this->Module_model->is_module_available($selectedModule->module_id, $data['currentUser']->user_id)){
+
+ if(isset($_POST['exportToFile'])){
+ $logInfoArray = $this->Log_model->getAllLoginfo();
+ $logrow = '';
+ $logTxt = fopen(getcwd()."/documents/loginfo.csv", "w") or die("Hiba a fájl mentésekor!");
+ $row = '"Esemény ideje";'.'"Esemény típusa";'.'"Felhasználónév";"Bejegyzés tartalma";'.PHP_EOL;
+ $string_encoded = iconv( mb_detect_encoding( $row ), 'ISO-8859-2', $row );
+ fwrite($logTxt, $string_encoded);
+
+ foreach($logInfoArray as $logInfoItem){
+ $logDateTime = new datetime($logInfoItem->event_datetime);
+ $row = date_format($logDateTime,"Y-m-d H:i").';"'.$logInfoItem->event_type.'";"'.$logInfoItem->username.'";"'.$logInfoItem->event_content.'";'.PHP_EOL;
+ $string_encoded = iconv( mb_detect_encoding( $row ), 'ISO-8859-2', $row );
+ fwrite($logTxt, $string_encoded);
+ }
+ fclose($logTxt);
+ $data['logInfoLink'] = 'A loginfo.csv fájl letöltése ';
+ }
+
+ $this->load->view('log-monitor', $data);
+
+ }
+ else{
+ header("Location:".SITEURL."home");
+ }
+
+
+ }
+ else{
+ header("Location:".SITEURL."login");
+ }
+
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+}
diff --git a/application/controllers/Pages_20250312.php b/application/controllers/Pages_20250312.php
new file mode 100755
index 0000000..27aa31f
--- /dev/null
+++ b/application/controllers/Pages_20250312.php
@@ -0,0 +1,547 @@
+
+ * @see https://codeigniter.com/userguide3/general/urls.html
+ */
+ public function index(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+
+ $data['pageTitle'] = '';
+ $this->load->view('pages/home', $data);
+ }
+
+ public function barber($lang){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+ $data['pageTitle'] = '';
+ $data['selectedLang'] = $lang;
+
+ $data['services'] = $this->Service_model->getAllServiceByServiceType('barber', $lang);
+ $this->load->view('pages/barber', $data);
+ }
+
+ public function beauty($lang){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+ $data['pageTitle'] = '';
+ $data['selectedLang'] = $lang;
+
+ $data['services'] = $this->Service_model->getAllServiceByServiceType('beauty', $lang);
+ $this->load->view('pages/beauty', $data);
+ }
+
+ public function booking($lang, $subpage){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+
+ $data['pageTitle'] = '';
+ $data['selectedLang'] = $lang;
+ $data['subpage'] = $subpage;
+
+ $data['services'] = $this->Service_model->getAllServiceByServiceType($subpage, $lang);
+ $data['workers'] = $this->Service_model->getActiveWorkers();
+
+ switch($subpage){
+ case 'barber':
+ $this->load->view('pages/barber-booking', $data);
+ break;
+ case 'beauty':
+ $this->load->view('pages/beauty-booking', $data);
+ break;
+ default:
+ header('Location:'.SITEURL);
+ }
+ }
+
+ public function booking_finished($lang, $subpage){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+ $data['pageTitle'] = '';
+ $data['selectedLang'] = $lang;
+
+ switch($subpage){
+ case 'barber':
+ $this->load->view('pages/barber-booking-finished', $data);
+ break;
+ case 'beauty':
+ $this->load->view('pages/beauty-booking-finished', $data);
+ break;
+ default:
+ header('Location:'.SITEURL);
+ }
+ }
+
+ public function email_verification(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+ $this->load->model('Log_model');
+
+ $data['pageTitle'] = '';
+ $this->load->view('pages/email-verification', $data);
+ }
+
+ public function ajax(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+ $this->load->model('Log_model');
+
+ $data['pageTitle'] = '';
+
+ if(isset($_POST['action']) && $_POST['action'] == 'calculate_service_length' && isset($_POST['service_ids'])){
+ if($_POST['service_ids'] != ''){
+ $explodedServiceIds = explode(',', $_POST['service_ids']);
+ $totalLength = '00:00:00';
+ if(!empty($explodedServiceIds)){
+ foreach($explodedServiceIds as $explodedServiceIdItem){
+ $currentService = $this->Service_model->getServiceById($explodedServiceIdItem);
+ $time = $totalLength;
+ $time2 = $currentService->service_time;
+
+ $secs = strtotime($time2)-strtotime("00:00:00");
+ $addedTotal = date("H:i:s",strtotime($time)+$secs);
+ $totalLength = $addedTotal;
+ }
+
+ }
+ echo $totalLength;
+ }
+ }
+
+ if(isset($_POST['action']) && $_POST['action'] == 'getAvailableTimeOptions' && isset($_POST['selectedDate'])){
+ $results = $this->Service_model->getAvailableTimes($_POST['worker_id'], $_POST['selectedDate'], $_POST['servicelength']);
+
+ $rowIndex = 1;
+ if(is_array($results)){
+ foreach($results as $resultIem){
+ ?>
+
+ Service_model->getAvailableTimes($_POST['worker_id'], $_POST['selectedDate'], $_POST['servicelength']);
+
+ $timeIsAvailable = 0;
+ if(is_array($results)){
+ foreach($results as $resultIem){
+ if(date('H:i:s', strtotime($resultIem)) == $_POST['selectedTime']){
+ $timeIsAvailable = 1;
+ }
+ }
+
+ echo $timeIsAvailable;
+ }
+ else{
+ echo 0;
+ }
+ }
+
+ if(isset($_POST['action']) && $_POST['action'] == 'getAvailableTimes' && isset($_POST['selectedDate'])){
+ $results = $this->Service_model->getAvailableTimes($_POST['worker_id'], $_POST['selectedDate'], $_POST['servicelength'].':00');
+
+ $rowIndex = 1;
+ if(!empty($results)){
+ foreach($results as $resultIem){
+ ?>
+
+ Service_model->getWorkerById($_POST['worker_id']);
+
+ if(is_object($result)){
+ ?>
+
+ worker_name;?>
+ User_model->getUserById($_POST['user_id']);
+ $userArray = array(
+ 'is_enabled' => $_POST['newValue']
+ );
+ $this->User_model->updateUser($_POST['user_id'], $userArray);
+ $this->Log_model->addLog('change_user_status', $data['currentUser']->username.' státusza változott - '.($_POST['newValue']?'aktív':'letiltva').' állapotra', $_POST['operator']);
+ }
+
+ if(isset($_POST['action']) && $_POST['action'] == 'checkUser'){
+ echo $this->User_model->isUsernameAvailable($_POST['username']);
+ }
+
+ if(isset($_POST['action']) && $_POST['action'] == 'refreshLogMonitor'){
+ $logInfoArray = $this->Log_model->getAllLoginfo();
+ $logrow = '';
+ foreach($logInfoArray as $logInfoItem){
+ $logDateTime = new datetime($logInfoItem->event_datetime);
+ $logrow .= date_format($logDateTime,"Y-m-d H:i").' '.$logInfoItem->username.' '.$logInfoItem->event_content.'
';
+ }
+ echo $logrow;
+ }
+
+
+
+ $this->load->view('pages/ajax', $data);
+ }
+
+
+ public function booking_process(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+
+ $data['pageTitle'] = '';
+ $data['subpage'] = '';
+
+ if(isset($_POST['sendBooking'])){
+ //calculate finish time
+ $serviceStartTime = date("H:i:s", strtotime($_POST['booking_start_time']));
+ $serviceLengthTime = date("H:i:s", strtotime($_POST['servicelength']));
+ $secs = strtotime($serviceLengthTime)-strtotime("00:00:00");
+ $serviceFinishTime = date("H:i:s",strtotime($serviceStartTime)+$secs);
+
+ $data['services'] = $this->Service_model->getAllServiceByServiceType($_POST['subpage'], $_POST['lang']);
+ $data['workers'] = $this->Service_model->getAllWorkers();
+ $data['selectedLang'] = 'en';
+ $selectedServiceArray = array();
+
+ //find selected services
+ if(is_array($data['services'])){
+ foreach($data['services'] as $serviceItem){
+ if(isset($_POST['service_'.$serviceItem->service_id])){
+ if($_POST['service_'.$serviceItem->service_id]){
+ $selectedServiceArray[] = $serviceItem->service_id;
+ }
+ }
+ }
+ }
+
+ $bookingArray = array(
+ 'guest_name' => $_POST['guest_name'],
+ 'guest_email' => $_POST['guest_email'],
+ 'guest_phone' => $_POST['guest_phone'],
+ 'worker_id' => $_POST['worker_id'],
+ 'booking_date' => $_POST['booking_date'],
+ 'booking_start_time' => $_POST['booking_start_time'],
+ 'booking_finish_time' => $serviceFinishTime,
+ 'service_ids' => serialize($selectedServiceArray),
+ 'guest_confirmed' => '0',
+ 'guest_confirm_code' => '1234',
+ );
+
+ $this->Service_model->createBooking($bookingArray);
+ $worker = $this->Service_model->getWorkerById($bookingArray['worker_id']);
+
+ $services = unserialize($bookingArray['service_ids']);
+ $serviceArray = array();
+ $emailArray = array();
+
+ if(is_array($services)){
+ foreach($services as $serviceItem){
+ $selectedService = $this->Service_model->getServiceById($serviceItem);
+ if(is_object($selectedService)){
+ $serviceArray[] = $selectedService;
+ }
+ }
+ }
+
+ $content = '';
+
+ switch($_POST['lang']){
+ case 'no':
+ $content = 'Kjære gjest, ';
+ $content .= 'Takk for din bestilling! ';
+ $content .= ' ';
+ $content .= '';
+ $content .= 'Navn: '.$bookingArray['guest_name'].' ';
+ $content .= 'E-post: '.$bookingArray['guest_email'].' ';
+ $content .= 'Telefon: '.$bookingArray['guest_phone'].' ';
+ $content .= 'Arbeider: '.$worker->worker_name.' ';
+ $content .= 'Dato: '.$bookingArray['booking_date'].' ';
+ $content .= 'Tid: '.$bookingArray['booking_start_time'].' - '.$bookingArray['booking_finish_time'].' ';
+ $content .= 'Tjenester: ';
+ $totalServicePrice = 0;
+ foreach($serviceArray as $serviceArrayItem){
+ $totalServicePrice += $serviceArrayItem->service_price;
+ $content .= ''.$serviceArrayItem->service_name_no.' '.$serviceArrayItem->service_price.' kr ';
+ }
+ $content .= '
';
+ $content .= 'Totalpris: '.$totalServicePrice.' kr ';
+ $content .= '
';
+ $content .= ' STUDIOBEVE';
+ break;
+ case 'en':
+ $content = 'Dear Guest, ';
+ $content .= 'Thank you for your booking! ';
+ $content .= ' ';
+ $content .= '';
+ $content .= 'Name: '.$bookingArray['guest_name'].' ';
+ $content .= 'Email: '.$bookingArray['guest_email'].' ';
+ $content .= 'Phone: '.$bookingArray['guest_phone'].' ';
+ $content .= 'Worker: '.$worker->worker_name.' ';
+ $content .= 'Date: '.$bookingArray['booking_date'].' ';
+ $content .= 'Time: '.$bookingArray['booking_start_time'].' - '.$bookingArray['booking_finish_time'].' ';
+ $content .= 'Services: ';
+ $totalServicePrice = 0;
+ foreach($serviceArray as $serviceArrayItem){
+ $totalServicePrice += $serviceArrayItem->service_price;
+ $content .= ''.$serviceArrayItem->service_name_en.' '.$serviceArrayItem->service_price.' kr ';
+ }
+ $content .= '
';
+ $content .= 'Total price: '.$totalServicePrice.' kr ';
+ $content .= '
';
+ $content .= ' STUDIOBEVE';
+ break;
+ case 'hu':
+ $content = 'Kedves Vendégünk, ';
+ $content .= 'Köszönettel fogadtuk a foglalását! ';
+ $content .= ' ';
+ $content .= '';
+ $content .= 'Név: '.$bookingArray['guest_name'].' ';
+ $content .= 'Email: '.$bookingArray['guest_email'].' ';
+ $content .= 'Telefon: '.$bookingArray['guest_phone'].' ';
+ $content .= 'Dolgozó: '.$worker->worker_name.' ';
+ $content .= 'Dátum: '.$bookingArray['booking_date'].' ';
+ $content .= 'Időpont: '.$bookingArray['booking_start_time'].' - '.$bookingArray['booking_finish_time'].' ';
+ $content .= 'Szolgáltatás(ok): ';
+ $totalServicePrice = 0;
+ foreach($serviceArray as $serviceArrayItem){
+ $totalServicePrice += $serviceArrayItem->service_price;
+ $content .= ''.$serviceArrayItem->service_name_hu.' '.$serviceArrayItem->service_price.' kr ';
+ }
+ $content .= '
';
+ $content .= 'Összesen fizetendő: '.$totalServicePrice.' kr ';
+ $content .= '
';
+ $content .= ' STUDIOBEVE';
+ break;
+ }
+
+ $data['selectedLang'] = $_POST['lang'];
+
+ $emailItem = array(
+ 'addressee_email' => $bookingArray['guest_email'],
+ 'addressee_name' => $bookingArray['guest_name'],
+ 'subject' => '[studiobeve] Your booking has arrived',
+ 'content' => $content,
+ 'attachments' => array()
+ );
+ $emailArray[] = $emailItem;
+ header('Location:'.SITEURL.$_POST['lang'].'/booking-finished/'.$_POST['subpage']);
+ }
+
+ $this->User_model->sendEmail($emailArray, $_POST['lang'], $_POST['subpage']);
+ $this->load->view('pages/booking-process', $data);
+ }
+
+ public function profile(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Log_model');
+ $this->load->model('Module_model');
+ $data['message'] = '';
+ $data['message_class'] = '';
+ $data['fullname'] = '';
+ $data['password'] = '';
+ $data['profile_img_url'] = '';
+
+ if(isset($_SESSION['username'])){
+ $data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
+
+ $data['message'] = '';
+ $data['message_class'] = '';
+ $data['pageTitle'] = 'Profil szerkesztése';
+
+ if($this->User_model->is_user_admin($_SESSION['username'])){
+ $data['activeModules'] = $this->Module_model->getAllModule();
+ }
+ else{
+ $data['activeModules'] = $this->Module_model->getUserModules($data['currentUser']->user_id);
+ }
+
+ if(isset($_POST["storeProfile"])) {
+
+ if($_POST['fullname'] != $data['currentUser']->fullname){
+ $userArray = array(
+ 'fullname' => $_POST['fullname']
+ );
+ $this->User_model->updateUser($data['currentUser']->user_id, $userArray);
+ $this->Log_model->addLog('profile', 'A felhasználó módosította a teljes nevét: '.$data['currentUser']->fullname.' => '.$_POST['fullname'],$_SESSION['username']);
+ }
+
+ if($_POST['password'] != ''){
+ $userArray = array(
+ 'password' => hash('sha256', $_POST['password'])
+ );
+ $this->User_model->updateUser($data['currentUser']->user_id, $userArray);
+ $this->Log_model->addLog('profile', 'A felhasználó módosította a jelszavát',$_SESSION['username']);
+ }
+
+
+ //upload profile image
+ if($_FILES["profile_img"]["tmp_name"] != ''){
+ $target_dir = getcwd()."/assets/img/profiles/";
+ $target_file = $target_dir . str_replace('.','_', str_replace('@','_',$_SESSION['username']));
+ $imageFileType = strtolower(pathinfo(basename($_FILES["profile_img"]["name"]),PATHINFO_EXTENSION));
+
+ if (move_uploaded_file($_FILES["profile_img"]["tmp_name"], $target_file.'.'.$imageFileType)) {
+ $data['message'] = 'A profilkép sikeresen feltöltve!';
+ $data['message_class'] = 'successMessage';
+ $data['profile_img_url'] = 'assets/img/profiles/'.str_replace('.','_', str_replace('@','_',$_SESSION['username'])).'.'.$imageFileType;
+ $userArray = array(
+ 'profile_img_url' => $data['profile_img_url']
+ );
+ $this->User_model->updateUser($data['currentUser']->user_id, $userArray);
+ $this->Log_model->addLog('profile', 'A felhasználó lecserélte a profilképét ',$_SESSION['username']);
+ } else {
+ $data['message'] = 'Hiba a feltöltés közben!';
+ $data['message_class'] = 'errorMessage';
+ }
+
+ }
+
+ $data['message'] = 'A profil sikeresen módosítva!';
+ $data['message_class'] = 'successMessage';
+ }
+
+
+ $data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
+ $this->load->view('pages/profile', $data);
+
+ }
+ else{
+ header("Location:".SITEURL."login");
+ }
+ }
+
+ public function log_monitor(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Log_model');
+ $this->load->model('Module_model');
+
+ if(isset($_SESSION['username'])){
+ $data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
+ $data['message'] = '';
+ $data['message_class'] = '';
+ $data['pageTitle'] = 'Rendszermonitor';
+ $data['logInfoLink'] = '';
+
+ if($this->User_model->is_user_admin($_SESSION['username'])){
+ $data['activeModules'] = $this->Module_model->getAllModule();
+ }
+ else{
+ $data['activeModules'] = $this->Module_model->getUserModules($data['currentUser']->user_id);
+ }
+
+ $selectedModule = $this->Module_model->getModuleBySlug('log-monitor');
+ if($this->Module_model->is_module_available($selectedModule->module_id, $data['currentUser']->user_id)){
+
+ if(isset($_POST['exportToFile'])){
+ $logInfoArray = $this->Log_model->getAllLoginfo();
+ $logrow = '';
+ $logTxt = fopen(getcwd()."/documents/loginfo.csv", "w") or die("Hiba a fájl mentésekor!");
+ $row = '"Esemény ideje";'.'"Esemény típusa";'.'"Felhasználónév";"Bejegyzés tartalma";'.PHP_EOL;
+ $string_encoded = iconv( mb_detect_encoding( $row ), 'ISO-8859-2', $row );
+ fwrite($logTxt, $string_encoded);
+
+ foreach($logInfoArray as $logInfoItem){
+ $logDateTime = new datetime($logInfoItem->event_datetime);
+ $row = date_format($logDateTime,"Y-m-d H:i").';"'.$logInfoItem->event_type.'";"'.$logInfoItem->username.'";"'.$logInfoItem->event_content.'";'.PHP_EOL;
+ $string_encoded = iconv( mb_detect_encoding( $row ), 'ISO-8859-2', $row );
+ fwrite($logTxt, $string_encoded);
+ }
+ fclose($logTxt);
+ $data['logInfoLink'] = 'A loginfo.csv fájl letöltése ';
+ }
+
+ $this->load->view('log-monitor', $data);
+
+ }
+ else{
+ header("Location:".SITEURL."home");
+ }
+
+
+ }
+ else{
+ header("Location:".SITEURL."login");
+ }
+
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+}
diff --git a/application/controllers/Pages_20250523.php b/application/controllers/Pages_20250523.php
new file mode 100755
index 0000000..eae23de
--- /dev/null
+++ b/application/controllers/Pages_20250523.php
@@ -0,0 +1,591 @@
+
+ * @see https://codeigniter.com/userguide3/general/urls.html
+ */
+ public function index(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+
+ $data['pageTitle'] = '';
+ $this->load->view('pages/home', $data);
+ }
+
+ public function barber($lang){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+ $data['pageTitle'] = '';
+ $data['selectedLang'] = $lang;
+
+ $data['services'] = $this->Service_model->getAllServiceByServiceType('barber', $lang);
+ $this->load->view('pages/barber', $data);
+ }
+
+ public function beauty($lang){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+ $data['pageTitle'] = '';
+ $data['selectedLang'] = $lang;
+
+ $data['services'] = $this->Service_model->getAllServiceByServiceType('beauty', $lang);
+ $this->load->view('pages/beauty', $data);
+ }
+
+ public function booking($lang, $subpage){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+
+ $data['pageTitle'] = '';
+ $data['selectedLang'] = $lang;
+ $data['subpage'] = $subpage;
+
+ $data['services'] = $this->Service_model->getAllServiceByServiceType($subpage, $lang);
+ $data['workers'] = $this->Service_model->getActiveWorkers($subpage);
+
+ switch($subpage){
+ case 'barber':
+ $this->load->view('pages/barber-booking', $data);
+ break;
+ case 'beauty':
+ $this->load->view('pages/beauty-booking', $data);
+ break;
+ default:
+ header('Location:'.SITEURL);
+ }
+ }
+
+ public function booking_finished($lang, $subpage){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+ $data['pageTitle'] = '';
+ $data['selectedLang'] = $lang;
+
+ switch($subpage){
+ case 'barber':
+ $this->load->view('pages/barber-booking-finished', $data);
+ break;
+ case 'beauty':
+ $this->load->view('pages/beauty-booking-finished', $data);
+ break;
+ default:
+ header('Location:'.SITEURL);
+ }
+ }
+
+ public function email_verification(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+ $this->load->model('Log_model');
+
+ $data['pageTitle'] = '';
+ $this->load->view('pages/email-verification', $data);
+ }
+
+ public function ajax(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+ $this->load->model('Log_model');
+
+ $data['pageTitle'] = '';
+
+ if(isset($_POST['action']) && $_POST['action'] == 'getAvailableWorkersByServiceCategory' && isset($_POST['serv_cat_slug'])){
+ $workers = $this->Service_model->getWorkersByCategorySlug($_POST['serv_cat_slug']);
+ $returnedWorkers = '';
+ $workerIndex = 0;
+ $workerListShow = '';
+
+ if(is_array($workers)){
+ foreach($workers as $workerItem){
+ $workerListShow .= '';
+ $workerListShow .= '';
+ $workerListShow .= '
';
+ $workerListShow .= '
';
+ $workerListShow .= '
';
+ $workerListShow .= '
'.$workerItem->worker_name.'
';
+ $workerListShow .= '
'.$workerItem->worker_info.'
';
+ $workerListShow .= '
';
+ $workerListShow .= '
';
+ $workerListShow .= ' ';
+ /*
+ ?>
+
+
+
>
+
+
+
worker_name;?>
+
worker_info;?>
+
+
+
+ $workers,
+ 'workerListShow' => $workerListShow
+ );
+
+ echo json_encode($responseArray);
+ }
+
+ if(isset($_POST['action']) && $_POST['action'] == 'calculate_service_length' && isset($_POST['service_ids'])){
+ if($_POST['service_ids'] != ''){
+ $explodedServiceIds = explode(',', $_POST['service_ids']);
+ $totalLength = '00:00:00';
+ if(!empty($explodedServiceIds)){
+ foreach($explodedServiceIds as $explodedServiceIdItem){
+ $currentService = $this->Service_model->getServiceById($explodedServiceIdItem);
+ $time = $totalLength;
+ $time2 = $currentService->service_time;
+
+ $secs = strtotime($time2)-strtotime("00:00:00");
+ $addedTotal = date("H:i:s",strtotime($time)+$secs);
+ $totalLength = $addedTotal;
+ }
+
+ }
+ echo $totalLength;
+ }
+ }
+
+ if(isset($_POST['action']) && $_POST['action'] == 'getAvailableTimeOptions' && isset($_POST['selectedDate'])){
+ $results = $this->Service_model->getAvailableTimes($_POST['worker_id'], $_POST['selectedDate'], $_POST['servicelength']);
+
+ $rowIndex = 1;
+ if(is_array($results)){
+ foreach($results as $resultIem){
+ ?>
+
+ Service_model->getAvailableTimes($_POST['worker_id'], $_POST['selectedDate'], $_POST['servicelength']);
+
+ $timeIsAvailable = 0;
+ if(is_array($results)){
+ foreach($results as $resultIem){
+ if(date('H:i:s', strtotime($resultIem)) == $_POST['selectedTime']){
+ $timeIsAvailable = 1;
+ }
+ }
+
+ echo $timeIsAvailable;
+ }
+ else{
+ echo 0;
+ }
+ }
+
+ if(isset($_POST['action']) && $_POST['action'] == 'getAvailableTimes' && isset($_POST['selectedDate'])){
+ $results = $this->Service_model->getAvailableTimes($_POST['worker_id'], $_POST['selectedDate'], $_POST['servicelength'].':00');
+
+ $rowIndex = 1;
+ if(!empty($results)){
+ foreach($results as $resultIem){
+ ?>
+
+ Service_model->getWorkerById($_POST['worker_id']);
+
+ if(is_object($result)){
+ ?>
+
+ worker_name;?>
+ User_model->getUserById($_POST['user_id']);
+ $userArray = array(
+ 'is_enabled' => $_POST['newValue']
+ );
+ $this->User_model->updateUser($_POST['user_id'], $userArray);
+ $this->Log_model->addLog('change_user_status', $data['currentUser']->username.' státusza változott - '.($_POST['newValue']?'aktív':'letiltva').' állapotra', $_POST['operator']);
+ }
+
+ if(isset($_POST['action']) && $_POST['action'] == 'checkUser'){
+ echo $this->User_model->isUsernameAvailable($_POST['username']);
+ }
+
+ if(isset($_POST['action']) && $_POST['action'] == 'refreshLogMonitor'){
+ $logInfoArray = $this->Log_model->getAllLoginfo();
+ $logrow = '';
+ foreach($logInfoArray as $logInfoItem){
+ $logDateTime = new datetime($logInfoItem->event_datetime);
+ $logrow .= date_format($logDateTime,"Y-m-d H:i").' '.$logInfoItem->username.' '.$logInfoItem->event_content.'
';
+ }
+ echo $logrow;
+ }
+
+
+
+ $this->load->view('pages/ajax', $data);
+ }
+
+
+ public function booking_process(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+
+ $data['pageTitle'] = '';
+ $data['subpage'] = '';
+
+ if(isset($_POST['sendBooking'])){
+ //calculate finish time
+ $serviceStartTime = date("H:i:s", strtotime($_POST['booking_start_time']));
+ $serviceLengthTime = date("H:i:s", strtotime($_POST['servicelength']));
+ $secs = strtotime($serviceLengthTime)-strtotime("00:00:00");
+ $serviceFinishTime = date("H:i:s",strtotime($serviceStartTime)+$secs);
+
+ $data['services'] = $this->Service_model->getAllServiceByServiceType($_POST['subpage'], $_POST['lang']);
+ $data['workers'] = $this->Service_model->getAllWorkers();
+ $data['selectedLang'] = 'en';
+ $selectedServiceArray = array();
+
+ //find selected services
+ if(is_array($data['services'])){
+ foreach($data['services'] as $serviceItem){
+ if(isset($_POST['service_'.$serviceItem->service_id])){
+ if($_POST['service_'.$serviceItem->service_id]){
+ $selectedServiceArray[] = $serviceItem->service_id;
+ }
+ }
+ }
+ }
+
+ $bookingArray = array(
+ 'guest_name' => $_POST['guest_name'],
+ 'guest_email' => $_POST['guest_email'],
+ 'guest_phone' => $_POST['guest_phone'],
+ 'worker_id' => $_POST['worker_id'],
+ 'booking_date' => $_POST['booking_date'],
+ 'booking_start_time' => $_POST['booking_start_time'],
+ 'booking_finish_time' => $serviceFinishTime,
+ 'service_ids' => serialize($selectedServiceArray),
+ 'guest_confirmed' => '0',
+ 'guest_confirm_code' => '1234',
+ );
+
+ $this->Service_model->createBooking($bookingArray);
+ $worker = $this->Service_model->getWorkerById($bookingArray['worker_id']);
+
+ $services = unserialize($bookingArray['service_ids']);
+ $serviceArray = array();
+ $emailArray = array();
+
+ if(is_array($services)){
+ foreach($services as $serviceItem){
+ $selectedService = $this->Service_model->getServiceById($serviceItem);
+ if(is_object($selectedService)){
+ $serviceArray[] = $selectedService;
+ }
+ }
+ }
+
+ $content = '';
+
+ switch($_POST['lang']){
+ case 'no':
+ $content = 'Kjære gjest, ';
+ $content .= 'Takk for din bestilling! ';
+ $content .= ' ';
+ $content .= '';
+ $content .= 'Navn: '.$bookingArray['guest_name'].' ';
+ $content .= 'E-post: '.$bookingArray['guest_email'].' ';
+ $content .= 'Telefon: '.$bookingArray['guest_phone'].' ';
+ $content .= 'Arbeider: '.$worker->worker_name.' ';
+ $content .= 'Dato: '.$bookingArray['booking_date'].' ';
+ $content .= 'Tid: '.$bookingArray['booking_start_time'].' - '.$bookingArray['booking_finish_time'].' ';
+ $content .= 'Tjenester: ';
+ $totalServicePrice = 0;
+ foreach($serviceArray as $serviceArrayItem){
+ $totalServicePrice += $serviceArrayItem->service_price;
+ $content .= ''.$serviceArrayItem->service_name_no.' '.$serviceArrayItem->service_price.' kr ';
+ }
+ $content .= '
';
+ $content .= 'Totalpris: '.$totalServicePrice.' kr ';
+ $content .= '
';
+ $content .= ' STUDIOBEVE';
+ break;
+ case 'en':
+ $content = 'Dear Guest, ';
+ $content .= 'Thank you for your booking! ';
+ $content .= ' ';
+ $content .= '';
+ $content .= 'Name: '.$bookingArray['guest_name'].' ';
+ $content .= 'Email: '.$bookingArray['guest_email'].' ';
+ $content .= 'Phone: '.$bookingArray['guest_phone'].' ';
+ $content .= 'Worker: '.$worker->worker_name.' ';
+ $content .= 'Date: '.$bookingArray['booking_date'].' ';
+ $content .= 'Time: '.$bookingArray['booking_start_time'].' - '.$bookingArray['booking_finish_time'].' ';
+ $content .= 'Services: ';
+ $totalServicePrice = 0;
+ foreach($serviceArray as $serviceArrayItem){
+ $totalServicePrice += $serviceArrayItem->service_price;
+ $content .= ''.$serviceArrayItem->service_name_en.' '.$serviceArrayItem->service_price.' kr ';
+ }
+ $content .= '
';
+ $content .= 'Total price: '.$totalServicePrice.' kr ';
+ $content .= '
';
+ $content .= ' STUDIOBEVE';
+ break;
+ case 'hu':
+ $content = 'Kedves Vendégünk, ';
+ $content .= 'Köszönettel fogadtuk a foglalását! ';
+ $content .= ' ';
+ $content .= '';
+ $content .= 'Név: '.$bookingArray['guest_name'].' ';
+ $content .= 'Email: '.$bookingArray['guest_email'].' ';
+ $content .= 'Telefon: '.$bookingArray['guest_phone'].' ';
+ $content .= 'Dolgozó: '.$worker->worker_name.' ';
+ $content .= 'Dátum: '.$bookingArray['booking_date'].' ';
+ $content .= 'Időpont: '.$bookingArray['booking_start_time'].' - '.$bookingArray['booking_finish_time'].' ';
+ $content .= 'Szolgáltatás(ok): ';
+ $totalServicePrice = 0;
+ foreach($serviceArray as $serviceArrayItem){
+ $totalServicePrice += $serviceArrayItem->service_price;
+ $content .= ''.$serviceArrayItem->service_name_hu.' '.$serviceArrayItem->service_price.' kr ';
+ }
+ $content .= '
';
+ $content .= 'Összesen fizetendő: '.$totalServicePrice.' kr ';
+ $content .= '
';
+ $content .= ' STUDIOBEVE';
+ break;
+ }
+
+ $data['selectedLang'] = $_POST['lang'];
+
+ $emailItem = array(
+ 'addressee_email' => $bookingArray['guest_email'],
+ 'addressee_name' => $bookingArray['guest_name'],
+ 'subject' => '[studiobeve] Your booking has arrived',
+ 'content' => $content,
+ 'attachments' => array()
+ );
+ $emailArray[] = $emailItem;
+ header('Location:'.SITEURL.$_POST['lang'].'/booking-finished/'.$_POST['subpage']);
+ }
+
+ $this->User_model->sendEmail($emailArray, $_POST['lang'], $_POST['subpage']);
+ $this->load->view('pages/booking-process', $data);
+ }
+
+ public function profile(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Log_model');
+ $this->load->model('Module_model');
+ $data['message'] = '';
+ $data['message_class'] = '';
+ $data['fullname'] = '';
+ $data['password'] = '';
+ $data['profile_img_url'] = '';
+
+ if(isset($_SESSION['username'])){
+ $data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
+
+ $data['message'] = '';
+ $data['message_class'] = '';
+ $data['pageTitle'] = 'Profil szerkesztése';
+
+ if($this->User_model->is_user_admin($_SESSION['username'])){
+ $data['activeModules'] = $this->Module_model->getAllModule();
+ }
+ else{
+ $data['activeModules'] = $this->Module_model->getUserModules($data['currentUser']->user_id);
+ }
+
+ if(isset($_POST["storeProfile"])) {
+
+ if($_POST['fullname'] != $data['currentUser']->fullname){
+ $userArray = array(
+ 'fullname' => $_POST['fullname']
+ );
+ $this->User_model->updateUser($data['currentUser']->user_id, $userArray);
+ $this->Log_model->addLog('profile', 'A felhasználó módosította a teljes nevét: '.$data['currentUser']->fullname.' => '.$_POST['fullname'],$_SESSION['username']);
+ }
+
+ if($_POST['password'] != ''){
+ $userArray = array(
+ 'password' => hash('sha256', $_POST['password'])
+ );
+ $this->User_model->updateUser($data['currentUser']->user_id, $userArray);
+ $this->Log_model->addLog('profile', 'A felhasználó módosította a jelszavát',$_SESSION['username']);
+ }
+
+
+ //upload profile image
+ if($_FILES["profile_img"]["tmp_name"] != ''){
+ $target_dir = getcwd()."/assets/img/profiles/";
+ $target_file = $target_dir . str_replace('.','_', str_replace('@','_',$_SESSION['username']));
+ $imageFileType = strtolower(pathinfo(basename($_FILES["profile_img"]["name"]),PATHINFO_EXTENSION));
+
+ if (move_uploaded_file($_FILES["profile_img"]["tmp_name"], $target_file.'.'.$imageFileType)) {
+ $data['message'] = 'A profilkép sikeresen feltöltve!';
+ $data['message_class'] = 'successMessage';
+ $data['profile_img_url'] = 'assets/img/profiles/'.str_replace('.','_', str_replace('@','_',$_SESSION['username'])).'.'.$imageFileType;
+ $userArray = array(
+ 'profile_img_url' => $data['profile_img_url']
+ );
+ $this->User_model->updateUser($data['currentUser']->user_id, $userArray);
+ $this->Log_model->addLog('profile', 'A felhasználó lecserélte a profilképét ',$_SESSION['username']);
+ } else {
+ $data['message'] = 'Hiba a feltöltés közben!';
+ $data['message_class'] = 'errorMessage';
+ }
+
+ }
+
+ $data['message'] = 'A profil sikeresen módosítva!';
+ $data['message_class'] = 'successMessage';
+ }
+
+
+ $data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
+ $this->load->view('pages/profile', $data);
+
+ }
+ else{
+ header("Location:".SITEURL."login");
+ }
+ }
+
+ public function log_monitor(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Log_model');
+ $this->load->model('Module_model');
+
+ if(isset($_SESSION['username'])){
+ $data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
+ $data['message'] = '';
+ $data['message_class'] = '';
+ $data['pageTitle'] = 'Rendszermonitor';
+ $data['logInfoLink'] = '';
+
+ if($this->User_model->is_user_admin($_SESSION['username'])){
+ $data['activeModules'] = $this->Module_model->getAllModule();
+ }
+ else{
+ $data['activeModules'] = $this->Module_model->getUserModules($data['currentUser']->user_id);
+ }
+
+ $selectedModule = $this->Module_model->getModuleBySlug('log-monitor');
+ if($this->Module_model->is_module_available($selectedModule->module_id, $data['currentUser']->user_id)){
+
+ if(isset($_POST['exportToFile'])){
+ $logInfoArray = $this->Log_model->getAllLoginfo();
+ $logrow = '';
+ $logTxt = fopen(getcwd()."/documents/loginfo.csv", "w") or die("Hiba a fájl mentésekor!");
+ $row = '"Esemény ideje";'.'"Esemény típusa";'.'"Felhasználónév";"Bejegyzés tartalma";'.PHP_EOL;
+ $string_encoded = iconv( mb_detect_encoding( $row ), 'ISO-8859-2', $row );
+ fwrite($logTxt, $string_encoded);
+
+ foreach($logInfoArray as $logInfoItem){
+ $logDateTime = new datetime($logInfoItem->event_datetime);
+ $row = date_format($logDateTime,"Y-m-d H:i").';"'.$logInfoItem->event_type.'";"'.$logInfoItem->username.'";"'.$logInfoItem->event_content.'";'.PHP_EOL;
+ $string_encoded = iconv( mb_detect_encoding( $row ), 'ISO-8859-2', $row );
+ fwrite($logTxt, $string_encoded);
+ }
+ fclose($logTxt);
+ $data['logInfoLink'] = 'A loginfo.csv fájl letöltése ';
+ }
+
+ $this->load->view('log-monitor', $data);
+
+ }
+ else{
+ header("Location:".SITEURL."home");
+ }
+
+
+ }
+ else{
+ header("Location:".SITEURL."login");
+ }
+
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+}
diff --git a/application/controllers/Pages_20250524.php b/application/controllers/Pages_20250524.php
new file mode 100755
index 0000000..721333f
--- /dev/null
+++ b/application/controllers/Pages_20250524.php
@@ -0,0 +1,652 @@
+
+ * @see https://codeigniter.com/userguide3/general/urls.html
+ */
+ public function index(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+
+ $data['pageTitle'] = '';
+ $this->load->view('pages/home', $data);
+ }
+
+ public function barber($lang){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+ $data['pageTitle'] = '';
+ $data['selectedLang'] = $lang;
+
+ $data['services'] = $this->Service_model->getAllServiceByServiceType('barber', $lang);
+ $this->load->view('pages/barber', $data);
+ }
+
+ public function beauty($lang){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+ $data['pageTitle'] = '';
+ $data['selectedLang'] = $lang;
+
+ $data['services'] = $this->Service_model->getAllServiceByServiceType('beauty', $lang);
+ $this->load->view('pages/beauty', $data);
+ }
+
+ public function booking($lang, $subpage){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+
+ $data['pageTitle'] = '';
+ $data['selectedLang'] = $lang;
+ $data['subpage'] = $subpage;
+
+ $data['services'] = $this->Service_model->getAllServiceByServiceType($subpage, $lang);
+ $data['workers'] = $this->Service_model->getActiveWorkers($subpage);
+
+ switch($subpage){
+ case 'barber':
+ $this->load->view('pages/barber-booking', $data);
+ break;
+ case 'beauty':
+ $this->load->view('pages/beauty-booking', $data);
+ break;
+ default:
+ header('Location:'.SITEURL);
+ }
+ }
+
+ public function booking_finished($lang, $subpage){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+ $data['pageTitle'] = '';
+ $data['selectedLang'] = $lang;
+
+ switch($subpage){
+ case 'barber':
+ $this->load->view('pages/barber-booking-finished', $data);
+ break;
+ case 'beauty':
+ $this->load->view('pages/beauty-booking-finished', $data);
+ break;
+ default:
+ header('Location:'.SITEURL);
+ }
+ }
+
+ public function email_verification(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+ $this->load->model('Log_model');
+
+ $data['pageTitle'] = '';
+ $this->load->view('pages/email-verification', $data);
+ }
+
+ public function ajax(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+ $this->load->model('Log_model');
+
+ $data['pageTitle'] = '';
+
+ if(isset($_POST['action']) && $_POST['action'] == 'getAvailableWorkersByServiceCategory' && isset($_POST['serv_cat_slug'])){
+ $workers = $this->Service_model->getWorkersByCategorySlug($_POST['serv_cat_slug']);
+ $returnedWorkers = '';
+ $workerIndex = 0;
+ $workerListShow = '';
+
+ if(is_array($workers)){
+ foreach($workers as $workerItem){
+ $workerListShow .= '';
+ $workerListShow .= '';
+ $workerListShow .= '
';
+ $workerListShow .= '
';
+ $workerListShow .= '
';
+ $workerListShow .= '
'.$workerItem->worker_name.'
';
+ $workerListShow .= '
'.$workerItem->worker_info.'
';
+ $workerListShow .= '
';
+ $workerListShow .= '
';
+ $workerListShow .= ' ';
+ /*
+ ?>
+
+
+
>
+
+
+
worker_name;?>
+
worker_info;?>
+
+
+
+ $workers,
+ 'workerListShow' => $workerListShow
+ );
+
+ echo json_encode($responseArray);
+ }
+
+ if(isset($_POST['action']) && $_POST['action'] == 'calculate_service_length' && isset($_POST['service_ids'])){
+ if($_POST['service_ids'] != ''){
+ $explodedServiceIds = explode(',', $_POST['service_ids']);
+ $totalLength = '00:00:00';
+ if(!empty($explodedServiceIds)){
+ foreach($explodedServiceIds as $explodedServiceIdItem){
+ $currentService = $this->Service_model->getServiceById($explodedServiceIdItem);
+ $time = $totalLength;
+ $time2 = $currentService->service_time;
+
+ $secs = strtotime($time2)-strtotime("00:00:00");
+ $addedTotal = date("H:i:s",strtotime($time)+$secs);
+ $totalLength = $addedTotal;
+ }
+
+ }
+ echo $totalLength;
+ }
+ }
+
+ if(isset($_POST['action']) && $_POST['action'] == 'getAvailableTimeOptions' && isset($_POST['selectedDate'])){
+ $results = $this->Service_model->getAvailableTimes($_POST['worker_id'], $_POST['selectedDate'], $_POST['servicelength']);
+
+ $rowIndex = 1;
+ if(is_array($results)){
+ foreach($results as $resultIem){
+ ?>
+
+ Service_model->getAvailableTimes($_POST['worker_id'], $_POST['selectedDate'], $_POST['servicelength']);
+
+ $timeIsAvailable = 0;
+ if(is_array($results)){
+ foreach($results as $resultIem){
+ if(date('H:i:s', strtotime($resultIem)) == $_POST['selectedTime']){
+ $timeIsAvailable = 1;
+ }
+ }
+
+ echo $timeIsAvailable;
+ }
+ else{
+ echo 0;
+ }
+ }
+
+ if(isset($_POST['action']) && $_POST['action'] == 'getAvailableTimes' && isset($_POST['selectedDate'])){
+ $results = $this->Service_model->getAvailableTimes($_POST['worker_id'], $_POST['selectedDate'], $_POST['servicelength'].':00');
+
+ $rowIndex = 1;
+ if(!empty($results)){
+ foreach($results as $resultIem){
+ ?>
+
+ Service_model->getWorkerById($_POST['worker_id']);
+
+ if(is_object($result)){
+ ?>
+
+ worker_name;?>
+ User_model->getUserById($_POST['user_id']);
+ $userArray = array(
+ 'is_enabled' => $_POST['newValue']
+ );
+ $this->User_model->updateUser($_POST['user_id'], $userArray);
+ $this->Log_model->addLog('change_user_status', $data['currentUser']->username.' státusza változott - '.($_POST['newValue']?'aktív':'letiltva').' állapotra', $_POST['operator']);
+ }
+
+ if(isset($_POST['action']) && $_POST['action'] == 'checkUser'){
+ echo $this->User_model->isUsernameAvailable($_POST['username']);
+ }
+
+ if(isset($_POST['action']) && $_POST['action'] == 'refreshLogMonitor'){
+ $logInfoArray = $this->Log_model->getAllLoginfo();
+ $logrow = '';
+ foreach($logInfoArray as $logInfoItem){
+ $logDateTime = new datetime($logInfoItem->event_datetime);
+ $logrow .= date_format($logDateTime,"Y-m-d H:i").' '.$logInfoItem->username.' '.$logInfoItem->event_content.'
';
+ }
+ echo $logrow;
+ }
+
+
+
+ $this->load->view('pages/ajax', $data);
+ }
+
+
+ public function booking_process(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+
+ $data['pageTitle'] = '';
+ $data['subpage'] = '';
+
+ if(isset($_POST['sendBooking'])){
+ //calculate finish time
+ $serviceStartTime = date("H:i:s", strtotime($_POST['booking_start_time']));
+ $serviceLengthTime = date("H:i:s", strtotime($_POST['servicelength']));
+ $secs = strtotime($serviceLengthTime)-strtotime("00:00:00");
+ $serviceFinishTime = date("H:i:s",strtotime($serviceStartTime)+$secs);
+
+ $data['services'] = $this->Service_model->getAllServiceByServiceType($_POST['subpage'], $_POST['lang']);
+ $data['workers'] = $this->Service_model->getAllWorkers();
+ $data['selectedLang'] = 'en';
+ $selectedServiceArray = array();
+
+ //find selected services
+ if(is_array($data['services'])){
+ foreach($data['services'] as $serviceItem){
+ if(isset($_POST['service_'.$serviceItem->service_id])){
+ if($_POST['service_'.$serviceItem->service_id]){
+ $selectedServiceArray[] = $serviceItem->service_id;
+ }
+ }
+ }
+ }
+
+ // 1. Build selected service array
+ $selectedServiceArray = array();
+ $totalLengthSeconds = 0;
+
+ foreach ($_POST as $key => $value) {
+ if (strpos($key, 'service_') === 0 && $value == '1') {
+ $serviceId = str_replace('service_', '', $key);
+ $selectedServiceArray[] = $serviceId;
+
+ $service = $this->Service_model->getServiceById($serviceId);
+ if ($service) {
+ $parts = explode(':', $service->service_time);
+ $totalLengthSeconds += ($parts[0] * 3600) + ($parts[1] * 60);
+ }
+ }
+ }
+
+ // 2. Convert total time to H:i format
+ $servicelength = gmdate('H:i:s', $totalLengthSeconds);
+
+ // 3. Build booking array
+ $bookingArray = array(
+ 'guest_name' => $_POST['guest_name'],
+ 'guest_email' => $_POST['guest_email'],
+ 'guest_phone' => $_POST['guest_phone'],
+ 'worker_id' => $_POST['worker_id'],
+ 'booking_date' => $_POST['booking_date'],
+ 'booking_start_time' => $_POST['booking_start_time'],
+ 'booking_finish_time' => '', // optional
+ 'service_ids' => serialize($selectedServiceArray),
+ 'guest_confirmed' => '0',
+ 'guest_confirm_code' => '1234',
+ );
+
+ // 4. Validate: available slot with correct length
+ $available = $this->Service_model->getAvailableTimes(
+ $bookingArray['worker_id'],
+ $bookingArray['booking_date'],
+ $servicelength
+ );
+
+ if (!is_array($available) || !in_array($bookingArray['booking_start_time'], $available)) {
+ $this->output
+ ->set_status_header(409)
+ ->set_content_type('application/json')
+ ->set_output(json_encode([
+ 'error' => 'Conflict. Timeslot is taken or does not fit the service.'
+ ]));
+ return;
+ }
+
+ // 5. Validate: booking doesn't go past 18:00
+ $bookingStart = new DateTime($bookingArray['booking_start_time']);
+ $bookingLength = new DateTime($servicelength);
+ $bookingEnd = clone $bookingStart;
+ $bookingEnd->add(new DateInterval('PT' . intval($bookingLength->format('H')) . 'H'));
+ $bookingEnd->add(new DateInterval('PT' . intval($bookingLength->format('i')) . 'M'));
+
+ $bookingArray['booking_finish_time'] = $bookingEnd->format('H:i:s');
+
+ $closingTime = new DateTime('18:00');
+
+ if ($bookingEnd > $closingTime) {
+ $this->output
+ ->set_status_header(403)
+ ->set_content_type('application/json')
+ ->set_output(json_encode([
+ 'error' => 'Selected time exceeds business hours.'
+ ]));
+ return;
+ }
+
+ // 6. Create booking
+ $this->Service_model->createBooking($bookingArray);
+
+ $worker = $this->Service_model->getWorkerById($bookingArray['worker_id']);
+
+ $services = unserialize($bookingArray['service_ids']);
+ $serviceArray = array();
+ $emailArray = array();
+
+ if(is_array($services)){
+ foreach($services as $serviceItem){
+ $selectedService = $this->Service_model->getServiceById($serviceItem);
+ if(is_object($selectedService)){
+ $serviceArray[] = $selectedService;
+ }
+ }
+ }
+
+ $content = '';
+
+ switch($_POST['lang']){
+ case 'no':
+ $content = 'Kjære gjest, ';
+ $content .= 'Takk for din bestilling! ';
+ $content .= ' ';
+ $content .= '';
+ $content .= 'Navn: '.$bookingArray['guest_name'].' ';
+ $content .= 'E-post: '.$bookingArray['guest_email'].' ';
+ $content .= 'Telefon: '.$bookingArray['guest_phone'].' ';
+ $content .= 'Arbeider: '.$worker->worker_name.' ';
+ $content .= 'Dato: '.$bookingArray['booking_date'].' ';
+ $content .= 'Tid: '.$bookingArray['booking_start_time'].' - '.$bookingArray['booking_finish_time'].' ';
+ $content .= 'Tjenester: ';
+ $totalServicePrice = 0;
+ foreach($serviceArray as $serviceArrayItem){
+ $totalServicePrice += $serviceArrayItem->service_price;
+ $content .= ''.$serviceArrayItem->service_name_no.' '.$serviceArrayItem->service_price.' kr ';
+ }
+ $content .= '
';
+ $content .= 'Totalpris: '.$totalServicePrice.' kr ';
+ $content .= '
';
+ $content .= ' STUDIOBEVE';
+ break;
+ case 'en':
+ $content = 'Dear Guest, ';
+ $content .= 'Thank you for your booking! ';
+ $content .= ' ';
+ $content .= '';
+ $content .= 'Name: '.$bookingArray['guest_name'].' ';
+ $content .= 'Email: '.$bookingArray['guest_email'].' ';
+ $content .= 'Phone: '.$bookingArray['guest_phone'].' ';
+ $content .= 'Worker: '.$worker->worker_name.' ';
+ $content .= 'Date: '.$bookingArray['booking_date'].' ';
+ $content .= 'Time: '.$bookingArray['booking_start_time'].' - '.$bookingArray['booking_finish_time'].' ';
+ $content .= 'Services: ';
+ $totalServicePrice = 0;
+ foreach($serviceArray as $serviceArrayItem){
+ $totalServicePrice += $serviceArrayItem->service_price;
+ $content .= ''.$serviceArrayItem->service_name_en.' '.$serviceArrayItem->service_price.' kr ';
+ }
+ $content .= '
';
+ $content .= 'Total price: '.$totalServicePrice.' kr ';
+ $content .= '
';
+ $content .= ' STUDIOBEVE';
+ break;
+ case 'hu':
+ $content = 'Kedves Vendégünk, ';
+ $content .= 'Köszönettel fogadtuk a foglalását! ';
+ $content .= ' ';
+ $content .= '';
+ $content .= 'Név: '.$bookingArray['guest_name'].' ';
+ $content .= 'Email: '.$bookingArray['guest_email'].' ';
+ $content .= 'Telefon: '.$bookingArray['guest_phone'].' ';
+ $content .= 'Dolgozó: '.$worker->worker_name.' ';
+ $content .= 'Dátum: '.$bookingArray['booking_date'].' ';
+ $content .= 'Időpont: '.$bookingArray['booking_start_time'].' - '.$bookingArray['booking_finish_time'].' ';
+ $content .= 'Szolgáltatás(ok): ';
+ $totalServicePrice = 0;
+ foreach($serviceArray as $serviceArrayItem){
+ $totalServicePrice += $serviceArrayItem->service_price;
+ $content .= ''.$serviceArrayItem->service_name_hu.' '.$serviceArrayItem->service_price.' kr ';
+ }
+ $content .= '
';
+ $content .= 'Összesen fizetendő: '.$totalServicePrice.' kr ';
+ $content .= '
';
+ $content .= ' STUDIOBEVE';
+ break;
+ }
+
+ $data['selectedLang'] = $_POST['lang'];
+
+ $emailItem = array(
+ 'addressee_email' => $bookingArray['guest_email'],
+ 'addressee_name' => $bookingArray['guest_name'],
+ 'subject' => '[studiobeve] Your booking has arrived',
+ 'content' => $content,
+ 'attachments' => array()
+ );
+ $emailArray[] = $emailItem;
+ header('Location:'.SITEURL.$_POST['lang'].'/booking-finished/'.$_POST['subpage']);
+ }
+
+ $this->User_model->sendEmail($emailArray, $_POST['lang'], $_POST['subpage']);
+ $this->load->view('pages/booking-process', $data);
+ }
+
+ public function profile(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Log_model');
+ $this->load->model('Module_model');
+ $data['message'] = '';
+ $data['message_class'] = '';
+ $data['fullname'] = '';
+ $data['password'] = '';
+ $data['profile_img_url'] = '';
+
+ if(isset($_SESSION['username'])){
+ $data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
+
+ $data['message'] = '';
+ $data['message_class'] = '';
+ $data['pageTitle'] = 'Profil szerkesztése';
+
+ if($this->User_model->is_user_admin($_SESSION['username'])){
+ $data['activeModules'] = $this->Module_model->getAllModule();
+ }
+ else{
+ $data['activeModules'] = $this->Module_model->getUserModules($data['currentUser']->user_id);
+ }
+
+ if(isset($_POST["storeProfile"])) {
+
+ if($_POST['fullname'] != $data['currentUser']->fullname){
+ $userArray = array(
+ 'fullname' => $_POST['fullname']
+ );
+ $this->User_model->updateUser($data['currentUser']->user_id, $userArray);
+ $this->Log_model->addLog('profile', 'A felhasználó módosította a teljes nevét: '.$data['currentUser']->fullname.' => '.$_POST['fullname'],$_SESSION['username']);
+ }
+
+ if($_POST['password'] != ''){
+ $userArray = array(
+ 'password' => hash('sha256', $_POST['password'])
+ );
+ $this->User_model->updateUser($data['currentUser']->user_id, $userArray);
+ $this->Log_model->addLog('profile', 'A felhasználó módosította a jelszavát',$_SESSION['username']);
+ }
+
+
+ //upload profile image
+ if($_FILES["profile_img"]["tmp_name"] != ''){
+ $target_dir = getcwd()."/assets/img/profiles/";
+ $target_file = $target_dir . str_replace('.','_', str_replace('@','_',$_SESSION['username']));
+ $imageFileType = strtolower(pathinfo(basename($_FILES["profile_img"]["name"]),PATHINFO_EXTENSION));
+
+ if (move_uploaded_file($_FILES["profile_img"]["tmp_name"], $target_file.'.'.$imageFileType)) {
+ $data['message'] = 'A profilkép sikeresen feltöltve!';
+ $data['message_class'] = 'successMessage';
+ $data['profile_img_url'] = 'assets/img/profiles/'.str_replace('.','_', str_replace('@','_',$_SESSION['username'])).'.'.$imageFileType;
+ $userArray = array(
+ 'profile_img_url' => $data['profile_img_url']
+ );
+ $this->User_model->updateUser($data['currentUser']->user_id, $userArray);
+ $this->Log_model->addLog('profile', 'A felhasználó lecserélte a profilképét ',$_SESSION['username']);
+ } else {
+ $data['message'] = 'Hiba a feltöltés közben!';
+ $data['message_class'] = 'errorMessage';
+ }
+
+ }
+
+ $data['message'] = 'A profil sikeresen módosítva!';
+ $data['message_class'] = 'successMessage';
+ }
+
+
+ $data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
+ $this->load->view('pages/profile', $data);
+
+ }
+ else{
+ header("Location:".SITEURL."login");
+ }
+ }
+
+ public function log_monitor(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Log_model');
+ $this->load->model('Module_model');
+
+ if(isset($_SESSION['username'])){
+ $data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
+ $data['message'] = '';
+ $data['message_class'] = '';
+ $data['pageTitle'] = 'Rendszermonitor';
+ $data['logInfoLink'] = '';
+
+ if($this->User_model->is_user_admin($_SESSION['username'])){
+ $data['activeModules'] = $this->Module_model->getAllModule();
+ }
+ else{
+ $data['activeModules'] = $this->Module_model->getUserModules($data['currentUser']->user_id);
+ }
+
+ $selectedModule = $this->Module_model->getModuleBySlug('log-monitor');
+ if($this->Module_model->is_module_available($selectedModule->module_id, $data['currentUser']->user_id)){
+
+ if(isset($_POST['exportToFile'])){
+ $logInfoArray = $this->Log_model->getAllLoginfo();
+ $logrow = '';
+ $logTxt = fopen(getcwd()."/documents/loginfo.csv", "w") or die("Hiba a fájl mentésekor!");
+ $row = '"Esemény ideje";'.'"Esemény típusa";'.'"Felhasználónév";"Bejegyzés tartalma";'.PHP_EOL;
+ $string_encoded = iconv( mb_detect_encoding( $row ), 'ISO-8859-2', $row );
+ fwrite($logTxt, $string_encoded);
+
+ foreach($logInfoArray as $logInfoItem){
+ $logDateTime = new datetime($logInfoItem->event_datetime);
+ $row = date_format($logDateTime,"Y-m-d H:i").';"'.$logInfoItem->event_type.'";"'.$logInfoItem->username.'";"'.$logInfoItem->event_content.'";'.PHP_EOL;
+ $string_encoded = iconv( mb_detect_encoding( $row ), 'ISO-8859-2', $row );
+ fwrite($logTxt, $string_encoded);
+ }
+ fclose($logTxt);
+ $data['logInfoLink'] = 'A loginfo.csv fájl letöltése ';
+ }
+
+ $this->load->view('log-monitor', $data);
+
+ }
+ else{
+ header("Location:".SITEURL."home");
+ }
+
+
+ }
+ else{
+ header("Location:".SITEURL."login");
+ }
+
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+}
diff --git a/application/controllers/Pages_20250617.php b/application/controllers/Pages_20250617.php
new file mode 100755
index 0000000..c3e22fb
--- /dev/null
+++ b/application/controllers/Pages_20250617.php
@@ -0,0 +1,685 @@
+
+ * @see https://codeigniter.com/userguide3/general/urls.html
+ */
+ public function index(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+
+ $data['pageTitle'] = '';
+ $this->load->view('pages/home', $data);
+ }
+
+ public function barber($lang){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+ $data['pageTitle'] = '';
+ $data['selectedLang'] = $lang;
+
+ $data['services'] = $this->Service_model->getAllServiceByServiceType('barber', $lang);
+ $this->load->view('pages/barber', $data);
+ }
+
+ public function beauty($lang){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+ $data['pageTitle'] = '';
+ $data['selectedLang'] = $lang;
+
+ $data['services'] = $this->Service_model->getAllServiceByServiceType('beauty', $lang);
+ $this->load->view('pages/beauty', $data);
+ }
+
+ public function booking($lang, $subpage){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+
+ $data['pageTitle'] = '';
+ $data['selectedLang'] = $lang;
+ $data['subpage'] = $subpage;
+
+ $data['services'] = $this->Service_model->getAllServiceByServiceType($subpage, $lang);
+ $data['workers'] = $this->Service_model->getActiveWorkers($subpage);
+
+ switch($subpage){
+ case 'barber':
+ $this->load->view('pages/barber-booking', $data);
+ break;
+ case 'beauty':
+ $this->load->view('pages/beauty-booking', $data);
+ break;
+ default:
+ header('Location:'.SITEURL);
+ }
+ }
+
+ public function booking_finished($lang, $subpage){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+ $data['pageTitle'] = '';
+ $data['selectedLang'] = $lang;
+
+ switch($subpage){
+ case 'barber':
+ $this->load->view('pages/barber-booking-finished', $data);
+ break;
+ case 'beauty':
+ $this->load->view('pages/beauty-booking-finished', $data);
+ break;
+ default:
+ header('Location:'.SITEURL);
+ }
+ }
+
+ public function email_verification(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+ $this->load->model('Log_model');
+
+ $data['pageTitle'] = '';
+ $this->load->view('pages/email-verification', $data);
+ }
+
+ public function ajax(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+ $this->load->model('Log_model');
+
+ $data['pageTitle'] = '';
+
+ if(isset($_POST['action']) && $_POST['action'] == 'getAvailableWorkersByServiceCategory' && isset($_POST['serv_cat_slug'])){
+ $workers = $this->Service_model->getWorkersByCategorySlug($_POST['serv_cat_slug']);
+ $returnedWorkers = '';
+ $workerIndex = 0;
+ $workerListShow = '';
+
+ if(is_array($workers)){
+ foreach($workers as $workerItem){
+ $workerListShow .= '';
+ $workerListShow .= '';
+ $workerListShow .= '
';
+ $workerListShow .= '
';
+ $workerListShow .= '
';
+ $workerListShow .= '
'.$workerItem->worker_name.'
';
+ $workerListShow .= '
'.$workerItem->worker_info.'
';
+ $workerListShow .= '
';
+ $workerListShow .= '
';
+ $workerListShow .= ' ';
+ /*
+ ?>
+
+
+
>
+
+
+
worker_name;?>
+
worker_info;?>
+
+
+
+ $workers,
+ 'workerListShow' => $workerListShow
+ );
+
+ echo json_encode($responseArray);
+ }
+
+ if(isset($_POST['action']) && $_POST['action'] == 'calculate_service_length' && isset($_POST['service_ids'])){
+ if($_POST['service_ids'] != ''){
+ $explodedServiceIds = explode(',', $_POST['service_ids']);
+ $totalLength = '00:00:00';
+ if(!empty($explodedServiceIds)){
+ foreach($explodedServiceIds as $explodedServiceIdItem){
+ $currentService = $this->Service_model->getServiceById($explodedServiceIdItem);
+ $time = $totalLength;
+ $time2 = $currentService->service_time;
+
+ $secs = strtotime($time2)-strtotime("00:00:00");
+ $addedTotal = date("H:i:s",strtotime($time)+$secs);
+ $totalLength = $addedTotal;
+ }
+
+ }
+ echo $totalLength;
+ }
+ }
+
+ if(isset($_POST['action']) && $_POST['action'] == 'getAvailableTimeOptions' && isset($_POST['selectedDate'])){
+ $results = $this->Service_model->getAvailableTimes($_POST['worker_id'], $_POST['selectedDate'], $_POST['servicelength']);
+
+ $rowIndex = 1;
+ if(is_array($results)){
+ foreach($results as $resultIem){
+ ?>
+
+ Service_model->getAvailableTimes($_POST['worker_id'], $_POST['selectedDate'], $_POST['servicelength']);
+
+ $timeIsAvailable = 0;
+ if(is_array($results)){
+ foreach($results as $resultIem){
+ if(date('H:i:s', strtotime($resultIem)) == $_POST['selectedTime']){
+ $timeIsAvailable = 1;
+ }
+ }
+
+ echo $timeIsAvailable;
+ }
+ else{
+ echo 0;
+ }
+ }
+
+ if(isset($_POST['action']) && $_POST['action'] == 'getAvailableTimes' && isset($_POST['selectedDate'])){
+ $results = $this->Service_model->getAvailableTimes($_POST['worker_id'], $_POST['selectedDate'], $_POST['servicelength'].':00');
+
+ $rowIndex = 1;
+ if(!empty($results)){
+ foreach($results as $resultIem){
+ ?>
+
+ Service_model->getWorkerById($_POST['worker_id']);
+
+ if(is_object($result)){
+ ?>
+
+ worker_name;?>
+ User_model->getUserById($_POST['user_id']);
+ $userArray = array(
+ 'is_enabled' => $_POST['newValue']
+ );
+ $this->User_model->updateUser($_POST['user_id'], $userArray);
+ $this->Log_model->addLog('change_user_status', $data['currentUser']->username.' státusza változott - '.($_POST['newValue']?'aktív':'letiltva').' állapotra', $_POST['operator']);
+ }
+
+ if(isset($_POST['action']) && $_POST['action'] == 'checkUser'){
+ echo $this->User_model->isUsernameAvailable($_POST['username']);
+ }
+
+ if(isset($_POST['action']) && $_POST['action'] == 'refreshLogMonitor'){
+ $logInfoArray = $this->Log_model->getAllLoginfo();
+ $logrow = '';
+ foreach($logInfoArray as $logInfoItem){
+ $logDateTime = new datetime($logInfoItem->event_datetime);
+ $logrow .= date_format($logDateTime,"Y-m-d H:i").' '.$logInfoItem->username.' '.$logInfoItem->event_content.'
';
+ }
+ echo $logrow;
+ }
+
+
+
+ $this->load->view('pages/ajax', $data);
+ }
+
+
+ public function booking_process(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+
+ $data['pageTitle'] = '';
+ $data['subpage'] = '';
+
+ if(isset($_POST['sendBooking'])){
+ //calculate finish time
+ $serviceStartTime = date("H:i:s", strtotime($_POST['booking_start_time']));
+ $serviceLengthTime = date("H:i:s", strtotime($_POST['servicelength']));
+ $secs = strtotime($serviceLengthTime)-strtotime("00:00:00");
+ $serviceFinishTime = date("H:i:s",strtotime($serviceStartTime)+$secs);
+
+ $data['services'] = $this->Service_model->getAllServiceByServiceType($_POST['subpage'], $_POST['lang']);
+ $data['workers'] = $this->Service_model->getAllWorkers();
+ $data['selectedLang'] = 'en';
+ $selectedServiceArray = array();
+
+
+ //find selected services
+ if(is_array($data['services'])){
+ foreach($data['services'] as $serviceItem){
+ if(isset($_POST['service_'.$serviceItem->service_id])){
+ if($_POST['service_'.$serviceItem->service_id]){
+ $selectedServiceArray[] = $serviceItem->service_id;
+ }
+ }
+ }
+ }
+
+ // 1. Build selected service array
+ $selectedServiceArray = array();
+ $totalLengthSeconds = 0;
+
+ foreach ($_POST as $key => $value) {
+ if (strpos($key, 'service_') === 0 && $value == '1') {
+ $serviceId = str_replace('service_', '', $key);
+ $selectedServiceArray[] = $serviceId;
+
+ $service = $this->Service_model->getServiceById($serviceId);
+ if ($service) {
+ $parts = explode(':', $service->service_time);
+ $totalLengthSeconds += ($parts[0] * 3600) + ($parts[1] * 60);
+ }
+ }
+ }
+
+ // 2. Convert total time to H:i format
+ $servicelength = gmdate('H:i:s', $totalLengthSeconds);
+
+ // 3. Build booking array
+ $bookingArray = array(
+ 'guest_name' => $_POST['guest_name'],
+ 'guest_email' => $_POST['guest_email'],
+ 'guest_phone' => $_POST['guest_phone'],
+ 'worker_id' => $_POST['worker_id'],
+ 'booking_date' => $_POST['booking_date'],
+ 'booking_start_time' => $_POST['booking_start_time'],
+ 'booking_finish_time' => '', // optional
+ 'service_ids' => serialize($selectedServiceArray),
+ 'guest_confirmed' => '0',
+ 'guest_confirm_code' => '1234',
+ );
+
+ $bookingDate = $bookingArray['booking_date'];
+ $bookingTime = $bookingArray['booking_start_time'];
+ $weekday = date('w', strtotime($bookingDate));
+ $schedule = $this->Service_model->getWorkerScheduleByDay($bookingArray['worker_id'], $weekday);
+
+ if (!$schedule) {
+ $this->output
+ ->set_status_header(403)
+ ->set_content_type('application/json')
+ ->set_output(json_encode(['error' => 'Worker is not available on this day.']));
+ return;
+ }
+
+ if ($bookingTime < $schedule->start_time || $bookingTime >= $schedule->end_time) {
+ $this->output
+ ->set_status_header(403)
+ ->set_content_type('application/json')
+ ->set_output(json_encode(['error' => 'Booking time is outside worker schedule.']));
+ return;
+ }
+
+ if ($schedule->is_alternate_week) {
+ $weekNum = date('W', strtotime($bookingDate));
+ if ($weekNum % 2 !== 0) {
+ $this->output
+ ->set_status_header(403)
+ ->set_content_type('application/json')
+ ->set_output(json_encode(['error' => 'Worker only works every second week.']));
+ return;
+ }
+ }
+
+ // 4. Validate: available slot with correct length
+ $available = $this->Service_model->getAvailableTimes(
+ $bookingArray['worker_id'],
+ $bookingArray['booking_date'],
+ $servicelength
+ );
+
+ if (!is_array($available) || !in_array($bookingArray['booking_start_time'], $available)) {
+ $this->output
+ ->set_status_header(409)
+ ->set_content_type('application/json')
+ ->set_output(json_encode([
+ 'error' => 'Conflict. Timeslot is taken or does not fit the service.'
+ ]));
+ return;
+ }
+
+ // 5. Validate: booking doesn't go past 18:00
+ $bookingStart = new DateTime($bookingArray['booking_start_time']);
+ $bookingLength = new DateTime($servicelength);
+ $bookingEnd = clone $bookingStart;
+ $bookingEnd->add(new DateInterval('PT' . intval($bookingLength->format('H')) . 'H'));
+ $bookingEnd->add(new DateInterval('PT' . intval($bookingLength->format('i')) . 'M'));
+
+ $bookingArray['booking_finish_time'] = $bookingEnd->format('H:i:s');
+
+ $closingTime = new DateTime('18:00');
+
+ if ($bookingEnd > $closingTime) {
+ $this->output
+ ->set_status_header(403)
+ ->set_content_type('application/json')
+ ->set_output(json_encode([
+ 'error' => 'Selected time exceeds business hours.'
+ ]));
+ return;
+ }
+
+ // 6. Create booking
+ $this->Service_model->createBooking($bookingArray);
+
+ $worker = $this->Service_model->getWorkerById($bookingArray['worker_id']);
+
+ $services = unserialize($bookingArray['service_ids']);
+ $serviceArray = array();
+ $emailArray = array();
+
+ if(is_array($services)){
+ foreach($services as $serviceItem){
+ $selectedService = $this->Service_model->getServiceById($serviceItem);
+ if(is_object($selectedService)){
+ $serviceArray[] = $selectedService;
+ }
+ }
+ }
+
+ $content = '';
+
+ switch($_POST['lang']){
+ case 'no':
+ $content = 'Kjære gjest, ';
+ $content .= 'Takk for din bestilling! ';
+ $content .= ' ';
+ $content .= '';
+ $content .= 'Navn: '.$bookingArray['guest_name'].' ';
+ $content .= 'E-post: '.$bookingArray['guest_email'].' ';
+ $content .= 'Telefon: '.$bookingArray['guest_phone'].' ';
+ $content .= 'Arbeider: '.$worker->worker_name.' ';
+ $content .= 'Dato: '.$bookingArray['booking_date'].' ';
+ $content .= 'Tid: '.$bookingArray['booking_start_time'].' - '.$bookingArray['booking_finish_time'].' ';
+ $content .= 'Tjenester: ';
+ $totalServicePrice = 0;
+ foreach($serviceArray as $serviceArrayItem){
+ $totalServicePrice += $serviceArrayItem->service_price;
+ $content .= ''.$serviceArrayItem->service_name_no.' '.$serviceArrayItem->service_price.' kr ';
+ }
+ $content .= '
';
+ $content .= 'Totalpris: '.$totalServicePrice.' kr ';
+ $content .= '
';
+ $content .= ' STUDIOBEVE';
+ break;
+ case 'en':
+ $content = 'Dear Guest, ';
+ $content .= 'Thank you for your booking! ';
+ $content .= ' ';
+ $content .= '';
+ $content .= 'Name: '.$bookingArray['guest_name'].' ';
+ $content .= 'Email: '.$bookingArray['guest_email'].' ';
+ $content .= 'Phone: '.$bookingArray['guest_phone'].' ';
+ $content .= 'Worker: '.$worker->worker_name.' ';
+ $content .= 'Date: '.$bookingArray['booking_date'].' ';
+ $content .= 'Time: '.$bookingArray['booking_start_time'].' - '.$bookingArray['booking_finish_time'].' ';
+ $content .= 'Services: ';
+ $totalServicePrice = 0;
+ foreach($serviceArray as $serviceArrayItem){
+ $totalServicePrice += $serviceArrayItem->service_price;
+ $content .= ''.$serviceArrayItem->service_name_en.' '.$serviceArrayItem->service_price.' kr ';
+ }
+ $content .= '
';
+ $content .= 'Total price: '.$totalServicePrice.' kr ';
+ $content .= '
';
+ $content .= ' STUDIOBEVE';
+ break;
+ case 'hu':
+ $content = 'Kedves Vendégünk, ';
+ $content .= 'Köszönettel fogadtuk a foglalását! ';
+ $content .= ' ';
+ $content .= '';
+ $content .= 'Név: '.$bookingArray['guest_name'].' ';
+ $content .= 'Email: '.$bookingArray['guest_email'].' ';
+ $content .= 'Telefon: '.$bookingArray['guest_phone'].' ';
+ $content .= 'Dolgozó: '.$worker->worker_name.' ';
+ $content .= 'Dátum: '.$bookingArray['booking_date'].' ';
+ $content .= 'Időpont: '.$bookingArray['booking_start_time'].' - '.$bookingArray['booking_finish_time'].' ';
+ $content .= 'Szolgáltatás(ok): ';
+ $totalServicePrice = 0;
+ foreach($serviceArray as $serviceArrayItem){
+ $totalServicePrice += $serviceArrayItem->service_price;
+ $content .= ''.$serviceArrayItem->service_name_hu.' '.$serviceArrayItem->service_price.' kr ';
+ }
+ $content .= '
';
+ $content .= 'Összesen fizetendő: '.$totalServicePrice.' kr ';
+ $content .= '
';
+ $content .= ' STUDIOBEVE';
+ break;
+ }
+
+ $data['selectedLang'] = $_POST['lang'];
+
+ $emailItem = array(
+ 'addressee_email' => $bookingArray['guest_email'],
+ 'addressee_name' => $bookingArray['guest_name'],
+ 'subject' => '[studiobeve] Your booking has arrived',
+ 'content' => $content,
+ 'attachments' => array()
+ );
+ $emailArray[] = $emailItem;
+ header('Location:'.SITEURL.$_POST['lang'].'/booking-finished/'.$_POST['subpage']);
+ }
+
+ $this->User_model->sendEmail($emailArray, $_POST['lang'], $_POST['subpage']);
+ $this->load->view('pages/booking-process', $data);
+ }
+
+ public function profile(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Log_model');
+ $this->load->model('Module_model');
+ $data['message'] = '';
+ $data['message_class'] = '';
+ $data['fullname'] = '';
+ $data['password'] = '';
+ $data['profile_img_url'] = '';
+
+ if(isset($_SESSION['username'])){
+ $data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
+
+ $data['message'] = '';
+ $data['message_class'] = '';
+ $data['pageTitle'] = 'Profil szerkesztése';
+
+ if($this->User_model->is_user_admin($_SESSION['username'])){
+ $data['activeModules'] = $this->Module_model->getAllModule();
+ }
+ else{
+ $data['activeModules'] = $this->Module_model->getUserModules($data['currentUser']->user_id);
+ }
+
+ if(isset($_POST["storeProfile"])) {
+
+ if($_POST['fullname'] != $data['currentUser']->fullname){
+ $userArray = array(
+ 'fullname' => $_POST['fullname']
+ );
+ $this->User_model->updateUser($data['currentUser']->user_id, $userArray);
+ $this->Log_model->addLog('profile', 'A felhasználó módosította a teljes nevét: '.$data['currentUser']->fullname.' => '.$_POST['fullname'],$_SESSION['username']);
+ }
+
+ if($_POST['password'] != ''){
+ $userArray = array(
+ 'password' => hash('sha256', $_POST['password'])
+ );
+ $this->User_model->updateUser($data['currentUser']->user_id, $userArray);
+ $this->Log_model->addLog('profile', 'A felhasználó módosította a jelszavát',$_SESSION['username']);
+ }
+
+
+ //upload profile image
+ if($_FILES["profile_img"]["tmp_name"] != ''){
+ $target_dir = getcwd()."/assets/img/profiles/";
+ $target_file = $target_dir . str_replace('.','_', str_replace('@','_',$_SESSION['username']));
+ $imageFileType = strtolower(pathinfo(basename($_FILES["profile_img"]["name"]),PATHINFO_EXTENSION));
+
+ if (move_uploaded_file($_FILES["profile_img"]["tmp_name"], $target_file.'.'.$imageFileType)) {
+ $data['message'] = 'A profilkép sikeresen feltöltve!';
+ $data['message_class'] = 'successMessage';
+ $data['profile_img_url'] = 'assets/img/profiles/'.str_replace('.','_', str_replace('@','_',$_SESSION['username'])).'.'.$imageFileType;
+ $userArray = array(
+ 'profile_img_url' => $data['profile_img_url']
+ );
+ $this->User_model->updateUser($data['currentUser']->user_id, $userArray);
+ $this->Log_model->addLog('profile', 'A felhasználó lecserélte a profilképét ',$_SESSION['username']);
+ } else {
+ $data['message'] = 'Hiba a feltöltés közben!';
+ $data['message_class'] = 'errorMessage';
+ }
+
+ }
+
+ $data['message'] = 'A profil sikeresen módosítva!';
+ $data['message_class'] = 'successMessage';
+ }
+
+
+ $data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
+ $this->load->view('pages/profile', $data);
+
+ }
+ else{
+ header("Location:".SITEURL."login");
+ }
+ }
+
+ public function log_monitor(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Log_model');
+ $this->load->model('Module_model');
+
+ if(isset($_SESSION['username'])){
+ $data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
+ $data['message'] = '';
+ $data['message_class'] = '';
+ $data['pageTitle'] = 'Rendszermonitor';
+ $data['logInfoLink'] = '';
+
+ if($this->User_model->is_user_admin($_SESSION['username'])){
+ $data['activeModules'] = $this->Module_model->getAllModule();
+ }
+ else{
+ $data['activeModules'] = $this->Module_model->getUserModules($data['currentUser']->user_id);
+ }
+
+ $selectedModule = $this->Module_model->getModuleBySlug('log-monitor');
+ if($this->Module_model->is_module_available($selectedModule->module_id, $data['currentUser']->user_id)){
+
+ if(isset($_POST['exportToFile'])){
+ $logInfoArray = $this->Log_model->getAllLoginfo();
+ $logrow = '';
+ $logTxt = fopen(getcwd()."/documents/loginfo.csv", "w") or die("Hiba a fájl mentésekor!");
+ $row = '"Esemény ideje";'.'"Esemény típusa";'.'"Felhasználónév";"Bejegyzés tartalma";'.PHP_EOL;
+ $string_encoded = iconv( mb_detect_encoding( $row ), 'ISO-8859-2', $row );
+ fwrite($logTxt, $string_encoded);
+
+ foreach($logInfoArray as $logInfoItem){
+ $logDateTime = new datetime($logInfoItem->event_datetime);
+ $row = date_format($logDateTime,"Y-m-d H:i").';"'.$logInfoItem->event_type.'";"'.$logInfoItem->username.'";"'.$logInfoItem->event_content.'";'.PHP_EOL;
+ $string_encoded = iconv( mb_detect_encoding( $row ), 'ISO-8859-2', $row );
+ fwrite($logTxt, $string_encoded);
+ }
+ fclose($logTxt);
+ $data['logInfoLink'] = 'A loginfo.csv fájl letöltése ';
+ }
+
+ $this->load->view('log-monitor', $data);
+
+ }
+ else{
+ header("Location:".SITEURL."home");
+ }
+
+
+ }
+ else{
+ header("Location:".SITEURL."login");
+ }
+
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+}
diff --git a/application/controllers/UserManagement.php b/application/controllers/UserManagement.php
new file mode 100755
index 0000000..f6e1d07
--- /dev/null
+++ b/application/controllers/UserManagement.php
@@ -0,0 +1,233 @@
+
+ * @see https://codeigniter.com/user_guide/general/urls.html
+ */
+ public function index(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Log_model');
+ $this->load->model('Module_model');
+
+ if(isset($_SESSION['username'])){
+ $data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
+ $data['activeModules'] = $this->Module_model->getModulesByPermissionSlug($data['currentUser']->permission_slug);
+ $data['message'] = '';
+ $data['message_class'] = '';
+ $data['pageTitle'] = 'Felhasználó kezelése';
+
+ if($this->User_model->is_user_admin($_SESSION['username'])){
+ $data['activeModules'] = $this->Module_model->getAllModule();
+ }
+ else{
+ $data['activeModules'] = $this->Module_model->getUserModules($data['currentUser']->user_id);
+ }
+
+ $selectedModule = $this->Module_model->getModuleBySlug('user-management');
+ if($this->Module_model->user_can_access_this_module($selectedModule->module_slug, $data['currentUser']->user_id) || $data['currentUser']->permission_slug == 'admin'){
+ //delete user
+ if(isset($_GET['delete-user'])){
+ $selectedUser = $this->User_model->getUserById($_GET['delete-user']);
+ $this->Log_model->addLog('users', $data['currentUser']->username.' törölte a(z) '.$selectedUser->username.' felhasználót', $data['currentUser']->username);
+ $this->User_model->deleteUser($_GET['delete-user']);
+ header('Location:'.site_url().'user-management');
+ }
+ $data['users'] = $this->User_model->getAllUser();
+ $this->load->view('pages/user-management',$data);
+
+ }
+ else{
+ header("Location:".SITEURL."dashboard");
+ }
+
+
+ }
+ else{
+ header("Location:".SITEURL."login");
+ }
+
+ }
+
+ public function add_new_user(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Log_model');
+ $this->load->model('Module_model');
+
+ if(isset($_SESSION['username'])){
+ $data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
+ $data['activeModules'] = $this->Module_model->getModulesByPermissionSlug($data['currentUser']->permission_slug);
+ $data['message'] = '';
+ $data['message_class'] = '';
+ $data['pageTitle'] = 'Felhasználó létrehozása';
+
+ if($this->User_model->is_user_admin($_SESSION['username'])){
+ $data['activeModules'] = $this->Module_model->getAllModule();
+ }
+ else{
+ $data['activeModules'] = $this->Module_model->getUserModules($data['currentUser']->user_id);
+ }
+
+ $selectedModule = $this->Module_model->getModuleBySlug('user-management');
+ if($this->Module_model->user_can_access_this_module($selectedModule->module_slug, $data['currentUser']->user_id) || $data['currentUser']->permission_slug == 'admin'){
+ $data['permissions'] = $this->User_model->getAllUserPermission();
+
+
+ $this->load->view('pages/add-new-user',$data);
+ }
+ else{
+ header("Location:".SITEURL."home");
+ }
+
+
+ }
+ else{
+ header("Location:".SITEURL."login");
+ }
+
+ }
+
+ public function modify_user($user_id=''){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Log_model');
+ $this->load->model('Module_model');
+
+ if(isset($_SESSION['username'])){
+ $data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
+ $data['activeModules'] = $this->Module_model->getModulesByPermissionSlug($data['currentUser']->permission_slug);
+ $data['message'] = '';
+ $data['message_class'] = '';
+ $data['pageTitle'] = 'Felhasználók';
+
+ if($this->User_model->is_user_admin($_SESSION['username'])){
+ $data['activeModules'] = $this->Module_model->getAllModule();
+ }
+ else{
+ $data['activeModules'] = $this->Module_model->getUserModules($data['currentUser']->user_id);
+ }
+
+ $selectedModule = $this->Module_model->getModuleBySlug('user-management');
+ if($this->Module_model->user_can_access_this_module($selectedModule->module_slug, $data['currentUser']->user_id) || $data['currentUser']->permission_slug == 'admin'){
+
+ $data['selectedUser'] = $this->User_model->getUserById($user_id);
+ $data['permissions'] = $this->User_model->getAllUserPermission();
+ $this->load->view('pages/modify-user',$data);
+ }
+ else{
+ header("Location:".SITEURL."home");
+ }
+
+
+ }
+ else{
+ header("Location:".SITEURL."login");
+ }
+
+ }
+
+ public function user_process(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Log_model');
+ $this->load->model('Module_model');
+
+ if(isset($_SESSION['username'])){
+ $data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
+ $data['activeModules'] = $this->Module_model->getModulesByPermissionSlug($data['currentUser']->permission_slug);
+ $data['message'] = '';
+ $data['message_class'] = '';
+ $data['pageTitle'] = 'Felhasználók';
+
+ $selectedModule = $this->Module_model->getModuleBySlug('user-management');
+ if($this->Module_model->user_can_access_this_module($selectedModule->module_slug, $data['currentUser']->user_id) || $data['currentUser']->permission_slug == 'admin'){
+
+ //update user
+ if(isset($_POST['updateUser'])){
+ $userArray = array(
+ 'username' => $_POST['username'],
+ 'fullname' => $_POST['fullname'],
+ 'permission_slug' => $_POST['permission_slug'],
+ 'is_enabled' => $_POST['is_enabled'],
+ 'user_notes' => $_POST['user_notes']
+ );
+
+ if($_POST['password'] != ''){
+ $userArray['password'] = $_POST['password'];
+ }
+
+ $this->User_model->updateUser($_POST['user_id'], $userArray);
+
+ $userArray['permission_slug'] = $this->User_model->getPermissionBySlug($userArray['permission_slug'])->permission_name;
+
+ if($_POST['password'] != ''){
+ $userArray['password'] = '****';
+ }
+
+ $userArray['is_enabled'] = $userArray['is_enabled']?'aktív':'letiltva';
+ $userArray['user_notes'] = $userArray['user_notes'] != ''?$userArray['user_notes']:'nincs megjegyzés';
+
+ $this->Log_model->addLog('users', $data['currentUser']->username.' módosította a(z) '.$_POST['username'].' adatait ('.implode(', ', $userArray).')', $data['currentUser']->username);
+ }
+
+ //add new user
+ if(isset($_POST['addNewUser'])){
+ $userArray = array(
+ 'username' => $_POST['username'],
+ 'password' => $_POST['password'],
+ 'fullname' => $_POST['fullname'],
+ 'permission_slug' => $_POST['permission_slug'],
+ 'is_enabled' => $_POST['is_enabled'],
+ 'user_notes' => $_POST['user_notes']
+ );
+
+ $this->User_model->addNewUser($userArray);
+ $userArray['permission_id'] = $this->User_model->getpermissionBySlug($userArray['permission_slug'])->permission_slug;
+ $userArray['is_enabled'] = $userArray['is_enabled']?'aktív':'letiltva';
+ $userArray['user_notes'] = $userArray['user_notes'] != ''?$userArray['user_notes']:'nincs megjegyzés';
+ $userArray['password'] = '****';
+ $this->Log_model->addLog('users', $data['currentUser']->username.' létrehoza a(z) '.$_POST['username'].' felhasználót ('.implode(', ', $userArray).')', $data['currentUser']->username);
+ }
+
+ header("Location:".SITEURL."user-management");
+ //$this->load->view('pages/user-process',$data);
+
+ }
+ else{
+ header("Location:".SITEURL."home");
+ }
+
+
+ }
+ else{
+ header("Location:".SITEURL."login");
+ }
+
+ }
+
+
+
+
+
+
+
+
+
+
+
+}
diff --git a/application/controllers/index.html b/application/controllers/index.html
new file mode 100755
index 0000000..b48b490
--- /dev/null
+++ b/application/controllers/index.html
@@ -0,0 +1,11 @@
+
+
+
+ 403 Forbidden
+
+
+
+Directory access is forbidden.
+
+
+
diff --git a/application/controllers_20231211/Admin.php b/application/controllers_20231211/Admin.php
new file mode 100755
index 0000000..979906a
--- /dev/null
+++ b/application/controllers_20231211/Admin.php
@@ -0,0 +1,240 @@
+
+ * @see https://codeigniter.com/userguide3/general/urls.html
+ */
+ public function login(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+
+ if(isset($_SESSION['username'])){
+ $data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
+ $data['pageTitle'] = '';
+ $data['message'] = '';
+ $data['message_class'] = '';
+
+ $this->load->view('admin/login', $data);
+ }
+ }
+
+ public function users(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+
+ if(isset($_SESSION['username'])){
+ $data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
+ $data['pageTitle'] = '';
+ $data['message'] = '';
+ $data['message_class'] = '';
+
+ $this->load->view('admin/users', $data);
+ }
+ }
+
+ public function create_user(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+
+ if(isset($_SESSION['username'])){
+ $data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
+ $data['pageTitle'] = '';
+ $data['message'] = '';
+ $data['message_class'] = '';
+
+ $this->load->view('admin/create-user', $data);
+ }
+ }
+
+ public function update_user(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+
+ if(isset($_SESSION['username'])){
+ $data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
+ $data['pageTitle'] = '';
+ $data['message'] = '';
+ $data['message_class'] = '';
+
+ $this->load->view('admin/update-user', $data);
+ }
+ }
+
+ public function user_process(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+
+ if(isset($_SESSION['username'])){
+ $data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
+ $data['pageTitle'] = '';
+ $data['message'] = '';
+ $data['message_class'] = '';
+
+ $this->load->view('admin/user-process', $data);
+ }
+ }
+
+ public function services(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+
+ if(isset($_SESSION['username'])){
+ $data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
+ $data['pageTitle'] = '';
+ $data['message'] = '';
+ $data['message_class'] = '';
+
+ $this->load->view('admin/services', $data);
+ }
+ }
+
+ public function add_service(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+
+ if(isset($_SESSION['username'])){
+ $data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
+ $data['pageTitle'] = '';
+ $data['message'] = '';
+ $data['message_class'] = '';
+
+ $this->load->view('admin/add-service', $data);
+ }
+ }
+
+ public function update_service(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+
+ if(isset($_SESSION['username'])){
+ $data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
+ $data['pageTitle'] = '';
+ $data['message'] = '';
+ $data['message_class'] = '';
+
+ $this->load->view('admin/update-service', $data);
+ }
+ }
+
+ public function service_process(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+
+ if(isset($_SESSION['username'])){
+ $data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
+ $data['pageTitle'] = '';
+ $data['message'] = '';
+ $data['message_class'] = '';
+
+ $this->load->view('admin/service-process', $data);
+ }
+ }
+
+ public function workers(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+
+ if(isset($_SESSION['username'])){
+ $data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
+ $data['pageTitle'] = '';
+ $data['message'] = '';
+ $data['message_class'] = '';
+
+ $this->load->view('admin/workers', $data);
+ }
+ }
+
+ public function add_worker(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+
+ if(isset($_SESSION['username'])){
+ $data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
+ $data['pageTitle'] = '';
+ $data['message'] = '';
+ $data['message_class'] = '';
+
+ $this->load->view('admin/add-worker', $data);
+ }
+ }
+
+ public function update_worker(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+
+ if(isset($_SESSION['username'])){
+ $data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
+ $data['pageTitle'] = '';
+ $data['message'] = '';
+ $data['message_class'] = '';
+
+ $this->load->view('admin/update-worker', $data);
+ }
+ }
+
+ public function worker_process(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+
+ if(isset($_SESSION['username'])){
+ $data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
+ $data['pageTitle'] = '';
+ $data['message'] = '';
+ $data['message_class'] = '';
+
+ $this->load->view('admin/worker-process', $data);
+ }
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+}
diff --git a/application/controllers_20231211/Pages.php b/application/controllers_20231211/Pages.php
new file mode 100755
index 0000000..96bfdbd
--- /dev/null
+++ b/application/controllers_20231211/Pages.php
@@ -0,0 +1,315 @@
+
+ * @see https://codeigniter.com/userguide3/general/urls.html
+ */
+ public function index(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+
+ $data['pageTitle'] = '';
+ $this->load->view('pages/home', $data);
+ }
+
+ public function barber($lang){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+ $data['pageTitle'] = '';
+ $data['selectedLang'] = $lang;
+
+ $data['services'] = $this->Service_model->getAllServiceByServiceType('barber', $lang);
+ $this->load->view('pages/barber', $data);
+ }
+
+ public function beauty($lang){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+ $data['pageTitle'] = '';
+ $data['selectedLang'] = $lang;
+
+ $data['services'] = $this->Service_model->getAllServiceByServiceType('beauty', $lang);
+ $this->load->view('pages/beauty', $data);
+ }
+
+ public function booking($lang, $subpage){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+
+ $data['pageTitle'] = '';
+ $data['selectedLang'] = $lang;
+ $data['subpage'] = $subpage;
+
+ $data['services'] = $this->Service_model->getAllServiceByServiceType($subpage, $lang);
+ $data['workers'] = $this->Service_model->getAllWorkers();
+
+ switch($subpage){
+ case 'barber':
+ $this->load->view('pages/barber-booking', $data);
+ break;
+ case 'beauty':
+ $this->load->view('pages/beauty-booking', $data);
+ break;
+ default:
+ header('Location:'.SITEURL);
+ }
+ }
+
+ public function booking_finished($lang, $subpage){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+ $data['pageTitle'] = '';
+ $data['selectedLang'] = $lang;
+
+ switch($subpage){
+ case 'barber':
+ $this->load->view('pages/barber-booking-finished', $data);
+ break;
+ case 'beauty':
+ $this->load->view('pages/beauty-booking-finished', $data);
+ break;
+ default:
+ header('Location:'.SITEURL);
+ }
+ }
+
+ public function email_verification(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+
+ $data['pageTitle'] = '';
+ $this->load->view('pages/email-verification', $data);
+ }
+
+ public function ajax(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+
+ $data['pageTitle'] = '';
+
+ if(isset($_POST['action']) && $_POST['action'] == 'getAvailableTimes' && isset($_POST['selectedDate'])){
+ $results = $this->Service_model->getAvailableTimes($_POST['worker_id'], $_POST['selectedDate'], $_POST['servicelength']);
+
+ if(!empty($results)){
+ foreach($results as $resultIem){
+ ?>
+
+ load->view('pages/ajax', $data);
+ }
+
+
+ public function booking_process(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+
+ $data['pageTitle'] = '';
+
+ //calculate finish time
+ $serviceStartTime = date("H:i:s", strtotime($_POST['booking_start_time']));
+ $serviceLengthTime = date("H:i:s", strtotime($_POST['servicelength']));
+ $secs = strtotime($serviceLengthTime)-strtotime("00:00:00");
+ $serviceFinishTime = date("H:i:s",strtotime($serviceStartTime)+$secs);
+
+ $data['services'] = $this->Service_model->getAllServiceByServiceType($_POST['subpage'], $_POST['lang']);
+ $data['workers'] = $this->Service_model->getAllWorkers();
+ $data['selectedLang'] = 'en';
+ $selectedServiceArray = array();
+
+ //find selected services
+ if(is_array($data['services'])){
+ foreach($data['services'] as $serviceItem){
+ if(isset($_POST['service_'.$serviceItem->service_id])){
+ if($_POST['service_'.$serviceItem->service_id]){
+ $selectedServiceArray[] = $serviceItem->service_id;
+ }
+ }
+ }
+ }
+
+ if(isset($_POST['sendBooking'])){
+
+ $bookingArray = array(
+ 'guest_name' => $_POST['guest_name'],
+ 'guest_email' => $_POST['guest_email'],
+ 'guest_phone' => $_POST['guest_phone'],
+ 'worker_id' => $_POST['worker_id'],
+ 'booking_date' => $_POST['booking_date'],
+ 'booking_start_time' => $_POST['booking_start_time'],
+ 'booking_finish_time' => $serviceFinishTime,
+ 'service_ids' => serialize($selectedServiceArray),
+ 'guest_confirmed' => '0',
+ 'guest_confirm_code' => '1234',
+ );
+
+ $this->Service_model->createBooking($bookingArray);
+ $worker = $this->Service_model->getWorkerById($bookingArray['worker_id']);
+
+ $services = unserialize($bookingArray['service_ids']);
+ $serviceArray = array();
+
+ if(is_array($services)){
+ foreach($services as $serviceItem){
+ $selectedService = $this->Service_model->getServiceById($serviceItem);
+ if(is_object($selectedService)){
+ $serviceArray[] = $selectedService;
+ }
+ }
+ }
+
+ $content = '';
+
+ switch($_POST['lang']){
+ case 'no':
+ $content = 'Kjære gjest, ';
+ $content .= 'Takk for din bestilling! ';
+ $content .= ' ';
+ $content .= '';
+ $content .= 'Navn: '.$bookingArray['guest_name'].' ';
+ $content .= 'E-post: '.$bookingArray['guest_email'].' ';
+ $content .= 'Telefon: '.$bookingArray['guest_phone'].' ';
+ $content .= 'Arbeider: '.$worker->worker_name.' ';
+ $content .= 'Dato: '.$bookingArray['booking_date'].' ';
+ $content .= 'Tid: '.$bookingArray['booking_start_time'].' - '.$bookingArray['booking_finish_time'].' ';
+ $content .= 'Tjenester: ';
+ $totalServicePrice = 0;
+ foreach($serviceArray as $serviceArrayItem){
+ $totalServicePrice += $serviceArrayItem->service_price;
+ $content .= ''.$serviceArrayItem->service_name_no.' '.$serviceArrayItem->service_price.' kr ';
+ }
+ $content .= '
';
+ $content .= 'Totalpris: '.$totalServicePrice.' kr ';
+ $content .= '
';
+ $content .= ' STUDIOBEVE';
+ break;
+ case 'en':
+ $content = 'Dear Guest, ';
+ $content .= 'Thank you for your booking! ';
+ $content .= ' ';
+ $content .= '';
+ $content .= 'Name: '.$bookingArray['guest_name'].' ';
+ $content .= 'Email: '.$bookingArray['guest_email'].' ';
+ $content .= 'Phone: '.$bookingArray['guest_phone'].' ';
+ $content .= 'Worker: '.$worker->worker_name.' ';
+ $content .= 'Date: '.$bookingArray['booking_date'].' ';
+ $content .= 'Time: '.$bookingArray['booking_start_time'].' - '.$bookingArray['booking_finish_time'].' ';
+ $content .= 'Services: ';
+ $totalServicePrice = 0;
+ foreach($serviceArray as $serviceArrayItem){
+ $totalServicePrice += $serviceArrayItem->service_price;
+ $content .= ''.$serviceArrayItem->service_name_en.' '.$serviceArrayItem->service_price.' kr ';
+ }
+ $content .= '
';
+ $content .= 'Total price: '.$totalServicePrice.' kr ';
+ $content .= '
';
+ $content .= ' STUDIOBEVE';
+ break;
+ case 'hu':
+ $content = 'Kedves Vendégünk, ';
+ $content .= 'Köszönettel fogadtuk a foglalását! ';
+ $content .= ' ';
+ $content .= '';
+ $content .= 'Név: '.$bookingArray['guest_name'].' ';
+ $content .= 'Email: '.$bookingArray['guest_email'].' ';
+ $content .= 'Telefon: '.$bookingArray['guest_phone'].' ';
+ $content .= 'Dolgozó: '.$worker->worker_name.' ';
+ $content .= 'Dátum: '.$bookingArray['booking_date'].' ';
+ $content .= 'Időpont: '.$bookingArray['booking_start_time'].' - '.$bookingArray['booking_finish_time'].' ';
+ $content .= 'Szolgáltatás(ok): ';
+ $totalServicePrice = 0;
+ foreach($serviceArray as $serviceArrayItem){
+ $totalServicePrice += $serviceArrayItem->service_price;
+ $content .= ''.$serviceArrayItem->service_name_hu.' '.$serviceArrayItem->service_price.' kr ';
+ }
+ $content .= '
';
+ $content .= 'Összesen fizetendő: '.$totalServicePrice.' kr ';
+ $content .= '
';
+ $content .= ' STUDIOBEVE';
+ break;
+ }
+
+ $data['selectedLang'] = $_POST['lang'];
+ $emailArray = array();
+ $emailItem = array(
+ 'addressee_email' => $bookingArray['guest_email'],
+ 'addressee_name' => $bookingArray['guest_name'],
+ 'subject' => '[studiobeve] Your booking has arrived',
+ 'content' => $content,
+ 'attachments' => array()
+ );
+ $emailArray[] = $emailItem;
+ $this->User_model->sendEmail($emailArray, $_POST['lang'], $_POST['subpage']);
+echo SITEURL.$_POST['lang'].'/booking-finished/'.$_POST['subpage'];
+ //header('Location:'.SITEURL.$_POST['lang'].'/booking-finished/'.$_POST['subpage']);
+ }
+
+ $this->load->view('pages/booking-process', $data);
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+}
diff --git a/application/controllers_20231211/index.html b/application/controllers_20231211/index.html
new file mode 100755
index 0000000..b48b490
--- /dev/null
+++ b/application/controllers_20231211/index.html
@@ -0,0 +1,11 @@
+
+
+
+ 403 Forbidden
+
+
+
+Directory access is forbidden.
+
+
+
diff --git a/application/controllers_20240401/Admin.php b/application/controllers_20240401/Admin.php
new file mode 100755
index 0000000..979906a
--- /dev/null
+++ b/application/controllers_20240401/Admin.php
@@ -0,0 +1,240 @@
+
+ * @see https://codeigniter.com/userguide3/general/urls.html
+ */
+ public function login(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+
+ if(isset($_SESSION['username'])){
+ $data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
+ $data['pageTitle'] = '';
+ $data['message'] = '';
+ $data['message_class'] = '';
+
+ $this->load->view('admin/login', $data);
+ }
+ }
+
+ public function users(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+
+ if(isset($_SESSION['username'])){
+ $data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
+ $data['pageTitle'] = '';
+ $data['message'] = '';
+ $data['message_class'] = '';
+
+ $this->load->view('admin/users', $data);
+ }
+ }
+
+ public function create_user(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+
+ if(isset($_SESSION['username'])){
+ $data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
+ $data['pageTitle'] = '';
+ $data['message'] = '';
+ $data['message_class'] = '';
+
+ $this->load->view('admin/create-user', $data);
+ }
+ }
+
+ public function update_user(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+
+ if(isset($_SESSION['username'])){
+ $data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
+ $data['pageTitle'] = '';
+ $data['message'] = '';
+ $data['message_class'] = '';
+
+ $this->load->view('admin/update-user', $data);
+ }
+ }
+
+ public function user_process(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+
+ if(isset($_SESSION['username'])){
+ $data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
+ $data['pageTitle'] = '';
+ $data['message'] = '';
+ $data['message_class'] = '';
+
+ $this->load->view('admin/user-process', $data);
+ }
+ }
+
+ public function services(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+
+ if(isset($_SESSION['username'])){
+ $data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
+ $data['pageTitle'] = '';
+ $data['message'] = '';
+ $data['message_class'] = '';
+
+ $this->load->view('admin/services', $data);
+ }
+ }
+
+ public function add_service(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+
+ if(isset($_SESSION['username'])){
+ $data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
+ $data['pageTitle'] = '';
+ $data['message'] = '';
+ $data['message_class'] = '';
+
+ $this->load->view('admin/add-service', $data);
+ }
+ }
+
+ public function update_service(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+
+ if(isset($_SESSION['username'])){
+ $data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
+ $data['pageTitle'] = '';
+ $data['message'] = '';
+ $data['message_class'] = '';
+
+ $this->load->view('admin/update-service', $data);
+ }
+ }
+
+ public function service_process(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+
+ if(isset($_SESSION['username'])){
+ $data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
+ $data['pageTitle'] = '';
+ $data['message'] = '';
+ $data['message_class'] = '';
+
+ $this->load->view('admin/service-process', $data);
+ }
+ }
+
+ public function workers(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+
+ if(isset($_SESSION['username'])){
+ $data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
+ $data['pageTitle'] = '';
+ $data['message'] = '';
+ $data['message_class'] = '';
+
+ $this->load->view('admin/workers', $data);
+ }
+ }
+
+ public function add_worker(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+
+ if(isset($_SESSION['username'])){
+ $data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
+ $data['pageTitle'] = '';
+ $data['message'] = '';
+ $data['message_class'] = '';
+
+ $this->load->view('admin/add-worker', $data);
+ }
+ }
+
+ public function update_worker(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+
+ if(isset($_SESSION['username'])){
+ $data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
+ $data['pageTitle'] = '';
+ $data['message'] = '';
+ $data['message_class'] = '';
+
+ $this->load->view('admin/update-worker', $data);
+ }
+ }
+
+ public function worker_process(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+
+ if(isset($_SESSION['username'])){
+ $data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
+ $data['pageTitle'] = '';
+ $data['message'] = '';
+ $data['message_class'] = '';
+
+ $this->load->view('admin/worker-process', $data);
+ }
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+}
diff --git a/application/controllers_20240401/Pages.php b/application/controllers_20240401/Pages.php
new file mode 100755
index 0000000..c09afcb
--- /dev/null
+++ b/application/controllers_20240401/Pages.php
@@ -0,0 +1,333 @@
+
+ * @see https://codeigniter.com/userguide3/general/urls.html
+ */
+ public function index(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+
+ $data['pageTitle'] = '';
+ $this->load->view('pages/home', $data);
+ }
+
+ public function barber($lang){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+ $data['pageTitle'] = '';
+ $data['selectedLang'] = $lang;
+
+ $data['services'] = $this->Service_model->getAllServiceByServiceType('barber', $lang);
+ $this->load->view('pages/barber', $data);
+ }
+
+ public function beauty($lang){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+ $data['pageTitle'] = '';
+ $data['selectedLang'] = $lang;
+
+ $data['services'] = $this->Service_model->getAllServiceByServiceType('beauty', $lang);
+ $this->load->view('pages/beauty', $data);
+ }
+
+ public function booking($lang, $subpage){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+
+ $data['pageTitle'] = '';
+ $data['selectedLang'] = $lang;
+ $data['subpage'] = $subpage;
+
+ $data['services'] = $this->Service_model->getAllServiceByServiceType($subpage, $lang);
+ $data['workers'] = $this->Service_model->getAllWorkers();
+
+ switch($subpage){
+ case 'barber':
+ $this->load->view('pages/barber-booking', $data);
+ break;
+ case 'beauty':
+ $this->load->view('pages/beauty-booking', $data);
+ break;
+ default:
+ header('Location:'.SITEURL);
+ }
+ }
+
+ public function booking_finished($lang, $subpage){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+ $data['pageTitle'] = '';
+ $data['selectedLang'] = $lang;
+
+ switch($subpage){
+ case 'barber':
+ $this->load->view('pages/barber-booking-finished', $data);
+ break;
+ case 'beauty':
+ $this->load->view('pages/beauty-booking-finished', $data);
+ break;
+ default:
+ header('Location:'.SITEURL);
+ }
+ }
+
+ public function email_verification(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+
+ $data['pageTitle'] = '';
+ $this->load->view('pages/email-verification', $data);
+ }
+
+ public function ajax(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+
+ $data['pageTitle'] = '';
+
+ if(isset($_POST['action']) && $_POST['action'] == 'getAvailableTimes' && isset($_POST['selectedDate'])){
+ $results = $this->Service_model->getAvailableTimes($_POST['worker_id'], $_POST['selectedDate'], $_POST['servicelength']);
+
+ $rowIndex = 1;
+ if(!empty($results)){
+ foreach($results as $resultIem){
+ ?>
+
+ Service_model->getWorkerById($_POST['worker_id']);
+
+ if(is_object($result)){
+ ?>
+
+ worker_name;?>
+ load->view('pages/ajax', $data);
+ }
+
+
+ public function booking_process(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+
+ $data['pageTitle'] = '';
+
+ //calculate finish time
+ $serviceStartTime = date("H:i:s", strtotime($_POST['booking_start_time']));
+ $serviceLengthTime = date("H:i:s", strtotime($_POST['servicelength']));
+ $secs = strtotime($serviceLengthTime)-strtotime("00:00:00");
+ $serviceFinishTime = date("H:i:s",strtotime($serviceStartTime)+$secs);
+
+ $data['services'] = $this->Service_model->getAllServiceByServiceType($_POST['subpage'], $_POST['lang']);
+ $data['workers'] = $this->Service_model->getAllWorkers();
+ $data['selectedLang'] = 'en';
+ $selectedServiceArray = array();
+
+ //find selected services
+ if(is_array($data['services'])){
+ foreach($data['services'] as $serviceItem){
+ if(isset($_POST['service_'.$serviceItem->service_id])){
+ if($_POST['service_'.$serviceItem->service_id]){
+ $selectedServiceArray[] = $serviceItem->service_id;
+ }
+ }
+ }
+ }
+
+ if(isset($_POST['sendBooking'])){
+
+ $bookingArray = array(
+ 'guest_name' => $_POST['guest_name'],
+ 'guest_email' => $_POST['guest_email'],
+ 'guest_phone' => $_POST['guest_phone'],
+ 'worker_id' => $_POST['worker_id'],
+ 'booking_date' => $_POST['booking_date'],
+ 'booking_start_time' => $_POST['booking_start_time'],
+ 'booking_finish_time' => $serviceFinishTime,
+ 'service_ids' => serialize($selectedServiceArray),
+ 'guest_confirmed' => '0',
+ 'guest_confirm_code' => '1234',
+ );
+
+ $this->Service_model->createBooking($bookingArray);
+ $worker = $this->Service_model->getWorkerById($bookingArray['worker_id']);
+
+ $services = unserialize($bookingArray['service_ids']);
+ $serviceArray = array();
+ $emailArray = array();
+
+ if(is_array($services)){
+ foreach($services as $serviceItem){
+ $selectedService = $this->Service_model->getServiceById($serviceItem);
+ if(is_object($selectedService)){
+ $serviceArray[] = $selectedService;
+ }
+ }
+ }
+
+ $content = '';
+
+ switch($_POST['lang']){
+ case 'no':
+ $content = 'Kjære gjest, ';
+ $content .= 'Takk for din bestilling! ';
+ $content .= ' ';
+ $content .= '';
+ $content .= 'Navn: '.$bookingArray['guest_name'].' ';
+ $content .= 'E-post: '.$bookingArray['guest_email'].' ';
+ $content .= 'Telefon: '.$bookingArray['guest_phone'].' ';
+ $content .= 'Arbeider: '.$worker->worker_name.' ';
+ $content .= 'Dato: '.$bookingArray['booking_date'].' ';
+ $content .= 'Tid: '.$bookingArray['booking_start_time'].' - '.$bookingArray['booking_finish_time'].' ';
+ $content .= 'Tjenester: ';
+ $totalServicePrice = 0;
+ foreach($serviceArray as $serviceArrayItem){
+ $totalServicePrice += $serviceArrayItem->service_price;
+ $content .= ''.$serviceArrayItem->service_name_no.' '.$serviceArrayItem->service_price.' kr ';
+ }
+ $content .= '
';
+ $content .= 'Totalpris: '.$totalServicePrice.' kr ';
+ $content .= '
';
+ $content .= ' STUDIOBEVE';
+ break;
+ case 'en':
+ $content = 'Dear Guest, ';
+ $content .= 'Thank you for your booking! ';
+ $content .= ' ';
+ $content .= '';
+ $content .= 'Name: '.$bookingArray['guest_name'].' ';
+ $content .= 'Email: '.$bookingArray['guest_email'].' ';
+ $content .= 'Phone: '.$bookingArray['guest_phone'].' ';
+ $content .= 'Worker: '.$worker->worker_name.' ';
+ $content .= 'Date: '.$bookingArray['booking_date'].' ';
+ $content .= 'Time: '.$bookingArray['booking_start_time'].' - '.$bookingArray['booking_finish_time'].' ';
+ $content .= 'Services: ';
+ $totalServicePrice = 0;
+ foreach($serviceArray as $serviceArrayItem){
+ $totalServicePrice += $serviceArrayItem->service_price;
+ $content .= ''.$serviceArrayItem->service_name_en.' '.$serviceArrayItem->service_price.' kr ';
+ }
+ $content .= '
';
+ $content .= 'Total price: '.$totalServicePrice.' kr ';
+ $content .= '
';
+ $content .= ' STUDIOBEVE';
+ break;
+ case 'hu':
+ $content = 'Kedves Vendégünk, ';
+ $content .= 'Köszönettel fogadtuk a foglalását! ';
+ $content .= ' ';
+ $content .= '';
+ $content .= 'Név: '.$bookingArray['guest_name'].' ';
+ $content .= 'Email: '.$bookingArray['guest_email'].' ';
+ $content .= 'Telefon: '.$bookingArray['guest_phone'].' ';
+ $content .= 'Dolgozó: '.$worker->worker_name.' ';
+ $content .= 'Dátum: '.$bookingArray['booking_date'].' ';
+ $content .= 'Időpont: '.$bookingArray['booking_start_time'].' - '.$bookingArray['booking_finish_time'].' ';
+ $content .= 'Szolgáltatás(ok): ';
+ $totalServicePrice = 0;
+ foreach($serviceArray as $serviceArrayItem){
+ $totalServicePrice += $serviceArrayItem->service_price;
+ $content .= ''.$serviceArrayItem->service_name_hu.' '.$serviceArrayItem->service_price.' kr ';
+ }
+ $content .= '
';
+ $content .= 'Összesen fizetendő: '.$totalServicePrice.' kr ';
+ $content .= '
';
+ $content .= ' STUDIOBEVE';
+ break;
+ }
+
+ $data['selectedLang'] = $_POST['lang'];
+
+ $emailItem = array(
+ 'addressee_email' => $bookingArray['guest_email'],
+ 'addressee_name' => $bookingArray['guest_name'],
+ 'subject' => '[studiobeve] Your booking has arrived',
+ 'content' => $content,
+ 'attachments' => array()
+ );
+ $emailArray[] = $emailItem;
+ //header('Location:'.SITEURL.$_POST['lang'].'/booking-finished/'.$_POST['subpage']);
+ }
+
+ $this->User_model->sendEmail($emailArray, $_POST['lang'], $_POST['subpage']);
+ $this->load->view('pages/booking-process', $data);
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+}
diff --git a/application/controllers_20240401/Pages_20240111.php b/application/controllers_20240401/Pages_20240111.php
new file mode 100755
index 0000000..368c90b
--- /dev/null
+++ b/application/controllers_20240401/Pages_20240111.php
@@ -0,0 +1,332 @@
+
+ * @see https://codeigniter.com/userguide3/general/urls.html
+ */
+ public function index(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+
+ $data['pageTitle'] = '';
+ $this->load->view('pages/home', $data);
+ }
+
+ public function barber($lang){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+ $data['pageTitle'] = '';
+ $data['selectedLang'] = $lang;
+
+ $data['services'] = $this->Service_model->getAllServiceByServiceType('barber', $lang);
+ $this->load->view('pages/barber', $data);
+ }
+
+ public function beauty($lang){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+ $data['pageTitle'] = '';
+ $data['selectedLang'] = $lang;
+
+ $data['services'] = $this->Service_model->getAllServiceByServiceType('beauty', $lang);
+ $this->load->view('pages/beauty', $data);
+ }
+
+ public function booking($lang, $subpage){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+
+ $data['pageTitle'] = '';
+ $data['selectedLang'] = $lang;
+ $data['subpage'] = $subpage;
+
+ $data['services'] = $this->Service_model->getAllServiceByServiceType($subpage, $lang);
+ $data['workers'] = $this->Service_model->getAllWorkers();
+
+ switch($subpage){
+ case 'barber':
+ $this->load->view('pages/barber-booking', $data);
+ break;
+ case 'beauty':
+ $this->load->view('pages/beauty-booking', $data);
+ break;
+ default:
+ header('Location:'.SITEURL);
+ }
+ }
+
+ public function booking_finished($lang, $subpage){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+ $data['pageTitle'] = '';
+ $data['selectedLang'] = $lang;
+
+ switch($subpage){
+ case 'barber':
+ $this->load->view('pages/barber-booking-finished', $data);
+ break;
+ case 'beauty':
+ $this->load->view('pages/beauty-booking-finished', $data);
+ break;
+ default:
+ header('Location:'.SITEURL);
+ }
+ }
+
+ public function email_verification(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+
+ $data['pageTitle'] = '';
+ $this->load->view('pages/email-verification', $data);
+ }
+
+ public function ajax(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+
+ $data['pageTitle'] = '';
+
+ if(isset($_POST['action']) && $_POST['action'] == 'getAvailableTimes' && isset($_POST['selectedDate'])){
+ $results = $this->Service_model->getAvailableTimes($_POST['worker_id'], $_POST['selectedDate'], $_POST['servicelength']);
+
+ $rowIndex = 1;
+ if(!empty($results)){
+ foreach($results as $resultIem){
+ ?>
+
+ Service_model->getWorkerById($_POST['worker_id']);
+
+ if(is_object($result)){
+ ?>
+
+ worker_name;?>
+ load->view('pages/ajax', $data);
+ }
+
+
+ public function booking_process(){
+ $this->load->helper('url');
+ $this->load->model('User_model');
+ $this->load->model('Service_model');
+
+ $data['pageTitle'] = '';
+
+ //calculate finish time
+ $serviceStartTime = date("H:i:s", strtotime($_POST['booking_start_time']));
+ $serviceLengthTime = date("H:i:s", strtotime($_POST['servicelength']));
+ $secs = strtotime($serviceLengthTime)-strtotime("00:00:00");
+ $serviceFinishTime = date("H:i:s",strtotime($serviceStartTime)+$secs);
+
+ $data['services'] = $this->Service_model->getAllServiceByServiceType($_POST['subpage'], $_POST['lang']);
+ $data['workers'] = $this->Service_model->getAllWorkers();
+ $data['selectedLang'] = 'en';
+ $selectedServiceArray = array();
+
+ //find selected services
+ if(is_array($data['services'])){
+ foreach($data['services'] as $serviceItem){
+ if(isset($_POST['service_'.$serviceItem->service_id])){
+ if($_POST['service_'.$serviceItem->service_id]){
+ $selectedServiceArray[] = $serviceItem->service_id;
+ }
+ }
+ }
+ }
+
+ if(isset($_POST['sendBooking'])){
+
+ $bookingArray = array(
+ 'guest_name' => $_POST['guest_name'],
+ 'guest_email' => $_POST['guest_email'],
+ 'guest_phone' => $_POST['guest_phone'],
+ 'worker_id' => $_POST['worker_id'],
+ 'booking_date' => $_POST['booking_date'],
+ 'booking_start_time' => $_POST['booking_start_time'],
+ 'booking_finish_time' => $serviceFinishTime,
+ 'service_ids' => serialize($selectedServiceArray),
+ 'guest_confirmed' => '0',
+ 'guest_confirm_code' => '1234',
+ );
+
+ $this->Service_model->createBooking($bookingArray);
+ $worker = $this->Service_model->getWorkerById($bookingArray['worker_id']);
+
+ $services = unserialize($bookingArray['service_ids']);
+ $serviceArray = array();
+
+ if(is_array($services)){
+ foreach($services as $serviceItem){
+ $selectedService = $this->Service_model->getServiceById($serviceItem);
+ if(is_object($selectedService)){
+ $serviceArray[] = $selectedService;
+ }
+ }
+ }
+
+ $content = '';
+
+ switch($_POST['lang']){
+ case 'no':
+ $content = 'Kjære gjest, ';
+ $content .= 'Takk for din bestilling! ';
+ $content .= ' ';
+ $content .= '';
+ $content .= 'Navn: '.$bookingArray['guest_name'].' ';
+ $content .= 'E-post: '.$bookingArray['guest_email'].' ';
+ $content .= 'Telefon: '.$bookingArray['guest_phone'].' ';
+ $content .= 'Arbeider: '.$worker->worker_name.' ';
+ $content .= 'Dato: '.$bookingArray['booking_date'].' ';
+ $content .= 'Tid: '.$bookingArray['booking_start_time'].' - '.$bookingArray['booking_finish_time'].' ';
+ $content .= 'Tjenester: ';
+ $totalServicePrice = 0;
+ foreach($serviceArray as $serviceArrayItem){
+ $totalServicePrice += $serviceArrayItem->service_price;
+ $content .= ''.$serviceArrayItem->service_name_no.' '.$serviceArrayItem->service_price.' kr ';
+ }
+ $content .= '
';
+ $content .= 'Totalpris: '.$totalServicePrice.' kr ';
+ $content .= '
';
+ $content .= ' STUDIOBEVE';
+ break;
+ case 'en':
+ $content = 'Dear Guest, ';
+ $content .= 'Thank you for your booking! ';
+ $content .= ' ';
+ $content .= '';
+ $content .= 'Name: '.$bookingArray['guest_name'].' ';
+ $content .= 'Email: '.$bookingArray['guest_email'].' ';
+ $content .= 'Phone: '.$bookingArray['guest_phone'].' ';
+ $content .= 'Worker: '.$worker->worker_name.' ';
+ $content .= 'Date: '.$bookingArray['booking_date'].' ';
+ $content .= 'Time: '.$bookingArray['booking_start_time'].' - '.$bookingArray['booking_finish_time'].' ';
+ $content .= 'Services: ';
+ $totalServicePrice = 0;
+ foreach($serviceArray as $serviceArrayItem){
+ $totalServicePrice += $serviceArrayItem->service_price;
+ $content .= ''.$serviceArrayItem->service_name_en.' '.$serviceArrayItem->service_price.' kr ';
+ }
+ $content .= '
';
+ $content .= 'Total price: '.$totalServicePrice.' kr ';
+ $content .= '
';
+ $content .= ' STUDIOBEVE';
+ break;
+ case 'hu':
+ $content = 'Kedves Vendégünk, ';
+ $content .= 'Köszönettel fogadtuk a foglalását! ';
+ $content .= ' ';
+ $content .= '';
+ $content .= 'Név: '.$bookingArray['guest_name'].' ';
+ $content .= 'Email: '.$bookingArray['guest_email'].' ';
+ $content .= 'Telefon: '.$bookingArray['guest_phone'].' ';
+ $content .= 'Dolgozó: '.$worker->worker_name.' ';
+ $content .= 'Dátum: '.$bookingArray['booking_date'].' ';
+ $content .= 'Időpont: '.$bookingArray['booking_start_time'].' - '.$bookingArray['booking_finish_time'].' ';
+ $content .= 'Szolgáltatás(ok): ';
+ $totalServicePrice = 0;
+ foreach($serviceArray as $serviceArrayItem){
+ $totalServicePrice += $serviceArrayItem->service_price;
+ $content .= ''.$serviceArrayItem->service_name_hu.' '.$serviceArrayItem->service_price.' kr ';
+ }
+ $content .= '
';
+ $content .= 'Összesen fizetendő: '.$totalServicePrice.' kr ';
+ $content .= '
';
+ $content .= ' STUDIOBEVE';
+ break;
+ }
+
+ $data['selectedLang'] = $_POST['lang'];
+ $emailArray = array();
+ $emailItem = array(
+ 'addressee_email' => $bookingArray['guest_email'],
+ 'addressee_name' => $bookingArray['guest_name'],
+ 'subject' => '[studiobeve] Your booking has arrived',
+ 'content' => $content,
+ 'attachments' => array()
+ );
+ $emailArray[] = $emailItem;
+ $this->User_model->sendEmail($emailArray, $_POST['lang'], $_POST['subpage']);
+ //header('Location:'.SITEURL.$_POST['lang'].'/booking-finished/'.$_POST['subpage']);
+ }
+
+ $this->load->view('pages/booking-process', $data);
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+}
diff --git a/application/controllers_20240401/index.html b/application/controllers_20240401/index.html
new file mode 100755
index 0000000..b48b490
--- /dev/null
+++ b/application/controllers_20240401/index.html
@@ -0,0 +1,11 @@
+
+
+
+ 403 Forbidden
+
+
+
+Directory access is forbidden.
+
+
+
diff --git a/application/core/index.html b/application/core/index.html
new file mode 100755
index 0000000..b48b490
--- /dev/null
+++ b/application/core/index.html
@@ -0,0 +1,11 @@
+
+
+
+ 403 Forbidden
+
+
+
+Directory access is forbidden.
+
+
+
diff --git a/application/helpers/index.html b/application/helpers/index.html
new file mode 100755
index 0000000..b48b490
--- /dev/null
+++ b/application/helpers/index.html
@@ -0,0 +1,11 @@
+
+
+
+ 403 Forbidden
+
+
+
+Directory access is forbidden.
+
+
+
diff --git a/application/hooks/index.html b/application/hooks/index.html
new file mode 100755
index 0000000..b48b490
--- /dev/null
+++ b/application/hooks/index.html
@@ -0,0 +1,11 @@
+
+
+
+ 403 Forbidden
+
+
+
+Directory access is forbidden.
+
+
+
diff --git a/application/index.html b/application/index.html
new file mode 100755
index 0000000..b48b490
--- /dev/null
+++ b/application/index.html
@@ -0,0 +1,11 @@
+
+
+
+ 403 Forbidden
+
+
+
+Directory access is forbidden.
+
+
+
diff --git a/application/language/english/index.html b/application/language/english/index.html
new file mode 100755
index 0000000..b48b490
--- /dev/null
+++ b/application/language/english/index.html
@@ -0,0 +1,11 @@
+
+
+
+ 403 Forbidden
+
+
+
+Directory access is forbidden.
+
+
+
diff --git a/application/language/index.html b/application/language/index.html
new file mode 100755
index 0000000..b48b490
--- /dev/null
+++ b/application/language/index.html
@@ -0,0 +1,11 @@
+
+
+
+ 403 Forbidden
+
+
+
+Directory access is forbidden.
+
+
+
diff --git a/application/libraries/index.html b/application/libraries/index.html
new file mode 100755
index 0000000..b48b490
--- /dev/null
+++ b/application/libraries/index.html
@@ -0,0 +1,11 @@
+
+
+
+ 403 Forbidden
+
+
+
+Directory access is forbidden.
+
+
+
diff --git a/application/logs/index.html b/application/logs/index.html
new file mode 100755
index 0000000..b48b490
--- /dev/null
+++ b/application/logs/index.html
@@ -0,0 +1,11 @@
+
+
+
+ 403 Forbidden
+
+
+
+Directory access is forbidden.
+
+
+
diff --git a/application/models/Log_model.php b/application/models/Log_model.php
new file mode 100755
index 0000000..a1710cb
--- /dev/null
+++ b/application/models/Log_model.php
@@ -0,0 +1,24 @@
+load->database();
+ $query = $this->db->query("INSERT INTO system_log(event_type, event_content, username) VALUES('".$eventType."','".$eventContent."','".$username."');");
+ }
+
+ public function getAllLoginfo(){
+ $this->load->database();
+ $query = $this->db->query('SELECT * FROM system_log ORDER BY event_datetime DESC;');
+ return $query->result();
+ }
+
+
+
+
+}
+
+?>
\ No newline at end of file
diff --git a/application/models/Module_model.php b/application/models/Module_model.php
new file mode 100755
index 0000000..2db0283
--- /dev/null
+++ b/application/models/Module_model.php
@@ -0,0 +1,252 @@
+load->database();
+ $query = $this->db->query('SELECT * FROM modules ORDER BY module_name ASC');
+ return $query->result();
+ }
+
+ public function getModuleById($module_id){
+ $this->load->database();
+ $query = $this->db->query('SELECT * FROM modules WHERE module_id = "'.$module_id.'" LIMIT 1;');
+ return $query->result()[0];
+ }
+
+ public function getModuleBySlug($module_slug){
+ $this->load->database();
+ $query = $this->db->query('SELECT * FROM modules WHERE module_slug = "'.$module_slug.'" LIMIT 1;');
+ return $query->result()[0];
+ }
+
+ public function getUserModules($userId){
+ $this->load->database();
+ $this->load->model('User_model');
+
+ $currentUser = $this->User_model->getUserById($userId);
+
+ $query = $this->db->query('SELECT * FROM modules');
+ $all_module = $query->result();
+ $activeModules = array();
+ $activeModuleIds = array();
+
+ foreach($all_module as $moduleItem){
+
+ //check groupmodules
+ $moduleGroupIds = unserialize($moduleItem->permission_group_ids);
+ $moduleUserIds = unserialize($moduleItem->permission_ids);
+
+ if(!empty($moduleItem->permission_ids)){
+ }
+
+ //check group ids
+ if(is_array($moduleGroupIds)){
+ if(in_array($currentUser->permission_id, $moduleGroupIds)){
+ if(!in_array($moduleItem->module_id, $activeModuleIds)){
+
+ $activeModules[] = $moduleItem;
+ $activeModuleIds[] = $moduleItem->module_id;
+
+
+ }
+
+ }
+ }
+
+ //check user_ids
+
+ if(is_array($moduleUserIds)){
+ if(in_array($currentUser->user_id, $moduleUserIds)){
+
+ if(!in_array($moduleItem->module_id, $activeModuleIds)){
+ $activeModules[] = $moduleItem;
+ $activeModuleIds[] = $moduleItem->module_id;
+ }
+
+ }
+ }
+ }
+ return $activeModules;
+ }
+
+
+ public function is_module_available($module_id, $userId){
+ $this->load->database();
+ $this->load->model('User_model');
+
+ $currentModule = $this->getModuleById($module_id);
+ $currentUser = $this->User_model->getUserById($userId);
+ $moduleGroupIds = unserialize($currentModule->permission_group_ids);
+ $moduleUserIds = unserialize($currentModule->permission_ids);
+ $moduleIsOk = 0;
+
+ //if($currentUser->permission_slug == 'admin' && $module_id != '5'){
+ if($currentUser->permission_slug == 'admin'){
+ $moduleIsOk = 1;
+ }
+
+ //check groupmodules
+ if(is_array($moduleGroupIds)){
+ if(in_array($currentUser->permission_id, $moduleGroupIds)){
+ $moduleIsOk = 1;
+ }
+ }
+
+ //check user_ids
+ if(is_array($moduleUserIds)){
+ if(in_array($currentUser->user_id, $moduleUserIds)){
+ $moduleIsOk = 1;
+ }
+ }
+
+ if($moduleIsOk){
+ return 1;
+ }
+ else{
+ return 0;
+ }
+
+}
+
+public function is_userId_available_in_module($module_id, $userId){
+ $this->load->database();
+ $this->load->model('User_model');
+
+ $currentModule = $this->getModuleById($module_id);
+ $userIds = unserialize($currentModule->permission_ids);
+
+
+ if(is_array($userIds)){
+ if(in_array($userId, $userIds)){
+ return 1;
+ }
+ }
+}
+
+public function is_groupId_available_in_module($module_id, $groupId){
+ $this->load->database();
+ $this->load->model('User_model');
+
+ $currentModule = $this->getModuleById($module_id);
+ $moduleGroupIds = unserialize($currentModule->permission_group_ids);
+
+ if(is_array($moduleGroupIds)){
+ if(in_array($groupId, $moduleGroupIds)){
+ return 1;
+ }
+ }
+}
+
+
+public function updateModule($fieldName, $module_id, $moduleUserArray){
+ $this->load->database();
+
+ if(!empty($moduleUserArray)){
+ $query = $this->db->query("UPDATE modules SET ".$fieldName." ='".serialize($moduleUserArray)."' WHERE module_id = '".$module_id."';");
+ }
+ else{
+ $query = $this->db->query("UPDATE modules SET ".$fieldName." ='' WHERE module_id = '".$module_id."';");
+ }
+}
+
+
+public function getModulesByPermissionSlug($permissionSlug){
+ $this->load->database();
+ $this->load->model('Module_model');
+ $selectedPermission = $this->Module_model->getPermissionBySlug($permissionSlug);
+
+ $query = $this->db->query('SELECT * FROM modules;');
+ $results = $query->result();
+ $resultArray = array();
+ foreach($results as $resultItem){
+ $permissionIdsArray = explode(',', $resultItem->permission_ids);
+ if(in_array($selectedPermission->permission_id, $permissionIdsArray)){
+ $resultArray[] = $resultItem;
+ }
+ }
+ return $resultArray;
+}
+
+public function getPermissionBySlug($permissionSlug){
+ $this->load->database();
+
+ $query = $this->db->query('SELECT * FROM permissions WHERE permission_slug = "'.$permissionSlug.'";');
+ if($query->num_rows() == 1){
+ return $query->result()[0];
+ }
+ else{
+ return 0;
+ }
+}
+
+public function user_can_access_this_module($moduleSlug, $userId){
+ $this->load->database();
+ $this->load->model('User_model');
+ $selectedUser = $this->User_model->getUserById($userId);
+
+ $query = $this->db->query('SELECT * FROM modules WHERE module_slug = "'.$moduleSlug.'" LIMIT 1;');
+
+ if($query->num_rows() == 1){
+ $result = $query->result()[0];
+ $permissionArray = explode(',', $result->permission_ids);
+ if(in_array($selectedUser->permission_id, $permissionArray)){
+ return 1;
+ }
+ else{
+ return 0;
+ }
+
+ }
+ else{
+ return 0;
+ }
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+}
+
+
+?>
\ No newline at end of file
diff --git a/application/models/Service_model.php b/application/models/Service_model.php
new file mode 100755
index 0000000..30099e7
--- /dev/null
+++ b/application/models/Service_model.php
@@ -0,0 +1,695 @@
+load->database();
+ $query = $this->db->query('INSERT INTO services (
+ service_type,
+ service_category_no,
+ service_category_en,
+ service_category_hu,
+ service_name_no,
+ service_name_en,
+ service_name_hu,
+ service_description_no,
+ service_description_en,
+ service_description_hu,
+ service_price,
+ service_time,
+ service_category_id,
+ is_enabled
+ ) VALUES(
+ "'.$serviceArray['service_type'].'",
+ "'.$serviceArray['service_category_no'].'",
+ "'.$serviceArray['service_category_en'].'",
+ "'.$serviceArray['service_category_hu'].'",
+ "'.$serviceArray['service_name_no'].'",
+ "'.$serviceArray['service_name_en'].'",
+ "'.$serviceArray['service_name_hu'].'",
+ "'.$serviceArray['service_description_no'].'",
+ "'.$serviceArray['service_description_en'].'",
+ "'.$serviceArray['service_description_hu'].'",
+ "'.$serviceArray['service_price'].'",
+ "'.$serviceArray['service_time'].'",
+ "'.$serviceArray['service_category_id'].'",
+ "'.$serviceArray['is_enabled'].'"
+ );');
+ }
+
+ public function createServiceCategory($serviceCategoryArray){
+ $this->load->database();
+ $query = $this->db->query('INSERT INTO service_categories (
+ serv_cat_slug,
+ serv_cat_name
+ ) VALUES(
+ "'.$serviceCategoryArray['serv_cat_slug'].'",
+ "'.$serviceCategoryArray['serv_cat_name'].'"
+ );');
+ }
+
+ public function updateService($service_id, $serviceArray){
+ $this->load->database();
+
+ foreach($serviceArray as $propertyKey => $propertyValue){
+ $query = $this->db->query('UPDATE services SET '.$propertyKey.' = "'.$propertyValue.'" WHERE service_id = "'.$service_id.'";');
+ }
+ }
+
+ public function updateServiceCategory($service_category_id, $serviceCategoryArray){
+ $this->load->database();
+
+ foreach($serviceCategoryArray as $propertyKey => $propertyValue){
+ $query = $this->db->query('UPDATE service_categories SET '.$propertyKey.' = "'.$propertyValue.'" WHERE service_category_id = "'.$service_category_id.'";');
+ }
+ }
+
+ public function createWorker($workerArray){
+ $this->load->database();
+ $query = $this->db->query('INSERT INTO workers (
+ worker_name,
+ worker_profile_img,
+ worker_info,
+ is_beauty,
+ is_barber,
+ service_category_id
+ ) VALUES(
+ "'.$workerArray['worker_name'].'",
+ "'.$workerArray['worker_profile_img'].'",
+ "'.$workerArray['worker_info'].'",
+ "'.$workerArray['is_beauty'].'",
+ "'.$workerArray['is_barber'].'",
+ "'.$workerArray['service_category_id'].'"
+ );');
+ }
+
+ public function updateWorker($worker_id, $workerArray){
+ $this->load->database();
+
+ foreach($workerArray as $propertyKey => $propertyValue){
+ $query = $this->db->query('UPDATE workers SET '.$propertyKey.' = "'.$propertyValue.'" WHERE worker_id = "'.$worker_id.'";');
+ }
+ }
+
+ public function updateBooking($booking_id, $bookingArray){
+ $this->load->database();
+
+ foreach($bookingArray as $propertyKey => $propertyValue){
+ $query = $this->db->query("UPDATE bookings SET ".$propertyKey." = '".$propertyValue."' WHERE booking_id = '".$booking_id."';");
+ }
+ }
+
+ public function getAllServiceByServiceType($service_type, $lang){
+ $this->load->database();
+ $query = $this->db->query('SELECT * FROM services JOIN service_categories ON services.service_category_id = service_categories.service_category_id WHERE service_type = "'.$service_type.'" AND services.is_enabled = "1" AND services.is_deleted != "1" ORDER BY service_id ASC;');
+ $serviceArray = array();
+ if($query->num_rows() > 0){
+ foreach($query->result() as $resultItem){
+
+ $service_category = '';
+ $service_name = '';
+ $service_description = '';
+
+ switch($lang){
+ case 'no':
+ $service_category = $resultItem->service_category_no;
+ $service_name = $resultItem->service_name_no;
+ $service_description = $resultItem->service_description_no;
+ break;
+ case 'en':
+ $service_category = $resultItem->service_category_en;
+ $service_name = $resultItem->service_name_en;
+ $service_description = $resultItem->service_description_en;
+ break;
+ case 'hu':
+ $service_category = $resultItem->service_category_hu;
+ $service_name = $resultItem->service_name_hu;
+ $service_description = $resultItem->service_description_hu;
+ break;
+ }
+
+ $resultItemTmp = array(
+ 'service_id' => $resultItem->service_id,
+ 'service_type' => $resultItem->service_type,
+ 'service_category' => $service_category,
+ 'service_name' => $service_name,
+ 'service_description' => $service_description,
+ 'service_price' => $resultItem->service_price,
+ 'service_time' => $resultItem->service_time,
+ 'serv_cat_slug' => $resultItem->serv_cat_slug,
+ 'service_category_id' => $resultItem->service_category_id
+ );
+
+ $serviceArray[] = (object)$resultItemTmp;
+ }
+ }
+ return $serviceArray;
+ }
+
+ public function getServiceById($service_id){
+ $this->load->database();
+ $query = $this->db->query('SELECT * FROM services WHERE service_id = "'.$service_id.'" LIMIT 1;');
+ if($query->num_rows() > 0){
+ return $query->result()[0];
+ }
+ else{
+ return 0;
+ }
+ }
+
+ public function getServiceCategoryById($service_category_id){
+ $this->load->database();
+ $query = $this->db->query('SELECT * FROM service_categories WHERE service_category_id = "'.$service_category_id.'" LIMIT 1;');
+ if($query->num_rows() > 0){
+ return $query->result()[0];
+ }
+ else{
+ return 0;
+ }
+ }
+
+ public function getAllServices(){
+ $this->load->database();
+ $query = $this->db->query('SELECT * FROM services JOIN service_categories ON services.service_category_id = service_categories.service_category_id WHERE services.is_deleted != "1" ORDER BY service_type ASC, service_name_hu ASC;');
+ if($query->num_rows() > 0){
+ return $query->result();
+ }
+ else{
+ return 0;
+ }
+ }
+
+ public function getAllServiceCategories(){
+ $this->load->database();
+ $query = $this->db->query('SELECT * FROM service_categories WHERE is_deleted != "1" ORDER BY service_category_id;');
+ if($query->num_rows() > 0){
+ return $query->result();
+ }
+ else{
+ return 0;
+ }
+ }
+
+ public function getAvailableServices(){
+ $this->load->database();
+ $query = $this->db->query('SELECT * FROM services WHERE is_enabled = "1" AND is_deleted != "1" ORDER BY service_name_hu ASC;');
+
+ if($query->num_rows() > 0){
+
+ $serviceArray = array();
+ foreach($query->result() as $resultItem){
+ $serviceTmp = array(
+ 'service_name' => $resultItem->service_name_hu.' ('.$resultItem->service_type.')',
+ 'service_id' => $resultItem->service_id
+ );
+
+ $serviceArray[] = $serviceTmp;
+ }
+ return $serviceArray;
+ }
+ }
+
+ public function getAllWorkers(){
+ $this->load->database();
+ $query = $this->db->query('SELECT * FROM workers JOIN service_categories ON workers.service_category_id = service_categories.service_category_id WHERE workers.is_deleted != "1" ORDER BY worker_name ASC;');
+ return $query->result();
+ }
+
+ public function getWorkersByCategorySlug($serv_cat_slug){
+ $this->load->database();
+ $query = $this->db->query('SELECT * FROM workers JOIN service_categories ON workers.service_category_id = service_categories.service_category_id WHERE workers.is_deleted != "1" AND serv_cat_slug = "'.$serv_cat_slug.'" ORDER BY worker_name ASC;');
+ return $query->result();
+ }
+
+ public function getActiveWorkers($subpage = ''){
+ $this->load->database();
+ $subpageString = '';
+
+ if($subpage == 'beauty'){
+ $subpageString = ' AND is_beauty = "1"';
+ }
+ else if($subpage == 'barber'){
+ $subpageString = ' AND is_barber = "1"';
+ }
+ else{
+ $subpageString = '';
+ }
+
+ $query = $this->db->query('SELECT * FROM workers WHERE is_active = "1" '.$subpageString.' AND is_deleted != "1" ORDER BY worker_name ASC;');
+ return $query->result();
+ }
+
+ public function deleteBooking($booking_id){
+ $this->load->database();
+ $query = $this->db->query('DELETE FROM bookings WHERE booking_id = "'.$booking_id.'";');
+ }
+
+ public function getAllBookings(){
+ $this->load->database();
+ $this->load->model('Service_model');
+
+ $query = $this->db->query('SELECT * FROM bookings JOIN workers ON bookings.worker_id = workers.worker_id ORDER BY booking_date DESC, booking_start_time ASC;');
+
+ if($query->num_rows() > 0){
+ $resultsArray = array();
+ foreach($query->result() as $resultItem){
+ $resultTmp = (array)$resultItem;
+ if($resultTmp['service_ids'] != ''){
+ $servicesArray = unserialize($resultTmp['service_ids']);
+ if(is_array($servicesArray)){
+ $services = array();
+ foreach($servicesArray as $servicesArrayItem){
+ $selectedService = $this->Service_model->getServiceById($servicesArrayItem);
+ $services[] = (object)array(
+ 'service_type' => $selectedService->service_type,
+ 'service_name' => $selectedService->service_name_hu,
+ 'service_price' => $selectedService->service_price,
+ 'service_time' => $selectedService->service_time
+ );
+ }
+ $resultTmp['services'] = $services;
+ }
+ else{
+ $resultTmp['services'] = array();
+ }
+ }
+ else{
+ $resultTmp['services'] = array();
+
+ }
+ $resultsArray[] = (object)$resultTmp;
+ }
+
+
+ return $resultsArray;
+ }
+ else{
+ return 0;
+ }
+ }
+
+ public function getActualBookings(){
+ $this->load->database();
+ $this->load->model('Service_model');
+
+ $query = $this->db->query('SELECT * FROM bookings JOIN workers ON bookings.worker_id = workers.worker_id WHERE booking_date >= CURDATE() ORDER BY booking_date DESC, booking_start_time ASC;');
+
+ if($query->num_rows() > 0){
+ $resultsArray = array();
+ foreach($query->result() as $resultItem){
+ $resultTmp = (array)$resultItem;
+ if($resultTmp['service_ids'] != ''){
+ $servicesArray = unserialize($resultTmp['service_ids']);
+ if(is_array($servicesArray)){
+ $services = array();
+ foreach($servicesArray as $servicesArrayItem){
+ $selectedService = $this->Service_model->getServiceById($servicesArrayItem);
+ $services[] = (object)array(
+ 'service_type' => $selectedService->service_type,
+ 'service_name' => $selectedService->service_name_hu,
+ 'service_price' => $selectedService->service_price,
+ 'service_time' => $selectedService->service_time
+ );
+ }
+ $resultTmp['services'] = $services;
+ }
+ else{
+ $resultTmp['services'] = array();
+ }
+ }
+ else{
+ $resultTmp['services'] = array();
+
+ }
+ $resultsArray[] = (object)$resultTmp;
+ }
+
+
+ return $resultsArray;
+ }
+ else{
+ return 0;
+ }
+ }
+
+ public function getActualBookingsByWorkerID($workerID){
+ $this->load->database();
+ $this->load->model('Service_model');
+
+ $query = $this->db->query('SELECT * FROM bookings JOIN workers ON bookings.worker_id = workers.worker_id WHERE booking_date >= CURDATE() AND bookings.worker_id = "'.$workerID.'" ORDER BY booking_date DESC, booking_start_time ASC;');
+
+ if($query->num_rows() > 0){
+ $resultsArray = array();
+ foreach($query->result() as $resultItem){
+ $resultTmp = (array)$resultItem;
+ if($resultTmp['service_ids'] != ''){
+ $servicesArray = unserialize($resultTmp['service_ids']);
+ if(is_array($servicesArray)){
+ $services = array();
+ foreach($servicesArray as $servicesArrayItem){
+ $selectedService = $this->Service_model->getServiceById($servicesArrayItem);
+ $services[] = (object)array(
+ 'service_type' => $selectedService->service_type,
+ 'service_name' => $selectedService->service_name_hu,
+ 'service_price' => $selectedService->service_price,
+ 'service_time' => $selectedService->service_time
+ );
+ }
+ $resultTmp['services'] = $services;
+ }
+ else{
+ $resultTmp['services'] = array();
+ }
+ }
+ else{
+ $resultTmp['services'] = array();
+
+ }
+ $resultsArray[] = (object)$resultTmp;
+ }
+
+
+ return $resultsArray;
+ }
+ else{
+ return 0;
+ }
+ }
+
+ public function getBookingById($booking_id){
+ $this->load->database();
+ $this->load->model('Service_model');
+
+ $query = $this->db->query('SELECT * FROM bookings WHERE booking_id = "'.$booking_id.'" LIMIT 1;');
+ if($query->num_rows() > 0){
+ return $query->result()[0];
+ }
+ else{
+ return 0;
+ }
+ }
+
+ public function getWorkerById($worker_id){
+ $this->load->database();
+ $query = $this->db->query('SELECT * FROM workers WHERE worker_id = "'.$worker_id.'" LIMIT 1;');
+ if($query->num_rows() > 0){
+ return $query->result()[0];
+ }
+ else{
+ return 0;
+ }
+ }
+
+
+ public function getAvailableTimes($worker_id, $selectedDate, $servicelength) {
+ $this->load->database();
+ if (strtotime($selectedDate) < strtotime(date('Y-m-d'))) {
+ return [];
+ }
+ $ts = strtotime($selectedDate);
+ $debugDate = date('Y-m-d (w)', $ts) . ' - ' . date('l', $ts);
+ log_message('error', "📅 DEBUG DATE CHECK for '{$selectedDate}': {$debugDate}");
+ log_message('error', "⏱ Timezone: " . date_default_timezone_get());
+ $serviceLengthTime = strtotime($servicelength);
+ $availableTimeArray = [];
+
+ // Check override first
+ $overrideQuery = $this->db->query("
+ SELECT * FROM worker_schedule_overrides
+ WHERE worker_id = '$worker_id' AND date = '$selectedDate'
+ LIMIT 1
+ ");
+
+ if ($overrideQuery->num_rows() > 0) {
+ $override = $overrideQuery->row();
+
+ if ($override->is_day_off) return [];
+
+ $dayStartTime = new DateTime($selectedDate.' '.$override->start_time);
+ $finishTime = new DateTime($selectedDate.' '.$override->end_time);
+ } else {
+ $weekday = date('w', strtotime($selectedDate)); // 0 = Sunday, 6 = Saturday
+ $weekNumber = date('W', strtotime($selectedDate));
+ $isOddWeek = $weekNumber % 2 !== 0;
+
+ $scheduleQuery = $this->db->query("
+ SELECT * FROM worker_schedule
+ WHERE worker_id = '{$worker_id}'
+ AND weekday = '{$weekday}'
+ AND (
+ is_alternate_week = 0
+ OR (is_alternate_week = 1 AND " . ($isOddWeek ? "1" : "0") . ")
+ )
+ ");
+
+ if ($scheduleQuery->num_rows() == 0) {
+ return [];
+ }
+
+ $schedule = $scheduleQuery->row();
+ $dayStartTime = new DateTime($selectedDate . ' ' . $schedule->start_time);
+ $finishTime = new DateTime($selectedDate . ' ' . $schedule->end_time);
+ }
+
+ $interval = new DateInterval('PT15M');
+ list($h, $m) = explode(':', $servicelength);
+ $serviceDuration = new DateInterval('PT' . (int)$h . 'H' . (int)$m . 'M');
+
+ for ($current = clone $dayStartTime; $current < $finishTime; $current->add($interval)) {
+ $slotEnd = clone $current;
+ $slotEnd->add($serviceDuration);
+ if ($slotEnd > $finishTime) break;
+ if ($selectedDate == date('Y-m-d') && $current < new DateTime()) continue;
+
+ $startTimeStr = $current->format('H:i:s');
+ $endTimeStr = $slotEnd->format('H:i:s');
+
+ $bookingQuery = $this->db->query("
+ SELECT * FROM bookings
+ WHERE booking_date = '{$selectedDate}'
+ AND worker_id = '{$worker_id}'
+ AND (
+ (booking_start_time < '{$endTimeStr}' AND booking_finish_time > '{$startTimeStr}')
+ )
+ ");
+
+ if ($bookingQuery->num_rows() == 0) {
+ $availableTimeArray[] = $startTimeStr;
+ }
+ log_message('debug', 'Selected Date: ' . $selectedDate);
+ log_message('debug', 'Weekday: ' . $weekday);
+ log_message('debug', 'Worker ID: ' . $worker_id);
+ log_message('debug', 'Query: ' . $this->db->last_query());
+ }
+
+ return $availableTimeArray;
+ }
+
+
+
+ public function createBooking($bookingArray){
+ $this->load->database();
+ $query = $this->db->query("INSERT INTO bookings (
+ guest_name,
+ guest_email,
+ guest_phone,
+ worker_id,
+ booking_date,
+ booking_start_time,
+ booking_finish_time,
+ service_ids,
+ guest_confirmed,
+ guest_confirm_code
+ ) VALUES(
+ '".$bookingArray['guest_name']."',
+ '".$bookingArray['guest_email']."',
+ '".$bookingArray['guest_phone']."',
+ '".$bookingArray['worker_id']."',
+ '".$bookingArray['booking_date']."',
+ '".$bookingArray['booking_start_time']."',
+ '".$bookingArray['booking_finish_time']."',
+ '".$bookingArray['service_ids']."',
+ '".$bookingArray['guest_confirmed']."',
+ '".$bookingArray['guest_confirm_code']."'
+ );");
+ }
+
+ public function getWorkerSchedule($worker_id) {
+ return $this->db
+ ->where('worker_id', $worker_id)
+ ->order_by('weekday', 'ASC')
+ ->get('worker_schedule')
+ ->result();
+ }
+
+ public function clearWorkerSchedule($worker_id) {
+ $this->load->database();
+ $this->db->where('worker_id', $worker_id)->delete('worker_schedule');
+ }
+
+ public function addWorkerSchedule($data) {
+ $this->db->insert('worker_schedule', $data);
+ }
+
+ public function getAllWorkerSchedules() {
+ $query = $this->db->query('SELECT * FROM worker_schedule');
+ return $query->result();
+ }
+
+ public function getAllWorkerOverrides() {
+ $query = $this->db->query('SELECT * FROM worker_schedule_overrides');
+ return $query->result();
+ }
+
+ public function getWorkerScheduleOverrides() {
+ $this->load->database();
+ $query = $this->db->query("
+ SELECT o.*, w.worker_name
+ FROM worker_schedule_overrides o
+ JOIN workers w ON o.worker_id = w.worker_id
+ ORDER BY o.date DESC
+ ");
+ return $query->result();
+ }
+
+ public function createWorkerScheduleOverride($override) {
+ $this->db->insert('worker_schedule_overrides', $override);
+ }
+
+ public function getWorkerScheduleByDay($worker_id, $weekday) {
+ $this->db->where('worker_id', $worker_id);
+ $this->db->where('weekday', $weekday);
+ $query = $this->db->get('worker_schedule');
+ return $query->row(); // null if no row
+ }
+
+ public function isEvenWeek($date) {
+ return ((int)date('W', strtotime($date)) % 2) === 0;
+ }
+
+ public function isWorkerAvailableThisWeek($worker_id, $selectedDate) {
+ $weekday = date('w', strtotime($selectedDate));
+ $weekNumber = date('W', strtotime($selectedDate));
+ $isOddWeek = $weekNumber % 2 !== 0;
+
+ $query = $this->db->query("
+ SELECT * FROM worker_schedule
+ WHERE worker_id = '{$worker_id}'
+ AND weekday = '{$weekday}'
+ AND (
+ is_alternate_week = 0
+ OR (is_alternate_week = 1 AND " . ($isOddWeek ? "1" : "0") . ")
+ )
+ ");
+
+ return $query->num_rows() > 0;
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+}
+
+?>
diff --git a/application/models/Service_model_20250312.php b/application/models/Service_model_20250312.php
new file mode 100755
index 0000000..b275dd8
--- /dev/null
+++ b/application/models/Service_model_20250312.php
@@ -0,0 +1,568 @@
+load->database();
+ $query = $this->db->query('INSERT INTO services (
+ service_type,
+ service_category_no,
+ service_category_en,
+ service_category_hu,
+ service_name_no,
+ service_name_en,
+ service_name_hu,
+ service_description_no,
+ service_description_en,
+ service_description_hu,
+ service_price,
+ service_time,
+ is_enabled
+ ) VALUES(
+ "'.$serviceArray['service_type'].'",
+ "'.$serviceArray['service_category_no'].'",
+ "'.$serviceArray['service_category_en'].'",
+ "'.$serviceArray['service_category_hu'].'",
+ "'.$serviceArray['service_name_no'].'",
+ "'.$serviceArray['service_name_en'].'",
+ "'.$serviceArray['service_name_hu'].'",
+ "'.$serviceArray['service_description_no'].'",
+ "'.$serviceArray['service_description_en'].'",
+ "'.$serviceArray['service_description_hu'].'",
+ "'.$serviceArray['service_price'].'",
+ "'.$serviceArray['service_time'].'",
+ "'.$serviceArray['is_enabled'].'"
+ );');
+ }
+
+ public function updateService($service_id, $serviceArray){
+ $this->load->database();
+
+ foreach($serviceArray as $propertyKey => $propertyValue){
+ $query = $this->db->query('UPDATE services SET '.$propertyKey.' = "'.$propertyValue.'" WHERE service_id = "'.$service_id.'";');
+ }
+ }
+
+ public function createWorker($workerArray){
+ $this->load->database();
+ $query = $this->db->query('INSERT INTO workers (
+ worker_name,
+ worker_profile_img,
+ worker_info
+ ) VALUES(
+ "'.$workerArray['worker_name'].'",
+ "'.$workerArray['worker_profile_img'].'",
+ "'.$workerArray['worker_info'].'"
+ );');
+ }
+
+ public function updateWorker($worker_id, $workerArray){
+ $this->load->database();
+
+ foreach($workerArray as $propertyKey => $propertyValue){
+ $query = $this->db->query('UPDATE workers SET '.$propertyKey.' = "'.$propertyValue.'" WHERE worker_id = "'.$worker_id.'";');
+ }
+ }
+
+ public function updateBooking($booking_id, $bookingArray){
+ $this->load->database();
+
+ foreach($bookingArray as $propertyKey => $propertyValue){
+ $query = $this->db->query("UPDATE bookings SET ".$propertyKey." = '".$propertyValue."' WHERE booking_id = '".$booking_id."';");
+ }
+ }
+
+ public function getAllServiceByServiceType($service_type, $lang){
+ $this->load->database();
+ $query = $this->db->query('SELECT * FROM services WHERE service_type = "'.$service_type.'" AND is_enabled = "1" AND is_deleted != "1" ORDER BY service_id ASC;');
+ $serviceArray = array();
+ if($query->num_rows() > 0){
+ foreach($query->result() as $resultItem){
+
+ $service_category = '';
+ $service_name = '';
+ $service_description = '';
+
+ switch($lang){
+ case 'no':
+ $service_category = $resultItem->service_category_no;
+ $service_name = $resultItem->service_name_no;
+ $service_description = $resultItem->service_description_no;
+ break;
+ case 'en':
+ $service_category = $resultItem->service_category_en;
+ $service_name = $resultItem->service_name_en;
+ $service_description = $resultItem->service_description_en;
+ break;
+ case 'hu':
+ $service_category = $resultItem->service_category_hu;
+ $service_name = $resultItem->service_name_hu;
+ $service_description = $resultItem->service_description_hu;
+ break;
+ }
+
+ $resultItemTmp = array(
+ 'service_id' => $resultItem->service_id,
+ 'service_type' => $resultItem->service_type,
+ 'service_category' => $service_category,
+ 'service_name' => $service_name,
+ 'service_description' => $service_description,
+ 'service_price' => $resultItem->service_price,
+ 'service_time' => $resultItem->service_time
+ );
+
+ $serviceArray[] = (object)$resultItemTmp;
+ }
+ }
+ return $serviceArray;
+ }
+
+ public function getServiceById($service_id){
+ $this->load->database();
+ $query = $this->db->query('SELECT * FROM services WHERE service_id = "'.$service_id.'" LIMIT 1;');
+ if($query->num_rows() > 0){
+ return $query->result()[0];
+ }
+ else{
+ return 0;
+ }
+ }
+
+ public function getAllServices(){
+ $this->load->database();
+ $query = $this->db->query('SELECT * FROM services WHERE is_deleted != "1" ORDER BY service_type ASC, service_name_hu ASC;');
+ if($query->num_rows() > 0){
+ return $query->result();
+ }
+ else{
+ return 0;
+ }
+ }
+
+ public function getAvailableServices(){
+ $this->load->database();
+ $query = $this->db->query('SELECT * FROM services WHERE is_enabled = "1" AND is_deleted != "1" ORDER BY service_name_hu ASC;');
+
+ if($query->num_rows() > 0){
+
+ $serviceArray = array();
+ foreach($query->result() as $resultItem){
+ $serviceTmp = array(
+ 'service_name' => $resultItem->service_name_hu.' ('.$resultItem->service_type.')',
+ 'service_id' => $resultItem->service_id
+ );
+
+ $serviceArray[] = $serviceTmp;
+ }
+ return $serviceArray;
+ }
+ }
+
+ public function getAllWorkers(){
+ $this->load->database();
+ $query = $this->db->query('SELECT * FROM workers WHERE is_deleted != "1" ORDER BY worker_name ASC;');
+ return $query->result();
+ }
+
+ public function getActiveWorkers(){
+ $this->load->database();
+ $query = $this->db->query('SELECT * FROM workers WHERE is_active = "1" AND is_deleted != "1" ORDER BY worker_name ASC;');
+ return $query->result();
+ }
+
+ public function deleteBooking($booking_id){
+ $this->load->database();
+ $query = $this->db->query('DELETE FROM bookings WHERE booking_id = "'.$booking_id.'";');
+ }
+
+ public function getAllBookings(){
+ $this->load->database();
+ $this->load->model('Service_model');
+
+ $query = $this->db->query('SELECT * FROM bookings JOIN workers ON bookings.worker_id = workers.worker_id ORDER BY booking_date DESC, booking_start_time ASC;');
+
+ if($query->num_rows() > 0){
+ $resultsArray = array();
+ foreach($query->result() as $resultItem){
+ $resultTmp = (array)$resultItem;
+ if($resultTmp['service_ids'] != ''){
+ $servicesArray = unserialize($resultTmp['service_ids']);
+ if(is_array($servicesArray)){
+ $services = array();
+ foreach($servicesArray as $servicesArrayItem){
+ $selectedService = $this->Service_model->getServiceById($servicesArrayItem);
+ $services[] = (object)array(
+ 'service_type' => $selectedService->service_type,
+ 'service_name' => $selectedService->service_name_hu,
+ 'service_price' => $selectedService->service_price,
+ 'service_time' => $selectedService->service_time
+ );
+ }
+ $resultTmp['services'] = $services;
+ }
+ else{
+ $resultTmp['services'] = array();
+ }
+ }
+ else{
+ $resultTmp['services'] = array();
+
+ }
+ $resultsArray[] = (object)$resultTmp;
+ }
+
+
+ return $resultsArray;
+ }
+ else{
+ return 0;
+ }
+ }
+
+ public function getActualBookings(){
+ $this->load->database();
+ $this->load->model('Service_model');
+
+ $query = $this->db->query('SELECT * FROM bookings JOIN workers ON bookings.worker_id = workers.worker_id WHERE booking_date >= CURDATE() ORDER BY booking_date DESC, booking_start_time ASC;');
+
+ if($query->num_rows() > 0){
+ $resultsArray = array();
+ foreach($query->result() as $resultItem){
+ $resultTmp = (array)$resultItem;
+ if($resultTmp['service_ids'] != ''){
+ $servicesArray = unserialize($resultTmp['service_ids']);
+ if(is_array($servicesArray)){
+ $services = array();
+ foreach($servicesArray as $servicesArrayItem){
+ $selectedService = $this->Service_model->getServiceById($servicesArrayItem);
+ $services[] = (object)array(
+ 'service_type' => $selectedService->service_type,
+ 'service_name' => $selectedService->service_name_hu,
+ 'service_price' => $selectedService->service_price,
+ 'service_time' => $selectedService->service_time
+ );
+ }
+ $resultTmp['services'] = $services;
+ }
+ else{
+ $resultTmp['services'] = array();
+ }
+ }
+ else{
+ $resultTmp['services'] = array();
+
+ }
+ $resultsArray[] = (object)$resultTmp;
+ }
+
+
+ return $resultsArray;
+ }
+ else{
+ return 0;
+ }
+ }
+
+ public function getBookingById($booking_id){
+ $this->load->database();
+ $this->load->model('Service_model');
+
+ $query = $this->db->query('SELECT * FROM bookings WHERE booking_id = "'.$booking_id.'" LIMIT 1;');
+ if($query->num_rows() > 0){
+ return $query->result()[0];
+ }
+ else{
+ return 0;
+ }
+ }
+
+ public function getWorkerById($worker_id){
+ $this->load->database();
+ $query = $this->db->query('SELECT * FROM workers WHERE worker_id = "'.$worker_id.'" LIMIT 1;');
+ if($query->num_rows() > 0){
+ return $query->result()[0];
+ }
+ else{
+ return 0;
+ }
+ }
+
+ public function getAvailableTimes($worker_id, $selectedDate, $servicelength){
+ $this->load->database();
+ $serviceLengthDateTime = new DateTime($selectedDate.' '.$servicelength);
+ $service_length_time = strtotime($servicelength);
+ $availableTimeArray = array();
+ $selectedDayName = date('D', strtotime($selectedDate));
+ $dayStartTime = new DateTime($selectedDate.' 10:00');
+ $finishTime = new DateTime($selectedDate.' 18:00');
+ if($selectedDayName == 'Sun'){
+ return array();
+ }
+ elseif($selectedDayName == 'Sat'){
+ $finishTime = new DateTime($selectedDate.' 16:00');
+ }
+ else{
+ //finish time - selected service length
+ $finishTime = new DateTime($selectedDate.' 18:00');
+
+ }
+
+ $today=date_create(date('Y-m-d'));
+ $selectedDay=date_create($selectedDate);
+ $dateDiff=date_diff($today,$selectedDay);
+
+ $tmpDateStart = date_create(date('2024-02-29'));
+ $tmpDateEnd = date_create(date('2024-03-07'));
+
+ $datelength = new DateTime($servicelength);
+ $diff = $datelength->diff($finishTime);
+
+ //max time for start
+ $maxTime = $diff->h.':'.$diff->i.':00';
+ $hours = (intval($diff->h)-10)*4+1;
+ $mins = floor(intval($diff->i) / 15);
+ $loopSteps = intval($hours) + intval($mins);
+
+ for($periodIndex = 1; $periodIndex <= $loopSteps; $periodIndex++){
+ $minutes_to_add_start = $periodIndex*15;
+ $minutes_to_add_end = ($periodIndex+1)*15;
+ $startTime = new DateTime($selectedDate.' 09:45');
+ $endTime = new DateTime($selectedDate.' 09:45');
+ $startTime->add(new DateInterval('PT' . $minutes_to_add_start . 'M'));
+ $endTime->add(new DateInterval('PT' . $minutes_to_add_end . 'M'));
+ $maxTimeObject = new DateTime($maxTime);
+
+ $tz = new DateTimeZone('Europe/Budapest');
+ $addStartTimeAndLength = new DateTime($selectedDate.' '.$startTime->format('H:i:00'), $tz);
+ $addStartTimeAndLength->add(new DateInterval('PT' . intval($serviceLengthDateTime->format('H')) . 'H'));
+ $addStartTimeAndLength->add(new DateInterval('PT' . intval($serviceLengthDateTime->format('i')) . 'M'));
+
+ $currentStartTime = $startTime->format('H:i:00');
+ $currentEndTime = $endTime->format('H:i:00');
+
+
+
+ /*
+ echo '<< ';
+ print_r($serviceLengthDateTime->format('H:i:00'));
+ echo ' / ';
+ print_r($currentStartTime);
+ echo ' / ';
+ print_r($addStartTimeAndLength->format('H:i:00'));
+ echo ' >>';
+ */
+ /*
+ $query = $this->db->query('SELECT * FROM bookings WHERE booking_date = "'.$selectedDate.'" AND worker_id = "'.$worker_id.'" AND (
+
+ (TIME(booking_start_time) >= CAST("'.$currentStartTime.'" AS TIME) AND TIME(booking_finish_time) <= CAST("'.$currentEndTime.'" AS TIME)) OR
+
+
+ (TIME(booking_start_time) <= CAST("'.$addStartTimeAndLength->format('H:i:00').'" AS TIME) AND TIME(booking_finish_time) >= CAST("'.$currentEndTime.'" AS TIME)) OR
+
+
+ (TIME(booking_start_time) >= CAST("'.$currentStartTime.'" AS TIME) AND TIME(booking_start_time) <= CAST("'.$currentEndTime.'" AS TIME) AND TIME(booking_finish_time) >= CAST("'.$currentEndTime.'" AS TIME)) OR
+
+
+ (TIME(booking_start_time) <= CAST("'.$currentStartTime.'" AS TIME) AND TIME(booking_finish_time) >= CAST("'.$currentEndTime.'" AS TIME)
+ AND TIME(booking_start_time) <= CAST("'.$currentStartTime.'" AS TIME)) OR
+
+
+ (TIME(booking_start_time) <= CAST("'.$currentStartTime.'" AS TIME) AND TIME(booking_finish_time) <= CAST("'.$currentEndTime.'" AS TIME)
+ AND TIME(booking_finish_time) >= CAST("'.$currentStartTime.'" AS TIME)) OR
+
+
+ (TIME(booking_start_time) <= CAST("'.$currentStartTime.'" AS TIME) AND TIME(booking_finish_time) >= CAST("'.$currentEndTime.'" AS TIME))
+ );
+ ');
+ */
+
+
+ $query = $this->db->query('SELECT * FROM bookings WHERE booking_date = "'.$selectedDate.'" AND worker_id = "'.$worker_id.'" AND (
+ /*start later and finish before*/
+ (TIME(booking_start_time) > CAST("'.$currentStartTime.'" AS TIME) AND TIME(booking_finish_time) < CAST("'.$currentEndTime.'" AS TIME)) OR
+
+ /*check if not end service until next booking*/
+ (TIME(booking_start_time) < CAST("'.$addStartTimeAndLength->format('H:i:00').'" AS TIME) AND TIME(booking_finish_time) >= CAST("'.$currentEndTime.'" AS TIME)) OR
+
+ /*start later and finish later*/
+ (TIME(booking_start_time) > CAST("'.$currentStartTime.'" AS TIME) AND TIME(booking_start_time) < CAST("'.$currentEndTime.'" AS TIME) AND TIME(booking_finish_time) >= CAST("'.$currentEndTime.'" AS TIME)) OR
+
+ /*start before and finish before*/
+ (TIME(booking_start_time) < CAST("'.$currentStartTime.'" AS TIME) AND TIME(booking_finish_time) >= CAST("'.$currentEndTime.'" AS TIME)
+ AND TIME(booking_start_time) < CAST("'.$currentStartTime.'" AS TIME)) OR
+
+ /**/
+ (TIME(booking_start_time) < CAST("'.$currentStartTime.'" AS TIME) AND TIME(booking_finish_time) < CAST("'.$currentEndTime.'" AS TIME)
+ AND TIME(booking_finish_time) > CAST("'.$currentStartTime.'" AS TIME)) OR
+
+ /**/
+ (TIME(booking_start_time) < CAST("'.$currentStartTime.'" AS TIME) AND TIME(booking_finish_time) >= CAST("'.$currentEndTime.'" AS TIME))
+ );
+ ');
+
+ $now = strtotime(date('H:i:s')) + 60*60;
+ $timezone = 'Europe/Budapest';
+ $todayStartTime = strtotime($currentStartTime.' '.$timezone);
+ $minDiff = ($todayStartTime - $now) / 60;
+
+
+ if($dateDiff->format("%R%a") == 0 && $minDiff > 0){
+ if($query->num_rows() == 0){
+ $availableTimeArray[] = $currentStartTime;
+ }
+ }
+
+ elseif($dateDiff->format("%R%a") >= 0 && ($selectedDay < $tmpDateStart || $selectedDay > $tmpDateEnd) && $dateDiff->format("%R%a") != 0){
+ if($query->num_rows() == 0){
+ $availableTimeArray[] = $currentStartTime;
+ }
+
+ }
+
+
+ }
+
+ return $availableTimeArray;
+
+
+ }
+
+ public function createBooking($bookingArray){
+ $this->load->database();
+ $query = $this->db->query("INSERT INTO bookings (
+ guest_name,
+ guest_email,
+ guest_phone,
+ worker_id,
+ booking_date,
+ booking_start_time,
+ booking_finish_time,
+ service_ids,
+ guest_confirmed,
+ guest_confirm_code
+ ) VALUES(
+ '".$bookingArray['guest_name']."',
+ '".$bookingArray['guest_email']."',
+ '".$bookingArray['guest_phone']."',
+ '".$bookingArray['worker_id']."',
+ '".$bookingArray['booking_date']."',
+ '".$bookingArray['booking_start_time']."',
+ '".$bookingArray['booking_finish_time']."',
+ '".$bookingArray['service_ids']."',
+ '".$bookingArray['guest_confirmed']."',
+ '".$bookingArray['guest_confirm_code']."'
+ );");
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+}
+
+?>
\ No newline at end of file
diff --git a/application/models/Service_model_20250524.php b/application/models/Service_model_20250524.php
new file mode 100755
index 0000000..6e61ed8
--- /dev/null
+++ b/application/models/Service_model_20250524.php
@@ -0,0 +1,685 @@
+load->database();
+ $query = $this->db->query('INSERT INTO services (
+ service_type,
+ service_category_no,
+ service_category_en,
+ service_category_hu,
+ service_name_no,
+ service_name_en,
+ service_name_hu,
+ service_description_no,
+ service_description_en,
+ service_description_hu,
+ service_price,
+ service_time,
+ service_category_id,
+ is_enabled
+ ) VALUES(
+ "'.$serviceArray['service_type'].'",
+ "'.$serviceArray['service_category_no'].'",
+ "'.$serviceArray['service_category_en'].'",
+ "'.$serviceArray['service_category_hu'].'",
+ "'.$serviceArray['service_name_no'].'",
+ "'.$serviceArray['service_name_en'].'",
+ "'.$serviceArray['service_name_hu'].'",
+ "'.$serviceArray['service_description_no'].'",
+ "'.$serviceArray['service_description_en'].'",
+ "'.$serviceArray['service_description_hu'].'",
+ "'.$serviceArray['service_price'].'",
+ "'.$serviceArray['service_time'].'",
+ "'.$serviceArray['service_category_id'].'",
+ "'.$serviceArray['is_enabled'].'"
+ );');
+ }
+
+ public function createServiceCategory($serviceCategoryArray){
+ $this->load->database();
+ $query = $this->db->query('INSERT INTO service_categories (
+ serv_cat_slug,
+ serv_cat_name
+ ) VALUES(
+ "'.$serviceCategoryArray['serv_cat_slug'].'",
+ "'.$serviceCategoryArray['serv_cat_name'].'"
+ );');
+ }
+
+ public function updateService($service_id, $serviceArray){
+ $this->load->database();
+
+ foreach($serviceArray as $propertyKey => $propertyValue){
+ $query = $this->db->query('UPDATE services SET '.$propertyKey.' = "'.$propertyValue.'" WHERE service_id = "'.$service_id.'";');
+ }
+ }
+
+ public function updateServiceCategory($service_category_id, $serviceCategoryArray){
+ $this->load->database();
+
+ foreach($serviceCategoryArray as $propertyKey => $propertyValue){
+ $query = $this->db->query('UPDATE service_categories SET '.$propertyKey.' = "'.$propertyValue.'" WHERE service_category_id = "'.$service_category_id.'";');
+ }
+ }
+
+ public function createWorker($workerArray){
+ $this->load->database();
+ $query = $this->db->query('INSERT INTO workers (
+ worker_name,
+ worker_profile_img,
+ worker_info,
+ is_beauty,
+ is_barber,
+ service_category_id
+ ) VALUES(
+ "'.$workerArray['worker_name'].'",
+ "'.$workerArray['worker_profile_img'].'",
+ "'.$workerArray['worker_info'].'",
+ "'.$workerArray['is_beauty'].'",
+ "'.$workerArray['is_barber'].'",
+ "'.$workerArray['service_category_id'].'"
+ );');
+ }
+
+ public function updateWorker($worker_id, $workerArray){
+ $this->load->database();
+
+ foreach($workerArray as $propertyKey => $propertyValue){
+ $query = $this->db->query('UPDATE workers SET '.$propertyKey.' = "'.$propertyValue.'" WHERE worker_id = "'.$worker_id.'";');
+ }
+ }
+
+ public function updateBooking($booking_id, $bookingArray){
+ $this->load->database();
+
+ foreach($bookingArray as $propertyKey => $propertyValue){
+ $query = $this->db->query("UPDATE bookings SET ".$propertyKey." = '".$propertyValue."' WHERE booking_id = '".$booking_id."';");
+ }
+ }
+
+ public function getAllServiceByServiceType($service_type, $lang){
+ $this->load->database();
+ $query = $this->db->query('SELECT * FROM services JOIN service_categories ON services.service_category_id = service_categories.service_category_id WHERE service_type = "'.$service_type.'" AND services.is_enabled = "1" AND services.is_deleted != "1" ORDER BY service_id ASC;');
+ $serviceArray = array();
+ if($query->num_rows() > 0){
+ foreach($query->result() as $resultItem){
+
+ $service_category = '';
+ $service_name = '';
+ $service_description = '';
+
+ switch($lang){
+ case 'no':
+ $service_category = $resultItem->service_category_no;
+ $service_name = $resultItem->service_name_no;
+ $service_description = $resultItem->service_description_no;
+ break;
+ case 'en':
+ $service_category = $resultItem->service_category_en;
+ $service_name = $resultItem->service_name_en;
+ $service_description = $resultItem->service_description_en;
+ break;
+ case 'hu':
+ $service_category = $resultItem->service_category_hu;
+ $service_name = $resultItem->service_name_hu;
+ $service_description = $resultItem->service_description_hu;
+ break;
+ }
+
+ $resultItemTmp = array(
+ 'service_id' => $resultItem->service_id,
+ 'service_type' => $resultItem->service_type,
+ 'service_category' => $service_category,
+ 'service_name' => $service_name,
+ 'service_description' => $service_description,
+ 'service_price' => $resultItem->service_price,
+ 'service_time' => $resultItem->service_time,
+ 'serv_cat_slug' => $resultItem->serv_cat_slug,
+ 'service_category_id' => $resultItem->service_category_id
+ );
+
+ $serviceArray[] = (object)$resultItemTmp;
+ }
+ }
+ return $serviceArray;
+ }
+
+ public function getServiceById($service_id){
+ $this->load->database();
+ $query = $this->db->query('SELECT * FROM services WHERE service_id = "'.$service_id.'" LIMIT 1;');
+ if($query->num_rows() > 0){
+ return $query->result()[0];
+ }
+ else{
+ return 0;
+ }
+ }
+
+ public function getServiceCategoryById($service_category_id){
+ $this->load->database();
+ $query = $this->db->query('SELECT * FROM service_categories WHERE service_category_id = "'.$service_category_id.'" LIMIT 1;');
+ if($query->num_rows() > 0){
+ return $query->result()[0];
+ }
+ else{
+ return 0;
+ }
+ }
+
+ public function getAllServices(){
+ $this->load->database();
+ $query = $this->db->query('SELECT * FROM services JOIN service_categories ON services.service_category_id = service_categories.service_category_id WHERE services.is_deleted != "1" ORDER BY service_type ASC, service_name_hu ASC;');
+ if($query->num_rows() > 0){
+ return $query->result();
+ }
+ else{
+ return 0;
+ }
+ }
+
+ public function getAllServiceCategories(){
+ $this->load->database();
+ $query = $this->db->query('SELECT * FROM service_categories WHERE is_deleted != "1" ORDER BY service_category_id;');
+ if($query->num_rows() > 0){
+ return $query->result();
+ }
+ else{
+ return 0;
+ }
+ }
+
+ public function getAvailableServices(){
+ $this->load->database();
+ $query = $this->db->query('SELECT * FROM services WHERE is_enabled = "1" AND is_deleted != "1" ORDER BY service_name_hu ASC;');
+
+ if($query->num_rows() > 0){
+
+ $serviceArray = array();
+ foreach($query->result() as $resultItem){
+ $serviceTmp = array(
+ 'service_name' => $resultItem->service_name_hu.' ('.$resultItem->service_type.')',
+ 'service_id' => $resultItem->service_id
+ );
+
+ $serviceArray[] = $serviceTmp;
+ }
+ return $serviceArray;
+ }
+ }
+
+ public function getAllWorkers(){
+ $this->load->database();
+ $query = $this->db->query('SELECT * FROM workers JOIN service_categories ON workers.service_category_id = service_categories.service_category_id WHERE workers.is_deleted != "1" ORDER BY worker_name ASC;');
+ return $query->result();
+ }
+
+ public function getWorkersByCategorySlug($serv_cat_slug){
+ $this->load->database();
+ $query = $this->db->query('SELECT * FROM workers JOIN service_categories ON workers.service_category_id = service_categories.service_category_id WHERE workers.is_deleted != "1" AND serv_cat_slug = "'.$serv_cat_slug.'" ORDER BY worker_name ASC;');
+ return $query->result();
+ }
+
+ public function getActiveWorkers($subpage = ''){
+ $this->load->database();
+ $subpageString = '';
+
+ if($subpage == 'beauty'){
+ $subpageString = ' AND is_beauty = "1"';
+ }
+ else if($subpage == 'barber'){
+ $subpageString = ' AND is_barber = "1"';
+ }
+ else{
+ $subpageString = '';
+ }
+
+ $query = $this->db->query('SELECT * FROM workers WHERE is_active = "1" '.$subpageString.' AND is_deleted != "1" ORDER BY worker_name ASC;');
+ return $query->result();
+ }
+
+ public function deleteBooking($booking_id){
+ $this->load->database();
+ $query = $this->db->query('DELETE FROM bookings WHERE booking_id = "'.$booking_id.'";');
+ }
+
+ public function getAllBookings(){
+ $this->load->database();
+ $this->load->model('Service_model');
+
+ $query = $this->db->query('SELECT * FROM bookings JOIN workers ON bookings.worker_id = workers.worker_id ORDER BY booking_date DESC, booking_start_time ASC;');
+
+ if($query->num_rows() > 0){
+ $resultsArray = array();
+ foreach($query->result() as $resultItem){
+ $resultTmp = (array)$resultItem;
+ if($resultTmp['service_ids'] != ''){
+ $servicesArray = unserialize($resultTmp['service_ids']);
+ if(is_array($servicesArray)){
+ $services = array();
+ foreach($servicesArray as $servicesArrayItem){
+ $selectedService = $this->Service_model->getServiceById($servicesArrayItem);
+ $services[] = (object)array(
+ 'service_type' => $selectedService->service_type,
+ 'service_name' => $selectedService->service_name_hu,
+ 'service_price' => $selectedService->service_price,
+ 'service_time' => $selectedService->service_time
+ );
+ }
+ $resultTmp['services'] = $services;
+ }
+ else{
+ $resultTmp['services'] = array();
+ }
+ }
+ else{
+ $resultTmp['services'] = array();
+
+ }
+ $resultsArray[] = (object)$resultTmp;
+ }
+
+
+ return $resultsArray;
+ }
+ else{
+ return 0;
+ }
+ }
+
+ public function getActualBookings(){
+ $this->load->database();
+ $this->load->model('Service_model');
+
+ $query = $this->db->query('SELECT * FROM bookings JOIN workers ON bookings.worker_id = workers.worker_id WHERE booking_date >= CURDATE() ORDER BY booking_date DESC, booking_start_time ASC;');
+
+ if($query->num_rows() > 0){
+ $resultsArray = array();
+ foreach($query->result() as $resultItem){
+ $resultTmp = (array)$resultItem;
+ if($resultTmp['service_ids'] != ''){
+ $servicesArray = unserialize($resultTmp['service_ids']);
+ if(is_array($servicesArray)){
+ $services = array();
+ foreach($servicesArray as $servicesArrayItem){
+ $selectedService = $this->Service_model->getServiceById($servicesArrayItem);
+ $services[] = (object)array(
+ 'service_type' => $selectedService->service_type,
+ 'service_name' => $selectedService->service_name_hu,
+ 'service_price' => $selectedService->service_price,
+ 'service_time' => $selectedService->service_time
+ );
+ }
+ $resultTmp['services'] = $services;
+ }
+ else{
+ $resultTmp['services'] = array();
+ }
+ }
+ else{
+ $resultTmp['services'] = array();
+
+ }
+ $resultsArray[] = (object)$resultTmp;
+ }
+
+
+ return $resultsArray;
+ }
+ else{
+ return 0;
+ }
+ }
+
+ public function getActualBookingsByWorkerID($workerID){
+ $this->load->database();
+ $this->load->model('Service_model');
+
+ $query = $this->db->query('SELECT * FROM bookings JOIN workers ON bookings.worker_id = workers.worker_id WHERE booking_date >= CURDATE() AND bookings.worker_id = "'.$workerID.'" ORDER BY booking_date DESC, booking_start_time ASC;');
+
+ if($query->num_rows() > 0){
+ $resultsArray = array();
+ foreach($query->result() as $resultItem){
+ $resultTmp = (array)$resultItem;
+ if($resultTmp['service_ids'] != ''){
+ $servicesArray = unserialize($resultTmp['service_ids']);
+ if(is_array($servicesArray)){
+ $services = array();
+ foreach($servicesArray as $servicesArrayItem){
+ $selectedService = $this->Service_model->getServiceById($servicesArrayItem);
+ $services[] = (object)array(
+ 'service_type' => $selectedService->service_type,
+ 'service_name' => $selectedService->service_name_hu,
+ 'service_price' => $selectedService->service_price,
+ 'service_time' => $selectedService->service_time
+ );
+ }
+ $resultTmp['services'] = $services;
+ }
+ else{
+ $resultTmp['services'] = array();
+ }
+ }
+ else{
+ $resultTmp['services'] = array();
+
+ }
+ $resultsArray[] = (object)$resultTmp;
+ }
+
+
+ return $resultsArray;
+ }
+ else{
+ return 0;
+ }
+ }
+
+ public function getBookingById($booking_id){
+ $this->load->database();
+ $this->load->model('Service_model');
+
+ $query = $this->db->query('SELECT * FROM bookings WHERE booking_id = "'.$booking_id.'" LIMIT 1;');
+ if($query->num_rows() > 0){
+ return $query->result()[0];
+ }
+ else{
+ return 0;
+ }
+ }
+
+ public function getWorkerById($worker_id){
+ $this->load->database();
+ $query = $this->db->query('SELECT * FROM workers WHERE worker_id = "'.$worker_id.'" LIMIT 1;');
+ if($query->num_rows() > 0){
+ return $query->result()[0];
+ }
+ else{
+ return 0;
+ }
+ }
+
+ public function getAvailableTimes($worker_id, $selectedDate, $servicelength){
+ $this->load->database();
+ $serviceLengthDateTime = new DateTime($selectedDate.' '.$servicelength);
+ $service_length_time = strtotime($servicelength);
+ $availableTimeArray = array();
+ $selectedDayName = date('D', strtotime($selectedDate));
+ $dayStartTime = new DateTime($selectedDate.' 10:00');
+ $finishTime = new DateTime($selectedDate.' 18:00');
+ $lastBookingLimitDate = date('Y-m-d', strtotime("+3 months", strtotime(date('Y-m-d'))));
+
+ if($selectedDayName == 'Sun'){
+ return array();
+ }
+ elseif($selectedDayName == 'Sat'){
+ $finishTime = new DateTime($selectedDate.' 16:00');
+ }
+ else{
+ //finish time - selected service length
+ $finishTime = new DateTime($selectedDate.' 18:00');
+
+ }
+
+ $today=date_create(date('Y-m-d'));
+ $selectedDay=date_create($selectedDate);
+ $dateDiff=date_diff($today,$selectedDay);
+
+ $tmpDateStart = date_create(date('2024-02-29'));
+ $tmpDateEnd = date_create(date('2024-03-07'));
+
+ $datelength = new DateTime($servicelength);
+ $diff = $datelength->diff($finishTime);
+
+ //max time for start
+ $maxTime = $diff->h.':'.$diff->i.':00';
+ $hours = (intval($diff->h)-10)*4+1;
+ $mins = floor(intval($diff->i) / 15);
+ $loopSteps = intval($hours) + intval($mins);
+
+ for($periodIndex = 1; $periodIndex <= $loopSteps; $periodIndex++){
+ $minutes_to_add_start = $periodIndex*15;
+ $minutes_to_add_end = ($periodIndex+1)*15;
+ $startTime = new DateTime($selectedDate.' 09:45');
+ $endTime = new DateTime($selectedDate.' 09:45');
+ $startTime->add(new DateInterval('PT' . $minutes_to_add_start . 'M'));
+ $endTime->add(new DateInterval('PT' . $minutes_to_add_end . 'M'));
+ $maxTimeObject = new DateTime($maxTime);
+
+ $tz = new DateTimeZone('Europe/Budapest');
+ $addStartTimeAndLength = new DateTime($selectedDate.' '.$startTime->format('H:i:00'), $tz);
+ $addStartTimeAndLength->add(new DateInterval('PT' . intval($serviceLengthDateTime->format('H')) . 'H'));
+ $addStartTimeAndLength->add(new DateInterval('PT' . intval($serviceLengthDateTime->format('i')) . 'M'));
+
+ $currentStartTime = $startTime->format('H:i:00');
+ $currentEndTime = $endTime->format('H:i:00');
+
+
+
+ /*
+ echo '<< ';
+ print_r($serviceLengthDateTime->format('H:i:00'));
+ echo ' / ';
+ print_r($currentStartTime);
+ echo ' / ';
+ print_r($addStartTimeAndLength->format('H:i:00'));
+ echo ' >>';
+ */
+ /*
+ $query = $this->db->query('SELECT * FROM bookings WHERE booking_date = "'.$selectedDate.'" AND worker_id = "'.$worker_id.'" AND (
+
+ (TIME(booking_start_time) >= CAST("'.$currentStartTime.'" AS TIME) AND TIME(booking_finish_time) <= CAST("'.$currentEndTime.'" AS TIME)) OR
+
+
+ (TIME(booking_start_time) <= CAST("'.$addStartTimeAndLength->format('H:i:00').'" AS TIME) AND TIME(booking_finish_time) >= CAST("'.$currentEndTime.'" AS TIME)) OR
+
+
+ (TIME(booking_start_time) >= CAST("'.$currentStartTime.'" AS TIME) AND TIME(booking_start_time) <= CAST("'.$currentEndTime.'" AS TIME) AND TIME(booking_finish_time) >= CAST("'.$currentEndTime.'" AS TIME)) OR
+
+
+ (TIME(booking_start_time) <= CAST("'.$currentStartTime.'" AS TIME) AND TIME(booking_finish_time) >= CAST("'.$currentEndTime.'" AS TIME)
+ AND TIME(booking_start_time) <= CAST("'.$currentStartTime.'" AS TIME)) OR
+
+
+ (TIME(booking_start_time) <= CAST("'.$currentStartTime.'" AS TIME) AND TIME(booking_finish_time) <= CAST("'.$currentEndTime.'" AS TIME)
+ AND TIME(booking_finish_time) >= CAST("'.$currentStartTime.'" AS TIME)) OR
+
+
+ (TIME(booking_start_time) <= CAST("'.$currentStartTime.'" AS TIME) AND TIME(booking_finish_time) >= CAST("'.$currentEndTime.'" AS TIME))
+ );
+ ');
+ */
+
+
+ $query = $this->db->query('SELECT * FROM bookings WHERE booking_date = "'.$selectedDate.'" AND worker_id = "'.$worker_id.'" AND (
+ /*start later and finish before*/
+ (TIME(booking_start_time) > CAST("'.$currentStartTime.'" AS TIME) AND TIME(booking_finish_time) < CAST("'.$currentEndTime.'" AS TIME)) OR
+
+ /*check if not end service until next booking*/
+ (TIME(booking_start_time) < CAST("'.$addStartTimeAndLength->format('H:i:00').'" AS TIME) AND TIME(booking_finish_time) >= CAST("'.$currentEndTime.'" AS TIME)) OR
+
+ /*start later and finish later*/
+ (TIME(booking_start_time) > CAST("'.$currentStartTime.'" AS TIME) AND TIME(booking_start_time) < CAST("'.$currentEndTime.'" AS TIME) AND TIME(booking_finish_time) >= CAST("'.$currentEndTime.'" AS TIME)) OR
+
+ /*start before and finish before*/
+ (TIME(booking_start_time) < CAST("'.$currentStartTime.'" AS TIME) AND TIME(booking_finish_time) >= CAST("'.$currentEndTime.'" AS TIME)
+ AND TIME(booking_start_time) < CAST("'.$currentStartTime.'" AS TIME)) OR
+
+ /**/
+ (TIME(booking_start_time) < CAST("'.$currentStartTime.'" AS TIME) AND TIME(booking_finish_time) < CAST("'.$currentEndTime.'" AS TIME)
+ AND TIME(booking_finish_time) > CAST("'.$currentStartTime.'" AS TIME)) OR
+
+ /**/
+ (TIME(booking_start_time) < CAST("'.$currentStartTime.'" AS TIME) AND TIME(booking_finish_time) >= CAST("'.$currentEndTime.'" AS TIME))
+ );
+ ');
+
+ $now = strtotime(date('H:i:s')) + 60*60;
+ $timezone = 'Europe/Budapest';
+ $todayStartTime = strtotime($currentStartTime.' '.$timezone);
+ $minDiff = ($todayStartTime - $now) / 60;
+
+ if($lastBookingLimitDate >= $selectedDate){
+ if($dateDiff->format("%R%a") == 0 && $minDiff > 0){
+ if($query->num_rows() == 0){
+ $availableTimeArray[] = $currentStartTime;
+ }
+ }
+
+ elseif($dateDiff->format("%R%a") >= 0 && ($selectedDay < $tmpDateStart || $selectedDay > $tmpDateEnd) && $dateDiff->format("%R%a") != 0){
+ if($query->num_rows() == 0){
+ $availableTimeArray[] = $currentStartTime;
+ }
+
+ }
+ }
+
+
+
+ }
+
+ return $availableTimeArray;
+
+
+ }
+
+ public function createBooking($bookingArray){
+ $this->load->database();
+ $query = $this->db->query("INSERT INTO bookings (
+ guest_name,
+ guest_email,
+ guest_phone,
+ worker_id,
+ booking_date,
+ booking_start_time,
+ booking_finish_time,
+ service_ids,
+ guest_confirmed,
+ guest_confirm_code
+ ) VALUES(
+ '".$bookingArray['guest_name']."',
+ '".$bookingArray['guest_email']."',
+ '".$bookingArray['guest_phone']."',
+ '".$bookingArray['worker_id']."',
+ '".$bookingArray['booking_date']."',
+ '".$bookingArray['booking_start_time']."',
+ '".$bookingArray['booking_finish_time']."',
+ '".$bookingArray['service_ids']."',
+ '".$bookingArray['guest_confirmed']."',
+ '".$bookingArray['guest_confirm_code']."'
+ );");
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+}
+
+?>
\ No newline at end of file
diff --git a/application/models/Service_model_20250617.php b/application/models/Service_model_20250617.php
new file mode 100755
index 0000000..1a9dae8
--- /dev/null
+++ b/application/models/Service_model_20250617.php
@@ -0,0 +1,677 @@
+load->database();
+ $query = $this->db->query('INSERT INTO services (
+ service_type,
+ service_category_no,
+ service_category_en,
+ service_category_hu,
+ service_name_no,
+ service_name_en,
+ service_name_hu,
+ service_description_no,
+ service_description_en,
+ service_description_hu,
+ service_price,
+ service_time,
+ service_category_id,
+ is_enabled
+ ) VALUES(
+ "'.$serviceArray['service_type'].'",
+ "'.$serviceArray['service_category_no'].'",
+ "'.$serviceArray['service_category_en'].'",
+ "'.$serviceArray['service_category_hu'].'",
+ "'.$serviceArray['service_name_no'].'",
+ "'.$serviceArray['service_name_en'].'",
+ "'.$serviceArray['service_name_hu'].'",
+ "'.$serviceArray['service_description_no'].'",
+ "'.$serviceArray['service_description_en'].'",
+ "'.$serviceArray['service_description_hu'].'",
+ "'.$serviceArray['service_price'].'",
+ "'.$serviceArray['service_time'].'",
+ "'.$serviceArray['service_category_id'].'",
+ "'.$serviceArray['is_enabled'].'"
+ );');
+ }
+
+ public function createServiceCategory($serviceCategoryArray){
+ $this->load->database();
+ $query = $this->db->query('INSERT INTO service_categories (
+ serv_cat_slug,
+ serv_cat_name
+ ) VALUES(
+ "'.$serviceCategoryArray['serv_cat_slug'].'",
+ "'.$serviceCategoryArray['serv_cat_name'].'"
+ );');
+ }
+
+ public function updateService($service_id, $serviceArray){
+ $this->load->database();
+
+ foreach($serviceArray as $propertyKey => $propertyValue){
+ $query = $this->db->query('UPDATE services SET '.$propertyKey.' = "'.$propertyValue.'" WHERE service_id = "'.$service_id.'";');
+ }
+ }
+
+ public function updateServiceCategory($service_category_id, $serviceCategoryArray){
+ $this->load->database();
+
+ foreach($serviceCategoryArray as $propertyKey => $propertyValue){
+ $query = $this->db->query('UPDATE service_categories SET '.$propertyKey.' = "'.$propertyValue.'" WHERE service_category_id = "'.$service_category_id.'";');
+ }
+ }
+
+ public function createWorker($workerArray){
+ $this->load->database();
+ $query = $this->db->query('INSERT INTO workers (
+ worker_name,
+ worker_profile_img,
+ worker_info,
+ is_beauty,
+ is_barber,
+ service_category_id
+ ) VALUES(
+ "'.$workerArray['worker_name'].'",
+ "'.$workerArray['worker_profile_img'].'",
+ "'.$workerArray['worker_info'].'",
+ "'.$workerArray['is_beauty'].'",
+ "'.$workerArray['is_barber'].'",
+ "'.$workerArray['service_category_id'].'"
+ );');
+ }
+
+ public function updateWorker($worker_id, $workerArray){
+ $this->load->database();
+
+ foreach($workerArray as $propertyKey => $propertyValue){
+ $query = $this->db->query('UPDATE workers SET '.$propertyKey.' = "'.$propertyValue.'" WHERE worker_id = "'.$worker_id.'";');
+ }
+ }
+
+ public function updateBooking($booking_id, $bookingArray){
+ $this->load->database();
+
+ foreach($bookingArray as $propertyKey => $propertyValue){
+ $query = $this->db->query("UPDATE bookings SET ".$propertyKey." = '".$propertyValue."' WHERE booking_id = '".$booking_id."';");
+ }
+ }
+
+ public function getAllServiceByServiceType($service_type, $lang){
+ $this->load->database();
+ $query = $this->db->query('SELECT * FROM services JOIN service_categories ON services.service_category_id = service_categories.service_category_id WHERE service_type = "'.$service_type.'" AND services.is_enabled = "1" AND services.is_deleted != "1" ORDER BY service_id ASC;');
+ $serviceArray = array();
+ if($query->num_rows() > 0){
+ foreach($query->result() as $resultItem){
+
+ $service_category = '';
+ $service_name = '';
+ $service_description = '';
+
+ switch($lang){
+ case 'no':
+ $service_category = $resultItem->service_category_no;
+ $service_name = $resultItem->service_name_no;
+ $service_description = $resultItem->service_description_no;
+ break;
+ case 'en':
+ $service_category = $resultItem->service_category_en;
+ $service_name = $resultItem->service_name_en;
+ $service_description = $resultItem->service_description_en;
+ break;
+ case 'hu':
+ $service_category = $resultItem->service_category_hu;
+ $service_name = $resultItem->service_name_hu;
+ $service_description = $resultItem->service_description_hu;
+ break;
+ }
+
+ $resultItemTmp = array(
+ 'service_id' => $resultItem->service_id,
+ 'service_type' => $resultItem->service_type,
+ 'service_category' => $service_category,
+ 'service_name' => $service_name,
+ 'service_description' => $service_description,
+ 'service_price' => $resultItem->service_price,
+ 'service_time' => $resultItem->service_time,
+ 'serv_cat_slug' => $resultItem->serv_cat_slug,
+ 'service_category_id' => $resultItem->service_category_id
+ );
+
+ $serviceArray[] = (object)$resultItemTmp;
+ }
+ }
+ return $serviceArray;
+ }
+
+ public function getServiceById($service_id){
+ $this->load->database();
+ $query = $this->db->query('SELECT * FROM services WHERE service_id = "'.$service_id.'" LIMIT 1;');
+ if($query->num_rows() > 0){
+ return $query->result()[0];
+ }
+ else{
+ return 0;
+ }
+ }
+
+ public function getServiceCategoryById($service_category_id){
+ $this->load->database();
+ $query = $this->db->query('SELECT * FROM service_categories WHERE service_category_id = "'.$service_category_id.'" LIMIT 1;');
+ if($query->num_rows() > 0){
+ return $query->result()[0];
+ }
+ else{
+ return 0;
+ }
+ }
+
+ public function getAllServices(){
+ $this->load->database();
+ $query = $this->db->query('SELECT * FROM services JOIN service_categories ON services.service_category_id = service_categories.service_category_id WHERE services.is_deleted != "1" ORDER BY service_type ASC, service_name_hu ASC;');
+ if($query->num_rows() > 0){
+ return $query->result();
+ }
+ else{
+ return 0;
+ }
+ }
+
+ public function getAllServiceCategories(){
+ $this->load->database();
+ $query = $this->db->query('SELECT * FROM service_categories WHERE is_deleted != "1" ORDER BY service_category_id;');
+ if($query->num_rows() > 0){
+ return $query->result();
+ }
+ else{
+ return 0;
+ }
+ }
+
+ public function getAvailableServices(){
+ $this->load->database();
+ $query = $this->db->query('SELECT * FROM services WHERE is_enabled = "1" AND is_deleted != "1" ORDER BY service_name_hu ASC;');
+
+ if($query->num_rows() > 0){
+
+ $serviceArray = array();
+ foreach($query->result() as $resultItem){
+ $serviceTmp = array(
+ 'service_name' => $resultItem->service_name_hu.' ('.$resultItem->service_type.')',
+ 'service_id' => $resultItem->service_id
+ );
+
+ $serviceArray[] = $serviceTmp;
+ }
+ return $serviceArray;
+ }
+ }
+
+ public function getAllWorkers(){
+ $this->load->database();
+ $query = $this->db->query('SELECT * FROM workers JOIN service_categories ON workers.service_category_id = service_categories.service_category_id WHERE workers.is_deleted != "1" ORDER BY worker_name ASC;');
+ return $query->result();
+ }
+
+ public function getWorkersByCategorySlug($serv_cat_slug){
+ $this->load->database();
+ $query = $this->db->query('SELECT * FROM workers JOIN service_categories ON workers.service_category_id = service_categories.service_category_id WHERE workers.is_deleted != "1" AND serv_cat_slug = "'.$serv_cat_slug.'" ORDER BY worker_name ASC;');
+ return $query->result();
+ }
+
+ public function getActiveWorkers($subpage = ''){
+ $this->load->database();
+ $subpageString = '';
+
+ if($subpage == 'beauty'){
+ $subpageString = ' AND is_beauty = "1"';
+ }
+ else if($subpage == 'barber'){
+ $subpageString = ' AND is_barber = "1"';
+ }
+ else{
+ $subpageString = '';
+ }
+
+ $query = $this->db->query('SELECT * FROM workers WHERE is_active = "1" '.$subpageString.' AND is_deleted != "1" ORDER BY worker_name ASC;');
+ return $query->result();
+ }
+
+ public function deleteBooking($booking_id){
+ $this->load->database();
+ $query = $this->db->query('DELETE FROM bookings WHERE booking_id = "'.$booking_id.'";');
+ }
+
+ public function getAllBookings(){
+ $this->load->database();
+ $this->load->model('Service_model');
+
+ $query = $this->db->query('SELECT * FROM bookings JOIN workers ON bookings.worker_id = workers.worker_id ORDER BY booking_date DESC, booking_start_time ASC;');
+
+ if($query->num_rows() > 0){
+ $resultsArray = array();
+ foreach($query->result() as $resultItem){
+ $resultTmp = (array)$resultItem;
+ if($resultTmp['service_ids'] != ''){
+ $servicesArray = unserialize($resultTmp['service_ids']);
+ if(is_array($servicesArray)){
+ $services = array();
+ foreach($servicesArray as $servicesArrayItem){
+ $selectedService = $this->Service_model->getServiceById($servicesArrayItem);
+ $services[] = (object)array(
+ 'service_type' => $selectedService->service_type,
+ 'service_name' => $selectedService->service_name_hu,
+ 'service_price' => $selectedService->service_price,
+ 'service_time' => $selectedService->service_time
+ );
+ }
+ $resultTmp['services'] = $services;
+ }
+ else{
+ $resultTmp['services'] = array();
+ }
+ }
+ else{
+ $resultTmp['services'] = array();
+
+ }
+ $resultsArray[] = (object)$resultTmp;
+ }
+
+
+ return $resultsArray;
+ }
+ else{
+ return 0;
+ }
+ }
+
+ public function getActualBookings(){
+ $this->load->database();
+ $this->load->model('Service_model');
+
+ $query = $this->db->query('SELECT * FROM bookings JOIN workers ON bookings.worker_id = workers.worker_id WHERE booking_date >= CURDATE() ORDER BY booking_date DESC, booking_start_time ASC;');
+
+ if($query->num_rows() > 0){
+ $resultsArray = array();
+ foreach($query->result() as $resultItem){
+ $resultTmp = (array)$resultItem;
+ if($resultTmp['service_ids'] != ''){
+ $servicesArray = unserialize($resultTmp['service_ids']);
+ if(is_array($servicesArray)){
+ $services = array();
+ foreach($servicesArray as $servicesArrayItem){
+ $selectedService = $this->Service_model->getServiceById($servicesArrayItem);
+ $services[] = (object)array(
+ 'service_type' => $selectedService->service_type,
+ 'service_name' => $selectedService->service_name_hu,
+ 'service_price' => $selectedService->service_price,
+ 'service_time' => $selectedService->service_time
+ );
+ }
+ $resultTmp['services'] = $services;
+ }
+ else{
+ $resultTmp['services'] = array();
+ }
+ }
+ else{
+ $resultTmp['services'] = array();
+
+ }
+ $resultsArray[] = (object)$resultTmp;
+ }
+
+
+ return $resultsArray;
+ }
+ else{
+ return 0;
+ }
+ }
+
+ public function getActualBookingsByWorkerID($workerID){
+ $this->load->database();
+ $this->load->model('Service_model');
+
+ $query = $this->db->query('SELECT * FROM bookings JOIN workers ON bookings.worker_id = workers.worker_id WHERE booking_date >= CURDATE() AND bookings.worker_id = "'.$workerID.'" ORDER BY booking_date DESC, booking_start_time ASC;');
+
+ if($query->num_rows() > 0){
+ $resultsArray = array();
+ foreach($query->result() as $resultItem){
+ $resultTmp = (array)$resultItem;
+ if($resultTmp['service_ids'] != ''){
+ $servicesArray = unserialize($resultTmp['service_ids']);
+ if(is_array($servicesArray)){
+ $services = array();
+ foreach($servicesArray as $servicesArrayItem){
+ $selectedService = $this->Service_model->getServiceById($servicesArrayItem);
+ $services[] = (object)array(
+ 'service_type' => $selectedService->service_type,
+ 'service_name' => $selectedService->service_name_hu,
+ 'service_price' => $selectedService->service_price,
+ 'service_time' => $selectedService->service_time
+ );
+ }
+ $resultTmp['services'] = $services;
+ }
+ else{
+ $resultTmp['services'] = array();
+ }
+ }
+ else{
+ $resultTmp['services'] = array();
+
+ }
+ $resultsArray[] = (object)$resultTmp;
+ }
+
+
+ return $resultsArray;
+ }
+ else{
+ return 0;
+ }
+ }
+
+ public function getBookingById($booking_id){
+ $this->load->database();
+ $this->load->model('Service_model');
+
+ $query = $this->db->query('SELECT * FROM bookings WHERE booking_id = "'.$booking_id.'" LIMIT 1;');
+ if($query->num_rows() > 0){
+ return $query->result()[0];
+ }
+ else{
+ return 0;
+ }
+ }
+
+ public function getWorkerById($worker_id){
+ $this->load->database();
+ $query = $this->db->query('SELECT * FROM workers WHERE worker_id = "'.$worker_id.'" LIMIT 1;');
+ if($query->num_rows() > 0){
+ return $query->result()[0];
+ }
+ else{
+ return 0;
+ }
+ }
+
+
+ public function getAvailableTimes($worker_id, $selectedDate, $servicelength) {
+ $this->load->database();
+ if (strtotime($selectedDate) < strtotime(date('Y-m-d'))) {
+ return [];
+ }
+ $ts = strtotime($selectedDate);
+ $debugDate = date('Y-m-d (w)', $ts) . ' - ' . date('l', $ts);
+ log_message('error', "📅 DEBUG DATE CHECK for '{$selectedDate}': {$debugDate}");
+ log_message('error', "⏱ Timezone: " . date_default_timezone_get());
+ $serviceLengthTime = strtotime($servicelength);
+ $availableTimeArray = [];
+
+ // Check override first
+ $overrideQuery = $this->db->query("
+ SELECT * FROM worker_schedule_overrides
+ WHERE worker_id = '$worker_id' AND date = '$selectedDate'
+ LIMIT 1
+ ");
+
+ if ($overrideQuery->num_rows() > 0) {
+ $override = $overrideQuery->row();
+
+ if ($override->is_day_off) return [];
+
+ $dayStartTime = new DateTime($selectedDate.' '.$override->start_time);
+ $finishTime = new DateTime($selectedDate.' '.$override->end_time);
+ } else {
+ $weekday = date('w', strtotime($selectedDate)); // 0 = Sunday, 6 = Saturday
+ $weekNumber = date('W', strtotime($selectedDate));
+ $isOddWeek = $weekNumber % 2 !== 0;
+
+ $scheduleQuery = $this->db->query("
+ SELECT * FROM worker_schedule
+ WHERE worker_id = '{$worker_id}'
+ AND weekday = '{$weekday}'
+ AND (
+ is_alternate_week = 0
+ OR (is_alternate_week = 1 AND " . ($isOddWeek ? "1" : "0") . ")
+ )
+ ");
+
+ if ($scheduleQuery->num_rows() == 0) {
+ return [];
+ }
+
+ $schedule = $scheduleQuery->row();
+ $dayStartTime = new DateTime($selectedDate . ' ' . $schedule->start_time);
+ $finishTime = new DateTime($selectedDate . ' ' . $schedule->end_time);
+ }
+
+ $interval = new DateInterval('PT15M');
+ list($h, $m) = explode(':', $servicelength);
+ $serviceDuration = new DateInterval('PT' . (int)$h . 'H' . (int)$m . 'M');
+
+ for ($current = clone $dayStartTime; $current < $finishTime; $current->add($interval)) {
+ $slotEnd = clone $current;
+ $slotEnd->add($serviceDuration);
+ if ($slotEnd > $finishTime) break;
+ if ($selectedDate == date('Y-m-d') && $current < new DateTime()) continue;
+
+ $startTimeStr = $current->format('H:i:s');
+ $endTimeStr = $slotEnd->format('H:i:s');
+
+ $bookingQuery = $this->db->query("
+ SELECT * FROM bookings
+ WHERE booking_date = '{$selectedDate}'
+ AND worker_id = '{$worker_id}'
+ AND (
+ (booking_start_time < '{$endTimeStr}' AND booking_finish_time > '{$startTimeStr}')
+ )
+ ");
+
+ if ($bookingQuery->num_rows() == 0) {
+ $availableTimeArray[] = $startTimeStr;
+ }
+ log_message('debug', 'Selected Date: ' . $selectedDate);
+ log_message('debug', 'Weekday: ' . $weekday);
+ log_message('debug', 'Worker ID: ' . $worker_id);
+ log_message('debug', 'Query: ' . $this->db->last_query());
+ }
+
+ return $availableTimeArray;
+ }
+
+
+
+ public function createBooking($bookingArray){
+ $this->load->database();
+ $query = $this->db->query("INSERT INTO bookings (
+ guest_name,
+ guest_email,
+ guest_phone,
+ worker_id,
+ booking_date,
+ booking_start_time,
+ booking_finish_time,
+ service_ids,
+ guest_confirmed,
+ guest_confirm_code
+ ) VALUES(
+ '".$bookingArray['guest_name']."',
+ '".$bookingArray['guest_email']."',
+ '".$bookingArray['guest_phone']."',
+ '".$bookingArray['worker_id']."',
+ '".$bookingArray['booking_date']."',
+ '".$bookingArray['booking_start_time']."',
+ '".$bookingArray['booking_finish_time']."',
+ '".$bookingArray['service_ids']."',
+ '".$bookingArray['guest_confirmed']."',
+ '".$bookingArray['guest_confirm_code']."'
+ );");
+ }
+
+ public function getWorkerSchedule($worker_id) {
+ return $this->db
+ ->where('worker_id', $worker_id)
+ ->order_by('weekday', 'ASC')
+ ->get('worker_schedule')
+ ->result();
+ }
+
+ public function clearWorkerSchedule($worker_id) {
+ $this->load->database();
+ $this->db->where('worker_id', $worker_id)->delete('worker_schedule');
+ }
+
+ public function addWorkerSchedule($data) {
+ $this->db->insert('worker_schedule', $data);
+ }
+
+ public function getAllWorkerSchedules() {
+ $query = $this->db->query('SELECT * FROM worker_schedule');
+ return $query->result();
+ }
+
+ public function getAllWorkerOverrides() {
+ $query = $this->db->query('SELECT * FROM worker_schedule_overrides');
+ return $query->result();
+ }
+
+ public function getWorkerScheduleOverrides() {
+ $this->load->database();
+ $query = $this->db->query("
+ SELECT o.*, w.worker_name
+ FROM worker_schedule_overrides o
+ JOIN workers w ON o.worker_id = w.worker_id
+ ORDER BY o.date DESC
+ ");
+ return $query->result();
+ }
+
+ public function createWorkerScheduleOverride($override) {
+ $this->db->insert('worker_schedule_overrides', $override);
+ }
+
+ public function getWorkerScheduleByDay($worker_id, $weekday) {
+ $this->db->where('worker_id', $worker_id);
+ $this->db->where('weekday', $weekday);
+ $query = $this->db->get('worker_schedule');
+ return $query->row(); // null if no row
+ }
+
+ public function isEvenWeek($date) {
+ return ((int)date('W', strtotime($date)) % 2) === 0;
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+}
+
+?>
diff --git a/application/models/User_model.php b/application/models/User_model.php
new file mode 100755
index 0000000..5ea5102
--- /dev/null
+++ b/application/models/User_model.php
@@ -0,0 +1,224 @@
+load->database();
+ $query = $this->db->query('SELECT * FROM users WHERE username = "'.$username.'" AND password = "'.hash('sha256', $password).'" AND is_enabled = 1 LIMIT 1');
+
+ if($query->num_rows() == 1){
+ return 1;
+ }
+ else{
+ return 0;
+ }
+ }
+
+ public function getAllUser(){
+ $this->load->database();
+ $query = $this->db->query('SELECT * FROM users JOIN permissions ON users.permission_slug = permissions.permission_slug ORDER BY fullname ASC');
+ $userResults = $query->result();
+
+ foreach($userResults as $userResultItem){
+ if($userResultItem->profile_img_url == ''){
+ $userResultItem->profile_img_url = base_url().'img/default_profile.jpg';
+ }
+ }
+ return $userResults;
+ }
+
+ public function getUserByUsername($username){
+ $this->load->database();
+ $query = $this->db->query('SELECT * FROM users JOIN permissions ON users.permission_slug = permissions.permission_slug WHERE username = "'.$username.'" LIMIT 1');
+ if($query->num_rows() == 1){
+
+ if($query->result()[0]->profile_img_url == ''){
+ $query->result()[0]->profile_img_url = base_url().'img/default_profile.jpg';
+ }
+ return $query->result()[0];
+ }
+ else{
+ return 0;
+ }
+ }
+
+ public function getAllUserPermission(){
+ $this->load->database();
+ $query = $this->db->query('SELECT * FROM permissions;');
+ if($query->num_rows() > 0){
+ return $query->result();
+ }
+ else{
+ return 0;
+ }
+ }
+ public function getUserById($userId){
+ $this->load->database();
+ $query = $this->db->query('SELECT * FROM users JOIN permissions ON users.permission_slug = permissions.permission_slug WHERE user_id = "'.$userId.'" LIMIT 1');
+ if($query->num_rows() == 1){
+ if($query->result()[0]->profile_img_url == ''){
+ $query->result()[0]->profile_img_url = base_url().'img/default_profile.jpg';
+ }
+ return $query->result()[0];
+ }
+ else{
+ return 0;
+ }
+ }
+
+ public function deleteUser($userId){
+ $this->load->database();
+ $query = $this->db->query('DELETE FROM users WHERE user_id = "'.$userId.'";');
+ }
+
+ public function isUsernameAvailable($username){
+ $this->load->database();
+ $query = $this->db->query('SELECT * FROM users WHERE username = "'.$username.'";');
+ if($query->num_rows() == 1){
+ return 0;
+ }
+ else{
+ return 1;
+ }
+ }
+
+ public function updateUser($userId, $userArray){
+ $this->load->database();
+
+ foreach($userArray as $propertyKey => $propertyValue){
+ $query = $this->db->query('UPDATE users SET '.$propertyKey.' = "'.$propertyValue.'" WHERE user_id = "'.$userId.'";');
+ }
+ }
+
+ public function addNewUser($userArray){
+ $this->load->database();
+
+ if(!is_object($this->getUserByUsername($userArray['username']))){
+ $query = $this->db->query('INSERT INTO users (username, password, fullname, permission_slug, is_enabled, user_notes) VALUES("'.$userArray['username'].'", "'.hash('sha256', $userArray['password']).'", "'.$userArray['fullname'].'", "'.$userArray['permission_slug'].'", "'.$userArray['is_enabled'].'", "'.$userArray['user_notes'].'");');
+ return 1;
+ }
+ else{
+ return 0;
+ }
+
+ }
+
+ public function getAllUserGroup(){
+ $this->load->database();
+ $query = $this->db->query('SELECT * FROM permissions ORDER BY permission_name ASC;');
+ return $query->result();
+ }
+
+ public function getPermissionById($groupId){
+ $this->load->database();
+ $query = $this->db->query('SELECT * FROM permissions WHERE permission_id = "'.$groupId.'" LIMIT 1;');
+ return $query->result()[0];
+ }
+
+ public function getPermissionBySlug($permission_slug){
+ $this->load->database();
+ $query = $this->db->query('SELECT * FROM permissions WHERE permission_slug = "'.$permission_slug.'" LIMIT 1;');
+ return $query->result()[0];
+ }
+
+ public function sendEmail($addressList, $lang, $subpage){
+ // Import PHPMailer classes into the global namespace
+ // These must be at the top of your script, not inside a function
+ echo $lang;
+ if(!empty($addressList)){
+ foreach($addressList as $addressListItem){
+ // Instantiation and passing `true` enables exceptions
+ $mail = new PHPMailer(false);
+ $mail->SMTPDebug = false;
+ $mail->do_debug = 1;
+ try {
+ //Server settings
+ $mail->CharSet = 'UTF-8';
+ //$mail->SMTPDebug = SMTP::DEBUG_SERVER; // Enable verbose debug output
+ $mail->isSMTP(); //Send using SMTP
+ $mail->Host = 'mail.absolutesolution.hu'; //Set the SMTP server to send through
+ $mail->SMTPAuth = true; //Enable SMTP authentication
+ $mail->Username = 'reservations@studiobeve.no'; //SMTP username
+ $mail->Password = 'StudioBeve-1234'; //SMTP password
+ $mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS; //Enable TLS encryption; `PHPMailer::ENCRYPTION_SMTPS` encouraged
+ $mail->Port = 465; //TCP port to connect to, use 465 for `PHPMailer::ENCRYPTION_SMTPS` above
+
+ //Recipients
+ $mail->setFrom('reservations@studiobeve.no', '[studiobeve]');
+ $mail->addAddress($addressListItem['addressee_email'], $addressListItem['addressee_name']); // Add a recipient
+ //$mail->addAddress('ellen@example.com'); // Name is optional
+ //$mail->addReplyTo('info@example.com', 'Information');
+ $mail->addCC('evelin@studiobeve.no');
+ //$mail->addBCC('bcc@example.com');
+
+ // Attachments
+ if(is_array($addressListItem['attachments'])){
+ $attachments = $addressListItem['attachments'];
+ foreach($attachments as $attachmentsItem){
+ $mail->addAttachment(getcwd().'/documents/'.$attachmentsItem); // Add attachments
+ }
+ }
+ //$mail->addAttachment('/tmp/image.jpg', 'new.jpg'); // Optional name
+
+ // Content
+ $mail->isHTML(true); // Set email format to HTML
+ $mail->Subject = $addressListItem['subject'];
+ ob_start();
+ $body = ob_get_clean();
+ $body .= $addressListItem['content'];
+
+ $mail->Body = $body;
+ //$mail->AltBody = strip_tags($answer_message);
+
+ $mail->send();
+ echo 'Üzenet elküldve';
+ if($subpage != ''){
+ header('location:'.base_url().$lang.'/booking-finished/'.$subpage);
+ }
+
+ } catch (Exception $e) {
+ //header('location:'.base_url().'manage-applicants/?email-sent=false&error='.$mail->ErrorInfo);
+ echo "Üzenetküldési hiba. Mailer Error: {$mail->ErrorInfo}";
+ }
+
+ }
+ }
+
+
+
+ }
+
+
+ public function is_user_admin($username){
+ $this->load->database();
+ $query = $this->db->query('SELECT * FROM users JOIN permissions ON users.permission_slug = permissions.permission_slug WHERE username = "'.$username.'" LIMIT 1');
+ if($query->num_rows() == 1){
+ if($query->result()[0]->permission_slug == 'admin'){
+ return 1;
+ }
+ else{
+ return 0;
+ }
+ }
+ else{
+ return 0;
+ }
+ }
+
+
+
+
+
+}
+
+?>
\ No newline at end of file
diff --git a/application/models/index.html b/application/models/index.html
new file mode 100755
index 0000000..b48b490
--- /dev/null
+++ b/application/models/index.html
@@ -0,0 +1,11 @@
+
+
+
+ 403 Forbidden
+
+
+
+Directory access is forbidden.
+
+
+
diff --git a/application/models_20231211/Service_model.php b/application/models_20231211/Service_model.php
new file mode 100755
index 0000000..5b5788e
--- /dev/null
+++ b/application/models_20231211/Service_model.php
@@ -0,0 +1,299 @@
+load->database();
+ $query = $this->db->query('INSERT INTO services (
+ service_type,
+ service_category,
+ service_name,
+ service_description,
+ service_price,
+ service_time,
+ service_note
+ ) VALUES(
+ "'.$serviceArray['service_type'].'",
+ "'.$serviceArray['service_category'].'",
+ "'.$serviceArray['service_name'].'",
+ "'.$serviceArray['service_description'].'",
+ "'.$serviceArray['service_price'].'",
+ "'.$serviceArray['service_time'].'",
+ "'.$serviceArray['service_note'].'"
+ );');
+ }
+
+ public function updateService($service_id, $serviceArray){
+ $this->load->database();
+
+ foreach($serviceArray as $propertyKey => $propertyValue){
+ $query = $this->db->query('UPDATE users SET '.$propertyKey.' = "'.$propertyValue.'" WHERE service_id = "'.$service_id.'";');
+ }
+ }
+
+ public function getAllServiceByServiceType($service_type, $lang){
+ $this->load->database();
+ $query = $this->db->query('SELECT * FROM services WHERE service_type = "'.$service_type.'" ORDER BY service_id ASC;');
+ $serviceArray = array();
+ if($query->num_rows() > 0){
+ foreach($query->result() as $resultItem){
+
+ $service_category = '';
+ $service_name = '';
+ $service_description = '';
+
+ switch($lang){
+ case 'no':
+ $service_category = $resultItem->service_category_no;
+ $service_name = $resultItem->service_name_no;
+ $service_description = $resultItem->service_description_no;
+ break;
+ case 'en':
+ $service_category = $resultItem->service_category_en;
+ $service_name = $resultItem->service_name_en;
+ $service_description = $resultItem->service_description_en;
+ break;
+ case 'hu':
+ $service_category = $resultItem->service_category_hu;
+ $service_name = $resultItem->service_name_hu;
+ $service_description = $resultItem->service_description_hu;
+ break;
+ }
+
+ $resultItemTmp = array(
+ 'service_id' => $resultItem->service_id,
+ 'service_type' => $resultItem->service_type,
+ 'service_category' => $service_category,
+ 'service_name' => $service_name,
+ 'service_description' => $service_description,
+ 'service_price' => $resultItem->service_price,
+ 'service_time' => $resultItem->service_time
+ );
+
+ $serviceArray[] = (object)$resultItemTmp;
+ }
+ }
+ return $serviceArray;
+ }
+
+ public function getServiceById($service_id){
+ $this->load->database();
+ $query = $this->db->query('SELECT * FROM services WHERE service_id = "'.$service_id.'" LIMIT 1;');
+ if($query->num_rows() > 0){
+ return $query->result()[0];
+ }
+ else{
+ return 0;
+ }
+ }
+
+ public function getAllWorkers(){
+ $this->load->database();
+ $query = $this->db->query('SELECT * FROM workers ORDER BY worker_name ASC;');
+ return $query->result();
+ }
+
+ public function getWorkerById($worker_id){
+ $this->load->database();
+ $query = $this->db->query('SELECT * FROM workers WHERE worker_id = "'.$worker_id.'" LIMIT 1;');
+ if($query->num_rows() > 0){
+ return $query->result()[0];
+ }
+ else{
+ return 0;
+ }
+ }
+
+ public function getAvailableTimes($worker_id, $selectedDate, $servicelength){
+ $this->load->database();
+ $service_length_time = strtotime($servicelength);
+ $availableTimeArray = array();
+
+ //finish time - selected service length
+ $finishTime = new DateTime($selectedDate.' 18:00');
+ $datelength = new DateTime($servicelength);
+ $diff = $datelength->diff($finishTime);
+
+ //max time for start
+ $maxdate = $diff->h.':'.$diff->i.':00';
+ $hours = (intval($diff->h)-8)*4+1;
+ $mins = floor(intval($diff->i) / 15);
+ $loopSteps = intval($hours) + intval($mins);
+
+ for($periodIndex = 1; $periodIndex <= $loopSteps; $periodIndex++){
+ $minutes_to_add_start = $periodIndex*15;
+ $minutes_to_add_end = ($periodIndex+1)*15;
+ $startTime = new DateTime($selectedDate.' 07:45');
+ $endTime = new DateTime($selectedDate.' 07:45');
+ $startTime->add(new DateInterval('PT' . $minutes_to_add_start . 'M'));
+ $endTime->add(new DateInterval('PT' . $minutes_to_add_end . 'M'));
+
+ $currentStartTime = $startTime->format('H:i:00');
+ $currentEndTime = $endTime->format('H:i:00');
+
+ $query = $this->db->query('SELECT * FROM bookings WHERE booking_date = "'.$selectedDate.'" AND worker_id = "'.$worker_id.'" AND (
+ (TIME(booking_start_time) >= CAST("'.$currentStartTime.'" AS TIME) AND TIME(booking_finish_time) <= CAST("'.$currentEndTime.'" AS TIME)) OR
+
+ (TIME(booking_start_time) >= CAST("'.$currentStartTime.'" AS TIME) AND TIME(booking_start_time) <= CAST("'.$currentEndTime.'" AS TIME) AND TIME(booking_finish_time) >= CAST("'.$currentEndTime.'" AS TIME)) OR
+
+ (TIME(booking_start_time) <= CAST("'.$currentStartTime.'" AS TIME) AND TIME(booking_finish_time) >= CAST("'.$currentEndTime.'" AS TIME)
+ AND TIME(booking_start_time) <= CAST("'.$currentStartTime.'" AS TIME)) OR
+
+ (TIME(booking_start_time) <= CAST("'.$currentStartTime.'" AS TIME) AND TIME(booking_finish_time) <= CAST("'.$currentEndTime.'" AS TIME)
+ AND TIME(booking_finish_time) >= CAST("'.$currentStartTime.'" AS TIME)) OR
+
+ (TIME(booking_start_time) <= CAST("'.$currentStartTime.'" AS TIME) AND TIME(booking_finish_time) >= CAST("'.$currentEndTime.'" AS TIME))
+ );
+ ');
+
+ if($query->num_rows() == 0){
+ $availableTimeArray[] = $currentStartTime;
+ }
+
+ }
+
+
+ return $availableTimeArray;
+
+
+ }
+
+ public function createBooking($bookingArray){
+ $this->load->database();
+ $query = $this->db->query("INSERT INTO bookings (
+ guest_name,
+ guest_email,
+ guest_phone,
+ worker_id,
+ booking_date,
+ booking_start_time,
+ booking_finish_time,
+ service_ids,
+ guest_confirmed,
+ guest_confirm_code
+ ) VALUES(
+ '".$bookingArray['guest_name']."',
+ '".$bookingArray['guest_email']."',
+ '".$bookingArray['guest_phone']."',
+ '".$bookingArray['worker_id']."',
+ '".$bookingArray['booking_date']."',
+ '".$bookingArray['booking_start_time']."',
+ '".$bookingArray['booking_finish_time']."',
+ '".$bookingArray['service_ids']."',
+ '".$bookingArray['guest_confirmed']."',
+ '".$bookingArray['guest_confirm_code']."'
+ );");
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+}
+
+?>
\ No newline at end of file
diff --git a/application/models_20231211/User_model.php b/application/models_20231211/User_model.php
new file mode 100755
index 0000000..d96d329
--- /dev/null
+++ b/application/models_20231211/User_model.php
@@ -0,0 +1,182 @@
+load->database();
+ $query = $this->db->query('SELECT * FROM users WHERE username = "'.$username.'" AND password = "'.hash('sha256', $password).'" AND is_enabled = 1 LIMIT 1');
+
+ if($query->num_rows() == 1){
+ return 1;
+ }
+ else{
+ return 0;
+ }
+ }
+
+ public function getAllUser(){
+ $this->load->database();
+ $query = $this->db->query('SELECT * FROM users JOIN privilegies ON users.privilegy_group_id = privilegies.privilegy_group_id ORDER BY fullname ASC');
+ $userResults = $query->result();
+
+ foreach($userResults as $userResultItem){
+ if($userResultItem->profile_img_url == ''){
+ $userResultItem->profile_img_url = base_url().'img/default_profile.jpg';
+ }
+ }
+ return $userResults;
+ }
+
+ public function getUserByUsername($username){
+ $this->load->database();
+ $query = $this->db->query('SELECT * FROM users JOIN privilegies ON users.privilegy_group_id = privilegies.privilegy_group_id WHERE username = "'.$username.'" LIMIT 1');
+ if($query->num_rows() == 1){
+
+ if($query->result()[0]->profile_img_url == ''){
+ $query->result()[0]->profile_img_url = base_url().'img/default_profile.jpg';
+ }
+ return $query->result()[0];
+ }
+ else{
+ return 0;
+ }
+ }
+
+ public function getUserById($userId){
+ $this->load->database();
+ $query = $this->db->query('SELECT * FROM users JOIN privilegies ON users.privilegy_group_id = privilegies.privilegy_group_id WHERE user_id = "'.$userId.'" LIMIT 1');
+ if($query->num_rows() == 1){
+ if($query->result()[0]->profile_img_url == ''){
+ $query->result()[0]->profile_img_url = base_url().'img/default_profile.jpg';
+ }
+ return $query->result()[0];
+ }
+ else{
+ return 0;
+ }
+ }
+
+ public function deleteUser($userId){
+ $this->load->database();
+ $query = $this->db->query('DELETE FROM users WHERE user_id = "'.$userId.'";');
+ }
+
+ public function isUsernameAvailable($username){
+ $this->load->database();
+ $query = $this->db->query('SELECT * FROM users WHERE username = "'.$username.'";');
+ if($query->num_rows() == 1){
+ return 0;
+ }
+ else{
+ return 1;
+ }
+ }
+
+ public function updateUser($userId, $userArray){
+ $this->load->database();
+
+ foreach($userArray as $propertyKey => $propertyValue){
+ $query = $this->db->query('UPDATE users SET '.$propertyKey.' = "'.hash('sha256',$propertyValue).'" WHERE user_id = "'.$userId.'";');
+ }
+ }
+
+ public function addNewUser($userArray){
+ $this->load->database();
+
+ if(!is_object($this->getUserByUsername($userArray['username']))){
+ $query = $this->db->query('INSERT INTO users (username, password, fullname, privilegy_group_id, is_enabled, user_notes) VALUES("'.$userArray['username'].'", "'.hash('sha256', $userArray['password']).'", "'.$userArray['fullname'].'", "'.$userArray['privilegy_group_id'].'", "'.$userArray['is_enabled'].'", "'.$userArray['user_notes'].'");');
+ return 1;
+ }
+ else{
+ return 0;
+ }
+
+ }
+
+
+
+
+ public function sendEmail($addressList, $lang, $subpage){
+ // Import PHPMailer classes into the global namespace
+ // These must be at the top of your script, not inside a function
+
+ if(!empty($addressList)){
+ foreach($addressList as $addressListItem){
+ // Instantiation and passing `true` enables exceptions
+ $mail = new PHPMailer(false);
+ $mail->SMTPDebug = false;
+ $mail->do_debug = 1;
+ try {
+ //Server settings
+ $mail->CharSet = 'UTF-8';
+ //$mail->SMTPDebug = SMTP::DEBUG_SERVER; // Enable verbose debug output
+ $mail->isSMTP(); //Send using SMTP
+ $mail->Host = 'mail.absolutesolution.hu'; //Set the SMTP server to send through
+ $mail->SMTPAuth = true; //Enable SMTP authentication
+ $mail->Username = 'reservations@studiobeve.no'; //SMTP username
+ $mail->Password = 'StudioBeve-1234'; //SMTP password
+ $mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS; //Enable TLS encryption; `PHPMailer::ENCRYPTION_SMTPS` encouraged
+ $mail->Port = 465; //TCP port to connect to, use 465 for `PHPMailer::ENCRYPTION_SMTPS` above
+
+ //Recipients
+ $mail->setFrom('reservations@studiobeve.no', '[studiobeve]');
+ $mail->addAddress($addressListItem['addressee_email'], $addressListItem['addressee_name']); // Add a recipient
+ //$mail->addAddress('ellen@example.com'); // Name is optional
+ //$mail->addReplyTo('info@example.com', 'Information');
+ //$mail->addCC('cc@example.com');
+ //$mail->addBCC('bcc@example.com');
+
+ // Attachments
+ if(is_array($addressListItem['attachments'])){
+ $attachments = $addressListItem['attachments'];
+ foreach($attachments as $attachmentsItem){
+ $mail->addAttachment(getcwd().'/documents/'.$attachmentsItem); // Add attachments
+ }
+ }
+ //$mail->addAttachment('/tmp/image.jpg', 'new.jpg'); // Optional name
+
+ // Content
+ $mail->isHTML(true); // Set email format to HTML
+ $mail->Subject = $addressListItem['subject'];
+ ob_start();
+ $body = ob_get_clean();
+ $body .= $addressListItem['content'];
+
+ $mail->Body = $body;
+ //$mail->AltBody = strip_tags($answer_message);
+
+ $mail->send();
+ echo 'Üzenet elküldve';
+ header('location:'.base_url().$lang.'/booking-finished/'.$subpage);
+ } catch (Exception $e) {
+ //header('location:'.base_url().'manage-applicants/?email-sent=false&error='.$mail->ErrorInfo);
+ echo "Üzenetküldési hiba. Mailer Error: {$mail->ErrorInfo}";
+ }
+
+ }
+ }
+
+
+
+ }
+
+
+
+
+
+
+
+
+}
+
+?>
\ No newline at end of file
diff --git a/application/models_20231211/index.html b/application/models_20231211/index.html
new file mode 100755
index 0000000..b48b490
--- /dev/null
+++ b/application/models_20231211/index.html
@@ -0,0 +1,11 @@
+
+
+
+ 403 Forbidden
+
+
+
+Directory access is forbidden.
+
+
+
diff --git a/application/models_20240401/Service_model-2023-12-20.php b/application/models_20240401/Service_model-2023-12-20.php
new file mode 100755
index 0000000..d6798ce
--- /dev/null
+++ b/application/models_20240401/Service_model-2023-12-20.php
@@ -0,0 +1,331 @@
+load->database();
+ $query = $this->db->query('INSERT INTO services (
+ service_type,
+ service_category,
+ service_name,
+ service_description,
+ service_price,
+ service_time,
+ service_note
+ ) VALUES(
+ "'.$serviceArray['service_type'].'",
+ "'.$serviceArray['service_category'].'",
+ "'.$serviceArray['service_name'].'",
+ "'.$serviceArray['service_description'].'",
+ "'.$serviceArray['service_price'].'",
+ "'.$serviceArray['service_time'].'",
+ "'.$serviceArray['service_note'].'"
+ );');
+ }
+
+ public function updateService($service_id, $serviceArray){
+ $this->load->database();
+
+ foreach($serviceArray as $propertyKey => $propertyValue){
+ $query = $this->db->query('UPDATE users SET '.$propertyKey.' = "'.$propertyValue.'" WHERE service_id = "'.$service_id.'";');
+ }
+ }
+
+ public function getAllServiceByServiceType($service_type, $lang){
+ $this->load->database();
+ $query = $this->db->query('SELECT * FROM services WHERE service_type = "'.$service_type.'" ORDER BY service_id ASC;');
+ $serviceArray = array();
+ if($query->num_rows() > 0){
+ foreach($query->result() as $resultItem){
+
+ $service_category = '';
+ $service_name = '';
+ $service_description = '';
+
+ switch($lang){
+ case 'no':
+ $service_category = $resultItem->service_category_no;
+ $service_name = $resultItem->service_name_no;
+ $service_description = $resultItem->service_description_no;
+ break;
+ case 'en':
+ $service_category = $resultItem->service_category_en;
+ $service_name = $resultItem->service_name_en;
+ $service_description = $resultItem->service_description_en;
+ break;
+ case 'hu':
+ $service_category = $resultItem->service_category_hu;
+ $service_name = $resultItem->service_name_hu;
+ $service_description = $resultItem->service_description_hu;
+ break;
+ }
+
+ $resultItemTmp = array(
+ 'service_id' => $resultItem->service_id,
+ 'service_type' => $resultItem->service_type,
+ 'service_category' => $service_category,
+ 'service_name' => $service_name,
+ 'service_description' => $service_description,
+ 'service_price' => $resultItem->service_price,
+ 'service_time' => $resultItem->service_time
+ );
+
+ $serviceArray[] = (object)$resultItemTmp;
+ }
+ }
+ return $serviceArray;
+ }
+
+ public function getServiceById($service_id){
+ $this->load->database();
+ $query = $this->db->query('SELECT * FROM services WHERE service_id = "'.$service_id.'" LIMIT 1;');
+ if($query->num_rows() > 0){
+ return $query->result()[0];
+ }
+ else{
+ return 0;
+ }
+ }
+
+ public function getAllWorkers(){
+ $this->load->database();
+ $query = $this->db->query('SELECT * FROM workers ORDER BY worker_name ASC;');
+ return $query->result();
+ }
+
+ public function getWorkerById($worker_id){
+ $this->load->database();
+ $query = $this->db->query('SELECT * FROM workers WHERE worker_id = "'.$worker_id.'" LIMIT 1;');
+ if($query->num_rows() > 0){
+ return $query->result()[0];
+ }
+ else{
+ return 0;
+ }
+ }
+
+ public function getAvailableTimes($worker_id, $selectedDate, $servicelength){
+ $this->load->database();
+ $service_length_time = strtotime($servicelength);
+ $availableTimeArray = array();
+ $selectedDayName = date('D', strtotime($selectedDate));
+ $dayStartTime = new DateTime($selectedDate.' 10:00');
+ $finishTime = new DateTime($selectedDate.' 18:00');
+ if($selectedDayName == 'Sun'){
+ return array();
+ }
+ elseif($selectedDayName == 'Sat'){
+ $finishTime = new DateTime($selectedDate.' 16:00');
+ }
+ else{
+ //finish time - selected service length
+ $finishTime = new DateTime($selectedDate.' 18:00');
+
+ }
+
+ $today=date_create(date('Y-m-d'));
+ $selectedDay=date_create($selectedDate);
+ $dateDiff=date_diff($today,$selectedDay);
+
+ $tmpDateStart = date_create(date('2023-12-22'));
+ $tmpDateEnd = date_create(date('2024-01-06'));
+
+ $datelength = new DateTime($servicelength);
+ $diff = $datelength->diff($finishTime);
+
+ //max time for start
+ $maxTime = $diff->h.':'.$diff->i.':00';
+ $hours = (intval($diff->h)-10)*4+1;
+ $mins = floor(intval($diff->i) / 15);
+ $loopSteps = intval($hours) + intval($mins);
+
+ for($periodIndex = 1; $periodIndex <= $loopSteps; $periodIndex++){
+ $minutes_to_add_start = $periodIndex*15;
+ $minutes_to_add_end = ($periodIndex+1)*15;
+ $startTime = new DateTime($selectedDate.' 09:45');
+ $endTime = new DateTime($selectedDate.' 09:45');
+ $startTime->add(new DateInterval('PT' . $minutes_to_add_start . 'M'));
+ $endTime->add(new DateInterval('PT' . $minutes_to_add_end . 'M'));
+ $maxTimeObject = new DateTime($maxTime);
+
+ $currentStartTime = $startTime->format('H:i:00');
+ $currentEndTime = $endTime->format('H:i:00');
+
+ $query = $this->db->query('SELECT * FROM bookings WHERE booking_date = "'.$selectedDate.'" AND worker_id = "'.$worker_id.'" AND (
+ (TIME(booking_start_time) >= CAST("'.$currentStartTime.'" AS TIME) AND TIME(booking_finish_time) <= CAST("'.$currentEndTime.'" AS TIME)) OR
+
+ (TIME(booking_start_time) >= CAST("'.$currentStartTime.'" AS TIME) AND TIME(booking_start_time) <= CAST("'.$currentEndTime.'" AS TIME) AND TIME(booking_finish_time) >= CAST("'.$currentEndTime.'" AS TIME)) OR
+
+ (TIME(booking_start_time) <= CAST("'.$currentStartTime.'" AS TIME) AND TIME(booking_finish_time) >= CAST("'.$currentEndTime.'" AS TIME)
+ AND TIME(booking_start_time) <= CAST("'.$currentStartTime.'" AS TIME)) OR
+
+ (TIME(booking_start_time) <= CAST("'.$currentStartTime.'" AS TIME) AND TIME(booking_finish_time) <= CAST("'.$currentEndTime.'" AS TIME)
+ AND TIME(booking_finish_time) >= CAST("'.$currentStartTime.'" AS TIME)) OR
+
+ (TIME(booking_start_time) <= CAST("'.$currentStartTime.'" AS TIME) AND TIME(booking_finish_time) >= CAST("'.$currentEndTime.'" AS TIME))
+ );
+ ');
+
+ $now = strtotime(date('H:i:s')) + 60*60;
+ $timezone = 'Europe/Budapest';
+ $todayStartTime = strtotime($currentStartTime.' '.$timezone);
+ $minDiff = ($todayStartTime - $now) / 60;
+
+ if($dateDiff->format("%R%a") == 0 && $minDiff > 0){
+ if($query->num_rows() == 0){
+ $availableTimeArray[] = $currentStartTime;
+ }
+ }
+ elseif($dateDiff->format("%R%a") >= 0 && ($selectedDay < $tmpDateStart || $selectedDay > $tmpDateEnd) && $dateDiff->format("%R%a") != 0){
+ if($query->num_rows() == 0){
+ $availableTimeArray[] = $currentStartTime;
+ }
+
+ }
+
+ }
+
+ return $availableTimeArray;
+
+
+ }
+
+ public function createBooking($bookingArray){
+ $this->load->database();
+ $query = $this->db->query("INSERT INTO bookings (
+ guest_name,
+ guest_email,
+ guest_phone,
+ worker_id,
+ booking_date,
+ booking_start_time,
+ booking_finish_time,
+ service_ids,
+ guest_confirmed,
+ guest_confirm_code
+ ) VALUES(
+ '".$bookingArray['guest_name']."',
+ '".$bookingArray['guest_email']."',
+ '".$bookingArray['guest_phone']."',
+ '".$bookingArray['worker_id']."',
+ '".$bookingArray['booking_date']."',
+ '".$bookingArray['booking_start_time']."',
+ '".$bookingArray['booking_finish_time']."',
+ '".$bookingArray['service_ids']."',
+ '".$bookingArray['guest_confirmed']."',
+ '".$bookingArray['guest_confirm_code']."'
+ );");
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+}
+
+?>
\ No newline at end of file
diff --git a/application/models_20240401/Service_model-20231214.php b/application/models_20240401/Service_model-20231214.php
new file mode 100755
index 0000000..0bee94f
--- /dev/null
+++ b/application/models_20240401/Service_model-20231214.php
@@ -0,0 +1,321 @@
+load->database();
+ $query = $this->db->query('INSERT INTO services (
+ service_type,
+ service_category,
+ service_name,
+ service_description,
+ service_price,
+ service_time,
+ service_note
+ ) VALUES(
+ "'.$serviceArray['service_type'].'",
+ "'.$serviceArray['service_category'].'",
+ "'.$serviceArray['service_name'].'",
+ "'.$serviceArray['service_description'].'",
+ "'.$serviceArray['service_price'].'",
+ "'.$serviceArray['service_time'].'",
+ "'.$serviceArray['service_note'].'"
+ );');
+ }
+
+ public function updateService($service_id, $serviceArray){
+ $this->load->database();
+
+ foreach($serviceArray as $propertyKey => $propertyValue){
+ $query = $this->db->query('UPDATE users SET '.$propertyKey.' = "'.$propertyValue.'" WHERE service_id = "'.$service_id.'";');
+ }
+ }
+
+ public function getAllServiceByServiceType($service_type, $lang){
+ $this->load->database();
+ $query = $this->db->query('SELECT * FROM services WHERE service_type = "'.$service_type.'" ORDER BY service_id ASC;');
+ $serviceArray = array();
+ if($query->num_rows() > 0){
+ foreach($query->result() as $resultItem){
+
+ $service_category = '';
+ $service_name = '';
+ $service_description = '';
+
+ switch($lang){
+ case 'no':
+ $service_category = $resultItem->service_category_no;
+ $service_name = $resultItem->service_name_no;
+ $service_description = $resultItem->service_description_no;
+ break;
+ case 'en':
+ $service_category = $resultItem->service_category_en;
+ $service_name = $resultItem->service_name_en;
+ $service_description = $resultItem->service_description_en;
+ break;
+ case 'hu':
+ $service_category = $resultItem->service_category_hu;
+ $service_name = $resultItem->service_name_hu;
+ $service_description = $resultItem->service_description_hu;
+ break;
+ }
+
+ $resultItemTmp = array(
+ 'service_id' => $resultItem->service_id,
+ 'service_type' => $resultItem->service_type,
+ 'service_category' => $service_category,
+ 'service_name' => $service_name,
+ 'service_description' => $service_description,
+ 'service_price' => $resultItem->service_price,
+ 'service_time' => $resultItem->service_time
+ );
+
+ $serviceArray[] = (object)$resultItemTmp;
+ }
+ }
+ return $serviceArray;
+ }
+
+ public function getServiceById($service_id){
+ $this->load->database();
+ $query = $this->db->query('SELECT * FROM services WHERE service_id = "'.$service_id.'" LIMIT 1;');
+ if($query->num_rows() > 0){
+ return $query->result()[0];
+ }
+ else{
+ return 0;
+ }
+ }
+
+ public function getAllWorkers(){
+ $this->load->database();
+ $query = $this->db->query('SELECT * FROM workers ORDER BY worker_name ASC;');
+ return $query->result();
+ }
+
+ public function getWorkerById($worker_id){
+ $this->load->database();
+ $query = $this->db->query('SELECT * FROM workers WHERE worker_id = "'.$worker_id.'" LIMIT 1;');
+ if($query->num_rows() > 0){
+ return $query->result()[0];
+ }
+ else{
+ return 0;
+ }
+ }
+
+ public function getAvailableTimes($worker_id, $selectedDate, $servicelength){
+ $this->load->database();
+ $service_length_time = strtotime($servicelength);
+ $availableTimeArray = array();
+ $selectedDayName = date('D', strtotime($selectedDate));
+ $dayStartTime = new DateTime($selectedDate.' 10:00');
+ $finishTime = new DateTime($selectedDate.' 18:00');
+ if($selectedDayName == 'Sun'){
+ return array();
+ }
+ elseif($selectedDayName == 'Sat'){
+ $finishTime = new DateTime($selectedDate.' 16:00');
+ }
+ else{
+ //finish time - selected service length
+ $finishTime = new DateTime($selectedDate.' 18:00');
+
+ }
+
+ $today=date_create(date('Y-m-d'));
+ $selectedDay=date_create($selectedDate);
+ $dateDiff=date_diff($today,$selectedDay);
+
+ $tmpDateStart = date_create(date('2023-12-22'));
+ $tmpDateEnd = date_create(date('2024-01-06'));
+
+ $datelength = new DateTime($servicelength);
+ $diff = $datelength->diff($finishTime);
+
+ //max time for start
+ $maxTime = $diff->h.':'.$diff->i.':00';
+ $hours = (intval($diff->h)-10)*4+1;
+ $mins = floor(intval($diff->i) / 15);
+ $loopSteps = intval($hours) + intval($mins);
+
+ for($periodIndex = 1; $periodIndex <= $loopSteps; $periodIndex++){
+ $minutes_to_add_start = $periodIndex*15;
+ $minutes_to_add_end = ($periodIndex+1)*15;
+ $startTime = new DateTime($selectedDate.' 09:45');
+ $endTime = new DateTime($selectedDate.' 09:45');
+ $startTime->add(new DateInterval('PT' . $minutes_to_add_start . 'M'));
+ $endTime->add(new DateInterval('PT' . $minutes_to_add_end . 'M'));
+ $maxTimeObject = new DateTime($maxTime);
+
+ $currentStartTime = $startTime->format('H:i:00');
+ $currentEndTime = $endTime->format('H:i:00');
+
+ $query = $this->db->query('SELECT * FROM bookings WHERE booking_date = "'.$selectedDate.'" AND worker_id = "'.$worker_id.'" AND (
+ (TIME(booking_start_time) >= CAST("'.$currentStartTime.'" AS TIME) AND TIME(booking_finish_time) <= CAST("'.$currentEndTime.'" AS TIME)) OR
+
+ (TIME(booking_start_time) >= CAST("'.$currentStartTime.'" AS TIME) AND TIME(booking_start_time) <= CAST("'.$currentEndTime.'" AS TIME) AND TIME(booking_finish_time) >= CAST("'.$currentEndTime.'" AS TIME)) OR
+
+ (TIME(booking_start_time) <= CAST("'.$currentStartTime.'" AS TIME) AND TIME(booking_finish_time) >= CAST("'.$currentEndTime.'" AS TIME)
+ AND TIME(booking_start_time) <= CAST("'.$currentStartTime.'" AS TIME)) OR
+
+ (TIME(booking_start_time) <= CAST("'.$currentStartTime.'" AS TIME) AND TIME(booking_finish_time) <= CAST("'.$currentEndTime.'" AS TIME)
+ AND TIME(booking_finish_time) >= CAST("'.$currentStartTime.'" AS TIME)) OR
+
+ (TIME(booking_start_time) <= CAST("'.$currentStartTime.'" AS TIME) AND TIME(booking_finish_time) >= CAST("'.$currentEndTime.'" AS TIME))
+ );
+ ');
+
+ if($dateDiff->format("%R%a") >= 0 && ($selectedDay < $tmpDateStart || $selectedDay > $tmpDateEnd) ){
+ if($query->num_rows() == 0){
+ $availableTimeArray[] = $currentStartTime;
+ }
+
+ }
+
+ }
+
+ return $availableTimeArray;
+
+
+ }
+
+ public function createBooking($bookingArray){
+ $this->load->database();
+ $query = $this->db->query("INSERT INTO bookings (
+ guest_name,
+ guest_email,
+ guest_phone,
+ worker_id,
+ booking_date,
+ booking_start_time,
+ booking_finish_time,
+ service_ids,
+ guest_confirmed,
+ guest_confirm_code
+ ) VALUES(
+ '".$bookingArray['guest_name']."',
+ '".$bookingArray['guest_email']."',
+ '".$bookingArray['guest_phone']."',
+ '".$bookingArray['worker_id']."',
+ '".$bookingArray['booking_date']."',
+ '".$bookingArray['booking_start_time']."',
+ '".$bookingArray['booking_finish_time']."',
+ '".$bookingArray['service_ids']."',
+ '".$bookingArray['guest_confirmed']."',
+ '".$bookingArray['guest_confirm_code']."'
+ );");
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+}
+
+?>
\ No newline at end of file
diff --git a/application/models_20240401/Service_model-20240301.php b/application/models_20240401/Service_model-20240301.php
new file mode 100755
index 0000000..480fbdf
--- /dev/null
+++ b/application/models_20240401/Service_model-20240301.php
@@ -0,0 +1,356 @@
+load->database();
+ $query = $this->db->query('INSERT INTO services (
+ service_type,
+ service_category,
+ service_name,
+ service_description,
+ service_price,
+ service_time,
+ service_note
+ ) VALUES(
+ "'.$serviceArray['service_type'].'",
+ "'.$serviceArray['service_category'].'",
+ "'.$serviceArray['service_name'].'",
+ "'.$serviceArray['service_description'].'",
+ "'.$serviceArray['service_price'].'",
+ "'.$serviceArray['service_time'].'",
+ "'.$serviceArray['service_note'].'"
+ );');
+ }
+
+ public function updateService($service_id, $serviceArray){
+ $this->load->database();
+
+ foreach($serviceArray as $propertyKey => $propertyValue){
+ $query = $this->db->query('UPDATE users SET '.$propertyKey.' = "'.$propertyValue.'" WHERE service_id = "'.$service_id.'";');
+ }
+ }
+
+ public function getAllServiceByServiceType($service_type, $lang){
+ $this->load->database();
+ $query = $this->db->query('SELECT * FROM services WHERE service_type = "'.$service_type.'" ORDER BY service_id ASC;');
+ $serviceArray = array();
+ if($query->num_rows() > 0){
+ foreach($query->result() as $resultItem){
+
+ $service_category = '';
+ $service_name = '';
+ $service_description = '';
+
+ switch($lang){
+ case 'no':
+ $service_category = $resultItem->service_category_no;
+ $service_name = $resultItem->service_name_no;
+ $service_description = $resultItem->service_description_no;
+ break;
+ case 'en':
+ $service_category = $resultItem->service_category_en;
+ $service_name = $resultItem->service_name_en;
+ $service_description = $resultItem->service_description_en;
+ break;
+ case 'hu':
+ $service_category = $resultItem->service_category_hu;
+ $service_name = $resultItem->service_name_hu;
+ $service_description = $resultItem->service_description_hu;
+ break;
+ }
+
+ $resultItemTmp = array(
+ 'service_id' => $resultItem->service_id,
+ 'service_type' => $resultItem->service_type,
+ 'service_category' => $service_category,
+ 'service_name' => $service_name,
+ 'service_description' => $service_description,
+ 'service_price' => $resultItem->service_price,
+ 'service_time' => $resultItem->service_time
+ );
+
+ $serviceArray[] = (object)$resultItemTmp;
+ }
+ }
+ return $serviceArray;
+ }
+
+ public function getServiceById($service_id){
+ $this->load->database();
+ $query = $this->db->query('SELECT * FROM services WHERE service_id = "'.$service_id.'" LIMIT 1;');
+ if($query->num_rows() > 0){
+ return $query->result()[0];
+ }
+ else{
+ return 0;
+ }
+ }
+
+ public function getAllWorkers(){
+ $this->load->database();
+ $query = $this->db->query('SELECT * FROM workers ORDER BY worker_name ASC;');
+ return $query->result();
+ }
+
+ public function getWorkerById($worker_id){
+ $this->load->database();
+ $query = $this->db->query('SELECT * FROM workers WHERE worker_id = "'.$worker_id.'" LIMIT 1;');
+ if($query->num_rows() > 0){
+ return $query->result()[0];
+ }
+ else{
+ return 0;
+ }
+ }
+
+ public function getAvailableTimes($worker_id, $selectedDate, $servicelength){
+ $this->load->database();
+ $serviceLengthDateTime = new DateTime($selectedDate.' '.$servicelength);
+ $service_length_time = strtotime($servicelength);
+ $availableTimeArray = array();
+ $selectedDayName = date('D', strtotime($selectedDate));
+ $dayStartTime = new DateTime($selectedDate.' 10:00');
+ $finishTime = new DateTime($selectedDate.' 18:00');
+ if($selectedDayName == 'Sun'){
+ return array();
+ }
+ elseif($selectedDayName == 'Sat'){
+ $finishTime = new DateTime($selectedDate.' 16:00');
+ }
+ else{
+ //finish time - selected service length
+ $finishTime = new DateTime($selectedDate.' 18:00');
+
+ }
+
+ $today=date_create(date('Y-m-d'));
+ $selectedDay=date_create($selectedDate);
+ $dateDiff=date_diff($today,$selectedDay);
+
+ $tmpDateStart = date_create(date('2024-02-29'));
+ $tmpDateEnd = date_create(date('2024-03-07'));
+
+ $datelength = new DateTime($servicelength);
+ $diff = $datelength->diff($finishTime);
+
+ //max time for start
+ $maxTime = $diff->h.':'.$diff->i.':00';
+ $hours = (intval($diff->h)-10)*4+1;
+ $mins = floor(intval($diff->i) / 15);
+ $loopSteps = intval($hours) + intval($mins);
+
+ for($periodIndex = 1; $periodIndex <= $loopSteps; $periodIndex++){
+ $minutes_to_add_start = $periodIndex*15;
+ $minutes_to_add_end = ($periodIndex+1)*15;
+ $startTime = new DateTime($selectedDate.' 09:45');
+ $endTime = new DateTime($selectedDate.' 09:45');
+ $startTime->add(new DateInterval('PT' . $minutes_to_add_start . 'M'));
+ $endTime->add(new DateInterval('PT' . $minutes_to_add_end . 'M'));
+ $maxTimeObject = new DateTime($maxTime);
+
+ $tz = new DateTimeZone('Europe/Budapest');
+ $addStartTimeAndLength = new DateTime($selectedDate.' '.$startTime->format('H:i:00'), $tz);
+ $addStartTimeAndLength->add(new DateInterval('PT' . intval($serviceLengthDateTime->format('H')) . 'H'));
+ $addStartTimeAndLength->add(new DateInterval('PT' . intval($serviceLengthDateTime->format('i')) . 'M'));
+
+ $currentStartTime = $startTime->format('H:i:00');
+ $currentEndTime = $endTime->format('H:i:00');
+
+
+
+ /*
+ echo '<< ';
+ print_r($serviceLengthDateTime->format('H:i:00'));
+ echo ' / ';
+ print_r($currentStartTime);
+ echo ' / ';
+ print_r($addStartTimeAndLength->format('H:i:00'));
+ echo ' >>';
+ */
+ $query = $this->db->query('SELECT * FROM bookings WHERE booking_date = "'.$selectedDate.'" AND worker_id = "'.$worker_id.'" AND (
+ /*start later and finish before*/
+ (TIME(booking_start_time) >= CAST("'.$currentStartTime.'" AS TIME) AND TIME(booking_finish_time) <= CAST("'.$currentEndTime.'" AS TIME)) OR
+
+ /*check if not end service until next booking*/
+ (TIME(booking_start_time) <= CAST("'.$addStartTimeAndLength->format('H:i:00').'" AS TIME) AND TIME(booking_finish_time) >= CAST("'.$currentEndTime.'" AS TIME)) OR
+
+ /*start later and finish later*/
+ (TIME(booking_start_time) >= CAST("'.$currentStartTime.'" AS TIME) AND TIME(booking_start_time) <= CAST("'.$currentEndTime.'" AS TIME) AND TIME(booking_finish_time) >= CAST("'.$currentEndTime.'" AS TIME)) OR
+
+ /*start before and finish before*/
+ (TIME(booking_start_time) <= CAST("'.$currentStartTime.'" AS TIME) AND TIME(booking_finish_time) >= CAST("'.$currentEndTime.'" AS TIME)
+ AND TIME(booking_start_time) <= CAST("'.$currentStartTime.'" AS TIME)) OR
+
+ /**/
+ (TIME(booking_start_time) <= CAST("'.$currentStartTime.'" AS TIME) AND TIME(booking_finish_time) <= CAST("'.$currentEndTime.'" AS TIME)
+ AND TIME(booking_finish_time) >= CAST("'.$currentStartTime.'" AS TIME)) OR
+
+ /**/
+ (TIME(booking_start_time) <= CAST("'.$currentStartTime.'" AS TIME) AND TIME(booking_finish_time) >= CAST("'.$currentEndTime.'" AS TIME))
+ );
+ ');
+
+ $now = strtotime(date('H:i:s')) + 60*60;
+ $timezone = 'Europe/Budapest';
+ $todayStartTime = strtotime($currentStartTime.' '.$timezone);
+ $minDiff = ($todayStartTime - $now) / 60;
+
+ if($dateDiff->format("%R%a") == 0 && $minDiff > 0){
+ if($query->num_rows() == 0){
+ $availableTimeArray[] = $currentStartTime;
+ }
+ }
+ elseif($dateDiff->format("%R%a") >= 0 && ($selectedDay < $tmpDateStart || $selectedDay > $tmpDateEnd) && $dateDiff->format("%R%a") != 0){
+ if($query->num_rows() == 0){
+ $availableTimeArray[] = $currentStartTime;
+ }
+
+ }
+
+ }
+
+ return $availableTimeArray;
+
+
+ }
+
+ public function createBooking($bookingArray){
+ $this->load->database();
+ $query = $this->db->query("INSERT INTO bookings (
+ guest_name,
+ guest_email,
+ guest_phone,
+ worker_id,
+ booking_date,
+ booking_start_time,
+ booking_finish_time,
+ service_ids,
+ guest_confirmed,
+ guest_confirm_code
+ ) VALUES(
+ '".$bookingArray['guest_name']."',
+ '".$bookingArray['guest_email']."',
+ '".$bookingArray['guest_phone']."',
+ '".$bookingArray['worker_id']."',
+ '".$bookingArray['booking_date']."',
+ '".$bookingArray['booking_start_time']."',
+ '".$bookingArray['booking_finish_time']."',
+ '".$bookingArray['service_ids']."',
+ '".$bookingArray['guest_confirmed']."',
+ '".$bookingArray['guest_confirm_code']."'
+ );");
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+}
+
+?>
\ No newline at end of file
diff --git a/application/models_20240401/Service_model.php b/application/models_20240401/Service_model.php
new file mode 100755
index 0000000..e702e66
--- /dev/null
+++ b/application/models_20240401/Service_model.php
@@ -0,0 +1,356 @@
+load->database();
+ $query = $this->db->query('INSERT INTO services (
+ service_type,
+ service_category,
+ service_name,
+ service_description,
+ service_price,
+ service_time,
+ service_note
+ ) VALUES(
+ "'.$serviceArray['service_type'].'",
+ "'.$serviceArray['service_category'].'",
+ "'.$serviceArray['service_name'].'",
+ "'.$serviceArray['service_description'].'",
+ "'.$serviceArray['service_price'].'",
+ "'.$serviceArray['service_time'].'",
+ "'.$serviceArray['service_note'].'"
+ );');
+ }
+
+ public function updateService($service_id, $serviceArray){
+ $this->load->database();
+
+ foreach($serviceArray as $propertyKey => $propertyValue){
+ $query = $this->db->query('UPDATE users SET '.$propertyKey.' = "'.$propertyValue.'" WHERE service_id = "'.$service_id.'";');
+ }
+ }
+
+ public function getAllServiceByServiceType($service_type, $lang){
+ $this->load->database();
+ $query = $this->db->query('SELECT * FROM services WHERE service_type = "'.$service_type.'" ORDER BY service_id ASC;');
+ $serviceArray = array();
+ if($query->num_rows() > 0){
+ foreach($query->result() as $resultItem){
+
+ $service_category = '';
+ $service_name = '';
+ $service_description = '';
+
+ switch($lang){
+ case 'no':
+ $service_category = $resultItem->service_category_no;
+ $service_name = $resultItem->service_name_no;
+ $service_description = $resultItem->service_description_no;
+ break;
+ case 'en':
+ $service_category = $resultItem->service_category_en;
+ $service_name = $resultItem->service_name_en;
+ $service_description = $resultItem->service_description_en;
+ break;
+ case 'hu':
+ $service_category = $resultItem->service_category_hu;
+ $service_name = $resultItem->service_name_hu;
+ $service_description = $resultItem->service_description_hu;
+ break;
+ }
+
+ $resultItemTmp = array(
+ 'service_id' => $resultItem->service_id,
+ 'service_type' => $resultItem->service_type,
+ 'service_category' => $service_category,
+ 'service_name' => $service_name,
+ 'service_description' => $service_description,
+ 'service_price' => $resultItem->service_price,
+ 'service_time' => $resultItem->service_time
+ );
+
+ $serviceArray[] = (object)$resultItemTmp;
+ }
+ }
+ return $serviceArray;
+ }
+
+ public function getServiceById($service_id){
+ $this->load->database();
+ $query = $this->db->query('SELECT * FROM services WHERE service_id = "'.$service_id.'" LIMIT 1;');
+ if($query->num_rows() > 0){
+ return $query->result()[0];
+ }
+ else{
+ return 0;
+ }
+ }
+
+ public function getAllWorkers(){
+ $this->load->database();
+ $query = $this->db->query('SELECT * FROM workers ORDER BY worker_name ASC;');
+ return $query->result();
+ }
+
+ public function getWorkerById($worker_id){
+ $this->load->database();
+ $query = $this->db->query('SELECT * FROM workers WHERE worker_id = "'.$worker_id.'" LIMIT 1;');
+ if($query->num_rows() > 0){
+ return $query->result()[0];
+ }
+ else{
+ return 0;
+ }
+ }
+
+ public function getAvailableTimes($worker_id, $selectedDate, $servicelength){
+ $this->load->database();
+ $serviceLengthDateTime = new DateTime($selectedDate.' '.$servicelength);
+ $service_length_time = strtotime($servicelength);
+ $availableTimeArray = array();
+ $selectedDayName = date('D', strtotime($selectedDate));
+ $dayStartTime = new DateTime($selectedDate.' 10:00');
+ $finishTime = new DateTime($selectedDate.' 18:00');
+ if($selectedDayName == 'Sun'){
+ return array();
+ }
+ elseif($selectedDayName == 'Sat'){
+ $finishTime = new DateTime($selectedDate.' 16:00');
+ }
+ else{
+ //finish time - selected service length
+ $finishTime = new DateTime($selectedDate.' 18:00');
+
+ }
+
+ $today=date_create(date('Y-m-d'));
+ $selectedDay=date_create($selectedDate);
+ $dateDiff=date_diff($today,$selectedDay);
+
+ $tmpDateStart = date_create(date('2024-03-01'));
+ $tmpDateEnd = date_create(date('2024-03-07'));
+
+ $datelength = new DateTime($servicelength);
+ $diff = $datelength->diff($finishTime);
+
+ //max time for start
+ $maxTime = $diff->h.':'.$diff->i.':00';
+ $hours = (intval($diff->h)-10)*4+1;
+ $mins = floor(intval($diff->i) / 15);
+ $loopSteps = intval($hours) + intval($mins);
+
+ for($periodIndex = 1; $periodIndex <= $loopSteps; $periodIndex++){
+ $minutes_to_add_start = $periodIndex*15;
+ $minutes_to_add_end = ($periodIndex+1)*15;
+ $startTime = new DateTime($selectedDate.' 09:45');
+ $endTime = new DateTime($selectedDate.' 09:45');
+ $startTime->add(new DateInterval('PT' . $minutes_to_add_start . 'M'));
+ $endTime->add(new DateInterval('PT' . $minutes_to_add_end . 'M'));
+ $maxTimeObject = new DateTime($maxTime);
+
+ $tz = new DateTimeZone('Europe/Budapest');
+ $addStartTimeAndLength = new DateTime($selectedDate.' '.$startTime->format('H:i:00'), $tz);
+ $addStartTimeAndLength->add(new DateInterval('PT' . intval($serviceLengthDateTime->format('H')) . 'H'));
+ $addStartTimeAndLength->add(new DateInterval('PT' . intval($serviceLengthDateTime->format('i')) . 'M'));
+
+ $currentStartTime = $startTime->format('H:i:00');
+ $currentEndTime = $endTime->format('H:i:00');
+
+
+
+ /*
+ echo '<< ';
+ print_r($serviceLengthDateTime->format('H:i:00'));
+ echo ' / ';
+ print_r($currentStartTime);
+ echo ' / ';
+ print_r($addStartTimeAndLength->format('H:i:00'));
+ echo ' >>';
+ */
+ $query = $this->db->query('SELECT * FROM bookings WHERE booking_date = "'.$selectedDate.'" AND worker_id = "'.$worker_id.'" AND (
+ /*start later and finish before*/
+ (TIME(booking_start_time) >= CAST("'.$currentStartTime.'" AS TIME) AND TIME(booking_finish_time) <= CAST("'.$currentEndTime.'" AS TIME)) OR
+
+ /*check if not end service until next booking*/
+ (TIME(booking_start_time) <= CAST("'.$addStartTimeAndLength->format('H:i:00').'" AS TIME) AND TIME(booking_finish_time) >= CAST("'.$currentEndTime.'" AS TIME)) OR
+
+ /*start later and finish later*/
+ (TIME(booking_start_time) >= CAST("'.$currentStartTime.'" AS TIME) AND TIME(booking_start_time) <= CAST("'.$currentEndTime.'" AS TIME) AND TIME(booking_finish_time) >= CAST("'.$currentEndTime.'" AS TIME)) OR
+
+ /*start before and finish before*/
+ (TIME(booking_start_time) <= CAST("'.$currentStartTime.'" AS TIME) AND TIME(booking_finish_time) >= CAST("'.$currentEndTime.'" AS TIME)
+ AND TIME(booking_start_time) <= CAST("'.$currentStartTime.'" AS TIME)) OR
+
+ /**/
+ (TIME(booking_start_time) <= CAST("'.$currentStartTime.'" AS TIME) AND TIME(booking_finish_time) <= CAST("'.$currentEndTime.'" AS TIME)
+ AND TIME(booking_finish_time) >= CAST("'.$currentStartTime.'" AS TIME)) OR
+
+ /**/
+ (TIME(booking_start_time) <= CAST("'.$currentStartTime.'" AS TIME) AND TIME(booking_finish_time) >= CAST("'.$currentEndTime.'" AS TIME))
+ );
+ ');
+
+ $now = strtotime(date('H:i:s')) + 60*60;
+ $timezone = 'Europe/Budapest';
+ $todayStartTime = strtotime($currentStartTime.' '.$timezone);
+ $minDiff = ($todayStartTime - $now) / 60;
+
+ if($dateDiff->format("%R%a") == 0 && $minDiff > 0){
+ if($query->num_rows() == 0){
+ $availableTimeArray[] = $currentStartTime;
+ }
+ }
+ elseif($dateDiff->format("%R%a") >= 0 && ($selectedDay < $tmpDateStart || $selectedDay > $tmpDateEnd) && $dateDiff->format("%R%a") != 0){
+ if($query->num_rows() == 0){
+ $availableTimeArray[] = $currentStartTime;
+ }
+
+ }
+
+ }
+
+ return $availableTimeArray;
+
+
+ }
+
+ public function createBooking($bookingArray){
+ $this->load->database();
+ $query = $this->db->query("INSERT INTO bookings (
+ guest_name,
+ guest_email,
+ guest_phone,
+ worker_id,
+ booking_date,
+ booking_start_time,
+ booking_finish_time,
+ service_ids,
+ guest_confirmed,
+ guest_confirm_code
+ ) VALUES(
+ '".$bookingArray['guest_name']."',
+ '".$bookingArray['guest_email']."',
+ '".$bookingArray['guest_phone']."',
+ '".$bookingArray['worker_id']."',
+ '".$bookingArray['booking_date']."',
+ '".$bookingArray['booking_start_time']."',
+ '".$bookingArray['booking_finish_time']."',
+ '".$bookingArray['service_ids']."',
+ '".$bookingArray['guest_confirmed']."',
+ '".$bookingArray['guest_confirm_code']."'
+ );");
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+}
+
+?>
\ No newline at end of file
diff --git a/application/models_20240401/Service_model_20240206.php b/application/models_20240401/Service_model_20240206.php
new file mode 100755
index 0000000..2aa8909
--- /dev/null
+++ b/application/models_20240401/Service_model_20240206.php
@@ -0,0 +1,356 @@
+load->database();
+ $query = $this->db->query('INSERT INTO services (
+ service_type,
+ service_category,
+ service_name,
+ service_description,
+ service_price,
+ service_time,
+ service_note
+ ) VALUES(
+ "'.$serviceArray['service_type'].'",
+ "'.$serviceArray['service_category'].'",
+ "'.$serviceArray['service_name'].'",
+ "'.$serviceArray['service_description'].'",
+ "'.$serviceArray['service_price'].'",
+ "'.$serviceArray['service_time'].'",
+ "'.$serviceArray['service_note'].'"
+ );');
+ }
+
+ public function updateService($service_id, $serviceArray){
+ $this->load->database();
+
+ foreach($serviceArray as $propertyKey => $propertyValue){
+ $query = $this->db->query('UPDATE users SET '.$propertyKey.' = "'.$propertyValue.'" WHERE service_id = "'.$service_id.'";');
+ }
+ }
+
+ public function getAllServiceByServiceType($service_type, $lang){
+ $this->load->database();
+ $query = $this->db->query('SELECT * FROM services WHERE service_type = "'.$service_type.'" ORDER BY service_id ASC;');
+ $serviceArray = array();
+ if($query->num_rows() > 0){
+ foreach($query->result() as $resultItem){
+
+ $service_category = '';
+ $service_name = '';
+ $service_description = '';
+
+ switch($lang){
+ case 'no':
+ $service_category = $resultItem->service_category_no;
+ $service_name = $resultItem->service_name_no;
+ $service_description = $resultItem->service_description_no;
+ break;
+ case 'en':
+ $service_category = $resultItem->service_category_en;
+ $service_name = $resultItem->service_name_en;
+ $service_description = $resultItem->service_description_en;
+ break;
+ case 'hu':
+ $service_category = $resultItem->service_category_hu;
+ $service_name = $resultItem->service_name_hu;
+ $service_description = $resultItem->service_description_hu;
+ break;
+ }
+
+ $resultItemTmp = array(
+ 'service_id' => $resultItem->service_id,
+ 'service_type' => $resultItem->service_type,
+ 'service_category' => $service_category,
+ 'service_name' => $service_name,
+ 'service_description' => $service_description,
+ 'service_price' => $resultItem->service_price,
+ 'service_time' => $resultItem->service_time
+ );
+
+ $serviceArray[] = (object)$resultItemTmp;
+ }
+ }
+ return $serviceArray;
+ }
+
+ public function getServiceById($service_id){
+ $this->load->database();
+ $query = $this->db->query('SELECT * FROM services WHERE service_id = "'.$service_id.'" LIMIT 1;');
+ if($query->num_rows() > 0){
+ return $query->result()[0];
+ }
+ else{
+ return 0;
+ }
+ }
+
+ public function getAllWorkers(){
+ $this->load->database();
+ $query = $this->db->query('SELECT * FROM workers ORDER BY worker_name ASC;');
+ return $query->result();
+ }
+
+ public function getWorkerById($worker_id){
+ $this->load->database();
+ $query = $this->db->query('SELECT * FROM workers WHERE worker_id = "'.$worker_id.'" LIMIT 1;');
+ if($query->num_rows() > 0){
+ return $query->result()[0];
+ }
+ else{
+ return 0;
+ }
+ }
+
+ public function getAvailableTimes($worker_id, $selectedDate, $servicelength){
+ $this->load->database();
+ $serviceLengthDateTime = new DateTime($selectedDate.' '.$servicelength);
+ $service_length_time = strtotime($servicelength);
+ $availableTimeArray = array();
+ $selectedDayName = date('D', strtotime($selectedDate));
+ $dayStartTime = new DateTime($selectedDate.' 10:00');
+ $finishTime = new DateTime($selectedDate.' 18:00');
+ if($selectedDayName == 'Sun'){
+ return array();
+ }
+ elseif($selectedDayName == 'Sat'){
+ $finishTime = new DateTime($selectedDate.' 16:00');
+ }
+ else{
+ //finish time - selected service length
+ $finishTime = new DateTime($selectedDate.' 18:00');
+
+ }
+
+ $today=date_create(date('Y-m-d'));
+ $selectedDay=date_create($selectedDate);
+ $dateDiff=date_diff($today,$selectedDay);
+
+ $tmpDateStart = date_create(date('2023-12-22'));
+ $tmpDateEnd = date_create(date('2024-01-06'));
+
+ $datelength = new DateTime($servicelength);
+ $diff = $datelength->diff($finishTime);
+
+ //max time for start
+ $maxTime = $diff->h.':'.$diff->i.':00';
+ $hours = (intval($diff->h)-10)*4+1;
+ $mins = floor(intval($diff->i) / 15);
+ $loopSteps = intval($hours) + intval($mins);
+
+ for($periodIndex = 1; $periodIndex <= $loopSteps; $periodIndex++){
+ $minutes_to_add_start = $periodIndex*15;
+ $minutes_to_add_end = ($periodIndex+1)*15;
+ $startTime = new DateTime($selectedDate.' 09:45');
+ $endTime = new DateTime($selectedDate.' 09:45');
+ $startTime->add(new DateInterval('PT' . $minutes_to_add_start . 'M'));
+ $endTime->add(new DateInterval('PT' . $minutes_to_add_end . 'M'));
+ $maxTimeObject = new DateTime($maxTime);
+
+ $tz = new DateTimeZone('Europe/Budapest');
+ $addStartTimeAndLength = new DateTime($selectedDate.' '.$startTime->format('H:i:00'), $tz);
+ $addStartTimeAndLength->add(new DateInterval('PT' . intval($serviceLengthDateTime->format('H')) . 'H'));
+ $addStartTimeAndLength->add(new DateInterval('PT' . intval($serviceLengthDateTime->format('i')) . 'M'));
+
+ $currentStartTime = $startTime->format('H:i:00');
+ $currentEndTime = $endTime->format('H:i:00');
+
+
+
+ /*
+ echo '<< ';
+ print_r($serviceLengthDateTime->format('H:i:00'));
+ echo ' / ';
+ print_r($currentStartTime);
+ echo ' / ';
+ print_r($addStartTimeAndLength->format('H:i:00'));
+ echo ' >>';
+ */
+ $query = $this->db->query('SELECT * FROM bookings WHERE booking_date = "'.$selectedDate.'" AND worker_id = "'.$worker_id.'" AND (
+ /*start later and finish before*/
+ (TIME(booking_start_time) >= CAST("'.$currentStartTime.'" AS TIME) AND TIME(booking_finish_time) <= CAST("'.$currentEndTime.'" AS TIME)) OR
+
+ /*check if not end service until next booking*/
+ (TIME(booking_start_time) <= CAST("'.$addStartTimeAndLength->format('H:i:00').'" AS TIME) AND TIME(booking_finish_time) >= CAST("'.$currentEndTime.'" AS TIME)) OR
+
+ /*start later and finish later*/
+ (TIME(booking_start_time) >= CAST("'.$currentStartTime.'" AS TIME) AND TIME(booking_start_time) <= CAST("'.$currentEndTime.'" AS TIME) AND TIME(booking_finish_time) >= CAST("'.$currentEndTime.'" AS TIME)) OR
+
+ /*start before and finish before*/
+ (TIME(booking_start_time) <= CAST("'.$currentStartTime.'" AS TIME) AND TIME(booking_finish_time) >= CAST("'.$currentEndTime.'" AS TIME)
+ AND TIME(booking_start_time) <= CAST("'.$currentStartTime.'" AS TIME)) OR
+
+ /**/
+ (TIME(booking_start_time) <= CAST("'.$currentStartTime.'" AS TIME) AND TIME(booking_finish_time) <= CAST("'.$currentEndTime.'" AS TIME)
+ AND TIME(booking_finish_time) >= CAST("'.$currentStartTime.'" AS TIME)) OR
+
+ /**/
+ (TIME(booking_start_time) <= CAST("'.$currentStartTime.'" AS TIME) AND TIME(booking_finish_time) >= CAST("'.$currentEndTime.'" AS TIME))
+ );
+ ');
+
+ $now = strtotime(date('H:i:s')) + 60*60;
+ $timezone = 'Europe/Budapest';
+ $todayStartTime = strtotime($currentStartTime.' '.$timezone);
+ $minDiff = ($todayStartTime - $now) / 60;
+
+ if($dateDiff->format("%R%a") == 0 && $minDiff > 0){
+ if($query->num_rows() == 0){
+ $availableTimeArray[] = $currentStartTime;
+ }
+ }
+ elseif($dateDiff->format("%R%a") >= 0 && ($selectedDay < $tmpDateStart || $selectedDay > $tmpDateEnd) && $dateDiff->format("%R%a") != 0){
+ if($query->num_rows() == 0){
+ $availableTimeArray[] = $currentStartTime;
+ }
+
+ }
+
+ }
+
+ return $availableTimeArray;
+
+
+ }
+
+ public function createBooking($bookingArray){
+ $this->load->database();
+ $query = $this->db->query("INSERT INTO bookings (
+ guest_name,
+ guest_email,
+ guest_phone,
+ worker_id,
+ booking_date,
+ booking_start_time,
+ booking_finish_time,
+ service_ids,
+ guest_confirmed,
+ guest_confirm_code
+ ) VALUES(
+ '".$bookingArray['guest_name']."',
+ '".$bookingArray['guest_email']."',
+ '".$bookingArray['guest_phone']."',
+ '".$bookingArray['worker_id']."',
+ '".$bookingArray['booking_date']."',
+ '".$bookingArray['booking_start_time']."',
+ '".$bookingArray['booking_finish_time']."',
+ '".$bookingArray['service_ids']."',
+ '".$bookingArray['guest_confirmed']."',
+ '".$bookingArray['guest_confirm_code']."'
+ );");
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+}
+
+?>
\ No newline at end of file
diff --git a/application/models_20240401/Service_model_20240212.php b/application/models_20240401/Service_model_20240212.php
new file mode 100755
index 0000000..2aa8909
--- /dev/null
+++ b/application/models_20240401/Service_model_20240212.php
@@ -0,0 +1,356 @@
+load->database();
+ $query = $this->db->query('INSERT INTO services (
+ service_type,
+ service_category,
+ service_name,
+ service_description,
+ service_price,
+ service_time,
+ service_note
+ ) VALUES(
+ "'.$serviceArray['service_type'].'",
+ "'.$serviceArray['service_category'].'",
+ "'.$serviceArray['service_name'].'",
+ "'.$serviceArray['service_description'].'",
+ "'.$serviceArray['service_price'].'",
+ "'.$serviceArray['service_time'].'",
+ "'.$serviceArray['service_note'].'"
+ );');
+ }
+
+ public function updateService($service_id, $serviceArray){
+ $this->load->database();
+
+ foreach($serviceArray as $propertyKey => $propertyValue){
+ $query = $this->db->query('UPDATE users SET '.$propertyKey.' = "'.$propertyValue.'" WHERE service_id = "'.$service_id.'";');
+ }
+ }
+
+ public function getAllServiceByServiceType($service_type, $lang){
+ $this->load->database();
+ $query = $this->db->query('SELECT * FROM services WHERE service_type = "'.$service_type.'" ORDER BY service_id ASC;');
+ $serviceArray = array();
+ if($query->num_rows() > 0){
+ foreach($query->result() as $resultItem){
+
+ $service_category = '';
+ $service_name = '';
+ $service_description = '';
+
+ switch($lang){
+ case 'no':
+ $service_category = $resultItem->service_category_no;
+ $service_name = $resultItem->service_name_no;
+ $service_description = $resultItem->service_description_no;
+ break;
+ case 'en':
+ $service_category = $resultItem->service_category_en;
+ $service_name = $resultItem->service_name_en;
+ $service_description = $resultItem->service_description_en;
+ break;
+ case 'hu':
+ $service_category = $resultItem->service_category_hu;
+ $service_name = $resultItem->service_name_hu;
+ $service_description = $resultItem->service_description_hu;
+ break;
+ }
+
+ $resultItemTmp = array(
+ 'service_id' => $resultItem->service_id,
+ 'service_type' => $resultItem->service_type,
+ 'service_category' => $service_category,
+ 'service_name' => $service_name,
+ 'service_description' => $service_description,
+ 'service_price' => $resultItem->service_price,
+ 'service_time' => $resultItem->service_time
+ );
+
+ $serviceArray[] = (object)$resultItemTmp;
+ }
+ }
+ return $serviceArray;
+ }
+
+ public function getServiceById($service_id){
+ $this->load->database();
+ $query = $this->db->query('SELECT * FROM services WHERE service_id = "'.$service_id.'" LIMIT 1;');
+ if($query->num_rows() > 0){
+ return $query->result()[0];
+ }
+ else{
+ return 0;
+ }
+ }
+
+ public function getAllWorkers(){
+ $this->load->database();
+ $query = $this->db->query('SELECT * FROM workers ORDER BY worker_name ASC;');
+ return $query->result();
+ }
+
+ public function getWorkerById($worker_id){
+ $this->load->database();
+ $query = $this->db->query('SELECT * FROM workers WHERE worker_id = "'.$worker_id.'" LIMIT 1;');
+ if($query->num_rows() > 0){
+ return $query->result()[0];
+ }
+ else{
+ return 0;
+ }
+ }
+
+ public function getAvailableTimes($worker_id, $selectedDate, $servicelength){
+ $this->load->database();
+ $serviceLengthDateTime = new DateTime($selectedDate.' '.$servicelength);
+ $service_length_time = strtotime($servicelength);
+ $availableTimeArray = array();
+ $selectedDayName = date('D', strtotime($selectedDate));
+ $dayStartTime = new DateTime($selectedDate.' 10:00');
+ $finishTime = new DateTime($selectedDate.' 18:00');
+ if($selectedDayName == 'Sun'){
+ return array();
+ }
+ elseif($selectedDayName == 'Sat'){
+ $finishTime = new DateTime($selectedDate.' 16:00');
+ }
+ else{
+ //finish time - selected service length
+ $finishTime = new DateTime($selectedDate.' 18:00');
+
+ }
+
+ $today=date_create(date('Y-m-d'));
+ $selectedDay=date_create($selectedDate);
+ $dateDiff=date_diff($today,$selectedDay);
+
+ $tmpDateStart = date_create(date('2023-12-22'));
+ $tmpDateEnd = date_create(date('2024-01-06'));
+
+ $datelength = new DateTime($servicelength);
+ $diff = $datelength->diff($finishTime);
+
+ //max time for start
+ $maxTime = $diff->h.':'.$diff->i.':00';
+ $hours = (intval($diff->h)-10)*4+1;
+ $mins = floor(intval($diff->i) / 15);
+ $loopSteps = intval($hours) + intval($mins);
+
+ for($periodIndex = 1; $periodIndex <= $loopSteps; $periodIndex++){
+ $minutes_to_add_start = $periodIndex*15;
+ $minutes_to_add_end = ($periodIndex+1)*15;
+ $startTime = new DateTime($selectedDate.' 09:45');
+ $endTime = new DateTime($selectedDate.' 09:45');
+ $startTime->add(new DateInterval('PT' . $minutes_to_add_start . 'M'));
+ $endTime->add(new DateInterval('PT' . $minutes_to_add_end . 'M'));
+ $maxTimeObject = new DateTime($maxTime);
+
+ $tz = new DateTimeZone('Europe/Budapest');
+ $addStartTimeAndLength = new DateTime($selectedDate.' '.$startTime->format('H:i:00'), $tz);
+ $addStartTimeAndLength->add(new DateInterval('PT' . intval($serviceLengthDateTime->format('H')) . 'H'));
+ $addStartTimeAndLength->add(new DateInterval('PT' . intval($serviceLengthDateTime->format('i')) . 'M'));
+
+ $currentStartTime = $startTime->format('H:i:00');
+ $currentEndTime = $endTime->format('H:i:00');
+
+
+
+ /*
+ echo '<< ';
+ print_r($serviceLengthDateTime->format('H:i:00'));
+ echo ' / ';
+ print_r($currentStartTime);
+ echo ' / ';
+ print_r($addStartTimeAndLength->format('H:i:00'));
+ echo ' >>';
+ */
+ $query = $this->db->query('SELECT * FROM bookings WHERE booking_date = "'.$selectedDate.'" AND worker_id = "'.$worker_id.'" AND (
+ /*start later and finish before*/
+ (TIME(booking_start_time) >= CAST("'.$currentStartTime.'" AS TIME) AND TIME(booking_finish_time) <= CAST("'.$currentEndTime.'" AS TIME)) OR
+
+ /*check if not end service until next booking*/
+ (TIME(booking_start_time) <= CAST("'.$addStartTimeAndLength->format('H:i:00').'" AS TIME) AND TIME(booking_finish_time) >= CAST("'.$currentEndTime.'" AS TIME)) OR
+
+ /*start later and finish later*/
+ (TIME(booking_start_time) >= CAST("'.$currentStartTime.'" AS TIME) AND TIME(booking_start_time) <= CAST("'.$currentEndTime.'" AS TIME) AND TIME(booking_finish_time) >= CAST("'.$currentEndTime.'" AS TIME)) OR
+
+ /*start before and finish before*/
+ (TIME(booking_start_time) <= CAST("'.$currentStartTime.'" AS TIME) AND TIME(booking_finish_time) >= CAST("'.$currentEndTime.'" AS TIME)
+ AND TIME(booking_start_time) <= CAST("'.$currentStartTime.'" AS TIME)) OR
+
+ /**/
+ (TIME(booking_start_time) <= CAST("'.$currentStartTime.'" AS TIME) AND TIME(booking_finish_time) <= CAST("'.$currentEndTime.'" AS TIME)
+ AND TIME(booking_finish_time) >= CAST("'.$currentStartTime.'" AS TIME)) OR
+
+ /**/
+ (TIME(booking_start_time) <= CAST("'.$currentStartTime.'" AS TIME) AND TIME(booking_finish_time) >= CAST("'.$currentEndTime.'" AS TIME))
+ );
+ ');
+
+ $now = strtotime(date('H:i:s')) + 60*60;
+ $timezone = 'Europe/Budapest';
+ $todayStartTime = strtotime($currentStartTime.' '.$timezone);
+ $minDiff = ($todayStartTime - $now) / 60;
+
+ if($dateDiff->format("%R%a") == 0 && $minDiff > 0){
+ if($query->num_rows() == 0){
+ $availableTimeArray[] = $currentStartTime;
+ }
+ }
+ elseif($dateDiff->format("%R%a") >= 0 && ($selectedDay < $tmpDateStart || $selectedDay > $tmpDateEnd) && $dateDiff->format("%R%a") != 0){
+ if($query->num_rows() == 0){
+ $availableTimeArray[] = $currentStartTime;
+ }
+
+ }
+
+ }
+
+ return $availableTimeArray;
+
+
+ }
+
+ public function createBooking($bookingArray){
+ $this->load->database();
+ $query = $this->db->query("INSERT INTO bookings (
+ guest_name,
+ guest_email,
+ guest_phone,
+ worker_id,
+ booking_date,
+ booking_start_time,
+ booking_finish_time,
+ service_ids,
+ guest_confirmed,
+ guest_confirm_code
+ ) VALUES(
+ '".$bookingArray['guest_name']."',
+ '".$bookingArray['guest_email']."',
+ '".$bookingArray['guest_phone']."',
+ '".$bookingArray['worker_id']."',
+ '".$bookingArray['booking_date']."',
+ '".$bookingArray['booking_start_time']."',
+ '".$bookingArray['booking_finish_time']."',
+ '".$bookingArray['service_ids']."',
+ '".$bookingArray['guest_confirmed']."',
+ '".$bookingArray['guest_confirm_code']."'
+ );");
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+}
+
+?>
\ No newline at end of file
diff --git a/application/models_20240401/User_model.php b/application/models_20240401/User_model.php
new file mode 100755
index 0000000..3bf83a0
--- /dev/null
+++ b/application/models_20240401/User_model.php
@@ -0,0 +1,182 @@
+load->database();
+ $query = $this->db->query('SELECT * FROM users WHERE username = "'.$username.'" AND password = "'.hash('sha256', $password).'" AND is_enabled = 1 LIMIT 1');
+
+ if($query->num_rows() == 1){
+ return 1;
+ }
+ else{
+ return 0;
+ }
+ }
+
+ public function getAllUser(){
+ $this->load->database();
+ $query = $this->db->query('SELECT * FROM users JOIN privilegies ON users.privilegy_group_id = privilegies.privilegy_group_id ORDER BY fullname ASC');
+ $userResults = $query->result();
+
+ foreach($userResults as $userResultItem){
+ if($userResultItem->profile_img_url == ''){
+ $userResultItem->profile_img_url = base_url().'img/default_profile.jpg';
+ }
+ }
+ return $userResults;
+ }
+
+ public function getUserByUsername($username){
+ $this->load->database();
+ $query = $this->db->query('SELECT * FROM users JOIN privilegies ON users.privilegy_group_id = privilegies.privilegy_group_id WHERE username = "'.$username.'" LIMIT 1');
+ if($query->num_rows() == 1){
+
+ if($query->result()[0]->profile_img_url == ''){
+ $query->result()[0]->profile_img_url = base_url().'img/default_profile.jpg';
+ }
+ return $query->result()[0];
+ }
+ else{
+ return 0;
+ }
+ }
+
+ public function getUserById($userId){
+ $this->load->database();
+ $query = $this->db->query('SELECT * FROM users JOIN privilegies ON users.privilegy_group_id = privilegies.privilegy_group_id WHERE user_id = "'.$userId.'" LIMIT 1');
+ if($query->num_rows() == 1){
+ if($query->result()[0]->profile_img_url == ''){
+ $query->result()[0]->profile_img_url = base_url().'img/default_profile.jpg';
+ }
+ return $query->result()[0];
+ }
+ else{
+ return 0;
+ }
+ }
+
+ public function deleteUser($userId){
+ $this->load->database();
+ $query = $this->db->query('DELETE FROM users WHERE user_id = "'.$userId.'";');
+ }
+
+ public function isUsernameAvailable($username){
+ $this->load->database();
+ $query = $this->db->query('SELECT * FROM users WHERE username = "'.$username.'";');
+ if($query->num_rows() == 1){
+ return 0;
+ }
+ else{
+ return 1;
+ }
+ }
+
+ public function updateUser($userId, $userArray){
+ $this->load->database();
+
+ foreach($userArray as $propertyKey => $propertyValue){
+ $query = $this->db->query('UPDATE users SET '.$propertyKey.' = "'.hash('sha256',$propertyValue).'" WHERE user_id = "'.$userId.'";');
+ }
+ }
+
+ public function addNewUser($userArray){
+ $this->load->database();
+
+ if(!is_object($this->getUserByUsername($userArray['username']))){
+ $query = $this->db->query('INSERT INTO users (username, password, fullname, privilegy_group_id, is_enabled, user_notes) VALUES("'.$userArray['username'].'", "'.hash('sha256', $userArray['password']).'", "'.$userArray['fullname'].'", "'.$userArray['privilegy_group_id'].'", "'.$userArray['is_enabled'].'", "'.$userArray['user_notes'].'");');
+ return 1;
+ }
+ else{
+ return 0;
+ }
+
+ }
+
+
+
+
+ public function sendEmail($addressList, $lang, $subpage){
+ // Import PHPMailer classes into the global namespace
+ // These must be at the top of your script, not inside a function
+ echo $lang;
+ if(!empty($addressList)){
+ foreach($addressList as $addressListItem){
+ // Instantiation and passing `true` enables exceptions
+ $mail = new PHPMailer(false);
+ $mail->SMTPDebug = false;
+ $mail->do_debug = 1;
+ try {
+ //Server settings
+ $mail->CharSet = 'UTF-8';
+ //$mail->SMTPDebug = SMTP::DEBUG_SERVER; // Enable verbose debug output
+ $mail->isSMTP(); //Send using SMTP
+ $mail->Host = 'mail.absolutesolution.hu'; //Set the SMTP server to send through
+ $mail->SMTPAuth = true; //Enable SMTP authentication
+ $mail->Username = 'reservations@studiobeve.no'; //SMTP username
+ $mail->Password = 'StudioBeve-1234'; //SMTP password
+ $mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS; //Enable TLS encryption; `PHPMailer::ENCRYPTION_SMTPS` encouraged
+ $mail->Port = 465; //TCP port to connect to, use 465 for `PHPMailer::ENCRYPTION_SMTPS` above
+
+ //Recipients
+ $mail->setFrom('reservations@studiobeve.no', '[studiobeve]');
+ $mail->addAddress($addressListItem['addressee_email'], $addressListItem['addressee_name']); // Add a recipient
+ //$mail->addAddress('ellen@example.com'); // Name is optional
+ //$mail->addReplyTo('info@example.com', 'Information');
+ $mail->addCC('evelin@studiobeve.no');
+ //$mail->addBCC('bcc@example.com');
+
+ // Attachments
+ if(is_array($addressListItem['attachments'])){
+ $attachments = $addressListItem['attachments'];
+ foreach($attachments as $attachmentsItem){
+ $mail->addAttachment(getcwd().'/documents/'.$attachmentsItem); // Add attachments
+ }
+ }
+ //$mail->addAttachment('/tmp/image.jpg', 'new.jpg'); // Optional name
+
+ // Content
+ $mail->isHTML(true); // Set email format to HTML
+ $mail->Subject = $addressListItem['subject'];
+ ob_start();
+ $body = ob_get_clean();
+ $body .= $addressListItem['content'];
+
+ $mail->Body = $body;
+ //$mail->AltBody = strip_tags($answer_message);
+
+ $mail->send();
+ echo 'Üzenet elküldve';
+ header('location:'.base_url().$lang.'/booking-finished/'.$subpage);
+ } catch (Exception $e) {
+ //header('location:'.base_url().'manage-applicants/?email-sent=false&error='.$mail->ErrorInfo);
+ echo "Üzenetküldési hiba. Mailer Error: {$mail->ErrorInfo}";
+ }
+
+ }
+ }
+
+
+
+ }
+
+
+
+
+
+
+
+
+}
+
+?>
\ No newline at end of file
diff --git a/application/models_20240401/index.html b/application/models_20240401/index.html
new file mode 100755
index 0000000..b48b490
--- /dev/null
+++ b/application/models_20240401/index.html
@@ -0,0 +1,11 @@
+
+
+
+ 403 Forbidden
+
+
+
+Directory access is forbidden.
+
+
+
diff --git a/application/third_party/index.html b/application/third_party/index.html
new file mode 100755
index 0000000..b48b490
--- /dev/null
+++ b/application/third_party/index.html
@@ -0,0 +1,11 @@
+
+
+
+ 403 Forbidden
+
+
+
+Directory access is forbidden.
+
+
+
diff --git a/application/views/admin/add-booking.php b/application/views/admin/add-booking.php
new file mode 100755
index 0000000..ef3a4aa
--- /dev/null
+++ b/application/views/admin/add-booking.php
@@ -0,0 +1,6 @@
+
+
diff --git a/application/views/admin/add-service-category.php b/application/views/admin/add-service-category.php
new file mode 100755
index 0000000..9cde70e
--- /dev/null
+++ b/application/views/admin/add-service-category.php
@@ -0,0 +1,6 @@
+
+
diff --git a/application/views/admin/add-service.php b/application/views/admin/add-service.php
new file mode 100755
index 0000000..ca1cc5b
--- /dev/null
+++ b/application/views/admin/add-service.php
@@ -0,0 +1,6 @@
+
+
diff --git a/application/views/admin/add-worker.php b/application/views/admin/add-worker.php
new file mode 100755
index 0000000..772c159
--- /dev/null
+++ b/application/views/admin/add-worker.php
@@ -0,0 +1,6 @@
+
+
diff --git a/application/views/admin/booking-process.php b/application/views/admin/booking-process.php
new file mode 100755
index 0000000..e69de29
diff --git a/application/views/admin/bookings.php b/application/views/admin/bookings.php
new file mode 100755
index 0000000..782bffc
--- /dev/null
+++ b/application/views/admin/bookings.php
@@ -0,0 +1,5 @@
+
\ No newline at end of file
diff --git a/application/views/admin/dashboard.php b/application/views/admin/dashboard.php
new file mode 100755
index 0000000..a7eb825
--- /dev/null
+++ b/application/views/admin/dashboard.php
@@ -0,0 +1,6 @@
+
+
diff --git a/application/views/admin/includes/add-booking-form.php b/application/views/admin/includes/add-booking-form.php
new file mode 100755
index 0000000..b6860c6
--- /dev/null
+++ b/application/views/admin/includes/add-booking-form.php
@@ -0,0 +1,195 @@
+
+
+
\ No newline at end of file
diff --git a/application/views/admin/includes/add-service-category-form.php b/application/views/admin/includes/add-service-category-form.php
new file mode 100755
index 0000000..ca11096
--- /dev/null
+++ b/application/views/admin/includes/add-service-category-form.php
@@ -0,0 +1,20 @@
+
diff --git a/application/views/admin/includes/add-service-form.php b/application/views/admin/includes/add-service-form.php
new file mode 100755
index 0000000..4907fef
--- /dev/null
+++ b/application/views/admin/includes/add-service-form.php
@@ -0,0 +1,82 @@
+
diff --git a/application/views/admin/includes/add-worker-form.php b/application/views/admin/includes/add-worker-form.php
new file mode 100755
index 0000000..129e5e1
--- /dev/null
+++ b/application/views/admin/includes/add-worker-form.php
@@ -0,0 +1,57 @@
+
diff --git a/application/views/admin/includes/bookings-form.php b/application/views/admin/includes/bookings-form.php
new file mode 100755
index 0000000..40791cb
--- /dev/null
+++ b/application/views/admin/includes/bookings-form.php
@@ -0,0 +1,94 @@
+
+
+
+
+
+ Minden
+ worker_id.'" '.(isset($_GET['worker']) && $_GET['worker'] == $workerItem->worker_id?' selected':'').'>'.$workerItem->worker_name.'';
+ }
+ ?>
+
+
+
+
+
+
\ No newline at end of file
diff --git a/application/views/admin/includes/dashboard-form.php b/application/views/admin/includes/dashboard-form.php
new file mode 100755
index 0000000..9dbee28
--- /dev/null
+++ b/application/views/admin/includes/dashboard-form.php
@@ -0,0 +1,81 @@
+
+
+
+
+
+
+
+
+
+
+
V
+
H
+
K
+
Sze
+
CS
+
P
+
Szo
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/application/views/admin/includes/service-categories-form.php b/application/views/admin/includes/service-categories-form.php
new file mode 100755
index 0000000..8e6e3fd
--- /dev/null
+++ b/application/views/admin/includes/service-categories-form.php
@@ -0,0 +1,39 @@
+
\ No newline at end of file
diff --git a/application/views/admin/includes/services-form.php b/application/views/admin/includes/services-form.php
new file mode 100755
index 0000000..d7a5fc1
--- /dev/null
+++ b/application/views/admin/includes/services-form.php
@@ -0,0 +1,63 @@
+
\ No newline at end of file
diff --git a/application/views/admin/includes/update-booking-form.php b/application/views/admin/includes/update-booking-form.php
new file mode 100755
index 0000000..40f3932
--- /dev/null
+++ b/application/views/admin/includes/update-booking-form.php
@@ -0,0 +1,219 @@
+
+
+
\ No newline at end of file
diff --git a/application/views/admin/includes/update-service-category-form.php b/application/views/admin/includes/update-service-category-form.php
new file mode 100755
index 0000000..87bb7f9
--- /dev/null
+++ b/application/views/admin/includes/update-service-category-form.php
@@ -0,0 +1,20 @@
+
diff --git a/application/views/admin/includes/update-service-form.php b/application/views/admin/includes/update-service-form.php
new file mode 100755
index 0000000..9df60e7
--- /dev/null
+++ b/application/views/admin/includes/update-service-form.php
@@ -0,0 +1,81 @@
+
diff --git a/application/views/admin/includes/update-worker-form.php b/application/views/admin/includes/update-worker-form.php
new file mode 100755
index 0000000..51cbd8f
--- /dev/null
+++ b/application/views/admin/includes/update-worker-form.php
@@ -0,0 +1,61 @@
+
diff --git a/application/views/admin/includes/worker-schedule-overrides-form.php b/application/views/admin/includes/worker-schedule-overrides-form.php
new file mode 100755
index 0000000..99641f0
--- /dev/null
+++ b/application/views/admin/includes/worker-schedule-overrides-form.php
@@ -0,0 +1,113 @@
+
+
+Dolgozó munkaidő beállítása
+
+
+
+
+
+ Jelenlegi beállítások
+
+
+
+ = $days[$row->weekday] ?>:
+ = substr($row->start_time, 0, 5) ?> - = substr($row->end_time, 0, 5) ?>
+ = $row->is_alternate_week ? '(Minden 2. hét)' : '' ?>
+
+
+
+
+
+
+
+
+
diff --git a/application/views/admin/includes/workers-form.php b/application/views/admin/includes/workers-form.php
new file mode 100755
index 0000000..7eda0ad
--- /dev/null
+++ b/application/views/admin/includes/workers-form.php
@@ -0,0 +1,49 @@
+
\ No newline at end of file
diff --git a/application/views/admin/service-categories.php b/application/views/admin/service-categories.php
new file mode 100755
index 0000000..241629b
--- /dev/null
+++ b/application/views/admin/service-categories.php
@@ -0,0 +1,6 @@
+
+
diff --git a/application/views/admin/service-category-process.php b/application/views/admin/service-category-process.php
new file mode 100755
index 0000000..e69de29
diff --git a/application/views/admin/service-process.php b/application/views/admin/service-process.php
new file mode 100755
index 0000000..e69de29
diff --git a/application/views/admin/services.php b/application/views/admin/services.php
new file mode 100755
index 0000000..7132e1e
--- /dev/null
+++ b/application/views/admin/services.php
@@ -0,0 +1,6 @@
+
+
diff --git a/application/views/admin/update-booking.php b/application/views/admin/update-booking.php
new file mode 100755
index 0000000..ef069ff
--- /dev/null
+++ b/application/views/admin/update-booking.php
@@ -0,0 +1,5 @@
+
diff --git a/application/views/admin/update-service-category.php b/application/views/admin/update-service-category.php
new file mode 100755
index 0000000..20f036f
--- /dev/null
+++ b/application/views/admin/update-service-category.php
@@ -0,0 +1,6 @@
+
+
diff --git a/application/views/admin/update-service.php b/application/views/admin/update-service.php
new file mode 100755
index 0000000..14273dd
--- /dev/null
+++ b/application/views/admin/update-service.php
@@ -0,0 +1,6 @@
+
+
diff --git a/application/views/admin/update-worker.php b/application/views/admin/update-worker.php
new file mode 100755
index 0000000..f59dae8
--- /dev/null
+++ b/application/views/admin/update-worker.php
@@ -0,0 +1,6 @@
+
+
diff --git a/application/views/admin/users.php b/application/views/admin/users.php
new file mode 100755
index 0000000..5709d86
--- /dev/null
+++ b/application/views/admin/users.php
@@ -0,0 +1,33 @@
+
+
+
+
+
+
+
+ '.$message.'
';
+ }
+ ?>
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/application/views/admin/worker-process.php b/application/views/admin/worker-process.php
new file mode 100755
index 0000000..e69de29
diff --git a/application/views/admin/worker_schedule.php b/application/views/admin/worker_schedule.php
new file mode 100755
index 0000000..f0d953e
--- /dev/null
+++ b/application/views/admin/worker_schedule.php
@@ -0,0 +1,5 @@
+
diff --git a/application/views/admin/workers.php b/application/views/admin/workers.php
new file mode 100755
index 0000000..85d5917
--- /dev/null
+++ b/application/views/admin/workers.php
@@ -0,0 +1,6 @@
+
+
diff --git a/application/views/admin_20240401/add-service.php b/application/views/admin_20240401/add-service.php
new file mode 100755
index 0000000..e69de29
diff --git a/application/views/admin_20240401/add-worker.php b/application/views/admin_20240401/add-worker.php
new file mode 100755
index 0000000..e69de29
diff --git a/application/views/admin_20240401/create-user.php b/application/views/admin_20240401/create-user.php
new file mode 100755
index 0000000..e69de29
diff --git a/application/views/admin_20240401/login.php b/application/views/admin_20240401/login.php
new file mode 100755
index 0000000..e69de29
diff --git a/application/views/admin_20240401/service-process.php b/application/views/admin_20240401/service-process.php
new file mode 100755
index 0000000..e69de29
diff --git a/application/views/admin_20240401/services.php b/application/views/admin_20240401/services.php
new file mode 100755
index 0000000..e69de29
diff --git a/application/views/admin_20240401/update-service.php b/application/views/admin_20240401/update-service.php
new file mode 100755
index 0000000..e69de29
diff --git a/application/views/admin_20240401/update-user.php b/application/views/admin_20240401/update-user.php
new file mode 100755
index 0000000..e69de29
diff --git a/application/views/admin_20240401/update-worker.php b/application/views/admin_20240401/update-worker.php
new file mode 100755
index 0000000..e69de29
diff --git a/application/views/admin_20240401/user-process.php b/application/views/admin_20240401/user-process.php
new file mode 100755
index 0000000..e69de29
diff --git a/application/views/admin_20240401/users.php b/application/views/admin_20240401/users.php
new file mode 100755
index 0000000..e69de29
diff --git a/application/views/admin_20240401/worker-process.php b/application/views/admin_20240401/worker-process.php
new file mode 100755
index 0000000..e69de29
diff --git a/application/views/admin_20240401/workers.php b/application/views/admin_20240401/workers.php
new file mode 100755
index 0000000..e69de29
diff --git a/application/views/admin_20250312/add-booking.php b/application/views/admin_20250312/add-booking.php
new file mode 100755
index 0000000..ef3a4aa
--- /dev/null
+++ b/application/views/admin_20250312/add-booking.php
@@ -0,0 +1,6 @@
+
+
diff --git a/application/views/admin_20250312/add-service.php b/application/views/admin_20250312/add-service.php
new file mode 100755
index 0000000..ca1cc5b
--- /dev/null
+++ b/application/views/admin_20250312/add-service.php
@@ -0,0 +1,6 @@
+
+
diff --git a/application/views/admin_20250312/add-worker.php b/application/views/admin_20250312/add-worker.php
new file mode 100755
index 0000000..772c159
--- /dev/null
+++ b/application/views/admin_20250312/add-worker.php
@@ -0,0 +1,6 @@
+
+
diff --git a/application/views/admin_20250312/booking-process.php b/application/views/admin_20250312/booking-process.php
new file mode 100755
index 0000000..e69de29
diff --git a/application/views/admin_20250312/bookings.php b/application/views/admin_20250312/bookings.php
new file mode 100755
index 0000000..782bffc
--- /dev/null
+++ b/application/views/admin_20250312/bookings.php
@@ -0,0 +1,5 @@
+
\ No newline at end of file
diff --git a/application/views/admin_20250312/dashboard.php b/application/views/admin_20250312/dashboard.php
new file mode 100755
index 0000000..a7eb825
--- /dev/null
+++ b/application/views/admin_20250312/dashboard.php
@@ -0,0 +1,6 @@
+
+
diff --git a/application/views/admin_20250312/includes/add-booking-form.php b/application/views/admin_20250312/includes/add-booking-form.php
new file mode 100755
index 0000000..b6860c6
--- /dev/null
+++ b/application/views/admin_20250312/includes/add-booking-form.php
@@ -0,0 +1,195 @@
+
+
+
\ No newline at end of file
diff --git a/application/views/admin_20250312/includes/add-service-form.php b/application/views/admin_20250312/includes/add-service-form.php
new file mode 100755
index 0000000..fd7fa2b
--- /dev/null
+++ b/application/views/admin_20250312/includes/add-service-form.php
@@ -0,0 +1,69 @@
+
diff --git a/application/views/admin_20250312/includes/add-worker-form.php b/application/views/admin_20250312/includes/add-worker-form.php
new file mode 100755
index 0000000..697e264
--- /dev/null
+++ b/application/views/admin_20250312/includes/add-worker-form.php
@@ -0,0 +1,30 @@
+
diff --git a/application/views/admin_20250312/includes/bookings-form.php b/application/views/admin_20250312/includes/bookings-form.php
new file mode 100755
index 0000000..8f5a05f
--- /dev/null
+++ b/application/views/admin_20250312/includes/bookings-form.php
@@ -0,0 +1,71 @@
+
\ No newline at end of file
diff --git a/application/views/admin_20250312/includes/dashboard-form.php b/application/views/admin_20250312/includes/dashboard-form.php
new file mode 100755
index 0000000..9dbee28
--- /dev/null
+++ b/application/views/admin_20250312/includes/dashboard-form.php
@@ -0,0 +1,81 @@
+
+
+
+
+
+
+
+
+
+
+
V
+
H
+
K
+
Sze
+
CS
+
P
+
Szo
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/application/views/admin_20250312/includes/services-form.php b/application/views/admin_20250312/includes/services-form.php
new file mode 100755
index 0000000..c7f78c1
--- /dev/null
+++ b/application/views/admin_20250312/includes/services-form.php
@@ -0,0 +1,61 @@
+
\ No newline at end of file
diff --git a/application/views/admin_20250312/includes/update-booking-form.php b/application/views/admin_20250312/includes/update-booking-form.php
new file mode 100755
index 0000000..40f3932
--- /dev/null
+++ b/application/views/admin_20250312/includes/update-booking-form.php
@@ -0,0 +1,219 @@
+
+
+
\ No newline at end of file
diff --git a/application/views/admin_20250312/includes/update-service-form.php b/application/views/admin_20250312/includes/update-service-form.php
new file mode 100755
index 0000000..7da59bf
--- /dev/null
+++ b/application/views/admin_20250312/includes/update-service-form.php
@@ -0,0 +1,69 @@
+
diff --git a/application/views/admin_20250312/includes/update-worker-form.php b/application/views/admin_20250312/includes/update-worker-form.php
new file mode 100755
index 0000000..cb954be
--- /dev/null
+++ b/application/views/admin_20250312/includes/update-worker-form.php
@@ -0,0 +1,33 @@
+
diff --git a/application/views/admin_20250312/includes/workers-form.php b/application/views/admin_20250312/includes/workers-form.php
new file mode 100755
index 0000000..973a0c7
--- /dev/null
+++ b/application/views/admin_20250312/includes/workers-form.php
@@ -0,0 +1,43 @@
+
\ No newline at end of file
diff --git a/application/views/admin_20250312/service-process.php b/application/views/admin_20250312/service-process.php
new file mode 100755
index 0000000..e69de29
diff --git a/application/views/admin_20250312/services.php b/application/views/admin_20250312/services.php
new file mode 100755
index 0000000..7132e1e
--- /dev/null
+++ b/application/views/admin_20250312/services.php
@@ -0,0 +1,6 @@
+
+
diff --git a/application/views/admin_20250312/update-booking.php b/application/views/admin_20250312/update-booking.php
new file mode 100755
index 0000000..ef069ff
--- /dev/null
+++ b/application/views/admin_20250312/update-booking.php
@@ -0,0 +1,5 @@
+
diff --git a/application/views/admin_20250312/update-service.php b/application/views/admin_20250312/update-service.php
new file mode 100755
index 0000000..14273dd
--- /dev/null
+++ b/application/views/admin_20250312/update-service.php
@@ -0,0 +1,6 @@
+
+
diff --git a/application/views/admin_20250312/update-worker.php b/application/views/admin_20250312/update-worker.php
new file mode 100755
index 0000000..f59dae8
--- /dev/null
+++ b/application/views/admin_20250312/update-worker.php
@@ -0,0 +1,6 @@
+
+
diff --git a/application/views/admin_20250312/users.php b/application/views/admin_20250312/users.php
new file mode 100755
index 0000000..5709d86
--- /dev/null
+++ b/application/views/admin_20250312/users.php
@@ -0,0 +1,33 @@
+
+
+
+
+
+
+
+ '.$message.'
';
+ }
+ ?>
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/application/views/admin_20250312/worker-process.php b/application/views/admin_20250312/worker-process.php
new file mode 100755
index 0000000..e69de29
diff --git a/application/views/admin_20250312/workers.php b/application/views/admin_20250312/workers.php
new file mode 100755
index 0000000..85d5917
--- /dev/null
+++ b/application/views/admin_20250312/workers.php
@@ -0,0 +1,6 @@
+
+
diff --git a/application/views/ajax.php b/application/views/ajax.php
new file mode 100755
index 0000000..e69de29
diff --git a/application/views/api.php b/application/views/api.php
new file mode 100755
index 0000000..e69de29
diff --git a/application/views/errors/cli/error_404.php b/application/views/errors/cli/error_404.php
new file mode 100755
index 0000000..af8fecd
--- /dev/null
+++ b/application/views/errors/cli/error_404.php
@@ -0,0 +1,8 @@
+
+
+An uncaught Exception was encountered
+
+Type:
+Message:
+Filename: getFile(), "\n"; ?>
+Line Number: getLine(); ?>
+
+
+
+Backtrace:
+getTrace() as $error): ?>
+
+ File:
+ Line:
+ Function:
+
+
+
+
diff --git a/application/views/errors/cli/error_general.php b/application/views/errors/cli/error_general.php
new file mode 100755
index 0000000..af8fecd
--- /dev/null
+++ b/application/views/errors/cli/error_general.php
@@ -0,0 +1,8 @@
+
+
+A PHP Error was encountered
+
+Severity:
+Message:
+Filename:
+Line Number:
+
+
+
+Backtrace:
+
+
+ File:
+ Line:
+ Function:
+
+
+
+
diff --git a/application/views/errors/cli/index.html b/application/views/errors/cli/index.html
new file mode 100755
index 0000000..b48b490
--- /dev/null
+++ b/application/views/errors/cli/index.html
@@ -0,0 +1,11 @@
+
+
+
+ 403 Forbidden
+
+
+
+Directory access is forbidden.
+
+
+
diff --git a/application/views/errors/html/error_404.php b/application/views/errors/html/error_404.php
new file mode 100755
index 0000000..38689d7
--- /dev/null
+++ b/application/views/errors/html/error_404.php
@@ -0,0 +1,64 @@
+
+
+
+
+404 Page Not Found
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/application/views/errors/html/error_db.php b/application/views/errors/html/error_db.php
new file mode 100755
index 0000000..899d072
--- /dev/null
+++ b/application/views/errors/html/error_db.php
@@ -0,0 +1,64 @@
+
+
+
+
+Database Error
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/application/views/errors/html/error_exception.php b/application/views/errors/html/error_exception.php
new file mode 100755
index 0000000..bde0dc3
--- /dev/null
+++ b/application/views/errors/html/error_exception.php
@@ -0,0 +1,32 @@
+
+
+
+
+
An uncaught Exception was encountered
+
+
Type:
+
Message:
+
Filename: getFile(); ?>
+
Line Number: getLine(); ?>
+
+
+
+
Backtrace:
+ getTrace() as $error): ?>
+
+
+
+
+ File:
+ Line:
+ Function:
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/application/views/errors/html/error_general.php b/application/views/errors/html/error_general.php
new file mode 100755
index 0000000..3a64a4f
--- /dev/null
+++ b/application/views/errors/html/error_general.php
@@ -0,0 +1,64 @@
+
+
+
+
+Error
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/application/views/errors/html/error_php.php b/application/views/errors/html/error_php.php
new file mode 100755
index 0000000..be4d2f1
--- /dev/null
+++ b/application/views/errors/html/error_php.php
@@ -0,0 +1,33 @@
+
+
+
+
+
A PHP Error was encountered
+
+
Severity:
+
Message:
+
Filename:
+
Line Number:
+
+
+
+
Backtrace:
+
+
+
+
+
+ File:
+ Line:
+ Function:
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/application/views/errors/html/index.html b/application/views/errors/html/index.html
new file mode 100755
index 0000000..b48b490
--- /dev/null
+++ b/application/views/errors/html/index.html
@@ -0,0 +1,11 @@
+
+
+
+ 403 Forbidden
+
+
+
+Directory access is forbidden.
+
+
+
diff --git a/application/views/errors/index.html b/application/views/errors/index.html
new file mode 100755
index 0000000..b48b490
--- /dev/null
+++ b/application/views/errors/index.html
@@ -0,0 +1,11 @@
+
+
+
+ 403 Forbidden
+
+
+
+Directory access is forbidden.
+
+
+
diff --git a/application/views/includes/add-new-user-form.php b/application/views/includes/add-new-user-form.php
new file mode 100755
index 0000000..a4d35b5
--- /dev/null
+++ b/application/views/includes/add-new-user-form.php
@@ -0,0 +1,100 @@
+
+
+
\ No newline at end of file
diff --git a/application/views/includes/admin-footer.php b/application/views/includes/admin-footer.php
new file mode 100755
index 0000000..ab0a4da
--- /dev/null
+++ b/application/views/includes/admin-footer.php
@@ -0,0 +1 @@
+© 2024. Az alkalmazás szerzői jogvédelem alatt áll.
\ No newline at end of file
diff --git a/application/views/includes/barber-footer.php b/application/views/includes/barber-footer.php
new file mode 100755
index 0000000..4f5a1d2
--- /dev/null
+++ b/application/views/includes/barber-footer.php
@@ -0,0 +1,138 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/application/views/includes/barber-head.php b/application/views/includes/barber-head.php
new file mode 100755
index 0000000..44fc6b6
--- /dev/null
+++ b/application/views/includes/barber-head.php
@@ -0,0 +1,49 @@
+load->helper('url');
+
+
+?>
+
+
+
+
+
+
+
+ Studio Beve - Beauty & Barber Shop
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/application/views/includes/barber-header.php b/application/views/includes/barber-header.php
new file mode 100755
index 0000000..a8d72d4
--- /dev/null
+++ b/application/views/includes/barber-header.php
@@ -0,0 +1,92 @@
+
+
+
+
+
diff --git a/application/views/includes/barber-skeleton-bottom.php b/application/views/includes/barber-skeleton-bottom.php
new file mode 100755
index 0000000..4c823f1
--- /dev/null
+++ b/application/views/includes/barber-skeleton-bottom.php
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
+