Your commit message
This commit is contained in:
parent
aac7f7ed1b
commit
f9bc85d5f8
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"presets": ["@babel/preset-env"]
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
{
|
||||||
|
"env": {
|
||||||
|
"browser": true,
|
||||||
|
"jquery": true
|
||||||
|
},
|
||||||
|
"parser": "@babel/eslint-parser",
|
||||||
|
"parserOptions": {
|
||||||
|
"ecmaVersion": 2020,
|
||||||
|
"sourceType": "module"
|
||||||
|
},
|
||||||
|
"plugins": [
|
||||||
|
"prettier"
|
||||||
|
],
|
||||||
|
"extends": [
|
||||||
|
"eslint:recommended",
|
||||||
|
"prettier"
|
||||||
|
],
|
||||||
|
"rules": {
|
||||||
|
"prettier/prettier": "error",
|
||||||
|
"no-undef": "off",
|
||||||
|
"no-unused-vars": "off"
|
||||||
|
},
|
||||||
|
"globals": {
|
||||||
|
"$": "readonly",
|
||||||
|
"jQuery": "readonly",
|
||||||
|
"document": "readonly",
|
||||||
|
"window": "readonly",
|
||||||
|
"console": "readonly"
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,55 +1,35 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
. "$(dirname "$0")/_/husky.sh"
|
. "$(dirname "$0")/_/husky.sh"
|
||||||
|
# Run JS/CSS checks
|
||||||
|
.husky/pre-commit-js-css
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo "JS/CSS checks failed"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
# Get the list of staged PHP files
|
||||||
|
STAGED_FILES=$(git diff --cached --name-only --diff-filter=ACM | grep '\.php$')
|
||||||
|
|
||||||
|
# If there are no staged PHP files, exit
|
||||||
|
if [ -z "$STAGED_FILES" ]; then
|
||||||
|
echo "No PHP files staged for commit."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
# Function to display errors
|
# Function to display errors
|
||||||
display_errors() {
|
display_errors() {
|
||||||
local errors="$1"
|
local errors="$1"
|
||||||
echo "Errors detected:"
|
echo "Errors detected:"
|
||||||
echo "---------------------------------------"
|
echo "---------------------------------------"
|
||||||
echo "$errors"
|
echo "$errors" | while IFS='|' read -r file line error; do
|
||||||
|
printf "%-60s | %-10s | %s\n" "$file" "$line" "$error"
|
||||||
|
done
|
||||||
echo "---------------------------------------"
|
echo "---------------------------------------"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Get the list of staged files
|
# Run PHP lint to check for syntax errors
|
||||||
STAGED_FILES=$(git diff --cached --name-only --diff-filter=ACM | grep -E '\.(php|js|css|jsx|ts|tsx)$')
|
|
||||||
|
|
||||||
# If there are no staged files, exit
|
|
||||||
if [ -z "$STAGED_FILES" ]; then
|
|
||||||
echo "No files staged for commit."
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Initialize error flags
|
|
||||||
ESLINT_ERRORS=""
|
|
||||||
PHP_ERRORS=0
|
|
||||||
|
|
||||||
# Function to run ESLint and Prettier on JavaScript files
|
|
||||||
run_js_tools() {
|
|
||||||
local files="$1"
|
|
||||||
if [ -n "$files" ]; then
|
|
||||||
echo "Running ESLint..."
|
|
||||||
for FILE in $files; do
|
|
||||||
ESLINT_OUTPUT=$(npx eslint "$FILE" 2>&1)
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
display_errors "$ESLINT_OUTPUT"
|
|
||||||
ESLINT_ERRORS=1
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
echo "Running Prettier..."
|
|
||||||
for FILE in $files; do
|
|
||||||
npx prettier --write "$FILE"
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Function to run PHP tools
|
|
||||||
run_php_tools() {
|
|
||||||
local files="$1"
|
|
||||||
if [ -n "$files" ]; then
|
|
||||||
echo "Checking PHP syntax errors..."
|
|
||||||
SYNTAX_ERRORS=0
|
SYNTAX_ERRORS=0
|
||||||
for FILE in $files; do
|
echo "Checking PHP syntax errors..."
|
||||||
|
for FILE in $STAGED_FILES; do
|
||||||
php -l "$FILE"
|
php -l "$FILE"
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
SYNTAX_ERRORS=1
|
SYNTAX_ERRORS=1
|
||||||
|
@ -57,44 +37,30 @@ run_php_tools() {
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ $SYNTAX_ERRORS -ne 0 ]; then
|
if [ $SYNTAX_ERRORS -ne 0 ]; then
|
||||||
PHP_ERRORS=1
|
echo "Syntax errors detected. Please fix them before committing."
|
||||||
echo "Syntax errors detected in PHP files."
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Run PHPCBF to auto-fix issues
|
||||||
echo "Running PHPCBF..."
|
echo "Running PHPCBF..."
|
||||||
for FILE in $files; do
|
for FILE in $STAGED_FILES; do
|
||||||
/home/aissel/.config/composer/vendor/bin/phpcbf --standard=/var/www/html/google_forms/phpcs.xml "$FILE" || true
|
/home/aissel/.config/composer/vendor/bin/phpcbf --standard=/var/www/html/google_forms/phpcs.xml "$FILE" || true
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# Run PHP CS Fixer to auto-fix issues
|
||||||
echo "Running PHP CS Fixer..."
|
echo "Running PHP CS Fixer..."
|
||||||
for FILE in $files; do
|
for FILE in $STAGED_FILES; do
|
||||||
/home/aissel/.config/composer/vendor/bin/php-cs-fixer fix "$FILE"
|
/home/aissel/.config/composer/vendor/bin/php-cs-fixer fix "$FILE"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# Re-run PHPCS to check for unresolved coding standard violations
|
||||||
echo "Running PHPCS..."
|
echo "Running PHPCS..."
|
||||||
for FILE in $files; do
|
echo "$STAGED_FILES" | xargs -n 1 /home/aissel/.config/composer/vendor/bin/phpcs --standard=/var/www/html/google_forms/phpcs.xml
|
||||||
PHPCS_OUTPUT=$(/home/aissel/.config/composer/vendor/bin/phpcs --standard=/var/www/html/google_forms/phpcs.xml "$FILE" 2>&1)
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
display_errors "$PHPCS_OUTPUT"
|
|
||||||
PHP_ERRORS=1
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Run tools based on file types
|
|
||||||
run_js_tools "$(echo "$STAGED_FILES" | grep -E '\.(js|jsx|ts|tsx)$')"
|
|
||||||
run_php_tools "$(echo "$STAGED_FILES" | grep '\.php$')"
|
|
||||||
|
|
||||||
# Add the fixed files back to the staging area
|
# Add the fixed files back to the staging area
|
||||||
for FILE in $STAGED_FILES; do
|
for FILE in $STAGED_FILES; do
|
||||||
git add "$FILE"
|
git add "$FILE"
|
||||||
done
|
done
|
||||||
|
|
||||||
# Exit with error code if there were any errors
|
|
||||||
if [ $PHP_ERRORS -ne 0 ] || [ $ESLINT_ERRORS -eq 1 ]; then
|
|
||||||
echo "Pre-commit checks failed. Please fix the errors before committing."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Pre-commit checks completed."
|
echo "Pre-commit checks completed."
|
||||||
|
|
|
@ -0,0 +1,48 @@
|
||||||
|
#!/bin/sh
|
||||||
|
. "$(dirname "$0")/_/husky.sh"
|
||||||
|
|
||||||
|
# Get the list of staged JS/CSS files
|
||||||
|
STAGED_FILES=$(git diff --cached --name-only --diff-filter=ACM | grep -E '\.(js|jsx|ts|tsx|css|scss)$')
|
||||||
|
|
||||||
|
# If there are no staged JS/CSS files, exit
|
||||||
|
if [ -z "$STAGED_FILES" ]; then
|
||||||
|
echo "No JS/CSS files staged for commit."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Function to display errors
|
||||||
|
display_errors() {
|
||||||
|
local errors="$1"
|
||||||
|
echo "Errors detected:"
|
||||||
|
echo "---------------------------------------"
|
||||||
|
echo "$errors"
|
||||||
|
echo "---------------------------------------"
|
||||||
|
}
|
||||||
|
# Run Prettier
|
||||||
|
echo "Running Prettier..."
|
||||||
|
for FILE in $STAGED_FILES; do
|
||||||
|
npx prettier --write "$FILE"
|
||||||
|
done
|
||||||
|
|
||||||
|
# Run ESLint
|
||||||
|
echo "Running ESLint..."
|
||||||
|
ESLINT_ERRORS=0
|
||||||
|
for FILE in $STAGED_FILES; do
|
||||||
|
ESLINT_OUTPUT=$(npx eslint "$FILE" 2>&1)
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
display_errors "$ESLINT_OUTPUT"
|
||||||
|
ESLINT_ERRORS=1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ $ESLINT_ERRORS -ne 0 ]; then
|
||||||
|
echo "ESLint errors detected. Please fix them before committing."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Add the fixed files back to the staging area
|
||||||
|
for FILE in $STAGED_FILES; do
|
||||||
|
git add "$FILE"
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "JS/CSS pre-commit checks completed."
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,22 @@
|
||||||
|
# Ignore node_modules directory
|
||||||
|
node_modules/
|
||||||
|
|
||||||
|
# Ignore build directory
|
||||||
|
build/
|
||||||
|
|
||||||
|
# Ignore all minified JavaScript files
|
||||||
|
*.min.js
|
||||||
|
|
||||||
|
|
||||||
|
# Ignore specific files
|
||||||
|
public/vendor/jquery.js
|
||||||
|
public/vendor/bootstrap.js
|
||||||
|
|
||||||
|
# Ignore all files in a specific directory
|
||||||
|
src/vendor/
|
||||||
|
|
||||||
|
# Ignore specific file
|
||||||
|
path/to/specific/file.js
|
||||||
|
|
||||||
|
# Ignore all JavaScript files in a specific directory
|
||||||
|
src/vendor/*.js
|
|
@ -0,0 +1,15 @@
|
||||||
|
{
|
||||||
|
"trailingComma": "es5",
|
||||||
|
"tabWidth": 2,
|
||||||
|
"semi": false,
|
||||||
|
"singleQuote": true,
|
||||||
|
"jsxSingleQuote": true,
|
||||||
|
"bracketSpacing": true,
|
||||||
|
"parser": "babel-ts",
|
||||||
|
"requirePragma": false,
|
||||||
|
"insertPragma": false,
|
||||||
|
"proseWrap": "preserve",
|
||||||
|
"htmlWhitespaceSensitivity": "css",
|
||||||
|
"endOfLine": "lf",
|
||||||
|
"embeddedLanguageFormatting": "off"
|
||||||
|
}
|
|
@ -1,11 +1,9 @@
|
||||||
<!DOCTYPE html>
|
<!doctype html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>403 Forbidden</title>
|
<title>403 Forbidden</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<p>Directory access is forbidden.</p>
|
<p>Directory access is forbidden.</p>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
|
||||||
|
defined('BASEPATH') or exit('No direct script access allowed');
|
||||||
|
|
||||||
/*
|
/*
|
||||||
| -------------------------------------------------------------------
|
| -------------------------------------------------------------------
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
|
||||||
|
defined('BASEPATH') or exit('No direct script access allowed');
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
@ -102,7 +103,7 @@ $config['charset'] = 'UTF-8';
|
||||||
| setting this variable to TRUE (boolean). See the user guide for details.
|
| setting this variable to TRUE (boolean). See the user guide for details.
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
$config['enable_hooks'] = FALSE;
|
$config['enable_hooks'] = false;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
@ -138,7 +139,7 @@ $config['subclass_prefix'] = 'MY_';
|
||||||
| Note: This will NOT disable or override the CodeIgniter-specific
|
| Note: This will NOT disable or override the CodeIgniter-specific
|
||||||
| autoloading (application/config/autoload.php)
|
| autoloading (application/config/autoload.php)
|
||||||
*/
|
*/
|
||||||
$config['composer_autoload'] = FALSE;
|
$config['composer_autoload'] = false;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
@ -184,7 +185,7 @@ $config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-';
|
||||||
| use segment based URLs.
|
| use segment based URLs.
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
$config['enable_query_strings'] = FALSE;
|
$config['enable_query_strings'] = false;
|
||||||
$config['controller_trigger'] = 'c';
|
$config['controller_trigger'] = 'c';
|
||||||
$config['function_trigger'] = 'm';
|
$config['function_trigger'] = 'm';
|
||||||
$config['directory_trigger'] = 'd';
|
$config['directory_trigger'] = 'd';
|
||||||
|
@ -201,7 +202,7 @@ $config['directory_trigger'] = 'd';
|
||||||
| for backwards compatibility purposes!
|
| for backwards compatibility purposes!
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
$config['allow_get_array'] = TRUE;
|
$config['allow_get_array'] = true;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
@ -313,7 +314,7 @@ $config['cache_path'] = '';
|
||||||
| of query parameters.
|
| of query parameters.
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
$config['cache_query_string'] = FALSE;
|
$config['cache_query_string'] = false;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
@ -387,10 +388,10 @@ $config['sess_driver'] = 'files';
|
||||||
$config['sess_cookie_name'] = 'ci_session';
|
$config['sess_cookie_name'] = 'ci_session';
|
||||||
$config['sess_samesite'] = 'Lax';
|
$config['sess_samesite'] = 'Lax';
|
||||||
$config['sess_expiration'] = 7200;
|
$config['sess_expiration'] = 7200;
|
||||||
$config['sess_save_path'] = NULL;
|
$config['sess_save_path'] = null;
|
||||||
$config['sess_match_ip'] = FALSE;
|
$config['sess_match_ip'] = false;
|
||||||
$config['sess_time_to_update'] = 300;
|
$config['sess_time_to_update'] = 300;
|
||||||
$config['sess_regenerate_destroy'] = FALSE;
|
$config['sess_regenerate_destroy'] = false;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
@ -411,8 +412,8 @@ $config['sess_regenerate_destroy'] = FALSE;
|
||||||
$config['cookie_prefix'] = '';
|
$config['cookie_prefix'] = '';
|
||||||
$config['cookie_domain'] = '';
|
$config['cookie_domain'] = '';
|
||||||
$config['cookie_path'] = '/';
|
$config['cookie_path'] = '/';
|
||||||
$config['cookie_secure'] = FALSE;
|
$config['cookie_secure'] = false;
|
||||||
$config['cookie_httponly'] = FALSE;
|
$config['cookie_httponly'] = false;
|
||||||
$config['cookie_samesite'] = 'Lax';
|
$config['cookie_samesite'] = 'Lax';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -427,7 +428,7 @@ $config['cookie_samesite'] = 'Lax';
|
||||||
| for backwards compatibility purposes!
|
| for backwards compatibility purposes!
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
$config['standardize_newlines'] = FALSE;
|
$config['standardize_newlines'] = false;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
@ -441,7 +442,7 @@ $config['standardize_newlines'] = FALSE;
|
||||||
| for backwards compatibility purposes!
|
| for backwards compatibility purposes!
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
$config['global_xss_filtering'] = FALSE;
|
$config['global_xss_filtering'] = false;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
@ -457,11 +458,11 @@ $config['global_xss_filtering'] = FALSE;
|
||||||
| 'csrf_regenerate' = Regenerate token on every submission
|
| 'csrf_regenerate' = Regenerate token on every submission
|
||||||
| 'csrf_exclude_uris' = Array of URIs which ignore CSRF checks
|
| 'csrf_exclude_uris' = Array of URIs which ignore CSRF checks
|
||||||
*/
|
*/
|
||||||
$config['csrf_protection'] = FALSE;
|
$config['csrf_protection'] = false;
|
||||||
$config['csrf_token_name'] = 'csrf_test_name';
|
$config['csrf_token_name'] = 'csrf_test_name';
|
||||||
$config['csrf_cookie_name'] = 'csrf_cookie_name';
|
$config['csrf_cookie_name'] = 'csrf_cookie_name';
|
||||||
$config['csrf_expire'] = 7200;
|
$config['csrf_expire'] = 7200;
|
||||||
$config['csrf_regenerate'] = TRUE;
|
$config['csrf_regenerate'] = true;
|
||||||
$config['csrf_exclude_uris'] = array();
|
$config['csrf_exclude_uris'] = array();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -484,7 +485,7 @@ $config['csrf_exclude_uris'] = array();
|
||||||
| by the output class. Do not 'echo' any values with compression enabled.
|
| by the output class. Do not 'echo' any values with compression enabled.
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
$config['compress_output'] = FALSE;
|
$config['compress_output'] = false;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
@ -511,7 +512,7 @@ $config['time_reference'] = 'local';
|
||||||
| Note: You need to have eval() enabled for this to work.
|
| Note: You need to have eval() enabled for this to work.
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
$config['rewrite_short_tags'] = FALSE;
|
$config['rewrite_short_tags'] = false;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
|
||||||
|
defined('BASEPATH') or exit('No direct script access allowed');
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
@ -11,7 +12,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||||
| of this setting
|
| of this setting
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
defined('SHOW_DEBUG_BACKTRACE') OR define('SHOW_DEBUG_BACKTRACE', TRUE);
|
defined('SHOW_DEBUG_BACKTRACE') or define('SHOW_DEBUG_BACKTRACE', true);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
@ -26,10 +27,10 @@ defined('SHOW_DEBUG_BACKTRACE') OR define('SHOW_DEBUG_BACKTRACE', TRUE);
|
||||||
| always be used to set the mode correctly.
|
| always be used to set the mode correctly.
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
defined('FILE_READ_MODE') OR define('FILE_READ_MODE', 0644);
|
defined('FILE_READ_MODE') or define('FILE_READ_MODE', 0644);
|
||||||
defined('FILE_WRITE_MODE') OR define('FILE_WRITE_MODE', 0666);
|
defined('FILE_WRITE_MODE') or define('FILE_WRITE_MODE', 0666);
|
||||||
defined('DIR_READ_MODE') OR define('DIR_READ_MODE', 0755);
|
defined('DIR_READ_MODE') or define('DIR_READ_MODE', 0755);
|
||||||
defined('DIR_WRITE_MODE') OR define('DIR_WRITE_MODE', 0755);
|
defined('DIR_WRITE_MODE') or define('DIR_WRITE_MODE', 0755);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
@ -39,14 +40,14 @@ defined('DIR_WRITE_MODE') OR define('DIR_WRITE_MODE', 0755);
|
||||||
| These modes are used when working with fopen()/popen()
|
| These modes are used when working with fopen()/popen()
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
defined('FOPEN_READ') OR define('FOPEN_READ', 'rb');
|
defined('FOPEN_READ') or define('FOPEN_READ', 'rb');
|
||||||
defined('FOPEN_READ_WRITE') OR define('FOPEN_READ_WRITE', 'r+b');
|
defined('FOPEN_READ_WRITE') or define('FOPEN_READ_WRITE', 'r+b');
|
||||||
defined('FOPEN_WRITE_CREATE_DESTRUCTIVE') OR define('FOPEN_WRITE_CREATE_DESTRUCTIVE', 'wb'); // truncates existing file data, use with care
|
defined('FOPEN_WRITE_CREATE_DESTRUCTIVE') or define('FOPEN_WRITE_CREATE_DESTRUCTIVE', 'wb'); // truncates existing file data, use with care
|
||||||
defined('FOPEN_READ_WRITE_CREATE_DESTRUCTIVE') OR define('FOPEN_READ_WRITE_CREATE_DESTRUCTIVE', 'w+b'); // truncates existing file data, use with care
|
defined('FOPEN_READ_WRITE_CREATE_DESTRUCTIVE') or define('FOPEN_READ_WRITE_CREATE_DESTRUCTIVE', 'w+b'); // truncates existing file data, use with care
|
||||||
defined('FOPEN_WRITE_CREATE') OR define('FOPEN_WRITE_CREATE', 'ab');
|
defined('FOPEN_WRITE_CREATE') or define('FOPEN_WRITE_CREATE', 'ab');
|
||||||
defined('FOPEN_READ_WRITE_CREATE') OR define('FOPEN_READ_WRITE_CREATE', 'a+b');
|
defined('FOPEN_READ_WRITE_CREATE') or define('FOPEN_READ_WRITE_CREATE', 'a+b');
|
||||||
defined('FOPEN_WRITE_CREATE_STRICT') OR define('FOPEN_WRITE_CREATE_STRICT', 'xb');
|
defined('FOPEN_WRITE_CREATE_STRICT') or define('FOPEN_WRITE_CREATE_STRICT', 'xb');
|
||||||
defined('FOPEN_READ_WRITE_CREATE_STRICT') OR define('FOPEN_READ_WRITE_CREATE_STRICT', 'x+b');
|
defined('FOPEN_READ_WRITE_CREATE_STRICT') or define('FOPEN_READ_WRITE_CREATE_STRICT', 'x+b');
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
@ -73,13 +74,13 @@ defined('FOPEN_READ_WRITE_CREATE_STRICT') OR define('FOPEN_READ_WRITE_CREA
|
||||||
| http://tldp.org/LDP/abs/html/exitcodes.html
|
| http://tldp.org/LDP/abs/html/exitcodes.html
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
defined('EXIT_SUCCESS') OR define('EXIT_SUCCESS', 0); // no errors
|
defined('EXIT_SUCCESS') or define('EXIT_SUCCESS', 0); // no errors
|
||||||
defined('EXIT_ERROR') OR define('EXIT_ERROR', 1); // generic error
|
defined('EXIT_ERROR') or define('EXIT_ERROR', 1); // generic error
|
||||||
defined('EXIT_CONFIG') OR define('EXIT_CONFIG', 3); // configuration error
|
defined('EXIT_CONFIG') or define('EXIT_CONFIG', 3); // configuration error
|
||||||
defined('EXIT_UNKNOWN_FILE') OR define('EXIT_UNKNOWN_FILE', 4); // file not found
|
defined('EXIT_UNKNOWN_FILE') or define('EXIT_UNKNOWN_FILE', 4); // file not found
|
||||||
defined('EXIT_UNKNOWN_CLASS') OR define('EXIT_UNKNOWN_CLASS', 5); // unknown class
|
defined('EXIT_UNKNOWN_CLASS') or define('EXIT_UNKNOWN_CLASS', 5); // unknown class
|
||||||
defined('EXIT_UNKNOWN_METHOD') OR define('EXIT_UNKNOWN_METHOD', 6); // unknown class member
|
defined('EXIT_UNKNOWN_METHOD') or define('EXIT_UNKNOWN_METHOD', 6); // unknown class member
|
||||||
defined('EXIT_USER_INPUT') OR define('EXIT_USER_INPUT', 7); // invalid user input
|
defined('EXIT_USER_INPUT') or define('EXIT_USER_INPUT', 7); // invalid user input
|
||||||
defined('EXIT_DATABASE') OR define('EXIT_DATABASE', 8); // database error
|
defined('EXIT_DATABASE') or define('EXIT_DATABASE', 8); // database error
|
||||||
defined('EXIT__AUTO_MIN') OR define('EXIT__AUTO_MIN', 9); // lowest automatically-assigned error code
|
defined('EXIT__AUTO_MIN') or define('EXIT__AUTO_MIN', 9); // lowest automatically-assigned error code
|
||||||
defined('EXIT__AUTO_MAX') OR define('EXIT__AUTO_MAX', 125); // highest automatically-assigned error code
|
defined('EXIT__AUTO_MAX') or define('EXIT__AUTO_MAX', 125); // highest automatically-assigned error code
|
||||||
|
|
|
@ -1,77 +1,20 @@
|
||||||
<?php
|
<?php
|
||||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
|
||||||
|
|
||||||
/*
|
/**
|
||||||
| -------------------------------------------------------------------
|
* This file handles the XYZ functionality in the application.
|
||||||
| DATABASE CONNECTIVITY SETTINGS
|
* @category YourCategory
|
||||||
| -------------------------------------------------------------------
|
* @package YourApplication
|
||||||
| This file will contain the settings needed to access your database.
|
* @subpackage YourSubpackage
|
||||||
|
|
* @author Your Name
|
||||||
| For complete instructions please consult the 'Database Connection'
|
* @date YYYY-MM-DD
|
||||||
| page of the User Guide.
|
* @version 1.0
|
||||||
|
|
|
||||||
| -------------------------------------------------------------------
|
|
||||||
| EXPLANATION OF VARIABLES
|
|
||||||
| -------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| ['dsn'] The full DSN string describe a connection to the database.
|
|
||||||
| ['hostname'] The hostname of your database server.
|
|
||||||
| ['username'] The username used to connect to the database
|
|
||||||
| ['password'] The password used to connect to the database
|
|
||||||
| ['database'] The name of the database you want to connect to
|
|
||||||
| ['dbdriver'] The database driver. e.g.: mysqli.
|
|
||||||
| Currently supported:
|
|
||||||
| cubrid, ibase, mssql, mysql, mysqli, oci8,
|
|
||||||
| odbc, pdo, postgre, sqlite, sqlite3, sqlsrv
|
|
||||||
| ['dbprefix'] You can add an optional prefix, which will be added
|
|
||||||
| to the table name when using the Query Builder class
|
|
||||||
| ['pconnect'] TRUE/FALSE - Whether to use a persistent connection
|
|
||||||
| ['db_debug'] TRUE/FALSE - Whether database errors should be displayed.
|
|
||||||
| ['cache_on'] TRUE/FALSE - Enables/disables query caching
|
|
||||||
| ['cachedir'] The path to the folder where cache files should be stored
|
|
||||||
| ['char_set'] The character set used in communicating with the database
|
|
||||||
| ['dbcollat'] The character collation used in communicating with the database
|
|
||||||
| NOTE: For MySQL and MySQLi databases, this setting is only used
|
|
||||||
| as a backup if your server is running PHP < 5.2.3 or MySQL < 5.0.7
|
|
||||||
| (and in table creation queries made with DB Forge).
|
|
||||||
| There is an incompatibility in PHP with mysql_real_escape_string() which
|
|
||||||
| can make your site vulnerable to SQL injection if you are using a
|
|
||||||
| multi-byte character set and are running versions lower than these.
|
|
||||||
| Sites using Latin-1 or UTF-8 database character set and collation are unaffected.
|
|
||||||
| ['swap_pre'] A default table prefix that should be swapped with the dbprefix
|
|
||||||
| ['encrypt'] Whether or not to use an encrypted connection.
|
|
||||||
|
|
|
||||||
| 'mysql' (deprecated), 'sqlsrv' and 'pdo/sqlsrv' drivers accept TRUE/FALSE
|
|
||||||
| 'mysqli' and 'pdo/mysql' drivers accept an array with the following options:
|
|
||||||
|
|
|
||||||
| 'ssl_key' - Path to the private key file
|
|
||||||
| 'ssl_cert' - Path to the public key certificate file
|
|
||||||
| 'ssl_ca' - Path to the certificate authority file
|
|
||||||
| 'ssl_capath' - Path to a directory containing trusted CA certificates in PEM format
|
|
||||||
| 'ssl_cipher' - List of *allowed* ciphers to be used for the encryption, separated by colons (':')
|
|
||||||
| 'ssl_verify' - TRUE/FALSE; Whether verify the server certificate or not
|
|
||||||
|
|
|
||||||
| ['compress'] Whether or not to use client compression (MySQL only)
|
|
||||||
| ['stricton'] TRUE/FALSE - forces 'Strict Mode' connections
|
|
||||||
| - good for ensuring strict SQL while developing
|
|
||||||
| ['ssl_options'] Used to set various SSL options that can be used when making SSL connections.
|
|
||||||
| ['failover'] array - A array with 0 or more data for connections if the main should fail.
|
|
||||||
| ['save_queries'] TRUE/FALSE - Whether to "save" all executed queries.
|
|
||||||
| NOTE: Disabling this will also effectively disable both
|
|
||||||
| $this->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.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
defined('BASEPATH') or exit('No direct script access allowed');
|
||||||
|
|
||||||
|
|
||||||
$active_group = 'default';
|
$active_group = 'default';
|
||||||
$query_builder = TRUE;
|
$query_builder = true;
|
||||||
|
|
||||||
$db['default'] = array(
|
$db['default'] = array(
|
||||||
'dsn' => '',
|
'dsn' => '',
|
||||||
|
@ -81,16 +24,16 @@ $db['default'] = array(
|
||||||
'database' => 'google_forms',
|
'database' => 'google_forms',
|
||||||
'dbdriver' => 'mysqli',
|
'dbdriver' => 'mysqli',
|
||||||
'dbprefix' => '',
|
'dbprefix' => '',
|
||||||
'pconnect' => FALSE,
|
'pconnect' => false,
|
||||||
'db_debug' => (ENVIRONMENT !== 'production'),
|
'db_debug' => (ENVIRONMENT !== 'production'),
|
||||||
'cache_on' => FALSE,
|
'cache_on' => false,
|
||||||
'cachedir' => '',
|
'cachedir' => '',
|
||||||
'char_set' => 'utf8',
|
'char_set' => 'utf8',
|
||||||
'dbcollat' => 'utf8_general_ci',
|
'dbcollat' => 'utf8_general_ci',
|
||||||
'swap_pre' => '',
|
'swap_pre' => '',
|
||||||
'encrypt' => FALSE,
|
'encrypt' => false,
|
||||||
'compress' => FALSE,
|
'compress' => false,
|
||||||
'stricton' => FALSE,
|
'stricton' => false,
|
||||||
'failover' => array(),
|
'failover' => array(),
|
||||||
'save_queries' => TRUE
|
'save_queries' => true
|
||||||
);
|
);
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
|
||||||
|
defined('BASEPATH') or exit('No direct script access allowed');
|
||||||
|
|
||||||
$_doctypes = array(
|
$_doctypes = array(
|
||||||
'xhtml11' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">',
|
'xhtml11' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">',
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
|
||||||
|
defined('BASEPATH') or exit('No direct script access allowed');
|
||||||
|
|
||||||
/*
|
/*
|
||||||
| -------------------------------------------------------------------
|
| -------------------------------------------------------------------
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
|
||||||
|
defined('BASEPATH') or exit('No direct script access allowed');
|
||||||
|
|
||||||
/*
|
/*
|
||||||
| -------------------------------------------------------------------------
|
| -------------------------------------------------------------------------
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
<!DOCTYPE html>
|
<!doctype html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>403 Forbidden</title>
|
<title>403 Forbidden</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<p>Directory access is forbidden.</p>
|
<p>Directory access is forbidden.</p>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
|
||||||
|
defined('BASEPATH') or exit('No direct script access allowed');
|
||||||
|
|
||||||
/*
|
/*
|
||||||
| -------------------------------------------------------------------------
|
| -------------------------------------------------------------------------
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
|
||||||
|
defined('BASEPATH') or exit('No direct script access allowed');
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
@ -11,7 +12,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||||
| and disable it back when you're done.
|
| and disable it back when you're done.
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
$config['migration_enabled'] = FALSE;
|
$config['migration_enabled'] = false;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
@ -57,7 +58,7 @@ $config['migration_table'] = 'migrations';
|
||||||
| in your code to have the latest migration.
|
| in your code to have the latest migration.
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
$config['migration_auto_latest'] = FALSE;
|
$config['migration_auto_latest'] = false;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
|
||||||
|
defined('BASEPATH') or exit('No direct script access allowed');
|
||||||
|
|
||||||
/*
|
/*
|
||||||
| -------------------------------------------------------------------
|
| -------------------------------------------------------------------
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
|
||||||
|
defined('BASEPATH') or exit('No direct script access allowed');
|
||||||
|
|
||||||
/*
|
/*
|
||||||
| -------------------------------------------------------------------------
|
| -------------------------------------------------------------------------
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
|
||||||
|
defined('BASEPATH') or exit('No direct script access allowed');
|
||||||
|
|
||||||
$route['forms'] = 'home/index4';
|
$route['forms'] = 'home/index4';
|
||||||
|
|
||||||
|
@ -8,7 +9,7 @@ $route['responses/view/(:num)'] = 'Response_submit/viewresponse/$1';
|
||||||
$route['publish/(:num)'] = 'forms/preview/$1';
|
$route['publish/(:num)'] = 'forms/preview/$1';
|
||||||
$route['default_controller'] = 'Form_controller/index_forms';
|
$route['default_controller'] = 'Form_controller/index_forms';
|
||||||
$route['404_override'] = '';
|
$route['404_override'] = '';
|
||||||
$route['translate_uri_dashes'] = FALSE;
|
$route['translate_uri_dashes'] = false;
|
||||||
$route['start'] = 'Form_controller/index_forms';
|
$route['start'] = 'Form_controller/index_forms';
|
||||||
$route['title_desc'] = 'homepage/title';
|
$route['title_desc'] = 'homepage/title';
|
||||||
$route['forms/delete/(:any)'] = 'Form_controller/delete/$1';
|
$route['forms/delete/(:any)'] = 'Form_controller/delete/$1';
|
||||||
|
@ -25,3 +26,4 @@ $route['response_preview/(:num)'] = 'forms/response_preview/$1';
|
||||||
|
|
||||||
$route['title'] = 'homepage/title';
|
$route['title'] = 'homepage/title';
|
||||||
|
|
||||||
|
$route['total_responses'] = 'Response_submit/index';
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
|
||||||
|
defined('BASEPATH') or exit('No direct script access allowed');
|
||||||
|
|
||||||
/*
|
/*
|
||||||
| -------------------------------------------------------------------
|
| -------------------------------------------------------------------
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
|
||||||
|
defined('BASEPATH') or exit('No direct script access allowed');
|
||||||
|
|
||||||
/*
|
/*
|
||||||
| -------------------------------------------------------------------
|
| -------------------------------------------------------------------
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace application\controllers;
|
// namespace application\controllers;
|
||||||
|
|
||||||
defined('BASEPATH') or exit('No direct script access allowed');
|
defined('BASEPATH') or exit('No direct script access allowed');
|
||||||
|
|
||||||
// use application\models\Form_model;
|
|
||||||
|
|
||||||
class Form extends CI_Controller
|
class Form extends CI_Controller
|
||||||
{
|
{
|
||||||
public function __construct()
|
public function __construct()
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
defined('BASEPATH') or exit('No direct script access allowed');
|
defined('BASEPATH') or exit('No direct script access allowed');
|
||||||
|
|
||||||
class Form_controller extends CI_Controller
|
class Form_controller extends CI_Controller
|
||||||
{
|
{
|
||||||
|
|
||||||
public function index_forms($form_id = null)
|
public function index_forms($form_id = null)
|
||||||
{
|
{
|
||||||
$this->load->model('Frontend_model');
|
$this->load->model('Frontend_model');
|
||||||
|
@ -25,7 +25,6 @@ class Form_controller extends CI_Controller
|
||||||
$form_title = $form['title'];
|
$form_title = $form['title'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fetch data from models
|
// Fetch data from models
|
||||||
$data['total_forms'] = $this->Form_model->get_total_forms($user_id);
|
$data['total_forms'] = $this->Form_model->get_total_forms($user_id);
|
||||||
$data['published_forms'] = $this->Form_model->get_published_forms($user_id);
|
$data['published_forms'] = $this->Form_model->get_published_forms($user_id);
|
||||||
|
@ -49,12 +48,13 @@ class Form_controller extends CI_Controller
|
||||||
$this->load->model('Frontend_model');
|
$this->load->model('Frontend_model');
|
||||||
$this->Frontend_model->deleteForm($id);
|
$this->Frontend_model->deleteForm($id);
|
||||||
$this->session->set_flashdata('status', 'Form data deleted successfully');
|
$this->session->set_flashdata('status', 'Form data deleted successfully');
|
||||||
redirect('drafts');
|
redirect('home');
|
||||||
}
|
}
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
$this->load->model('Updation_model');
|
$this->load->model('Updation_model');
|
||||||
|
$this->load->model('Form_model');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load the form for editing
|
// Load the form for editing
|
||||||
|
@ -63,11 +63,11 @@ class Form_controller extends CI_Controller
|
||||||
$data['form'] = $this->Updation_model->get_form($form_id);
|
$data['form'] = $this->Updation_model->get_form($form_id);
|
||||||
$data['questions'] = $this->Updation_model->get_questions($form_id);
|
$data['questions'] = $this->Updation_model->get_questions($form_id);
|
||||||
$data['options'] = $this->Updation_model->get_options();
|
$data['options'] = $this->Updation_model->get_options();
|
||||||
|
$data['is_published'] = $this->Form_model->get_published_value($form_id);
|
||||||
|
|
||||||
// $this->load->view('templates/header');
|
// $this->load->view('templates/header');
|
||||||
$this->load->view('edit_form_view', $data);
|
$this->load->view('edit_form_view', $data);
|
||||||
// $this->load->view('templates/footer');
|
// $this->load->view('templates/footer');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save the edited form
|
// Save the edited form
|
||||||
|
@ -126,5 +126,4 @@ class Form_controller extends CI_Controller
|
||||||
|
|
||||||
$this->load->view('templates/footer');
|
$this->load->view('templates/footer');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -10,9 +10,6 @@ class Forms extends CI_Controller
|
||||||
// If not logged in, redirect to login page
|
// If not logged in, redirect to login page
|
||||||
redirect('users/login');
|
redirect('users/login');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Load the model that handles the form data
|
// Load the model that handles the form data
|
||||||
$this->load->model('preview_model');
|
$this->load->model('preview_model');
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
defined('BASEPATH') or exit('No direct script access allowed');
|
defined('BASEPATH') or exit('No direct script access allowed');
|
||||||
|
|
||||||
class Homepage extends CI_Controller
|
class Homepage extends CI_Controller
|
||||||
{
|
{
|
||||||
|
|
||||||
// index2-default
|
// index2-default
|
||||||
public function home()
|
public function home()
|
||||||
{
|
{
|
||||||
|
@ -17,19 +17,15 @@ class Homepage extends CI_Controller
|
||||||
{
|
{
|
||||||
|
|
||||||
$this->load->view('templates/forms_ui');
|
$this->load->view('templates/forms_ui');
|
||||||
|
|
||||||
}
|
}
|
||||||
public function title()
|
public function title()
|
||||||
{
|
{
|
||||||
$this->load->view('templates/header');
|
$this->load->view('templates/header');
|
||||||
$this->load->view('templates/form_title');
|
$this->load->view('templates/form_title');
|
||||||
$this->load->view('templates/footer');
|
$this->load->view('templates/footer');
|
||||||
|
|
||||||
}
|
}
|
||||||
public function ui_forms()
|
public function ui_forms()
|
||||||
{
|
{
|
||||||
$this->load->view('templates/forms_ui');
|
$this->load->view('templates/forms_ui');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,7 +1,9 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
class New_form extends CI_Controller
|
class New_form extends CI_Controller
|
||||||
{
|
{
|
||||||
public function create_form() {
|
public function create_form()
|
||||||
|
{
|
||||||
if (!$this->session->userdata('logged_in')) {
|
if (!$this->session->userdata('logged_in')) {
|
||||||
// If not logged in, redirect to login page
|
// If not logged in, redirect to login page
|
||||||
redirect('users/login');
|
redirect('users/login');
|
||||||
|
@ -11,7 +13,7 @@ class New_form extends CI_Controller
|
||||||
$this->form_validation->set_rules('title', 'Title', 'required');
|
$this->form_validation->set_rules('title', 'Title', 'required');
|
||||||
$this->form_validation->set_rules('description', 'Description', 'required');
|
$this->form_validation->set_rules('description', 'Description', 'required');
|
||||||
|
|
||||||
if ($this->form_validation->run() === FALSE) {
|
if ($this->form_validation->run() === false) {
|
||||||
$this->load->view('templates/header');
|
$this->load->view('templates/header');
|
||||||
$this->load->view('templates/form_title', $data);
|
$this->load->view('templates/form_title', $data);
|
||||||
$this->load->view('templates/footer');
|
$this->load->view('templates/footer');
|
||||||
|
@ -23,7 +25,4 @@ class New_form extends CI_Controller
|
||||||
redirect('form/view/' . $form_id);
|
redirect('form/view/' . $form_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
|
|
@ -1,22 +1,19 @@
|
||||||
<?php
|
<?php
|
||||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
|
||||||
|
|
||||||
class New_form_controller extends CI_Controller {
|
defined('BASEPATH') or exit('No direct script access allowed');
|
||||||
|
|
||||||
public function submit_form() {
|
class New_form_controller extends CI_Controller
|
||||||
|
{
|
||||||
|
public function submit_form()
|
||||||
|
{
|
||||||
if (!$this->session->userdata('logged_in')) {
|
if (!$this->session->userdata('logged_in')) {
|
||||||
// If not logged in, redirect to login page
|
// If not logged in, redirect to login page
|
||||||
echo json_encode(['status' => 'error', 'message' => 'User not logged in']);
|
echo json_encode(['status' => 'error', 'message' => 'User not logged in']);
|
||||||
return;
|
return;
|
||||||
}
|
}// Decode the formData from the POST request$formData = $this->input->post('formData');
|
||||||
|
// Check if form_id is set in session$formId = $this->session->userdata('form_id');
|
||||||
// Decode the formData from the POST request
|
|
||||||
$formData = $this->input->post('formData');
|
|
||||||
// Check if form_id is set in session
|
|
||||||
$formId = $this->session->userdata('form_id');
|
|
||||||
if ($formId) {
|
if ($formId) {
|
||||||
// Load the model and save form data
|
// Load the model and save form data$this->load->model('new_form_model');
|
||||||
$this->load->model('new_form_model');
|
|
||||||
$saveStatus = $this->new_form_model->save_form_data($formId, $formData);
|
$saveStatus = $this->new_form_model->save_form_data($formId, $formData);
|
||||||
|
|
||||||
if ($saveStatus) {
|
if ($saveStatus) {
|
||||||
|
@ -29,4 +26,3 @@ class New_form_controller extends CI_Controller {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
<?php
|
<?php
|
||||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
|
||||||
|
|
||||||
class Publish_controller extends CI_Controller {
|
defined('BASEPATH') or exit('No direct script access allowed');
|
||||||
|
|
||||||
|
class Publish_controller extends CI_Controller
|
||||||
|
{
|
||||||
// Method to publish a form
|
// Method to publish a form
|
||||||
public function publish_form($form_id) {
|
public function publish_form($form_id)
|
||||||
|
{
|
||||||
// Generate a unique link
|
// Generate a unique link
|
||||||
if (!$this->session->userdata('logged_in')) {
|
if (!$this->session->userdata('logged_in')) {
|
||||||
// If not logged in, redirect to login page
|
// If not logged in, redirect to login page
|
||||||
|
@ -23,7 +25,8 @@ class Publish_controller extends CI_Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Method to list published forms of a user
|
// Method to list published forms of a user
|
||||||
public function list_user_published_forms() {
|
public function list_user_published_forms()
|
||||||
|
{
|
||||||
if (!$this->session->userdata('logged_in')) {
|
if (!$this->session->userdata('logged_in')) {
|
||||||
// If not logged in, redirect to login page
|
// If not logged in, redirect to login page
|
||||||
redirect('users/login');
|
redirect('users/login');
|
||||||
|
@ -39,7 +42,8 @@ class Publish_controller extends CI_Controller {
|
||||||
|
|
||||||
|
|
||||||
// Method to unpublish a form
|
// Method to unpublish a form
|
||||||
public function unpublish_form($form_id) {
|
public function unpublish_form($form_id)
|
||||||
|
{
|
||||||
if (!$this->session->userdata('logged_in')) {
|
if (!$this->session->userdata('logged_in')) {
|
||||||
// If not logged in, redirect to login page
|
// If not logged in, redirect to login page
|
||||||
redirect('users/login');
|
redirect('users/login');
|
||||||
|
@ -51,7 +55,8 @@ class Publish_controller extends CI_Controller {
|
||||||
|
|
||||||
// redirect('published_forms');
|
// redirect('published_forms');
|
||||||
}
|
}
|
||||||
public function toggle_responsive($form_id) {
|
public function toggle_responsive($form_id)
|
||||||
|
{
|
||||||
if (!$this->session->userdata('logged_in')) {
|
if (!$this->session->userdata('logged_in')) {
|
||||||
redirect('users/login');
|
redirect('users/login');
|
||||||
}
|
}
|
||||||
|
@ -76,6 +81,4 @@ class Publish_controller extends CI_Controller {
|
||||||
echo json_encode(['success' => false, 'message' => 'Failed to update']);
|
echo json_encode(['success' => false, 'message' => 'Failed to update']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
<?php
|
<?php
|
||||||
class Response_submit extends CI_Controller {
|
|
||||||
|
|
||||||
public function view($form_id) {
|
class Response_submit extends CI_Controller
|
||||||
|
{
|
||||||
|
public function view($form_id)
|
||||||
|
{
|
||||||
$this->load->model('Response_model');
|
$this->load->model('Response_model');
|
||||||
|
|
||||||
$data['form'] = $this->Response_model->get_form($form_id);
|
$data['form'] = $this->Response_model->get_form($form_id);
|
||||||
|
@ -17,7 +19,8 @@ class Response_submit extends CI_Controller {
|
||||||
redirect('responses/' . $form_id);
|
redirect('responses/' . $form_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function view_responses($form_id) {
|
public function view_responses($form_id)
|
||||||
|
{
|
||||||
$this->load->model('Response_model');
|
$this->load->model('Response_model');
|
||||||
|
|
||||||
$data['form'] = $this->Response_model->get_form($form_id);
|
$data['form'] = $this->Response_model->get_form($form_id);
|
||||||
|
@ -29,7 +32,8 @@ class Response_submit extends CI_Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function submit_form() {
|
public function submit_form()
|
||||||
|
{
|
||||||
$this->load->model('Response_model');
|
$this->load->model('Response_model');
|
||||||
$responses = $this->input->post('responses');
|
$responses = $this->input->post('responses');
|
||||||
$user_id = $this->session->userdata('user_id'); // Assuming user_id is stored in session
|
$user_id = $this->session->userdata('user_id'); // Assuming user_id is stored in session
|
||||||
|
@ -71,7 +75,8 @@ class Response_submit extends CI_Controller {
|
||||||
|
|
||||||
|
|
||||||
// Method to list responses for a form
|
// Method to list responses for a form
|
||||||
public function list_responses($form_id) {
|
public function list_responses($form_id)
|
||||||
|
{
|
||||||
$this->load->model('Response_model');
|
$this->load->model('Response_model');
|
||||||
$data['form'] = $this->Response_model->get_form($form_id);
|
$data['form'] = $this->Response_model->get_form($form_id);
|
||||||
$data['responses'] = $this->Response_model->get_responses($form_id);
|
$data['responses'] = $this->Response_model->get_responses($form_id);
|
||||||
|
@ -82,7 +87,8 @@ class Response_submit extends CI_Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Method to view questions and answers for a specific response
|
// Method to view questions and answers for a specific response
|
||||||
public function viewresponse($response_id) {
|
public function viewresponse($response_id)
|
||||||
|
{
|
||||||
$this->load->model('Response_model');
|
$this->load->model('Response_model');
|
||||||
$data['response'] = $this->Response_model->get_response($response_id);
|
$data['response'] = $this->Response_model->get_response($response_id);
|
||||||
$data['form'] = $this->Response_model->get_form_by_response($response_id); // Get form details
|
$data['form'] = $this->Response_model->get_form_by_response($response_id); // Get form details
|
||||||
|
@ -115,15 +121,52 @@ class Response_submit extends CI_Controller {
|
||||||
$data['form'] = $form;
|
$data['form'] = $form;
|
||||||
$data['summary_data'] = $summary_data;
|
$data['summary_data'] = $summary_data;
|
||||||
|
|
||||||
$this->load->view('templates/header');
|
|
||||||
$this->load->view('Forms/summary', $data);
|
$this->load->view('Forms/summary', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
$this->load->model('response_model');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$data['responses'] = $this->response_model->get_responses_with_details();
|
||||||
|
$this->load->view('templates/header');
|
||||||
|
$this->load->view('allresponse_details_view', $data);
|
||||||
|
$this->load->view('templates/footer');
|
||||||
|
}
|
||||||
|
public function response_summary()
|
||||||
|
{
|
||||||
|
$data['forms'] = $this->Response_model->get_forms();
|
||||||
|
$this->load->view('templates/header');
|
||||||
|
$this->load->view('responses/response_summary', $data);
|
||||||
$this->load->view('templates/footer');
|
$this->load->view('templates/footer');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function response_summary_by_form($form_id)
|
||||||
|
{
|
||||||
|
$responses = $this->Response_model->get_response_summary_by_form($form_id);
|
||||||
|
$data = $this->prepare_data($responses);
|
||||||
|
$data['form_id'] = $form_id;
|
||||||
|
|
||||||
|
$this->load->view('templates/header');
|
||||||
|
$this->load->view('responses/summary', $data);
|
||||||
|
$this->load->view('templates/footer');
|
||||||
|
}
|
||||||
|
|
||||||
|
private function prepare_data($responses)
|
||||||
|
{
|
||||||
|
$data = [];
|
||||||
|
foreach ($responses as $response) {
|
||||||
|
$question_text = $response->question_text;
|
||||||
|
if (!isset($data[$question_text])) {
|
||||||
|
$data[$question_text] = ['type' => $response->question_type, 'answers' => []];
|
||||||
|
}
|
||||||
|
$data[$question_text]['answers'][] = $response->answer_text;
|
||||||
|
}
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
class Users extends CI_Controller
|
class Users extends CI_Controller
|
||||||
{
|
{
|
||||||
//signup user
|
//signup user
|
||||||
|
@ -10,7 +11,7 @@ class Users extends CI_Controller
|
||||||
$this->form_validation->set_rules('password', 'Password', 'required');
|
$this->form_validation->set_rules('password', 'Password', 'required');
|
||||||
$this->form_validation->set_rules('password2', 'Confirm Passsword', 'matches[password]');
|
$this->form_validation->set_rules('password2', 'Confirm Passsword', 'matches[password]');
|
||||||
|
|
||||||
if ($this->form_validation->run() === FALSE) {
|
if ($this->form_validation->run() === false) {
|
||||||
$this->load->view('templates/header');
|
$this->load->view('templates/header');
|
||||||
$this->load->view('users/register', $data);
|
$this->load->view('users/register', $data);
|
||||||
$this->load->view('templates/footer');
|
$this->load->view('templates/footer');
|
||||||
|
@ -25,7 +26,6 @@ class Users extends CI_Controller
|
||||||
$this->session->set_flashdata('user_registered', 'You are now registered and can log in');
|
$this->session->set_flashdata('user_registered', 'You are now registered and can log in');
|
||||||
redirect('start');
|
redirect('start');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ class Users extends CI_Controller
|
||||||
$this->form_validation->set_rules('username', 'Username', 'required');
|
$this->form_validation->set_rules('username', 'Username', 'required');
|
||||||
$this->form_validation->set_rules('password', 'Password', 'required');
|
$this->form_validation->set_rules('password', 'Password', 'required');
|
||||||
|
|
||||||
if ($this->form_validation->run() === FALSE) {
|
if ($this->form_validation->run() === false) {
|
||||||
$this->load->view('templates/header');
|
$this->load->view('templates/header');
|
||||||
$this->load->view('users/login', $data);
|
$this->load->view('users/login', $data);
|
||||||
$this->load->view('templates/footer');
|
$this->load->view('templates/footer');
|
||||||
|
@ -85,7 +85,6 @@ class Users extends CI_Controller
|
||||||
|
|
||||||
$this->session->set_flashdata('user_loggedout', 'You are now logged out');
|
$this->session->set_flashdata('user_loggedout', 'You are now logged out');
|
||||||
redirect('users/login');
|
redirect('users/login');
|
||||||
|
|
||||||
}
|
}
|
||||||
// check if username exists
|
// check if username exists
|
||||||
public function check_username_exists($username)
|
public function check_username_exists($username)
|
||||||
|
@ -122,6 +121,3 @@ class Users extends CI_Controller
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
?>
|
|
|
@ -1,11 +1,9 @@
|
||||||
<!DOCTYPE html>
|
<!doctype html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>403 Forbidden</title>
|
<title>403 Forbidden</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<p>Directory access is forbidden.</p>
|
<p>Directory access is forbidden.</p>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
<!DOCTYPE html>
|
<!doctype html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>403 Forbidden</title>
|
<title>403 Forbidden</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<p>Directory access is forbidden.</p>
|
<p>Directory access is forbidden.</p>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
<!DOCTYPE html>
|
<!doctype html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>403 Forbidden</title>
|
<title>403 Forbidden</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<p>Directory access is forbidden.</p>
|
<p>Directory access is forbidden.</p>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
<!DOCTYPE html>
|
<!doctype html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>403 Forbidden</title>
|
<title>403 Forbidden</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<p>Directory access is forbidden.</p>
|
<p>Directory access is forbidden.</p>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
<!DOCTYPE html>
|
<!doctype html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>403 Forbidden</title>
|
<title>403 Forbidden</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<p>Directory access is forbidden.</p>
|
<p>Directory access is forbidden.</p>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
<!DOCTYPE html>
|
<!doctype html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>403 Forbidden</title>
|
<title>403 Forbidden</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<p>Directory access is forbidden.</p>
|
<p>Directory access is forbidden.</p>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
<!DOCTYPE html>
|
<!doctype html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>403 Forbidden</title>
|
<title>403 Forbidden</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<p>Directory access is forbidden.</p>
|
<p>Directory access is forbidden.</p>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
<!DOCTYPE html>
|
<!doctype html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>403 Forbidden</title>
|
<title>403 Forbidden</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<p>Directory access is forbidden.</p>
|
<p>Directory access is forbidden.</p>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
<!DOCTYPE html>
|
<!doctype html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>403 Forbidden</title>
|
<title>403 Forbidden</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<p>Directory access is forbidden.</p>
|
<p>Directory access is forbidden.</p>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
class Create_model extends CI_Model {
|
|
||||||
|
|
||||||
public function details() {
|
class Create_model extends CI_Model
|
||||||
|
{
|
||||||
|
public function details()
|
||||||
|
{
|
||||||
// Retrieve user_id from session
|
// Retrieve user_id from session
|
||||||
$user_id = $this->session->userdata('user_id');
|
$user_id = $this->session->userdata('user_id');
|
||||||
|
|
||||||
|
@ -22,6 +24,4 @@ class Create_model extends CI_Model {
|
||||||
|
|
||||||
return $formId;
|
return $formId;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
|
|
|
@ -1,9 +1,22 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
defined('BASEPATH') or exit('No direct script access allowed');
|
defined('BASEPATH') or exit('No direct script access allowed');
|
||||||
|
|
||||||
class Form_model extends CI_Model
|
class Form_model extends CI_Model
|
||||||
{
|
{
|
||||||
|
public function get_published_value($form_id)
|
||||||
|
{
|
||||||
|
$this->db->select('is_published');
|
||||||
|
$this->db->from('forms'); // Adjust 'forms' to your table name
|
||||||
|
$this->db->where('id', $form_id);
|
||||||
|
$query = $this->db->get();
|
||||||
|
|
||||||
|
if ($query->num_rows() > 0) {
|
||||||
|
return $query->row()->is_published;
|
||||||
|
} else {
|
||||||
|
return null; // or 0 or another default value if you prefer
|
||||||
|
}
|
||||||
|
}
|
||||||
// Function to get form details by ID
|
// Function to get form details by ID
|
||||||
public function get_form_by_id($form_id)
|
public function get_form_by_id($form_id)
|
||||||
{
|
{
|
||||||
|
@ -13,14 +26,16 @@ class Form_model extends CI_Model
|
||||||
return $query->row();
|
return $query->row();
|
||||||
}
|
}
|
||||||
// Get the total number of forms
|
// Get the total number of forms
|
||||||
public function get_total_forms($user_id) {
|
public function get_total_forms($user_id)
|
||||||
|
{
|
||||||
// Ensure user_id is passed as a parameter and used in the query
|
// Ensure user_id is passed as a parameter and used in the query
|
||||||
$this->db->where('user_id', $user_id);
|
$this->db->where('user_id', $user_id);
|
||||||
return $this->db->count_all_results('forms'); // Use count_all_results to ensure WHERE conditions are applied
|
return $this->db->count_all_results('forms'); // Use count_all_results to ensure WHERE conditions are applied
|
||||||
}
|
}
|
||||||
|
|
||||||
// Function to count published forms
|
// Function to count published forms
|
||||||
public function get_published_forms($user_id) {
|
public function get_published_forms($user_id)
|
||||||
|
{
|
||||||
// Ensure user_id and is_published are passed as parameters and used in the query
|
// Ensure user_id and is_published are passed as parameters and used in the query
|
||||||
$this->db->where('user_id', $user_id);
|
$this->db->where('user_id', $user_id);
|
||||||
$this->db->where('is_published', 1);
|
$this->db->where('is_published', 1);
|
||||||
|
@ -65,7 +80,7 @@ class Form_model extends CI_Model
|
||||||
|
|
||||||
$this->db->trans_complete();
|
$this->db->trans_complete();
|
||||||
|
|
||||||
if ($this->db->trans_status() === FALSE) {
|
if ($this->db->trans_status() === false) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
|
||||||
|
|
||||||
class Frontend_model extends CI_Model {
|
defined('BASEPATH') or exit('No direct script access allowed');
|
||||||
|
|
||||||
|
class Frontend_model extends CI_Model
|
||||||
|
{
|
||||||
public function getforms()
|
public function getforms()
|
||||||
{
|
{
|
||||||
// Get the user_id from session
|
// Get the user_id from session
|
||||||
|
@ -21,7 +23,8 @@ class Frontend_model extends CI_Model {
|
||||||
return $query->result(); // Return the result as an array of objects
|
return $query->result(); // Return the result as an array of objects
|
||||||
}
|
}
|
||||||
|
|
||||||
public function deleteForm($id){
|
public function deleteForm($id)
|
||||||
|
{
|
||||||
return $this->db->delete('forms', ['id' => $id]);
|
return $this->db->delete('forms', ['id' => $id]);
|
||||||
}
|
}
|
||||||
public function getFormById($form_id)
|
public function getFormById($form_id)
|
||||||
|
@ -29,13 +32,12 @@ class Frontend_model extends CI_Model {
|
||||||
$query = $this->db->get_where('forms', ['id' => $form_id]);
|
$query = $this->db->get_where('forms', ['id' => $form_id]);
|
||||||
return $query->row_array();
|
return $query->row_array();
|
||||||
}
|
}
|
||||||
public function getforms_draft($user_id) {
|
public function getforms_draft($user_id)
|
||||||
|
{
|
||||||
$this->db->where('is_published', 0);
|
$this->db->where('is_published', 0);
|
||||||
$this->db->where('user_id', $user_id);
|
$this->db->where('user_id', $user_id);
|
||||||
$this->db->order_by('created_at', 'DESC');
|
$this->db->order_by('created_at', 'DESC');
|
||||||
$query = $this->db->get('forms');
|
$query = $this->db->get('forms');
|
||||||
return $query->result();
|
return $query->result();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,7 +1,9 @@
|
||||||
<?php
|
<?php
|
||||||
class New_form_model extends CI_Model {
|
|
||||||
|
|
||||||
public function save_form_data($formId, $formData) {
|
class New_form_model extends CI_Model
|
||||||
|
{
|
||||||
|
public function save_form_data($formId, $formData)
|
||||||
|
{
|
||||||
if (!$formId || !isset($formData['questions'])) {
|
if (!$formId || !isset($formData['questions'])) {
|
||||||
return false; // Handle error if formId is not valid or questions are missing
|
return false; // Handle error if formId is not valid or questions are missing
|
||||||
}
|
}
|
||||||
|
@ -36,7 +38,4 @@ class New_form_model extends CI_Model {
|
||||||
|
|
||||||
return true; // Return true indicating success
|
return true; // Return true indicating success
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
|
|
|
@ -1,22 +1,25 @@
|
||||||
<?php
|
<?php
|
||||||
class preview_model extends CI_Model {
|
|
||||||
|
|
||||||
public function get_form($form_id) {
|
class preview_model extends CI_Model
|
||||||
|
{
|
||||||
|
public function get_form($form_id)
|
||||||
|
{
|
||||||
$this->db->where('id', $form_id);
|
$this->db->where('id', $form_id);
|
||||||
$query = $this->db->get('forms');
|
$query = $this->db->get('forms');
|
||||||
return $query->row();
|
return $query->row();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function get_questions($form_id) {
|
public function get_questions($form_id)
|
||||||
|
{
|
||||||
$this->db->where('form_id', $form_id);
|
$this->db->where('form_id', $form_id);
|
||||||
$query = $this->db->get('questions');
|
$query = $this->db->get('questions');
|
||||||
return $query->result(); // Ensure this returns objects with the 'is_required' field
|
return $query->result(); // Ensure this returns objects with the 'is_required' field
|
||||||
}
|
}
|
||||||
|
|
||||||
public function get_options($question_id) {
|
public function get_options($question_id)
|
||||||
|
{
|
||||||
$this->db->where('question_id', $question_id);
|
$this->db->where('question_id', $question_id);
|
||||||
$query = $this->db->get('options');
|
$query = $this->db->get('options');
|
||||||
return $query->result(); // Ensure this returns the options related to the question
|
return $query->result(); // Ensure this returns the options related to the question
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,19 +1,21 @@
|
||||||
<?php
|
<?php
|
||||||
class Publish_model extends CI_Model {
|
|
||||||
|
|
||||||
|
class Publish_model extends CI_Model
|
||||||
|
{
|
||||||
// Method to update form details including is_published status
|
// Method to update form details including is_published status
|
||||||
public function update_form($form_id, $data) {
|
public function update_form($form_id, $data)
|
||||||
|
{
|
||||||
$this->db->where('id', $form_id);
|
$this->db->where('id', $form_id);
|
||||||
return $this->db->update('forms', $data);
|
return $this->db->update('forms', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Method to retrieve published forms by user
|
// Method to retrieve published forms by user
|
||||||
public function get_published_forms_by_user($user_id) {
|
public function get_published_forms_by_user($user_id)
|
||||||
|
{
|
||||||
$this->db->where('user_id', $user_id);
|
$this->db->where('user_id', $user_id);
|
||||||
$this->db->where('is_published', 1);
|
$this->db->where('is_published', 1);
|
||||||
$this->db->order_by('id', 'DESC'); // Order by id column, most recent first
|
$this->db->order_by('id', 'DESC'); // Order by id column, most recent first
|
||||||
$query = $this->db->get('forms');
|
$query = $this->db->get('forms');
|
||||||
return $query->result();
|
return $query->result();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,12 +1,15 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
class Response_model extends CI_Model
|
class Response_model extends CI_Model
|
||||||
{
|
{
|
||||||
public function __construct() {
|
public function __construct()
|
||||||
|
{
|
||||||
$this->load->database();
|
$this->load->database();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the total number of responses
|
// Get the total number of responses
|
||||||
public function get_total_responses($user_id) {
|
public function get_total_responses($user_id)
|
||||||
|
{
|
||||||
// Join the responses table with the forms table
|
// Join the responses table with the forms table
|
||||||
$this->db->select('responses.id');
|
$this->db->select('responses.id');
|
||||||
$this->db->from('responses');
|
$this->db->from('responses');
|
||||||
|
@ -168,5 +171,58 @@ class Response_model extends CI_Model
|
||||||
|
|
||||||
return $summary_data;
|
return $summary_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function get_responses_with_details()
|
||||||
|
{
|
||||||
|
// Fetch responses with form title, submission time, and user email
|
||||||
|
$this->db->select('responses.id as response_id, forms.title as form_title, responses.submitted_at, users.email');
|
||||||
|
$this->db->from('responses');
|
||||||
|
$this->db->join('forms', 'responses.form_id = forms.id');
|
||||||
|
$this->db->join('users', 'responses.user_id = users.id');
|
||||||
|
$this->db->order_by('responses.submitted_at', 'DESC');
|
||||||
|
$responses_query = $this->db->get();
|
||||||
|
$responses = $responses_query->result();
|
||||||
|
|
||||||
|
$response_details = [];
|
||||||
|
foreach ($responses as $response) {
|
||||||
|
// Fetch questions and answers for each response
|
||||||
|
$this->db->select('questions.text, response_answers.answered_text');
|
||||||
|
$this->db->from('response_answers');
|
||||||
|
$this->db->join('questions', 'response_answers.question_id = questions.id');
|
||||||
|
$this->db->where('response_answers.response_id', $response->response_id);
|
||||||
|
$questions_query = $this->db->get();
|
||||||
|
$questions_and_answers = $questions_query->result();
|
||||||
|
|
||||||
|
if (!isset($response_details[$response->form_title])) {
|
||||||
|
$response_details[$response->form_title] = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$response_details[$response->form_title][] = [
|
||||||
|
'submitted_at' => $response->submitted_at,
|
||||||
|
'email' => $response->email,
|
||||||
|
'questions_and_answers' => $questions_and_answers
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $response_details;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function get_response_summary_by_form($form_id)
|
||||||
|
{
|
||||||
|
$this->db->select('questions.text as question_text, answers.text as answer_text, questions.type as question_type');
|
||||||
|
$this->db->from('responses');
|
||||||
|
$this->db->join('answers', 'responses.id = answers.response_id');
|
||||||
|
$this->db->join('questions', 'answers.question_id = questions.id');
|
||||||
|
$this->db->where('responses.form_id', $form_id);
|
||||||
|
$query = $this->db->get();
|
||||||
|
return $query->result();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function get_forms()
|
||||||
|
{
|
||||||
|
$this->db->select('id, title');
|
||||||
|
$this->db->from('forms');
|
||||||
|
$query = $this->db->get();
|
||||||
|
return $query->result();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
class Updation_model extends CI_Model
|
class Updation_model extends CI_Model
|
||||||
{
|
{
|
||||||
|
|
||||||
public function get_form($form_id)
|
public function get_form($form_id)
|
||||||
{
|
{
|
||||||
$this->db->where('id', $form_id);
|
$this->db->where('id', $form_id);
|
||||||
|
@ -9,6 +9,7 @@ class Updation_model extends CI_Model
|
||||||
return $query->row_array();
|
return $query->row_array();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function get_questions($form_id)
|
public function get_questions($form_id)
|
||||||
{
|
{
|
||||||
$this->db->where('form_id', $form_id);
|
$this->db->where('form_id', $form_id);
|
||||||
|
@ -90,8 +91,4 @@ class Updation_model extends CI_Model
|
||||||
$this->db->delete('options');
|
$this->db->delete('options');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
?>
|
|
|
@ -1,6 +1,9 @@
|
||||||
<?php
|
<?php
|
||||||
class User_model extends CI_Model{
|
|
||||||
public function register($enc_password){
|
class User_model extends CI_Model
|
||||||
|
{
|
||||||
|
public function register($enc_password)
|
||||||
|
{
|
||||||
$data = array(
|
$data = array(
|
||||||
'email' => $this->input->post('email'),
|
'email' => $this->input->post('email'),
|
||||||
'username' => $this->input->post('username'),
|
'username' => $this->input->post('username'),
|
||||||
|
@ -8,42 +11,38 @@ $data = array(
|
||||||
);
|
);
|
||||||
|
|
||||||
return $this->db->insert('users', $data);
|
return $this->db->insert('users', $data);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function login($username,$password){
|
public function login($username, $password)
|
||||||
|
{
|
||||||
$this->db->where('username', $username);
|
$this->db->where('username', $username);
|
||||||
$this->db->where('password', $password);
|
$this->db->where('password', $password);
|
||||||
|
|
||||||
$result = $this->db->get('users');
|
$result = $this->db->get('users');
|
||||||
if ($result->num_rows() == 1) {
|
if ($result->num_rows() == 1) {
|
||||||
return $result->row(0)->id;
|
return $result->row(0)->id;
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function check_username_exists($username){
|
public function check_username_exists($username)
|
||||||
|
{
|
||||||
$query = $this->db->get_where('users', array('username' => $username));
|
$query = $this->db->get_where('users', array('username' => $username));
|
||||||
if (empty($query->row_array())) {
|
if (empty($query->row_array())) {
|
||||||
return true;
|
return true;
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function check_email_exists($email){
|
public function check_email_exists($email)
|
||||||
|
{
|
||||||
$query = $this->db->get_where('users', array('email' => $email));
|
$query = $this->db->get_where('users', array('email' => $email));
|
||||||
if (empty($query->row_array())) {
|
if (empty($query->row_array())) {
|
||||||
return true;
|
return true;
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
<!DOCTYPE html>
|
<!doctype html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>403 Forbidden</title>
|
<title>403 Forbidden</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<p>Directory access is forbidden.</p>
|
<p>Directory access is forbidden.</p>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
<!DOCTYPE html>
|
<!doctype html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>403 Forbidden</title>
|
<title>403 Forbidden</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<p>Directory access is forbidden.</p>
|
<p>Directory access is forbidden.</p>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
<table id="basetable1" class="table table-bordered">
|
<table id="basetable1" class="table table-bordered">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Drafts</th>
|
<th>Serial No.</th>
|
||||||
<th>Title</th>
|
<th>Title</th>
|
||||||
<th>Created On</th>
|
<th>Created On</th>
|
||||||
<th>Edit</th>
|
<th>Edit</th>
|
||||||
|
|
|
@ -1,12 +1,18 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<!-- Other head elements -->
|
<!-- Other head elements -->
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>Form List</title>
|
<title>Form List</title>
|
||||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
|
||||||
|
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
|
||||||
|
|
||||||
<!-- <link rel="stylesheet" href="styles.css"> -->
|
<!-- <link rel="stylesheet" href="styles.css"> -->
|
||||||
|
|
||||||
|
<link rel="stylesheet" href=" < ?php echo base_url(); ?>assets/css/header_styles.css">
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
/* CSS styles */
|
/* CSS styles */
|
||||||
.title-column {
|
.title-column {
|
||||||
|
@ -35,15 +41,20 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.card-title {
|
.card-title {
|
||||||
color: rgb(103, 58, 183); /* Match the color theme */
|
color: rgb(103, 58, 183);
|
||||||
|
/* Match the color theme */
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
font-size: 20px; /* Increase the font size of the title */
|
font-size: 20px;
|
||||||
font-weight: bold; /* Make the title bold */
|
/* Increase the font size of the title */
|
||||||
|
font-weight: bold;
|
||||||
|
/* Make the title bold */
|
||||||
}
|
}
|
||||||
|
|
||||||
.card-text {
|
.card-text {
|
||||||
font-size: 28px; /* Increase the font size */
|
font-size: 28px;
|
||||||
font-weight: bold; /* Make the text bold */
|
/* Increase the font size */
|
||||||
|
font-weight: bold;
|
||||||
|
/* Make the text bold */
|
||||||
}
|
}
|
||||||
|
|
||||||
.card-text.green {
|
.card-text.green {
|
||||||
|
@ -65,8 +76,45 @@
|
||||||
.card-text.purple {
|
.card-text.purple {
|
||||||
color: #6f42c1;
|
color: #6f42c1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.btn-icon {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
width: 25px;
|
||||||
|
height: 25px;
|
||||||
|
/* background-color: rgb(103, 58, 183); */
|
||||||
|
border-radius: 4px;
|
||||||
|
color: white;
|
||||||
|
text-decoration: none;
|
||||||
|
font-size: 16px;
|
||||||
|
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
||||||
|
transition: background-color 0.3s, transform 0.3s, box-shadow 0.3s;
|
||||||
|
margin: 0 5px;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-icon:hover {
|
||||||
|
background-color: rgba(255, 255, 255, 0.2);
|
||||||
|
transform: scale(1.1);
|
||||||
|
box-shadow: 0 6px 8px rgba(0, 0, 0, 0.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-icon.disabled {
|
||||||
|
background-color: #ccc;
|
||||||
|
color: #888;
|
||||||
|
cursor: not-allowed;
|
||||||
|
box-shadow: none;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-icon.disabled:hover {
|
||||||
|
background-color: #ccc;
|
||||||
|
transform: none;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
@ -74,7 +122,10 @@
|
||||||
<div class="card card-stats">
|
<div class="card card-stats">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<h5 class="card-title">Total Forms Created</h5>
|
<h5 class="card-title">Total Forms Created</h5>
|
||||||
<p class="card-text" id="total-forms"><?php echo $total_forms; ?></p>
|
<p class="card-text" id="total-forms">
|
||||||
|
<?php echo $total_forms; ?>
|
||||||
|
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -82,7 +133,8 @@
|
||||||
<div class="card card-stats">
|
<div class="card card-stats">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<h5 class="card-title">Published Forms</h5>
|
<h5 class="card-title">Published Forms</h5>
|
||||||
<p class="card-text" id="published-forms"><?php echo $published_forms; ?></p>
|
<p class="card-text" id="published-forms">
|
||||||
|
<?php echo $published_forms; ?></p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -90,7 +142,8 @@
|
||||||
<div class="card card-stats">
|
<div class="card card-stats">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<h5 class="card-title">Responses Submitted</h5>
|
<h5 class="card-title">Responses Submitted</h5>
|
||||||
<p class="card-text" id="total-responses"><?php echo $total_responses; ?></p>
|
<p class="card-text" id="total-responses">
|
||||||
|
<?php echo $total_responses; ?></p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -113,33 +166,68 @@
|
||||||
<table id="basetable1" class="table table-bordered">
|
<table id="basetable1" class="table table-bordered">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Forms</th>
|
<th>Serial No.</th>
|
||||||
<th>Title</th>
|
<th>Title</th>
|
||||||
<th>Description</th>
|
<th>Description</th>
|
||||||
<th>Created On</th>
|
<th>Created On</th>
|
||||||
<th>Status</th>
|
<th>Status</th>
|
||||||
|
<th>Actions</th>
|
||||||
<th>Responses</th>
|
<th>Responses</th>
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<?php
|
<?php
|
||||||
$serialNumber = 1; // Initialize the counter variable
|
$serialNumber = 1; // Initialize the counter variable
|
||||||
foreach ($forms as $row) : ?>
|
foreach ($forms as $row) : ?>
|
||||||
<tr class="<?php echo ($row->is_published ? '' : 'draft-row'); ?>">
|
<tr
|
||||||
<td><?php echo $serialNumber++; ?></td>
|
class="<?php echo($row->is_published ? '' : 'draft-row'); ?>">
|
||||||
<td class="title-column">
|
<td><?php echo $serialNumber++; ?>
|
||||||
<a href="<?php echo base_url('publish/' . $row->id); ?>"><?php echo $row->title; ?></a>
|
|
||||||
</td>
|
</td>
|
||||||
<td><?php echo $row->description; ?></td>
|
<td class="title-column">
|
||||||
<td><?php echo $row->created_at; ?></td>
|
<a
|
||||||
<td style="color: <?php echo ($row->is_published ? '#006400' : 'red'); ?>;">
|
href="<?php echo base_url('publish/' . $row->id); ?>"><?php echo $row->title; ?></a>
|
||||||
|
</td>
|
||||||
|
<td><?php echo $row->description; ?>
|
||||||
|
</td>
|
||||||
|
<td><?php echo $row->created_at; ?>
|
||||||
|
</td>
|
||||||
|
<td
|
||||||
|
style="color: <?php echo($row->is_published ? '#006400' : 'red'); ?>;">
|
||||||
<?php echo($row->is_published ? 'Published' : 'Draft'); ?>
|
<?php echo($row->is_published ? 'Published' : 'Draft'); ?>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="<?php echo base_url('responses/' . $row->id); ?>">
|
<?php if ($row->is_published == 0) : ?>
|
||||||
|
<!-- Buttons are enabled -->
|
||||||
|
<a href="<?php echo base_url('edit/' . $row->id); ?>"
|
||||||
|
class="btn-icon" title="Edit">
|
||||||
|
<i class="fas fa-edit"></i> <!-- For Font Awesome -->
|
||||||
|
</a>
|
||||||
|
<a href="<?php echo base_url('forms/delete/' . $row->id); ?>"
|
||||||
|
class="btn-icon" title="Delete">
|
||||||
|
<i class="fas fa-trash"></i> <!-- For Font Awesome -->
|
||||||
|
</a>
|
||||||
|
<?php else : ?>
|
||||||
|
<!-- Buttons are disabled -->
|
||||||
|
<span class="btn-icon disabled" title="Edit">
|
||||||
|
<i class="fas fa-edit"></i> <!-- For Font Awesome -->
|
||||||
|
</span>
|
||||||
|
<a href="<?php echo base_url('forms/delete/' . $row->id); ?>"
|
||||||
|
class="btn-icon" title="Delete">
|
||||||
|
<i class="fas fa-trash"></i> <!-- For Font Awesome -->
|
||||||
|
</a>
|
||||||
|
<?php endif; ?>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<td>
|
||||||
|
<a
|
||||||
|
href="<?php echo base_url('responses/' . $row->id); ?>">
|
||||||
<i class="fas fa-eye"></i> <!-- Eye icon -->
|
<i class="fas fa-eye"></i> <!-- Eye icon -->
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
@ -149,3 +237,8 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<script>
|
||||||
|
document.getElementById('total-responses').parentNode.addEventListener('click', function() {
|
||||||
|
window.location.href = 'total_responses';
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
|
@ -0,0 +1,135 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Response Details</title>
|
||||||
|
<link rel="stylesheet" href="https://bootswatch.com/3/flatly/bootstrap.min.css">
|
||||||
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/datatables/1.11.5/css/jquery.dataTables.min.css">
|
||||||
|
<style>
|
||||||
|
.question-label {
|
||||||
|
display: inline;
|
||||||
|
margin-bottom: 11px;
|
||||||
|
padding: 0;
|
||||||
|
border: none;
|
||||||
|
background: none;
|
||||||
|
}
|
||||||
|
.form-section {
|
||||||
|
border: 2px solid #ddd; /* Thicker border */
|
||||||
|
border-radius: 5px;
|
||||||
|
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2); /* Box shadow */
|
||||||
|
padding: 15px;
|
||||||
|
background: #fff;
|
||||||
|
margin-bottom: 15px;
|
||||||
|
transition: transform 0.3s, box-shadow 0.3s;
|
||||||
|
}
|
||||||
|
.form-section:hover {
|
||||||
|
transform: scale(1.02); /* Pop-out effect */
|
||||||
|
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3); /* Enhanced box shadow on hover */
|
||||||
|
}
|
||||||
|
#scroll-up-btn {
|
||||||
|
position: fixed;
|
||||||
|
bottom: 20px;
|
||||||
|
right: 20px;
|
||||||
|
display: none;
|
||||||
|
z-index: 9999; /* Ensure it's above other content */
|
||||||
|
background-color: #007bff; /* Button color */
|
||||||
|
color: #fff; /* Text color */
|
||||||
|
border: none;
|
||||||
|
border-radius: 50%; /* Rounded button */
|
||||||
|
width: 50px;
|
||||||
|
height: 50px;
|
||||||
|
text-align: center;
|
||||||
|
line-height: 50px; /* Center text vertically */
|
||||||
|
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3); /* Box shadow */
|
||||||
|
font-size: 20px; /* Font size */
|
||||||
|
}
|
||||||
|
#scroll-up-btn:hover {
|
||||||
|
background-color: #0056b3; /* Darker color on hover */
|
||||||
|
}
|
||||||
|
.dataTables_wrapper .dataTables_paginate .paginate_button {
|
||||||
|
padding: 5px 10px;
|
||||||
|
margin: 0 2px;
|
||||||
|
border: 2px solid #007bff; /* Thicker border for pagination */
|
||||||
|
border-radius: 3px;
|
||||||
|
background-color: #f8f9fa;
|
||||||
|
}
|
||||||
|
.dataTables_wrapper .dataTables_paginate .paginate_button.current,
|
||||||
|
.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
|
||||||
|
background-color: #007bff;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
table.dataTable thead th {
|
||||||
|
border-bottom: 2px solid #007bff; /* Thicker border for table header */
|
||||||
|
}
|
||||||
|
table.dataTable tbody td, table.dataTable thead th {
|
||||||
|
border: 2px solid #007bff; /* Thicker border for table cells */
|
||||||
|
}
|
||||||
|
.response-count {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div class="container">
|
||||||
|
<?php foreach ($responses as $form_title => $form_responses) : ?>
|
||||||
|
<div class="form-section">
|
||||||
|
<h2><?php echo $form_title; ?></h2>
|
||||||
|
<p class="response-count">Number of responses: <span><?php echo count($form_responses); ?></span></p> <!-- Display response count -->
|
||||||
|
<table class="table table-bordered" id="responses-table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Question</th>
|
||||||
|
<th>Answers</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php
|
||||||
|
$all_questions = [];
|
||||||
|
foreach ($form_responses as $response) {
|
||||||
|
foreach ($response['questions_and_answers'] as $qa) {
|
||||||
|
if (!isset($all_questions[$qa->text])) {
|
||||||
|
$all_questions[$qa->text] = [];
|
||||||
|
}
|
||||||
|
$all_questions[$qa->text][] = $qa->answered_text;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<?php foreach ($all_questions as $question => $answers) : ?>
|
||||||
|
<tr>
|
||||||
|
<td><?php echo $question; ?></td>
|
||||||
|
<td><?php echo implode(", ", $answers); ?></td>
|
||||||
|
</tr>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button id="scroll-up-btn" class="btn">↑</button>
|
||||||
|
|
||||||
|
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||||
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/datatables/1.11.5/js/jquery.dataTables.min.js"></script>
|
||||||
|
<script>
|
||||||
|
$(document).ready(function() {
|
||||||
|
$('#responses-table').DataTable();
|
||||||
|
|
||||||
|
var scrollUpBtn = document.getElementById('scroll-up-btn');
|
||||||
|
|
||||||
|
window.addEventListener('scroll', function() {
|
||||||
|
if (window.scrollY > 200) {
|
||||||
|
scrollUpBtn.style.display = 'block';
|
||||||
|
} else {
|
||||||
|
scrollUpBtn.style.display = 'none';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
scrollUpBtn.addEventListener('click', function() {
|
||||||
|
window.scrollTo({ top: 0, behavior: 'smooth' });
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -34,7 +34,6 @@
|
||||||
border: 1px solid #dce4ec;
|
border: 1px solid #dce4ec;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
<!-- Navbar -->
|
<!-- Navbar -->
|
||||||
<nav class="navbar navbar-custom">
|
<nav class="navbar navbar-custom">
|
||||||
|
@ -49,7 +48,6 @@
|
||||||
<ul class="nav navbar-nav">
|
<ul class="nav navbar-nav">
|
||||||
<?php if ($this->session->userdata('logged_in')) : ?>
|
<?php if ($this->session->userdata('logged_in')) : ?>
|
||||||
<li><a href="<?php echo base_url(); ?>published_forms">Published Forms</a></li>
|
<li><a href="<?php echo base_url(); ?>published_forms">Published Forms</a></li>
|
||||||
<li><a href="<?php echo base_url(); ?>drafts">Drafts</a></li>
|
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</ul>
|
</ul>
|
||||||
<ul class="nav navbar-nav navbar-right">
|
<ul class="nav navbar-nav navbar-right">
|
||||||
|
@ -57,6 +55,7 @@
|
||||||
<li><a href="<?php echo base_url(); ?>users/login">Login</a></li>
|
<li><a href="<?php echo base_url(); ?>users/login">Login</a></li>
|
||||||
<li><a href="<?php echo base_url(); ?>users/register">Register</a></li>
|
<li><a href="<?php echo base_url(); ?>users/register">Register</a></li>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
<?php if ($this->session->userdata('logged_in')) : ?>
|
<?php if ($this->session->userdata('logged_in')) : ?>
|
||||||
<li><a href="<?php echo base_url(); ?>homepage/title">Create Form</a></li>
|
<li><a href="<?php echo base_url(); ?>homepage/title">Create Form</a></li>
|
||||||
<li><a href="<?php echo base_url(); ?>users/logout">Logout</a></li>
|
<li><a href="<?php echo base_url(); ?>users/logout">Logout</a></li>
|
||||||
|
@ -160,6 +159,7 @@
|
||||||
positionAddSectionButton();
|
positionAddSectionButton();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
function positionAddSectionButton() {
|
function positionAddSectionButton() {
|
||||||
if (activeSection) {
|
if (activeSection) {
|
||||||
var position = activeSection.position();
|
var position = activeSection.position();
|
||||||
|
@ -330,7 +330,9 @@
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: base_url + 'Form_controller/update_form',
|
url: base_url + 'Form_controller/update_form',
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
data: { formData: formData },
|
data: {
|
||||||
|
formData: formData
|
||||||
|
},
|
||||||
dataType: 'JSON',
|
dataType: 'JSON',
|
||||||
success: function(response) {
|
success: function(response) {
|
||||||
if (response.status === 'success') {
|
if (response.status === 'success') {
|
||||||
|
@ -395,18 +397,29 @@
|
||||||
function validateFormData(formData) {
|
function validateFormData(formData) {
|
||||||
for (let question of formData.questions) {
|
for (let question of formData.questions) {
|
||||||
if (!question.text.trim()) {
|
if (!question.text.trim()) {
|
||||||
return { isValid: false, message: 'All questions must have text.' };
|
return {
|
||||||
|
isValid: false,
|
||||||
|
message: 'All questions must have text.'
|
||||||
|
};
|
||||||
}
|
}
|
||||||
if ((question.type === 'multiple-choice' || question.type === 'checkboxes' || question.type === 'dropdown') && question.options.length === 0) {
|
if ((question.type === 'multiple-choice' || question.type === 'checkboxes' || question.type === 'dropdown') && question.options.length === 0) {
|
||||||
return { isValid: false, message: 'All options-based questions must have at least one option.' };
|
return {
|
||||||
|
isValid: false,
|
||||||
|
message: 'All options-based questions must have at least one option.'
|
||||||
|
};
|
||||||
}
|
}
|
||||||
for (let option of question.options) {
|
for (let option of question.options) {
|
||||||
if (!option.trim()) {
|
if (!option.trim()) {
|
||||||
return { isValid: false, message: 'All options must have text.' };
|
return {
|
||||||
|
isValid: false,
|
||||||
|
message: 'All options must have text.'
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return { isValid: true };
|
return {
|
||||||
|
isValid: true
|
||||||
|
};
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
|
||||||
|
defined('BASEPATH') or exit('No direct script access allowed');
|
||||||
|
|
||||||
echo "\nERROR: ",
|
echo "\nERROR: ",
|
||||||
$heading,
|
$heading,
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
|
||||||
|
defined('BASEPATH') or exit('No direct script access allowed');
|
||||||
|
|
||||||
echo "\nDatabase error: ",
|
echo "\nDatabase error: ",
|
||||||
$heading,
|
$heading,
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<?php defined('BASEPATH') OR exit('No direct script access allowed'); ?>
|
<?php defined('BASEPATH') or exit('No direct script access allowed'); ?>
|
||||||
|
|
||||||
An uncaught Exception was encountered
|
An uncaught Exception was encountered
|
||||||
|
|
||||||
|
@ -7,8 +7,7 @@ Message: <?php echo $message, "\n"; ?>
|
||||||
Filename: <?php echo $exception->getFile(), "\n"; ?>
|
Filename: <?php echo $exception->getFile(), "\n"; ?>
|
||||||
Line Number: <?php echo $exception->getLine(); ?>
|
Line Number: <?php echo $exception->getLine(); ?>
|
||||||
|
|
||||||
<?php if (defined('SHOW_DEBUG_BACKTRACE') && SHOW_DEBUG_BACKTRACE === TRUE): ?>
|
<?php if (defined('SHOW_DEBUG_BACKTRACE') && SHOW_DEBUG_BACKTRACE === true) : ?>
|
||||||
|
|
||||||
Backtrace:
|
Backtrace:
|
||||||
<?php foreach ($exception->getTrace() as $error) : ?>
|
<?php foreach ($exception->getTrace() as $error) : ?>
|
||||||
<?php if (isset($error['file']) && strpos($error['file'], realpath(BASEPATH)) !== 0) : ?>
|
<?php if (isset($error['file']) && strpos($error['file'], realpath(BASEPATH)) !== 0) : ?>
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
|
||||||
|
defined('BASEPATH') or exit('No direct script access allowed');
|
||||||
|
|
||||||
echo "\nERROR: ",
|
echo "\nERROR: ",
|
||||||
$heading,
|
$heading,
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<?php defined('BASEPATH') OR exit('No direct script access allowed'); ?>
|
<?php defined('BASEPATH') or exit('No direct script access allowed'); ?>
|
||||||
|
|
||||||
A PHP Error was encountered
|
A PHP Error was encountered
|
||||||
|
|
||||||
|
@ -7,8 +7,7 @@ Message: <?php echo $message, "\n"; ?>
|
||||||
Filename: <?php echo $filepath, "\n"; ?>
|
Filename: <?php echo $filepath, "\n"; ?>
|
||||||
Line Number: <?php echo $line; ?>
|
Line Number: <?php echo $line; ?>
|
||||||
|
|
||||||
<?php if (defined('SHOW_DEBUG_BACKTRACE') && SHOW_DEBUG_BACKTRACE === TRUE): ?>
|
<?php if (defined('SHOW_DEBUG_BACKTRACE') && SHOW_DEBUG_BACKTRACE === true) : ?>
|
||||||
|
|
||||||
Backtrace:
|
Backtrace:
|
||||||
<?php foreach (debug_backtrace() as $error) : ?>
|
<?php foreach (debug_backtrace() as $error) : ?>
|
||||||
<?php if (isset($error['file']) && strpos($error['file'], realpath(BASEPATH)) !== 0) : ?>
|
<?php if (isset($error['file']) && strpos($error['file'], realpath(BASEPATH)) !== 0) : ?>
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
<!DOCTYPE html>
|
<!doctype html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>403 Forbidden</title>
|
<title>403 Forbidden</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<p>Directory access is forbidden.</p>
|
<p>Directory access is forbidden.</p>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
defined('BASEPATH') or exit('No direct script access allowed');
|
||||||
?><!DOCTYPE html>
|
?><!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
defined('BASEPATH') or exit('No direct script access allowed');
|
||||||
?><!DOCTYPE html>
|
?><!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
defined('BASEPATH') or exit('No direct script access allowed');
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<div style="border:1px solid #990000;padding-left:20px;margin:0 0 10px 0;">
|
<div style="border:1px solid #990000;padding-left:20px;margin:0 0 10px 0;">
|
||||||
|
@ -11,13 +11,10 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||||
<p>Filename: <?php echo $exception->getFile(); ?></p>
|
<p>Filename: <?php echo $exception->getFile(); ?></p>
|
||||||
<p>Line Number: <?php echo $exception->getLine(); ?></p>
|
<p>Line Number: <?php echo $exception->getLine(); ?></p>
|
||||||
|
|
||||||
<?php if (defined('SHOW_DEBUG_BACKTRACE') && SHOW_DEBUG_BACKTRACE === TRUE): ?>
|
<?php if (defined('SHOW_DEBUG_BACKTRACE') && SHOW_DEBUG_BACKTRACE === true) : ?>
|
||||||
|
|
||||||
<p>Backtrace:</p>
|
<p>Backtrace:</p>
|
||||||
<?php foreach ($exception->getTrace() as $error) : ?>
|
<?php foreach ($exception->getTrace() as $error) : ?>
|
||||||
|
|
||||||
<?php if (isset($error['file']) && strpos($error['file'], realpath(BASEPATH)) !== 0) : ?>
|
<?php if (isset($error['file']) && strpos($error['file'], realpath(BASEPATH)) !== 0) : ?>
|
||||||
|
|
||||||
<p style="margin-left:10px">
|
<p style="margin-left:10px">
|
||||||
File: <?php echo $error['file']; ?><br />
|
File: <?php echo $error['file']; ?><br />
|
||||||
Line: <?php echo $error['line']; ?><br />
|
Line: <?php echo $error['line']; ?><br />
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
defined('BASEPATH') or exit('No direct script access allowed');
|
||||||
?><!DOCTYPE html>
|
?><!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
defined('BASEPATH') or exit('No direct script access allowed');
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<div style="border:1px solid #990000;padding-left:20px;margin:0 0 10px 0;">
|
<div style="border:1px solid #990000;padding-left:20px;margin:0 0 10px 0;">
|
||||||
|
@ -11,13 +11,10 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||||
<p>Filename: <?php echo $filepath; ?></p>
|
<p>Filename: <?php echo $filepath; ?></p>
|
||||||
<p>Line Number: <?php echo $line; ?></p>
|
<p>Line Number: <?php echo $line; ?></p>
|
||||||
|
|
||||||
<?php if (defined('SHOW_DEBUG_BACKTRACE') && SHOW_DEBUG_BACKTRACE === TRUE): ?>
|
<?php if (defined('SHOW_DEBUG_BACKTRACE') && SHOW_DEBUG_BACKTRACE === true) : ?>
|
||||||
|
|
||||||
<p>Backtrace:</p>
|
<p>Backtrace:</p>
|
||||||
<?php foreach (debug_backtrace() as $error) : ?>
|
<?php foreach (debug_backtrace() as $error) : ?>
|
||||||
|
|
||||||
<?php if (isset($error['file']) && strpos($error['file'], realpath(BASEPATH)) !== 0) : ?>
|
<?php if (isset($error['file']) && strpos($error['file'], realpath(BASEPATH)) !== 0) : ?>
|
||||||
|
|
||||||
<p style="margin-left:10px">
|
<p style="margin-left:10px">
|
||||||
File: <?php echo $error['file'] ?><br />
|
File: <?php echo $error['file'] ?><br />
|
||||||
Line: <?php echo $error['line'] ?><br />
|
Line: <?php echo $error['line'] ?><br />
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
<!DOCTYPE html>
|
<!doctype html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>403 Forbidden</title>
|
<title>403 Forbidden</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<p>Directory access is forbidden.</p>
|
<p>Directory access is forbidden.</p>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
<!DOCTYPE html>
|
<!doctype html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>403 Forbidden</title>
|
<title>403 Forbidden</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<p>Directory access is forbidden.</p>
|
<p>Directory access is forbidden.</p>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
<!DOCTYPE html>
|
<!doctype html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>403 Forbidden</title>
|
<title>403 Forbidden</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<p>Directory access is forbidden.</p>
|
<p>Directory access is forbidden.</p>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
<table id="basetable1" class="table table-bordered">
|
<table id="basetable1" class="table table-bordered">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Responses</th>
|
<th>Serial No.</th>
|
||||||
<th>Title</th>
|
<th>Title</th>
|
||||||
<th>Response Link</th>
|
<th>Response Link</th>
|
||||||
<th>Status</th>
|
<th>Status</th>
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
<div class="container">
|
||||||
|
<h2>Select a form to view summary</h2>
|
||||||
|
<?php foreach ($forms as $form) : ?>
|
||||||
|
<div class="form-section" data-form-id="<?php echo $form->id; ?>">
|
||||||
|
<h3><?php echo $form->title; ?></h3>
|
||||||
|
</div>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
document.querySelectorAll('.form-section').forEach(function(section) {
|
||||||
|
section.addEventListener('click', function() {
|
||||||
|
var formId = this.getAttribute('data-form-id');
|
||||||
|
window.location.href = '<?php echo base_url('response_submit/response_summary_by_form/'); ?>' + formId;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
|
@ -0,0 +1,38 @@
|
||||||
|
<div class="container">
|
||||||
|
<h2>Summary for Form <?php echo $form_id; ?></h2>
|
||||||
|
<?php foreach ($data as $question => $info) : ?>
|
||||||
|
<div class="chart-container">
|
||||||
|
<h3><?php echo $question; ?></h3>
|
||||||
|
<canvas id="chart-<?php echo md5($question); ?>" width="400" height="400"></canvas>
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
var ctx = document.getElementById('chart-<?php echo md5($question); ?>').getContext('2d');
|
||||||
|
var labels = <?php echo json_encode(array_unique($info['answers'])); ?>;
|
||||||
|
var counts = labels.map(label => {
|
||||||
|
return <?php echo json_encode(array_count_values($info['answers'])); ?>[label];
|
||||||
|
});
|
||||||
|
|
||||||
|
var chartData = {
|
||||||
|
labels: labels,
|
||||||
|
datasets: [{
|
||||||
|
data: counts,
|
||||||
|
backgroundColor: labels.map(() => 'rgba(54, 162, 235, 0.2)'),
|
||||||
|
borderColor: labels.map(() => 'rgba(54, 162, 235, 1)'),
|
||||||
|
borderWidth: 1
|
||||||
|
}]
|
||||||
|
};
|
||||||
|
|
||||||
|
var chartType = '<?php echo ($info['type'] == 'checkbox') ? 'bar' : 'pie'; ?>';
|
||||||
|
new Chart(ctx, {
|
||||||
|
type: chartType,
|
||||||
|
data: chartData,
|
||||||
|
options: {
|
||||||
|
responsive: true,
|
||||||
|
maintainAspectRatio: false
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
|
|
@ -19,16 +19,16 @@
|
||||||
<style>
|
<style>
|
||||||
.navbar-custom .navbar-brand,
|
.navbar-custom .navbar-brand,
|
||||||
.navbar-custom .navbar-nav .nav-link {
|
.navbar-custom .navbar-nav .nav-link {
|
||||||
color: white !important; /* Forces the text color to be white */
|
color: white !important;
|
||||||
text-decoration: none !important; /* Ensures no underline */
|
text-decoration: none !important;
|
||||||
background: none !important; /* Ensures no background color */
|
background: none !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.navbar-custom .navbar-brand:hover,
|
.navbar-custom .navbar-brand:hover,
|
||||||
.navbar-custom .navbar-nav .nav-link:hover {
|
.navbar-custom .navbar-nav .nav-link:hover {
|
||||||
color: white !important; /* Keeps text color white on hover */
|
color: white !important;
|
||||||
text-decoration: none !important; /* Ensures no underline on hover */
|
text-decoration: none !important;
|
||||||
background: none !important; /* Ensures no background color on hover */
|
background: none !important;
|
||||||
}
|
}
|
||||||
.title-column {
|
.title-column {
|
||||||
color: darkblue;
|
color: darkblue;
|
||||||
|
@ -124,7 +124,7 @@
|
||||||
<ul class="nav navbar-nav">
|
<ul class="nav navbar-nav">
|
||||||
<?php if ($this->session->userdata('logged_in')) : ?>
|
<?php if ($this->session->userdata('logged_in')) : ?>
|
||||||
<li><a href="<?php echo base_url(); ?>published_forms">Published Forms</a></li>
|
<li><a href="<?php echo base_url(); ?>published_forms">Published Forms</a></li>
|
||||||
<li><a href="<?php echo base_url(); ?>drafts">Drafts</a></li>
|
<!-- <li><a href="<?php echo base_url(); ?>drafts">Drafts</a></li> -->
|
||||||
|
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
defined('BASEPATH') or exit('No direct script access allowed');
|
||||||
?><!DOCTYPE html>
|
?><!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -3,7 +3,6 @@
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
margin-top: -56px;
|
margin-top: -56px;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.form-title,
|
.form-title,
|
||||||
|
@ -32,7 +31,6 @@
|
||||||
opacity: 0.5; /* Make the icon transparent */
|
opacity: 0.5; /* Make the icon transparent */
|
||||||
margin-right: 10px; /* Space between icon and option box */
|
margin-right: 10px; /* Space between icon and option box */
|
||||||
font-size: 10px; /* Adjust icon size here */
|
font-size: 10px; /* Adjust icon size here */
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.option .form-control.option-label {
|
.option .form-control.option-label {
|
||||||
|
|
|
@ -34,7 +34,8 @@ body {
|
||||||
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
|
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
}
|
}
|
||||||
.form-header h2, .form-header h4 {
|
.form-header h2,
|
||||||
|
.form-header h4 {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
}
|
}
|
||||||
|
@ -62,12 +63,12 @@ body {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
.option input[type="checkbox"] {
|
.option input[type='checkbox'] {
|
||||||
margin-right: 10px;
|
margin-right: 10px;
|
||||||
width: 16px; /* Adjust size of checkbox */
|
width: 16px; /* Adjust size of checkbox */
|
||||||
height: 16px; /* Adjust size of checkbox */
|
height: 16px; /* Adjust size of checkbox */
|
||||||
}
|
}
|
||||||
.option input[type="radio"] {
|
.option input[type='radio'] {
|
||||||
margin-right: 10px;
|
margin-right: 10px;
|
||||||
width: 16px; /* Adjust size of radio button */
|
width: 16px; /* Adjust size of radio button */
|
||||||
height: 16px; /* Adjust size of radio button */
|
height: 16px; /* Adjust size of radio button */
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
.navbar-container {
|
.navbar-container {
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
|
@ -23,7 +22,6 @@
|
||||||
padding: 15px 10px;
|
padding: 15px 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.navbar-custom .navbar-nav {
|
.navbar-custom .navbar-nav {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
@ -54,8 +52,6 @@
|
||||||
margin: 0 10px;
|
margin: 0 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#add-section-btn {
|
#add-section-btn {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,8 +74,6 @@ body {
|
||||||
flex: 1; /* Allow items to grow/shrink to fill space */
|
flex: 1; /* Allow items to grow/shrink to fill space */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#submit-btn {
|
#submit-btn {
|
||||||
margin-top: 20px;
|
margin-top: 20px;
|
||||||
float: left;
|
float: left;
|
||||||
|
@ -133,8 +131,7 @@ a.pagination-link{
|
||||||
border: 1px solid #3333336c; /* Darker border color */
|
border: 1px solid #3333336c; /* Darker border color */
|
||||||
}
|
}
|
||||||
|
|
||||||
#basetable1 th, #basetable1 td {
|
#basetable1 th,
|
||||||
|
#basetable1 td {
|
||||||
border: 1px solid #3333336c; /* Darker border color for table cells */
|
border: 1px solid #3333336c; /* Darker border color for table cells */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,5 +1,9 @@
|
||||||
body { background-color: rgb(240, 235, 248); }
|
body {
|
||||||
.container { margin-top: 30px; }
|
background-color: rgb(240, 235, 248);
|
||||||
|
}
|
||||||
|
.container {
|
||||||
|
margin-top: 30px;
|
||||||
|
}
|
||||||
.form-header {
|
.form-header {
|
||||||
background-color: white;
|
background-color: white;
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
|
@ -13,8 +17,12 @@ body { background-color: rgb(240, 235, 248); }
|
||||||
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
|
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
}
|
}
|
||||||
.form-header h2 { margin: 0; }
|
.form-header h2 {
|
||||||
.form-header h4 { color: rgba(0, 0, 0, 0.5); }
|
margin: 0;
|
||||||
|
}
|
||||||
|
.form-header h4 {
|
||||||
|
color: rgba(0, 0, 0, 0.5);
|
||||||
|
}
|
||||||
.form-section {
|
.form-section {
|
||||||
background-color: white;
|
background-color: white;
|
||||||
width: 56%;
|
width: 56%;
|
||||||
|
@ -36,8 +44,8 @@ body { background-color: rgb(240, 235, 248); }
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
.option input[type="radio"],
|
.option input[type='radio'],
|
||||||
.option input[type="checkbox"] {
|
.option input[type='checkbox'] {
|
||||||
margin-right: 10px;
|
margin-right: 10px;
|
||||||
}
|
}
|
||||||
.required-field::after {
|
.required-field::after {
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
body {
|
body {
|
||||||
background-color: rgb(240, 235, 248);
|
background-color: rgb(240, 235, 248);
|
||||||
font-family: Arial, sans-serif;
|
font-family: Arial, sans-serif;
|
||||||
|
@ -13,7 +12,6 @@ body {
|
||||||
}
|
}
|
||||||
/* Navbar custom styles */
|
/* Navbar custom styles */
|
||||||
|
|
||||||
|
|
||||||
.container {
|
.container {
|
||||||
position: relative;
|
position: relative;
|
||||||
margin-top: 30px;
|
margin-top: 30px;
|
||||||
|
@ -78,10 +76,8 @@ body {
|
||||||
z-index: 1000;
|
z-index: 1000;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
background-color: rgb(103, 58, 183);
|
background-color: rgb(103, 58, 183);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.form-section {
|
.form-section {
|
||||||
background-color: white;
|
background-color: white;
|
||||||
width: 56%;
|
width: 56%;
|
||||||
|
@ -125,7 +121,6 @@ body {
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.delete-section-icon {
|
.delete-section-icon {
|
||||||
flex: 0.1;
|
flex: 0.1;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
@ -152,8 +147,8 @@ body {
|
||||||
margin-bottom: 5px;
|
margin-bottom: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.option input[type="radio"],
|
.option input[type='radio'],
|
||||||
.option input[type="checkbox"] {
|
.option input[type='checkbox'] {
|
||||||
margin-right: 10px;
|
margin-right: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -169,16 +164,13 @@ body {
|
||||||
text-align: left;
|
text-align: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.add-option-btn {
|
.add-option-btn {
|
||||||
background-color: rgb(66, 133, 244);
|
background-color: rgb(66, 133, 244);
|
||||||
/* color: rgb(66, 133, 244); */
|
/* color: rgb(66, 133, 244); */
|
||||||
margin-top: 11px;
|
margin-top: 11px;
|
||||||
font-size: 0.8em;
|
font-size: 0.8em;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.ui-state-highlight {
|
.ui-state-highlight {
|
||||||
background-color: transparent !important;
|
background-color: transparent !important;
|
||||||
border: none !important;
|
border: none !important;
|
||||||
|
@ -210,19 +202,19 @@ body {
|
||||||
right: 0;
|
right: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
background-color: #ccc;
|
background-color: #ccc;
|
||||||
transition: .4s;
|
transition: 0.4s;
|
||||||
border-radius: 34px;
|
border-radius: 34px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.slider:before {
|
.slider:before {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
content: "";
|
content: '';
|
||||||
height: 14px;
|
height: 14px;
|
||||||
width: 14px;
|
width: 14px;
|
||||||
left: 3px;
|
left: 3px;
|
||||||
bottom: 3px;
|
bottom: 3px;
|
||||||
background-color: white;
|
background-color: white;
|
||||||
transition: .4s;
|
transition: 0.4s;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -277,4 +269,3 @@ color: white;
|
||||||
margin-top: 5px;
|
margin-top: 5px;
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -135,8 +135,8 @@ body {
|
||||||
margin-bottom: 5px;
|
margin-bottom: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.option input[type="radio"],
|
.option input[type='radio'],
|
||||||
.option input[type="checkbox"] {
|
.option input[type='checkbox'] {
|
||||||
margin-right: 10px;
|
margin-right: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -191,19 +191,19 @@ body {
|
||||||
right: 0;
|
right: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
background-color: #ccc;
|
background-color: #ccc;
|
||||||
transition: .4s;
|
transition: 0.4s;
|
||||||
border-radius: 34px;
|
border-radius: 34px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.slider:before {
|
.slider:before {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
content: "";
|
content: '';
|
||||||
height: 14px;
|
height: 14px;
|
||||||
width: 14px;
|
width: 14px;
|
||||||
left: 3px;
|
left: 3px;
|
||||||
bottom: 3px;
|
bottom: 3px;
|
||||||
background-color: white;
|
background-color: white;
|
||||||
transition: .4s;
|
transition: 0.4s;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,50 @@
|
||||||
|
// src/index.js
|
||||||
|
|
||||||
|
// Example function to add two numbers
|
||||||
|
function add(a, b) {
|
||||||
|
return a + b
|
||||||
|
}
|
||||||
|
|
||||||
|
// Example usage of the add function
|
||||||
|
|
||||||
|
const result = add(5, 10)
|
||||||
|
console.log('The result is:', result)
|
||||||
|
|
||||||
|
// Example object with properties
|
||||||
|
const person = {
|
||||||
|
name: 'John Doe',
|
||||||
|
age: 30,
|
||||||
|
greet: function () {
|
||||||
|
console.log(
|
||||||
|
`Hello, my name is ${this.name} and I am ${this.age} years old.`
|
||||||
|
)
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// Call the greet method
|
||||||
|
person.greet()
|
||||||
|
|
||||||
|
// Example of an arrow function
|
||||||
|
const multiply = (x, y) => x * y
|
||||||
|
|
||||||
|
console.log('The product is:', multiply(4, 5))
|
||||||
|
|
||||||
|
// Example of a variable declared with let
|
||||||
|
let count = 0
|
||||||
|
for (let i = 0; i < 5; i++) {
|
||||||
|
count += i
|
||||||
|
}
|
||||||
|
console.log('The count is:', count)
|
||||||
|
|
||||||
|
// Example of a variable declared with const
|
||||||
|
const message = 'This is a constant message.'
|
||||||
|
console.log(message)
|
||||||
|
|
||||||
|
// Example of a function with default parameters
|
||||||
|
function greet(name = 'Guest') {
|
||||||
|
console.log(`Welcome, ${name}!`)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Call the function with and without arguments
|
||||||
|
greet('Alice')
|
||||||
|
greet()
|
|
@ -21,10 +21,8 @@ $(document).ready(function() {
|
||||||
<span class="delete-section-icon"><i class="fas fa-trash-alt"></i></span>
|
<span class="delete-section-icon"><i class="fas fa-trash-alt"></i></span>
|
||||||
</div>
|
</div>
|
||||||
<div class="options-container"></div>
|
<div class="options-container"></div>
|
||||||
<button class="btn btn-secondary add-option-btn" style="display: none;">Add Option</button>
|
<button class="btn btn-secondary add-option-btn" style="display: none;">Add Option</button></div>
|
||||||
</div>
|
`; $('#form-container').append(sectionHtml);
|
||||||
`;
|
|
||||||
$('#form-container').append(sectionHtml);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Add option button functionality
|
// Add option button functionality
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,10 +1,10 @@
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
let index = 1;
|
let index = 1
|
||||||
let activeSection = null;
|
let activeSection = null
|
||||||
|
|
||||||
function addOption(type, container) {
|
function addOption(type, container) {
|
||||||
// let optionIndex = container.children().length + 1;
|
// let optionIndex = container.children().length + 1;
|
||||||
let optionHtml;
|
let optionHtml
|
||||||
if (type === 'multiple-choice' || type === 'checkboxes') {
|
if (type === 'multiple-choice' || type === 'checkboxes') {
|
||||||
optionHtml = `
|
optionHtml = `
|
||||||
<div class="option">
|
<div class="option">
|
||||||
|
@ -12,17 +12,16 @@ function addOption(type, container) {
|
||||||
<input type="text" class="form-control option-label" >
|
<input type="text" class="form-control option-label" >
|
||||||
<span class="delete-option-icon">×</span>
|
<span class="delete-option-icon">×</span>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`
|
||||||
}
|
} else if (type === 'dropdown') {
|
||||||
else if (type === 'dropdown') {
|
|
||||||
optionHtml = `
|
optionHtml = `
|
||||||
<div class="option">
|
<div class="option">
|
||||||
<input type="text" class="form-control option-label">
|
<input type="text" class="form-control option-label">
|
||||||
<span class="delete-option-icon">×</span>
|
<span class="delete-option-icon">×</span>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`
|
||||||
}
|
}
|
||||||
container.append(optionHtml);
|
container.append(optionHtml)
|
||||||
}
|
}
|
||||||
|
|
||||||
function createFormSection() {
|
function createFormSection() {
|
||||||
|
@ -45,88 +44,100 @@ function addOption(type, container) {
|
||||||
</div>
|
</div>
|
||||||
<div class="options-container"></div>
|
<div class="options-container"></div>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`
|
||||||
$('#form-container').append(newSection);
|
$('#form-container').append(newSection)
|
||||||
index++;
|
index++
|
||||||
positionAddSectionButton();
|
positionAddSectionButton()
|
||||||
}
|
}
|
||||||
|
|
||||||
function positionAddSectionButton() {
|
function positionAddSectionButton() {
|
||||||
if (activeSection) {
|
if (activeSection) {
|
||||||
let position = activeSection.position();
|
let position = activeSection.position()
|
||||||
let buttonWidth = $('#add-section-btn').outerWidth();
|
let buttonWidth = $('#add-section-btn').outerWidth()
|
||||||
let buttonHeight = $('#add-section-btn').outerHeight();
|
let buttonHeight = $('#add-section-btn').outerHeight()
|
||||||
|
|
||||||
$('#add-section-btn').css({
|
$('#add-section-btn').css({
|
||||||
position: 'absolute',
|
position: 'absolute',
|
||||||
left: position.left - buttonWidth - 47 + 'px',
|
left: position.left - buttonWidth - 47 + 'px',
|
||||||
top: position.top + activeSection.height() / 2 - buttonHeight / 2 + 'px'
|
top:
|
||||||
});
|
position.top + activeSection.height() / 2 - buttonHeight / 2 + 'px',
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#add-section-btn').on('click', function () {
|
$('#add-section-btn').on('click', function () {
|
||||||
createFormSection();
|
createFormSection()
|
||||||
$('.form-section').removeClass('active');
|
$('.form-section').removeClass('active')
|
||||||
activeSection = $('.form-section').last();
|
activeSection = $('.form-section').last()
|
||||||
activeSection.addClass('active');
|
activeSection.addClass('active')
|
||||||
positionAddSectionButton();
|
positionAddSectionButton()
|
||||||
});
|
})
|
||||||
|
|
||||||
$(document).on('change', '.custom-select', function () {
|
$(document).on('change', '.custom-select', function () {
|
||||||
let type = $(this).val();
|
let type = $(this).val()
|
||||||
let container = $(this).closest('.form-section').find('.options-container');
|
let container = $(this).closest('.form-section').find('.options-container')
|
||||||
container.empty();
|
container.empty()
|
||||||
$(this).closest('.form-section').find('.add-option-btn').remove();
|
$(this).closest('.form-section').find('.add-option-btn').remove()
|
||||||
|
|
||||||
if (type === 'short-answer') {
|
if (type === 'short-answer') {
|
||||||
container.append('<input type="text" class="form-control" disabled placeholder="Short answer text">');
|
container.append(
|
||||||
|
'<input type="text" class="form-control" disabled placeholder="Short answer text">'
|
||||||
|
)
|
||||||
} else if (type === 'paragraph') {
|
} else if (type === 'paragraph') {
|
||||||
container.append('<textarea class="form-control" disabled placeholder="Paragraph text"></textarea>');
|
container.append(
|
||||||
|
'<textarea class="form-control" disabled placeholder="Paragraph text"></textarea>'
|
||||||
|
)
|
||||||
} else {
|
} else {
|
||||||
addOption(type, container);
|
addOption(type, container)
|
||||||
$(this).closest('.form-section').append('<button class="btn btn-secondary add-option-btn">Add Option</button>');
|
$(this)
|
||||||
|
.closest('.form-section')
|
||||||
|
.append(
|
||||||
|
'<button class="btn btn-secondary add-option-btn">Add Option</button>'
|
||||||
|
)
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
|
|
||||||
$(document).on('click', '.add-option-btn', function () {
|
$(document).on('click', '.add-option-btn', function () {
|
||||||
let type = $(this).closest('.form-section').find('.custom-select').val();
|
let type = $(this).closest('.form-section').find('.custom-select').val()
|
||||||
let container = $(this).closest('.form-section').find('.options-container');
|
let container = $(this).closest('.form-section').find('.options-container')
|
||||||
addOption(type, container);
|
addOption(type, container)
|
||||||
});
|
})
|
||||||
|
|
||||||
$(document).on('click', '.delete-section-icon', function () {
|
$(document).on('click', '.delete-section-icon', function () {
|
||||||
let section = $(this).closest('.form-section');
|
let section = $(this).closest('.form-section')
|
||||||
let prevSection = section.prev('.form-section');
|
let prevSection = section.prev('.form-section')
|
||||||
let nextSection = section.next('.form-section');
|
let nextSection = section.next('.form-section')
|
||||||
section.remove();
|
section.remove()
|
||||||
if (section.hasClass('active')) {
|
if (section.hasClass('active')) {
|
||||||
activeSection = null;
|
activeSection = null
|
||||||
}
|
}
|
||||||
if (prevSection.length > 0) {
|
if (prevSection.length > 0) {
|
||||||
prevSection.find('.delete-section-icon').appendTo(prevSection.find('.form-section'));
|
prevSection
|
||||||
activeSection = prevSection;row
|
.find('.delete-section-icon')
|
||||||
|
.appendTo(prevSection.find('.form-section'))
|
||||||
|
activeSection = prevSection
|
||||||
|
row
|
||||||
|
} else if (nextSection.length > 0) {
|
||||||
|
nextSection
|
||||||
|
.find('.delete-section-icon')
|
||||||
|
.appendTo(nextSection.find('.form-header'))
|
||||||
|
activeSection = nextSection
|
||||||
}
|
}
|
||||||
else if (nextSection.length > 0) {
|
positionAddSectionButton()
|
||||||
nextSection.find('.delete-section-icon').appendTo(nextSection.find('.form-header'));
|
})
|
||||||
activeSection = nextSection;
|
|
||||||
}
|
|
||||||
positionAddSectionButton();
|
|
||||||
});
|
|
||||||
|
|
||||||
$(document).on('click', '.delete-option-icon', function () {
|
$(document).on('click', '.delete-option-icon', function () {
|
||||||
let option = $(this).closest('.option');
|
let option = $(this).closest('.option')
|
||||||
let container = option.closest('.options-container');
|
let container = option.closest('.options-container')
|
||||||
option.remove();
|
option.remove()
|
||||||
|
})
|
||||||
});
|
|
||||||
|
|
||||||
$(document).on('click', '.required-toggle', function () {
|
$(document).on('click', '.required-toggle', function () {
|
||||||
$(this).closest('.form-section').toggleClass('required');
|
$(this).closest('.form-section').toggleClass('required')
|
||||||
});
|
})
|
||||||
|
|
||||||
$('#preview-btn').on('click', function () {
|
$('#preview-btn').on('click', function () {
|
||||||
let previewWindow = window.open('', '_blank');
|
let previewWindow = window.open('', '_blank')
|
||||||
let previewContent = `
|
let previewContent = `
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
|
@ -146,14 +157,17 @@ function addOption(type, container) {
|
||||||
<div class="form-header">
|
<div class="form-header">
|
||||||
<h3>Form Preview</h3>
|
<h3>Form Preview</h3>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`
|
||||||
$('.form-section').each(function () {
|
$('.form-section').each(function () {
|
||||||
previewContent += '<div class="form-section">';
|
previewContent += '<div class="form-section">'
|
||||||
previewContent += '<div class="question-section">';
|
previewContent += '<div class="question-section">'
|
||||||
previewContent += '<div class="question-label">' + $(this).find('.untitled-question').val() + '</div>';
|
previewContent +=
|
||||||
previewContent += '</div>';
|
'<div class="question-label">' +
|
||||||
let type = $(this).find('.custom-select').val();
|
$(this).find('.untitled-question').val() +
|
||||||
let optionsContainer = $(this).find('.options-container');
|
'</div>'
|
||||||
|
previewContent += '</div>'
|
||||||
|
let type = $(this).find('.custom-select').val()
|
||||||
|
let optionsContainer = $(this).find('.options-container')
|
||||||
|
|
||||||
if (type === 'multiple-choice') {
|
if (type === 'multiple-choice') {
|
||||||
optionsContainer.find('.option').each(function () {
|
optionsContainer.find('.option').each(function () {
|
||||||
|
@ -162,8 +176,8 @@ function addOption(type, container) {
|
||||||
<input type="radio" name="option-${index}">
|
<input type="radio" name="option-${index}">
|
||||||
<label>${$(this).find('.option-label').val()}</label>
|
<label>${$(this).find('.option-label').val()}</label>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`
|
||||||
});
|
})
|
||||||
} else if (type === 'checkboxes') {
|
} else if (type === 'checkboxes') {
|
||||||
optionsContainer.find('.option').each(function () {
|
optionsContainer.find('.option').each(function () {
|
||||||
previewContent += `
|
previewContent += `
|
||||||
|
@ -171,101 +185,116 @@ function addOption(type, container) {
|
||||||
<input type="checkbox">
|
<input type="checkbox">
|
||||||
<label>${$(this).find('.option-label').val()}</label>
|
<label>${$(this).find('.option-label').val()}</label>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`
|
||||||
});
|
})
|
||||||
} else if (type === 'short-answer') {
|
} else if (type === 'short-answer') {
|
||||||
previewContent += '<input type="text" class="form-control" placeholder="Short answer text">';
|
previewContent +=
|
||||||
|
'<input type="text" class="form-control" placeholder="Short answer text">'
|
||||||
} else if (type === 'paragraph') {
|
} else if (type === 'paragraph') {
|
||||||
previewContent += '<textarea class="form-control" placeholder="Paragraph text"></textarea>';
|
previewContent +=
|
||||||
|
'<textarea class="form-control" placeholder="Paragraph text"></textarea>'
|
||||||
} else if (type === 'dropdown') {
|
} else if (type === 'dropdown') {
|
||||||
let dropdownHtml = '<select class="form-control">';
|
let dropdownHtml = '<select class="form-control">'
|
||||||
optionsContainer.find('.option .option-label').each(function () {
|
optionsContainer.find('.option .option-label').each(function () {
|
||||||
dropdownHtml += `<option>${$(this).val()}</option>`;
|
dropdownHtml += `<option>${$(this).val()}</option>`
|
||||||
});
|
})
|
||||||
dropdownHtml += '</select>';
|
dropdownHtml += '</select>'
|
||||||
previewContent += dropdownHtml;
|
previewContent += dropdownHtml
|
||||||
}
|
}
|
||||||
previewContent += '</div>';
|
previewContent += '</div>'
|
||||||
});
|
})
|
||||||
previewContent += `
|
previewContent += `
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
`;
|
`
|
||||||
previewWindow.document.write(previewContent);
|
previewWindow.document.write(previewContent)
|
||||||
previewWindow.document.close();
|
previewWindow.document.close()
|
||||||
});
|
})
|
||||||
|
|
||||||
$(document).on('click', '.form-section', function () {
|
$(document).on('click', '.form-section', function () {
|
||||||
$('.form-section').removeClass('active');
|
$('.form-section').removeClass('active')
|
||||||
$(this).addClass('active');
|
$(this).addClass('active')
|
||||||
activeSection = $(this);
|
activeSection = $(this)
|
||||||
positionAddSectionButton();
|
positionAddSectionButton()
|
||||||
});
|
})
|
||||||
|
|
||||||
$('#form-container').sortable({
|
$('#form-container').sortable({
|
||||||
placeholder: 'ui-state-highlight',
|
placeholder: 'ui-state-highlight',
|
||||||
start: function (event, ui) {
|
start: function (event, ui) {
|
||||||
ui.placeholder.height(ui.item.height());
|
ui.placeholder.height(ui.item.height())
|
||||||
},
|
},
|
||||||
stop: function (event, ui) {
|
stop: function (event, ui) {
|
||||||
positionAddSectionButton();
|
positionAddSectionButton()
|
||||||
}
|
},
|
||||||
});
|
})
|
||||||
|
|
||||||
function collectFormData() {
|
function collectFormData() {
|
||||||
var formData = {
|
var formData = {
|
||||||
questions: []
|
questions: [],
|
||||||
};
|
}
|
||||||
|
|
||||||
$('.form-section').each(function () {
|
$('.form-section').each(function () {
|
||||||
var questionType = $(this).find('.custom-select').val();
|
var questionType = $(this).find('.custom-select').val()
|
||||||
var questionData = {
|
var questionData = {
|
||||||
text: $(this).find('.untitled-question').val(),
|
text: $(this).find('.untitled-question').val(),
|
||||||
type: questionType,
|
type: questionType,
|
||||||
is_required: $(this).find('.required-toggle').is(':checked'),
|
is_required: $(this).find('.required-toggle').is(':checked'),
|
||||||
options: []
|
options: [],
|
||||||
};
|
}
|
||||||
|
|
||||||
// Only add options if the question type supports them
|
// Only add options if the question type supports them
|
||||||
if (questionType === 'multiple-choice' || questionType === 'checkboxes' || questionType === 'dropdown') {
|
if (
|
||||||
$(this).find('.option-label').each(function() {
|
questionType === 'multiple-choice' ||
|
||||||
questionData.options.push($(this).val());
|
questionType === 'checkboxes' ||
|
||||||
});
|
questionType === 'dropdown'
|
||||||
|
) {
|
||||||
|
$(this)
|
||||||
|
.find('.option-label')
|
||||||
|
.each(function () {
|
||||||
|
questionData.options.push($(this).val())
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
formData.questions.push(questionData);
|
formData.questions.push(questionData)
|
||||||
});
|
})
|
||||||
|
|
||||||
console.log(formData);
|
console.log(formData)
|
||||||
return formData;
|
return formData
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function validateFormData(formData) {
|
function validateFormData(formData) {
|
||||||
for (let question of formData.questions) {
|
for (let question of formData.questions) {
|
||||||
if (!question.text.trim()) {
|
if (!question.text.trim()) {
|
||||||
return { isValid: false, message: 'All questions must have text.' };
|
return { isValid: false, message: 'All questions must have text.' }
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
(question.type === 'multiple-choice' ||
|
||||||
|
question.type === 'checkboxes' ||
|
||||||
|
question.type === 'dropdown') &&
|
||||||
|
question.options.length === 0
|
||||||
|
) {
|
||||||
|
return {
|
||||||
|
isValid: false,
|
||||||
|
message: 'All options-based questions must have at least one option.',
|
||||||
}
|
}
|
||||||
if ((question.type === 'multiple-choice' || question.type === 'checkboxes' || question.type === 'dropdown') && question.options.length === 0) {
|
|
||||||
return { isValid: false, message: 'All options-based questions must have at least one option.' };
|
|
||||||
}
|
}
|
||||||
for (let option of question.options) {
|
for (let option of question.options) {
|
||||||
if (!option.trim()) {
|
if (!option.trim()) {
|
||||||
return { isValid: false, message: 'All options must have text.' };
|
return { isValid: false, message: 'All options must have text.' }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return { isValid: true };
|
return { isValid: true }
|
||||||
}
|
}
|
||||||
$('#submit-btn').on('click', function () {
|
$('#submit-btn').on('click', function () {
|
||||||
let formData = collectFormData();
|
let formData = collectFormData()
|
||||||
console.log(formData);
|
console.log(formData)
|
||||||
|
|
||||||
let validation = validateFormData(formData);
|
let validation = validateFormData(formData)
|
||||||
if (!validation.isValid) {
|
if (!validation.isValid) {
|
||||||
alert(validation.message);
|
alert(validation.message)
|
||||||
return;
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
|
@ -279,18 +308,18 @@ function addOption(type, container) {
|
||||||
title: 'Success!',
|
title: 'Success!',
|
||||||
text: 'Form submitted successfully!',
|
text: 'Form submitted successfully!',
|
||||||
icon: 'success',
|
icon: 'success',
|
||||||
confirmButtonText: 'OK'
|
confirmButtonText: 'OK',
|
||||||
}).then((result) => {
|
}).then((result) => {
|
||||||
window.location.href = base_url;
|
window.location.href = base_url
|
||||||
});
|
})
|
||||||
} else {
|
} else {
|
||||||
Swal.fire({
|
Swal.fire({
|
||||||
title: 'Error!',
|
title: 'Error!',
|
||||||
text: response.message,
|
text: response.message,
|
||||||
icon: 'error',
|
icon: 'error',
|
||||||
confirmButtonText: 'OK'
|
confirmButtonText: 'OK',
|
||||||
});
|
})
|
||||||
console.log(response);
|
console.log(response)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
error: function (error) {
|
error: function (error) {
|
||||||
|
@ -304,16 +333,13 @@ function addOption(type, container) {
|
||||||
padding: 'auto',
|
padding: 'auto',
|
||||||
}).then((result) => {
|
}).then((result) => {
|
||||||
if (result.isConfirmed) {
|
if (result.isConfirmed) {
|
||||||
window.location.href = home;
|
window.location.href = home
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
console.log(error);
|
console.log(error)
|
||||||
}
|
},
|
||||||
});
|
})
|
||||||
});
|
})
|
||||||
|
|
||||||
|
$('#form-container').disableSelection()
|
||||||
|
})
|
||||||
|
|
||||||
$('#form-container').disableSelection();
|
|
||||||
});
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ $(document).ready(function () {
|
||||||
let index = 1
|
let index = 1
|
||||||
let activeSection = null
|
let activeSection = null
|
||||||
|
|
||||||
function addOption(type, container)
|
function addOption(type, container) {
|
||||||
let optionHtml
|
let optionHtml
|
||||||
|
|
||||||
if (type === 'multiple-choice' || type === 'checkboxes') {
|
if (type === 'multiple-choice' || type === 'checkboxes') {
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -30,6 +30,7 @@
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"mikey179/vfsstream": "1.6.*",
|
"mikey179/vfsstream": "1.6.*",
|
||||||
"phpunit/phpunit": "4.* || 5.* || 9.*"
|
"phpunit/phpunit": "4.* || 5.* || 9.*",
|
||||||
|
"squizlabs/php_codesniffer": "^3.5"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,7 @@
|
||||||
|
import globals from 'globals'
|
||||||
|
import pluginJs from '@eslint/js'
|
||||||
|
|
||||||
|
export default [
|
||||||
|
{ languageOptions: { globals: { ...globals.browser, ...globals.node } } },
|
||||||
|
pluginJs.configs.recommended,
|
||||||
|
]
|
76
index.php
76
index.php
|
@ -1,4 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CodeIgniter
|
* CodeIgniter
|
||||||
*
|
*
|
||||||
|
@ -63,8 +64,7 @@
|
||||||
* Different environments will require different levels of error reporting.
|
* Different environments will require different levels of error reporting.
|
||||||
* By default development will show errors but testing and live will hide them.
|
* By default development will show errors but testing and live will hide them.
|
||||||
*/
|
*/
|
||||||
switch (ENVIRONMENT)
|
switch (ENVIRONMENT) {
|
||||||
{
|
|
||||||
case 'development':
|
case 'development':
|
||||||
error_reporting(-1);
|
error_reporting(-1);
|
||||||
ini_set('display_errors', 1);
|
ini_set('display_errors', 1);
|
||||||
|
@ -73,18 +73,15 @@ switch (ENVIRONMENT)
|
||||||
case 'testing':
|
case 'testing':
|
||||||
case 'production':
|
case 'production':
|
||||||
ini_set('display_errors', 0);
|
ini_set('display_errors', 0);
|
||||||
if (version_compare(PHP_VERSION, '5.3', '>='))
|
if (version_compare(PHP_VERSION, '5.3', '>=')) {
|
||||||
{
|
|
||||||
error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_NOTICE & ~E_USER_DEPRECATED);
|
error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_NOTICE & ~E_USER_DEPRECATED);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_USER_NOTICE);
|
error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_USER_NOTICE);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
header('HTTP/1.1 503 Service Unavailable.', TRUE, 503);
|
header('HTTP/1.1 503 Service Unavailable.', true, 503);
|
||||||
echo 'The application environment is not set correctly.';
|
echo 'The application environment is not set correctly.';
|
||||||
exit(1); // EXIT_ERROR
|
exit(1); // EXIT_ERROR
|
||||||
}
|
}
|
||||||
|
@ -191,17 +188,13 @@ switch (ENVIRONMENT)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Set the current directory correctly for CLI requests
|
// Set the current directory correctly for CLI requests
|
||||||
if (defined('STDIN'))
|
if (defined('STDIN')) {
|
||||||
{
|
|
||||||
chdir(dirname(__FILE__));
|
chdir(dirname(__FILE__));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($_temp = realpath($system_path)) !== FALSE)
|
if (($_temp = realpath($system_path)) !== false) {
|
||||||
{
|
|
||||||
$system_path = $_temp . DIRECTORY_SEPARATOR;
|
$system_path = $_temp . DIRECTORY_SEPARATOR;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
// Ensure there's a trailing slash
|
// Ensure there's a trailing slash
|
||||||
$system_path = strtr(
|
$system_path = strtr(
|
||||||
rtrim($system_path, '/\\'),
|
rtrim($system_path, '/\\'),
|
||||||
|
@ -211,9 +204,8 @@ switch (ENVIRONMENT)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Is the system path correct?
|
// Is the system path correct?
|
||||||
if ( ! is_dir($system_path))
|
if (! is_dir($system_path)) {
|
||||||
{
|
header('HTTP/1.1 503 Service Unavailable.', true, 503);
|
||||||
header('HTTP/1.1 503 Service Unavailable.', TRUE, 503);
|
|
||||||
echo 'Your system folder path does not appear to be set correctly. Please open the following file and correct this: ' . pathinfo(__FILE__, PATHINFO_BASENAME);
|
echo 'Your system folder path does not appear to be set correctly. Please open the following file and correct this: ' . pathinfo(__FILE__, PATHINFO_BASENAME);
|
||||||
exit(3); // EXIT_CONFIG
|
exit(3); // EXIT_CONFIG
|
||||||
}
|
}
|
||||||
|
@ -236,70 +228,52 @@ switch (ENVIRONMENT)
|
||||||
define('SYSDIR', basename(BASEPATH));
|
define('SYSDIR', basename(BASEPATH));
|
||||||
|
|
||||||
// The path to the "application" directory
|
// The path to the "application" directory
|
||||||
if (is_dir($application_folder))
|
if (is_dir($application_folder)) {
|
||||||
{
|
if (($_temp = realpath($application_folder)) !== false) {
|
||||||
if (($_temp = realpath($application_folder)) !== FALSE)
|
|
||||||
{
|
|
||||||
$application_folder = $_temp;
|
$application_folder = $_temp;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$application_folder = strtr(
|
$application_folder = strtr(
|
||||||
rtrim($application_folder, '/\\'),
|
rtrim($application_folder, '/\\'),
|
||||||
'/\\',
|
'/\\',
|
||||||
DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR
|
DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
} elseif (is_dir(BASEPATH . $application_folder . DIRECTORY_SEPARATOR)) {
|
||||||
elseif (is_dir(BASEPATH.$application_folder.DIRECTORY_SEPARATOR))
|
|
||||||
{
|
|
||||||
$application_folder = BASEPATH . strtr(
|
$application_folder = BASEPATH . strtr(
|
||||||
trim($application_folder, '/\\'),
|
trim($application_folder, '/\\'),
|
||||||
'/\\',
|
'/\\',
|
||||||
DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR
|
DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR
|
||||||
);
|
);
|
||||||
}
|
} else {
|
||||||
else
|
header('HTTP/1.1 503 Service Unavailable.', true, 503);
|
||||||
{
|
echo 'Your application folder path does not appear to be set correctly. Please open the following file and correct this: ' . self;
|
||||||
header('HTTP/1.1 503 Service Unavailable.', TRUE, 503);
|
|
||||||
echo 'Your application folder path does not appear to be set correctly. Please open the following file and correct this: '.SELF;
|
|
||||||
exit(3); // EXIT_CONFIG
|
exit(3); // EXIT_CONFIG
|
||||||
}
|
}
|
||||||
|
|
||||||
define('APPPATH', $application_folder . DIRECTORY_SEPARATOR);
|
define('APPPATH', $application_folder . DIRECTORY_SEPARATOR);
|
||||||
|
|
||||||
// The path to the "views" directory
|
// The path to the "views" directory
|
||||||
if ( ! isset($view_folder[0]) && is_dir(APPPATH.'views'.DIRECTORY_SEPARATOR))
|
if (! isset($view_folder[0]) && is_dir(APPPATH . 'views' . DIRECTORY_SEPARATOR)) {
|
||||||
{
|
|
||||||
$view_folder = APPPATH . 'views';
|
$view_folder = APPPATH . 'views';
|
||||||
}
|
} elseif (is_dir($view_folder)) {
|
||||||
elseif (is_dir($view_folder))
|
if (($_temp = realpath($view_folder)) !== false) {
|
||||||
{
|
|
||||||
if (($_temp = realpath($view_folder)) !== FALSE)
|
|
||||||
{
|
|
||||||
$view_folder = $_temp;
|
$view_folder = $_temp;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$view_folder = strtr(
|
$view_folder = strtr(
|
||||||
rtrim($view_folder, '/\\'),
|
rtrim($view_folder, '/\\'),
|
||||||
'/\\',
|
'/\\',
|
||||||
DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR
|
DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
} elseif (is_dir(APPPATH . $view_folder . DIRECTORY_SEPARATOR)) {
|
||||||
elseif (is_dir(APPPATH.$view_folder.DIRECTORY_SEPARATOR))
|
|
||||||
{
|
|
||||||
$view_folder = APPPATH . strtr(
|
$view_folder = APPPATH . strtr(
|
||||||
trim($view_folder, '/\\'),
|
trim($view_folder, '/\\'),
|
||||||
'/\\',
|
'/\\',
|
||||||
DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR
|
DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR
|
||||||
);
|
);
|
||||||
}
|
} else {
|
||||||
else
|
header('HTTP/1.1 503 Service Unavailable.', true, 503);
|
||||||
{
|
echo 'Your view folder path does not appear to be set correctly. Please open the following file and correct this: ' . self;
|
||||||
header('HTTP/1.1 503 Service Unavailable.', TRUE, 503);
|
|
||||||
echo 'Your view folder path does not appear to be set correctly. Please open the following file and correct this: '.SELF;
|
|
||||||
exit(3); // EXIT_CONFIG
|
exit(3); // EXIT_CONFIG
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
../acorn/bin/acorn
|
|
@ -0,0 +1 @@
|
||||||
|
../browserslist/cli.js
|
|
@ -0,0 +1 @@
|
||||||
|
../eslint/bin/eslint.js
|
|
@ -0,0 +1 @@
|
||||||
|
../eslint-config-prettier/bin/cli.js
|
|
@ -0,0 +1 @@
|
||||||
|
../esprima/bin/esparse.js
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue