summaryrefslogtreecommitdiff
path: root/public/app/views/templates
diff options
context:
space:
mode:
Diffstat (limited to 'public/app/views/templates')
-rw-r--r--public/app/views/templates/course.php93
-rw-r--r--public/app/views/templates/lesson.php82
-rw-r--r--public/app/views/templates/page.php64
-rw-r--r--public/app/views/templates/penalty.php227
4 files changed, 155 insertions, 311 deletions
diff --git a/public/app/views/templates/course.php b/public/app/views/templates/course.php
deleted file mode 100644
index 1d212b8..0000000
--- a/public/app/views/templates/course.php
+++ /dev/null
@@ -1,93 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
-<head>
- <meta charset="utf-8">
- <title><?=SITE_TITLE?> - <?=$title?></title>
-
- <?php // header includes
- ////////////////////////////////////////////////////////////////////////
- Render::view('components/header_includes');
- ?>
-
-</head>
-<body class="classroom">
-
- <?php // top-bar
- ////////////////////////////////////////////////////////////////////////
- Render::view('components/top_bar', [
- 'id' => $id,
- 'label' => $breadcrumbs[ $id ]['rec']['label'],
- 'parents' => $breadcrumbs[ $id ]['parents']
- ]);
- ?>
-
-
-<div class="main-content container">
- <div class="row">
-
- <div class="col col-md-5 col-lg-4 d-sm-none d-md-block side-bar">
-
- <?php // tree of courses
- ////////////////////////////////////////////////////////////////////////
- Render::view('components/courses_menu', [
- 'categories' => $categories,
- 'open_path' => $course_path
- ]);
- ?>
-
- </div>
-
- <div class="col col-sm-12 col-md-7 col-lg-8 course-view">
-
- <!-- Category Title -->
- <h3>
- <?=$breadcrumbs[ $id ]['rec']['label']?>
- </h3>
-
-
- <!-- Sub-Categories -->
- <?php
- Render::view('components/subcategories',[
- 'id' => $id,
- 'breadcrumbs' => $breadcrumbs
- ])
- ?>
-
-
- <!-- Articles List -->
- <?php if ($lessons) : ?>
-
- <h5>Μαθήματα</h5>
-
- <?php // list of posts/articles
- ////////////////////////////////////////////////////
- Render::view("components/lessons_list", [
- 'lessons' => $lessons,
- 'fieldset' => ['intro', 'level'] // ['intro', 'date']
- ]);
- ?>
- <?php endif; ?>
-
-
-
-
- </div>
-
- </div>
- </div>
-
- <footer>
- <div class="container">
-
- <?php // render footer
- ////////////////////////////////////////////////////////////////
- Render::view('components/footer', [ 'entity' => $entity ]);
- ?>
-
- </div>
- </footer>
-
-
- <script src="/assets/js/classroom.js"></script>
-</body>
-</html>
diff --git a/public/app/views/templates/lesson.php b/public/app/views/templates/lesson.php
deleted file mode 100644
index 0867cd3..0000000
--- a/public/app/views/templates/lesson.php
+++ /dev/null
@@ -1,82 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
-<head>
- <meta charset="utf-8">
- <title><?=SITE_TITLE?> - <?=$title?></title>
-
- <?php // header includes
- ////////////////////////////////////////////////////////////////////////
- Render::view('components/header_includes');
- ?>
-
-</head>
-<body class="classroom">
-
- <?php // top-bar
- ////////////////////////////////////////////////////////////////////////
- Render::view('components/top_bar', [
- 'id' => $id,
- 'label' => $breadcrumbs[ $course_id ]['rec']['label'],
- 'parents' => $breadcrumbs[ $course_id ]['parents']
- ]);
- ?>
-
-
-<div class="main-content container">
- <div class="row">
-
- <div class="col col-md-5 col-lg-4 d-sm-none d-md-block side-bar">
-
- <?php // tree of courses
- ////////////////////////////////////////////////////////////////////////
- Render::view('components/courses_menu', [
- 'categories' => $categories,
- 'open_path' => $course_path
- ]);
- ?>
-
- </div>
-
- <div class="col col-sm-12 col-md-7 col-lg-8 lesson-view">
-
- <!-- Lesson Title -->
- <h3>
- <?=$title?>
- </h3>
-
- <!-- intro -->
- <?php if ($lesson['intro'] != "") : ?>
- <p class="intro"><?=$lesson['intro']?></p>
- <?php endif; ?>
-
- <!-- body -->
- <div class="article-body">
- <?php
-
- $parsedown = new Parsedown();
- echo $parsedown->text($lesson['body']);
-
- ?>
- </div>
-
-
- </div>
-
- </div>
- </div>
-
- <footer>
- <div class="container">
-
- <?php // render footer
- ////////////////////////////////////////////////////////////////
- Render::view('components/footer', [ 'entity' => $entity ]);
- ?>
-
- </div>
- </footer>
-
- <script src="/assets/js/classroom.js"></script>
- <script src="/assets/js/lesson-features.js"></script>
-</body>
-</html>
diff --git a/public/app/views/templates/page.php b/public/app/views/templates/page.php
deleted file mode 100644
index 6afe45e..0000000
--- a/public/app/views/templates/page.php
+++ /dev/null
@@ -1,64 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
-<head>
- <meta charset="utf-8">
- <title><?=SITE_TITLE?> - <?=$page['title']?></title>
-
- <?php // header includes
- ////////////////////////////////////////////////////////////////////////
- Render::view('components/header_includes');
- ?>
-
-</head>
-<body class="classroom">
-
- <?php // top-bar
- ////////////////////////////////////////////////////////////////////////
- Render::view('components/top_bar', [
- 'id' => 0,
- 'label' => '',
- 'parents' => []
- ]);
- ?>
-
-
- <div class="main-content container page-container">
-
-
- <div class="lesson-view">
-
- <!-- page Title -->
- <h3>
- <?=$page['title']?>
- </h3>
-
- <!-- page body -->
- <div class="article-body">
- <?php
-
- $parsedown = new Parsedown();
- echo $parsedown->text($page['body']);
-
- ?>
- </div>
-
-
- </div>
-
- </div>
-
- <footer>
- <div class="container">
-
- <?php // render footer
- ////////////////////////////////////////////////////////////////
- Render::view('components/footer', [ 'entity' => $entity ]);
- ?>
-
- </div>
- </footer>
-
- <script src="/assets/js/classroom.js"></script>
- <script src="/assets/js/lesson-features.js"></script>
-</body>
-</html>
diff --git a/public/app/views/templates/penalty.php b/public/app/views/templates/penalty.php
index bbd7b4a..17e5426 100644
--- a/public/app/views/templates/penalty.php
+++ b/public/app/views/templates/penalty.php
@@ -9,115 +9,198 @@
Render::view('components/header_includes');
?>
- <style>
- html,body{
- padding:0; margin:0;
- font-size:1.25em;
- color: #037; background: #f6f6f6;
- line-height:1.2em;
- }
- h3 {
- font-size: 2em; font-style: normal;
- font-weight: 400;
- color: #05a;
- margin: 0; padding: 5px;
- opacity: 0.27;
- border-bottom: 1px solid #05a;
- }
- .container { display: flex; height: 100vh; align-items:center; }
- .content { position: relative;
- max-width: 800px; width: 100%;
- margin: auto auto; padding: .5em;
- justify-center: center;
- font-size: .78em;
- }
- .content-form {
- padding: 1.5em;
- background: #eee;
- border-radius: 8px;
- box-shadow: 1px 5px 7px #7777;
- }
- .content .info { padding: 1.5em; font-size: .92em; }
- .content .info p { padding: .5em; color: #444; font-size: .82em }
- .form-label { margin-bottom: .25rem; }
-
- .select2-container--default .select2-selection--multiple { font-size: 15px; }
- .select2-container--default.select2-container--focus .select2-selection--multiple { line-height: 100%; }
- label { font-size: 14px; }
- </style>
</head>
-<body class="classroom">
- <div class='container'>
- <div class="content">
- <div class="info">
- <!--<h4>1o Γυμνάσιο Ραφήνας</h4>
- <p>1o Γυμνάσιο Ραφήνας: Πλατφόρμα ηλεκτρονικών αιτήσεων και δημιουργίας εγγράφων</p>-->
- </div>
+<body class="office central-form">
+
+<div class='container'>
+ <div class="content max720px">
+
<div class='content-form'>
<form method="post">
<div>
- <h2>Πρακτικό Πειθαρχικής Υπόθεσης</h2>
+ <h4>Πρακτικό Πειθαρχικής Υπόθεσης</h4>
+ <hr />
<?=$form['html']?>
<br />
- <button type="submit" class="btn btn-primary btn-sm col-12">Εγγραφή</button>
+ <button type="submit" class="btn btn-primary btn-sm col-12">Καταχώριση</button>
</div>
</form>
</div>
- <div class="info">
- <p>Απαιτείται η συμπλήρωση όλων των στοιχείων προκειμένου να γίνεται γρήγορα η σύνταξη των εγγράφων. Τα στοιχεία σας δεν πρόκειται να δημοσιοποιηθούν και προστατεύονται κατά την εισαγωγή τους με κρυπτογράφιση AES. Παράλληλα η σύνδεση στο site γίνεται με χρήση πιστοποιητικού SSL (RSA 2048 bits).</p>
- <p>Αν έχετε ενεργοποιήσει ήδη το λογαρισμό σας <a href="/login">μπορείτε να συνδεθείτε</a>.</p>
-
</div>
</div>
-</body>
+</body>
<script>
+var values = {};
+var empty = '';
+
+$(document).ready(function() {
+
+ // supplementary functions to select2 control
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** getValues
+ * --- -- -- - - -
+ * Get selected value(s) of Select2 control
+ *
+ * @param arg: source-element
+ * @return (string) value(s) comma-separated
+ */
+ function getValues(srcElm) {
+ var res;
+ var obj = srcElm.select2('data'); // get delected data array
+
+ if (obj.length === 0) return ''; // if empty list then nothig is selected
+ else {
+ var i = 0;
+ obj.forEach(function(elm){ // loop through object elements array
+
+ if (i) res += ',' + elm.id; // if not first item, prepend ',' befor value(id)
+ else res = elm.id; // else set (first) checked value
+
+ i++;
+ });
+ }
+ return res;
+ }
+
+ /** select2_set_text
+ * --- -- -- - - -
+ * select an (select2-)option by text
+ * onto a (single) select2 control
+ *
+ * @param control = jquery selector,
+ * @param t (string) = text of option
+ */
+ function select2_set_text(control, t) {
+ opts = control.select2()[0].options;
+ var id;
+ for(i=0; i<opts.length; i++) { if (opts[i].text == t) id = i; }
+ control.val(id).trigger('change');
+ }
+
+ /** get_id_of_text
+ * --- -- -- - - -
+ * get id (=value) of an option with `t` as text
+ * onto a select2 control;
+ *
+ * Can be used on single or multiple select2 contols
+ *
+ * @param control = jquery selector,
+ * @param t (string) = text of option
+ */
+ function get_id_of_text( control , t) {
+ opts = control.select2()[0].options;
+ var id = false;
+ for(i=0; i<opts.length; i++) { if (opts[i].text == t) id = i; }
+ return id;
+ }
+
+ /** select2_set_multi_text
+ * --- -- -- - - -
+ * select several (select2-)options by text
+ *
+ * @param control = jquery selector,
+ * @param t_list (string) = list of selected texts
+ */
+ function select2_set_multi_text(control, t_list) { /* define function */
+ var ids = [];
+ t_list.forEach (t => { let id = get_id_of_text(control, t);
+ if (id !== false) ids.push(id);
+ })
+ control.val(ids).change();
+ }
+
+ /**
+ * get selected text of a select2 control
+ */
+ function selected_text(control) {
+ if (typeof control.select2('data') === 'undefined') return false;
+ else if (control.select2('data').length == 0) return false;
+ else return control.select2('data')[0].text;
+ }
+
+ /**
+ * get all selected texts from a multi-select2 contol
+ */
+ function selected_multitexts(control) {
+ if (typeof control.select2('data') === 'undefined') return false;
+ else if (control.select2('data').length == 0) return false;
+ else {
+ var result = [];
+ control.select2('data').forEach( item => { result.push(item.text); });
+ return result;
+ }
+ }
+
+ // intializations from form-definition
+ ////////////////////////////////////////////////////////////////////////////
+
+ <?=$form['init_js']?>
+
+
+ // track empty values
+ ////////////////////////////////////////////////////////////////////////////
+
+
+
+
+
// When form is submited
- // -------------------------------------------------------------------------
+ ////////////////////////////////////////////////////////////////////////////
$('.content-form form').submit( event => {
event.preventDefault();
- if ($('input[name=password]').val() != $('input[name=password2]').val()) {
+ if (false) {
alert('Τα δυο passrods δεν ταιριάζουν!');
} else {
- // prepare data to POST
- var data = {
- first_name: $('input[name=first_name]').val(),
- last_name: $('input[name=last_name]').val(),
- email: $('input[name=email]').val(),
- registration_number: $('input[name=registration_number]').val(),
- sector: $('input[name=sector]').val(),
- belonging_school: $('input[name=belonging_school]').val(),
- working_shcool: $('input[name=working_shcool]').val(),
- position_type_id: $('input[name=position_type_id]').val(),
- phone: $('input[name=phone]').val(),
- password: $('input[name=password]').val()
+ var data = { // select content data
+ of_article: selected_text($('select[name=of_article]')),
+ student_names: $('textarea[name=student_names]').val(),
+ of_department: $('input[name=of_department]').val(),
+ date: $('input[name=date]').val(),
+ time: $('input[name=time]').val(),
+ place: selected_text($('select[name=place]')),
+ rapporteur: selected_text($('select[name=rapporteur]')),
+ charge: $('textarea[name=charge]').val(),
+ apology: $('textarea[name=apology]').val(),
+ decision_reasoning: $('textarea[name=decision_reasoning]').val(),
+ decision: selected_text($('select[name=decision]')),
+ decision_more: $('input[name=decision_more]').val(),
+ president: selected_text($('select[name=president]')),
+ members: selected_multitexts($('select[name="members[]"]'))
};
+ var form_data = { // prepare data to post
+ subject: $('input[name=of_department]').val(),
+ content: JSON.stringify(data),
+ on_date: $('input[name=date]').val(),
+ user_id: $('input[name=id]').val()
+ }
+
// select action url (add or update)
- var request = '/account/register';
+ // var request = '/account/register';
+ console.log(data);
// send POST request
- $.post(request, data)
- .done(function( data ) {
- $('.classroom .content-form').html(data.message)
- });
+ // $.post(request, form_data)
+ // .done(function( data ) {
+ // $('.classroom .content-form').html(data.message)
+ // });
}
});
- <?=$form['init_js']?>
-
- <?=$form['values_js']?>
+ });
</script>
</html>