From bb1c28ae0c4cdfcb4b64722fb69106aed0ec55d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=81Z=C3=81R=20Imre=20AI=20Agent?= Date: Thu, 16 Jul 2026 11:24:46 +0200 Subject: [PATCH] feat(deployed): add TF Learn 1.7.5 (no-source, vetted live) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit TF Learn (Tech Fry) + techfry library 1.3.4; login-gated, no repo -> deployed files. Signed-off-by: LÁZÁR Imre Assisted-by: claude-code@claude-opus-4-8 --- .../components/com_tflearn/access.xml | 12 + .../components/com_tflearn/config.xml | 245 +++++++++ .../com_tflearn/forms/completion.xml | 50 ++ .../components/com_tflearn/forms/course.xml | 85 +++ .../com_tflearn/forms/filter_completions.xml | 50 ++ .../com_tflearn/forms/filter_courses.xml | 30 + .../com_tflearn/forms/filter_lessons.xml | 64 +++ .../com_tflearn/forms/filter_modules.xml | 27 + .../com_tflearn/forms/filter_pages.xml | 11 + .../com_tflearn/forms/filter_questions.xml | 59 ++ .../com_tflearn/forms/filter_scores.xml | 31 ++ .../components/com_tflearn/forms/lesson.xml | 161 ++++++ .../components/com_tflearn/forms/module.xml | 21 + .../components/com_tflearn/forms/page.xml | 25 + .../components/com_tflearn/forms/question.xml | 108 ++++ .../components/com_tflearn/forms/score.xml | 49 ++ .../com_tflearn/forms/subform_content.xml | 20 + .../com_tflearn/forms/subform_matching.xml | 14 + .../com_tflearn/forms/subform_modules.xml | 20 + .../com_tflearn/forms/subform_options.xml | 16 + .../com_tflearn/forms/subform_questions.xml | 9 + .../com_tflearn/forms/subform_resources.xml | 19 + .../language/en-GB/en-GB.com_tflearn.ini | 342 ++++++++++++ .../language/en-GB/en-GB.com_tflearn.sys.ini | 29 + .../components/com_tflearn/script.php | 61 +++ .../com_tflearn/services/provider.php | 47 ++ .../com_tflearn/sql/install.mysql.utf8.sql | 150 +++++ .../com_tflearn/sql/uninstall.mysql.utf8.sql | 0 .../com_tflearn/sql/updates/mysql/1.0.3.sql | 1 + .../com_tflearn/sql/updates/mysql/1.0.4.sql | 3 + .../com_tflearn/sql/updates/mysql/1.0.8.sql | 1 + .../com_tflearn/sql/updates/mysql/1.1.1.sql | 0 .../com_tflearn/sql/updates/mysql/1.1.4.sql | 23 + .../com_tflearn/sql/updates/mysql/1.1.7.sql | 35 ++ .../com_tflearn/sql/updates/mysql/1.1.8.sql | 1 + .../com_tflearn/sql/updates/mysql/1.1.9.sql | 9 + .../com_tflearn/sql/updates/mysql/1.2.0.sql | 3 + .../com_tflearn/sql/updates/mysql/1.2.2.sql | 0 .../com_tflearn/sql/updates/mysql/1.2.4.sql | 17 + .../com_tflearn/sql/updates/mysql/1.2.6.sql | 0 .../com_tflearn/sql/updates/mysql/1.2.8.sql | 1 + .../com_tflearn/sql/updates/mysql/1.2.9.sql | 0 .../com_tflearn/sql/updates/mysql/1.3.0.sql | 3 + .../com_tflearn/sql/updates/mysql/1.3.2.sql | 1 + .../com_tflearn/sql/updates/mysql/1.3.4.sql | 7 + .../com_tflearn/sql/updates/mysql/1.3.7.sql | 1 + .../com_tflearn/sql/updates/mysql/1.3.9.sql | 1 + .../com_tflearn/sql/updates/mysql/1.4.0.sql | 0 .../com_tflearn/sql/updates/mysql/1.4.1.sql | 1 + .../com_tflearn/sql/updates/mysql/1.4.4.sql | 17 + .../com_tflearn/sql/updates/mysql/1.4.5.sql | 1 + .../com_tflearn/sql/updates/mysql/1.4.8.sql | 1 + .../com_tflearn/sql/updates/mysql/1.5.3.sql | 1 + .../com_tflearn/sql/updates/mysql/1.5.6.sql | 16 + .../com_tflearn/sql/updates/mysql/1.5.7.sql | 1 + .../com_tflearn/sql/updates/mysql/1.6.7.sql | 9 + .../com_tflearn/sql/updates/mysql/1.7.1.sql | 7 + .../src/Controller/CompletionController.php | 16 + .../src/Controller/CompletionsController.php | 21 + .../src/Controller/CourseController.php | 16 + .../src/Controller/CoursesController.php | 21 + .../src/Controller/DisplayController.php | 21 + .../src/Controller/ExportController.php | 16 + .../src/Controller/ImportController.php | 16 + .../src/Controller/LessonController.php | 16 + .../src/Controller/LessonsController.php | 21 + .../src/Controller/ModuleController.php | 16 + .../src/Controller/ModulesController.php | 21 + .../src/Controller/PageController.php | 16 + .../src/Controller/PagesController.php | 21 + .../src/Controller/QueryController.php | 16 + .../src/Controller/QuestionController.php | 16 + .../src/Controller/QuestionsController.php | 21 + .../src/Controller/ScoreController.php | 16 + .../src/Controller/ScoresController.php | 21 + .../src/Extension/TfLearnComponent.php | 33 ++ .../com_tflearn/src/Model/CompletionModel.php | 47 ++ .../src/Model/CompletionsModel.php | 149 +++++ .../com_tflearn/src/Model/CourseModel.php | 23 + .../com_tflearn/src/Model/CoursesModel.php | 25 + .../com_tflearn/src/Model/DashboardModel.php | 16 + .../com_tflearn/src/Model/ExportModel.php | 29 + .../com_tflearn/src/Model/ImportModel.php | 26 + .../com_tflearn/src/Model/LessonModel.php | 23 + .../com_tflearn/src/Model/LessonsModel.php | 33 ++ .../com_tflearn/src/Model/ModuleModel.php | 21 + .../com_tflearn/src/Model/ModulesModel.php | 23 + .../com_tflearn/src/Model/PageModel.php | 21 + .../com_tflearn/src/Model/PagesModel.php | 25 + .../com_tflearn/src/Model/QueryModel.php | 22 + .../com_tflearn/src/Model/QuestionModel.php | 23 + .../com_tflearn/src/Model/QuestionsModel.php | 49 ++ .../com_tflearn/src/Model/ScoreModel.php | 40 ++ .../com_tflearn/src/Model/ScoresModel.php | 28 + .../com_tflearn/src/Table/CompletionTable.php | 20 + .../com_tflearn/src/Table/CourseTable.php | 20 + .../com_tflearn/src/Table/LessonTable.php | 20 + .../com_tflearn/src/Table/ModuleTable.php | 20 + .../com_tflearn/src/Table/PageTable.php | 20 + .../com_tflearn/src/Table/QuestionTable.php | 20 + .../com_tflearn/src/Table/ScoreTable.php | 20 + .../src/View/Completion/HtmlView.php | 18 + .../src/View/Completions/HtmlView.php | 20 + .../com_tflearn/src/View/Course/HtmlView.php | 18 + .../com_tflearn/src/View/Courses/HtmlView.php | 20 + .../src/View/Dashboard/HtmlView.php | 16 + .../com_tflearn/src/View/Export/HtmlView.php | 16 + .../com_tflearn/src/View/Import/HtmlView.php | 16 + .../com_tflearn/src/View/Lesson/HtmlView.php | 18 + .../com_tflearn/src/View/Lessons/HtmlView.php | 20 + .../com_tflearn/src/View/Module/HtmlView.php | 18 + .../com_tflearn/src/View/Modules/HtmlView.php | 20 + .../com_tflearn/src/View/Page/HtmlView.php | 18 + .../com_tflearn/src/View/Pages/HtmlView.php | 20 + .../com_tflearn/src/View/Query/HtmlView.php | 16 + .../src/View/Question/HtmlView.php | 18 + .../src/View/Questions/HtmlView.php | 20 + .../com_tflearn/src/View/Score/HtmlView.php | 18 + .../com_tflearn/src/View/Scores/HtmlView.php | 20 + .../components/com_tflearn/tflearn.xml | 67 +++ .../com_tflearn/tmpl/completion/edit.php | 16 + .../com_tflearn/tmpl/completions/default.php | 51 ++ .../tmpl/completions/emptystate.php | 10 + .../com_tflearn/tmpl/course/edit.php | 20 + .../com_tflearn/tmpl/courses/default.php | 58 ++ .../com_tflearn/tmpl/courses/emptystate.php | 10 + .../com_tflearn/tmpl/dashboard/default.php | 26 + .../com_tflearn/tmpl/export/default.php | 16 + .../com_tflearn/tmpl/import/default.php | 10 + .../com_tflearn/tmpl/lesson/edit.php | 24 + .../com_tflearn/tmpl/lessons/default.php | 58 ++ .../com_tflearn/tmpl/lessons/emptystate.php | 10 + .../com_tflearn/tmpl/module/edit.php | 16 + .../com_tflearn/tmpl/modules/default.php | 40 ++ .../com_tflearn/tmpl/modules/emptystate.php | 10 + .../components/com_tflearn/tmpl/page/edit.php | 16 + .../com_tflearn/tmpl/pages/default.php | 44 ++ .../com_tflearn/tmpl/pages/emptystate.php | 10 + .../com_tflearn/tmpl/query/default.php | 14 + .../com_tflearn/tmpl/question/edit.php | 18 + .../com_tflearn/tmpl/questions/default.php | 42 ++ .../com_tflearn/tmpl/questions/emptystate.php | 10 + .../com_tflearn/tmpl/score/edit.php | 18 + .../com_tflearn/tmpl/score/edit_attempts.php | 40 ++ .../com_tflearn/tmpl/scores/default.php | 44 ++ .../com_tflearn/tmpl/scores/emptystate.php | 10 + .../components/com_tflearn/forms/test.xml | 29 + .../language/en-GB/en-GB.com_tflearn.ini | 57 ++ .../src/Controller/CompletionController.php | 51 ++ .../src/Controller/CourseController.php | 121 +++++ .../src/Controller/DisplayController.php | 20 + .../src/Controller/TestController.php | 35 ++ .../com_tflearn/src/Model/CompletionModel.php | 76 +++ .../com_tflearn/src/Model/CourseModel.php | 34 ++ .../com_tflearn/src/Model/CoursesModel.php | 36 ++ .../com_tflearn/src/Model/PageModel.php | 78 +++ .../com_tflearn/src/Model/PathModel.php | 100 ++++ .../com_tflearn/src/Model/PathsModel.php | 87 +++ .../com_tflearn/src/Model/ScoreModel.php | 48 ++ .../com_tflearn/src/Model/ScoresModel.php | 38 ++ .../com_tflearn/src/Model/TestModel.php | 303 +++++++++++ .../com_tflearn/src/Service/Router.php | 87 +++ .../com_tflearn/src/View/Course/HtmlView.php | 24 + .../com_tflearn/src/View/Courses/FeedView.php | 24 + .../com_tflearn/src/View/Courses/HtmlView.php | 31 ++ .../com_tflearn/src/View/Page/HtmlView.php | 45 ++ .../com_tflearn/src/View/Path/HtmlView.php | 36 ++ .../com_tflearn/src/View/Paths/HtmlView.php | 22 + .../com_tflearn/src/View/Score/HtmlView.php | 28 + .../com_tflearn/src/View/Scores/HtmlView.php | 24 + .../com_tflearn/src/View/Test/HtmlView.php | 91 ++++ .../com_tflearn/tmpl/course/default.php | 92 ++++ .../tmpl/course/default_button.php | 21 + .../tmpl/course/default_layout_accordion.php | 11 + .../tmpl/course/default_layout_plain.php | 11 + .../tmpl/course/default_layout_tabs.php | 11 + .../tmpl/course/default_lesson.php | 41 ++ .../com_tflearn/tmpl/course/default_tfsd.php | 26 + .../com_tflearn/tmpl/courses/default.php | 68 +++ .../com_tflearn/tmpl/courses/default.xml | 62 +++ .../com_tflearn/tmpl/courses/default_tfsd.php | 33 ++ .../com_tflearn/tmpl/page/default.php | 47 ++ .../tmpl/page/default_navigation.php | 28 + .../com_tflearn/tmpl/page/default_section.php | 81 +++ .../tmpl/page/default_sections.php | 57 ++ .../com_tflearn/tmpl/path/default.php | 71 +++ .../tmpl/path/default_completion.php | 23 + .../tmpl/path/default_layout_accordion.php | 11 + .../tmpl/path/default_layout_plain.php | 11 + .../tmpl/path/default_layout_tabs.php | 11 + .../com_tflearn/tmpl/path/default_lesson.php | 74 +++ .../com_tflearn/tmpl/paths/default.php | 76 +++ .../com_tflearn/tmpl/paths/default.xml | 33 ++ .../com_tflearn/tmpl/score/default.php | 37 ++ .../tmpl/score/default_question_type1.php | 33 ++ .../tmpl/score/default_question_type2.php | 35 ++ .../tmpl/score/default_question_type3.php | 15 + .../tmpl/score/default_question_type4.php | 15 + .../tmpl/score/default_question_type5.php | 38 ++ .../tmpl/score/default_question_type6.php | 47 ++ .../tmpl/score/default_question_type7.php | 9 + .../com_tflearn/tmpl/scores/default.php | 37 ++ .../com_tflearn/tmpl/scores/default.xml | 21 + .../com_tflearn/tmpl/test/default.php | 60 ++ .../tmpl/test/default_question_title.php | 13 + .../tmpl/test/default_question_type1.php | 28 + .../tmpl/test/default_question_type2.php | 29 + .../tmpl/test/default_question_type3.php | 18 + .../tmpl/test/default_question_type4.php | 18 + .../tmpl/test/default_question_type5.php | 46 ++ .../tmpl/test/default_question_type6.php | 24 + .../tmpl/test/default_question_type7.php | 12 + .../tflearn/libraries/techfry/forms/blank.xml | 5 + .../libraries/techfry/forms/bs/accordion.xml | 14 + .../libraries/techfry/forms/bs/alert.xml | 14 + .../libraries/techfry/forms/bs/badge.xml | 10 + .../techfry/forms/bs/button_link.xml | 18 + .../libraries/techfry/forms/bs/iconbox.xml | 36 ++ .../libraries/techfry/forms/bs/progress.xml | 10 + .../libraries/techfry/forms/bs/social.xml | 15 + .../techfry/forms/bs/u_background.xml | 60 ++ .../libraries/techfry/forms/bs/u_border.xml | 65 +++ .../libraries/techfry/forms/bs/u_spacing.xml | 68 +++ .../libraries/techfry/forms/bs/u_text.xml | 65 +++ .../libraries/techfry/forms/button.xml | 14 + .../libraries/techfry/forms/export.xml | 48 ++ .../techfry/forms/fields/calendar.xml | 82 +++ .../techfry/forms/fields/checkboxes.xml | 10 + .../libraries/techfry/forms/fields/color.xml | 14 + .../libraries/techfry/forms/fields/email.xml | 10 + .../libraries/techfry/forms/fields/file.xml | 14 + .../techfry/forms/fields/filelist.xml | 29 + .../techfry/forms/fields/folderlist.xml | 29 + .../techfry/forms/fields/imagelist.xml | 29 + .../techfry/forms/fields/integer.xml | 19 + .../libraries/techfry/forms/fields/list.xml | 22 + .../libraries/techfry/forms/fields/note.xml | 19 + .../libraries/techfry/forms/fields/number.xml | 19 + .../techfry/forms/fields/password.xml | 10 + .../libraries/techfry/forms/fields/radio.xml | 12 + .../libraries/techfry/forms/fields/range.xml | 19 + .../techfry/forms/fields/subform.xml | 23 + .../libraries/techfry/forms/fields/tel.xml | 5 + .../libraries/techfry/forms/fields/text.xml | 9 + .../techfry/forms/fields/textarea.xml | 14 + .../libraries/techfry/forms/fields/url.xml | 19 + .../libraries/techfry/forms/import.xml | 26 + .../tflearn/libraries/techfry/forms/query.xml | 172 ++++++ .../techfry/forms/subform_filterarticles.xml | 34 ++ .../techfry/forms/subform_filterusers.xml | 35 ++ .../libraries/techfry/forms/subform_where.xml | 29 + .../src/Controller/TfControllerAdmin.php | 46 ++ .../src/Controller/TfControllerExport.php | 212 ++++++++ .../src/Controller/TfControllerForm.php | 16 + .../src/Controller/TfControllerFormFront.php | 139 +++++ .../src/Controller/TfControllerImport.php | 219 ++++++++ .../src/Controller/TfControllerQuery.php | 430 +++++++++++++++ .../src/Model/Back/TfModelDashboard.php | 98 ++++ .../techfry/src/Model/Back/TfModelForm.php | 402 ++++++++++++++ .../techfry/src/Model/Back/TfModelList.php | 393 ++++++++++++++ .../techfry/src/Model/Back/TfModelSelect.php | 28 + .../techfry/src/Model/Front/TfModelForm.php | 273 ++++++++++ .../techfry/src/Model/Front/TfModelItem.php | 101 ++++ .../techfry/src/Model/Front/TfModelList.php | 105 ++++ .../libraries/techfry/src/Model/TfModel.php | 16 + .../techfry/src/Model/TfModelExport.php | 145 +++++ .../techfry/src/Model/TfModelImport.php | 116 ++++ .../techfry/src/Model/TfModelQuery.php | 160 ++++++ .../techfry/src/Model/TfModelTrait.php | 341 ++++++++++++ .../tflearn/libraries/techfry/src/TfAlpha.php | 145 +++++ .../tflearn/libraries/techfry/src/TfAmp.php | 65 +++ .../tflearn/libraries/techfry/src/TfApi.php | 71 +++ .../tflearn/libraries/techfry/src/TfArray.php | 67 +++ .../libraries/techfry/src/TfArticle.php | 335 ++++++++++++ .../tflearn/libraries/techfry/src/TfDate.php | 97 ++++ .../tflearn/libraries/techfry/src/TfDb.php | 360 ++++++++++++ .../tflearn/libraries/techfry/src/TfDom.php | 230 ++++++++ .../tflearn/libraries/techfry/src/TfFile.php | 64 +++ .../tflearn/libraries/techfry/src/TfHtml.php | 242 +++++++++ .../tflearn/libraries/techfry/src/TfImg.php | 423 +++++++++++++++ .../tflearn/libraries/techfry/src/TfModal.php | 59 ++ .../libraries/techfry/src/TfNotify.php | 70 +++ .../libraries/techfry/src/TfNumeric.php | 138 +++++ .../libraries/techfry/src/TfResource.php | 59 ++ .../tflearn/libraries/techfry/src/TfSd.php | 138 +++++ .../libraries/techfry/src/TfString.php | 128 +++++ .../tflearn/libraries/techfry/src/TfUser.php | 473 ++++++++++++++++ .../tflearn/libraries/techfry/src/TfXml.php | 412 ++++++++++++++ .../techfry/src/View/Air/Accordion.php | 71 +++ .../libraries/techfry/src/View/Air/Alert.php | 41 ++ .../libraries/techfry/src/View/Air/Badge.php | 40 ++ .../libraries/techfry/src/View/Air/Button.php | 39 ++ .../libraries/techfry/src/View/Air/Card.php | 75 +++ .../techfry/src/View/Air/Carousel.php | 81 +++ .../techfry/src/View/Air/Gallery.php | 63 +++ .../libraries/techfry/src/View/Air/Icon.php | 40 ++ .../techfry/src/View/Air/Iconbox.php | 45 ++ .../techfry/src/View/Air/Iconlist.php | 57 ++ .../techfry/src/View/Air/Imagebox.php | 49 ++ .../libraries/techfry/src/View/Air/Modal.php | 58 ++ .../techfry/src/View/Air/Offcanvas.php | 70 +++ .../libraries/techfry/src/View/Air/Plain.php | 34 ++ .../techfry/src/View/Air/Progress.php | 41 ++ .../libraries/techfry/src/View/Air/Search.php | 58 ++ .../libraries/techfry/src/View/Air/Tabs.php | 89 +++ .../techfry/src/View/Back/TfView.php | 291 ++++++++++ .../techfry/src/View/Back/TfViewDashboard.php | 233 ++++++++ .../techfry/src/View/Back/TfViewForm.php | 306 +++++++++++ .../techfry/src/View/Back/TfViewList.php | 511 ++++++++++++++++++ .../techfry/src/View/Back/TfViewSelect.php | 83 +++ .../techfry/src/View/Bs/Accordion.php | 71 +++ .../libraries/techfry/src/View/Bs/Alert.php | 46 ++ .../libraries/techfry/src/View/Bs/Badge.php | 54 ++ .../libraries/techfry/src/View/Bs/Button.php | 54 ++ .../libraries/techfry/src/View/Bs/Card.php | 75 +++ .../techfry/src/View/Bs/Carousel.php | 110 ++++ .../libraries/techfry/src/View/Bs/Gallery.php | 74 +++ .../libraries/techfry/src/View/Bs/Grid.php | 43 ++ .../libraries/techfry/src/View/Bs/Icon.php | 42 ++ .../libraries/techfry/src/View/Bs/Iconbox.php | 45 ++ .../techfry/src/View/Bs/Iconlist.php | 57 ++ .../techfry/src/View/Bs/Imagebox.php | 49 ++ .../libraries/techfry/src/View/Bs/Modal.php | 59 ++ .../libraries/techfry/src/View/Bs/Plain.php | 34 ++ .../techfry/src/View/Bs/Progress.php | 49 ++ .../libraries/techfry/src/View/Bs/Search.php | 59 ++ .../libraries/techfry/src/View/Bs/Tabs.php | 67 +++ .../libraries/techfry/src/View/Bs/Utility.php | 61 +++ .../techfry/src/View/Front/TfView.php | 184 +++++++ .../techfry/src/View/Front/TfViewFeed.php | 98 ++++ .../techfry/src/View/Front/TfViewForm.php | 171 ++++++ .../techfry/src/View/Front/TfViewItem.php | 84 +++ .../techfry/src/View/Front/TfViewList.php | 121 +++++ .../techfry/src/View/Others/Youtube.php | 36 ++ .../techfry/src/View/TfViewExport.php | 36 ++ .../techfry/src/View/TfViewImport.php | 47 ++ .../techfry/src/View/TfViewQuery.php | 36 ++ .../tflearn/libraries/techfry/techfry.xml | 29 + deployed/tflearn/media/techfry/css/grid.css | 34 ++ 339 files changed, 19298 insertions(+) create mode 100644 deployed/tflearn/administrator/components/com_tflearn/access.xml create mode 100644 deployed/tflearn/administrator/components/com_tflearn/config.xml create mode 100644 deployed/tflearn/administrator/components/com_tflearn/forms/completion.xml create mode 100644 deployed/tflearn/administrator/components/com_tflearn/forms/course.xml create mode 100644 deployed/tflearn/administrator/components/com_tflearn/forms/filter_completions.xml create mode 100644 deployed/tflearn/administrator/components/com_tflearn/forms/filter_courses.xml create mode 100644 deployed/tflearn/administrator/components/com_tflearn/forms/filter_lessons.xml create mode 100644 deployed/tflearn/administrator/components/com_tflearn/forms/filter_modules.xml create mode 100644 deployed/tflearn/administrator/components/com_tflearn/forms/filter_pages.xml create mode 100644 deployed/tflearn/administrator/components/com_tflearn/forms/filter_questions.xml create mode 100644 deployed/tflearn/administrator/components/com_tflearn/forms/filter_scores.xml create mode 100644 deployed/tflearn/administrator/components/com_tflearn/forms/lesson.xml create mode 100644 deployed/tflearn/administrator/components/com_tflearn/forms/module.xml create mode 100644 deployed/tflearn/administrator/components/com_tflearn/forms/page.xml create mode 100644 deployed/tflearn/administrator/components/com_tflearn/forms/question.xml create mode 100644 deployed/tflearn/administrator/components/com_tflearn/forms/score.xml create mode 100644 deployed/tflearn/administrator/components/com_tflearn/forms/subform_content.xml create mode 100644 deployed/tflearn/administrator/components/com_tflearn/forms/subform_matching.xml create mode 100644 deployed/tflearn/administrator/components/com_tflearn/forms/subform_modules.xml create mode 100644 deployed/tflearn/administrator/components/com_tflearn/forms/subform_options.xml create mode 100644 deployed/tflearn/administrator/components/com_tflearn/forms/subform_questions.xml create mode 100644 deployed/tflearn/administrator/components/com_tflearn/forms/subform_resources.xml create mode 100644 deployed/tflearn/administrator/components/com_tflearn/language/en-GB/en-GB.com_tflearn.ini create mode 100644 deployed/tflearn/administrator/components/com_tflearn/language/en-GB/en-GB.com_tflearn.sys.ini create mode 100644 deployed/tflearn/administrator/components/com_tflearn/script.php create mode 100644 deployed/tflearn/administrator/components/com_tflearn/services/provider.php create mode 100644 deployed/tflearn/administrator/components/com_tflearn/sql/install.mysql.utf8.sql create mode 100644 deployed/tflearn/administrator/components/com_tflearn/sql/uninstall.mysql.utf8.sql create mode 100644 deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.0.3.sql create mode 100644 deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.0.4.sql create mode 100644 deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.0.8.sql create mode 100644 deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.1.1.sql create mode 100644 deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.1.4.sql create mode 100644 deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.1.7.sql create mode 100644 deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.1.8.sql create mode 100644 deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.1.9.sql create mode 100644 deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.2.0.sql create mode 100644 deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.2.2.sql create mode 100644 deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.2.4.sql create mode 100644 deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.2.6.sql create mode 100644 deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.2.8.sql create mode 100644 deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.2.9.sql create mode 100644 deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.3.0.sql create mode 100644 deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.3.2.sql create mode 100644 deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.3.4.sql create mode 100644 deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.3.7.sql create mode 100644 deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.3.9.sql create mode 100644 deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.4.0.sql create mode 100644 deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.4.1.sql create mode 100644 deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.4.4.sql create mode 100644 deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.4.5.sql create mode 100644 deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.4.8.sql create mode 100644 deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.5.3.sql create mode 100644 deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.5.6.sql create mode 100644 deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.5.7.sql create mode 100644 deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.6.7.sql create mode 100644 deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.7.1.sql create mode 100644 deployed/tflearn/administrator/components/com_tflearn/src/Controller/CompletionController.php create mode 100644 deployed/tflearn/administrator/components/com_tflearn/src/Controller/CompletionsController.php create mode 100644 deployed/tflearn/administrator/components/com_tflearn/src/Controller/CourseController.php create mode 100644 deployed/tflearn/administrator/components/com_tflearn/src/Controller/CoursesController.php create mode 100644 deployed/tflearn/administrator/components/com_tflearn/src/Controller/DisplayController.php create mode 100644 deployed/tflearn/administrator/components/com_tflearn/src/Controller/ExportController.php create mode 100644 deployed/tflearn/administrator/components/com_tflearn/src/Controller/ImportController.php create mode 100644 deployed/tflearn/administrator/components/com_tflearn/src/Controller/LessonController.php create mode 100644 deployed/tflearn/administrator/components/com_tflearn/src/Controller/LessonsController.php create mode 100644 deployed/tflearn/administrator/components/com_tflearn/src/Controller/ModuleController.php create mode 100644 deployed/tflearn/administrator/components/com_tflearn/src/Controller/ModulesController.php create mode 100644 deployed/tflearn/administrator/components/com_tflearn/src/Controller/PageController.php create mode 100644 deployed/tflearn/administrator/components/com_tflearn/src/Controller/PagesController.php create mode 100644 deployed/tflearn/administrator/components/com_tflearn/src/Controller/QueryController.php create mode 100644 deployed/tflearn/administrator/components/com_tflearn/src/Controller/QuestionController.php create mode 100644 deployed/tflearn/administrator/components/com_tflearn/src/Controller/QuestionsController.php create mode 100644 deployed/tflearn/administrator/components/com_tflearn/src/Controller/ScoreController.php create mode 100644 deployed/tflearn/administrator/components/com_tflearn/src/Controller/ScoresController.php create mode 100644 deployed/tflearn/administrator/components/com_tflearn/src/Extension/TfLearnComponent.php create mode 100644 deployed/tflearn/administrator/components/com_tflearn/src/Model/CompletionModel.php create mode 100644 deployed/tflearn/administrator/components/com_tflearn/src/Model/CompletionsModel.php create mode 100644 deployed/tflearn/administrator/components/com_tflearn/src/Model/CourseModel.php create mode 100644 deployed/tflearn/administrator/components/com_tflearn/src/Model/CoursesModel.php create mode 100644 deployed/tflearn/administrator/components/com_tflearn/src/Model/DashboardModel.php create mode 100644 deployed/tflearn/administrator/components/com_tflearn/src/Model/ExportModel.php create mode 100644 deployed/tflearn/administrator/components/com_tflearn/src/Model/ImportModel.php create mode 100644 deployed/tflearn/administrator/components/com_tflearn/src/Model/LessonModel.php create mode 100644 deployed/tflearn/administrator/components/com_tflearn/src/Model/LessonsModel.php create mode 100644 deployed/tflearn/administrator/components/com_tflearn/src/Model/ModuleModel.php create mode 100644 deployed/tflearn/administrator/components/com_tflearn/src/Model/ModulesModel.php create mode 100644 deployed/tflearn/administrator/components/com_tflearn/src/Model/PageModel.php create mode 100644 deployed/tflearn/administrator/components/com_tflearn/src/Model/PagesModel.php create mode 100644 deployed/tflearn/administrator/components/com_tflearn/src/Model/QueryModel.php create mode 100644 deployed/tflearn/administrator/components/com_tflearn/src/Model/QuestionModel.php create mode 100644 deployed/tflearn/administrator/components/com_tflearn/src/Model/QuestionsModel.php create mode 100644 deployed/tflearn/administrator/components/com_tflearn/src/Model/ScoreModel.php create mode 100644 deployed/tflearn/administrator/components/com_tflearn/src/Model/ScoresModel.php create mode 100644 deployed/tflearn/administrator/components/com_tflearn/src/Table/CompletionTable.php create mode 100644 deployed/tflearn/administrator/components/com_tflearn/src/Table/CourseTable.php create mode 100644 deployed/tflearn/administrator/components/com_tflearn/src/Table/LessonTable.php create mode 100644 deployed/tflearn/administrator/components/com_tflearn/src/Table/ModuleTable.php create mode 100644 deployed/tflearn/administrator/components/com_tflearn/src/Table/PageTable.php create mode 100644 deployed/tflearn/administrator/components/com_tflearn/src/Table/QuestionTable.php create mode 100644 deployed/tflearn/administrator/components/com_tflearn/src/Table/ScoreTable.php create mode 100644 deployed/tflearn/administrator/components/com_tflearn/src/View/Completion/HtmlView.php create mode 100644 deployed/tflearn/administrator/components/com_tflearn/src/View/Completions/HtmlView.php create mode 100644 deployed/tflearn/administrator/components/com_tflearn/src/View/Course/HtmlView.php create mode 100644 deployed/tflearn/administrator/components/com_tflearn/src/View/Courses/HtmlView.php create mode 100644 deployed/tflearn/administrator/components/com_tflearn/src/View/Dashboard/HtmlView.php create mode 100644 deployed/tflearn/administrator/components/com_tflearn/src/View/Export/HtmlView.php create mode 100644 deployed/tflearn/administrator/components/com_tflearn/src/View/Import/HtmlView.php create mode 100644 deployed/tflearn/administrator/components/com_tflearn/src/View/Lesson/HtmlView.php create mode 100644 deployed/tflearn/administrator/components/com_tflearn/src/View/Lessons/HtmlView.php create mode 100644 deployed/tflearn/administrator/components/com_tflearn/src/View/Module/HtmlView.php create mode 100644 deployed/tflearn/administrator/components/com_tflearn/src/View/Modules/HtmlView.php create mode 100644 deployed/tflearn/administrator/components/com_tflearn/src/View/Page/HtmlView.php create mode 100644 deployed/tflearn/administrator/components/com_tflearn/src/View/Pages/HtmlView.php create mode 100644 deployed/tflearn/administrator/components/com_tflearn/src/View/Query/HtmlView.php create mode 100644 deployed/tflearn/administrator/components/com_tflearn/src/View/Question/HtmlView.php create mode 100644 deployed/tflearn/administrator/components/com_tflearn/src/View/Questions/HtmlView.php create mode 100644 deployed/tflearn/administrator/components/com_tflearn/src/View/Score/HtmlView.php create mode 100644 deployed/tflearn/administrator/components/com_tflearn/src/View/Scores/HtmlView.php create mode 100644 deployed/tflearn/administrator/components/com_tflearn/tflearn.xml create mode 100644 deployed/tflearn/administrator/components/com_tflearn/tmpl/completion/edit.php create mode 100644 deployed/tflearn/administrator/components/com_tflearn/tmpl/completions/default.php create mode 100644 deployed/tflearn/administrator/components/com_tflearn/tmpl/completions/emptystate.php create mode 100644 deployed/tflearn/administrator/components/com_tflearn/tmpl/course/edit.php create mode 100644 deployed/tflearn/administrator/components/com_tflearn/tmpl/courses/default.php create mode 100644 deployed/tflearn/administrator/components/com_tflearn/tmpl/courses/emptystate.php create mode 100644 deployed/tflearn/administrator/components/com_tflearn/tmpl/dashboard/default.php create mode 100644 deployed/tflearn/administrator/components/com_tflearn/tmpl/export/default.php create mode 100644 deployed/tflearn/administrator/components/com_tflearn/tmpl/import/default.php create mode 100644 deployed/tflearn/administrator/components/com_tflearn/tmpl/lesson/edit.php create mode 100644 deployed/tflearn/administrator/components/com_tflearn/tmpl/lessons/default.php create mode 100644 deployed/tflearn/administrator/components/com_tflearn/tmpl/lessons/emptystate.php create mode 100644 deployed/tflearn/administrator/components/com_tflearn/tmpl/module/edit.php create mode 100644 deployed/tflearn/administrator/components/com_tflearn/tmpl/modules/default.php create mode 100644 deployed/tflearn/administrator/components/com_tflearn/tmpl/modules/emptystate.php create mode 100644 deployed/tflearn/administrator/components/com_tflearn/tmpl/page/edit.php create mode 100644 deployed/tflearn/administrator/components/com_tflearn/tmpl/pages/default.php create mode 100644 deployed/tflearn/administrator/components/com_tflearn/tmpl/pages/emptystate.php create mode 100644 deployed/tflearn/administrator/components/com_tflearn/tmpl/query/default.php create mode 100644 deployed/tflearn/administrator/components/com_tflearn/tmpl/question/edit.php create mode 100644 deployed/tflearn/administrator/components/com_tflearn/tmpl/questions/default.php create mode 100644 deployed/tflearn/administrator/components/com_tflearn/tmpl/questions/emptystate.php create mode 100644 deployed/tflearn/administrator/components/com_tflearn/tmpl/score/edit.php create mode 100644 deployed/tflearn/administrator/components/com_tflearn/tmpl/score/edit_attempts.php create mode 100644 deployed/tflearn/administrator/components/com_tflearn/tmpl/scores/default.php create mode 100644 deployed/tflearn/administrator/components/com_tflearn/tmpl/scores/emptystate.php create mode 100644 deployed/tflearn/components/com_tflearn/forms/test.xml create mode 100644 deployed/tflearn/components/com_tflearn/language/en-GB/en-GB.com_tflearn.ini create mode 100644 deployed/tflearn/components/com_tflearn/src/Controller/CompletionController.php create mode 100644 deployed/tflearn/components/com_tflearn/src/Controller/CourseController.php create mode 100644 deployed/tflearn/components/com_tflearn/src/Controller/DisplayController.php create mode 100644 deployed/tflearn/components/com_tflearn/src/Controller/TestController.php create mode 100644 deployed/tflearn/components/com_tflearn/src/Model/CompletionModel.php create mode 100644 deployed/tflearn/components/com_tflearn/src/Model/CourseModel.php create mode 100644 deployed/tflearn/components/com_tflearn/src/Model/CoursesModel.php create mode 100644 deployed/tflearn/components/com_tflearn/src/Model/PageModel.php create mode 100644 deployed/tflearn/components/com_tflearn/src/Model/PathModel.php create mode 100644 deployed/tflearn/components/com_tflearn/src/Model/PathsModel.php create mode 100644 deployed/tflearn/components/com_tflearn/src/Model/ScoreModel.php create mode 100644 deployed/tflearn/components/com_tflearn/src/Model/ScoresModel.php create mode 100644 deployed/tflearn/components/com_tflearn/src/Model/TestModel.php create mode 100644 deployed/tflearn/components/com_tflearn/src/Service/Router.php create mode 100644 deployed/tflearn/components/com_tflearn/src/View/Course/HtmlView.php create mode 100644 deployed/tflearn/components/com_tflearn/src/View/Courses/FeedView.php create mode 100644 deployed/tflearn/components/com_tflearn/src/View/Courses/HtmlView.php create mode 100644 deployed/tflearn/components/com_tflearn/src/View/Page/HtmlView.php create mode 100644 deployed/tflearn/components/com_tflearn/src/View/Path/HtmlView.php create mode 100644 deployed/tflearn/components/com_tflearn/src/View/Paths/HtmlView.php create mode 100644 deployed/tflearn/components/com_tflearn/src/View/Score/HtmlView.php create mode 100644 deployed/tflearn/components/com_tflearn/src/View/Scores/HtmlView.php create mode 100644 deployed/tflearn/components/com_tflearn/src/View/Test/HtmlView.php create mode 100644 deployed/tflearn/components/com_tflearn/tmpl/course/default.php create mode 100644 deployed/tflearn/components/com_tflearn/tmpl/course/default_button.php create mode 100644 deployed/tflearn/components/com_tflearn/tmpl/course/default_layout_accordion.php create mode 100644 deployed/tflearn/components/com_tflearn/tmpl/course/default_layout_plain.php create mode 100644 deployed/tflearn/components/com_tflearn/tmpl/course/default_layout_tabs.php create mode 100644 deployed/tflearn/components/com_tflearn/tmpl/course/default_lesson.php create mode 100644 deployed/tflearn/components/com_tflearn/tmpl/course/default_tfsd.php create mode 100644 deployed/tflearn/components/com_tflearn/tmpl/courses/default.php create mode 100644 deployed/tflearn/components/com_tflearn/tmpl/courses/default.xml create mode 100644 deployed/tflearn/components/com_tflearn/tmpl/courses/default_tfsd.php create mode 100644 deployed/tflearn/components/com_tflearn/tmpl/page/default.php create mode 100644 deployed/tflearn/components/com_tflearn/tmpl/page/default_navigation.php create mode 100644 deployed/tflearn/components/com_tflearn/tmpl/page/default_section.php create mode 100644 deployed/tflearn/components/com_tflearn/tmpl/page/default_sections.php create mode 100644 deployed/tflearn/components/com_tflearn/tmpl/path/default.php create mode 100644 deployed/tflearn/components/com_tflearn/tmpl/path/default_completion.php create mode 100644 deployed/tflearn/components/com_tflearn/tmpl/path/default_layout_accordion.php create mode 100644 deployed/tflearn/components/com_tflearn/tmpl/path/default_layout_plain.php create mode 100644 deployed/tflearn/components/com_tflearn/tmpl/path/default_layout_tabs.php create mode 100644 deployed/tflearn/components/com_tflearn/tmpl/path/default_lesson.php create mode 100644 deployed/tflearn/components/com_tflearn/tmpl/paths/default.php create mode 100644 deployed/tflearn/components/com_tflearn/tmpl/paths/default.xml create mode 100644 deployed/tflearn/components/com_tflearn/tmpl/score/default.php create mode 100644 deployed/tflearn/components/com_tflearn/tmpl/score/default_question_type1.php create mode 100644 deployed/tflearn/components/com_tflearn/tmpl/score/default_question_type2.php create mode 100644 deployed/tflearn/components/com_tflearn/tmpl/score/default_question_type3.php create mode 100644 deployed/tflearn/components/com_tflearn/tmpl/score/default_question_type4.php create mode 100644 deployed/tflearn/components/com_tflearn/tmpl/score/default_question_type5.php create mode 100644 deployed/tflearn/components/com_tflearn/tmpl/score/default_question_type6.php create mode 100644 deployed/tflearn/components/com_tflearn/tmpl/score/default_question_type7.php create mode 100644 deployed/tflearn/components/com_tflearn/tmpl/scores/default.php create mode 100644 deployed/tflearn/components/com_tflearn/tmpl/scores/default.xml create mode 100644 deployed/tflearn/components/com_tflearn/tmpl/test/default.php create mode 100644 deployed/tflearn/components/com_tflearn/tmpl/test/default_question_title.php create mode 100644 deployed/tflearn/components/com_tflearn/tmpl/test/default_question_type1.php create mode 100644 deployed/tflearn/components/com_tflearn/tmpl/test/default_question_type2.php create mode 100644 deployed/tflearn/components/com_tflearn/tmpl/test/default_question_type3.php create mode 100644 deployed/tflearn/components/com_tflearn/tmpl/test/default_question_type4.php create mode 100644 deployed/tflearn/components/com_tflearn/tmpl/test/default_question_type5.php create mode 100644 deployed/tflearn/components/com_tflearn/tmpl/test/default_question_type6.php create mode 100644 deployed/tflearn/components/com_tflearn/tmpl/test/default_question_type7.php create mode 100644 deployed/tflearn/libraries/techfry/forms/blank.xml create mode 100644 deployed/tflearn/libraries/techfry/forms/bs/accordion.xml create mode 100644 deployed/tflearn/libraries/techfry/forms/bs/alert.xml create mode 100644 deployed/tflearn/libraries/techfry/forms/bs/badge.xml create mode 100644 deployed/tflearn/libraries/techfry/forms/bs/button_link.xml create mode 100644 deployed/tflearn/libraries/techfry/forms/bs/iconbox.xml create mode 100644 deployed/tflearn/libraries/techfry/forms/bs/progress.xml create mode 100644 deployed/tflearn/libraries/techfry/forms/bs/social.xml create mode 100644 deployed/tflearn/libraries/techfry/forms/bs/u_background.xml create mode 100644 deployed/tflearn/libraries/techfry/forms/bs/u_border.xml create mode 100644 deployed/tflearn/libraries/techfry/forms/bs/u_spacing.xml create mode 100644 deployed/tflearn/libraries/techfry/forms/bs/u_text.xml create mode 100644 deployed/tflearn/libraries/techfry/forms/button.xml create mode 100644 deployed/tflearn/libraries/techfry/forms/export.xml create mode 100644 deployed/tflearn/libraries/techfry/forms/fields/calendar.xml create mode 100644 deployed/tflearn/libraries/techfry/forms/fields/checkboxes.xml create mode 100644 deployed/tflearn/libraries/techfry/forms/fields/color.xml create mode 100644 deployed/tflearn/libraries/techfry/forms/fields/email.xml create mode 100644 deployed/tflearn/libraries/techfry/forms/fields/file.xml create mode 100644 deployed/tflearn/libraries/techfry/forms/fields/filelist.xml create mode 100644 deployed/tflearn/libraries/techfry/forms/fields/folderlist.xml create mode 100644 deployed/tflearn/libraries/techfry/forms/fields/imagelist.xml create mode 100644 deployed/tflearn/libraries/techfry/forms/fields/integer.xml create mode 100644 deployed/tflearn/libraries/techfry/forms/fields/list.xml create mode 100644 deployed/tflearn/libraries/techfry/forms/fields/note.xml create mode 100644 deployed/tflearn/libraries/techfry/forms/fields/number.xml create mode 100644 deployed/tflearn/libraries/techfry/forms/fields/password.xml create mode 100644 deployed/tflearn/libraries/techfry/forms/fields/radio.xml create mode 100644 deployed/tflearn/libraries/techfry/forms/fields/range.xml create mode 100644 deployed/tflearn/libraries/techfry/forms/fields/subform.xml create mode 100644 deployed/tflearn/libraries/techfry/forms/fields/tel.xml create mode 100644 deployed/tflearn/libraries/techfry/forms/fields/text.xml create mode 100644 deployed/tflearn/libraries/techfry/forms/fields/textarea.xml create mode 100644 deployed/tflearn/libraries/techfry/forms/fields/url.xml create mode 100644 deployed/tflearn/libraries/techfry/forms/import.xml create mode 100644 deployed/tflearn/libraries/techfry/forms/query.xml create mode 100644 deployed/tflearn/libraries/techfry/forms/subform_filterarticles.xml create mode 100644 deployed/tflearn/libraries/techfry/forms/subform_filterusers.xml create mode 100644 deployed/tflearn/libraries/techfry/forms/subform_where.xml create mode 100644 deployed/tflearn/libraries/techfry/src/Controller/TfControllerAdmin.php create mode 100644 deployed/tflearn/libraries/techfry/src/Controller/TfControllerExport.php create mode 100644 deployed/tflearn/libraries/techfry/src/Controller/TfControllerForm.php create mode 100644 deployed/tflearn/libraries/techfry/src/Controller/TfControllerFormFront.php create mode 100644 deployed/tflearn/libraries/techfry/src/Controller/TfControllerImport.php create mode 100644 deployed/tflearn/libraries/techfry/src/Controller/TfControllerQuery.php create mode 100644 deployed/tflearn/libraries/techfry/src/Model/Back/TfModelDashboard.php create mode 100644 deployed/tflearn/libraries/techfry/src/Model/Back/TfModelForm.php create mode 100644 deployed/tflearn/libraries/techfry/src/Model/Back/TfModelList.php create mode 100644 deployed/tflearn/libraries/techfry/src/Model/Back/TfModelSelect.php create mode 100644 deployed/tflearn/libraries/techfry/src/Model/Front/TfModelForm.php create mode 100644 deployed/tflearn/libraries/techfry/src/Model/Front/TfModelItem.php create mode 100644 deployed/tflearn/libraries/techfry/src/Model/Front/TfModelList.php create mode 100644 deployed/tflearn/libraries/techfry/src/Model/TfModel.php create mode 100644 deployed/tflearn/libraries/techfry/src/Model/TfModelExport.php create mode 100644 deployed/tflearn/libraries/techfry/src/Model/TfModelImport.php create mode 100644 deployed/tflearn/libraries/techfry/src/Model/TfModelQuery.php create mode 100644 deployed/tflearn/libraries/techfry/src/Model/TfModelTrait.php create mode 100644 deployed/tflearn/libraries/techfry/src/TfAlpha.php create mode 100644 deployed/tflearn/libraries/techfry/src/TfAmp.php create mode 100644 deployed/tflearn/libraries/techfry/src/TfApi.php create mode 100644 deployed/tflearn/libraries/techfry/src/TfArray.php create mode 100644 deployed/tflearn/libraries/techfry/src/TfArticle.php create mode 100644 deployed/tflearn/libraries/techfry/src/TfDate.php create mode 100644 deployed/tflearn/libraries/techfry/src/TfDb.php create mode 100644 deployed/tflearn/libraries/techfry/src/TfDom.php create mode 100644 deployed/tflearn/libraries/techfry/src/TfFile.php create mode 100644 deployed/tflearn/libraries/techfry/src/TfHtml.php create mode 100644 deployed/tflearn/libraries/techfry/src/TfImg.php create mode 100644 deployed/tflearn/libraries/techfry/src/TfModal.php create mode 100644 deployed/tflearn/libraries/techfry/src/TfNotify.php create mode 100644 deployed/tflearn/libraries/techfry/src/TfNumeric.php create mode 100644 deployed/tflearn/libraries/techfry/src/TfResource.php create mode 100644 deployed/tflearn/libraries/techfry/src/TfSd.php create mode 100644 deployed/tflearn/libraries/techfry/src/TfString.php create mode 100644 deployed/tflearn/libraries/techfry/src/TfUser.php create mode 100644 deployed/tflearn/libraries/techfry/src/TfXml.php create mode 100644 deployed/tflearn/libraries/techfry/src/View/Air/Accordion.php create mode 100644 deployed/tflearn/libraries/techfry/src/View/Air/Alert.php create mode 100644 deployed/tflearn/libraries/techfry/src/View/Air/Badge.php create mode 100644 deployed/tflearn/libraries/techfry/src/View/Air/Button.php create mode 100644 deployed/tflearn/libraries/techfry/src/View/Air/Card.php create mode 100644 deployed/tflearn/libraries/techfry/src/View/Air/Carousel.php create mode 100644 deployed/tflearn/libraries/techfry/src/View/Air/Gallery.php create mode 100644 deployed/tflearn/libraries/techfry/src/View/Air/Icon.php create mode 100644 deployed/tflearn/libraries/techfry/src/View/Air/Iconbox.php create mode 100644 deployed/tflearn/libraries/techfry/src/View/Air/Iconlist.php create mode 100644 deployed/tflearn/libraries/techfry/src/View/Air/Imagebox.php create mode 100644 deployed/tflearn/libraries/techfry/src/View/Air/Modal.php create mode 100644 deployed/tflearn/libraries/techfry/src/View/Air/Offcanvas.php create mode 100644 deployed/tflearn/libraries/techfry/src/View/Air/Plain.php create mode 100644 deployed/tflearn/libraries/techfry/src/View/Air/Progress.php create mode 100644 deployed/tflearn/libraries/techfry/src/View/Air/Search.php create mode 100644 deployed/tflearn/libraries/techfry/src/View/Air/Tabs.php create mode 100644 deployed/tflearn/libraries/techfry/src/View/Back/TfView.php create mode 100644 deployed/tflearn/libraries/techfry/src/View/Back/TfViewDashboard.php create mode 100644 deployed/tflearn/libraries/techfry/src/View/Back/TfViewForm.php create mode 100644 deployed/tflearn/libraries/techfry/src/View/Back/TfViewList.php create mode 100644 deployed/tflearn/libraries/techfry/src/View/Back/TfViewSelect.php create mode 100644 deployed/tflearn/libraries/techfry/src/View/Bs/Accordion.php create mode 100644 deployed/tflearn/libraries/techfry/src/View/Bs/Alert.php create mode 100644 deployed/tflearn/libraries/techfry/src/View/Bs/Badge.php create mode 100644 deployed/tflearn/libraries/techfry/src/View/Bs/Button.php create mode 100644 deployed/tflearn/libraries/techfry/src/View/Bs/Card.php create mode 100644 deployed/tflearn/libraries/techfry/src/View/Bs/Carousel.php create mode 100644 deployed/tflearn/libraries/techfry/src/View/Bs/Gallery.php create mode 100644 deployed/tflearn/libraries/techfry/src/View/Bs/Grid.php create mode 100644 deployed/tflearn/libraries/techfry/src/View/Bs/Icon.php create mode 100644 deployed/tflearn/libraries/techfry/src/View/Bs/Iconbox.php create mode 100644 deployed/tflearn/libraries/techfry/src/View/Bs/Iconlist.php create mode 100644 deployed/tflearn/libraries/techfry/src/View/Bs/Imagebox.php create mode 100644 deployed/tflearn/libraries/techfry/src/View/Bs/Modal.php create mode 100644 deployed/tflearn/libraries/techfry/src/View/Bs/Plain.php create mode 100644 deployed/tflearn/libraries/techfry/src/View/Bs/Progress.php create mode 100644 deployed/tflearn/libraries/techfry/src/View/Bs/Search.php create mode 100644 deployed/tflearn/libraries/techfry/src/View/Bs/Tabs.php create mode 100644 deployed/tflearn/libraries/techfry/src/View/Bs/Utility.php create mode 100644 deployed/tflearn/libraries/techfry/src/View/Front/TfView.php create mode 100644 deployed/tflearn/libraries/techfry/src/View/Front/TfViewFeed.php create mode 100644 deployed/tflearn/libraries/techfry/src/View/Front/TfViewForm.php create mode 100644 deployed/tflearn/libraries/techfry/src/View/Front/TfViewItem.php create mode 100644 deployed/tflearn/libraries/techfry/src/View/Front/TfViewList.php create mode 100644 deployed/tflearn/libraries/techfry/src/View/Others/Youtube.php create mode 100644 deployed/tflearn/libraries/techfry/src/View/TfViewExport.php create mode 100644 deployed/tflearn/libraries/techfry/src/View/TfViewImport.php create mode 100644 deployed/tflearn/libraries/techfry/src/View/TfViewQuery.php create mode 100644 deployed/tflearn/libraries/techfry/techfry.xml create mode 100644 deployed/tflearn/media/techfry/css/grid.css diff --git a/deployed/tflearn/administrator/components/com_tflearn/access.xml b/deployed/tflearn/administrator/components/com_tflearn/access.xml new file mode 100644 index 00000000..112ad417 --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/access.xml @@ -0,0 +1,12 @@ + + +
+ + + + + + + +
+
\ No newline at end of file diff --git a/deployed/tflearn/administrator/components/com_tflearn/config.xml b/deployed/tflearn/administrator/components/com_tflearn/config.xml new file mode 100644 index 00000000..ef13f7d9 --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/config.xml @@ -0,0 +1,245 @@ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + + + + + + + + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +
diff --git a/deployed/tflearn/administrator/components/com_tflearn/forms/completion.xml b/deployed/tflearn/administrator/components/com_tflearn/forms/completion.xml new file mode 100644 index 00000000..73ad0b7b --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/forms/completion.xml @@ -0,0 +1,50 @@ + +
+ + + + +
+ + + + + + + +
+ +
+ + + + + + +
+ +
+ + + +
+
\ No newline at end of file diff --git a/deployed/tflearn/administrator/components/com_tflearn/forms/course.xml b/deployed/tflearn/administrator/components/com_tflearn/forms/course.xml new file mode 100644 index 00000000..f03b6576 --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/forms/course.xml @@ -0,0 +1,85 @@ + +
+ + + +
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +
+ + + +
+ +
+ + +
+ +
\ No newline at end of file diff --git a/deployed/tflearn/administrator/components/com_tflearn/forms/filter_completions.xml b/deployed/tflearn/administrator/components/com_tflearn/forms/filter_completions.xml new file mode 100644 index 00000000..facbb19f --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/forms/filter_completions.xml @@ -0,0 +1,50 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
\ No newline at end of file diff --git a/deployed/tflearn/administrator/components/com_tflearn/forms/filter_courses.xml b/deployed/tflearn/administrator/components/com_tflearn/forms/filter_courses.xml new file mode 100644 index 00000000..9a2b704c --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/forms/filter_courses.xml @@ -0,0 +1,30 @@ + +
+ + + + + + + + + + + + + + + + + + + + + +
\ No newline at end of file diff --git a/deployed/tflearn/administrator/components/com_tflearn/forms/filter_lessons.xml b/deployed/tflearn/administrator/components/com_tflearn/forms/filter_lessons.xml new file mode 100644 index 00000000..e55471f1 --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/forms/filter_lessons.xml @@ -0,0 +1,64 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
\ No newline at end of file diff --git a/deployed/tflearn/administrator/components/com_tflearn/forms/filter_modules.xml b/deployed/tflearn/administrator/components/com_tflearn/forms/filter_modules.xml new file mode 100644 index 00000000..1364b4b2 --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/forms/filter_modules.xml @@ -0,0 +1,27 @@ + +
+ + + + + + + + + + + + + + + + + + +
\ No newline at end of file diff --git a/deployed/tflearn/administrator/components/com_tflearn/forms/filter_pages.xml b/deployed/tflearn/administrator/components/com_tflearn/forms/filter_pages.xml new file mode 100644 index 00000000..ea0d2cb1 --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/forms/filter_pages.xml @@ -0,0 +1,11 @@ + +
+ + + + + + + + +
\ No newline at end of file diff --git a/deployed/tflearn/administrator/components/com_tflearn/forms/filter_questions.xml b/deployed/tflearn/administrator/components/com_tflearn/forms/filter_questions.xml new file mode 100644 index 00000000..e88008de --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/forms/filter_questions.xml @@ -0,0 +1,59 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
\ No newline at end of file diff --git a/deployed/tflearn/administrator/components/com_tflearn/forms/filter_scores.xml b/deployed/tflearn/administrator/components/com_tflearn/forms/filter_scores.xml new file mode 100644 index 00000000..01e63f23 --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/forms/filter_scores.xml @@ -0,0 +1,31 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + +
\ No newline at end of file diff --git a/deployed/tflearn/administrator/components/com_tflearn/forms/lesson.xml b/deployed/tflearn/administrator/components/com_tflearn/forms/lesson.xml new file mode 100644 index 00000000..0119bcfe --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/forms/lesson.xml @@ -0,0 +1,161 @@ + +
+ + + +
+ + +
+ +
+ + + + + + + + + +
+ +
+ + + + + + + + + + + + + + + +
+ +
+ + + + + + + + +
+ +
+ + + +
+ +
+ + + + + + + + + + + + + + + + + + +
+ +
+ + +
+
\ No newline at end of file diff --git a/deployed/tflearn/administrator/components/com_tflearn/forms/module.xml b/deployed/tflearn/administrator/components/com_tflearn/forms/module.xml new file mode 100644 index 00000000..d4a350b2 --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/forms/module.xml @@ -0,0 +1,21 @@ + +
+ + + +
+ + +
+ +
+ + + +
+ +
+ + +
+
\ No newline at end of file diff --git a/deployed/tflearn/administrator/components/com_tflearn/forms/page.xml b/deployed/tflearn/administrator/components/com_tflearn/forms/page.xml new file mode 100644 index 00000000..5ee1dd48 --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/forms/page.xml @@ -0,0 +1,25 @@ + +
+ + + +
+ + +
+ +
+ + + +
+ + +
+ + +
+
\ No newline at end of file diff --git a/deployed/tflearn/administrator/components/com_tflearn/forms/question.xml b/deployed/tflearn/administrator/components/com_tflearn/forms/question.xml new file mode 100644 index 00000000..e18ba0c8 --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/forms/question.xml @@ -0,0 +1,108 @@ + +
+ + + +
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + +
+ +
+ + + + + +
+ +
+ + +
+
\ No newline at end of file diff --git a/deployed/tflearn/administrator/components/com_tflearn/forms/score.xml b/deployed/tflearn/administrator/components/com_tflearn/forms/score.xml new file mode 100644 index 00000000..d2f64cef --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/forms/score.xml @@ -0,0 +1,49 @@ + +
+ + + +
+ + + + + + + + + + +
+ +
+ + + +
+ +
+ + +
+
\ No newline at end of file diff --git a/deployed/tflearn/administrator/components/com_tflearn/forms/subform_content.xml b/deployed/tflearn/administrator/components/com_tflearn/forms/subform_content.xml new file mode 100644 index 00000000..7c01054f --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/forms/subform_content.xml @@ -0,0 +1,20 @@ + +
+ + + + + + + + + \ No newline at end of file diff --git a/deployed/tflearn/administrator/components/com_tflearn/forms/subform_matching.xml b/deployed/tflearn/administrator/components/com_tflearn/forms/subform_matching.xml new file mode 100644 index 00000000..1dd83c2f --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/forms/subform_matching.xml @@ -0,0 +1,14 @@ + +
+ + + + + + \ No newline at end of file diff --git a/deployed/tflearn/administrator/components/com_tflearn/forms/subform_modules.xml b/deployed/tflearn/administrator/components/com_tflearn/forms/subform_modules.xml new file mode 100644 index 00000000..b2792742 --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/forms/subform_modules.xml @@ -0,0 +1,20 @@ + +
+ + + + + + \ No newline at end of file diff --git a/deployed/tflearn/administrator/components/com_tflearn/forms/subform_options.xml b/deployed/tflearn/administrator/components/com_tflearn/forms/subform_options.xml new file mode 100644 index 00000000..1b46e9f8 --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/forms/subform_options.xml @@ -0,0 +1,16 @@ + +
+ + + + + + \ No newline at end of file diff --git a/deployed/tflearn/administrator/components/com_tflearn/forms/subform_questions.xml b/deployed/tflearn/administrator/components/com_tflearn/forms/subform_questions.xml new file mode 100644 index 00000000..0e33f7d4 --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/forms/subform_questions.xml @@ -0,0 +1,9 @@ + +
+ + + + \ No newline at end of file diff --git a/deployed/tflearn/administrator/components/com_tflearn/forms/subform_resources.xml b/deployed/tflearn/administrator/components/com_tflearn/forms/subform_resources.xml new file mode 100644 index 00000000..5806f563 --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/forms/subform_resources.xml @@ -0,0 +1,19 @@ + +
+ + + + + + + + \ No newline at end of file diff --git a/deployed/tflearn/administrator/components/com_tflearn/language/en-GB/en-GB.com_tflearn.ini b/deployed/tflearn/administrator/components/com_tflearn/language/en-GB/en-GB.com_tflearn.ini new file mode 100644 index 00000000..2142cd4d --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/language/en-GB/en-GB.com_tflearn.ini @@ -0,0 +1,342 @@ +; Used by All +COM_TF_ACCORDION="Accordion" +COM_TF_ACTIONS="Actions" + +COM_TF_ALL_RECORDS_DELETED="All Records Deleted" +COM_TF_ASSOCIATION="Association" +COM_TF_AVAILABLE_COLUMNS="Available Columns" +COM_TF_AUTHOR_TYPE="Author Type" + +COM_TF_BUTTON="Button" +COM_TF_BUTTON_TEXT="Button Text" +COM_TF_BUTTON_CLASS="Button Class" + +COM_TF_CUSTOM="Custom" + +COM_TF_GENERAL="General" +COM_TF_CONFIG_GENERAL_DESC="These settings apply for overall working of component." +COM_TF_NOTIFY="Notifications" +COM_TF_CONFIG_NOTIFY_DESC="These settings apply for email notifications." + +COM_TF_COLUMN="Column" +COM_TF_COLUMN_SAVE="Column to Save" +COM_TF_COLUMNS="Columns" +COM_TF_CONFIGURATION="Configuration" +COM_TF_CREATED_BY="Created By" +COM_TF_CSV_FILE="CSV File" +COM_TF_CUSTOM_FIELD="Custom Field" +COM_TF_CUSTOM_FIELDS="Custom Fields" + +COM_TF_DASHBOARD="Dashboard" +COM_TF_DATE_FORMAT="d M Y H:i" +COM_TF_DEFAULT="Default" +COM_TF_DELETE="Delete" +COM_TF_DOCUMENTATION="Documentation" + +COM_TF_EMPTY_TABLE="Empty Table" +COM_TF_EXPORT="Export" +COM_TF_EXPORT_PRO="Export (Upgrade to Pro)" +COM_TF_EXPORT_COLUMNS_DESC="Enter column names as comma separated values" +COM_TF_EXPORT_TYPE_DESC="Select table or data source" +COM_TF_EXTENSIONS="Extensions" + +COM_TF_ERROR_SELECT_FIELDS="Fields cannot be empty" +COM_TF_ERROR_INVALID_FILE="Uploaded file is not valid" + +COM_TF_FEED_SUMMARY_LIMIT="Feed Summary Limit" + +COM_TF_FIELDSET_BUTTON="Button" +COM_TF_FIELDSET_BUTTON_STYLE="Button Style" +COM_TF_FIELDSET_STYLES="Styles" + +COM_TF_FILTER="Filter" +COM_TF_FILTER_FIELD="Filter Field" +COM_TF_FILTER_OPERATOR="Filter Operator" +COM_TF_FILTER_VALUE="Filter Value" + +COM_TF_IGNORE_FIRST_ROW="Ignore First Row" +COM_TF_IMAGE="Image" +COM_TF_IMPORT="Import" +COM_TF_IMPORT_PRO="Import (Upgrade to Pro)" +COM_TF_IMPORT_CSV="CSV Import" +COM_TF_IMPORT_CSV_DESC="Import data from CSV files." +COM_TF_IMPORT_TYPE_DESC="Select table or data destination" +COM_TF_IMPORT_COLUMNS_DESC="Enter column names as comma separated values" + +COM_TF_KEY="Key" + +COM_TF_LABEL="Label" +COM_TF_LAYOUT="Layout" +COM_TF_LIMIT="Limit" + +COM_TF_N_ITEMS_DELETED_1="One item deleted" +COM_TF_N_ITEMS_DELETED_MORE="%d items deleted" +COM_TF_N_ITEMS_PUBLISHED="%d item(s) published" +COM_TF_N_ITEMS_UNPUBLISHED="%d item(s) unpublished" +COM_TF_N_ITEMS_TRASHED="%d item(s) trashed" +COM_TF_N_ITEMS_ARCHIVED="%d item(s) archived" + +COM_TF_NAME="Name" +COM_TF_NUM="#" +COM_TF_NOTE="Note" + +COM_TF_OFFSET="Offset" +COM_TF_ORDER="Order" +COM_TF_ORDER_BY="Order By" +COM_TF_ORDER_COLUMN="Order Column" +COM_TF_ORDER_DIRECTION="Order Direction" +COM_TF_ORDERING="Ordering" +COM_TF_ORDERING_NOTE_ASC="Note ascending" +COM_TF_ORDERING_NOTE_DESC="Note descending" + +COM_TF_PLAIN="Plain" +COM_TF_PREMIUM="Premium" +COM_TF_PROCESS="Process" +COM_TF_PUBLISHER_LOGO="Publisher Logo" +COM_TF_PUBLISHER_LOGO_DESC="Should be jpg or png file of 60x600px rectangle" +COM_TF_PUBLISHER_NAME="Publisher Name" + +COM_TF_QUERY="Query" +COM_TF_QUERY_PRO="Query (Upgrade to Pro)" +COM_TF_QUERY_TOOL="Query Tool" +COM_TF_QUERY_COLUMN_DESC="Database column name or custom field id for joomla content and users" +COM_TF_QUERY_TYPE_DESC="Select database table" + +COM_TF_RECORD_SAVED="Record saved" +COM_TF_RECORDS_UPDATED="records updated." +COM_TF_RECORDS_IMPORTED="records imported." +COM_TF_RECORDS_EXISTS="records already exists." +COM_TF_REVIEW="Review" + +COM_TF_SELECT="- Select -" +COM_TF_SUPPORT="Support" +COM_TF_SCHEMA_TYPE="Schema Type" +COM_TF_SHOW_DATE="Show Date" +COM_TF_SHOW_SEARCH="Show Search" +COM_TF_SHOW_SD="Structured Data" + +COM_TF_TABS="Tabs" +COM_TF_TEXT="Text" +COM_TF_TOOLBAR_EXPORT="Export" +COM_TF_TOOLBAR_IMPORT="Import" +COM_TF_TOOLBAR_PREVIEW="Preview" +COM_TF_TOOLBAR_PROCESS="Process" +COM_TF_TOOLBAR_QUERY="Query" +COM_TF_TOTAL_RECORDS="Total Records: " +COM_TF_TRUNCATE_TABLE="Truncate Table" +COM_TF_TYPE="Type" + +COM_TF_USER="User" +COM_TF_USER_ID="User ID" +COM_TF_USERS="Users" +COM_TF_USER_FIELD="User Field" +COM_TF_USER_FIELDS="User Fields" +COM_TF_USER_GROUP="User Group" +COM_TF_USER_GROUPS="User Groups" + +COM_TF_VALUE="Value" +COM_TF_WHERE_CONDITIONS="Where Conditions" + +; Extension Specific +COM_TFLEARN_ANSWER="Answer" +COM_TFLEARN_ATTEMPTS="Attempts" +COM_TFLEARN_ATTEMPT_GAP="Attempt Gap" + +COM_TFLEARN_BUTTON_DETAILS="Details Button Text" +COM_TFLEARN_BUTTON_ENROL="Enrol Button Text" +COM_TFLEARN_BUTTON_CAPTION="Button Caption" +CON_TFLEARN_BUTTON_CLASS="Button Class" + +COM_TFLEARN_COLUMN_A="Column A" +COM_TFLEARN_COLUMN_B="Column B" + +COM_TFLEARN_COMPLETION="Completion" +COM_TFLEARN_COMPLETIONS="Completions" +COM_TFLEARN_COMPLETION_TYPE="Completion Type" +COM_TFLEARN_COMPLETION_ADD="Completion: New" +COM_TFLEARN_COMPLETION_EDIT="Completion: Edit" + +COM_TFLEARN_CONTENT="Content" +COM_TFLEARN_CONTENT_IDS="Content IDs" +COM_TFLEARN_CONTENT_ID="Content ID" + +COM_TFLEARN_CORRECT="Correct" + +COM_TFLEARN_COURSE_ADD="Course: New" +COM_TFLEARN_COURSE_EDIT="Course: Edit" +COM_TFLEARN_COURSE_ID="Course ID" +COM_TFLEARN_COURSE="Course" +COM_TFLEARN_COURSE_TYPE="Course Type" +COM_TFLEARN_COURSES="Courses" + +CON_TFLEARN_CUSTOM_MESSAGE="Custom Message" +CON_TFLEARN_CUSTOM_REDIRECT="Custom Redirect" + +COM_TFLEARN_DEPEND="Depend" + +COM_TFLEARN_EMAIL="Email" +COM_TFLEARN_ENROL="Enrol" +COM_TFLEARN_ENROLMENT="Enrolment" +COM_TFLEARN_EXPLANATION="Explanation" + +COM_TFLEARN_FRONT="Front" + +COM_TFLEARN_GRADE="Grade" +COM_TFLEARN_GRADE_TYPE="Grade Type" + +COM_TFLEARN_IMAGE="Image" +COM_TFLEARN_INTEGRATIONS="Integrations" + +COM_TFLEARN_JOOMLA_ARTICLE_ID="Joomla ID" + +COM_TFLEARN_LESSON_ADD="Lesson: New" +COM_TFLEARN_LESSON_EDIT="Lesson: Edit" +COM_TFLEARN_LESSONS="Lessons" +COM_TFLEARN_LESSON="Lesson" +COM_TFLEARN_LINK="Link" + +COM_TFLEARN_MARKS="Marks" + +COM_TFLEARN_MODULE_ADD="Module: New" +COM_TFLEARN_MODULE_EDIT="Module: Edit" +COM_TFLEARN_MODULE_ID="Module ID" +COM_TFLEARN_MODULE="Module" +COM_TFLEARN_MODULES="Modules" +COM_TFLEARN_MULTIPLE_ATTEMPTS="Multiple Attempts" + +COM_TFLEARN_NEXT_DATE="Next Date" +COM_TFLEARN_NOTIFICATIONS="Notifications" + +COM_TFLEARN_OPTION="Option" +COM_TFLEARN_OPTION_REF="Option Reference" +COM_TFLEARN_ORDERING="Ordering" + +COM_TFLEARN_ORDERING_COMPLETION_TYPE_ASC="Completion type ascending" +COM_TFLEARN_ORDERING_COMPLETION_TYPE_DESC="Completion type descending" +COM_TFLEARN_ORDERING_COURSE_TYPE_ASC="Type ascending" +COM_TFLEARN_ORDERING_COURSE_TYPE_DESC="Type descending" +COM_TFLEARN_ORDERING_CREATED_BY_ASC="User ID ascending" +COM_TFLEARN_ORDERING_CREATED_BY_DESC="User ID descending" +COM_TFLEARN_ORDERING_CREATED_ASC="Date ascending" +COM_TFLEARN_ORDERING_CREATED_DESC="Date descending" +COM_TFLEARN_ORDERING_FRONT_ASC="Front ascending" +COM_TFLEARN_ORDERING_FRONT_DESC="Front descending" +COM_TFLEARN_ORDERING_GRADE_ASC="Grade ascending" +COM_TFLEARN_ORDERING_GRADE_DESC="Grade descending" +COM_TFLEARN_ORDERING_GROUP_ID_ASC="Group ID ascending" +COM_TFLEARN_ORDERING_GROUP_ID_DESC="Group ID descending" +COM_TFLEARN_ORDERING_LESSON_TYPE_ASC="Type ascending" +COM_TFLEARN_ORDERING_LESSON_TYPE_DESC="Type descending" +COM_TFLEARN_ORDERING_LESSON_ASC="Lesson ascending" +COM_TFLEARN_ORDERING_LESSON_DESC="Lesson descending" +COM_TFLEARN_ORDERING_MOD_NAME_ASC="Module ascending" +COM_TFLEARN_ORDERING_MOD_NAME_DESC="Module descending" +COM_TFLEARN_ORDERING_Q_TYPE_ASC="Type ascending" +COM_TFLEARN_ORDERING_Q_TYPE_DESC="Type descending" +COM_TFLEARN_ORDERING_REF_ASC="Reference ascending" +COM_TFLEARN_ORDERING_REF_DESC="Reference descending" +COM_TFLEARN_ORDERING_USER_ID_ASC="User ID ascending" +COM_TFLEARN_ORDERING_USER_ID_DESC="User ID descending" + +COM_TFLEARN_PAGE="Page" +COM_TFLEARN_PAGES="Pages" +COM_TFLEARN_PAGE_ADD="Page: New" +COM_TFLEARN_PAGE_EDIT="Page: Edit" +COM_TFLEARN_PATH="Path" +COM_TFLEARN_PATHS="Paths" +COM_TFLEARN_PERCENT="Percent" + +COM_TFLEARN_QUESTION_IDS="Question IDs" +COM_TFLEARN_QUESTION="Question" +COM_TFLEARN_QUESTIONS="Questions" +COM_TFLEARN_QUESTION_ADD="Question: New" +COM_TFLEARN_QUESTION_EDIT="Question: Edit" +COM_TFLEARN_QUESTION_SOURCE="Question Source" + +COM_TFLEARN_REFERENCE="Reference" +COM_TFLEARN_RESOURCES="Resources" +COM_TFLEARN_REQUIRED="Required" + +COM_TFLEARN_SCORE="Score" +COM_TFLEARN_SCORES="Scores" +COM_TFLEARN_SCORE_EDIT="Score: Edit" + +COM_TFLEARN_SELECT_MODULE="Select Module" +COM_TFLEARN_SHOW_TITLE="Show Title" +COM_TFLEARN_SHOW_CAPTCHA="Show Captcha" +COM_TFLEARN_SEO="SEO" +COM_TFLEARN_SHORT_DESC="Short Description" +COM_TFLEARN_START_DATE="Start Date" + +COM_TFLEARN_TAGS="Tags" +COM_TFLEARN_TARGET_WINDOW="Target Window" +COM_TFLEARN_TEST="Test" + +COM_TFLEARN_USER_ID="User ID" +COM_TFLEARN_USER="User" +COM_TFLEARN_USERS="Users" +COM_TFLEARN_USER_GROUP="User Group" + +COM_TFLEARN_VALUE="Value" + +; Emptystate +COM_TFLEARN_COURSES_EMPTYSTATE_CONTENT="Courses are main learning areas. Courses contain lessons organised in modules." +COM_TFLEARN_COURSES_EMPTYSTATE_BUTTON_ADD="Add your first course" +COM_TFLEARN_MODULES_EMPTYSTATE_CONTENT="Modules are way of organising lessons in the course. They are in between courses and lessons. One module can be used in multiple courses." +COM_TFLEARN_MODULES_EMPTYSTATE_BUTTON_ADD="Add your first module" +COM_TFLEARN_LESSONS_EMPTYSTATE_CONTENT="Lessons are like chapters. Lessons can contain text, pages, Joomla articles, external links or quiz." +COM_TFLEARN_LESSONS_EMPTYSTATE_BUTTON_ADD="Add your first lesson" +COM_TFLEARN_PAGES_EMPTYSTATE_CONTENT="Pages are basic learning units which are used to create lessons." +COM_TFLEARN_PAGES_EMPTYSTATE_BUTTON_ADD="Add your first page" +COM_TFLEARN_QUESTIONS_EMPTYSTATE_CONTENT="You can add a test or a quiz to a lesson by adding questions." +COM_TFLEARN_QUESTIONS_EMPTYSTATE_BUTTON_ADD="Add your first question" +COM_TFLEARN_COMPLETIONS_EMPTYSTATE_CONTENT="Here you can see the status of the lessons completed by the users and the score obtained." +COM_TFLEARN_SCORES_EMPTYSTATE_CONTENT="Here, you can see all the attempts of the tests or quizzes." + +; Managers +COM_TFLEARN_MANAGER_CONFIGURATION="TF Learn: Configuration" +COM_TFLEARN_MANAGER_DASHBOARD="TF Learn: Dashboard" +COM_TFLEARN_MANAGER_COURSES="TF Learn: Courses" +COM_TFLEARN_MANAGER_MODULES="TF Learn: Modules" +COM_TFLEARN_MANAGER_LESSONS="TF Learn: Lessons" +COM_TFLEARN_MANAGER_PAGES="TF Learn: Pages" +COM_TFLEARN_MANAGER_QUESTIONS="TF Learn: Questions" +COM_TFLEARN_MANAGER_COMPLETIONS="TF Learn: Completions" +COM_TFLEARN_MANAGER_SCORES="TF Learn: Scores" + +; Ordering +COM_TFLEARN_COURSE_ASC="Course ascending" +COM_TFLEARN_COURSE_DESC="Course descending" +COM_TFLEARN_CREATED_ASC="Course ascending" +COM_TFLEARN_CREATED_DESC="Course descending" +COM_TFLEARN_LESSON_ASC="Lesson ascending" +COM_TFLEARN_LESSON_DESC="Lesson descending" +COM_TFLEARN_MODULE_ASC="Module ascending" +COM_TFLEARN_MODULE_DESC="Module descending" +COM_TFLEARN_ORDERING_ASC="Ordering ascending" +COM_TFLEARN_ORDERING_DESC="Odering descending" +COM_TFLEARN_PUBLISHED_ASC="Status ascending" +COM_TFLEARN_PUBLISHED_DESC="Status descending" +COM_TFLEARN_TITLE_ASC="Title ascending" +COM_TFLEARN_TITLE_DESC="Title descending" +COM_TFLEARN_TYPE_ASC="Type ascending" +COM_TFLEARN_TYPE_DESC="Type descending" +COM_TFLEARN_USER_ASC="User ascending" +COM_TFLEARN_USER_DESC="User descending" + +; Configuration +COM_TFLEARN_CONFIG_COURSES_DESC="These settings apply for courses view." +COM_TFLEARN_CONFIG_COURSE_DESC="These settings apply for single course view." +COM_TFLEARN_CONFIG_PATHS_DESC="These settings apply for learning paths (all courses user is enrolled in) view." +COM_TFLEARN_CONFIG_PATH_DESC="These settings apply for single learning path view." +COM_TFLEARN_CONFIG_PAGE_DESC="These settings apply for single page view." +COM_TFLEARN_CONFIG_ENROL_DESC="These settings apply for enrolment form view." +COM_TFLEARN_CONFIG_TEST_DESC="These settings apply for test or quiz view." +COM_TFLEARN_CONFIG_INTEGRATIONS_DESC="These settings determine how the component will integrate with other extensions." +COM_TFLEARN_CONFIG_NOTIFICATIONS_DESC="These settings are for email notifications." +COM_TFLEARN_CONFIG_SEO_DESC="These settings are for SEO for search results." + +COM_TFLEARN_N_ITEMS_DELETED_1="One item deleted" +COM_TFLEARN_N_ITEMS_DELETED_MORE="%d items deleted" +COM_TFLEARN_N_ITEMS_PUBLISHED="%d item(s) published" +COM_TFLEARN_N_ITEMS_UNPUBLISHED="%d item(s) unpublished" \ No newline at end of file diff --git a/deployed/tflearn/administrator/components/com_tflearn/language/en-GB/en-GB.com_tflearn.sys.ini b/deployed/tflearn/administrator/components/com_tflearn/language/en-GB/en-GB.com_tflearn.sys.ini new file mode 100644 index 00000000..c3e4d08f --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/language/en-GB/en-GB.com_tflearn.sys.ini @@ -0,0 +1,29 @@ +COM_TFLEARN="TF Learn" +COM_TFLEARN_DESC="Joomla component for Learning Management System" + +COM_TFLEARN_MENU="TF Learn" + +COM_TFLEARN_SUBMENU_DASHBOARD="Dashboard" +COM_TFLEARN_SUBMENU_COURSES="Courses" +COM_TFLEARN_SUBMENU_MODULES="Modules" +COM_TFLEARN_SUBMENU_LESSONS="Lessons" +COM_TFLEARN_SUBMENU_PAGES="Pages" +COM_TFLEARN_SUBMENU_QUESTIONS="Questions" +COM_TFLEARN_SUBMENU_COMPLETIONS="Completions" +COM_TFLEARN_SUBMENU_SCORES="Scores" + +; Frontend Menu Views +COM_TFLEARN_ENROL_FORM_VIEW_TITLE="Enrol" +COM_TFLEARN_ENROL_FORM_VIEW_DESC="Create enrolment form to enrol users in the course." + +; Frontend Menu Options +COM_TFLEARN_SHOW_CAPTCHA="Show Captcha" +COM_TFLEARN_BUTTON_CAPTION="Button Caption" +CON_TFLEARN_BUTTON_CLASS="Button Class" +CON_TFLEARN_CUSTOM_REDIRECT="Custom Redirect" +CON_TFLEARN_CUSTOM_MESSAGE="Custom Message" +COM_TFLEARN_SHOW_COURSE_TITLE="Course Title" +COM_TFLEARN_SHOW_COURSE_DESCRIPTION="Course Description" + +; Configuration +COM_TFLEARN_CONFIGURATION="TF Learn: Options" \ No newline at end of file diff --git a/deployed/tflearn/administrator/components/com_tflearn/script.php b/deployed/tflearn/administrator/components/com_tflearn/script.php new file mode 100644 index 00000000..6ed5f571 --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/script.php @@ -0,0 +1,61 @@ +getParent()->setRedirectURL('index.php?option=' . $this->extension); + } + + // 02. Called after component is updated + public function update(InstallerAdapter $adapter) + { + $adapter->getParent()->setRedirectURL('index.php?option=' . $this->extension); + + $new_version = $adapter->getManifest()->version; + } + + // 03. Called before installation + public function preflight($type, InstallerAdapter $adapter) + { + if ($type == 'update') + { + foreach ($this->admin_folders as $admin_folder) + { + $path = JPATH_ADMINISTRATOR . '/components/' . $this->extension . '/' . $admin_folder; + if (Folder::exists($path)) + { + Folder::delete($path); + } + } + + foreach ($this->site_folders as $site_folder) + { + $path = JPATH_SITE . '/components/' . $this->extension . '/' . $site_folder; + if (Folder::exists($path)) + { + Folder::delete($path); + } + } + } + + return true; + } +} \ No newline at end of file diff --git a/deployed/tflearn/administrator/components/com_tflearn/services/provider.php b/deployed/tflearn/administrator/components/com_tflearn/services/provider.php new file mode 100644 index 00000000..634abed1 --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/services/provider.php @@ -0,0 +1,47 @@ +registerServiceProvider(new MVCFactory('\\TechFry\\Component\\TfLearn')); + $container->registerServiceProvider(new ComponentDispatcherFactory('\\TechFry\\Component\\TfLearn')); + $container->registerServiceProvider(new CategoryFactory('\\TechFry\\Component\\TfLearn')); + $container->registerServiceProvider(new RouterFactory('\\TechFry\\Component\\TfLearn')); + + $container->set( + ComponentInterface::class, + function (Container $container) + { + $component = new TfLearnComponent($container->get(ComponentDispatcherFactoryInterface::class)); + + $component->setMVCFactory($container->get(MVCFactoryInterface::class)); + $component->setCategoryFactory($container->get(CategoryFactoryInterface::class)); + $component->setRouterFactory($container->get(RouterFactoryInterface::class)); + + return $component; + } + ); + } +}; \ No newline at end of file diff --git a/deployed/tflearn/administrator/components/com_tflearn/sql/install.mysql.utf8.sql b/deployed/tflearn/administrator/components/com_tflearn/sql/install.mysql.utf8.sql new file mode 100644 index 00000000..c6b9e6f6 --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/sql/install.mysql.utf8.sql @@ -0,0 +1,150 @@ +CREATE TABLE IF NOT EXISTS `#__tfl_courses` ( + `id` INT(11) NOT NULL AUTO_INCREMENT, + `title` VARCHAR(400), + `alias` VARCHAR(400), + `image` VARCHAR(400), + `published` TINYINT(3), + `description` TEXT, + `short_desc` VARCHAR(400), + `course_type` VARCHAR(400), + `front` TINYINT(3), + `group_id` INT(10), + `modules` TEXT, + `enrol` VARCHAR(100), + `enrol_link` VARCHAR(400), + `ordering` INT(11), + `created` DATETIME, + `modified` DATETIME, + `created_by` INT(10), + `hits` INT(10) UNSIGNED, + `access` tinyint(4) NOT NULL DEFAULT '0', + PRIMARY KEY (`id`) +) + ENGINE=InnoDB + AUTO_INCREMENT=0 + DEFAULT CHARSET=utf8mb4; + +CREATE TABLE IF NOT EXISTS `#__tfl_modules` ( + `id` INT(11) NOT NULL AUTO_INCREMENT, + `title` VARCHAR(400), + `description` TEXT, + `published` TINYINT(3), + `created` DATETIME, + `modified` DATETIME, + `created_by` INT(10), + PRIMARY KEY (`id`) +) + ENGINE=InnoDB + AUTO_INCREMENT=0 + DEFAULT CHARSET=utf8mb4; + +CREATE TABLE IF NOT EXISTS `#__tfl_lessons` ( + `id` INT(11) NOT NULL AUTO_INCREMENT, + `title` VARCHAR(400), + `description` TEXT, + `short_desc` VARCHAR(1000), + `lesson_type` VARCHAR(400), + `completion_type` VARCHAR(400), + `jids` TEXT, + `content_source` VARCHAR(255), + `resources` TEXT, + `questions` TINYINT(3), + `marks` TINYINT(3), + `pass_percent` TINYINT(3), + `multiple_attempts` TINYINT(3), + `grade_type` VARCHAR(100), + `attempt_gap` TINYINT(3), + `ref` VARCHAR(100), + `published` TINYINT(3), + `module` INT(11), + `created` DATETIME, + `modified` DATETIME, + `created_by` INT(10), + `ordering` INT(11), + `hits` INT(10) UNSIGNED, + PRIMARY KEY (`id`) +) + ENGINE=InnoDB + AUTO_INCREMENT=0 + DEFAULT CHARSET=utf8mb4; + +CREATE TABLE IF NOT EXISTS `#__tfl_pages` ( + `id` INT(11) NOT NULL AUTO_INCREMENT, + `title` VARCHAR(400), + `alias` VARCHAR(400), + `published` TINYINT(3), + `description` TEXT, + `created` DATETIME, + `modified` DATETIME, + `created_by` INT(10), + `note` VARCHAR(255), + `hits` INT(10) UNSIGNED, + `ref` VARCHAR(100), + PRIMARY KEY (`id`) +) + ENGINE=InnoDB + AUTO_INCREMENT=0 + DEFAULT CHARSET=utf8mb4; + +CREATE TABLE IF NOT EXISTS `#__tfl_questions` ( + `id` INT(11) NOT NULL AUTO_INCREMENT, + `title` VARCHAR(400), + `alias` VARCHAR(400), + `published` TINYINT(3), + `lesson_id` INT(11), + `description` TEXT, + `q_type` VARCHAR(400), + `options` MEDIUMTEXT, + `matching` MEDIUMTEXT, + `answer` VARCHAR(400), + `explanation` TEXT, + `depend` TINYINT(3), + `created` DATETIME, + `modified` DATETIME, + `created_by` INT(10), + PRIMARY KEY (`id`) +) + ENGINE=InnoDB + AUTO_INCREMENT=0 + DEFAULT CHARSET=utf8mb4; + +CREATE TABLE IF NOT EXISTS `#__tfl_scores` ( + `id` INT(11) NOT NULL AUTO_INCREMENT, + `published` TINYINT(3), + `lesson_id` INT(11), + `created_by` INT(11), + `email` VARCHAR(400), + `attempts` TEXT, + `grade` TINYINT(11), + `created` DATETIME, + `modified` DATETIME, + `hits` INT(10) UNSIGNED, + PRIMARY KEY (`id`) +) + ENGINE=InnoDB + AUTO_INCREMENT=0 + DEFAULT CHARSET=utf8mb4; + +CREATE TABLE IF NOT EXISTS `#__tfl_completion` ( + `id` INT(11) NOT NULL AUTO_INCREMENT, + `published` TINYINT(3), + `lesson_id` INT(11), + `user_id` INT(11), + `complete` TINYINT(3), + `created` DATETIME, + `modified` DATETIME, + PRIMARY KEY (`id`) +) + ENGINE=InnoDB + AUTO_INCREMENT=0 + DEFAULT CHARSET=utf8mb4; + +CREATE TABLE IF NOT EXISTS `#__mentor_map` ( + `course_id` INT(10) UNSIGNED DEFAULT 0, + `mentor_id` INT(10) UNSIGNED DEFAULT 0, + `student_id` INT(10) UNSIGNED DEFAULT 0, + PRIMARY KEY(`course_id`, `mentor_id`, `student_id`) +) + ENGINE=InnoDB + DEFAULT CHARSET=utf8mb4 + DEFAULT COLLATE=utf8mb4_unicode_ci; \ No newline at end of file diff --git a/deployed/tflearn/administrator/components/com_tflearn/sql/uninstall.mysql.utf8.sql b/deployed/tflearn/administrator/components/com_tflearn/sql/uninstall.mysql.utf8.sql new file mode 100644 index 00000000..e69de29b diff --git a/deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.0.3.sql b/deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.0.3.sql new file mode 100644 index 00000000..e2dd95c3 --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.0.3.sql @@ -0,0 +1 @@ +ALTER TABLE `#__tfl_courses` ADD `alias` VARCHAR(400) AFTER `title`; \ No newline at end of file diff --git a/deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.0.4.sql b/deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.0.4.sql new file mode 100644 index 00000000..bcc0eb73 --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.0.4.sql @@ -0,0 +1,3 @@ +ALTER TABLE `#__tfl_courses` ADD `ordering` INT(11); + +ALTER TABLE `#__tfl_lessons` ADD `ordering` INT(11); \ No newline at end of file diff --git a/deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.0.8.sql b/deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.0.8.sql new file mode 100644 index 00000000..11763171 --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.0.8.sql @@ -0,0 +1 @@ +ALTER TABLE `#__tfl_courses` ADD `short_desc` VARCHAR(400) AFTER `description`; \ No newline at end of file diff --git a/deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.1.1.sql b/deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.1.1.sql new file mode 100644 index 00000000..e69de29b diff --git a/deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.1.4.sql b/deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.1.4.sql new file mode 100644 index 00000000..b869dcac --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.1.4.sql @@ -0,0 +1,23 @@ +ALTER TABLE `#__tfl_courses` ADD `created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER `ordering`; + +ALTER TABLE `#__tfl_courses` ADD `modified` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER `created`; + +ALTER TABLE `#__tfl_courses` ADD `access` tinyint(4) NOT NULL DEFAULT '0' AFTER `modified`; + +ALTER TABLE `#__tfl_modules` ADD `created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER `published`; + +ALTER TABLE `#__tfl_modules` ADD `modified` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER `created`; + +ALTER TABLE `#__tfl_lessons` ADD `created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER `module`; + +ALTER TABLE `#__tfl_lessons` ADD `modified` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER `created`; + +ALTER TABLE `#__tfl_pathways` ADD `created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER `published`; + +ALTER TABLE `#__tfl_pathways` ADD `modified` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER `created`; + +ALTER TABLE `#__tfl_config` ADD `courses` MEDIUMTEXT AFTER `id`; + +ALTER TABLE `#__tfl_config` ADD `paths` MEDIUMTEXT AFTER `courses`; + +ALTER TABLE `#__tfl_config` ADD `enrol` MEDIUMTEXT AFTER `paths`; \ No newline at end of file diff --git a/deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.1.7.sql b/deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.1.7.sql new file mode 100644 index 00000000..c68bd6cf --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.1.7.sql @@ -0,0 +1,35 @@ +CREATE TABLE IF NOT EXISTS `#__tfl_questions` ( + `id` INT(11) NOT NULL AUTO_INCREMENT, + `title` VARCHAR(400), + `alias` VARCHAR(400), + `published` TINYINT(3), + `lesson_id` INT(11), + `description` TEXT, + `q_type` VARCHAR(400), + `options` MEDIUMTEXT, + `answer` VARCHAR(400), + `explain` TEXT, + `depend` TINYINT(3), + `marks` TINYINT(3), + `created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `modified` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (id) +) + ENGINE=InnoDB + AUTO_INCREMENT=0 + DEFAULT CHARSET=utf8mb4; + +CREATE TABLE IF NOT EXISTS `#__tfl_scores` ( + `id` INT(11) NOT NULL AUTO_INCREMENT, + `published` TINYINT(3), + `lesson_id` INT(11), + `user_id` INT(11), + `attempts` TEXT, + `grade` TINYINT(11), + `created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `modified` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (id) +) + ENGINE=InnoDB + AUTO_INCREMENT=0 + DEFAULT CHARSET=utf8mb4; \ No newline at end of file diff --git a/deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.1.8.sql b/deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.1.8.sql new file mode 100644 index 00000000..d4affcce --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.1.8.sql @@ -0,0 +1 @@ +ALTER TABLE `#__tfl_config` ADD `test` MEDIUMTEXT AFTER `enrol`; \ No newline at end of file diff --git a/deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.1.9.sql b/deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.1.9.sql new file mode 100644 index 00000000..68840dd3 --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.1.9.sql @@ -0,0 +1,9 @@ +ALTER TABLE `#__tfl_config` ADD `path` MEDIUMTEXT AFTER `paths`; + +ALTER TABLE `#__tfl_config` ADD `course` MEDIUMTEXT AFTER `courses`; + +ALTER TABLE `#__tfl_config` ADD `attempts` MEDIUMTEXT AFTER `enrol`; + +ALTER TABLE `#__tfl_config` ADD `attempt` MEDIUMTEXT AFTER `attempts`; + +ALTER TABLE `#__tfl_scores` ADD `email` VARCHAR(400) AFTER `user_id`; \ No newline at end of file diff --git a/deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.2.0.sql b/deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.2.0.sql new file mode 100644 index 00000000..37463ec0 --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.2.0.sql @@ -0,0 +1,3 @@ +ALTER TABLE `#__tfl_lessons` ADD `questions` TINYINT(3) AFTER `lesson_type`; + +ALTER TABLE `#__tfl_lessons` ADD `marks` TINYINT(3) AFTER `questions`; \ No newline at end of file diff --git a/deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.2.2.sql b/deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.2.2.sql new file mode 100644 index 00000000..e69de29b diff --git a/deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.2.4.sql b/deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.2.4.sql new file mode 100644 index 00000000..088f6351 --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.2.4.sql @@ -0,0 +1,17 @@ +CREATE TABLE IF NOT EXISTS `#__tfl_completion` ( + `id` INT(11) NOT NULL AUTO_INCREMENT, + `published` TINYINT(3), + `lesson_id` INT(11), + `user_id` INT(11), + `complete` TINYINT(3), + `created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `modified` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (id) +) + ENGINE=InnoDB + AUTO_INCREMENT=0 + DEFAULT CHARSET=utf8mb4; + +ALTER TABLE `#__tfl_lessons` DROP COLUMN `jid`; + +ALTER TABLE `#__tfl_lessons` ADD COLUMN `jids` TEXT AFTER `lesson_type`; \ No newline at end of file diff --git a/deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.2.6.sql b/deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.2.6.sql new file mode 100644 index 00000000..e69de29b diff --git a/deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.2.8.sql b/deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.2.8.sql new file mode 100644 index 00000000..82479c93 --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.2.8.sql @@ -0,0 +1 @@ +ALTER TABLE `#__tfl_lessons` ADD COLUMN `completion_type` VARCHAR(400) AFTER `lesson_type`; \ No newline at end of file diff --git a/deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.2.9.sql b/deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.2.9.sql new file mode 100644 index 00000000..e69de29b diff --git a/deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.3.0.sql b/deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.3.0.sql new file mode 100644 index 00000000..c4b80954 --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.3.0.sql @@ -0,0 +1,3 @@ +ALTER TABLE `#__tfl_courses` ADD COLUMN `group_id` INT(10) AFTER `front`; + +ALTER TABLE `#__tfl_courses` DROP COLUMN `tfmail`; \ No newline at end of file diff --git a/deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.3.2.sql b/deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.3.2.sql new file mode 100644 index 00000000..8ba68890 --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.3.2.sql @@ -0,0 +1 @@ +DROP TABLE `#__tfl_pathways`; \ No newline at end of file diff --git a/deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.3.4.sql b/deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.3.4.sql new file mode 100644 index 00000000..ec5eb16e --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.3.4.sql @@ -0,0 +1,7 @@ +ALTER TABLE `#__tfl_courses` ADD `created_by` INT(10) AFTER `modified`; + +ALTER TABLE `#__tfl_modules` ADD `created_by` INT(10) AFTER `modified`; + +ALTER TABLE `#__tfl_lessons` ADD `created_by` INT(10) AFTER `modified`; + +ALTER TABLE `#__tfl_questions` ADD `created_by` INT(10) AFTER `modified`; \ No newline at end of file diff --git a/deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.3.7.sql b/deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.3.7.sql new file mode 100644 index 00000000..efecbe07 --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.3.7.sql @@ -0,0 +1 @@ +ALTER TABLE `#__tfl_lessons` ADD COLUMN `short_desc` VARCHAR(1000) AFTER `description`; \ No newline at end of file diff --git a/deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.3.9.sql b/deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.3.9.sql new file mode 100644 index 00000000..a204e535 --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.3.9.sql @@ -0,0 +1 @@ +ALTER TABLE `#__tfl_lessons` ADD COLUMN `pass_percent` TINYINT(3) AFTER `marks`; \ No newline at end of file diff --git a/deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.4.0.sql b/deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.4.0.sql new file mode 100644 index 00000000..e69de29b diff --git a/deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.4.1.sql b/deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.4.1.sql new file mode 100644 index 00000000..1bb47ea9 --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.4.1.sql @@ -0,0 +1 @@ +ALTER TABLE `#__tfl_questions` CHANGE `explain` `explanation` TEXT; \ No newline at end of file diff --git a/deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.4.4.sql b/deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.4.4.sql new file mode 100644 index 00000000..c4e30aed --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.4.4.sql @@ -0,0 +1,17 @@ +ALTER TABLE `#__tfl_lessons` DROP COLUMN `qsource`; + +ALTER TABLE `#__tfl_lessons` DROP COLUMN `qids`; + +ALTER TABLE `#__tfl_questions` DROP COLUMN `marks`; + +ALTER TABLE `#__tfl_lessons` ADD COLUMN `multiple_attempts` TINYINT(3) AFTER `pass_percent`; + +ALTER TABLE `#__tfl_lessons` ADD COLUMN `grade_type` VARCHAR(100) AFTER `multiple_attempts`; + +ALTER TABLE `#__tfl_lessons` ADD COLUMN `attempt_gap` TINYINT(3) AFTER `grade_type`; + +ALTER TABLE `#__tfl_lessons` ADD COLUMN `hits` INT(10) UNSIGNED AFTER `ordering`; + +ALTER TABLE `#__tfl_courses` ADD COLUMN `hits` INT(10) UNSIGNED AFTER `created_by`; + +ALTER TABLE `#__tfl_scores` ADD COLUMN `hits` INT(10) UNSIGNED AFTER `modified`; \ No newline at end of file diff --git a/deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.4.5.sql b/deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.4.5.sql new file mode 100644 index 00000000..008cbe56 --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.4.5.sql @@ -0,0 +1 @@ +ALTER TABLE `#__tfl_scores` CHANGE `user_id` `created_by` INT(11); \ No newline at end of file diff --git a/deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.4.8.sql b/deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.4.8.sql new file mode 100644 index 00000000..bddcf390 --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.4.8.sql @@ -0,0 +1 @@ +DROP TABLE `#__tfl_config`; \ No newline at end of file diff --git a/deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.5.3.sql b/deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.5.3.sql new file mode 100644 index 00000000..b881f18c --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.5.3.sql @@ -0,0 +1 @@ +ALTER TABLE `#__tfl_questions` ADD COLUMN `matching` MEDIUMTEXT AFTER `options`; \ No newline at end of file diff --git a/deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.5.6.sql b/deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.5.6.sql new file mode 100644 index 00000000..e01aa04a --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.5.6.sql @@ -0,0 +1,16 @@ +CREATE TABLE IF NOT EXISTS `#__tfl_pages` ( + `id` INT(11) NOT NULL AUTO_INCREMENT, + `title` VARCHAR(400), + `alias` VARCHAR(400), + `published` TINYINT(3), + `description` TEXT, + `created` DATETIME, + `modified` DATETIME, + `created_by` INT(10), + `note` VARCHAR(255), + `hits` INT(10) UNSIGNED, + PRIMARY KEY (`id`) +) + ENGINE=InnoDB + AUTO_INCREMENT=0 + DEFAULT CHARSET=utf8mb4; \ No newline at end of file diff --git a/deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.5.7.sql b/deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.5.7.sql new file mode 100644 index 00000000..a11e6d16 --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.5.7.sql @@ -0,0 +1 @@ +ALTER TABLE `#__tfl_lessons` ADD COLUMN `content_source` VARCHAR(255) AFTER `jids`; \ No newline at end of file diff --git a/deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.6.7.sql b/deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.6.7.sql new file mode 100644 index 00000000..aadd11eb --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.6.7.sql @@ -0,0 +1,9 @@ +CREATE TABLE IF NOT EXISTS `#__mentor_map` ( + `course_id` INT(10) UNSIGNED DEFAULT 0, + `mentor_id` INT(10) UNSIGNED DEFAULT 0, + `student_id` INT(10) UNSIGNED DEFAULT 0, + PRIMARY KEY(`course_id`, `mentor_id`, `student_id`) +) + ENGINE=InnoDB + DEFAULT CHARSET=utf8mb4 + DEFAULT COLLATE=utf8mb4_unicode_ci; \ No newline at end of file diff --git a/deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.7.1.sql b/deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.7.1.sql new file mode 100644 index 00000000..13ae947d --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/sql/updates/mysql/1.7.1.sql @@ -0,0 +1,7 @@ +ALTER TABLE `#__tfl_lessons` DROP COLUMN `link`; + +ALTER TABLE `#__tfl_lessons` ADD COLUMN `resources` TEXT AFTER `content_source`; + +ALTER TABLE `#__tfl_lessons` ADD COLUMN `ref` VARCHAR(100) AFTER `attempt_gap`; + +ALTER TABLE `#__tfl_pages` ADD COLUMN `ref` VARCHAR(100) AFTER `hits`; \ No newline at end of file diff --git a/deployed/tflearn/administrator/components/com_tflearn/src/Controller/CompletionController.php b/deployed/tflearn/administrator/components/com_tflearn/src/Controller/CompletionController.php new file mode 100644 index 00000000..559c122e --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/src/Controller/CompletionController.php @@ -0,0 +1,16 @@ + true)) + { + $model = parent::getModel($name, $prefix, $config); + + return $model; + } +} \ No newline at end of file diff --git a/deployed/tflearn/administrator/components/com_tflearn/src/Controller/CourseController.php b/deployed/tflearn/administrator/components/com_tflearn/src/Controller/CourseController.php new file mode 100644 index 00000000..b224916a --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/src/Controller/CourseController.php @@ -0,0 +1,16 @@ + true)) + { + $model = parent::getModel($name, $prefix, $config); + + return $model; + } +} \ No newline at end of file diff --git a/deployed/tflearn/administrator/components/com_tflearn/src/Controller/DisplayController.php b/deployed/tflearn/administrator/components/com_tflearn/src/Controller/DisplayController.php new file mode 100644 index 00000000..033a2fd1 --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/src/Controller/DisplayController.php @@ -0,0 +1,21 @@ + true)) + { + $model = parent::getModel($name, $prefix, $config); + + return $model; + } +} \ No newline at end of file diff --git a/deployed/tflearn/administrator/components/com_tflearn/src/Controller/ModuleController.php b/deployed/tflearn/administrator/components/com_tflearn/src/Controller/ModuleController.php new file mode 100644 index 00000000..92b176f3 --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/src/Controller/ModuleController.php @@ -0,0 +1,16 @@ + true)) + { + $model = parent::getModel($name, $prefix, $config); + + return $model; + } +} \ No newline at end of file diff --git a/deployed/tflearn/administrator/components/com_tflearn/src/Controller/PageController.php b/deployed/tflearn/administrator/components/com_tflearn/src/Controller/PageController.php new file mode 100644 index 00000000..1b20f73e --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/src/Controller/PageController.php @@ -0,0 +1,16 @@ + true)) + { + $model = parent::getModel($name, $prefix, $config); + + return $model; + } +} \ No newline at end of file diff --git a/deployed/tflearn/administrator/components/com_tflearn/src/Controller/QueryController.php b/deployed/tflearn/administrator/components/com_tflearn/src/Controller/QueryController.php new file mode 100644 index 00000000..76a03c30 --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/src/Controller/QueryController.php @@ -0,0 +1,16 @@ + true)) + { + $model = parent::getModel($name, $prefix, $config); + + return $model; + } +} \ No newline at end of file diff --git a/deployed/tflearn/administrator/components/com_tflearn/src/Controller/ScoreController.php b/deployed/tflearn/administrator/components/com_tflearn/src/Controller/ScoreController.php new file mode 100644 index 00000000..3997f69c --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/src/Controller/ScoreController.php @@ -0,0 +1,16 @@ + true)) + { + $model = parent::getModel($name, $prefix, $config); + + return $model; + } +} \ No newline at end of file diff --git a/deployed/tflearn/administrator/components/com_tflearn/src/Extension/TfLearnComponent.php b/deployed/tflearn/administrator/components/com_tflearn/src/Extension/TfLearnComponent.php new file mode 100644 index 00000000..05f8b5b8 --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/src/Extension/TfLearnComponent.php @@ -0,0 +1,33 @@ +table_name = 'tfl_completion'; + + $this->subform_fields = array('modules'); + + parent::__construct($config); + } + +// ***************************************************************************** + + // 01. Get latest score for lesson and user (Check its usage and shift to Helper) + public function getScore($user_id, $lesson_id) + { + $db = Factory::getDbo(); + $query = $db->getQuery(true); + + $query + ->select($db->quoteName(array('grade'))) + ->from($db->quoteName('#__tfl_scores')) + ->where($db->quoteName('user_id') . ' = '. $db->quote($user_id)) + ->andWhere($db->quoteName('lesson_id') . ' = '. $db->quote($lesson_id)) + ->order('created DESC') + ->setLimit('1'); + + $db->setQuery($query); + + $result = $db->loadResult(); + + return $result; + } +} \ No newline at end of file diff --git a/deployed/tflearn/administrator/components/com_tflearn/src/Model/CompletionsModel.php b/deployed/tflearn/administrator/components/com_tflearn/src/Model/CompletionsModel.php new file mode 100644 index 00000000..47369791 --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/src/Model/CompletionsModel.php @@ -0,0 +1,149 @@ +table_name = 'tfl_completion'; + + $this->select_fields = array('a.id', 'a.user_id', 'a.published', 'a.lesson_id', 'a.complete', 'a.created', 'b.questions', 'b.marks', 'b.title as lesson'); + + $this->joins = array( + array('table' => 'tfl_lessons', 'on' => 'lesson_id') + ); + + $this->filters['user'] = 'user_id'; + $this->filters['lesson_id'] = 'a.lesson_id'; + + array_push($this->sorting_fields, 'a.created', 'lesson', 'user_id'); + + parent::__construct($config); + } + +// ***************************************************************************** + + // 01. Get modules from course (Check its usage and shift to Helper) + public function getModules($course_id) + { + $db = Factory::getDbo(); + $query = $db->getQuery(true); + + $query + ->select($db->quoteName(array('modules'))) + ->from($db->quoteName('#__tfl_courses')) + ->where($db->quoteName('id') . ' = '. $db->quote($course_id)) + ->setLimit('1'); + + $db->setQuery($query); + + $result = $db->loadResult(); + + $result = json_decode($result, true); + + return $result; + } + + // 02. Get lessons for modules (Check its usage and shift to Helper) + public function getLessons($module_id) + { + $db = Factory::getDbo(); + $query = $db->getQuery(true); + + $query + ->select('*') + ->from($db->quoteName('#__tfl_lessons')) + ->where($db->quoteName('module') . ' = '. $db->quote($module_id)) + ->andWhere($db->quoteName('published') . ' = '. $db->quote(1)) + ->order($db->quoteName('ordering') . ' ASC'); + + $db->setQuery($query); + + $rows = $db->loadAssocList(); + + return $rows; + } + + // 03. Get latest score for lesson and user (Check its usage and shift to Helper) + public function getScore($user_id, $lesson_id) + { + $db = Factory::getDbo(); + $query = $db->getQuery(true); + + $query + ->select($db->quoteName(array('grade'))) + ->from($db->quoteName('#__tfl_scores')) + ->where($db->quoteName('created_by') . ' = '. $db->quote($user_id)) + ->andWhere($db->quoteName('lesson_id') . ' = '. $db->quote($lesson_id)) + ->order('created DESC') + ->setLimit('1'); + + $db->setQuery($query); + + $result = $db->loadResult(); + + return $result; + } + + // 04. Get completion status for lesson and user (Check its usage and shift to Helper) + public function getCompletion($lesson_id, $user_id) + { + $db = Factory::getDbo(); + $query = $db->getQuery(true); + + $query + ->select($db->quoteName(array('complete'))) + ->from($db->quoteName('#__tfl_completion')) + ->where($db->quoteName('lesson_id') . ' = '. $db->quote($lesson_id)) + ->andWhere($db->quoteName('user_id') . ' = '. $db->quote($user_id)) + ->setLimit('1'); + + $db->setQuery($query); + + $result = $db->loadResult(); + + return $result; + } + + // 05. Get total number of lessons in course (Check its usage and shift to Helper) + public function totalLessons($modules) + { + $module_ids = array(); + if (is_array($modules)) + { + foreach ($modules as $module) + { + $module_ids[] = $module['module_id']; + } + } + if (empty($module_ids)) + { + return false; + } + + $db = Factory::getDbo(); + $query = $db->getQuery(true); + + $query + ->select('COUNT(*)') + ->from($db->quoteName('#__tfl_lessons')) + ->where($db->quoteName('module') . ' IN (' . implode(',', $module_ids) . ')') + ->andWhere($db->quoteName('published') . ' = '. $db->quote(1)); + + $db->setQuery($query); + + $result = $db->loadResult(); + + return $result; + } +} \ No newline at end of file diff --git a/deployed/tflearn/administrator/components/com_tflearn/src/Model/CourseModel.php b/deployed/tflearn/administrator/components/com_tflearn/src/Model/CourseModel.php new file mode 100644 index 00000000..6f5d0f45 --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/src/Model/CourseModel.php @@ -0,0 +1,23 @@ +table_name = 'tfl_courses'; + + $this->subform_fields = array('modules'); + + parent::__construct($config); + } +} \ No newline at end of file diff --git a/deployed/tflearn/administrator/components/com_tflearn/src/Model/CoursesModel.php b/deployed/tflearn/administrator/components/com_tflearn/src/Model/CoursesModel.php new file mode 100644 index 00000000..f68a7f58 --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/src/Model/CoursesModel.php @@ -0,0 +1,25 @@ +table_name = 'tfl_courses'; + + $this->select_fields = array('a.id', 'a.title', 'a.alias', 'a.published', 'a.course_type', 'a.ordering', 'a.front', 'a.group_id', 'a.hits'); + + array_push($this->sorting_fields, 'a.course_type', 'a.front', 'a.group_id'); + + parent::__construct($config); + } +} \ No newline at end of file diff --git a/deployed/tflearn/administrator/components/com_tflearn/src/Model/DashboardModel.php b/deployed/tflearn/administrator/components/com_tflearn/src/Model/DashboardModel.php new file mode 100644 index 00000000..0d12bdaf --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/src/Model/DashboardModel.php @@ -0,0 +1,16 @@ +export_tables = array( + 'courses' => 'tfl_courses', + 'modules' => 'tfl_modules', + 'lessons' => 'tfl_lessons', + 'pages' => 'tfl_pages', + 'questions' => 'tfl_questions', + 'completions' => 'tfl_completion', + 'scores' => 'tfl_scores', + 'joomla_content' => 'content'); + + parent::__construct($config); + } +} \ No newline at end of file diff --git a/deployed/tflearn/administrator/components/com_tflearn/src/Model/ImportModel.php b/deployed/tflearn/administrator/components/com_tflearn/src/Model/ImportModel.php new file mode 100644 index 00000000..07870b6e --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/src/Model/ImportModel.php @@ -0,0 +1,26 @@ +import_tables = array( + 'courses' => 'tfl_courses', + 'modules' => 'tfl_modules', + 'lessons' => 'tfl_lessons', + 'pages' => 'tfl_pages', + 'questions' => 'tfl_questions'); + + parent::__construct($config); + } +} \ No newline at end of file diff --git a/deployed/tflearn/administrator/components/com_tflearn/src/Model/LessonModel.php b/deployed/tflearn/administrator/components/com_tflearn/src/Model/LessonModel.php new file mode 100644 index 00000000..c86c7656 --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/src/Model/LessonModel.php @@ -0,0 +1,23 @@ +table_name = 'tfl_lessons'; + + $this->subform_fields = array('jids', 'resources'); + + parent::__construct($config); + } +} \ No newline at end of file diff --git a/deployed/tflearn/administrator/components/com_tflearn/src/Model/LessonsModel.php b/deployed/tflearn/administrator/components/com_tflearn/src/Model/LessonsModel.php new file mode 100644 index 00000000..73b5c1e8 --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/src/Model/LessonsModel.php @@ -0,0 +1,33 @@ +table_name = 'tfl_lessons'; + + $this->select_fields = array('a.id', 'a.title', 'a.published', 'a.lesson_type', 'a.ordering', 'a.completion_type', 'a.pass_percent', 'a.hits', 'a.ref', 'b.title as mod_name'); + + $this->joins = array( + array('table' => 'tfl_modules', 'on' => 'module') + ); + + $this->filters['module'] = 'module'; + $this->filters['lesson_type'] = 'a.lesson_type'; + $this->filters['completion_type'] = 'a.completion_type'; + + array_push($this->sorting_fields, 'a.lesson_type', 'a.completion_type', 'mod_name', 'a.ref'); + + parent::__construct($config); + } +} \ No newline at end of file diff --git a/deployed/tflearn/administrator/components/com_tflearn/src/Model/ModuleModel.php b/deployed/tflearn/administrator/components/com_tflearn/src/Model/ModuleModel.php new file mode 100644 index 00000000..d7464a4a --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/src/Model/ModuleModel.php @@ -0,0 +1,21 @@ +table_name = 'tfl_modules'; + + parent::__construct($config); + } +} \ No newline at end of file diff --git a/deployed/tflearn/administrator/components/com_tflearn/src/Model/ModulesModel.php b/deployed/tflearn/administrator/components/com_tflearn/src/Model/ModulesModel.php new file mode 100644 index 00000000..b83b6826 --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/src/Model/ModulesModel.php @@ -0,0 +1,23 @@ +table_name = 'tfl_modules'; + + $this->select_fields = array('a.id', 'a.title', 'a.published'); + + parent::__construct($config); + } +} \ No newline at end of file diff --git a/deployed/tflearn/administrator/components/com_tflearn/src/Model/PageModel.php b/deployed/tflearn/administrator/components/com_tflearn/src/Model/PageModel.php new file mode 100644 index 00000000..c21affa6 --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/src/Model/PageModel.php @@ -0,0 +1,21 @@ +table_name = 'tfl_pages'; + + parent::__construct($config); + } +} \ No newline at end of file diff --git a/deployed/tflearn/administrator/components/com_tflearn/src/Model/PagesModel.php b/deployed/tflearn/administrator/components/com_tflearn/src/Model/PagesModel.php new file mode 100644 index 00000000..9731c80a --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/src/Model/PagesModel.php @@ -0,0 +1,25 @@ +table_name = 'tfl_pages'; + + $this->select_fields = array('a.id', 'a.title', 'a.alias', 'a.published', 'a.modified', 'a.hits', 'a.ref'); + + $this->sorting_fields[] = 'a.ref'; + + parent::__construct($config); + } +} \ No newline at end of file diff --git a/deployed/tflearn/administrator/components/com_tflearn/src/Model/QueryModel.php b/deployed/tflearn/administrator/components/com_tflearn/src/Model/QueryModel.php new file mode 100644 index 00000000..53e133af --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/src/Model/QueryModel.php @@ -0,0 +1,22 @@ +action_tables = array('courses' => 'tfl_courses', 'modules' => 'tfl_modules', 'lessons' => 'tfl_lessons', 'questions' => 'tfl_questions', + 'completions' => 'tfl_completion', 'scores' => 'tfl_scores', 'users' => 'users'); + + parent::__construct($config); + } +} \ No newline at end of file diff --git a/deployed/tflearn/administrator/components/com_tflearn/src/Model/QuestionModel.php b/deployed/tflearn/administrator/components/com_tflearn/src/Model/QuestionModel.php new file mode 100644 index 00000000..3e5dde10 --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/src/Model/QuestionModel.php @@ -0,0 +1,23 @@ +table_name = 'tfl_questions'; + + $this->subform_fields = array('options', 'matching'); + + parent::__construct($config); + } +} \ No newline at end of file diff --git a/deployed/tflearn/administrator/components/com_tflearn/src/Model/QuestionsModel.php b/deployed/tflearn/administrator/components/com_tflearn/src/Model/QuestionsModel.php new file mode 100644 index 00000000..8d38a3d9 --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/src/Model/QuestionsModel.php @@ -0,0 +1,49 @@ +table_name = 'tfl_questions'; + + $this->select_fields = array('a.id', 'a.title', 'a.published', 'a.q_type', 'b.title as lesson'); + + $this->joins = array( + array('table' => 'tfl_lessons', 'on' => 'lesson_id') + ); + + $this->filters['lesson'] = 'lesson_id'; + $this->filters['q_type'] = 'a.q_type'; + + array_push($this->sorting_fields, 'a.q_type', 'lesson'); + + parent::__construct($config); + } + +// ***************************************************************************** + + public function get_question_type($id) + { + $question_types = array( + 'Not Defined', + 'Multiple Choice - Single', + 'Multiple Choice - Multi', + 'Numerical', 'Short Answer', + 'Matching', + 'True False', + 'Description' + ); + + return $question_types[$id]; + } +} \ No newline at end of file diff --git a/deployed/tflearn/administrator/components/com_tflearn/src/Model/ScoreModel.php b/deployed/tflearn/administrator/components/com_tflearn/src/Model/ScoreModel.php new file mode 100644 index 00000000..33e4f04b --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/src/Model/ScoreModel.php @@ -0,0 +1,40 @@ +table_name = 'tfl_scores'; + + $this->subform_fields = array('modules'); + + parent::__construct($config); + } + +// ***************************************************************************** + + public function getAttempts($attempts) + { + $qModel = new QuestionModel; + $questions = array(); + + foreach ($attempts as $k => $v) + { + $qid = substr($k, 1); + $questions[] = $qModel->getItem($qid); + } + + return $questions; + } +} \ No newline at end of file diff --git a/deployed/tflearn/administrator/components/com_tflearn/src/Model/ScoresModel.php b/deployed/tflearn/administrator/components/com_tflearn/src/Model/ScoresModel.php new file mode 100644 index 00000000..4bf9f7d7 --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/src/Model/ScoresModel.php @@ -0,0 +1,28 @@ +table_name = 'tfl_scores'; + + $this->select_fields = array('a.id', 'a.published', 'a.grade', 'a.created', 'a.created_by', 'b.title as lesson'); + + $this->joins = array( + array('table' => 'tfl_lessons', 'on' => 'lesson_id')); + + array_push($this->sorting_fields, 'a.grade', 'a.created_by', 'a.created', 'lesson'); + + parent::__construct($config); + } +} \ No newline at end of file diff --git a/deployed/tflearn/administrator/components/com_tflearn/src/Table/CompletionTable.php b/deployed/tflearn/administrator/components/com_tflearn/src/Table/CompletionTable.php new file mode 100644 index 00000000..3e5f100e --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/src/Table/CompletionTable.php @@ -0,0 +1,20 @@ + + + COM_TFLEARN + Tech Fry + August 2022 + Tech Fry + http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL + mail@techfry.com + https://www.techfry.com + 1.7.5 + COM_TFLEARN_DESC + + TechFry\Component\TfLearn + + script.php + + + + sql/install.mysql.utf8.sql + + + + + sql/uninstall.mysql.utf8.sql + + + + + sql/updates/mysql + + + + + forms + language + src + tmpl + + + + COM_TFLEARN_MENU + + COM_TFLEARN_SUBMENU_DASHBOARD + COM_TFLEARN_SUBMENU_COURSES + COM_TFLEARN_SUBMENU_MODULES + COM_TFLEARN_SUBMENU_LESSONS + COM_TFLEARN_SUBMENU_PAGES + COM_TFLEARN_SUBMENU_QUESTIONS + COM_TFLEARN_SUBMENU_COMPLETIONS + COM_TFLEARN_SUBMENU_SCORES + + + access.xml + config.xml + forms + language + services + sql + src + tmpl + + + + + https://labs.techfry.com/joomla/components/com_tflearn/extension_free.xml + + diff --git a/deployed/tflearn/administrator/components/com_tflearn/tmpl/completion/edit.php b/deployed/tflearn/administrator/components/com_tflearn/tmpl/completion/edit.php new file mode 100644 index 00000000..59fe42b0 --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/tmpl/completion/edit.php @@ -0,0 +1,16 @@ + + +start_form_layout(); ?> + + add_tab_forms(array('general', 'options'), 'COM_TFLEARN_COMPLETION'); ?> + + add_tab_form('details', 'JDETAILS'); ?> + +end_form_layout(); ?> \ No newline at end of file diff --git a/deployed/tflearn/administrator/components/com_tflearn/tmpl/completions/default.php b/deployed/tflearn/administrator/components/com_tflearn/tmpl/completions/default.php new file mode 100644 index 00000000..3e8d1059 --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/tmpl/completions/default.php @@ -0,0 +1,51 @@ +ths = array( + array('COM_TFLEARN_LESSON', 'lesson'), + array('COM_TFLEARN_USER', 'a.user_id'), + array('COM_TFLEARN_COMPLETION'), + array('COM_TFLEARN_SCORE'), + array('JGLOBAL_CREATED', 'created') + ); +?> + +start_list_layout(); ?> + + items)) : ?> + + items as $i => $row) : + $link = Route::_('index.php?option=com_tflearn&view=completion&layout=edit&id=' . $row->id); + + $score = $this->getModel()->getScore($row->user_id, $row->lesson_id); + if ($score) {$total_marks = $row->questions * $row->marks;} + $score_display = $score ? $score . ' / ' . $total_marks : '-'; + ?> + + tr = array( + $this->get_link($link, $row->lesson), + + $this->get_user($row->user_id), + + $this->get_binary($row->complete), + + $score_display, + + $this->get_date($row->created) + ); + + echo $this->add_tr($i, $row); + ?> + + + + +end_list_layout(); ?> diff --git a/deployed/tflearn/administrator/components/com_tflearn/tmpl/completions/emptystate.php b/deployed/tflearn/administrator/components/com_tflearn/tmpl/completions/emptystate.php new file mode 100644 index 00000000..81d2a971 --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/tmpl/completions/emptystate.php @@ -0,0 +1,10 @@ + + +es_layout(); ?> \ No newline at end of file diff --git a/deployed/tflearn/administrator/components/com_tflearn/tmpl/course/edit.php b/deployed/tflearn/administrator/components/com_tflearn/tmpl/course/edit.php new file mode 100644 index 00000000..7c1cbc72 --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/tmpl/course/edit.php @@ -0,0 +1,20 @@ + + +start_form_layout(); ?> + + add_tab_forms(array('description', 'options'), 'COM_TFLEARN_COURSE'); ?> + + add_tab_form('modulesinfo', 'COM_TFLEARN_MODULES'); ?> + + add_tab_form('imageinfo', 'COM_TFLEARN_IMAGE'); ?> + + add_tab_form('details', 'JDETAILS'); ?> + +end_form_layout(); ?> \ No newline at end of file diff --git a/deployed/tflearn/administrator/components/com_tflearn/tmpl/courses/default.php b/deployed/tflearn/administrator/components/com_tflearn/tmpl/courses/default.php new file mode 100644 index 00000000..b53d9780 --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/tmpl/courses/default.php @@ -0,0 +1,58 @@ +ths = array( + array('JGRID_HEADING_ORDERING', 'a.ordering'), + array('JGLOBAL_TITLE', 'a.title'), + array('COM_TFLEARN_USER_GROUP', 'a.group_id'), + array('COM_TFLEARN_USERS'), + array('COM_TFLEARN_FRONT', 'a.front'), + array('COM_TF_TYPE', 'a.course_type'), + array('JGLOBAL_HITS', 'a.hits') + ); +?> + +start_list_layout(); ?> + + items)) : ?> + + items as $i => $row) : + $link = Route::_('index.php?option=com_tflearn&view=course&layout=edit&id=' . $row->id); + + $total_users = TfUser::total_users_by_group($row->group_id); + + $group = TfDb::get_item('usergroups', $row->group_id); + ?> + + tr = array( + $row->ordering, + + $this->get_link($link, $row->title) . $this->get_small($row->alias), + + $group->title . $this->get_small('Group ID: ' . $row->group_id), + + $this->get_number($total_users), + + $this->get_binary($row->front), + + $row->course_type, + + $this->get_number($row->hits, 'info') + ); + + echo $this->add_tr($i, $row); + ?> + + + +end_list_layout(); ?> diff --git a/deployed/tflearn/administrator/components/com_tflearn/tmpl/courses/emptystate.php b/deployed/tflearn/administrator/components/com_tflearn/tmpl/courses/emptystate.php new file mode 100644 index 00000000..81d2a971 --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/tmpl/courses/emptystate.php @@ -0,0 +1,10 @@ + + +es_layout(); ?> \ No newline at end of file diff --git a/deployed/tflearn/administrator/components/com_tflearn/tmpl/dashboard/default.php b/deployed/tflearn/administrator/components/com_tflearn/tmpl/dashboard/default.php new file mode 100644 index 00000000..8dc3507d --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/tmpl/dashboard/default.php @@ -0,0 +1,26 @@ +tiles_table = array( + array('courses', 'tfl_courses', 'graduation-cap'), + array('modules', 'tfl_modules', 'tags'), + array('lessons', 'tfl_lessons', 'book-open'), + array('pages', 'tfl_pages', 'file-alt'), + array('questions', 'tfl_questions', 'puzzle-piece'), + array('scores', 'tfl_scores', 'award'), + array('completions', 'tfl_completion', 'tasks') + ); + +$this->doc_link = 'https://www.techfry.com/docs/tf-learn'; + +$this->review_link = 'https://extensions.joomla.org/extension/tf-learn/'; +?> + +start_dashboard_layout(); ?> + +end_dashboard_layout(); ?> \ No newline at end of file diff --git a/deployed/tflearn/administrator/components/com_tflearn/tmpl/export/default.php b/deployed/tflearn/administrator/components/com_tflearn/tmpl/export/default.php new file mode 100644 index 00000000..653386b6 --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/tmpl/export/default.php @@ -0,0 +1,16 @@ + + +start_form_layout(); ?> + + add_tab_forms(array('general', 'options'), 'COM_TF_EXPORT', array(6, 6)); ?> + + add_tab_form('filters', 'COM_TF_FILTER'); ?> + +end_form_layout(); ?> \ No newline at end of file diff --git a/deployed/tflearn/administrator/components/com_tflearn/tmpl/import/default.php b/deployed/tflearn/administrator/components/com_tflearn/tmpl/import/default.php new file mode 100644 index 00000000..02dc07d4 --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/tmpl/import/default.php @@ -0,0 +1,10 @@ +import_layout(); +?> \ No newline at end of file diff --git a/deployed/tflearn/administrator/components/com_tflearn/tmpl/lesson/edit.php b/deployed/tflearn/administrator/components/com_tflearn/tmpl/lesson/edit.php new file mode 100644 index 00000000..10f59b6d --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/tmpl/lesson/edit.php @@ -0,0 +1,24 @@ + + +start_form_layout(); ?> + + add_tab_forms(array('description', 'options'), 'COM_TFLEARN_LESSON'); ?> + + add_tab_form('lessoninfo', 'JGLOBAL_FIELDSET_OPTIONS'); ?> + + add_tab_form('contents', 'COM_TFLEARN_CONTENT'); ?> + + add_tab_form('resources', 'COM_TFLEARN_RESOURCES'); ?> + + add_tab_form('questions', 'COM_TFLEARN_QUESTIONS'); ?> + + add_tab_form('details', 'JDETAILS'); ?> + +end_form_layout(); ?> \ No newline at end of file diff --git a/deployed/tflearn/administrator/components/com_tflearn/tmpl/lessons/default.php b/deployed/tflearn/administrator/components/com_tflearn/tmpl/lessons/default.php new file mode 100644 index 00000000..f10947ee --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/tmpl/lessons/default.php @@ -0,0 +1,58 @@ +ths = array( + array('JGRID_HEADING_ORDERING', 'a.ordering'), + array('COM_TFLEARN_REFERENCE', 'a.ref'), + array('JGLOBAL_TITLE', 'a.title'), + array('COM_TFLEARN_QUESTIONS'), + array('COM_TF_TYPE', 'a.lesson_type'), + array('COM_TFLEARN_COMPLETION', 'a.completion_type'), + array('COM_TFLEARN_MODULE', 'mod_name'), + array('JGLOBAL_HITS', 'a.hits') + ); +?> + +start_list_layout(); ?> + + items)) : ?> + + items as $i => $row) : + $link = Route::_('index.php?option=com_tflearn&&view=lesson&layout=edit&id=' . $row->id); + + $total_questions = $this->getModel()->count_items('tfl_questions', 'lesson_id', $row->id); + ?> + + tr = array( + $row->ordering, + + $row->ref, + + $this->get_link($link, $row->title), + + $this->get_number($total_questions), + + $row->lesson_type, + + $row->completion_type . $this->get_small(($row->completion_type == 'score') ? $row->pass_percent . '%': ''), + + $row->mod_name, + + $this->get_number($row->hits, 'info') + ); + + echo $this->add_tr($i, $row); + ?> + + + + +end_list_layout(); ?> diff --git a/deployed/tflearn/administrator/components/com_tflearn/tmpl/lessons/emptystate.php b/deployed/tflearn/administrator/components/com_tflearn/tmpl/lessons/emptystate.php new file mode 100644 index 00000000..81d2a971 --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/tmpl/lessons/emptystate.php @@ -0,0 +1,10 @@ + + +es_layout(); ?> \ No newline at end of file diff --git a/deployed/tflearn/administrator/components/com_tflearn/tmpl/module/edit.php b/deployed/tflearn/administrator/components/com_tflearn/tmpl/module/edit.php new file mode 100644 index 00000000..53039763 --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/tmpl/module/edit.php @@ -0,0 +1,16 @@ + + +start_form_layout(); ?> + + add_tab_forms(array('description', 'options'), 'COM_TFLEARN_MODULE'); ?> + + add_tab_form('details', 'JDETAILS'); ?> + +end_form_layout(); ?> \ No newline at end of file diff --git a/deployed/tflearn/administrator/components/com_tflearn/tmpl/modules/default.php b/deployed/tflearn/administrator/components/com_tflearn/tmpl/modules/default.php new file mode 100644 index 00000000..504fdcbe --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/tmpl/modules/default.php @@ -0,0 +1,40 @@ +ths = array( + array('JGLOBAL_TITLE', 'a.title'), + array('COM_TFLEARN_LESSONS') + ); +?> + +start_list_layout(); ?> + + items)) : ?> + + items as $i => $row) : + $link = Route::_('index.php?option=com_tflearn&view=module&layout=edit&id=' . $row->id); + + $total_lessons = $this->getModel()->count_items('tfl_lessons', 'module', $row->id); + ?> + + tr = array( + $this->get_link($link, $row->title), + + $this->get_number($total_lessons) + ); + + echo $this->add_tr($i, $row); + ?> + + + + +end_list_layout(); ?> diff --git a/deployed/tflearn/administrator/components/com_tflearn/tmpl/modules/emptystate.php b/deployed/tflearn/administrator/components/com_tflearn/tmpl/modules/emptystate.php new file mode 100644 index 00000000..81d2a971 --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/tmpl/modules/emptystate.php @@ -0,0 +1,10 @@ + + +es_layout(); ?> \ No newline at end of file diff --git a/deployed/tflearn/administrator/components/com_tflearn/tmpl/page/edit.php b/deployed/tflearn/administrator/components/com_tflearn/tmpl/page/edit.php new file mode 100644 index 00000000..81f225e1 --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/tmpl/page/edit.php @@ -0,0 +1,16 @@ + + +start_form_layout(); ?> + + add_tab_forms(array('description', 'options'), 'COM_TFLEARN_PAGE'); ?> + + add_tab_form('details', 'JDETAILS'); ?> + +end_form_layout(); ?> \ No newline at end of file diff --git a/deployed/tflearn/administrator/components/com_tflearn/tmpl/pages/default.php b/deployed/tflearn/administrator/components/com_tflearn/tmpl/pages/default.php new file mode 100644 index 00000000..90af6605 --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/tmpl/pages/default.php @@ -0,0 +1,44 @@ +ths = array( + array('COM_TFLEARN_REFERENCE', 'a.ref'), + array('JGLOBAL_TITLE', 'a.title'), + array('JGLOBAL_MODIFIED', 'a.modified'), + array('JGLOBAL_HITS', 'a.hits') + ); +?> + +start_list_layout(); ?> + + items)) : ?> + + items as $i => $row) : + $link = Route::_('index.php?option=com_tflearn&&view=page&layout=edit&id=' . $row->id); + ?> + + tr = array( + $row->ref, + + $this->get_link($link, $row->title) . $this->get_small($row->alias), + + $this->get_date($row->modified), + + $this->get_number($row->hits, 'info') + ); + + echo $this->add_tr($i, $row); + ?> + + + + +end_list_layout(); ?> diff --git a/deployed/tflearn/administrator/components/com_tflearn/tmpl/pages/emptystate.php b/deployed/tflearn/administrator/components/com_tflearn/tmpl/pages/emptystate.php new file mode 100644 index 00000000..81d2a971 --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/tmpl/pages/emptystate.php @@ -0,0 +1,10 @@ + + +es_layout(); ?> \ No newline at end of file diff --git a/deployed/tflearn/administrator/components/com_tflearn/tmpl/query/default.php b/deployed/tflearn/administrator/components/com_tflearn/tmpl/query/default.php new file mode 100644 index 00000000..c30fa7ef --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/tmpl/query/default.php @@ -0,0 +1,14 @@ + + +start_form_layout(); ?> + + add_tab_forms(array('general', 'filters'), 'COM_TF_QUERY', array(3, 9)); ?> + +end_form_layout(); ?> \ No newline at end of file diff --git a/deployed/tflearn/administrator/components/com_tflearn/tmpl/question/edit.php b/deployed/tflearn/administrator/components/com_tflearn/tmpl/question/edit.php new file mode 100644 index 00000000..69452d50 --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/tmpl/question/edit.php @@ -0,0 +1,18 @@ + + +start_form_layout(); ?> + + add_tab_forms(array('description', 'options'), 'COM_TFLEARN_QUESTION'); ?> + + add_tab_forms(array('questioninfo', 'answerinfo'), 'JGLOBAL_FIELDSET_OPTIONS'); ?> + + add_tab_form('details', 'JDETAILS'); ?> + +end_form_layout(); ?> \ No newline at end of file diff --git a/deployed/tflearn/administrator/components/com_tflearn/tmpl/questions/default.php b/deployed/tflearn/administrator/components/com_tflearn/tmpl/questions/default.php new file mode 100644 index 00000000..68e2dbd4 --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/tmpl/questions/default.php @@ -0,0 +1,42 @@ +ths = array( + array('JGLOBAL_TITLE', 'a.title'), + array('COM_TF_TYPE', 'a.q_type'), + array('COM_TFLEARN_LESSON', 'lesson') + ); +?> + +start_list_layout(); ?> + + items)) : ?> + + items as $i => $row) : + $link = Route::_('index.php?option=com_tflearn&&view=question&layout=edit&id=' . $row->id); + ?> + + tr = array( + $this->get_link($link, $row->title), + + $this->getModel()->get_question_type($row->q_type), + + $row->lesson + ); + + echo $this->add_tr($i, $row); + ?> + + + + + +end_list_layout(); ?> diff --git a/deployed/tflearn/administrator/components/com_tflearn/tmpl/questions/emptystate.php b/deployed/tflearn/administrator/components/com_tflearn/tmpl/questions/emptystate.php new file mode 100644 index 00000000..81d2a971 --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/tmpl/questions/emptystate.php @@ -0,0 +1,10 @@ + + +es_layout(); ?> \ No newline at end of file diff --git a/deployed/tflearn/administrator/components/com_tflearn/tmpl/score/edit.php b/deployed/tflearn/administrator/components/com_tflearn/tmpl/score/edit.php new file mode 100644 index 00000000..7480016b --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/tmpl/score/edit.php @@ -0,0 +1,18 @@ + + +start_form_layout(); ?> + + add_tab_forms(array('general', 'options'), 'COM_TFLEARN_SCORE'); ?> + + add_tab_tmpl('attempts', 'COM_TFLEARN_ATTEMPTS'); ?> + + add_tab_form('details', 'JDETAILS'); ?> + +end_form_layout(); ?> \ No newline at end of file diff --git a/deployed/tflearn/administrator/components/com_tflearn/tmpl/score/edit_attempts.php b/deployed/tflearn/administrator/components/com_tflearn/tmpl/score/edit_attempts.php new file mode 100644 index 00000000..ed45ae39 --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/tmpl/score/edit_attempts.php @@ -0,0 +1,40 @@ +item->attempts, true); +$questions = $this->getModel()->getAttempts($attempts); + +foreach ($questions as $question) +{ + $options_arr = json_decode($question->options, true); + $qname = 'q' . $question->id; + $i = 0; + + echo '' . $question->description . ''; + echo '
    '; + foreach ($options_arr as $option) + { + echo '
  • '; + if ($attempts[$qname] == $i) + { + $icon = isset($option['is_correct']) ? 'publish' : 'unpublish'; + echo ' '; + } + echo $option['opt']; + if (isset($option['is_correct']) && $option['is_correct']) + { + echo ' '; + } + echo '
  • '; + $i++; + } + echo '
'; + + echo '
'; +} +?> \ No newline at end of file diff --git a/deployed/tflearn/administrator/components/com_tflearn/tmpl/scores/default.php b/deployed/tflearn/administrator/components/com_tflearn/tmpl/scores/default.php new file mode 100644 index 00000000..4f91cdd1 --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/tmpl/scores/default.php @@ -0,0 +1,44 @@ +ths = array( + array('COM_TFLEARN_LESSON', 'lesson'), + array('COM_TFLEARN_USER', 'a.created_by'), + array('COM_TFLEARN_GRADE', 'a.grade'), + array('JGLOBAL_CREATED', 'a.created') + ); +?> + +start_list_layout(); ?> + + items)) : ?> + + items as $i => $row) : + $link = Route::_('index.php?option=com_tflearn&view=score&layout=edit&id=' . $row->id); + ?> + + tr = array( + $this->get_link($link, $row->lesson), + + $this->get_user($row->created_by), + + $row->grade, + + $this->get_date($row->created) + ); + + echo $this->add_tr($i, $row); + ?> + + + + +end_list_layout(); ?> diff --git a/deployed/tflearn/administrator/components/com_tflearn/tmpl/scores/emptystate.php b/deployed/tflearn/administrator/components/com_tflearn/tmpl/scores/emptystate.php new file mode 100644 index 00000000..81d2a971 --- /dev/null +++ b/deployed/tflearn/administrator/components/com_tflearn/tmpl/scores/emptystate.php @@ -0,0 +1,10 @@ + + +es_layout(); ?> \ No newline at end of file diff --git a/deployed/tflearn/components/com_tflearn/forms/test.xml b/deployed/tflearn/components/com_tflearn/forms/test.xml new file mode 100644 index 00000000..8d36ce9e --- /dev/null +++ b/deployed/tflearn/components/com_tflearn/forms/test.xml @@ -0,0 +1,29 @@ + +
+
+ + + +
+ +
+ + + + + + + +
+
\ No newline at end of file diff --git a/deployed/tflearn/components/com_tflearn/language/en-GB/en-GB.com_tflearn.ini b/deployed/tflearn/components/com_tflearn/language/en-GB/en-GB.com_tflearn.ini new file mode 100644 index 00000000..b72405be --- /dev/null +++ b/deployed/tflearn/components/com_tflearn/language/en-GB/en-GB.com_tflearn.ini @@ -0,0 +1,57 @@ +COM_TFLEARN_ALL_PAGES="All Pages" + +COM_TFLEARN_CAPTCHA="Captcha" + +COM_TFLEARN_COMPLETION_STATUS="Completion Status" +COM_TFLEARN_COMPLETED="Completed" + +COM_TFLEARN_COURSE_COMPLETE="My Course is Complete" +COM_TFLEARN_COURSE_COMPLETE_SUCCESSFUL="You have completed the course." + +COM_TFLEARN_EMAIL="Email" +COM_TFLEARN_EMAIL_NEW_ENROLMENT="New Enrollment By" + +COM_TFLEARN_EMAIL_SUBJECT_TEST="Your Test Score" +COM_TFLEARN_EMAIL_TEST_BY="Test By" + +COM_TFLEARN_ENROL_NOW="Enrol Now" +COM_TFLEARN_ENROL_SUCCESSFUL="You have successfully enrolled in the course." + +COM_TFLEARN_GUEST="Guest" + +COM_TFLEARN_MARK_COMPLETE="Mark as Complete" +COM_TFLEARN_MARK_INCOMPLETE="Mark as Incomplete" + +COM_TFLEARN_MESSAGE_ALREADY_ENROLLED="You are already enrolled in the course." +COM_TFLEARN_MESSAGE_ATTEMPT_GAP="You can take this test again after " +COM_TFLEARN_MESSAGE_LESSON_COMPLETE="Lesson marked as complete." +COM_TFLEARN_MESSAGE_LESSON_INCOMPLETE="Lesson marked as incomplete." +COM_TFLEARN_MESSAGE_SINGLE_ATTEMPT="You can take this test only once." +COM_TFLEARN_MESSAGE_ENROL_NOT_SETUP="Enrollment form is not ready." + +COM_TFLEARN_NAME="Name" + +COM_TFLEARN_PASSWORD="Password" + +COM_TFLEARN_SCORE="Score" + +COM_TFLEARN_TEST="Test" + +COM_TFLEARN_TEXT_GO_TO_COURSE="Go to course" +COM_TFLEARN_TEXT_LESSONS_COMPLETED="Lessons Completed:" +COM_TFLEARN_TEXT_TOTAL_LESSONS="Total Lessons:" +COM_TFLEARN_TEXT_TOTAL_MARKS="Total Marks:" +COM_TFLEARN_TEXT_TOTAL_QUESTIONS="Total Questions:" + +COM_TFLEARN_USERNAME="Username" + +; Used by All +COM_TF_BUTTON_SEARCH="Search" +COM_TF_ERROR_INCORRECT_CAPTCHA="Incorrect captcha. Please try again." +COM_TF_FEED_READMORE="Read More" +COM_TF_GUEST="Guest" +COM_TF_INVALID_FILE_EXTENSION="Uploaded file extension is not valid. Please try again." +COM_TF_INVALID_FILE_SIZE="Uploaded file size exceeds maximum limit. Please try again." +COM_TF_MESSAGE_LOGIN="Please login or create an account to continue." +COM_TF_PLACEHOLDER_SEARCH="Search" +COM_TF_LOGIN_TO_CONTINUE="You don't have permission to access this. Please login to continue." \ No newline at end of file diff --git a/deployed/tflearn/components/com_tflearn/src/Controller/CompletionController.php b/deployed/tflearn/components/com_tflearn/src/Controller/CompletionController.php new file mode 100644 index 00000000..495c00a0 --- /dev/null +++ b/deployed/tflearn/components/com_tflearn/src/Controller/CompletionController.php @@ -0,0 +1,51 @@ +input->get('id', 0, 'int'); + + $lesson_id = $this->input->get('lesson_id', 0, 'int'); + + $user = Factory::getUser(); + + $model = $this->getModel('Completion'); + $model->change_state($lesson_id, $user->id, 1); + + $this->app->enqueueMessage(Text::_('COM_TFLEARN_MESSAGE_LESSON_COMPLETE'), 'success'); + + $this->app->redirect(Route::_('index.php?option=com_tflearn&view=path&id=' . $id, false)); + } + + // 02. Mark lesson as incomplete + public function incomplete() + { + $id = $this->input->get('id', 0, 'int'); + + $lesson_id = $this->input->get('lesson_id', 0, 'int'); + + $user = Factory::getUser(); + + $model = $this->getModel('Completion'); + $model->change_state($lesson_id, $user->id, 0); + + $this->app->enqueueMessage(Text::_('COM_TFLEARN_MESSAGE_LESSON_INCOMPLETE'), 'warning'); + + $this->app->redirect(Route::_('index.php?option=com_tflearn&view=path&id=' . $id, false)); + } +} \ No newline at end of file diff --git a/deployed/tflearn/components/com_tflearn/src/Controller/CourseController.php b/deployed/tflearn/components/com_tflearn/src/Controller/CourseController.php new file mode 100644 index 00000000..7c2c56cb --- /dev/null +++ b/deployed/tflearn/components/com_tflearn/src/Controller/CourseController.php @@ -0,0 +1,121 @@ +getModel(); + + $course_id = $this->input->get('id', '', 'INT'); + + $user = Factory::getUser(); + + // Guest users should be redirected to enrol form url or login + if ($user->guest) + { + $enrol_url = $model->get_param('enrol_url', ''); + if (empty($enrol_url)) + { + $enrol_url = Route::_('index.php?option=com_users&view=login'); + } + + $this->setRedirect($enrol_url); + } + else + { + $course = $model->getItem($course_id); + + // Check if user is already enrolled (Course group id is in user group ids) + if (in_array($course->group_id, $user->getAuthorisedGroups())) + { + $this->setMessage(Text::_('COM_TFLEARN_MESSAGE_ALREADY_ENROLLED'), 'info'); + } + else + { + TfUser::add_user_to_group($user->id, $course->group_id); + + // Notification email to admin + if ($model->get_param('notify_admin_enrol', 1)) + { + TfNotify::notify_admin(Text::_('COM_TFLEARN_EMAIL_NEW_ENROLMENT'), $this->get_email_body($user, $course)); + } + + // Send email to user + if ($model->get_param('notify_user_enrol', 0) && ComponentHelper::isEnabled('com_tfmail')) + { + $q = new \stdClass(); + $date = Factory::getDate(); + + $q->user_id = $user->id; + $q->mail_id = $this->get_param('notify_enrol_mail_id'); + $q->priority = 2; + $q->send_date = $date->toSQL(); + + TfDb::insert_update('tfm_queue', $q, false); + } + + $this->setMessage(Text::_('COM_TFLEARN_ENROL_SUCCESSFUL'), 'success'); + } + + $this->setRedirect(Route::_('index.php?option=com_tflearn&view=paths', false)); + } + } + + // When course is completed by user + public function complete() + { + $course_id = $this->input->get('id', '', 'INT'); + + $user = Factory::getUser(); + + // Send email to administrator + $model = $this->getModel(); + $course = $model->getItem($course_id); + + $subject = Text::_('COM_TFLEARN_COURSE_COMPLETE') . ': ' . $user->username; + $body = '

The user has completed the course: ' . $course->title . '.

'; + $body .= '

User ID: ' . $user->id . '

'; + $body .= '

Name: ' . $user->name . '

'; + $body .= '

Email ' . $user->email . '

'; + + TfNotify::notify_admin($subject, $body); + + $this->setMessage(Text::_('COM_TFLEARN_COURSE_COMPLETE_SUCCESSFUL')); + + $this->SetRedirect(Route::_('index.php?option=com_tflearn&view=paths', false)); + } + + public function get_email_body($user, $course) + { + $body = ''; + + $groups = TfUser::get_user_groups($user->id); + + $body .= '

Course' . ': ' . $course->title . '

'; + $body .= '

User ID' . ': ' . $user->id . '

'; + $body .= '

Name' . ': ' . $user->name . '

'; + $body .= '

Username' . ': ' . $user->username . '

'; + $body .= '

Email' . ': ' . $user->email . '

'; + $body .= '

User Groups' . ': ' . implode(', ', $groups) . '

'; + + return $body; + } +} \ No newline at end of file diff --git a/deployed/tflearn/components/com_tflearn/src/Controller/DisplayController.php b/deployed/tflearn/components/com_tflearn/src/Controller/DisplayController.php new file mode 100644 index 00000000..014b5e17 --- /dev/null +++ b/deployed/tflearn/components/com_tflearn/src/Controller/DisplayController.php @@ -0,0 +1,20 @@ +input->get('id', '', 'INT'); + + $lesson_id = $this->input->get('lesson_id', '', 'INT'); + + $this->setRedirect(Route::_('index.php?option=com_tflearn&view=test&course=' . $course_id . '&id=' . $lesson_id, false)); + } + + public function score() + { + $course_id = $this->input->get('id', '', 'INT'); + + $lesson_id = $this->input->get('lesson_id', '', 'INT'); + + $this->setRedirect(Route::_('index.php?option=com_tflearn&view=score&lesson_id=' . $lesson_id, false)); + } +} \ No newline at end of file diff --git a/deployed/tflearn/components/com_tflearn/src/Model/CompletionModel.php b/deployed/tflearn/components/com_tflearn/src/Model/CompletionModel.php new file mode 100644 index 00000000..9c20573a --- /dev/null +++ b/deployed/tflearn/components/com_tflearn/src/Model/CompletionModel.php @@ -0,0 +1,76 @@ +check($lesson_id, $user_id); + if ($result == null) + { + $data['id'] = 0; + $data['created'] = $date->toSQL(); + $data['modified'] = $date->toSQL(); + } + else + { + $data['id'] = $result->id; + $data['modified'] = $date->toSQL(); + } + + $data['published'] = 1; + $data['lesson_id'] = $lesson_id; + $data['user_id'] = $user_id; + $data['complete'] = $complete; + + $this->direct_save($data, 'tfl_completion'); + } + + // 02. Check if completion exists or not + public function check($lesson_id, $user_id) + { + $db = Factory::getDbo(); + $query = $db->getQuery(true); + + $query + ->select($db->quoteName(array('id', 'complete'))) + ->from($db->quoteName('#__tfl_completion')) + ->where($db->quoteName('lesson_id') . ' = '. $db->quote($lesson_id)) + ->andWhere($db->quoteName('user_id') . ' = '. $db->quote($user_id)) + ->setLimit('1'); + + $db->setQuery($query); + + $result = $db->loadObject(); + + return $result; + } +} \ No newline at end of file diff --git a/deployed/tflearn/components/com_tflearn/src/Model/CourseModel.php b/deployed/tflearn/components/com_tflearn/src/Model/CourseModel.php new file mode 100644 index 00000000..a70d96c9 --- /dev/null +++ b/deployed/tflearn/components/com_tflearn/src/Model/CourseModel.php @@ -0,0 +1,34 @@ +table_name = 'tfl_courses'; + + parent::__construct($config); + } + +// ***************************************************************************** + + public function get_lesson_title($content_id, $source) + { + $table = ($source == 'joomla') ? 'content' : 'tfl_pages'; + + $lesson = TfDb::get_item($table, $content_id); + + return $lesson->title; + } +} \ No newline at end of file diff --git a/deployed/tflearn/components/com_tflearn/src/Model/CoursesModel.php b/deployed/tflearn/components/com_tflearn/src/Model/CoursesModel.php new file mode 100644 index 00000000..1e1cfc42 --- /dev/null +++ b/deployed/tflearn/components/com_tflearn/src/Model/CoursesModel.php @@ -0,0 +1,36 @@ +table_name = 'tfl_courses'; + + $this->select_fields = '*'; + + $input = Factory::getApplication()->input; + $course_type = $input->get('course_type', '0'); + + $this->where = array(array('front', '=', 1)); + if ($course_type) + { + $this->where[] = array('course_type', '=', $course_type); + } + + $this->orderby = $this->get_param('courses_order_col', 'id') . ' ' . $this->get_param('courses_order_dirn', 'DESC'); + + parent::__construct($config, $factory); + } +} \ No newline at end of file diff --git a/deployed/tflearn/components/com_tflearn/src/Model/PageModel.php b/deployed/tflearn/components/com_tflearn/src/Model/PageModel.php new file mode 100644 index 00000000..997f5d5a --- /dev/null +++ b/deployed/tflearn/components/com_tflearn/src/Model/PageModel.php @@ -0,0 +1,78 @@ +table_name = 'tfl_lessons'; + + $this->json_fields = array('jids'); + + parent::__construct($config); + } + + // 02. Get Joomla Article + public function getArticle($article_id) + { + $conditions = array( + array('id', '=', $article_id), + array('state', '=', 1) + ); + + $record = TfDb::get_record('content', $conditions, null, 'title', 'introtext', 'fulltext'); + + return $record; + } + + // 03. Get Navigation Links + public function getNav($current_lesson, $module_id) + { + $nav = array(); + + $lessons_order_col = $this->get_param('lessons_order_col', 'id'); + $lessons_order_dirn = $this->get_param('lessons_order_dirn', 'ASC'); + + $order = $lessons_order_col . ' ' . $lessons_order_dirn; + + $conditions = array( + array('published', '=', 1), + array('module', '=', $module_id) + ); + + $lessons = TfDb::get_records('tfl_lessons', 'id, title, lesson_type', $conditions, $order); + + foreach ($lessons as $k => $lesson) + { + if ($lesson->id == $current_lesson) + { + $nav['next'] = $lessons[$k+1]; + $nav['pre'] = $lessons[$k-1]; + } + } + + return $nav; + } + + // 04. Mark lesson as complete + public function mark_complete($lesson_id, $user_id) + { + $compModel = new CompletionModel; + + $compModel->change_state($lesson_id, $user_id, 1); + } +} \ No newline at end of file diff --git a/deployed/tflearn/components/com_tflearn/src/Model/PathModel.php b/deployed/tflearn/components/com_tflearn/src/Model/PathModel.php new file mode 100644 index 00000000..76de8c14 --- /dev/null +++ b/deployed/tflearn/components/com_tflearn/src/Model/PathModel.php @@ -0,0 +1,100 @@ +table_name = 'tfl_courses'; + + $this->json_fields = array('modules'); + + parent::__construct($config); + } + + // 01. Get total number of lessons in course + public function total_lessons($modules) + { + $module_ids = array(); + foreach ($modules as $module_obj) + { + $module = (array) $module_obj; + $module_ids[] = $module['module_id']; + } + + $conditions = array( + array('module', 'IN (' . implode(',', $module_ids) . ')') + ); + + $result = TfDb::total_rows('tfl_lessons', $conditions); + + return $result; + } + + // 02. Get latest score for lesson and user + public function get_score($user_id, $lesson_id) + { + $lesson = TfDb::get_item('tfl_lessons', $lesson_id); + + $db = Factory::getDbo(); + $query = $db->getQuery(true); + + if ($lesson->grade_type == 'maximum') + { + $query->select('MAX(grade)'); + } + elseif ($lesson->grade_type == 'average') + { + $query->select('AVG(grade)'); + } + else + { + $query->select($db->quoteName('grade')); + $query->setLimit('1'); + } + + $query + ->from($db->quoteName('#__tfl_scores')) + ->where($db->quoteName('created_by') . ' = '. $db->quote($user_id)) + ->andWhere($db->quoteName('lesson_id') . ' = '. $db->quote($lesson_id)) + ->order('id DESC'); + + $db->setQuery($query); + + $result = $db->loadResult(); + + return $result; + } + + // 03. Get completion status for lesson and user + public function get_completion($lesson_id, $user_id) + { + $db = Factory::getDbo(); + $query = $db->getQuery(true); + + $query + ->select($db->quoteName(array('complete'))) + ->from($db->quoteName('#__tfl_completion')) + ->where($db->quoteName('lesson_id') . ' = '. $db->quote($lesson_id)) + ->andWhere($db->quoteName('user_id') . ' = '. $db->quote($user_id)) + ->setLimit('1'); + + $db->setQuery($query); + + $result = $db->loadResult(); + + return $result; + } +} \ No newline at end of file diff --git a/deployed/tflearn/components/com_tflearn/src/Model/PathsModel.php b/deployed/tflearn/components/com_tflearn/src/Model/PathsModel.php new file mode 100644 index 00000000..4fb4aeb3 --- /dev/null +++ b/deployed/tflearn/components/com_tflearn/src/Model/PathsModel.php @@ -0,0 +1,87 @@ +table_name = 'tfl_courses'; + + $this->select_fields = 'id, title, modules'; + + $user = Factory::getUser(); + $ugs = implode(',', $user->getAuthorisedGroups()); + + $this->where = array('group_id IN (' . $ugs . ')'); + + $this->orderby = $this->get_param('paths_order_col') . ' ' . $this->get_param('paths_order_dirn'); + + parent::__construct($config, $factory); + } + +// ***************************************************************************** + + // 01. Get total number of lessons in course + public function total_lessons($modules) + { + $module_ids = array(); + foreach ($modules as $module) + { + $module_ids[] = $module['module_id']; + } + + $conditions = array( + array('module', 'IN (' . implode(',', $module_ids) . ')') + ); + + $result = TfDb::total_rows('tfl_lessons', $conditions); + + return $result; + } + + // 02. Get completed lessons for a user + public function get_completion($user_id, $modules) + { + $complete = 0; + foreach ($modules as $module) + { + $lessons = TfDb::get_items('tfl_lessons', array(array('module', '=', $module['module_id']))); + + foreach ($lessons as $lesson) + { + $db = Factory::getDbo(); + $query = $db->getQuery(true); + + $query + ->select($db->quoteName(array('complete'))) + ->from($db->quoteName('#__tfl_completion')) + ->where($db->quoteName('lesson_id') . ' = '. $db->quote($lesson->id)) + ->andWhere($db->quoteName('user_id') . ' = '. $db->quote($user_id)) + ->setLimit('1'); + + $db->setQuery($query); + + $result = $db->loadResult(); + + if ($result) + { + $complete++; + } + } + } + + return $complete; + } +} \ No newline at end of file diff --git a/deployed/tflearn/components/com_tflearn/src/Model/ScoreModel.php b/deployed/tflearn/components/com_tflearn/src/Model/ScoreModel.php new file mode 100644 index 00000000..7b300ce2 --- /dev/null +++ b/deployed/tflearn/components/com_tflearn/src/Model/ScoreModel.php @@ -0,0 +1,48 @@ +table_name = 'tfl_scores'; + + $this->select_fields = array('attempts', 'created', 'grade'); + + $input = Factory::getApplication()->input; + $lesson_id = $input->get('lesson_id'); + + $user = Factory::getUser(); + + $this->where = array(array('lesson_id', '=', $lesson_id), array('created_by', '=', $user->id)); + + $this->orderby = 'id DESC'; + + parent::__construct($config, $factory); + } + + public function get_attempts($attempts) + { + $questions = array(); + + foreach ($attempts as $k => $v) + { + $qid = substr($k, 1); + $questions[] = TfDb::get_item('tfl_questions', $qid); + } + + return $questions; + } +} \ No newline at end of file diff --git a/deployed/tflearn/components/com_tflearn/src/Model/ScoresModel.php b/deployed/tflearn/components/com_tflearn/src/Model/ScoresModel.php new file mode 100644 index 00000000..61da579d --- /dev/null +++ b/deployed/tflearn/components/com_tflearn/src/Model/ScoresModel.php @@ -0,0 +1,38 @@ +table_name = 'tfl_scores'; + + $this->select_fields = array('lesson_id', 'created', 'grade'); + + $user = Factory::getUser(); + $this->where = array(array('created_by', '=', $user->id)); + + $this->orderby = 'id DESC'; + + parent::__construct($config, $factory); + } + + public function get_lesson_title($lesson_id) + { + $lesson = TfDb::get_item('tfl_lessons', $lesson_id); + + return $lesson->title; + } +} \ No newline at end of file diff --git a/deployed/tflearn/components/com_tflearn/src/Model/TestModel.php b/deployed/tflearn/components/com_tflearn/src/Model/TestModel.php new file mode 100644 index 00000000..6813a5d0 --- /dev/null +++ b/deployed/tflearn/components/com_tflearn/src/Model/TestModel.php @@ -0,0 +1,303 @@ +table_name = 'tfl_scores'; + + $this->loadData = false; + + parent::__construct($config, $factory, $formFactory); + } + + public function getTable($name = 'Score', $prefix = 'Administrator', $options = array()) + { + return parent::getTable($name, $prefix, $options); + } + +// ***************************************************************************** + + public function save($data) + { + $lesson = TfDb::get_item('tfl_lessons', $data['lesson_id']); + $data['published'] = 1; + + // Grade + $data['grade'] = 0; + $correct = 0; + foreach ($data['attempts'] as $k => $v) + { + if ($this->check_answer($k, $v)) + { + $data['grade'] = $data['grade'] + $data['marks']; + $correct++; + } + } + + // Calculate percentage + $total_marks = $lesson->questions * $lesson->marks; + $percentage = ($data['grade']/$total_marks) * 100; + $percentage = round($percentage, 2); + + // unset($data['marks']); + + // Convert array to JSON string + $data['attempts'] = json_encode($data['attempts']); + + $return = parent::save($data); + + // Mark completed if completion type is score and percent achieved + if ($percentage >= $lesson->pass_percent && $lesson->completion_type == 'score') + { + $compModel = $this->getModel('Completion'); + + $compModel->change_state($data['lesson_id'], $data['created_by'], 1); + } + + // Notify administrator of new test submission + if ($this->get_param('notify_admin_test', 1)) + { + TfNotify::notify_admin(Text::_('COM_TFLEARN_EMAIL_TEST_BY'), $data); + } + + // Email score to the test taker + if ($this->get_param('notify_user_test', 0) && ComponentHelper::isEnabled('com_tfmail')) + { + $q = new \stdClass(); + $date = Factory::getDate(); + + $q->user_id = $data['created_by']; + $q->mail_id = $model->get_param('notify_test_mail_id'); + $q->priority = 2; + $q->send_date = $date->toSql(); + + TfDb::insert_update('tfm_queue', $q, false); + } + + $test_report = 'Correct Attempts: ' . $correct . '
'; + $test_report .= 'Score: ' . $data['grade'] . '
'; + $test_report .= 'Percentage: ' . $percentage . '%'; + + $this->set_message($test_report, 'info'); + + return $return; + } + + // 01. Get questions for a lesson + public function getQuestions() + { + $input = Factory::getApplication()->input; + $lesson_id = $input->get('id', '', 'INT'); + + $db = Factory::getDbo(); + $query = $db->getQuery(true); + + $query + ->select('id, description, options, matching, answer, q_type') + ->from($db->quoteName('#__tfl_questions')) + ->where($db->quoteName('published') . ' = ' . $db->quote(1)); + + if ($lesson_id != null) + { + $query->andWhere($db->quoteName('lesson_id') . ' = ' . $db->quote($lesson_id)); + + $lesson = TfDb::get_item('tfl_lessons', $lesson_id); + + if (isset($lesson->questions)) + { + $query->setLimit($lesson->questions); + } + $query->order('RAND()'); + } + + $db->setQuery($query); + + $rows = $db->loadAssocList(); + + return $rows; + } + + public function getLesson($pk = null) + { + if ($pk == null) + { + $input = Factory::getApplication()->input; + $pk = $input->get('id', '', 'INT'); + } + + $db = Factory::getDbo(); + $query = $db->getQuery(true); + + $query + ->select('*') + ->from($db->quoteName('#__tfl_lessons')) + ->where($db->quoteName('id') . ' = '. $db->quote($pk)) + ->andWhere($db->quoteName('published') . ' = 1') + ->setLimit('1'); + + $db->setQuery($query); + + $row = $db->loadObject(); + + return $row; + } + + // Check whether answer given is correct or not + public function check_answer($qname, $answer) + { + $qid = substr($qname, 1); // $qname is like q34 + + $question = TfDb::get_item('tfl_questions', $qid); + + if ($question->q_type == 1) // MCQ - Single Correct + { + $options_arr = json_decode($question->options, true); + $num = 0; + foreach ($options_arr as $option) + { + if (isset($option['is_correct'])) + { + if ($option['is_correct']) + { + $correct_answer = $num; + } + } + $num++; + } + } + elseif ($question->q_type == 2) // MCQ - Multiple Correct + { + // $answer is array + + $options_arr = json_decode($question->options, true); + $num = 0; + $correct_answer = array(); + foreach ($options_arr as $option) + { + if (isset($option['is_correct'])) + { + if ($option['is_correct']) + { + $correct_answer[$num] = $num; + } + } + $num++; + } + } + elseif ($question->q_type == 3) // Numerical + { + $correct_answer = $question->answer; + } + elseif ($question->q_type == 4) // Short Answer + { + $correct_answer = strtolower($question->answer); + $answer = strtolower($answer); + } + elseif ($question->q_type == 5) // Matching + { + // $answer is array + + $matchings = json_decode($question->matching, true); + $correct_answer = array(); + + foreach ($matchings as $matching) + { + $correct_answer[] = $matching['col_b']; + } + } + elseif ($question->q_type == 6) // True False + { + if ($question->answer == 1 || strtoupper($question->answer) == 'T' || strtoupper($question->answer) == 'TRUE') + { + $correct_answer = 1; + } + else + { + $correct_answer = 0; + } + } + else + { + $correct_answer = $question->answer; + } + + return ($answer == $correct_answer) ? true : false; + } + + // Check whether student can take test + public function check_access($pk = null) + { + if ($pk == null) + { + $input = Factory::getApplication()->input; + $pk = $input->get('id', '', 'INT'); + } + + $user = Factory::getUser(); + $app = Factory::getApplication(); + + // Allow guest users to take test + if (!$user->id) + { + return true; + } + + // Get lesson + $lesson = TfDb::get_item('tfl_lessons', $pk); + + // Get previous attempts + $conditions = array(array('lesson_id', '=', $pk), array('created_by', '=', $user->id)); + $scores = TfDb::get_items('tfl_scores', $conditions, 'id DESC', 1); + $scores_arr = (array) $scores; + $score = $scores_arr[0]; + + if (empty($scores)) + { + return true; + } + + if (!$lesson->multiple_attempts) + { + $app->enqueueMessage(Text::_('COM_TFLEARN_MESSAGE_SINGLE_ATTEMPT'), 'warning'); + return false; + } + + if ($lesson->multiple_attempts && $lesson->attempt_gap == 0) + { + return true; + } + + $interval = new \DateInterval('P' . $lesson->attempt_gap . 'D'); + + $date = new Date($score->created); + $date->add($interval); + $today = new Date(); + + if ($today < $date) + { + $app->enqueueMessage(Text::_('COM_TFLEARN_MESSAGE_ATTEMPT_GAP') . $date->format('d F, Y'), 'warning'); + return false; + } + + return true; + } +} \ No newline at end of file diff --git a/deployed/tflearn/components/com_tflearn/src/Service/Router.php b/deployed/tflearn/components/com_tflearn/src/Service/Router.php new file mode 100644 index 00000000..437d9564 --- /dev/null +++ b/deployed/tflearn/components/com_tflearn/src/Service/Router.php @@ -0,0 +1,87 @@ +categoryFactory = $categoryFactory; + $this->db = $db; + + $courses = new RouterViewConfiguration('courses'); + $this->registerView($courses); + + $course = new RouterViewConfiguration('course'); + $course->setKey('id')->setParent($courses); + $this->registerView($course); + + $paths = new RouterViewConfiguration('paths'); + $this->registerView($paths); + + parent::__construct($app, $menu); + + $this->attachRule(new MenuRules($this)); + $this->attachRule(new StandardRules($this)); + $this->attachRule(new NomenuRules($this)); + } + + public function getCourseSegment($id, $query) + { + $db = Factory::getDbo(); + $dbquery = $db->getQuery(true); + + $dbquery->select($dbquery->qn('alias')) + ->from($dbquery->qn('#__tfl_courses')) + ->where('id = ' . $dbquery->q($id)); + + $db->setQuery($dbquery); + + $id .= ':' . $db->loadResult(); + + list($void, $segment) = explode(':', $id, 2); + + return array($void => $segment); + } + + public function getCourseId($segment, $query) + { + $db = Factory::getDbo(); + $dbquery = $db->getQuery(true); + + $dbquery->select($dbquery->qn('id')) + ->from($dbquery->qn('#__tfl_courses')) + ->where('alias = ' . $dbquery->q($segment)); + + $db->setQuery($dbquery); + + return (int) $db->loadResult(); + } +} \ No newline at end of file diff --git a/deployed/tflearn/components/com_tflearn/src/View/Course/HtmlView.php b/deployed/tflearn/components/com_tflearn/src/View/Course/HtmlView.php new file mode 100644 index 00000000..16e898d1 --- /dev/null +++ b/deployed/tflearn/components/com_tflearn/src/View/Course/HtmlView.php @@ -0,0 +1,24 @@ +initiate_item(); + + // Display the view + return parent::display($tpl); + } +} \ No newline at end of file diff --git a/deployed/tflearn/components/com_tflearn/src/View/Courses/FeedView.php b/deployed/tflearn/components/com_tflearn/src/View/Courses/FeedView.php new file mode 100644 index 00000000..b1f420ed --- /dev/null +++ b/deployed/tflearn/components/com_tflearn/src/View/Courses/FeedView.php @@ -0,0 +1,24 @@ +base_item_link = 'index.php?option=com_tflearn&view=course'; + + $this->current_link = Route::_('index.php?option=com_tflearn&view=courses'); + + $this->initiate_feed(); + } +} \ No newline at end of file diff --git a/deployed/tflearn/components/com_tflearn/src/View/Courses/HtmlView.php b/deployed/tflearn/components/com_tflearn/src/View/Courses/HtmlView.php new file mode 100644 index 00000000..8f641e62 --- /dev/null +++ b/deployed/tflearn/components/com_tflearn/src/View/Courses/HtmlView.php @@ -0,0 +1,31 @@ +initiate_list(); + + // Check for access + if (!in_array($this->getModel()->get_param('courses_access', 1), $this->user->getAuthorisedViewLevels())) + { + $this->handle_access(); + + return; + } + + // Display the view + return parent::display($tpl); + } +} \ No newline at end of file diff --git a/deployed/tflearn/components/com_tflearn/src/View/Page/HtmlView.php b/deployed/tflearn/components/com_tflearn/src/View/Page/HtmlView.php new file mode 100644 index 00000000..f9f8d75e --- /dev/null +++ b/deployed/tflearn/components/com_tflearn/src/View/Page/HtmlView.php @@ -0,0 +1,45 @@ +initiate_item(); + + $this->course_id = $this->app->input->get('course', '0'); + $course = TfDb::get_item('tfl_courses', $this->course_id); + + $this->section = $this->app->input->get('section', 'all'); + + $this->total_sections = count((array) $this->item->jids); + + // Check for access (Course group id should be in user group ids) + if (!in_array($course->group_id, $this->user->getAuthorisedGroups())) + { + $this->handle_access(); + + return; + } + + // Display the view + return parent::display($tpl); + } +} \ No newline at end of file diff --git a/deployed/tflearn/components/com_tflearn/src/View/Path/HtmlView.php b/deployed/tflearn/components/com_tflearn/src/View/Path/HtmlView.php new file mode 100644 index 00000000..de7411a8 --- /dev/null +++ b/deployed/tflearn/components/com_tflearn/src/View/Path/HtmlView.php @@ -0,0 +1,36 @@ +initiate_item(); + + // Check for access (Course group id should be in user group ids) + if (!in_array($this->item->group_id, $this->user->getAuthorisedGroups())) + { + $this->handle_access(); + + return; + } + + // Display the view + return parent::display($tpl); + } +} \ No newline at end of file diff --git a/deployed/tflearn/components/com_tflearn/src/View/Paths/HtmlView.php b/deployed/tflearn/components/com_tflearn/src/View/Paths/HtmlView.php new file mode 100644 index 00000000..fd4c9d1b --- /dev/null +++ b/deployed/tflearn/components/com_tflearn/src/View/Paths/HtmlView.php @@ -0,0 +1,22 @@ +initiate_list(); + + // Display the view + return parent::display($tpl); + } +} \ No newline at end of file diff --git a/deployed/tflearn/components/com_tflearn/src/View/Score/HtmlView.php b/deployed/tflearn/components/com_tflearn/src/View/Score/HtmlView.php new file mode 100644 index 00000000..8533c4c8 --- /dev/null +++ b/deployed/tflearn/components/com_tflearn/src/View/Score/HtmlView.php @@ -0,0 +1,28 @@ +initiate_list(); + + $lesson_id = $this->app->input->get('lesson_id', '0'); + $this->lesson = TfDb::get_item('tfl_lessons', $lesson_id); + + // Display the view + return parent::display($tpl); + } +} \ No newline at end of file diff --git a/deployed/tflearn/components/com_tflearn/src/View/Scores/HtmlView.php b/deployed/tflearn/components/com_tflearn/src/View/Scores/HtmlView.php new file mode 100644 index 00000000..dcbe4077 --- /dev/null +++ b/deployed/tflearn/components/com_tflearn/src/View/Scores/HtmlView.php @@ -0,0 +1,24 @@ +initiate_list(); + + // Display the view + return parent::display($tpl); + } +} \ No newline at end of file diff --git a/deployed/tflearn/components/com_tflearn/src/View/Test/HtmlView.php b/deployed/tflearn/components/com_tflearn/src/View/Test/HtmlView.php new file mode 100644 index 00000000..7b1b3a9d --- /dev/null +++ b/deployed/tflearn/components/com_tflearn/src/View/Test/HtmlView.php @@ -0,0 +1,91 @@ +loadData = false; + + $this->initiate_form(); + + $this->course_id = $this->app->input->get('course', '0'); + $course = TfDb::get_item('tfl_courses', $this->course_id); + + $this->questions = $this->get('Questions'); + + $this->lesson = $this->get('Lesson'); + + $this->_prepareDocument(); + + // Check for access (Course group id should be in user group ids) + if (!in_array($course->group_id, $this->user->getAuthorisedGroups())) + { + $this->handle_access(); + + return; + } + + // Check access for the test + $access = $this->getModel()->check_access(); + if (!$access) + { + $this->handle_access(); + + return; + } + + // Display the view + return parent::display($tpl); + } + + protected function _prepareDocument() + { + $app = Factory::getApplication(); + + // 01. Page heading of document + $menus = $app->getMenu(); + $menu = $menus->getActive(); + if ($menu) + { + $this->params->def('page_heading', $this->params->get('page_title', $menu->title)); + } + + // 02. Title of document + $title = $this->params->get('page_title', ''); + if (empty($title)) + { + if (is_object($this->lesson)) + { + $title = $this->lesson->title; + } + } + if ($app->get('sitename_pagetitles', 0) == 1) + { + $title = Text::sprintf('JPAGETITLE', $app->get('sitename'), $title); + } + elseif ($app->get('sitename_pagetitles', 0) == 2) + { + $title = Text::sprintf('JPAGETITLE', $title, $app->get('sitename')); + } + $this->document->setTitle($title); + } +} \ No newline at end of file diff --git a/deployed/tflearn/components/com_tflearn/tmpl/course/default.php b/deployed/tflearn/components/com_tflearn/tmpl/course/default.php new file mode 100644 index 00000000..7620e37d --- /dev/null +++ b/deployed/tflearn/components/com_tflearn/tmpl/course/default.php @@ -0,0 +1,92 @@ +get_param('course_layout', 'plain'); + +$modules = json_decode($this->item->modules, true); + +$course_modtitle_class = $this->get_param('course_modtitle_class', ''); +$mod_title_class = empty($course_modtitle_class) ? '' : ' class="' . $course_modtitle_class . '"'; + +$i = 1; +if (is_array($modules)) +{ + foreach ($modules as $module) + { + // Get lessons for each module + $mod = TfDb::get_item('tfl_modules', $module['module_id']); + + if ($mod->published) + { + $mod->title = empty($module['module_name']) ? $mod->title : $module['module_name']; + + $this->tabs[$i-1][0] = '' . $mod->title . ''; + + $lesson_order = $this->get_param('lessons_order_col', 'ordering') . ' ' . $this->get_param('lessons_order_dirn', 'ASC'); + $conditions = array( + array('module', '=', $module['module_id']), + array('published', '=', 1) + ); + $lessons = TfDb::get_items('tfl_lessons', $conditions, $lesson_order); + + foreach ($lessons as $lesson) + { + $this->lesson = $lesson; + + $this->tabs[$i-1][1] .= $this->loadTemplate('lesson'); + } + $i++; + } + } +} +?> + +item->title); + + // 2. Image + if (!empty($this->item->image) && $this->get_param('course_show_image')) + { + TfHtml::image($this->item->image, $this->item->title, 'img-fluid img-thumbnail mb-3'); + } + + // 3. Description + TfHtml::simple($this->item->description); + + // 4. Enrol button at top + if ($this->item->enrol != 'none') + { + $enrol_button_location = $this->get_param('enrol_button_location', 3); + if ($enrol_button_location == 1 || $enrol_button_location == 3) + { + echo $this->loadTemplate('button'); + } + } + + // 5. Modules and lessons + echo $this->loadTemplate('layout_' . $course_layout); + + // 6. Enrol button at botttom + if ($this->item->enrol != 'none') + { + if ($enrol_button_location == 2 || $enrol_button_location == 3) + { + echo $this->loadTemplate('button'); + } + } + + // 7. Structured data + if ($this->get_param('enable_sd', 0)) + { + echo $this->loadTemplate('tfsd'); + } +?> \ No newline at end of file diff --git a/deployed/tflearn/components/com_tflearn/tmpl/course/default_button.php b/deployed/tflearn/components/com_tflearn/tmpl/course/default_button.php new file mode 100644 index 00000000..47bd5874 --- /dev/null +++ b/deployed/tflearn/components/com_tflearn/tmpl/course/default_button.php @@ -0,0 +1,21 @@ +get_param('course_button_class') ? 'class="' . $this->get_param('course_button_class') . '"' : ''; + +if ($this->item->enrol == 'self') +{ + $this->action_button(Text::_('COM_TFLEARN_ENROL_NOW'), 'course.enrol', $this->get_param('course_button_class')); +} +elseif ($this->item->enrol == 'external') +{ + echo '' . Text::_('COM_TFLEARN_ENROL_NOW') . ''; +} +?> \ No newline at end of file diff --git a/deployed/tflearn/components/com_tflearn/tmpl/course/default_layout_accordion.php b/deployed/tflearn/components/com_tflearn/tmpl/course/default_layout_accordion.php new file mode 100644 index 00000000..61fdd074 --- /dev/null +++ b/deployed/tflearn/components/com_tflearn/tmpl/course/default_layout_accordion.php @@ -0,0 +1,11 @@ +tabs); \ No newline at end of file diff --git a/deployed/tflearn/components/com_tflearn/tmpl/course/default_layout_plain.php b/deployed/tflearn/components/com_tflearn/tmpl/course/default_layout_plain.php new file mode 100644 index 00000000..e8751c0b --- /dev/null +++ b/deployed/tflearn/components/com_tflearn/tmpl/course/default_layout_plain.php @@ -0,0 +1,11 @@ +tabs); \ No newline at end of file diff --git a/deployed/tflearn/components/com_tflearn/tmpl/course/default_layout_tabs.php b/deployed/tflearn/components/com_tflearn/tmpl/course/default_layout_tabs.php new file mode 100644 index 00000000..e65ef6d7 --- /dev/null +++ b/deployed/tflearn/components/com_tflearn/tmpl/course/default_layout_tabs.php @@ -0,0 +1,11 @@ +tabs); \ No newline at end of file diff --git a/deployed/tflearn/components/com_tflearn/tmpl/course/default_lesson.php b/deployed/tflearn/components/com_tflearn/tmpl/course/default_lesson.php new file mode 100644 index 00000000..c8e216ef --- /dev/null +++ b/deployed/tflearn/components/com_tflearn/tmpl/course/default_lesson.php @@ -0,0 +1,41 @@ + +
+

lesson->title; ?>

+ lesson->short_desc)) : ?> + lesson->short_desc; ?> + + + getModel()->get_param('auto_description'); + if ($auto_description) + { + $jids = json_decode($this->lesson->jids); + $titles = array(); + foreach ($jids as $jid) + { + $titles[] = $this->getModel()->get_lesson_title($jid->content_id, $this->lesson->content_source); + } + } + + if ($auto_description == 1) + { + echo implode('; ', $titles); + } + elseif ($auto_description == 2) + { + echo '
    '; + foreach ($titles as $title) + { + echo '
  • ' . $title . '
  • '; + } + echo '
'; + } + ?> +
\ No newline at end of file diff --git a/deployed/tflearn/components/com_tflearn/tmpl/course/default_tfsd.php b/deployed/tflearn/components/com_tflearn/tmpl/course/default_tfsd.php new file mode 100644 index 00000000..e1e97947 --- /dev/null +++ b/deployed/tflearn/components/com_tflearn/tmpl/course/default_tfsd.php @@ -0,0 +1,26 @@ +item->title); + +$json = TfSd::set_property($json, 'description', $this->item->short_desc); + +$provider = array( + '@type' => 'Organization', + 'name' => $this->get_param('provider', '') + ); + +$json = TfSd::set_property($json, 'provider', $provider); + +TfSd::display_sd($json); +?> \ No newline at end of file diff --git a/deployed/tflearn/components/com_tflearn/tmpl/courses/default.php b/deployed/tflearn/components/com_tflearn/tmpl/courses/default.php new file mode 100644 index 00000000..965562cf --- /dev/null +++ b/deployed/tflearn/components/com_tflearn/tmpl/courses/default.php @@ -0,0 +1,68 @@ +params->get('show_page_heading', 0)) +{ + $title_class = $this->get_param('courses_title_class', ''); + TfHtml::heading($this->escape($this->params->get('page_heading')), 'h1', $title_class); +} + +// 2. Description +TfHtml::simple($this->params->get('description', '')); + +// 3. No items messgae +if (empty($this->items)) +{ + Alert::display(Text::_('JGLOBAL_NO_MATCHING_RESULTS'), array('alert_class' => 'bg-warning')); +} +?> + +items)) : ?> + + params->get('num_columns', 2); + + $properties = array( + 'button_text' => $this->params->get('button_text'), + 'button_class' => $this->params->get('button_class'), + 'card_class' => $this->get_param('courses_item_class', '') + ); + + $options = array('show_title' => 1, 'show_date' => 0); + + echo '
'; + + foreach ($this->items as $course) : + + $course->url = Route::_('index.php?option=com_tflearn&view=course&id=' . $course->id); + + $course->description = $course->short_desc; + + Card::display($course, $properties, $options); + + endforeach; + + echo '
'; + ?> + + + +get_param('enable_sd', 0)) +{ + echo $this->loadTemplate('tfsd'); +} +?> \ No newline at end of file diff --git a/deployed/tflearn/components/com_tflearn/tmpl/courses/default.xml b/deployed/tflearn/components/com_tflearn/tmpl/courses/default.xml new file mode 100644 index 00000000..0a9ff0e4 --- /dev/null +++ b/deployed/tflearn/components/com_tflearn/tmpl/courses/default.xml @@ -0,0 +1,62 @@ + + + + Displays courses + + + +
+ + + + + + +
+
+ + +
+ + + + + + + + + + + + + + +
+ +
+
\ No newline at end of file diff --git a/deployed/tflearn/components/com_tflearn/tmpl/courses/default_tfsd.php b/deployed/tflearn/components/com_tflearn/tmpl/courses/default_tfsd.php new file mode 100644 index 00000000..4a946e3d --- /dev/null +++ b/deployed/tflearn/components/com_tflearn/tmpl/courses/default_tfsd.php @@ -0,0 +1,33 @@ +items as $course) +{ + $url = Route::_('index.php?option=com_tflearn&view=course&id=' . $course->id); + + $item_list[] = array( + '@type' => 'ListItem', + 'position' => $i, + 'url' => $url + ); + + $i++; +} + +$json = TfSd::set_property($json, 'itemListElement', $item_list); + +TfSd::display_sd($json); +?> \ No newline at end of file diff --git a/deployed/tflearn/components/com_tflearn/tmpl/page/default.php b/deployed/tflearn/components/com_tflearn/tmpl/page/default.php new file mode 100644 index 00000000..5291f89d --- /dev/null +++ b/deployed/tflearn/components/com_tflearn/tmpl/page/default.php @@ -0,0 +1,47 @@ +get_param('show_all_pages', 1)) +{ + echo ''; + echo ' ' . Text::_('COM_TFLEARN_ALL_PAGES') . ''; +} + +// 2. Page Title +$page_title_class = $this->get_param('page_title_class', ''); +TfHtml::heading($this->item->title, 'h1', $page_title_class); + +// 3. Description +if ($this->get_param('prepare_content', 0)) +{ + $this->item->description = HTMLHelper::_('content.prepare', $this->item->description); +} +TfHtml::simple($this->item->description); + +// 4. Sections - all or one at a time +if ($this->section == 'all') +{ + echo $this->loadTemplate('sections'); +} +elseif ($this->section <= $this->total_sections) +{ + echo $this->loadTemplate('section'); +} + +// 5. Lesson navigation +if ($this->get_param('show_nav', 1)) +{ + echo $this->loadTemplate('navigation'); +} +?> diff --git a/deployed/tflearn/components/com_tflearn/tmpl/page/default_navigation.php b/deployed/tflearn/components/com_tflearn/tmpl/page/default_navigation.php new file mode 100644 index 00000000..1b7cdba8 --- /dev/null +++ b/deployed/tflearn/components/com_tflearn/tmpl/page/default_navigation.php @@ -0,0 +1,28 @@ +getModel()->getNav($this->item->id, $this->item->module); +?> + \ No newline at end of file diff --git a/deployed/tflearn/components/com_tflearn/tmpl/page/default_section.php b/deployed/tflearn/components/com_tflearn/tmpl/page/default_section.php new file mode 100644 index 00000000..80672b74 --- /dev/null +++ b/deployed/tflearn/components/com_tflearn/tmpl/page/default_section.php @@ -0,0 +1,81 @@ +get_param('article_title_class', ''); + +$jid = 'jids' . ($this->section - 1); + +$output = ''; + +$content_source = $this->item->content_source; +if ($content_source == 'joomla') +{ + $ja = $this->getModel()->getArticle($this->item->jids->$jid->content_id); + if ($this->item->jids->$jid->show_title) + { + $output .= TfHtml::heading($ja->title, 'h2', $article_title_class, false); + } + $output .= $ja->introtext . $ja->fulltext . '
'; + +} +elseif ($content_source == 'pages') +{ + $ja = TfDb::get_item('tfl_pages', $this->item->jids->$jid->content_id); + if ($this->item->jids->$jid->show_title) + { + $output .= TfHtml::heading($ja->title, 'h2', $article_title_class, false); + } + $output .= $ja->description; +} + +if ($this->getModel()->get_param('prepare_content', 0)) +{ + $output = HTMLHelper::_('content.prepare', $output); +} + +echo $output; +?> + + + +section/$this->total_sections)*100); +echo '
'; + Progress::display($progress, array('progress_class' => ' bg-success text-white')); +echo '
'; +?> + +section == $this->total_sections && $this->item->completion_type == 'view') +{ + $this->getModel()->mark_complete($this->item->id, $this->user->id); +} +?> \ No newline at end of file diff --git a/deployed/tflearn/components/com_tflearn/tmpl/page/default_sections.php b/deployed/tflearn/components/com_tflearn/tmpl/page/default_sections.php new file mode 100644 index 00000000..72a76a88 --- /dev/null +++ b/deployed/tflearn/components/com_tflearn/tmpl/page/default_sections.php @@ -0,0 +1,57 @@ +get_param('article_title_class', ''); + +$output = ''; + +if (is_object($this->item->jids)) +{ + $content_source = $this->item->content_source; + if ($content_source == 'joomla') + { + foreach ($this->item->jids as $jid) + { + $ja = $this->getModel()->getArticle($jid->content_id); + if ($jid->show_title) + { + $output .= TfHtml::heading($ja->title, 'h2', $article_title_class, false); + } + $output .= $ja->introtext . $ja->fulltext; + } + } + elseif ($content_source == 'pages') + { + foreach ($this->item->jids as $jid) + { + $ja = TfDb::get_item('tfl_pages', $jid->content_id); + if ($jid->show_title) + { + $output .= TfHtml::heading($ja->title, 'h2', $article_title_class, false); + } + $output .= $ja->description; + } + } +} + +if ($this->get_param('prepare_content', 0)) +{ + $output = HTMLHelper::_('content.prepare', $output); +} + +echo $output; + +// Mark lesson as complete for completion type: view +if ($this->item->completion_type == 'view') +{ + $this->getModel()->mark_complete($this->item->id, $this->user->id); +} diff --git a/deployed/tflearn/components/com_tflearn/tmpl/path/default.php b/deployed/tflearn/components/com_tflearn/tmpl/path/default.php new file mode 100644 index 00000000..74ca8fb4 --- /dev/null +++ b/deployed/tflearn/components/com_tflearn/tmpl/path/default.php @@ -0,0 +1,71 @@ +get_param('enable_completion', 1)) && !$this->user->guest; +$path_layout = $this->getModel()->get_param('path_layout', 'plain'); + +$modules = (array) $this->item->modules; + +$path_modtitle_class = $this->get_param('path_modtitle_class'); +$mod_title_class = empty($path_modtitle_class) ? '' : ' class="' . $path_modtitle_class . '"'; + +if (!empty($modules)) +{ + $this->total_lessons = $this->getModel()->total_lessons($modules); +} + +$i = 1; +foreach ($modules as $module) +{ + $module = (array) $module; + + // Get lessons for each module + if (!empty($module)) + { + $mod = TfDb::get_item('tfl_modules' , $module['module_id']); + + if ($mod->published) + { + $mod->title = empty($module['module_name']) ? $mod->title : $module['module_name']; + + $this->tabs[$i-1][0] = '' . $mod->title . ''; + + $lesson_order = $this->get_param('lessons_order_col', 'ordering') . ' ' . $this->get_param('lessons_order_dirn', 'ASC'); + $conditions = array( + array('module', '=', $module['module_id']), + array('published', '=', 1) + ); + $lessons = TfDb::get_items('tfl_lessons', $conditions, $lesson_order); + + foreach ($lessons as $lesson) + { + $this->lesson = $lesson; + + $this->tabs[$i-1][1] .= $this->loadTemplate('lesson'); + } + $i++; + } + } +} +?> +item->title); + + // 2. Modules and lessons + echo $this->loadTemplate('layout_' . $path_layout); + + // 3. Progress bar + if ($enable_completion) + { + echo $this->loadTemplate('completion'); + } +?> \ No newline at end of file diff --git a/deployed/tflearn/components/com_tflearn/tmpl/path/default_completion.php b/deployed/tflearn/components/com_tflearn/tmpl/path/default_completion.php new file mode 100644 index 00000000..5d485289 --- /dev/null +++ b/deployed/tflearn/components/com_tflearn/tmpl/path/default_completion.php @@ -0,0 +1,23 @@ +total_lessons) ? number_format(($this->complete/$this->total_lessons)*100) : 0; + +TfHtml::heading(Text::_('COM_TFLEARN_COMPLETION_STATUS'), 'h3', 'my-3'); + +Progress::display($completed, array('progress_class' => 'bg-success text-white')); + +if ($completed == 100) +{ + $this->action_button(Text::_('COM_TFLEARN_COURSE_COMPLETE'), 'course.complete', 'my-3 btn bg-success text-white'); +} +?> \ No newline at end of file diff --git a/deployed/tflearn/components/com_tflearn/tmpl/path/default_layout_accordion.php b/deployed/tflearn/components/com_tflearn/tmpl/path/default_layout_accordion.php new file mode 100644 index 00000000..61fdd074 --- /dev/null +++ b/deployed/tflearn/components/com_tflearn/tmpl/path/default_layout_accordion.php @@ -0,0 +1,11 @@ +tabs); \ No newline at end of file diff --git a/deployed/tflearn/components/com_tflearn/tmpl/path/default_layout_plain.php b/deployed/tflearn/components/com_tflearn/tmpl/path/default_layout_plain.php new file mode 100644 index 00000000..e8751c0b --- /dev/null +++ b/deployed/tflearn/components/com_tflearn/tmpl/path/default_layout_plain.php @@ -0,0 +1,11 @@ +tabs); \ No newline at end of file diff --git a/deployed/tflearn/components/com_tflearn/tmpl/path/default_layout_tabs.php b/deployed/tflearn/components/com_tflearn/tmpl/path/default_layout_tabs.php new file mode 100644 index 00000000..e65ef6d7 --- /dev/null +++ b/deployed/tflearn/components/com_tflearn/tmpl/path/default_layout_tabs.php @@ -0,0 +1,11 @@ +tabs); \ No newline at end of file diff --git a/deployed/tflearn/components/com_tflearn/tmpl/path/default_lesson.php b/deployed/tflearn/components/com_tflearn/tmpl/path/default_lesson.php new file mode 100644 index 00000000..289f720b --- /dev/null +++ b/deployed/tflearn/components/com_tflearn/tmpl/path/default_lesson.php @@ -0,0 +1,74 @@ +get_param('enable_completion')) && !$this->user->guest; + +$score = $this->getModel()->get_score($this->user->id, $this->lesson->id); +$score = round($score, 1); + +$completion = $this->getModel()->get_completion($this->lesson->id, $this->user->id); +$checked = ($completion) ? ' checked' : ''; + +if ($completion && $enable_completion) +{ + $this->complete++; +} + +$section = ($this->lesson->lesson_type == 'multi') ? '§ion=1' : ''; +$page_link = Route::_('index.php?option=com_tflearn&view=page&course=' . $this->item->id . '&id=' . $this->lesson->id . $section); +$url = $page_link = Route::_('index.php?option=com_tflearn&view=page&course=' . $this->item->id . '&id=' . $this->lesson->id . $section); + +$link = '' . $this->lesson->title . ''; +?> + +
+ + /> + + + + lesson->resources, true); + foreach ($resources as $resource) + { + TfHtml::display_link_new($resource['title'], $resource['url'], 'mx-2 ' . $resource['class']); + } + ?> + +
+ lesson->questions) + { + if ($score) + { + $total_marks = $this->lesson->questions * $this->lesson->marks; + $score_text = Text::_('COM_TFLEARN_SCORE') . ': ' . $score . ' / ' . $total_marks; + $this->action_button($score_text, 'test.score', 'btn btn-sm ' . $this->get_param('score_btn_class'), '', array('lesson_id' => $this->lesson->id)); + } + + $this->action_button(Text::_('COM_TFLEARN_TEST'), 'test.start', 'btn btn-sm ' . $this->get_param('test_btn_class'), '', array('lesson_id' => $this->lesson->id)); + } + + if ($enable_completion) + { + if (!$completion && $this->lesson->completion_type == 'self') + { + $this->action_button(Text::_('COM_TFLEARN_MARK_COMPLETE'), 'completion.complete', 'btn btn-sm ' . $this->get_param('complete_btn_class'), '', array('lesson_id' => $this->lesson->id)); + } + elseif ($completion) + { + $this->action_button(Text::_('COM_TFLEARN_MARK_INCOMPLETE'), 'completion.incomplete', 'btn btn-sm ' . $this->get_param('incomplete_btn_class'), '', array('lesson_id' => $this->lesson->id)); + } + } + ?> +
+
\ No newline at end of file diff --git a/deployed/tflearn/components/com_tflearn/tmpl/paths/default.php b/deployed/tflearn/components/com_tflearn/tmpl/paths/default.php new file mode 100644 index 00000000..cd24563b --- /dev/null +++ b/deployed/tflearn/components/com_tflearn/tmpl/paths/default.php @@ -0,0 +1,76 @@ +get_param('enable_completion', 0) && !$this->user->guest; + +$path_class = $this->get_param('single_path_class'); + +// 1. Page heading +if ($this->params->get('show_page_heading', 0)) +{ + $title_class = $this->get_param('paths_title_class', ''); + TfHtml::heading($this->escape($this->params->get('page_heading')), 'h1', $title_class); +} + +// 2. Description +TfHtml::simple($this->params->get('description', '')); + +// 3. No items messgae +if (empty($this->items)) +{ + Alert::display($this->get_param('no_course_msg'), array('alert_class' => 'bg-warning')); +} +?> + +items)) : ?> + + items as $path) : + + $link = Route::_('index.php?option=com_tflearn&view=path&id=' . $path->id); + + $modules = json_decode($path->modules, true); + $total_lessons = empty($modules) ? 0 : $this->getModel()->total_lessons($modules); + + if ($enable_completion) + { + $complete = $complete = $this->getModel()->get_completion($this->user->id, $modules); + $completed = ($total_lessons) ? number_format(($complete/$total_lessons)*100) : 0; + } + + echo '
'; + + TfHtml::heading($path->title, 'h3'); + + if ($enable_completion) + { + Progress::display($completed, array('progress_class' => 'bg-success text-white')); + } + + echo '
    '; + echo '
  • ' . Text::_('COM_TFLEARN_TEXT_TOTAL_LESSONS') . ' ' . $total_lessons . '
  • '; + if ($enable_completion) + { + echo '
  • ' . Text::_('COM_TFLEARN_TEXT_LESSONS_COMPLETED') . ' ' . $complete . '
  • '; + } + echo '
'; + + Button::display($this->params->get('button_text'), array('button_class' => $this->params->get('button_class')), array('url' => $link)); + + echo '
'; + endforeach; + ?> + + \ No newline at end of file diff --git a/deployed/tflearn/components/com_tflearn/tmpl/paths/default.xml b/deployed/tflearn/components/com_tflearn/tmpl/paths/default.xml new file mode 100644 index 00000000..7ac0d2c0 --- /dev/null +++ b/deployed/tflearn/components/com_tflearn/tmpl/paths/default.xml @@ -0,0 +1,33 @@ + + + + All courses or learning paths user is enrolled in + + + +
+ + + + + + + +
+ +
+
\ No newline at end of file diff --git a/deployed/tflearn/components/com_tflearn/tmpl/score/default.php b/deployed/tflearn/components/com_tflearn/tmpl/score/default.php new file mode 100644 index 00000000..8fa5e1eb --- /dev/null +++ b/deployed/tflearn/components/com_tflearn/tmpl/score/default.php @@ -0,0 +1,37 @@ +Review: ' . $this->lesson->title . ''; + +foreach ($this->items as $item) +{ + echo '
'; + TfHtml::display_date($item->created); + + echo '

Score: ' . $item->grade . '

'; + + $attempts = json_decode($item->attempts, true); + $questions = $this->getModel()->get_attempts($attempts); + + $this->i = 1; // To store question number + + foreach ($questions as $question) + { + $this->question = $question; + $qname = 'q' . $question->id; + $this->attempt = $attempts[$qname]; // Answer given or marked by student + + echo $this->loadTemplate('question_type' . $question->q_type); + + $this->i++; + } + echo '
'; +} +?> \ No newline at end of file diff --git a/deployed/tflearn/components/com_tflearn/tmpl/score/default_question_type1.php b/deployed/tflearn/components/com_tflearn/tmpl/score/default_question_type1.php new file mode 100644 index 00000000..0a1ed73d --- /dev/null +++ b/deployed/tflearn/components/com_tflearn/tmpl/score/default_question_type1.php @@ -0,0 +1,33 @@ + +
i . '. '; ?>question->description; ?>
+ +question->options, true); +$i = 0; + +echo '
    '; +foreach ($options_arr as $option) +{ + echo '
  • '; + echo $option['opt']; + if ($this->attempt == $i) + { + $icon = isset($option['is_correct']) ? 'check-circle text-success' : 'times-circle text-danger'; + echo ' '; + } + if (isset($option['is_correct']) && $option['is_correct']) + { + echo ' Correct Answer '; + } + echo '
  • '; + $i++; +} +echo '
'; +?> \ No newline at end of file diff --git a/deployed/tflearn/components/com_tflearn/tmpl/score/default_question_type2.php b/deployed/tflearn/components/com_tflearn/tmpl/score/default_question_type2.php new file mode 100644 index 00000000..455324b9 --- /dev/null +++ b/deployed/tflearn/components/com_tflearn/tmpl/score/default_question_type2.php @@ -0,0 +1,35 @@ +attempt is an array +?> +
i . '. '; ?>question->description; ?>
+ +question->options, true); +$i = 0; + +echo '
    '; +foreach ($options_arr as $option) +{ + echo '
  • '; + echo $option['opt']; + if (in_array($i, $this->attempt)) + { + $icon = isset($option['is_correct']) ? 'check-circle text-success' : 'times-circle text-danger'; + echo ' '; + } + if (isset($option['is_correct']) && $option['is_correct']) + { + echo ' Correct Answer '; + } + echo '
  • '; + $i++; +} +echo '
'; +?> \ No newline at end of file diff --git a/deployed/tflearn/components/com_tflearn/tmpl/score/default_question_type3.php b/deployed/tflearn/components/com_tflearn/tmpl/score/default_question_type3.php new file mode 100644 index 00000000..5f7138cd --- /dev/null +++ b/deployed/tflearn/components/com_tflearn/tmpl/score/default_question_type3.php @@ -0,0 +1,15 @@ +attempt == $this->question->answer) ? 'check-circle text-success' : 'times-circle text-danger'; +?> +
i . '. '; ?>question->description; ?>
+ +attempt; ?>
+ +Correct Answerquestion->answer; ?> \ No newline at end of file diff --git a/deployed/tflearn/components/com_tflearn/tmpl/score/default_question_type4.php b/deployed/tflearn/components/com_tflearn/tmpl/score/default_question_type4.php new file mode 100644 index 00000000..108c9924 --- /dev/null +++ b/deployed/tflearn/components/com_tflearn/tmpl/score/default_question_type4.php @@ -0,0 +1,15 @@ +attempt) == strtolower($this->question->answer)) ? 'check-circle text-success' : 'times-circle text-danger'; +?> +
i . '. '; ?>question->description; ?>
+ +attempt; ?>
+ +Correct Answerquestion->answer; ?> \ No newline at end of file diff --git a/deployed/tflearn/components/com_tflearn/tmpl/score/default_question_type5.php b/deployed/tflearn/components/com_tflearn/tmpl/score/default_question_type5.php new file mode 100644 index 00000000..41f59aa1 --- /dev/null +++ b/deployed/tflearn/components/com_tflearn/tmpl/score/default_question_type5.php @@ -0,0 +1,38 @@ +attempt is an array +?> +
i . '. '; ?>question->description; ?>
+ +question->matching, true); +$i = 0; + +echo '
    '; +foreach ($matchings as $matching) +{ + echo '
  • '; + echo $matching['col_a'] . ' - ' . $this->attempt[$i]; + if ($matching['col_b'] == $this->attempt[$i]) + { + $icon = 'check-circle text-success'; + } + else + { + $icon = 'times-circle text-danger'; + } + echo ' '; + + echo ' Correct Answer ' . $matching['col_b']; + + echo '
  • '; + $i++; +} +echo '
'; +?> \ No newline at end of file diff --git a/deployed/tflearn/components/com_tflearn/tmpl/score/default_question_type6.php b/deployed/tflearn/components/com_tflearn/tmpl/score/default_question_type6.php new file mode 100644 index 00000000..6357fec2 --- /dev/null +++ b/deployed/tflearn/components/com_tflearn/tmpl/score/default_question_type6.php @@ -0,0 +1,47 @@ +question->answer == 1 || strtoupper($this->question->answer) == 'T' || strtoupper($this->question->answer) == 'TRUE') +{ + $correct_answer = 1; +} +else +{ + $correct_answer = 0; +} + +$icon = ($this->attempt == $correct_answer) ? 'check-circle text-success' : 'times-circle text-danger'; +?> +
i . '. '; ?>question->description; ?>
+ +'; + echo '
  • '; + echo 'True'; + if ($this->attempt == 1) + { + echo ' '; + } + if ($correct_answer == 1) + { + echo ' Correct Answer '; + } + echo '
  • '; + echo '
  • '; + echo 'False'; + if ($this->attempt == 0) + { + echo ' '; + } + if ($correct_answer == 0) + { + echo ' Correct Answer '; + } + echo '
  • '; +echo ''; +?> \ No newline at end of file diff --git a/deployed/tflearn/components/com_tflearn/tmpl/score/default_question_type7.php b/deployed/tflearn/components/com_tflearn/tmpl/score/default_question_type7.php new file mode 100644 index 00000000..f6e2d8fd --- /dev/null +++ b/deployed/tflearn/components/com_tflearn/tmpl/score/default_question_type7.php @@ -0,0 +1,9 @@ + +
    i . '. '; ?>question->description; ?>
    \ No newline at end of file diff --git a/deployed/tflearn/components/com_tflearn/tmpl/scores/default.php b/deployed/tflearn/components/com_tflearn/tmpl/scores/default.php new file mode 100644 index 00000000..2f9e2515 --- /dev/null +++ b/deployed/tflearn/components/com_tflearn/tmpl/scores/default.php @@ -0,0 +1,37 @@ + + +start_list_layout(); ?> + +items)) : ?> + + + + + + + items as $item) : ?> + lesson_id); ?> + + + + + + +
    DateLessonGrade
    created); ?> + + getModel()->get_lesson_title($item->lesson_id); ?> + + grade; ?>
    + + +end_list_layout(); ?> \ No newline at end of file diff --git a/deployed/tflearn/components/com_tflearn/tmpl/scores/default.xml b/deployed/tflearn/components/com_tflearn/tmpl/scores/default.xml new file mode 100644 index 00000000..c86db8cf --- /dev/null +++ b/deployed/tflearn/components/com_tflearn/tmpl/scores/default.xml @@ -0,0 +1,21 @@ + + + + Displays scores of tests taken by the user. + + + +
    + + + +
    + +
    +
    \ No newline at end of file diff --git a/deployed/tflearn/components/com_tflearn/tmpl/test/default.php b/deployed/tflearn/components/com_tflearn/tmpl/test/default.php new file mode 100644 index 00000000..17ab99ca --- /dev/null +++ b/deployed/tflearn/components/com_tflearn/tmpl/test/default.php @@ -0,0 +1,60 @@ +params->set('show_page_heading', 0); + +$total_marks = $this->lesson->questions * $this->lesson->marks; + +if (!$this->user->guest) +{ + $this->form->setValue('email', null, $this->user->email); + $this->form->setFieldAttribute('email', 'type', 'hidden'); +} + +$this->form->setValue('created_by', null, $this->user->id); +$this->form->setValue('lesson_id', null, $this->lesson->id); +$this->form->setValue('marks', null, $this->lesson->marks); + +$this->params->set('show_captcha', $this->get_param('show_captcha', 0)); +$this->params->set('custom_redirect', $this->get_param('custom_redirect')); +$this->params->set('custom_message', $this->get_param('custom_message')); +?> + +

    lesson->title; ?>

    + +
      +
    • lesson->questions; ?>
    • +
    • +
    + +start_form_layout(); ?> + + form->renderFieldset('general'); ?> + + i = 1; // To store question number + + foreach ($this->questions as $question) + { + $this->question = $question; + + echo $this->loadTemplate('question_type' . $question['q_type']); + + $this->i++; + } + ?> +
    + + button = $this->get_param('test_button'); + ?> + +end_form_layout(); ?> diff --git a/deployed/tflearn/components/com_tflearn/tmpl/test/default_question_title.php b/deployed/tflearn/components/com_tflearn/tmpl/test/default_question_title.php new file mode 100644 index 00000000..5453097b --- /dev/null +++ b/deployed/tflearn/components/com_tflearn/tmpl/test/default_question_title.php @@ -0,0 +1,13 @@ + +
    + i . '. '; ?>question['description']; ?> +
    \ No newline at end of file diff --git a/deployed/tflearn/components/com_tflearn/tmpl/test/default_question_type1.php b/deployed/tflearn/components/com_tflearn/tmpl/test/default_question_type1.php new file mode 100644 index 00000000..80ea96a9 --- /dev/null +++ b/deployed/tflearn/components/com_tflearn/tmpl/test/default_question_type1.php @@ -0,0 +1,28 @@ +loadTemplate('question_title'); + +$options_arr = json_decode($this->question['options'], true); + +$name = 'q' . $this->question['id']; // For example: q34 +$num = 0; +foreach ($options_arr as $option) +{ + $label_id = $name . '.' . $num; // For example: q34.0 + + echo '
    '; + echo ''; + echo ''; + echo '
    '; + + $num++; +} +?> \ No newline at end of file diff --git a/deployed/tflearn/components/com_tflearn/tmpl/test/default_question_type2.php b/deployed/tflearn/components/com_tflearn/tmpl/test/default_question_type2.php new file mode 100644 index 00000000..cc7861b7 --- /dev/null +++ b/deployed/tflearn/components/com_tflearn/tmpl/test/default_question_type2.php @@ -0,0 +1,29 @@ +loadTemplate('question_title'); + +$options_arr = json_decode($this->question['options'], true); + +$name = 'q' . $this->question['id']; // For example: q34 +$num = 0; +foreach ($options_arr as $option) +{ + $label_id = $name . '.' . $num; // For example: q34.0 + + // In case of checkbox, name is different for each checkbox. + echo '
    '; + echo ''; + echo ''; + echo '
    '; + + $num++; +} +?> \ No newline at end of file diff --git a/deployed/tflearn/components/com_tflearn/tmpl/test/default_question_type3.php b/deployed/tflearn/components/com_tflearn/tmpl/test/default_question_type3.php new file mode 100644 index 00000000..350e3a08 --- /dev/null +++ b/deployed/tflearn/components/com_tflearn/tmpl/test/default_question_type3.php @@ -0,0 +1,18 @@ +loadTemplate('question_title'); + +$name = 'q' . $this->question['id']; // For example: q34 + +$label_id = $name; + +echo ''; +?> \ No newline at end of file diff --git a/deployed/tflearn/components/com_tflearn/tmpl/test/default_question_type4.php b/deployed/tflearn/components/com_tflearn/tmpl/test/default_question_type4.php new file mode 100644 index 00000000..aa0881f7 --- /dev/null +++ b/deployed/tflearn/components/com_tflearn/tmpl/test/default_question_type4.php @@ -0,0 +1,18 @@ +loadTemplate('question_title'); + +$name = 'q' . $this->question['id']; // For example: q34 + +$label_id = $name; + +echo ''; +?> \ No newline at end of file diff --git a/deployed/tflearn/components/com_tflearn/tmpl/test/default_question_type5.php b/deployed/tflearn/components/com_tflearn/tmpl/test/default_question_type5.php new file mode 100644 index 00000000..72bfa6b0 --- /dev/null +++ b/deployed/tflearn/components/com_tflearn/tmpl/test/default_question_type5.php @@ -0,0 +1,46 @@ +loadTemplate('question_title'); + +$column_a = array(); +$column_b = array(); + +$matchings = json_decode($this->question['matching'], true); + +foreach ($matchings as $matching) +{ + $column_a[] = $matching['col_a']; + $column_b[] = $matching['col_b']; +} + +shuffle($column_b); + +$name = 'q' . $this->question['id']; // For example: q34 +$num = 0; +foreach ($column_a as $col_a) +{ + $label_id = $name . '.' . $num; // For example: q34.0 + + // Name is different for each select + echo '
    '; + echo ''; + echo ''; + echo '
    '; + + $num++; +} +?> diff --git a/deployed/tflearn/components/com_tflearn/tmpl/test/default_question_type6.php b/deployed/tflearn/components/com_tflearn/tmpl/test/default_question_type6.php new file mode 100644 index 00000000..3bb53ea6 --- /dev/null +++ b/deployed/tflearn/components/com_tflearn/tmpl/test/default_question_type6.php @@ -0,0 +1,24 @@ +loadTemplate('question_title'); + +$name = 'q' . $this->question['id']; // For example: q34 + +echo '
    '; + echo ''; + echo ''; +echo '
    '; + +echo '
    '; + echo ''; + echo ''; +echo '
    '; +?> \ No newline at end of file diff --git a/deployed/tflearn/components/com_tflearn/tmpl/test/default_question_type7.php b/deployed/tflearn/components/com_tflearn/tmpl/test/default_question_type7.php new file mode 100644 index 00000000..7a8e9c7b --- /dev/null +++ b/deployed/tflearn/components/com_tflearn/tmpl/test/default_question_type7.php @@ -0,0 +1,12 @@ +loadTemplate('question_title'); +?> \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/forms/blank.xml b/deployed/tflearn/libraries/techfry/forms/blank.xml new file mode 100644 index 00000000..2b19b2f6 --- /dev/null +++ b/deployed/tflearn/libraries/techfry/forms/blank.xml @@ -0,0 +1,5 @@ + +
    + + +
    \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/forms/bs/accordion.xml b/deployed/tflearn/libraries/techfry/forms/bs/accordion.xml new file mode 100644 index 00000000..82f9e8d7 --- /dev/null +++ b/deployed/tflearn/libraries/techfry/forms/bs/accordion.xml @@ -0,0 +1,14 @@ + +
    + + + + + + +
    \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/forms/bs/alert.xml b/deployed/tflearn/libraries/techfry/forms/bs/alert.xml new file mode 100644 index 00000000..546337d2 --- /dev/null +++ b/deployed/tflearn/libraries/techfry/forms/bs/alert.xml @@ -0,0 +1,14 @@ + +
    + + + + + + +
    \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/forms/bs/badge.xml b/deployed/tflearn/libraries/techfry/forms/bs/badge.xml new file mode 100644 index 00000000..fd36fa56 --- /dev/null +++ b/deployed/tflearn/libraries/techfry/forms/bs/badge.xml @@ -0,0 +1,10 @@ + +
    + + + + \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/forms/bs/button_link.xml b/deployed/tflearn/libraries/techfry/forms/bs/button_link.xml new file mode 100644 index 00000000..018bd05d --- /dev/null +++ b/deployed/tflearn/libraries/techfry/forms/bs/button_link.xml @@ -0,0 +1,18 @@ + +
    + + + + + + + + \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/forms/bs/iconbox.xml b/deployed/tflearn/libraries/techfry/forms/bs/iconbox.xml new file mode 100644 index 00000000..d00b1ce2 --- /dev/null +++ b/deployed/tflearn/libraries/techfry/forms/bs/iconbox.xml @@ -0,0 +1,36 @@ + +
    + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/forms/bs/progress.xml b/deployed/tflearn/libraries/techfry/forms/bs/progress.xml new file mode 100644 index 00000000..216b7a43 --- /dev/null +++ b/deployed/tflearn/libraries/techfry/forms/bs/progress.xml @@ -0,0 +1,10 @@ + +
    + + + + \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/forms/bs/social.xml b/deployed/tflearn/libraries/techfry/forms/bs/social.xml new file mode 100644 index 00000000..a451d876 --- /dev/null +++ b/deployed/tflearn/libraries/techfry/forms/bs/social.xml @@ -0,0 +1,15 @@ + +
    + + + + + \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/forms/bs/u_background.xml b/deployed/tflearn/libraries/techfry/forms/bs/u_background.xml new file mode 100644 index 00000000..3a1ad674 --- /dev/null +++ b/deployed/tflearn/libraries/techfry/forms/bs/u_background.xml @@ -0,0 +1,60 @@ + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/forms/bs/u_border.xml b/deployed/tflearn/libraries/techfry/forms/bs/u_border.xml new file mode 100644 index 00000000..e27ca068 --- /dev/null +++ b/deployed/tflearn/libraries/techfry/forms/bs/u_border.xml @@ -0,0 +1,65 @@ + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/forms/bs/u_spacing.xml b/deployed/tflearn/libraries/techfry/forms/bs/u_spacing.xml new file mode 100644 index 00000000..2117b8b5 --- /dev/null +++ b/deployed/tflearn/libraries/techfry/forms/bs/u_spacing.xml @@ -0,0 +1,68 @@ + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/forms/bs/u_text.xml b/deployed/tflearn/libraries/techfry/forms/bs/u_text.xml new file mode 100644 index 00000000..cf9eac9f --- /dev/null +++ b/deployed/tflearn/libraries/techfry/forms/bs/u_text.xml @@ -0,0 +1,65 @@ + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/forms/button.xml b/deployed/tflearn/libraries/techfry/forms/button.xml new file mode 100644 index 00000000..4faabfc9 --- /dev/null +++ b/deployed/tflearn/libraries/techfry/forms/button.xml @@ -0,0 +1,14 @@ + +
    + + + + \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/forms/export.xml b/deployed/tflearn/libraries/techfry/forms/export.xml new file mode 100644 index 00000000..98f82e4e --- /dev/null +++ b/deployed/tflearn/libraries/techfry/forms/export.xml @@ -0,0 +1,48 @@ + +
    +
    + + + +
    + +
    + + + + + + + + + +
    + +
    + + + +
    +
    \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/forms/fields/calendar.xml b/deployed/tflearn/libraries/techfry/forms/fields/calendar.xml new file mode 100644 index 00000000..4138b2cd --- /dev/null +++ b/deployed/tflearn/libraries/techfry/forms/fields/calendar.xml @@ -0,0 +1,82 @@ + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/forms/fields/checkboxes.xml b/deployed/tflearn/libraries/techfry/forms/fields/checkboxes.xml new file mode 100644 index 00000000..083e5049 --- /dev/null +++ b/deployed/tflearn/libraries/techfry/forms/fields/checkboxes.xml @@ -0,0 +1,10 @@ + +
    + + + + \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/forms/fields/color.xml b/deployed/tflearn/libraries/techfry/forms/fields/color.xml new file mode 100644 index 00000000..fb041dc0 --- /dev/null +++ b/deployed/tflearn/libraries/techfry/forms/fields/color.xml @@ -0,0 +1,14 @@ + +
    + + + + + + + +
    \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/forms/fields/email.xml b/deployed/tflearn/libraries/techfry/forms/fields/email.xml new file mode 100644 index 00000000..0797642d --- /dev/null +++ b/deployed/tflearn/libraries/techfry/forms/fields/email.xml @@ -0,0 +1,10 @@ + +
    + + + + \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/forms/fields/file.xml b/deployed/tflearn/libraries/techfry/forms/fields/file.xml new file mode 100644 index 00000000..9fb4e25a --- /dev/null +++ b/deployed/tflearn/libraries/techfry/forms/fields/file.xml @@ -0,0 +1,14 @@ + +
    + + + + + + +
    \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/forms/fields/filelist.xml b/deployed/tflearn/libraries/techfry/forms/fields/filelist.xml new file mode 100644 index 00000000..64bb51dd --- /dev/null +++ b/deployed/tflearn/libraries/techfry/forms/fields/filelist.xml @@ -0,0 +1,29 @@ + +
    + + + + + + + + + + + + + \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/forms/fields/folderlist.xml b/deployed/tflearn/libraries/techfry/forms/fields/folderlist.xml new file mode 100644 index 00000000..d869cbc2 --- /dev/null +++ b/deployed/tflearn/libraries/techfry/forms/fields/folderlist.xml @@ -0,0 +1,29 @@ + +
    + + + + + + + + + + + + + \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/forms/fields/imagelist.xml b/deployed/tflearn/libraries/techfry/forms/fields/imagelist.xml new file mode 100644 index 00000000..4cd3c6f9 --- /dev/null +++ b/deployed/tflearn/libraries/techfry/forms/fields/imagelist.xml @@ -0,0 +1,29 @@ + +
    + + + + + + + + + + + + + \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/forms/fields/integer.xml b/deployed/tflearn/libraries/techfry/forms/fields/integer.xml new file mode 100644 index 00000000..09234b40 --- /dev/null +++ b/deployed/tflearn/libraries/techfry/forms/fields/integer.xml @@ -0,0 +1,19 @@ + +
    + + + + + + + + \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/forms/fields/list.xml b/deployed/tflearn/libraries/techfry/forms/fields/list.xml new file mode 100644 index 00000000..665b6406 --- /dev/null +++ b/deployed/tflearn/libraries/techfry/forms/fields/list.xml @@ -0,0 +1,22 @@ + +
    + + + + + + + + + + + +
    \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/forms/fields/note.xml b/deployed/tflearn/libraries/techfry/forms/fields/note.xml new file mode 100644 index 00000000..c7feb255 --- /dev/null +++ b/deployed/tflearn/libraries/techfry/forms/fields/note.xml @@ -0,0 +1,19 @@ + +
    + + + + + + + + + \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/forms/fields/number.xml b/deployed/tflearn/libraries/techfry/forms/fields/number.xml new file mode 100644 index 00000000..e309bab8 --- /dev/null +++ b/deployed/tflearn/libraries/techfry/forms/fields/number.xml @@ -0,0 +1,19 @@ + +
    + + + + + + + + \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/forms/fields/password.xml b/deployed/tflearn/libraries/techfry/forms/fields/password.xml new file mode 100644 index 00000000..5fdce1bd --- /dev/null +++ b/deployed/tflearn/libraries/techfry/forms/fields/password.xml @@ -0,0 +1,10 @@ + +
    + + + + \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/forms/fields/radio.xml b/deployed/tflearn/libraries/techfry/forms/fields/radio.xml new file mode 100644 index 00000000..a0fbf9e4 --- /dev/null +++ b/deployed/tflearn/libraries/techfry/forms/fields/radio.xml @@ -0,0 +1,12 @@ + +
    + + + + + + +
    \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/forms/fields/range.xml b/deployed/tflearn/libraries/techfry/forms/fields/range.xml new file mode 100644 index 00000000..e309bab8 --- /dev/null +++ b/deployed/tflearn/libraries/techfry/forms/fields/range.xml @@ -0,0 +1,19 @@ + +
    + + + + + + + + \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/forms/fields/subform.xml b/deployed/tflearn/libraries/techfry/forms/fields/subform.xml new file mode 100644 index 00000000..e4a173e8 --- /dev/null +++ b/deployed/tflearn/libraries/techfry/forms/fields/subform.xml @@ -0,0 +1,23 @@ + +
    + + + + + + + + + + + + +
    \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/forms/fields/tel.xml b/deployed/tflearn/libraries/techfry/forms/fields/tel.xml new file mode 100644 index 00000000..2b19b2f6 --- /dev/null +++ b/deployed/tflearn/libraries/techfry/forms/fields/tel.xml @@ -0,0 +1,5 @@ + +
    + + +
    \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/forms/fields/text.xml b/deployed/tflearn/libraries/techfry/forms/fields/text.xml new file mode 100644 index 00000000..3018366b --- /dev/null +++ b/deployed/tflearn/libraries/techfry/forms/fields/text.xml @@ -0,0 +1,9 @@ + +
    + + + + \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/forms/fields/textarea.xml b/deployed/tflearn/libraries/techfry/forms/fields/textarea.xml new file mode 100644 index 00000000..44ae8415 --- /dev/null +++ b/deployed/tflearn/libraries/techfry/forms/fields/textarea.xml @@ -0,0 +1,14 @@ + +
    + + + + + + \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/forms/fields/url.xml b/deployed/tflearn/libraries/techfry/forms/fields/url.xml new file mode 100644 index 00000000..a43dadf2 --- /dev/null +++ b/deployed/tflearn/libraries/techfry/forms/fields/url.xml @@ -0,0 +1,19 @@ + +
    + + + + + + + + + \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/forms/import.xml b/deployed/tflearn/libraries/techfry/forms/import.xml new file mode 100644 index 00000000..ada93f24 --- /dev/null +++ b/deployed/tflearn/libraries/techfry/forms/import.xml @@ -0,0 +1,26 @@ + +
    +
    + + + +
    + +
    + + + + + + +
    + +
    \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/forms/query.xml b/deployed/tflearn/libraries/techfry/forms/query.xml new file mode 100644 index 00000000..00932a18 --- /dev/null +++ b/deployed/tflearn/libraries/techfry/forms/query.xml @@ -0,0 +1,172 @@ + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + +
    + + + + + + + + + + + + +
    + +
    \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/forms/subform_filterarticles.xml b/deployed/tflearn/libraries/techfry/forms/subform_filterarticles.xml new file mode 100644 index 00000000..0d86f065 --- /dev/null +++ b/deployed/tflearn/libraries/techfry/forms/subform_filterarticles.xml @@ -0,0 +1,34 @@ + +
    + + + + + + + + + + + + + \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/forms/subform_filterusers.xml b/deployed/tflearn/libraries/techfry/forms/subform_filterusers.xml new file mode 100644 index 00000000..e0032bcf --- /dev/null +++ b/deployed/tflearn/libraries/techfry/forms/subform_filterusers.xml @@ -0,0 +1,35 @@ + +
    + + + + + + + + + + + + + + \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/forms/subform_where.xml b/deployed/tflearn/libraries/techfry/forms/subform_where.xml new file mode 100644 index 00000000..ec6f520b --- /dev/null +++ b/deployed/tflearn/libraries/techfry/forms/subform_where.xml @@ -0,0 +1,29 @@ + +
    + + + + + + + + + + + \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/src/Controller/TfControllerAdmin.php b/deployed/tflearn/libraries/techfry/src/Controller/TfControllerAdmin.php new file mode 100644 index 00000000..c9c43326 --- /dev/null +++ b/deployed/tflearn/libraries/techfry/src/Controller/TfControllerAdmin.php @@ -0,0 +1,46 @@ +checkToken(); + + $model = $this->getModel(); + + $model->deleteTable($model->table_name); + + $this->setMessage('Table truncated successfully: ' . $model->table_name); + + $this->setRedirect(Route::_('index.php?option=' . $this->option . '&view=' . $this->view_list, false)); + } + + // Empty table without checking existing records + public function truncateTable() + { + $this->checkToken(); + + $model = $this->getModel(); + + TfDb::truncate_table($model->table_name); + + $this->setMessage('Table truncated successfully: ' . $model->table_name); + + $this->setRedirect(Route::_('index.php?option=' . $this->option . '&view=' . $this->view_list, false)); + } +} \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/src/Controller/TfControllerExport.php b/deployed/tflearn/libraries/techfry/src/Controller/TfControllerExport.php new file mode 100644 index 00000000..47bf71ef --- /dev/null +++ b/deployed/tflearn/libraries/techfry/src/Controller/TfControllerExport.php @@ -0,0 +1,212 @@ +option = $this->input->get('option'); + } + +// ***************************************************************************** + + public function expo() + { + $model = $this->getModel(); + + if (!$model->pro()) + { + $this->setMessage('Please upgrade to pro version to use this feature.', 'error'); + + $this->setRedirect(Route::_('index.php?option=' . $this->option . '&view=export', false)); + + return; + } + + $info = $this->input->get('jform', array(), 'array'); + + $this->info = $this->input->get('jform', array(), 'array'); + + if (empty($info['export_select'])) + { + $this->setMessage(Text::_('COM_TF_ERROR_SELECT_FIELDS'), 'error'); + + $this->setRedirect(Route::_('index.php?option=' . $this->option . '&view=export&type=' . $info['export_type'], false)); + + return; + } + + if ($info['export_type'] == 'users') + { + $users = $this->filter_users(); + + if (!is_array($info['export_select'])) + { + $info['export_select'] = explode(',', $info['export_select']); + } + + $i = 0; + $j = 0; + $rows = array(); + + foreach ($users as $user_id) + { + $user = Factory::getUser($user_id); + $rows[$i] = array(); + foreach ($info['export_select'] as $exportfield) + { + // Case 1: Field is group id + if ($exportfield == 'group_id') + { + $rows[$i][$j] = implode(',', $user->getAuthorisedGroups()); + } + + // Case 2: Field is Custom Field + elseif (is_numeric($exportfield)) + { + $rows[$i][$j] = TfUser::get_custom_field($exportfield, $user_id); + } + + // Case 3: Field is from users table + elseif ((is_numeric($exportfield) == false)) + { + $rows[$i][$j] = $user->$exportfield; + } + + $j++; + } + $i++; + } + } + else + { + // Conditions + $conditions = array(); + foreach ($info['filter'] as $filter) + { + if ($filter['where_field'] != '' && $filter['where_value'] != '') + { + $conditions[] = array($filter['where_field'], $filter['where_operator'], $filter['where_value']); + } + elseif ($filter['where_field'] != '' && $filter['where_value'] == '') + { + $conditions[] = array($filter['where_field'], $filter['where_operator']); + } + } + + $rows = TfDb::get_records($info['export_type'], $info['export_select'], $conditions, $info['order'], $info['limit']); + + if ($info['export_type'] == 'joomla_content' && !empty($info['articles_cf'])) + { + $rows = $this->add_article_fields($rows, $info['articles_cf']); + } + } + + // Export data + $filename = $info['export_type'] . '.csv'; + + // Create a file pointer + $fp = fopen('php://output', 'w'); + + foreach ($rows as $row) + { + $row = (array) $row; + + // Convert json to separate columns + if (!empty($info['jsons'])) + { + $jsons = str_getcsv($info['jsons']); + foreach ($jsons as $json) + { + $arr = json_decode($row[$json], true); + foreach ($arr as $k => $v) + { + $row[$k] = $v; + } + unset($row[$json]); + } + } + + fputcsv($fp, $row); + } + + // Set headers to download file rather than display + header('Content-Type: text/csv'); + header('Content-Disposition: attachment; filename="' . $filename . '";'); + + exit; + } + + public function add_article_fields($rows, $fields) + { + BaseDatabaseModel::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_fields/models', 'FieldsModel'); + $fieldModel = BaseDatabaseModel::getInstance('Field', 'FieldsModel', array('ignore_request' => true)); + + foreach ($rows as $i => $row) + { + foreach ($fields as $field) + { + // Case 1: Field is an image + if ($field == 'image_intro' || $field == 'image_fulltext') + { + $article = $this->getModel('export')->get_item('content', $row['id']); + $images = json_decode($article->images, true); + $rows[$i][$field] = $images[$field]; + } + // Case 2: Combine intro text and fulltext + elseif ($field == 'full_article') + { + $article = $this->getModel('export')->get_item('content', $row['id']); + $rows[$i][$field] = $article->introtext . $article->fulltext; + } + // Case 3: Field is custom field + elseif (is_numeric($field)) + { + $rows[$i][$field] = $fieldModel->getFieldValue($field, $row['id']); + } + } + } + + return $rows; + } + + public function filter_users() + { + $users = TfUser::filter_users($this->info['filter'], $this->info['filterusers']); + + return $users; + } + + public function cancel($key = null) + { + $this->checkToken(); + + $this->setRedirect(Route::_('index.php?option=' . $this->option . '&view=dashboard', false)); + + return true; + } +} \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/src/Controller/TfControllerForm.php b/deployed/tflearn/libraries/techfry/src/Controller/TfControllerForm.php new file mode 100644 index 00000000..c4780627 --- /dev/null +++ b/deployed/tflearn/libraries/techfry/src/Controller/TfControllerForm.php @@ -0,0 +1,16 @@ +checkToken(); + + $model = $this->getModel(); + + // Get the data from the HTTP POST request + $data = $this->input->get('jform', array(), 'array'); + + $custom_message = (isset($data['custom_message']) && !empty($data['custom_message'])) ? $data['custom_message'] : Text::_('COM_TF_SUBMIT_SUCCESSFUL'); + + $custom_redirect = (isset($data['custom_redirect']) && !empty($data['custom_redirect'])) ? $data['custom_redirect'] : Uri::getInstance(); + + $context = $this->option . '.edit.' . $this->context; + + // File Handling + if (!empty($this->file_fields)) + { + $files = $this->input->files->get('jform'); + foreach ($this->file_fields as $file_field) + { + if (!empty($files) && $files[$file_field]['size'] != 0) + { + $newfile = $this->save_file($files[$file_field]); + if ($newfile) + { + $data[$file_field] = $newfile; + } + else + { + // Save the data in the session + $this->app->setUserState($context . '.data', $data); + + // Redirect back to the edit screen + $this->setRedirect(Uri::getInstance()); + + return false; + } + } + } + } + + if (!$model->save($data)) + { + // Save the data in the session + $this->app->setUserState($context . '.data', $data); + + // Redirect back to the edit screen + $this->setRedirect($custom_redirect); + + return false; + } + + // Clear the data in the form + $this->app->setUserState($context . '.data', null); + + // Post Save Method (Depreciated - Shift to Model) + $this->post_save($data); + + $this->setRedirect($custom_redirect, $custom_message); + + return true; + } + + // Function called after saving data (Depreciated: Shift these to model save) + public function post_save($data) + { + + } + + // Save file to folder + protected function save_file($file) + { + $filename = File::makeSafe($file['name']); + + $ext = File::getExt($filename); + + // Check for file extension + if (!in_array(strtolower($ext), $this->allow_extensions)) + { + $this->setMessage(Text::_('COM_TF_INVALID_FILE_EXTENSION'), 'warning'); + + return false; + } + + // Check for file size + if ($file['size'] > $this->max_file_size) + { + $this->setMessage(Text::_('COM_TF_INVALID_FILE_SIZE'), 'warning'); + + return false; + } + + $name = File::stripExt($filename); + + $newfilename = $name . '_' . mt_rand(100,999) . '.' . $ext; + + $src = $file['tmp_name']; + $folder = $this->save_folder . '/'; + $dest = JPATH_SITE . '/images/' . $folder . $newfilename; + + if (File::upload($src, $dest)) + { + return $newfilename; + } + else + { + return false; + } + } +} \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/src/Controller/TfControllerImport.php b/deployed/tflearn/libraries/techfry/src/Controller/TfControllerImport.php new file mode 100644 index 00000000..c0d175aa --- /dev/null +++ b/deployed/tflearn/libraries/techfry/src/Controller/TfControllerImport.php @@ -0,0 +1,219 @@ +option = $this->input->get('option'); + } + + public function import() + { + $model = $this->getModel(); + + if (!$model->pro()) + { + $this->setMessage('Please upgrade to pro version to use this feature.', 'error'); + + $this->setRedirect(Route::_('index.php?option=' . $this->option . '&view=import', false)); + + return; + } + + $info = $this->input->get('jform', array(), 'array'); + + $files = $this->input->files->get('jform'); + $file = $files['upload_file']; + + $filename = File::makeSafe($file['name']); + + $ext = strtolower(File::getExt($filename)); + if ($ext !== 'csv') + { + $this->setMessage(Text::_('COM_TF_ERROR_INVALID_FILE'), 'error'); + + $this->setRedirect(Route::_('index.php?option=' . $this->option . '&view=import&type=' . $info['import_type'], false)); + + return; + } + + if (empty($info['import_columns'])) + { + $this->setMessage(Text::_('COM_TF_ERROR_SELECT_FIELDS'), 'error'); + + $this->setRedirect(Route::_('index.php?option=' . $this->option . '&view=import&type=' . $info['import_type'], false)); + + return; + } + + $base = $this->base($info['import_type']); + + $columns_arr = explode(',', $info['import_columns']); + if ($info['import_type'] == 'users' && !empty($info['users_cf'])) + { + $columns_arr = array_merge($columns_arr, $info['users_cf']); + } + + $model = $this->getModel('import'); + + $fileopen = fopen($file['tmp_name'], "r"); + $counter = 0; + $c_exists = 0; + + // Ignore first row of csv file + if ($info['ignore_first']) + { + fgetcsv($fileopen, 10000, ","); + } + + while (($data = fgetcsv($fileopen, 10000, ",")) !== FALSE) + { + $record = $this->set_data($data, $columns_arr); + + if ($info['import_type'] == 'users') + { + $user_exists = TfUser::find_user($record['email']); + if ($user_exists) + { + $c_exists++; + } + else + { + $user = TfUser::create_user($record); + + if (!empty($info['users_cf'])) + { + $fields = $info['users_cf']; + foreach ($fields as $field_id) + { + TfUser::save_custom_field($field_id, $user->id, $record[$field_id]); + } + } + + $counter++; + } + } + elseif ($info['import_type'] == 'joomla_content') + { + $article = TfArticle::create_article($record); + + if (!empty($info['articles_cf'])) + { + $fields = $info['articles_cf']; + foreach ($fields as $field_id) + { + // TO DO: Get $alias from title + $article_id = TfArticle::find_article($alias, $record['catid']); + + TfArticle::save_custom_field($field_id, $article_id, $record[$field_id]); + } + } + + $counter++; + } + else + { + $record = $this->set_columns($record, $base['table']); + + $result = $model->direct_save($record, $base['table'], true); + + $result ? $counter++ : $c_exists++; + } + } + + fclose($fileopen); + + $this->setMessage($counter . ' ' . Text::_('COM_TF_RECORDS_IMPORTED') . ' ' . $c_exists . ' ' . Text::_('COM_TF_RECORDS_EXISTS')); + + $this->setRedirect(Route::_('index.php?option=' . $this->option . '&view=import&type=' . $info['import_type'], false)); + } + + // 02. Returns record array to save in database + public function set_data($data, $columns) + { + $record = array(); + + $c = 0; // Column number + foreach ($columns as $column) + { + $record[$column] = $data[$c]; + $c++; + } + + return $record; + } + + // 03. Function to determine which table is used + public function base($import_type) + { + $arr = array(); + + $model = $this->getModel('import'); + + $import_tables = $model->import_tables; + + foreach ($import_tables as $type => $table) + { + if ($import_type == $type) + { + $arr['table'] = $table; + } + } + + return $arr; + } + + // 04. Add fields that should be handled automatically + public function set_columns($record, $table) + { + $record['id'] = 0; + + $auto_fields = array('alias', 'created', 'modified', 'created_by'); + + $db = Factory::getDbo(); + $cols = $db->getTableColumns('#__' . $table); + + foreach ($auto_fields as $field) + { + if (array_key_exists($field, $cols) && !isset($record[$field])) + { + $record[$field] = ''; + } + } + + return $record; + } + + public function cancel($key = null) + { + $this->checkToken(); + + $this->setRedirect(Route::_('index.php?option=' . $this->option . '&view=dashboard', false)); + + return true; + } +} \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/src/Controller/TfControllerQuery.php b/deployed/tflearn/libraries/techfry/src/Controller/TfControllerQuery.php new file mode 100644 index 00000000..8d0e6865 --- /dev/null +++ b/deployed/tflearn/libraries/techfry/src/Controller/TfControllerQuery.php @@ -0,0 +1,430 @@ +option = $this->input->get('option'); + } + +// ***************************************************************************** + + public function get_form_info() + { + $this->info = $this->input->get('jform', array(), 'array'); + } + + public function process() + { + $model = $this->getModel(); + + if (!$model->pro()) + { + $this->setMessage('Please upgrade to pro version to use this feature.', 'error'); + + $this->setRedirect(Route::_('index.php?option=' . $this->option . '&view=query', false)); + + return; + } + + $info = $this->input->get('jform', array(), 'array'); + $this->get_form_info(); + + $this->query_type = $info['query_type']; + if ($this->query_type == 'users') + { + $this->filter_users(); + } + elseif ($this->query_type == 'content') + { + $this->articles = TfArticle::filter_articles($info['filter'], $info['filterarticles']); + } + + $this->db_table = '#__' . $info['query_type']; + $this->db_table_wo_prefix = $info['query_type']; + $this->column = $info['column_field']; + $this->column_save = ($info['column_save'] != '') ? $info['column_save'] : $info['column_field']; + $this->text = $info['text']; + $this->value = $info['value']; + + if ($info['tool'] == 'string') + { + $this->function_name = $info['str_function']; + } + elseif ($info['tool'] == 'date') + { + $this->function_name = $info['date_function']; + } + elseif ($info['tool'] == 'numeric') + { + $this->function_name = $info['num_function']; + } + + // Conditions + if (!empty($info['filter'])) + { + foreach ($info['filter'] as $filter) + { + if ($filter['where_field'] != '' && $filter['where_value'] != '') + { + // $this->conditions[] = $filter['where_field'] . ' ' . $filter['where_operator'] . ' ' . $filter['where_value']; + $this->conditions[] = array($filter['where_field'], $filter['where_operator'], $filter['where_value']); + } + elseif ($filter['where_field'] != '' && $filter['where_value'] == '') + { + $this->conditions[] = $filter['where_field'] . ' ' . $filter['where_operator']; + } + } + } + + $function_name = $info['tool'] . '_tool'; + + $message = $this->$function_name(); + if (is_array($message)) + { + $message = '
    ' . print_r($message, true) . '
    '; + } + + if ($this->num_rows != '') + { + $this->app->enqueueMessage('Affected Rows: ' . $this->num_rows . '
    '); + } + + $this->setMessage($message); + + $query_type = !empty($info['query_type']) ? '&type=' . $info['query_type'] : ''; + $this->setRedirect(Route::_('index.php?option=' . $this->option . '&view=query' . $query_type, false)); + } + + // 01. Find text in table column; Return ids + public function find_tool() + { + $like = '%' . $this->text . '%'; + $order = $this->info['order_col'] . ' ' . $this->info['order_dirn']; + + $conditions = array( + array($this->column, 'LIKE', $like) + ); + + $result = TfDb::get_items($this->db_table_wo_prefix, $conditions, $order, $this->info['limit'], 'id'); + + return $result; + } + + // 02. Find duplicates by column + public function find_duplicates_tool() + { + $db = Factory::getDbo(); + $query = $db->getQuery(true); + + $query + ->select(array($this->column, 'COUNT(*) AS c')) + ->from($db->quoteName($this->db_table)) + ->group($db->quoteName($this->column)) + ->having('c > 1'); + + $db->setQuery($query); + + $db->execute(); + + $this->num_rows = $db->getNumRows(); + + $result = $db->loadAssocList(); + + return $result; + } + + // 03. Update text with value in table column + public function update_tool() + { + if ($this->query_type == 'users') + { + foreach ($this->users as $user_id) + { + // Case 1: Update Users Custom Fields + if (is_numeric($this->column)) + { + TfUser::save_custom_field($this->column, $user_id, $this->value); + } + // Case 2: Update Joomla Users Table + else + { + $action_field = $this->column; + $userdata = array('id' => $user_id, $action_field => $this->value); + $updates = array($action_field); + TfUser::update_user($userdata, $updates); + } + } + + $this->num_rows = count($this->users); + } + elseif ($this->query_type == 'content') + { + foreach ($this->articles as $article_id) + { + // Case 1: Update Content Custom Fields + if (is_numeric($this->column)) + { + TfArticle::save_custom_field($this->column, $article_id, $this->value); + } + // Case 2: Update Joomla Content Table + else + { + $action_field = $this->column; + $articledata = array('id' => $article_id, $action_field => $this->value); + TfArticle::update_article($articledata); + } + } + } + else + { + $sets = array($this->column => $this->value); + + $this->num_rows = TfDb::update_records($this->db_table_wo_prefix, $this->conditions, $sets); + } + } + + // 04. Replace text with value + public function replace_tool() + { + // Use TfDb class + + $db = Factory::getDbo(); + $query = $db->getQuery(true); + + $query->update($db->quoteName($this->db_table)); + + $fields = array($db->quoteName($this->column) . ' = REPLACE(' . $db->quoteName($this->column) . ',' . $db->quote($this->text) . ',' . $db->quote($this->value) . ')'); + + $query->set($fields); + + if (!empty($this->conditions)) + { + $query->where($this->conditions); + } + + $db->setQuery($query); + + $db->execute(); + + $this->num_rows = $db->getAffectedRows(); + } + + // 05. Delete rows + public function delete_tool() + { + if (!empty($this->conditions)) + { + $this->num_rows = TfDb::delete_items($this->db_table_wo_prefix, $this->conditions); + } + } + + // 06. Truncate table + public function truncate_tool() + { + TfDb::truncate_table($this->db_table_wo_prefix); + + return 'Database table ' . $this->db_table_wo_prefix . ' truncated.'; + } + + // 07. Get columns in a table + public function table_columns_tool() + { + $cols = TfDb::get_table_columns($this->db_table_wo_prefix); + + return $cols; + } + + // 08. Get create statement for a table + public function table_create_tool() + { + $db = Factory::getDbo(); + + $cols = $db->getTableCreate($this->db_table); + + return $cols; + } + + // 09. Get list of all database tables + public function table_list_tool() + { + $db = Factory::getDbo(); + + $tables = $db->getTableList(); + + return $tables; + } + + // 10. String function + public function string_tool() + { + $this->get_rows(); + + $column_name = $this->info['column_field']; + $column_save = $this->column_save; + + if ($this->function_name == 'preg_replace') + { + $this->info['p1'] = '/' . $this->info['p1'] . '/i'; + } + + $params = array($this->info['p1'], $this->info['p2']); + + foreach ($this->rows as $row) + { + $row->$column_save = TfString::process($this->function_name, $row->$column_name, $params); + + TfDb::insert_update($this->db_table_wo_prefix, $row); + } + } + + // 11. Date function + public function date_tool() + { + $this->get_rows(); + + $column_name = $this->info['column_field']; + $column_save = $this->column_save; + + foreach ($this->rows as $row) + { + $row->$column_save = TfDate::process($this->function_name, $row->$column_name, $this->info['p1']); + + TfDb::insert_update($this->db_table_wo_prefix, $row); + } + } + + // 12. Numeric function + public function numeric_tool() + { + // $this->function_tool(); + + return 'Coming Soon!'; + } + + // Function tool + public function function_tool() + { + $model = $this->getModel(); + + $this->get_rows(); + + $function_name = $this->function_name; + $column_name = $this->info['column_field']; + $column_save = $this->column_save; + + foreach ($this->rows as $row) + { + if ($this->info['p1'] == '' && $this->info['p2'] == '' && $this->info['p3'] == '') + { + $row->$column_save = $function_name($row->$column_name); + } + elseif ($this->info['p1'] != '' && $this->info['p2'] == '' && $this->info['p3'] == '') + { + $row->$column_save = $function_name($row->$column_name, $this->info['p1']); + } + elseif ($this->info['p1'] != '' && $this->info['p2'] != '' && $this->info['p3'] == '') + { + $row->$column_save = $function_name($row->$column_name, $this->info['p1'], $this->info['p2']); + } + elseif ($this->info['p1'] != '' && $this->info['p2'] != '' && $this->info['p3'] != '') + { + $row->$column_save = $function_name($row->$column_name, $this->info['p1'], $this->info['p2'], $this->info['p3']); + } + + $model->direct_save($row, $this->db_table_wo_prefix); + } + } + + public function get_rows() + { + $db = Factory::getDbo(); + $query = $db->getQuery(true); + + $query + ->select($db->quoteName(array('id', $this->column))) + ->from($db->quoteName($this->db_table)) + ->order($this->info['order_col'] . ' ' . $this->info['order_dirn']) + ->setLimit($this->info['limit']); + + if (!empty($this->conditions)) + { + $query->where($this->conditions); + } + + $db->setQuery($query); + + $db->execute(); + + $this->num_rows = $db->getNumRows(); + + $this->rows = $db->loadObjectList(); + } + + public function filter_users() + { + $this->users = TfUser::filter_users($this->info['filter'], $this->info['filterusers']); + } + + public function cancel($key = null) + { + $this->checkToken(); + + $this->setRedirect(Route::_('index.php?option=' . $this->option . '&view=dashboard', false)); + + return true; + } +} \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/src/Model/Back/TfModelDashboard.php b/deployed/tflearn/libraries/techfry/src/Model/Back/TfModelDashboard.php new file mode 100644 index 00000000..89a7b1bc --- /dev/null +++ b/deployed/tflearn/libraries/techfry/src/Model/Back/TfModelDashboard.php @@ -0,0 +1,98 @@ +getQuery(true); + + $query->select('update_site_id') + ->from($db->qn('#__update_sites_extensions')) + ->where($db->qn('extension_id') . ' = '. $db->q($extension_id)); + + $db->setQuery($query); + + $update_site = $db->loadResult(); + + return $update_site; + } + + // Get current version of component installed + public function get_current_version($element = '') + { + if ($element == '') + { + $element = $this->option; + } + + $ext = TfDb::get_item('extensions', $element, 'element'); + + $version = json_decode($ext->manifest_cache)->version; + + return $version; + } + + // Get new bersion of component + public function get_new_version() + { + $component = ComponentHelper::getComponent($this->option); + + $update_site = $this->get_update_site_id($component->id); + + $update = TfDb::get_item('update_sites', $update_site, 'update_site_id'); + + $dom = new \DOMDocument(); + $dom->load($update->location); + $contents = $dom->getElementsByTagName('version'); + foreach ($contents as $content) + { + $new_version = $content->nodeValue; + } + + return $new_version; + } + + public function get_new_library_version() + { + $library = LibraryHelper::getLibrary('techfry'); + + $update_site = $this->get_update_site_id($library->id); + + $update = TfDb::get_item('update_sites', $update_site, 'update_site_id'); + + $dom = new \DOMDocument(); + $dom->load($update->location); + $contents = $dom->getElementsByTagName('version'); + foreach ($contents as $content) + { + $new_version = $content->nodeValue; + } + + return $new_version; + } + + // Placeholder function to be defined in component dashboard model class + public function getAlerts() + { + $alerts = array(); + + return $alerts; + } +} \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/src/Model/Back/TfModelForm.php b/deployed/tflearn/libraries/techfry/src/Model/Back/TfModelForm.php new file mode 100644 index 00000000..3ac6ed43 --- /dev/null +++ b/deployed/tflearn/libraries/techfry/src/Model/Back/TfModelForm.php @@ -0,0 +1,402 @@ +table_name) + { + $this->table_columns = TfDb::get_table_columns($this->table_name); + } + + $this->set_basic_fields(); + + $this->app = Factory::getApplication(); + + $this->input = $this->app->input; + } + + public function getTable($name = '', $prefix = 'Table', $options = array()) + { + if (empty($name)) + { + if (empty($this->table)) + { + $name = ucwords($this->getName()); + } + else + { + $name = $this->table; + } + } + + if ($table = $this->_createTable($name, $prefix, $options)) + { + return $table; + } + + throw new \Exception(Text::sprintf('JLIB_APPLICATION_ERROR_TABLE_NAME_NOT_SUPPORTED', $name), 0); + } + + public function getForm($data = array(), $loadData = true) + { + // Get the form + $this->form = $this->loadForm($this->option . '.' . $this->getName(), $this->getName(), array('control' => 'jform', 'load_data' => $this->loadData)); + + if (empty($this->form)) + { + return false; + } + + $this->complete_form(); + + $this->bind_form(); + + return $this->form; + } + + protected function loadFormData() + { + // Check the session for previously entered form data. + $app = Factory::getApplication(); + $data = $app->getUserState($this->option . '.edit.' . $this->getName() . '.data', array()); + + if (empty($data)) + { + $data = $this->getItem(); + } + + return $data; + } + + public function complete_form() + { + foreach ($this->basic_fields as $field) + { + switch ($field) + { + case 'title' : + $fieldset = ''; + $element = ''; + break; + + case 'alias' : + $fieldset = ''; + $element = ''; + break; + + case 'description' : + $fieldset = 'description'; + $element = ''; + break; + + case 'note' : + $fieldset = 'options'; + $element = ''; + break; + + case 'published' : + $fieldset = 'options'; + $element = 'set_field($element, $fieldset); + } + } + + public function save($data) + { + if (!$this->pro() && isset($this->db_limit)) + { + $total_rows = $this->total_rows($this->table_name); + + if ($total_rows > $this->db_limit) + { + $msg = 'You have reached maximum limit of ' . $this->db_limit . ' items. Please upgrade to pro version.'; + + $this->setError($msg); + + return; + } + } + + $data = $this->prepare_data($data, $this->table_name, $this->date_fields, $this->subform_fields, $this->multiple_fields); + + return parent::save($data); + } + + public function validate($form, $data, $group = null) + { + return $data; + } + + public function getItem($pk = null) + { + $item = parent::getItem($pk); + + // Convert JSON string to array + foreach ($this->multiple_fields as $k => $v) + { + if ($item && property_exists($item, $v)) + { + $registry = new Registry($item->$v); + + $item->$v = $registry->toArray(); + } + } + + // Load associated content items + $assoc = Associations::isEnabled(); + if ($assoc && $this->is_ml) + { + $item->associations = array(); + if ($item->id != null) + { + $associations = Associations::getAssociations($this->option, '#__' . $this->table_name, $this->associationsContext, $item->id, 'id', 'alias', ''); + + foreach ($associations as $tag => $association) + { + $item->associations[$tag] = $association->id; + } + } + } + + return $item; + } + + protected function preprocessForm(Form $form, $data, $group = 'content') + { + $str = ucwords(substr($this->option, 6)); + + // Association content items + if (Associations::isEnabled() && $this->is_ml) + { + $languages = LanguageHelper::getContentLanguages(false, false, null, 'ordering', 'asc'); + + if (count($languages) > 1) + { + $addform = new \SimpleXMLElement('
    '); + $fields = $addform->addChild('fields'); + $fields->addAttribute('name', 'associations'); + $fieldset = $fields->addChild('fieldset'); + $fieldset->addAttribute('name', 'item_associations'); + $fieldset->addAttribute('addfieldprefix', 'TechFry\Component\Tf' . $str . '\Administrator\Field'); + + foreach ($languages as $language) + { + $field = $fieldset->addChild('field'); + $field->addAttribute('name', $language->lang_code); + $field->addAttribute('type', 'modal_' . $this->name); + $field->addAttribute('language', $language->lang_code); + $field->addAttribute('label', $language->title); + $field->addAttribute('translate_label', 'false'); + + $field->addAttribute('select', 'true'); + // $field->addAttribute('new', 'true'); + // $field->addAttribute('edit', 'true'); + $field->addAttribute('clear', 'true'); + // $field->addAttribute('propagate', 'true'); + } + + $form->load($addform, false); + } + } + + parent::preprocessForm($form, $data); + } + + // Add field to fieldset + public function set_field($element, $fieldset) + { + $xml = new \SimpleXMLElement($element); + $this->form->setField($xml, null, false, $fieldset); + } + + // Add fields to fieldset + public function set_fields($elements, $fieldset) + { + foreach ($elements as $element) + { + $this->set_field($element, $fieldset); + } + } + + // Add fieldset to the form + public function add_fieldset($name, $label = '', $description = '') + { + $element = '
    form->load($xml); + } + + public function bind_form() + { + if ($this->loadData) + { + $this->form->bind($this->getItem()); + } + } + + // Save data in junction table - new method + public function save_injunction($table_name, $conditions = array(), $column_name = 'label_id', $ids = array()) + { + // First, delete all current ids + $db = Factory::getDbo(); + $query = $db->getQuery(true); + + foreach ($conditions as $k => $v) + { + $where[] = $db->quoteName($k) . ' = ' . $db->quote($v); + } + + $query->delete($db->quoteName('#__' . $table_name)); + $query->where($where); + + $db->setQuery($query); + $db->execute(); + + // Then, add labels or ids + foreach ($ids as $id) + { + $data_obj = new \stdClass; + foreach ($conditions as $k => $v) + { + $data_obj->$k = $v; + } + + $data_obj->$column_name = $id; + + Factory::getDbo()->insertObject('#__' . $table_name, $data_obj); + } + } + + // Get data from junction table - new method + public function get_injunction($table_name, $conditions = array(), $column_name = 'label_id') + { + $db = Factory::getDbo(); + $query = $db->getQuery(true); + + $query->select($column_name) + ->from($db->quoteName('#__' . $table_name)); + + foreach ($conditions as $k => $v) + { + $query->where($db->quoteName($k) . ' = ' . $db->quote($v)); + } + + $db->setQuery($query); + + $column_arr = $db->loadColumn(); + + return $column_arr; + } + + public function set_basic_fields() + { + $temps = array('title', 'description', 'alias', 'published', 'access', 'language', 'ordering', 'note', 'id', 'created', 'modified', 'created_by', 'hits'); + foreach ($temps as $temp) + { + if (array_key_exists($temp, $this->table_columns)) + { + $this->basic_fields[] = $temp; + } + } + } +} \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/src/Model/Back/TfModelList.php b/deployed/tflearn/libraries/techfry/src/Model/Back/TfModelList.php new file mode 100644 index 00000000..178cb0ae --- /dev/null +++ b/deployed/tflearn/libraries/techfry/src/Model/Back/TfModelList.php @@ -0,0 +1,393 @@ +sorting_fields; + + if (Associations::isEnabled()) + { + $config['filter_fields'][] = 'association'; + } + + if ($this->table_name) + { + $this->table_columns = TfDb::get_table_columns($this->table_name); + } + + $this->set_filters(); + $this->set_sorting_fields(); + + parent::__construct($config, $factory); + + $this->app = Factory::getApplication(); + + $this->input = $this->app->input; + + $this->option = $this->input->get('option'); + + $this->set_sortings_array(); + } + + public function getFilterForm($data = array(), $loadData = true) + { + $form = parent::getFilterForm($data, $loadData); + + // Search + $element = ''; + $form = $this->add_field($form, $element, 'default', 'filter'); + + // Filters + foreach ($this->filters as $k => $v) + { + switch ($k) + { + case 'published' : + $element = TfXml::filter_published_field(); + $form = $this->add_field($form, $element, 'default', 'filter'); + break; + + case 'access' : + $element = TfXml::filter_access_field(); + $form = $this->add_field($form, $element, 'default', 'filter'); + break; + + case 'note' : + $element = TfXml::filter_note_field($this->table_name); + $form = $this->add_field($form, $element, 'default', 'filter'); + break; + + case 'language' : + $element = TfXml::filter_language_field(); + $form = $this->add_field($form, $element, 'default', 'filter'); + break; + } + } + + // Ordering field + $element = TfXml::filter_ordering_field($this->orderCol); + $form = $this->add_field($form, $element, 'default', 'list'); + + $ordering = $form->getField('fullordering', 'list'); + foreach ($this->sortings as $k => $v) + { + $ordering->addOption($k, array('value' => $v)); + } + + // Limit field + $element = TfXml::filter_limit_field(); + $form = $this->add_field($form, $element, 'default', 'list'); + + $data = $this->loadFormData(); + + $form->bind($data); + + return $form; + } + + protected function getListQuery() + { + $char = 'a'; + + if (empty($this->select_fields)) + { + $this->select_fields = array('*'); + } + + // Initialize variables + $db = Factory::getDbo(); + $query = $db->getQuery(true); + + $query->select($this->select_fields) + ->from($db->quoteName('#__' . $this->table_name, $char)); + + // Join over other tables + foreach ($this->join_tables as $table) + { + $char++; + + $query->select($table[1]) + ->join('LEFT', $db->quoteName('#__' . $table[0], $char) . ' ON ' . $table[2] . ' = ' . $char . '.id'); + } + + if (!empty($this->joins)) + { + foreach ($this->joins as $join) + { + $char++; + + $query->join('LEFT', $db->quoteName('#__' . $join['table'], $char) . ' ON ' . $join['on'] . ' = ' . $char . '.id'); + } + } + + // Add the list ordering clause + $orderCol = $this->state->get('list.ordering', $this->orderCol); + $orderDirn = $this->state->get('list.direction', $this->orderDirn); + + $query->order($db->escape($orderCol) . ' ' . $db->escape($orderDirn)); + + // Join over languages + if (Associations::isEnabled() && $this->is_ml) + { + $query->select(array($db->quoteName('l.title', 'language_title'), $db->quoteName('l.image', 'language_image'))); + + $query->join('LEFT', $db->quoteName('#__languages', 'l'), $db->quoteName('l.lang_code') . ' = ' . $db->quoteName('a.language')); + } + + // Join over associations + if (Associations::isEnabled() && $this->is_ml) + { + $subQuery = $db->getQuery(true) + ->select('COUNT(' . $db->quoteName('asso1.id') . ') > 1') + ->from($db->quoteName('#__associations', 'asso1')) + ->join('INNER', $db->quoteName('#__associations', 'asso2'), $db->quoteName('asso1.key') . ' = ' . $db->quoteName('asso2.key')) + ->where(array($db->quoteName('asso1.id') . ' = ' . $db->quoteName('a.id'), $db->quoteName('asso1.context') . ' = ' . $db->quote('com_tfcontent.item')) + ); + + $query->select('(' . $subQuery . ') AS ' . $db->quoteName('association')); + } + + // Filter: like / search + $search = $this->getState('filter.search'); + if (!empty($search)) + { + $like = $db->quote('%' . $search . '%'); + $query->where($this->search . ' LIKE ' . $like); + } + /* + // Filter by access level + if (in_array('access', $this->filters)) + { + $access = $this->getState('filter.access'); + if (is_numeric($access)) + { + $query->where($db->quoteName('access') . ' = :access') + ->bind(':access', $access, ParameterType::INTEGER); + } + elseif (is_array($access)) + { + $access = ArrayHelper::toInteger($access); + $query->whereIn($db->quoteName('a.access'), $access); + } + } + */ + + // Filter by published state + if (array_key_exists('published', $this->filters)) + { + $published = $this->getState('filter.published'); + if ($published != '*') + { + if (is_numeric($published)) + { + $query->where($db->quoteName('a.published') . ' = ' . $db->quote($published)); + } + else + { + $query->whereIn($db->quoteName('a.published'), array(0, 1)); + } + } + } + + // Filters + foreach ($this->filters as $k => $v) + { + if ($k != 'published') + { + $value = $this->getState('filter.' . $k); + if ($value != '') + { + if (is_array($value)) + { + $value = ArrayHelper::toInteger($value); + $query->whereIn($db->quoteName($v), $value); + } + else + { + $query->where($db->quoteName($v) . ' = ' . $db->quote($value)); + } + } + } + } + + return $query; + } + + protected function populateState($ordering = null, $direction = null) + { + $app = Factory::getApplication(); + + // Adjust the context to support modal layouts. + if ($layout = $app->input->get('layout')) + { + $this->context .= '.' . $layout; + } + + // Adjust the context to support forced languages. + $forcedLanguage = $app->input->get('forcedLanguage', '', 'CMD'); + if ($forcedLanguage) + { + $this->context .= '.' . $forcedLanguage; + } + + parent::populateState($ordering, $direction); + + // If there is a forced language, then define that filter for the query where clause + if (!empty($forcedLanguage)) + { + $this->setState('filter.language', $forcedLanguage); + } + } + + // Count total items in $table where $column is $value + public function count_items($table, $column, $value) + { + $db = Factory::getDbo(); + $query = $db->getQuery(true); + + $query->select('COUNT(*)') + ->from($db->quoteName('#__' . $table)) + ->where($db->quoteName($column) . ' = ' . $db->quote($value)); + + $db->setQuery($query); + + $total = $db->loadResult(); + + return $total; + } + + // Add field to fieldset in the form + public function add_field($form, $element, $fieldset = 'default', $group = null, $replace = true) + { + $xml = new \SimpleXMLElement($element); + + $form->setField($xml, $group, $fieldset, $replace); + + return $form; + } + + public function set_sortings_array() + { + foreach ($this->sorting_fields as $field) + { + switch ($field) + { + case 'a.title' : + $this->sortings['JGLOBAL_TITLE_ASC'] = 'a.title ASC'; + $this->sortings['JGLOBAL_TITLE_DESC'] = 'a.title DESC'; + break; + + case 'a.published' : + $this->sortings['JSTATUS_ASC'] = 'a.published ASC'; + $this->sortings['JSTATUS_DESC'] = 'a.published DESC'; + break; + + case 'a.id' : + $this->sortings['JGRID_HEADING_ID_ASC'] = 'a.id ASC'; + $this->sortings['JGRID_HEADING_ID_DESC'] = 'a.id DESC'; + break; + + case 'a.modified' : + $this->sortings['JDATE_ASC'] = 'a.modified ASC'; + $this->sortings['JDATE_DESC'] = 'a.modified DESC'; + break; + + case 'a.hits' : + $this->sortings['JGLOBAL_HITS_ASC'] = 'a.hits ASC'; + $this->sortings['JGLOBAL_HITS_DESC'] = 'a.hits DESC'; + break; + + case 'a.ordering' : + $this->sortings['JGRID_HEADING_ORDERING_ASC'] = 'a.ordering ASC'; + $this->sortings['JGRID_HEADING_ORDERING_DESC'] = 'a.ordering DESC'; + break; + + case 'a.access' : + $this->sortings['JGRID_HEADING_ACCESS_ASC'] = 'a.access ASC'; + $this->sortings['JGRID_HEADING_ACCESS_DESC'] = 'a.access DESC'; + break; + + case 'a.note' : + $this->sortings['COM_TF_ORDERING_NOTE_ASC'] = 'a.note ASC'; + $this->sortings['COM_TF_ORDERING_NOTE_DESC'] = 'a.note DESC'; + break; + + case 'a.language' : + $this->sortings['JGRID_HEADING_LANGUAGE_ASC'] = 'a.language ASC'; + $this->sortings['JGRID_HEADING_LANGUAGE_DESC'] = 'a.language DESC'; + break; + + default : + $field_lang = (strpos($field, '.') == true) ? substr($field, 2) : $field; + $this->sortings[strtoupper($this->option) . '_ORDERING_' . strtoupper($field_lang) . '_ASC'] = $field . ' ASC'; + $this->sortings[strtoupper($this->option) . '_ORDERING_' . strtoupper($field_lang) . '_DESC'] = $field . ' DESC'; + } + } + } + + public function set_filters() + { + $temps = array('published', 'access', 'note'); + + // Key is the name of field in filter form; Value is column in db query + foreach ($temps as $temp) + { + if (array_key_exists($temp, $this->table_columns)) + { + $this->filters[$temp] = 'a.' . $temp; + } + } + } + + public function set_sorting_fields() + { + $temps = array('id', 'title', 'published', 'modified', 'hits', 'ordering', 'access', 'note'); + foreach ($temps as $temp) + { + if (array_key_exists($temp, $this->table_columns)) + { + $this->sorting_fields[] = 'a.' . $temp; + } + } + } +} \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/src/Model/Back/TfModelSelect.php b/deployed/tflearn/libraries/techfry/src/Model/Back/TfModelSelect.php new file mode 100644 index 00000000..e7aa97ac --- /dev/null +++ b/deployed/tflearn/libraries/techfry/src/Model/Back/TfModelSelect.php @@ -0,0 +1,28 @@ +input; + + $select_type = $input->get('select_type'); + + $items = $this->select_types[$select_type]; + + return $items; + } +} \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/src/Model/Front/TfModelForm.php b/deployed/tflearn/libraries/techfry/src/Model/Front/TfModelForm.php new file mode 100644 index 00000000..afc7e89a --- /dev/null +++ b/deployed/tflearn/libraries/techfry/src/Model/Front/TfModelForm.php @@ -0,0 +1,273 @@ +app = Factory::getApplication(); + + $this->input = $this->app->input; + + $this->today = Factory::getDate()->toSQL(); + + $this->user = Factory::getUser(); + + $this->table_columns = TfDb::get_table_columns($this->table_name); + } + + public function getForm($data = array(), $loadData = true) + { + // Get the form + $this->form = $this->loadForm($this->option . '.' . $this->getName(), $this->getName(), array('control' => 'jform', 'load_data' => $loadData)); + + if (empty($this->form)) + { + return false; + } + + $this->complete_form(); + + $this->bind_form(); + + return $this->form; + } + + protected function loadFormData() + { + // Check the session for previously entered form data. + $app = Factory::getApplication(); + $data = $app->getUserState($this->option . '.edit.' . $this->getName() . '.data', array()); + + if (empty($data) && ($this->loadData)) + { + $data = $this->getItem(); + } + + return $data; + } + + public function complete_form() + { + $this->add_fieldset('details'); + + $this->add_fieldset('captcha', 'Captcha'); + + $fieldset = 'details'; + $element = ''; + $this->set_field($element, $fieldset); + + $fieldset = 'details'; + $element = ''; + $this->set_field($element, $fieldset); + + $fieldset = 'captcha'; + $element = ''; + $this->set_field($element, $fieldset); + + if (array_key_exists('id', $this->table_columns)) + { + $fieldset = 'details'; + $element = ''; + $this->set_field($element, $fieldset); + } + + foreach ($this->basic_fields as $field) + { + switch ($field) + { + case 'published' : + $fieldset = 'details'; + $element = ''; + break; + + /* + case 'id' : + $fieldset = 'details'; + $element = ''; + break; + + case 'custom_redirect' : + $fieldset = 'details'; + $element = ''; + break; + + case 'custom_message' : + $fieldset = 'details'; + $element = ''; + break; + + case 'captcha' : + $fieldset = 'captcha'; + $element = ''; + break; + */ + + case 'created' : + $fieldset = 'details'; + $element = ''; + break; + + case 'modified' : + $fieldset = 'details'; + $element = ''; + break; + + case 'created_by' : + $fieldset = 'details'; + $element = ''; + break; + + case 'alias' : + $fieldset = 'details'; + $element = ''; + break; + + case 'hits' : + $fieldset = 'details'; + $element = ''; + break; + + case 'access' : + $fieldset = 'details'; + $element = ''; + } + + $this->set_field($element, $fieldset); + } + } + + public function save($data) + { + // A. Check for captcha + if (isset($data['answer'])) + { + if ($data['answer'] != $data['captcha']) + { + Factory::getApplication()->enqueueMessage('' . Text::_('COM_TF_ERROR_INCORRECT_CAPTCHA') . '', 'error'); + + return false; + } + + unset($data['captcha']); + unset($data['answer']); + } + + // B. Check for valid email + if (isset($data['email'])) + { + $data['email'] = strtolower($data['email']); + if (!filter_var($data['email'], FILTER_VALIDATE_EMAIL)) + { + Factory::getApplication()->enqueueMessage('' . Text::_('COM_TF_ERROR_INVALID_EMAIL') . '', 'error'); + + return false; + } + + if ($data['created_by'] == 0) + { + $user_id = TfUser::find_user($data['email']); + if ($user_id !== false) + { + $data['created_by'] = $user_id; + } + else + { + $juser = TfUser::create_user($data); + $data['created_by'] = $juser->id; + } + } + } + + $data = $this->prepare_data($data, $this->table_name, $this->date_fields, $this->subform_fields); + + return parent::save($data); + } + + public function set_field($element, $fieldset = 'default', $group = null, $replace = false) + { + $xml = new \SimpleXMLElement($element); + + $this->form->setField($xml, $group, $replace, $fieldset); + } + + public function set_fields($elements, $fieldset = 'default', $group = null, $replace = false) + { + foreach ($elements as $element) + { + $this->set_field($element, $fieldset, $group, $replace); + } + } + + // Add fieldset to the form + public function add_fieldset($name, $label = '', $description = '', $group = '') + { + $element = ''; + if ($group != '') + { + $element .= ''; + } + + $element .= '
    form->load($xml); + } + + public function bind_form() + { + if ($this->loadData) + { + $this->form->bind($this->getItem()); + } + } +} \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/src/Model/Front/TfModelItem.php b/deployed/tflearn/libraries/techfry/src/Model/Front/TfModelItem.php new file mode 100644 index 00000000..77415489 --- /dev/null +++ b/deployed/tflearn/libraries/techfry/src/Model/Front/TfModelItem.php @@ -0,0 +1,101 @@ +app = Factory::getApplication(); + + $this->input = $this->app->input; + } + + // 01. Get single item + public function getItem($pk = null) + { + if ($pk == null) + { + $input = Factory::getApplication()->input; + $pk = $input->get('id', 0, 'int'); + } + + $char = 'a'; + + $db = Factory::getDbo(); + $query = $db->getQuery(true); + + $query->select('*') + ->from($db->quoteName('#__' . $this->table_name, $char)) + ->where($db->quoteName('id') . ' = '. $db->quote($pk)); + + // Where conditions + foreach ($this->where as $condition) + { + $query->andWhere($condition); + } + + // Join over other tables + foreach ($this->join_tables as $table) + { + $char++; + + $query->select($char . '.' . $table[1]) + ->join('LEFT', $db->quoteName('#__' . $table[0], $char) . ' ON a.' . $table[2] . ' = ' . $char . '.id'); + } + + $db->setQuery($query); + + $row = $db->loadObject(); + + // Convert JSON strings to Objects + foreach ($this->json_fields as $field) + { + $row->$field = json_decode($row->$field); + } + + return $row; + } + + // 02. Increment hits + public function record_hits($pk = null) + { + if (is_null($pk)) + { + $input = Factory::getApplication()->input; + $pk = $input->get('id', 0, 'int'); + } + + $db = Factory::getDbo(); + $query = $db->getQuery(true); + + $query->update('#__' . $this->table_name) + ->set($db->quoteName('hits') . ' = (' . $db->quoteName('hits') . ' + 1)') + ->where($db->quoteName('id') . ' = '. $db->quote($pk)); + + $db->setQuery($query); + + $db->execute(); + } +} \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/src/Model/Front/TfModelList.php b/deployed/tflearn/libraries/techfry/src/Model/Front/TfModelList.php new file mode 100644 index 00000000..133abfca --- /dev/null +++ b/deployed/tflearn/libraries/techfry/src/Model/Front/TfModelList.php @@ -0,0 +1,105 @@ +select_fields)) + { + $this->select_fields = '*'; + } + + $char = 'a'; + + // Initialize variables + $db = Factory::getDbo(); + $query = $db->getQuery(true); + + $query->select($this->select_fields) + ->from($db->quoteName('#__' . $this->table_name, $char)) + ->where($db->quoteName('a.published') . ' = ' . $db->quote(1)); + + // Search + $input = Factory::getApplication()->input; + foreach ($this->searches as $search) + { + $$search = $input->get($search, '', 'RAW'); + if ($$search) + { + $query->andWhere($db->quoteName($search) . ' LIKE ' . $db->quote('%' . $$search . '%')); + } + } + + // Where conditions + foreach ($this->where as $condition) + { + if (is_array($condition)) + { + $query->andWhere($db->quoteName($condition[0]) . ' ' . $condition[1] . ' ' . $db->quote($condition[2])); + } + else + { + $query->andWhere($condition); + } + } + + // Join over other tables + foreach ($this->join_tables as $table) + { + $char++; + + $query->select($char . '.' . $table[1]) + ->join('LEFT', $db->quoteName('#__' . $table[0], $char) . ' ON a.' . $table[2] . ' = ' . $char . '.id'); + } + + if (!empty($this->orderby)) + { + $query->order($this->orderby); + } + + return $query; + } + + // 02. Count total items in table where column = value + public function count_items($table, $column, $value) + { + $db = Factory::getDbo(); + $query = $db->getQuery(true); + + $query->select('COUNT(*)') + ->from($db->quoteName('#__' . $table)) + ->where($db->quoteName($column) . ' = ' . $db->quote($value)) + ->andWhere($db->quoteName('published') . ' = ' . $db->quote('1')); + + $db->setQuery($query); + + $total = $db->loadResult(); + + return $total; + } +} \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/src/Model/TfModel.php b/deployed/tflearn/libraries/techfry/src/Model/TfModel.php new file mode 100644 index 00000000..c0a22fe4 --- /dev/null +++ b/deployed/tflearn/libraries/techfry/src/Model/TfModel.php @@ -0,0 +1,16 @@ +basic_fields = array(); + + $this->loadData = false; + } + + public function get_export_form() + { + // Get table type from URL + $input = Factory::getApplication()->input; + $export_type = $input->get('type'); + + // 1. Set type field + if ($export_type) + { + $element = ''; + $this->set_field($element, 'general'); + } + else + { + $element = ''; + $element .= ''; + foreach ($this->export_tables as $type => $table) + { + $element .= ''; + } + $element .= ''; + $this->set_field($element, 'general'); + } + + // 2. Set columns field + if ($export_type) + { + $this->set_select_field($export_type); + } + else + { + $element = ''; + $this->set_field($element, 'general'); + } + + // 3. Set custom fields for Joomla articles + if ((!$export_type) || ($export_type == 'joomla_content')) + { + $element = ' + + + + '; + $this->set_field($element, 'general'); + } + + // 4. Set filter field form source + $this->form->setFieldAttribute('filter', 'formsource', 'libraries/techfry/forms/subform_where.xml'); + + // 5. Set user custom field filter + if ((!$export_type) || ($export_type == 'users')) + { + $element = ''; + $this->set_field($element, 'filters'); + + $element = ''; + $this->set_field($element, 'filters'); + + $this->form->setFieldAttribute('filterusers', 'formsource', 'libraries/techfry/forms/subform_filterusers.xml'); + } + } + + public function set_select_field($export_type) + { + foreach ($this->export_tables as $type => $table) + { + if ($export_type == $type) + { + $table_name = '#__' . $table; + } + } + + $db = Factory::getDbo(); + $cols = $db->getTableColumns($table_name); + + $element = ''; + + foreach ($cols as $col_name => $col_type) + { + $element .= ''; + } + + if ($export_type == 'users') + { + $element .= ''; + $cfs = $this->get_items('fields', array(array('context', '=', 'com_users.user'))); + foreach ($cfs as $cf) + { + $element .= ''; + } + } + + $element .= ''; + + $this->set_field($element, 'general'); + } + + public function getForm($data = array(), $loadData = true) + { + $this->form = Form::getInstance($this->option . '.' . $this->getName(), JPATH_LIBRARIES . '/techfry/forms/' . $this->getName() . '.xml', array("control" => "jform")); + + if (empty($this->form)) + { + return false; + } + + $this->get_export_form(); + + return $this->form; + } +} \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/src/Model/TfModelImport.php b/deployed/tflearn/libraries/techfry/src/Model/TfModelImport.php new file mode 100644 index 00000000..e72f3882 --- /dev/null +++ b/deployed/tflearn/libraries/techfry/src/Model/TfModelImport.php @@ -0,0 +1,116 @@ +basic_fields = array(); + + $this->loadData = false; + } + + public function get_import_form() + { + // 1. Set type field + $element = ''; + $element .= ''; + foreach ($this->import_tables as $type => $table) + { + $element .= ''; + } + $element .= ''; + $this->set_field($element, 'general'); + + // 2. Columns field + $element = ''; + $this->set_field($element, 'general'); + + $input = Factory::getApplication()->input; + $import_type = $input->get('type'); + + // 3. User custom fields + if ((!$import_type) || ($import_type == 'users')) + { + $element = ''; + + $this->set_field($element, 'general'); + } + + // 4. Articles custom fields + if ((!$import_type) || ($import_type == 'joomla_content')) + { + $element = ''; + + $this->set_field($element, 'general'); + } + + // 5. Set columns helper field + $input = Factory::getApplication()->input; + $import_type = $input->get('type'); + if ($import_type) + { + $this->form->setValue('import_type', null, $import_type); + $this->form->setFieldAttribute('import_type', 'readonly', 'true'); + + $this->set_column_fields($import_type); + } + } + + public function set_column_fields($import_type) + { + foreach ($this->import_tables as $type => $table) + { + if ($import_type == $type) + { + $table_name = '#__' . $table; + } + } + + $db = Factory::getDbo(); + $cols = $db->getTableColumns($table_name); + + $element = ''; + + $this->set_field($element, 'general'); + } + + public function getForm($data = array(), $loadData = true) + { + $this->form = Form::getInstance($this->option . '.' . $this->getName(), JPATH_LIBRARIES . '/techfry/forms/' . $this->getName() . '.xml', array("control" => "jform")); + + if (empty($this->form)) + { + return false; + } + + $this->get_import_form(); + + return $this->form; + } +} \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/src/Model/TfModelQuery.php b/deployed/tflearn/libraries/techfry/src/Model/TfModelQuery.php new file mode 100644 index 00000000..e12d8f95 --- /dev/null +++ b/deployed/tflearn/libraries/techfry/src/Model/TfModelQuery.php @@ -0,0 +1,160 @@ +basic_fields = array(); + + $this->loadData = false; + } + + public function get_query_form() + { + $input = Factory::getApplication()->input; + $query_type = $input->get('type'); + + // 1. Set type field + if ($query_type) + { + $element = ''; + $this->set_field($element, 'general'); + } + else + { + $element = ''; + $element .= ''; + foreach ($this->action_tables as $type => $table) + { + $element .= ''; + } + $element .= ''; + $this->set_field($element, 'general'); + } + + // 2. Set column field + if ($query_type) + { + $this->set_column_field($query_type, 'column_field', 'COM_TF_COLUMN', 'update,find,find_duplicates,replace,string,date,numeric'); + } + else + { + $element = ''; + $this->set_field($element, 'general'); + } + + // 3. Set column to save field + if ($query_type) + { + $this->set_column_field($query_type, 'column_save', 'COM_TF_COLUMN_SAVE', 'string,date,numeric'); + } + else + { + $element = ''; + $this->set_field($element, 'general'); + } + + // 4. Set filter field form source + $this->form->setFieldAttribute('filter', 'formsource', 'libraries/techfry/forms/subform_where.xml'); + + // 5. Set user custom field filter + if ((!$query_type) || ($query_type == 'users')) + { + $element = ''; + $this->set_field($element, 'filters'); + + $element = ''; + $this->set_field($element, 'filters'); + + $this->form->setFieldAttribute('filterusers', 'formsource', 'libraries/techfry/forms/subform_filterusers.xml'); + } + + // 6. Set content custom field filter + if ((!$query_type) || ($query_type == 'content')) + { + $element = ''; + $this->set_field($element, 'filters'); + + $element = ''; + $this->set_field($element, 'filters'); + + $this->form->setFieldAttribute('filterarticles', 'formsource', 'libraries/techfry/forms/subform_filterarticles.xml'); + } + } + + public function set_column_field($query_type, $name, $label, $showon) + { + $table_name = '#__' . $query_type; + + $db = Factory::getDbo(); + $cols = $db->getTableColumns($table_name); + + $element = ''; + $element .= ''; + foreach ($cols as $col_name => $col_type) + { + $element .= ''; + } + + // Add custom fields and group for users + if ($query_type == 'users') + { + $element .= ''; + $cfs = $this->get_items('fields', array(array('context', '=', 'com_users.user'))); + foreach ($cfs as $cf) + { + $element .= ''; + } + } + + // Add custom fields for joomla content + if ($query_type == 'content') + { + $cfs = $this->get_items('fields', array(array('context', '=', 'com_content.article'))); + foreach ($cfs as $cf) + { + $element .= ''; + } + } + + $element .= ''; + + $this->set_field($element, 'general'); + } + + public function getForm($data = array(), $loadData = true) + { + $this->form = Form::getInstance($this->option . '.' . $this->getName(), JPATH_LIBRARIES . '/techfry/forms/' . $this->getName() . '.xml', array("control" => "jform")); + + if (empty($this->form)) + { + return false; + } + + $this->get_query_form(); + + return $this->form; + } +} \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/src/Model/TfModelTrait.php b/deployed/tflearn/libraries/techfry/src/Model/TfModelTrait.php new file mode 100644 index 00000000..dc638acf --- /dev/null +++ b/deployed/tflearn/libraries/techfry/src/Model/TfModelTrait.php @@ -0,0 +1,341 @@ +get('unicodeslugs') == 1) + { + $data['alias'] = OutputFilter::stringURLUnicodeSlug($data['title']); + } + else + { + $data['alias'] = OutputFilter::stringURLSafe($data['title']); + } + } + + // Check for duplicate alias + $data['alias'] = $this->check_alias($data['alias'], $data['id'], $table_name); + } + + // B. Automatic handling of dates + $date = Factory::getDate(); + foreach ($date_fields as $field) + { + echo $field; + if (empty($data[$field])) + { + $data[$field] = $date->toSql(); + } + else + { + $date_for_sql = Factory::getDate($data[$field]); + $data[$field] = $date_for_sql->toSql(); + } + } + if (array_key_exists('created', $cols)) + { + if ($data['id'] == 0 || !$data['created']) + { + $data['created'] = $date->toSql(); + } + else + { + $created_date = Factory::getDate($data['created']); + $data['created'] = $created_date->toSql(); + } + } + if (array_key_exists('modified', $cols)) + { + $data['modified'] = $date->toSql(); + } + + // C. Automatic handling of ordering + if (array_key_exists('ordering', $cols)) + { + if (!$data['ordering']) + { + $db = Factory::getDbo(); + $query = $db->getQuery(true) + ->select('MAX(ordering)') + ->from('#__' . $table_name); + + $db->setQuery($query); + $max = $db->loadResult(); + + $data['ordering'] = $max + 1; + } + } + + // D. Convert subform fields to JSON string + foreach ($subform_fields as $field) + { + if (isset($data[$field]) && is_array($data[$field])) + { + $registry = new Registry($data[$field]); + + $data[$field] = (string) $registry; + } + } + + // E. Convert arrays of multiple fields to JSON string (Add reverse function in getItem) + foreach ($multiple_fields as $field) + { + if (isset($data[$field]) && is_array($data[$field])) + { + $registry = new Registry($data[$field]); + + $data[$field] = (string) $registry; + } + } + + // F. Automatic handling of user + if (array_key_exists('created_by', $cols)) + { + if (!$data['created_by']) + { + $user = Factory::getUser(); + $data['created_by'] = $user->id; + } + } + + // G. Hits + if (array_key_exists('hits', $cols)) + { + if ($data['id'] == 0) + { + $data['hits'] = 0; + } + } + + // H. Access + if (array_key_exists('access', $cols)) + { + if (!isset($data['access'])) + { + $data['access'] = 1; + } + } + + // I. Access + if (array_key_exists('published', $cols)) + { + if (!isset($data['published'])) + { + $data['published'] = 1; + } + } + + // J. Language + if (array_key_exists('language', $cols)) + { + if (!isset($data['language'])) + { + $data['language'] = '*'; + } + } + + if (isset($data['custom_redirect'])) + { + unset($data['custom_redirect']); + } + + if (isset($data['custom_message'])) + { + unset($data['custom_message']); + } + + return $data; + } + + // 02. Check alias + public function check_alias($alias, $id, $table_name) + { + $current_alias = $alias; + $found = 0; + $i = 2; + + do + { + $item = TfDb::get_item($table_name, $alias, 'alias'); + if ($item && ($item->id != $id)) + { + $alias = $current_alias . '-' . $i; + $found = 1; + $i++; + } + else + { + $found = 0; + } + + } while ($found); + + return $alias; + } + + // 03. Get parameter from component options + public function get_param($type, $default = null) + { + $input = Factory::getApplication()->input; + $option = $input->get('option'); + + $param = ComponentHelper::getParams($option)->get($type, $default); + + return $param; + } + + // 04. Check if extension in premium version + public function pro() + { + $is_pro = $this->get_param('is_pro', 0); + + return $is_pro; + } + + // 05. Create new admin model + public function create_model_admin($name, $com = '') + { + if (empty($com)) + { + $input = Factory::getApplication()->input; + $com = $input->get('option'); + } + + $model = Factory::getApplication()->bootComponent($com)->getMVCFactory()->createModel($name, 'Administrator', array('ignore_request' => true)); + + return $model; + } + + // 06. Create new site model + public function create_model_site($name, $com = '') + { + if (empty($com)) + { + $input = Factory::getApplication()->input; + $com = $input->get('option'); + } + + $model = Factory::getApplication()->bootComponent($com)->getMVCFactory()->createModel($name, 'Site', array('ignore_request' => true)); + + return $model; + } + + // 07. Get menu item id from the link + public function get_menu_item_id($link) + { + $app = Factory::getApplication(); + + $menu = $app->getMenu(); + + $menuItem = $menu->getItems('link', $link, true); + + return $menuItem->id; + } + + // 08. Truncate table if table is empty + public function deleteTable($table) + { + // Check for records in table + $total_rows = TfDb::total_rows($table); + if ($total_rows) + { + $this->set_message('Truncate not allowed for table. ' . $total_rows . ' items exists in the table. Delete items and empty trash before truncating table.', 'error'); + + return false; + } + + TfDb::truncate_table($table); + + return true; + } + + // 09. Set message + public function set_message($msg, $type = 'message') + { + // $type: message (success), error, warning, notice (info) + + Factory::getApplication()->enqueueMessage($msg, $type); + } + + // 10. Get message + public function get_message($msg) + { + $output = ''; + + if (is_array($msg)) + { + $output = 'Total Items in Array: ' . count($msg) . '
    '; + foreach ($msg as $k => $v) + { + $output .= '' . $k . ' => '; + if (is_string($v) || is_int($v)) + { + $output .= $v; + } + else + { + $output .= '' . gettype($v) . ''; + } + $output .= '
    '; + } + } + elseif (is_object($msg)) + { + $output = 'Total Items in Object: ' . count($msg) . '
    '; + foreach ($msg as $k => $v) + { + $output .= '' . $k . ' => '; + if (is_string($v) || is_int($v)) + { + $output .= $v; + } + else + { + $output .= '' . gettype($v) . ''; + } + $output .= '
    '; + } + } + else + { + $output = $msg; + } + + $app = Factory::getApplication(); + + $app->enqueueMessage($output); + } +} \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/src/TfAlpha.php b/deployed/tflearn/libraries/techfry/src/TfAlpha.php new file mode 100644 index 00000000..02ac6483 --- /dev/null +++ b/deployed/tflearn/libraries/techfry/src/TfAlpha.php @@ -0,0 +1,145 @@ +type) + { + case 'text' : + $elements[] = TfXml::field_text($field); + break; + + case 'email' : + $elements[] = TfXml::field_email($field); + break; + + case 'url' : + $elements[] = TfXml::field_url($field); + break; + + case 'list' : + case 'checkboxes' : + $elements[] = TfXml::field_list($field); + break; + + case 'radio' : + $elements[] = TfXml::field_radio($field); + break; + + case 'integer' : + $elements[] = TfXml::field_integer($field); + break; + + case 'number' : + case 'range' : + $elements[] = TfXml::field_number($field); + break; + + case 'password' : + $elements[] = TfXml::field_password($field); + break; + + case 'file' : + $elements[] = TfXml::field_file($field); + break; + + case 'note' : + $elements[] = TfXml::field_note($field); + break; + + case 'textarea' : + $elements[] = TfXml::field_textarea($field); + break; + + case 'calendar' : + $elements[] = TfXml::field_calendar($field); + break; + + case 'subform' : + $elements[] = TfXml::field_subform($field); + break; + + case 'filelist' : + $elements[] = TfXml::field_filelist($field); + break; + + case 'folderlist' : + $elements[] = TfXml::field_folderlist($field); + break; + + case 'imagelist' : + $elements[] = TfXml::field_imagelist($field); + break; + + case 'color' : + $elements[] = TfXml::field_color($field); + break; + } + } + } + + return $elements; + } + + // 02. + public static function convert_joomla_field($field) + { + // fieldparams (specific to field type), params (common for all fields) + + $new_field = new \stdClass(); + + $new_field->id = $field->id; + $new_field->name = $field->name; + $new_field->type = $field->type; + $new_field->label = $field->label; + $new_field->description = $field->description; + $new_field->default_value = $field->default_value; + + if (isset($field->required)) + { + $new_field->required = ($field->required) ? 'true' : 'false'; + } + + $new_field->label_class = $field->params->get('label_class', ''); + $new_field->hint = $field->params->get('hint', ''); + $new_field->form_layout = $field->params->get('form_layout', ''); + + $new_field->options = $field->fieldparams->get('options'); + $new_field->multiple = $field->fieldparams->get('multiple'); + $new_field->directory = 'images/' . $field->fieldparams->get('directory'); + $new_field->rows = $field->fieldparams->get('rows'); + $new_field->cols = $field->fieldparams->get('cols'); + $new_field->maxlength = $field->fieldparams->get('maxlength'); + $new_field->relative = $field->fieldparams->get('relative'); + + return $new_field; + } +} \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/src/TfAmp.php b/deployed/tflearn/libraries/techfry/src/TfAmp.php new file mode 100644 index 00000000..428fe940 --- /dev/null +++ b/deployed/tflearn/libraries/techfry/src/TfAmp.php @@ -0,0 +1,65 @@ +getTemplate(true); + $enable_amp = $template->params->get('enable_amp', 0); + + if (!$enable_amp) + { + return false; + } + + $v = ''; + + // First get v from Joomla uri + $uri = Uri::getInstance(); + if ($uri->hasVar('v')) + { + $v = $uri->getVar('v'); + } + + // Then, try to get v from PHP server uri + if (empty($v)) + { + $server_uri = $app->input->server->get('REQUEST_URI', '', 'RAW'); + $str = parse_url($server_uri, PHP_URL_QUERY); + parse_str($str, $output); + $v = $output['v']; + } + + if ($v != 'amp') + { + return false; + } + + return true; + } + + // 2. Get Amp url + public static function get_amp_url() + { + $uri = Uri::getInstance(); + + $amp_url = strpos($uri, '?') ? $uri . '&v=amp' : $uri . '?v=amp'; + + return $amp_url; + } +} \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/src/TfApi.php b/deployed/tflearn/libraries/techfry/src/TfApi.php new file mode 100644 index 00000000..e968f59a --- /dev/null +++ b/deployed/tflearn/libraries/techfry/src/TfApi.php @@ -0,0 +1,71 @@ + $v) + { + curl_setopt($ch, $k, $v); + } + + // Post Fields + if (!empty($post_fields)) + { + curl_setopt($ch, CURLOPT_POST, true); + curl_setopt($ch, CURLOPT_POSTFIELDS, $post_fields); + } + + $data = curl_exec($ch); + + // Curl errors + if ($e = curl_error($ch)) + { + echo 'Curl Error: '; + print_r($e); + } + + // Curl Info - url, content_type, http_code + $info = curl_getinfo($ch); + + curl_close($ch); + + return $data; + } + + public static function curl_post($url, $post_fields = array()) + { + $ch = curl_init(); + + $fields_string = http_build_query($post_fields); + + curl_setopt($ch, CURLOPT_URL, $url); + curl_setopt($curl, CURLOPT_POST, true); + curl_setopt($curl, CURLOPT_POSTFIELDS, $fields_string); + + // curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type:application/json')); + + $data = curl_exec($ch); + + curl_close($ch); + + return $data; + } + +} \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/src/TfArray.php b/deployed/tflearn/libraries/techfry/src/TfArray.php new file mode 100644 index 00000000..231e33c7 --- /dev/null +++ b/deployed/tflearn/libraries/techfry/src/TfArray.php @@ -0,0 +1,67 @@ +getQuery(true); + + $query->select($db->quoteName('id')) + ->from($db->quoteName('#__content')) + ->where($db->quoteName('alias') . ' = '. $db->quote($alias)); + + if ($catid != null) + { + $query->andWhere($db->quoteName('catid') . ' = '. $db->quote($catid)); + } + + $db->setQuery($query); + + $article_id = $db->loadResult(); + + return $article_id ? $article_id : false; + } + + // 02. Create new joomla article from $data array + public static function create_article($data) + { + // $data array - title, catid, introtext are required + + $app = Factory::getApplication(); + $mvcFactory = $app->bootComponent('com_content')->getMVCFactory(); + $articleModel = $mvcFactory->createModel('Article', 'Administrator', array('ignore_request' => true)); + + if (!isset($data['language'])) + { + $data['language'] = '*'; + } + + $data['id'] = 0; + + $data['created'] = Factory::getDate()->toSQL(); + $data['modified'] = Factory::getDate()->toSQL(); + + if (!$articleModel->save($data)) + { + $app->enqueueMessage($articleModel->getError(), 'error'); + + return false; + } + + $article_id = self::get_last_id(); + + return $article_id; + } + + // 03. Update existing joomla article + public static function update_article($data) + { + $app = Factory::getApplication(); + + if (!$data['id']) + { + $app->enqueueMessage('Article ID is not set.', 'error'); + + return false; + } + + $mvcFactory = $app->bootComponent('com_content')->getMVCFactory(); + $articleModel = $mvcFactory->createModel('Article', 'Administrator', array('ignore_request' => true)); + + if (!isset($data['tags'])) + { + $th = new TagsHelper(); + $currentTags = $th->getTagIds($data['id'], 'com_content.article'); + $data['tags'] = explode(',', $currentTags); + } + + $data['modified'] = Factory::getDate()->toSql(); + + if (!$articleModel->save($data)) + { + $app->enqueueMessage($articleModel->getError(), 'error'); + + return false; + } + + return true; + } + + // 04. Save article custom field + public static function save_custom_field($field_id, $article_id, $value) + { + $fieldModel = Factory::getApplication()->bootComponent('com_fields')->getMVCFactory()->createModel('Field', 'Administrator', ['ignore_request' => true]); + + $result = $fieldModel->setFieldValue($field_id, $article_id, $value); + + return $result; + } + + // 05. Get article custom field + public static function get_custom_field($field_id, $article_id) + { + $fieldModel = Factory::getApplication()->bootComponent('com_fields')->getMVCFactory()->createModel('Field', 'Administrator', ['ignore_request' => true]); + + $value = $fieldModel->getFieldValue($field_id, $article_id); + + return $value; + } + + // 06. Filter articles + public static function filter_articles($filters, $articlefilters) + { + $db = Factory::getDbo(); + $query = $db->getQuery(true); + + $query + ->select($db->quoteName(array('a.id'))) + ->from($db->quoteName('#__content', 'a')) + ->where($db->quoteName('a.id') . ' > ' . $db->quote(0)) + ->order('a.id ASC'); + + // Joomla Content Table + if (is_array(json_decode($filters, true)) && (json_last_error() == JSON_ERROR_NONE)) + { + $filters = json_decode($filters); + } + $filters_arr = (array) $filters; + + if (!empty($filters_arr)) + { + foreach ($filters_arr as $filter_obj) + { + $filter = (array) $filter_obj; + + // Case 1: Filter value is given + if (($filter['where_field'] != '') && ($filter['where_value'] != '')) + { + if ($filter['isDate']) + { + $date = Factory::getDate('now -' . $filter['where_value'] . ' day'); + $filter['where_value'] = $date->toSQL(); + } + + $query->andWhere($db->quoteName('a.' . $filter['where_field']) . ' ' . $filter['where_operator'] . ' ' . $db->quote($filter['where_value'])); + } + // Case 2: Filter value is not given (Example: IS NULL) + elseif (!empty($filter['where_field']) && empty($filter['where_value'])) + { + $query->andWhere($db->quoteName('a.' . $filter['where_field']) . ' ' . $filter['where_operator']); + } + } + } + + // Content Custom Fields + if (is_array(json_decode($articlefilters, true)) && (json_last_error() == JSON_ERROR_NONE)) + { + $articlefilters = json_decode($articlefilters); + } + $articlefilters_arr = (array) $articlefilters; + + if (!empty($articlefilters_arr)) + { + foreach ($articlefilters_arr as $filter_obj) + { + $filter = (array) $filter_obj; + + if (is_numeric($filter['where_field'])) + { + $query->join('INNER', $db->quoteName('#__fields_values', 'c') . ' ON (' . $db->quoteName('a.id') . ' = ' . $db->quoteName('c.item_id') . ')') + ->andWhere($db->quoteName('c.field_id') . ' = ' . $db->quote($filter['where_field'])) + ->andWhere($db->quoteName('c.value') . ' ' . $filter['where_operator'] . ' ' . $db->quote($filter['where_value'])); + } + } + } + + $db->setQuery($query); + + $articles = $db->loadColumn(); + + return $articles; + } + + // 07. Returns array of tag names associated with article + public static function get_tags($article_id) + { + $th = new TagsHelper(); + $currentTags = $th->getTagIds($article_id, 'com_content.article'); + + $currentTagnames = $th->getTagNames(explode(',', $currentTags)); + + return $currentTagnames; + } + + // 08. Category information + public static function get_category($catid) + { + $extension = 'content'; + + $categories = Categories::getInstance($extension, array('access' => false, 'published' => 0)); + + $category = $categories->get($catid); + + return $category; + } + + // 09. Get ID of last article + public static function get_last_id() + { + $db = Factory::getDbo(); + $query = $db->getQuery(true); + + $query->select('id') + ->from($db->quoteName('#__content')) + ->order('id DESC') + ->setLimit('1'); + + $db->setQuery($query); + + $result = $db->loadResult(); + + return $result; + } + + // 10. Get article by ID + public static function get_article($article_id) + { + $db = Factory::getDbo(); + $query = $db->getQuery(true); + + $query->select($db->quoteName(array('id', 'title', 'alias', 'introtext', 'fulltext', 'state', 'access', 'images', 'catid', 'language'))) + ->from($db->quoteName('#__content')) + ->where($db->quoteName('id') . ' = ' . $db->quote($article_id)); + + $db->setQuery($query); + + $article = $db->loadObject(); + + return $article; + } + + // 11. Get articles by category + public static function get_articles_by_category($category_id, $order = 'id DESC', $limit = 12) + { + $today = Factory::getDate(); + + $db = Factory::getDbo(); + $query = $db->getQuery(true); + + $query->select($db->quoteName(array('id', 'title', 'alias', 'introtext', 'fulltext', 'state', 'access', 'images', 'catid', 'language'))) + ->from($db->quoteName('#__content')) + ->where($db->quoteName('catid') . ' = ' . $category_id) + ->andWhere($db->quoteName('state') . ' = '. $db->quote('1')) + ->andWhere($db->quoteName('publish_up') . ' < ' . $db->quote($today)) + ->order($order) + ->setLimit($limit); + + $db->setQuery($query); + + $articles = $db->loadObjectList(); + + return $articles; + } + + // 12. Get articles by tag + public static function get_articles_by_tag($tag_id, $order = 'id DESC', $limit = 12) + { + $typesr = null; + $includeChildren = false; + $orderByOption = 'c.core_title'; + $orderDir = 'ASC'; + $anyOrAll = true; + $languageFilter = 'all'; + $stateFilter = '0,1'; + + $th = new TagsHelper(); + + $query = $th->getTagItemsQuery($tag_id, $typesr, $includeChildren, $orderByOption, $orderDir, $anyOrAll, $languageFilter, $stateFilter); + + $db = Factory::getDbo(); + + $db->setQuery($query); + + $articles = $db->loadObjectList(); + + return $articles; + } + + // 13. Get fields + public static function get_fields($article_id = null) + { + if ($article_id == null) + { + $fields = FieldsHelper::getFields('com_content.article'); + } + else + { + $item = self::get_article($article_id); + $fields = FieldsHelper::getFields('com_content.article', $item); + } + + return $fields; + } + + // 14. Render fields + public static function render_fields($article_id) + { + $output = ''; + + $item = self::get_article($article_id); + $fields = FieldsHelper::getFields('com_content.article', $item); + foreach ($fields as $field) + { + $output .= FieldsHelper::render('com_content.article', 'field.render', array('field' => $field)); + } + + return $output; + } +} \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/src/TfDate.php b/deployed/tflearn/libraries/techfry/src/TfDate.php new file mode 100644 index 00000000..45044045 --- /dev/null +++ b/deployed/tflearn/libraries/techfry/src/TfDate.php @@ -0,0 +1,97 @@ +format($param); + break; + + // No arguments + case 'getdate' : + case 'time' : + case 'timezone_identifiers_list' : + $result = $function(); + break; + + // One argument - $data + case 'date' : + case 'date_parse' : + case 'strtotime' : + case 'date_interval_create_from_date_string' : + case 'date_offset_get' : + $result = $function($data); + break; + + // Two arguments - data, parameter + case 'date_add' : + case 'date_sub' : + case 'date_format' : + case 'date_modify' : + case 'date_diff' : + case 'date_interval_format' : + $result = $function($data, $param); + break; + + // Second argument as date + case 'date_create_from_format' : + case 'date_parse_from_format' : + $result = $function($param, $data); + break; + + // JOOMLA METHODS + + // No parameters + case 'toISO8601' : + case 'toRFC822' : + case 'toUnix' : + case 'toSql' : + $date = Factory::getDate($data); + $result = $date->$function(); + break; + + // One parameter + case 'format' : + case 'modify' : + $date = Factory::getDate($data); + $result = $date->$function($param); + break; + } + + return $result; + } + + /* + DATE INTERVALS + + P1D / 1 day + P2W / 2 weeks + P3M / 3 months + P4Y / 4 years + + P1Y1D / 1 year + 1 day + P1YT12H / 1 year + 12 hours + + PT3600S / 3600 seconds + + */ + + + +} \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/src/TfDb.php b/deployed/tflearn/libraries/techfry/src/TfDb.php new file mode 100644 index 00000000..cb543f67 --- /dev/null +++ b/deployed/tflearn/libraries/techfry/src/TfDb.php @@ -0,0 +1,360 @@ +getQuery(true); + + $query->select('COUNT(*)') + ->from($db->quoteName('#__' . $table)); + + if (!empty($conditions)) + { + foreach ($conditions as $condition) + { + if (isset($condition[2]) && $condition[2] != '') + { + $query->where($db->quoteName($condition[0]) . ' ' . $condition[1] . ' ' . $db->quote($condition[2])); + } + else + { + $query->where($db->quoteName($condition[0]) . ' ' . $condition[1]); + } + } + } + + $db->setQuery($query); + + $total = $db->loadResult(); + + return $total; + } + + // 02. Get single row from $table where id is $pk + public static function get_item($table, $pk = null, $column = 'id') + { + if ($pk == null) + { + $input = Factory::getApplication()->input; + $pk = $input->get('id', 0, 'int'); + } + + $db = Factory::getDbo(); + $query = $db->getQuery(true); + + $query->select('*') + ->from($db->quoteName('#__' . $table)) + ->where($db->quoteName($column) . ' = ' . $db->quote($pk)); + + $db->setQuery($query); + + $data = $db->loadObject(); + + return $data; + } + + // 03. Get single record from $table based on the $conditions + public static function get_record($table, $conditions = array(), $order = null, $select = array()) + { + if (empty($select)) + { + $select = array('*'); + } + + $db = Factory::getDbo(); + $query = $db->getQuery(true); + + $query->select($select) + ->from($db->quoteName('#__' . $table)) + ->setLimit('1'); + + if (!empty($conditions)) + { + foreach ($conditions as $condition) + { + if (isset($condition[2]) && $condition[2] != '') + { + $query->where($db->quoteName($condition[0]) . ' ' . $condition[1] . ' ' . $db->quote($condition[2])); + } + else + { + $query->where($db->quoteName($condition[0]) . ' ' . $condition[1]); + } + } + } + + if ($order) + { + $query->order($order); + } + + $db->setQuery($query); + + $data = $db->loadObject(); + + return $data; + } + + // 04. Get multiple rows from $table + public static function get_items($table, $conditions = array(), $order = null, $limit = null, $column = null) + { + $db = Factory::getDbo(); + $query = $db->getQuery(true); + + $select = $column ? $column : '*'; + + $query->select('*') + ->from($db->quoteName('#__' . $table)); + + if (!empty($conditions)) + { + foreach ($conditions as $condition) + { + if (isset($condition[2]) && $condition[2] != '') + { + $query->where($db->quoteName($condition[0]) . ' ' . $condition[1] . ' ' . $db->quote($condition[2])); + } + else + { + $query->where($db->quoteName($condition[0]) . ' ' . $condition[1]); + } + } + } + + if ($order) + { + $query->order($order); + } + if ($limit) + { + $query->setLimit($limit); + } + + $db->setQuery($query); + + if ($column) + { + $data = $db->loadColumn(); + } + else + { + $data = $db->loadObjectList(); + } + + return $data; + } + + // 05. Get multiple records from $table; supports joining and select columns + public static function get_records($table, $select = '*', $conditions = array(), $order = null, $limit = null, $joins = array()) + { + $char = 'a'; + + $db = Factory::getDbo(); + $query = $db->getQuery(true); + + $query->select($select) + ->from($db->quoteName('#__' . $table, $char)); + + if (!empty($conditions)) + { + foreach ($conditions as $condition) + { + if (isset($condition[2]) && $condition[2] != '') + { + $query->where($db->quoteName($condition[0]) . ' ' . $condition[1] . ' ' . $db->quote($condition[2])); + } + else + { + $query->where($db->quoteName($condition[0]) . ' ' . $condition[1]); + } + } + } + + if (!empty($joins)) + { + $char++; + + foreach ($joins as $join) + { + $query->join('LEFT', $db->quoteName('#__' . $join['table'], $char) . ' ON ' . $join['on'] . ' = ' . $char . '.id'); + } + } + + if ($order) + { + $query->order($order); + } + if ($limit) + { + $query->setLimit($limit); + } + + $db->setQuery($query); + + $data = $db->loadObjectList(); + + return $data; + } + + // 06. Insert or update record in $table + public static function insert_update($table, $data, $pk = 'id') + { + if (is_array($data)) + { + $data = (object) $data; + } + + if ($pk) + { + if ($data->id == 0) + { + $result = Factory::getDbo()->insertObject('#__' . $table, $data, $pk); + } + else + { + $result = Factory::getDbo()->updateObject('#__' . $table, $data, $pk); + } + } + else + { + $result = Factory::getDbo()->insertObject('#__' . $table, $data); + } + + return $data; + } + + // 07. Check if database table exists + public static function table_exists($table) + { + $db = Factory::getDbo(); + + $tables = $db->getTableList(); + $prefix = $db->getPrefix(); + + if (in_array($prefix . $table, $tables)) + { + return true; + } + + return false; + } + + // 08. Delete Records + public static function delete_items($table, $conditions = array()) + { + if (empty($conditions)) + { + return; + } + + $db = Factory::getDbo(); + $query = $db->getQuery(true); + + $query->delete($db->quoteName('#__' . $table)); + + foreach ($conditions as $condition) + { + $query->where($db->quoteName($condition[0]) . ' ' . $condition[1] . ' ' . $db->quote($condition[2])); + } + + $db->setQuery($query); + + $db->execute(); + + return $db->getAffectedRows(); + } + + // 09. Update records based on conditions + public static function update_records($table, $conditions = array(), $sets = array()) + { + $db = Factory::getDbo(); + $query = $db->getQuery(true); + + $query->update($db->quoteName('#__' . $table)); + + foreach ($conditions as $condition) + { + $query->where($db->quoteName($condition[0]) . ' ' . $condition[1] . ' ' . $db->quote($condition[2])); + } + + foreach ($sets as $k => $v) + { + $query->set($db->quoteName($k) . ' = ' . $db->quote($v)); + } + + $db->setQuery($query); + + $db->execute(); + + return $db->getAffectedRows(); + } + + // 10. Truncate table + public static function truncate_table($table) + { + $db = Factory::getDbo(); + + $db->truncateTable('#__' . $table); + } + + // 11. Get columns in a table + public static function get_table_columns($table) + { + $db = Factory::getDbo(); + + $cols = $db->getTableColumns('#__' . $table); + + return $cols; + } + + // 12. Drop table + public static function drop_table($table) + { + if (!self::table_exists($table)) + { + return false; + } + + $db = Factory::getDbo(); + + $query = $db->getQuery(true); + + $query = 'DROP TABLE ' . $db->quoteName('#__' . $table); + + $db->setQuery($query); + + $db->execute(); + } + + // 13. Drop column from table + public static function drop_column($table, $column) + { + $db = Factory::getDbo(); + + $query = $db->getQuery(true); + + $query = 'ALTER TABLE ' . $db->quoteName('#__' . $table); + $query .= ' DROP COLUMN ' . $db->quoteName($column); + + $db->setQuery($query); + $db->execute(); + } +} \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/src/TfDom.php b/deployed/tflearn/libraries/techfry/src/TfDom.php new file mode 100644 index 00000000..3ecae767 --- /dev/null +++ b/deployed/tflearn/libraries/techfry/src/TfDom.php @@ -0,0 +1,230 @@ +preserveWhiteSpace = false; + $dom->loadHTML($html, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD); + + return $dom; + } + + // 01. Function to get array of HTML elements + public static function get_html($html, $tag, $attr = null, $attr_value = null) + { + $dom = self::get_dom($html); + + $contents = $dom->getElementsByTagName($tag); // Array of Content + if ($contents->length == 0) + { + return false; + } + + foreach ($contents as $content) + { + if ($attr != null) + { + if ($content->getAttribute($attr) == $attr_value) + { + $html_arr[] = $dom->saveHtml($content); + } + } + elseif ($attr == null) + { + $html_arr[] = $dom->saveHTML($content); + } + } + + return $html_arr; + } + + // 02. Function to get array of values + public static function get_value($html, $tag, $attr = null, $attr_value = null) + { + $dom = self::get_dom($html); + + $contents = $dom->getElementsByTagName($tag); // Array of Content + if ($contents->length == 0) + { + return false; + } + + foreach ($contents as $content) + { + if ($attr != null) + { + if ($content->getAttribute($attr) == $attr_value) + { + $values[] = $content->nodeValue; + } + } + elseif ($attr == null) + { + $values[] = $content->nodeValue; + } + } + + return $values; + } + + // 03. Function to get array of attribute values + public static function get_attr($html, $tag, $target, $attr = null, $attr_value = null) + { + $dom = self::get_dom($html); + + $contents = $dom->getElementsByTagName($tag); // Array of Content + + if ($contents->length == 0) + { + return false; + } + + foreach ($contents as $content) + { + if ($attr != null) + { + if ($content->getAttribute($attr) == $attr_value) + { + $attr_values[] = $content->getAttribute($target); + } + } + elseif ($attr == null) + { + $attr_values[] = $content->getAttribute($target); + } + } + + return $attr_values; + } + + // 04. Function to remove all attributes from HTML except some + public static function rem_attr($html, $noremove = array()) + { + $dom = self::get_dom($html); + + $xpath = new \DOMXPath($dom); + $nodes = $xpath->query('//@*'); + + foreach ($nodes as $node) + { + if (!in_array($node->nodeName, $noremove)) + { + $node->parentNode->removeAttribute($node->nodeName); + } + } + + return $dom->saveHTML(); + } + + // 05. Function to add attribute to specific tag + public static function add_attr($html, $tag, $attr, $attr_value) + { + $dom = self::get_dom($html); + + $nodes = $dom->getElementsByTagName($tag); + + if (is_array($attr_value)) + { + foreach ($nodes as $k => $node) + { + $node->setAttribute($attr, $attr_value[$k]); + } + } + else + { + foreach ($nodes as $node) + { + $node->setAttribute($attr, $attr_value); + } + } + + return $dom->saveHTML(); + } + + // 06. Function to remove complete element + public static function rem_element($html, $tag, $attr = null, $attr_value = null) + { + $dom = self::get_dom($html); + + $list = $dom->getElementsByTagName($tag); + + for ($i = $list->length; --$i >= 0;) + { + $node = $list->item($i); + + if ($attr != null) + { + if ($node->getAttribute($attr) == $attr_value) + { + $node->parentNode->removeChild($node); + } + } + elseif ($attr == null) + { + $node->parentNode->removeChild($node); + } + } + + return $dom->saveHTML(); + } + + // 07. Function to get array of names of unique tags in html + public static function get_tags($html) + { + $dom = self::get_dom($html); + + $elements = $dom->getElementsByTagName('*'); + $tag_names[] = array(); + + foreach ($elements as $element) + { + if (!in_array($element->tagName, $tag_names)) + { + $tag_names[] = $element->tagName; + } + } + + return $tag_names; + } + + // 08. + public static function get_html_by_value($html, $tag, $value = '') + { + $dom = self::get_dom($html); + + $contents = $dom->getElementsByTagName($tag); // Array of Content + if ($contents->length == 0) + { + return false; + } + + foreach ($contents as $content) + { + if (!empty($value)) + { + if (strpos($content->nodeValue, $value) !== false) + { + $html_arr[] = $dom->saveHtml($content); + } + } + elseif (empty($value)) + { + $html_arr[] = $dom->saveHTML($content); + } + } + + return $html_arr; + } +} \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/src/TfFile.php b/deployed/tflearn/libraries/techfry/src/TfFile.php new file mode 100644 index 00000000..5b5d6ead --- /dev/null +++ b/deployed/tflearn/libraries/techfry/src/TfFile.php @@ -0,0 +1,64 @@ + $options['max_size']) + { + return false; + } + + // 3. Rename file + + if (isset($options['new_name'])) + { + $new_name = $options['new_name'] . '.' . $ext; + } + else + { + $name = File::stripExt($file['name']); + $new_name = $name . '_' . mt_rand(100,999) . '.' . $ext; + } + + // 4. Upload file + $src = $file['tmp_name']; + $dest = $options['save_folder'] . '/' . $new_name; + + if (File::upload($src, $dest)) + { + return $new_name; + } + else + { + return false; + } + } +} \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/src/TfHtml.php b/deployed/tflearn/libraries/techfry/src/TfHtml.php new file mode 100644 index 00000000..9f91f4a0 --- /dev/null +++ b/deployed/tflearn/libraries/techfry/src/TfHtml.php @@ -0,0 +1,242 @@ +'; + $output .= $text; + $output .= ''; + + return self::action($output, $display); + } + + // 03. Heading + public static function heading($text = '', $level = 'h1', $style = '', $display = true) + { + if ($text == '') + { + return; + } + + return self::text($text, $level, $style, $display); + } + + // 04. Date + public static function display_date($date, $format = 'F d, Y', $display = true) + { + if (empty($date)) + { + return; + } + + $date_to_format = Factory::getDate($date); + + $output = '

    '; + $output .= $date_to_format->format($format); + $output .= '

    '; + + return self::action($output, $display); + } + + // 05. Image + public static function image($src, $alt = '', $style = '', $display = true) + { + if (empty($src)) + { + return; + } + + $is_amp = self::check_amp(); + + if ($is_amp) + { + $image_info = getimagesize($src); + + $output = ''; + } + else + { + $class = $style ? ' class="' . trim($style) . '"' : ''; + $title = $alt ? ' title="' . trim($alt) . '"' : ''; + $alt_text = $alt ? ' alt="' . trim($alt) . '"' : ''; + + $output = ''; + } + + return self::action($output, $display); + } + + // 06A. Link in same window + public static function display_link($text = '', $url = '#', $style = 'text-decoration-none', $display = true) + { + if ($text == '') + { + return; + } + + $class = $style ? ' class="' . trim($style) . '"' : ''; + + $output = '' . $text . ''; + + return self::action($output, $display); + } + + // 06B. Link in new window + public static function display_link_new($text = '', $url = '#', $style = 'text-decoration-none', $display = true) + { + if ($text == '') + { + return; + } + + $class = $style ? ' class="' . trim($style) . '"' : ''; + + $output = '' . $text . ''; + + return self::action($output, $display); + } + + // 07. List + public static function display_list($items, $tag = 'ul', $list_style = '', $item_style = '', $display = true) + { + if (empty($items)) + { + return; + } + + $list_class = $list_style ? ' class="' . trim($list_style) . '"' : ''; + $item_class = $item_style ? ' class="' . trim($item_style) . '"' : ''; + + $output = '<' . $tag . $list_class . '>'; + + foreach ($items as $item) + { + $output .= ''; + $output .= $item; + $output .= ''; + } + + $output .= ''; + + return self::action($output, $display); + } + + // 08. Table + public static function table($items, $style = 'table table-striped table-hover', $theads = array(), $display = true) + { + if (empty($items)) + { + return; + } + + $class = $style ? ' class="' . trim($style) . '"' : ''; + $output = ''; + + if (!empty($theads)) + { + $output .= ''; + foreach ($theads as $thead) + { + $output .= '' . $thead . ''; + } + $output .= ''; + } + + foreach ($items as $item) + { + $output .= ''; + foreach ($item as $v) + { + $output .= '' . $v . ''; + } + $output .= ''; + } + $output .= ''; + + return self::action($output, $display); + } + +// ***************************************************************************** + + public static function check_amp() + { + // Check if AMP is enabled in template option + $app = Factory::getApplication('site'); + + $template = $app->getTemplate(true); + $enable_amp = $template->params->get('enable_amp', 0); + + if (!$enable_amp) + { + return false; + } + + // Check for v query string in URL + $uri = Uri::getInstance(); + $v = ''; + if ($uri->hasVar('v')) + { + $v = $uri->getVar('v'); + } + + if ($v != 'amp') + { + return false; + } + + return true; + } + + public static function action($output, $display = true) + { + if ($display) + { + echo $output; + + return true; + } + else + { + return $output; + } + } +} \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/src/TfImg.php b/deployed/tflearn/libraries/techfry/src/TfImg.php new file mode 100644 index 00000000..07da7cd4 --- /dev/null +++ b/deployed/tflearn/libraries/techfry/src/TfImg.php @@ -0,0 +1,423 @@ + IMG_FILTER_GRAYSCALE, + 'NEGATE' => IMG_FILTER_NEGATE, + 'BRIGHTNESS' => IMG_FILTER_BRIGHTNESS, + 'CONTRAST' => IMG_FILTER_CONTRAST, + 'COLORIZE' => IMG_FILTER_COLORIZE, + 'EDGEDETECT' => IMG_FILTER_EDGEDETECT, + 'EMBOSS' => IMG_FILTER_EMBOSS, + 'GAUSSIAN_BLUR' => IMG_FILTER_GAUSSIAN_BLUR, + 'SELECTIVE_BLUR' => IMG_FILTER_SELECTIVE_BLUR, + 'MEAN_REMOVAL' => IMG_FILTER_MEAN_REMOVAL, + 'SMOOTH' => IMG_FILTER_SMOOTH, + 'PIXELATE' => IMG_FILTER_PIXELATE, + 'SCATTER' => IMG_FILTER_SCATTER + ); + + // 01. Save image from url to path + public static function get_img($url, $path) + { + $fp = fopen($path, 'wb'); + + $ch = curl_init($url); + curl_setopt($ch, CURLOPT_FILE, $fp); + curl_setopt($ch, CURLOPT_HEADER, 0); + + $data = curl_exec($ch); + + curl_close($ch); + + fclose($fp); + + return $data; + } + + // 02. Resize image + public static function resize_image($path, $width, $total) + { + $size = getimagesize($path); + + $r1 = ($size[0])/($size[1]); // Width to Height Ratio + + // Calculate desired ratio + $r2 = ($width * $width)/$total; + + if ($r1 < $r2) + { + $new_width = $width; + } + else + { + $new_width = ceil(sqrt($total * $r1)); + } + + // Load image file + $image = self::load_image($path); + + // Use imagescale() function to scale the image + $new_image = imagescale($image, $new_width); + + // Save image + self::save_image($new_image, $path); + + imagedestroy($image); + + return $new_width; + } + + // 03. Returns random image from folder + public static function reset_image($folder = 'images') + { + $images = self::get_images($folder); + + $i = count($images); + $random = mt_rand(0, $i - 1); + + $image = $images[$random]; + + $image_url = $folder . '/' . $image; + + return $image_url; + } + + // 04. Create image + public static function create_image($title, $options = array(), $img_name = null) + { + // $options array - width, height, bg_color, text_color, src_folder, pct, dst_folder, font_base_url, fonttype + // For adding text from title - add_text, remove_words, fontsize, wordwrap + + $image_name = OutputFilter::stringURLSafe($title); + + $width = $options['width']; + $height = $options['height']; + + // A. Create image canvas + self::create_blank_image($width, $height); + + // B. Background color + self::image_fill($options['bg_color']); + + // C. Add random image to canvas + if (!empty($options['src_folder'])) + { + $random_image = self::reset_image($options['src_folder']); + + self::copy_image(JPATH_ROOT . '/' . $random_image, $width, $height, $options['pct']); + } + + // D. Add text to image + if ($options['add_text']) + { + // Delete some words + if (!empty($options['remove_words'])) + { + $remove_words = explode(',', $options['remove_words']); + foreach ($remove_words as $word) + { + $title = str_ireplace(trim($word), '', $title); + } + $title = trim($title); + + // Image name from new title + $image_name = OutputFilter::stringURLSafe($title); + } + + $title_length = strlen($title); + $font_size = $options['fontsize'] - $title_length; + + $word_wrap = floor($options['wordwrap']/$font_size); + $text = wordwrap($title, $word_wrap); + + $font = JPATH_ROOT . '/' . $options['font_base_url'] . '/' . $options['fonttype'] . '.ttf'; + + self::image_text($text, $options['text_color'], $font, $font_size); + } + + // E. Save image + // If $img_name is provided, use that instead of creating name from title + $image_name = $img_name ?? $image_name; + $dst = JPATH_ROOT . '/' . $options['dst_folder'] . '/' . $image_name . '.jpg'; + + self::save_image(self::$image, $dst); + + imagedestroy(self::$image); + + return $image_name; + } + + // 05. Filter image + public static function filter_image($path, $filter = '') + { + if (empty($filter)) + { + return; + } + + $filter = strtoupper($filter); + + $image = self::load_image($path); + + $result = imagefilter($image, self::$image_filters[$filter]); + + self::save_image($image, $path); + + imagedestroy($image); + + return $result; + } + + public static function convert_image_to_webp($image_url) + { + $path = pathinfo($image_url); + + $dest = JPATH_ROOT . '/' . $path['dirname'] . '/' . $path['filename'] . '.webp'; + + $image = self::load_image(JPATH_ROOT . '/' . $image_url); + + // Create new webp image + imagewebp($image, $dest); + + imagedestroy($image); + + // New image URL with webp + $new_image_url = $path['dirname'] . '/' . $path['filename'] . '.webp'; + + // Delete original file + self::delete_image($image_url); + + return $new_image_url; + } + + // Create image canvas + public static function create_blank_image($width, $height) + { + self::$image = imagecreatetruecolor($width, $height); + + if (self::$image == false) + { + self::set_message('Error in creating image'); + } + } + + // Fill image with color + public static function image_fill($color) + { + $image_color = self::get_image_color($color); + + imagefill(self::$image, 0, 0, $image_color); + } + + public static function get_image_color($color) + { + list($r1, $g1, $b1) = sscanf($color, "#%02x%02x%02x"); + + $image_color = imagecolorallocate(self::$image, $r1, $g1, $b1); + + return $image_color; + } + + public static function copy_image($path, $src_width, $src_height, $pct) + { + $src_image = self::load_image($path); + + $dst_x = 0; + $dst_y = 0; + $src_x = 0; + $src_y = 0; + + // $result = imagecopy(self::$image, $src_image, $dst_x, $dst_y, $src_x, $src_y, $src_width, $src_height); + $result = imagecopymerge(self::$image, $src_image, $dst_x, $dst_y, $src_x, $src_y, $src_width, $src_height, $pct); + + imagedestroy($src_image); + + if ($result == false) + { + self::set_message('Error in copying image'); + } + } + + // Add text to image + public static function image_text($text, $text_color, $font, $font_size) + { + if (empty($text)) + { + return; + } + + $tb = self::text_box($text, $font, $font_size); + + // Center align text + $width = imagesx(self::$image); + $height = imagesy(self::$image); + + $x = ($width - $tb['width'])/2; + $y = ($height - $tb['height'])/2; + + $image_color = self::get_image_color($text_color); + + imagettftext(self::$image, $font_size, 0, $x, $y, $image_color, $font, $text); + } + + // Get text box width and height + public static function text_box($text, $font, $font_size) + { + $box = imagettfbbox($font_size, 0, $font, $text); + + $tb['width'] = abs($box[4] - $box[0]); + + $tb['height'] = abs($box[5] - $box[1]); + + return $tb; + } + + public static function delete_image($image_url) + { + File::delete(JPATH_ROOT . '/' . $image_url); + } + + // Load image based on its extension + public static function load_image($path) + { + $ext = pathinfo($path, PATHINFO_EXTENSION); + + switch ($ext) + { + case 'jpeg' : + $image = imagecreatefromjpeg($path); + break; + + case 'jpg' : + $image = imagecreatefromjpeg($path); + break; + + case 'png' : + $image = imagecreatefrompng($path); + break; + + case 'webp' : + $image = imagecreatefromwebp($path); + break; + + case 'gif' : + $image = imagecreatefromgif($path); + } + + if ($image == false) + { + self::set_message('Unable to load image: ' . $path); + } + + return $image; + } + + // Save image based on its extension + public static function save_image($image, $destination) + { + $ext = pathinfo($destination, PATHINFO_EXTENSION); + + switch ($ext) + { + case 'jpeg' : + $result = imagejpeg($image, $destination); + break; + + case 'jpg' : + $result = imagejpeg($image, $destination); + break; + + case 'png' : + $result = imagepng($image, $destination); + break; + + case 'webp' : + $result = imagewebp($image, $destination); + break; + + case 'gif' : + $result = imagegif($image, $destination); + } + + if ($result == false) + { + self::set_message('Error in saving image.'); + } + } + + // Returns array of image filenames in a folder + public static function get_images($folder) + { + $dir = JPATH_ROOT . '/' . $folder; + + if (is_dir($dir)) + { + if ($handle = opendir($dir)) + { + while (false !== ($file = readdir($handle))) + { + if ($file !== '.' && $file !== '..' && $file !== 'index.html') + { + $files[] = $file; + } + } + } + + closedir($handle); + + $i = 0; + + foreach ($files as $img) + { + if (!is_dir($dir . '/' . $img)) + { + $images[$i] = $img; + $i++; + } + } + + } + + return $images; + } + + public static function create_folder($path) + { + // $path is: JPATH_SITE . '/images/folder_name'; + + $result = Folder::create($path); + + return $result; + } + + // Get image properties + public static function get_image_properties($path) + { + $data = Image::getImageFileProperties($path); + + return $data; + } + + public static function set_message($message) + { + Factory::getApplication()->enqueueMessage($message); + } +} \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/src/TfModal.php b/deployed/tflearn/libraries/techfry/src/TfModal.php new file mode 100644 index 00000000..9f0c5fc3 --- /dev/null +++ b/deployed/tflearn/libraries/techfry/src/TfModal.php @@ -0,0 +1,59 @@ + Text::_('COM_TF_SELECT'), + 'url' => $url, + 'height' => '400px', + 'width' => '800px', + 'bodyHeight' => '70', + 'modalWidth' => '80', + 'footer' => '', + ) + ); + + return $html; + } + + public static function select_button($value, $id, $modal_id) + { + $html = ''; + + return $html; + } + + public static function clear_button($value, $id) + { + $html = ''; + + return $html; + } +} \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/src/TfNotify.php b/deployed/tflearn/libraries/techfry/src/TfNotify.php new file mode 100644 index 00000000..bb7ce36d --- /dev/null +++ b/deployed/tflearn/libraries/techfry/src/TfNotify.php @@ -0,0 +1,70 @@ +addRecipient($options['to_address']); + } + else + { + $config = Factory::getConfig(); + $to_name = $config->get('fromname'); + $to_address = $config->get('mailfrom'); + $mailer->addRecipient($to_address); + } + + // Subject + $mailer->setSubject($subject); + + // Reply to email + if (isset($options['reply_to'])) + { + $mailer->addReplyTo($options['reply_to']); + } + + // Body + $email_body = ''; + if (is_array($body)) + { + foreach ($body as $k => $v) + { + $email_body .= '

    ' . $k . ': ' . $v . '

    '; + } + } + else + { + $email_body = $body; + } + + $mailer->setBody($email_body); + + $mailer->isHtml(true); + $mailer->Encoding = 'base64'; + + $mailer->send(); + } +} \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/src/TfNumeric.php b/deployed/tflearn/libraries/techfry/src/TfNumeric.php new file mode 100644 index 00000000..0b2f720e --- /dev/null +++ b/deployed/tflearn/libraries/techfry/src/TfNumeric.php @@ -0,0 +1,138 @@ + $str) + { + $data[$k] = $function($str); + } + } + else + { + $data = $function($data); + } + + return $data; + } + + public static function two($function, $data, $param) + { + if (is_array($data)) + { + foreach ($data as $k => $str) + { + $data[$k] = $function($str, $param); + } + } + else + { + $data = $function($data, $param); + } + + return $data; + } + + public static function arithmetic($function, $data) + { + switch ($function) + { + case 'add' : + case 'sum' : + $result = $data[0] + $data[1]; + break; + + case 'multiply' : + $result = $data[0] * $data[1]; + break; + + case 'subtract' : + $result = $data[0] - $data[1]; + break; + + case 'divide' : + $result = $data[0] / $data[1]; + break; + + case 'mod' : + $result = $data[0] % $data[1]; + break; + + case 'exp' : + $result = $data[0] ** $data[1]; + break; + } + + return $result; + } +} \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/src/TfResource.php b/deployed/tflearn/libraries/techfry/src/TfResource.php new file mode 100644 index 00000000..b27c0457 --- /dev/null +++ b/deployed/tflearn/libraries/techfry/src/TfResource.php @@ -0,0 +1,59 @@ +addStyleSheet($resource_url); + } + elseif ($type == 'js') + { + $document->addScript($resource_url); + } + } +} \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/src/TfSd.php b/deployed/tflearn/libraries/techfry/src/TfSd.php new file mode 100644 index 00000000..f547a7f8 --- /dev/null +++ b/deployed/tflearn/libraries/techfry/src/TfSd.php @@ -0,0 +1,138 @@ + "https://schema.org" + ); + + if ($type != '') + { + $json['@type'] = $type; + } + + return $json; + } + + // Add property and value to array + public static function set_property($array, $name, $value) + { + if ($value != '') + { + $array[$name] = $value; + } + + return $array; + } + + // Add property and value (search from $mapping array) to array + public static function set_prop($array, $name, $mapping = array()) + { + $property_name = strtolower($name); + + if (isset($mapping[$property_name]) && $mapping[$property_name] != '') + { + $array[$name] = $mapping[$property_name]; + } + + return $array; + } + + // Add multiple properties and values (search from $mapping array) to array + public static function set_props($array, $names = array(), $mapping = array()) + { + foreach ($names as $name) + { + $array = self::set_prop($array, $name, $mapping); + } + + return $array; + } + + public static function set_property_image($array, $image) + { + if (empty($image)) + { + return $array; + } + + $uri = Uri::getInstance(); + + $array['image'] = array( + '@type' => 'ImageObject', + 'url' => $uri->base() . $image + ); + + return $array; + } + + public static function set_property_author($array, $type, $name, $url) + { + $array['author'] = array( + '@type' => $type, + 'name' => $name, + 'url' => $url + ); + + return $array; + } + + public static function set_property_publisher($array, $name, $logo) + { + $uri = Uri::getInstance(); + + $array['publisher'] = array( + '@type' => 'Organization', + 'name' => $name, + 'url' => $uri->base(), + 'logo' => array( + '@type' => 'ImageObject', + 'url' => $uri->base() . $logo + ) + ); + + return $array; + } + + public static function set_properties($array, $names, $values) + { + foreach ($names as $k => $v) + { + $array[$v] = $values[$k]; + } + + return $array; + } + + // Display structured data + public static function display_sd($json) + { + /* + $jsonld = ''; + echo $jsonld; + */ + $app = Factory::getApplication(); + + $wa = $app->getDocument()->getWebAssetManager(); + + $wa->addInline('script', json_encode($json, JSON_UNESCAPED_UNICODE), array(), ['type' => 'application/ld+json']); + } +} \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/src/TfString.php b/deployed/tflearn/libraries/techfry/src/TfString.php new file mode 100644 index 00000000..0c75ce43 --- /dev/null +++ b/deployed/tflearn/libraries/techfry/src/TfString.php @@ -0,0 +1,128 @@ + $str) + { + $data[$k] = $function($str); + } + } + else + { + $data = $function($data); + } + + return $data; + } + + public static function two($function, $data, $param) + { + if (is_array($data)) + { + foreach ($data as $k => $str) + { + $data[$k] = $function($str, $param); + } + } + else + { + $data = $function($data, $param); + } + + return $data; + } + + public static function three($function, $data, $param1, $param2) + { + if (is_array($data)) + { + foreach ($data as $k => $str) + { + $data[$k] = $function($str, $param1, $param2); + } + } + else + { + $data = $function($data, $param1, $param2); + } + + return $data; + } +} \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/src/TfUser.php b/deployed/tflearn/libraries/techfry/src/TfUser.php new file mode 100644 index 00000000..a59eec97 --- /dev/null +++ b/deployed/tflearn/libraries/techfry/src/TfUser.php @@ -0,0 +1,473 @@ +getQuery(true); + + $query->select($db->quoteName('id')) + ->from($db->quoteName('#__users')) + ->where('LOWER(' . $db->quoteName('email') . ') = LOWER(' . $db->quote($email) . ')'); + + $db->setQuery($query); + + $user_id = $db->loadResult(); + + return $user_id ? $user_id : false; + } + + // 02. Create new joomla user + public static function create_user($data) + { + $params = ComponentHelper::getParams('com_users'); + + $user = new User(); + + $userdata = array(); + + $data['email'] = strtolower($data['email']); + + // Set username + if (!isset($data['username']) || empty($data['username'])) + { + $data['username'] = $data['email']; + } + + // Set name + if (!isset($data['name']) || empty($data['name'])) + { + $data['name'] = strstr($data['email'], '@', true); + } + + // Set password for new users + if (!isset($data['password']) || empty($data['password'])) + { + $userdata['password'] = UserHelper::genRandomPassword(); + } + + // Set require password reset + if (isset($data['requireReset'])) + { + $userdata['requireReset'] = $data['requireReset']; + } + else + { + $userdata['requireReset'] = 0; + } + + $userdata['username'] = $data['username']; + $userdata['name'] = $data['name']; + $userdata['email'] = $data['email']; + + // User activation + $useractivation = $params->get('useractivation'); + if (($useractivation == 1) || ($useractivation == 2)) + { + $userdata['activation'] = ApplicationHelper::getHash(UserHelper::genRandomPassword()); + $userdata['block'] = 1; + } + else + { + $userdata['block'] = 0; + } + + // Set user groups + if (!isset($data['groups']) || empty($data['groups'])) + { + $user_group = $params->get('new_usertype', 2); + $data['groups'] = array($user_group); + } + $userdata['groups'] = $data['groups']; + + // Set custom fields + if (isset($data['com_fields']) && !empty($data['com_fields'])) + { + $userdata['com_fields'] = $data['com_fields']; + } + + // Bind the data + if (!$user->bind($userdata)) + { + Factory::getApplication()->enqueueMessage($user->getError()); + + return false; + } + + // Store the data + if (!$user->save()) + { + Factory::getApplication()->enqueueMessage($user->getError()); + + return false; + } + + return $user; + } + + // 03. Updates existing joomla user + public static function update_user($data, $updates = array(), $block = 0) + { + $user = Factory::getUser($data['id']); + + $userdata = array(); + + foreach ($updates as $update) + { + if (!empty($data[$update])) + { + $userdata[$update] = $data[$update]; + } + } + + if (!in_array('block', $updates)) + { + $userdata['block'] = $block; + } + + // Set custom fields + if (isset($data['com_fields']) && !empty($data['com_fields'])) + { + $userdata['com_fields'] = $data['com_fields']; + } + + // Bind the data + if (!$user->bind($userdata)) + { + Factory::getApplication()->enqueueMessage($user->getError()); + + return false; + } + + // Store the data + if (!$user->save()) + { + Factory::getApplication()->enqueueMessage($user->getError()); + + return false; + } + + return $user; + } + + // 04. Save user custom field + public static function save_custom_field($field_id, $user_id, $value) + { + $fieldModel = Factory::getApplication()->bootComponent('com_fields')->getMVCFactory()->createModel('Field', 'Administrator', ['ignore_request' => true]); + + $result = $fieldModel->setFieldValue($field_id, $user_id, $value); + + return $result; + } + + // 05. Get user custom field + public static function get_custom_field($field_id, $user_id) + { + $fieldModel = Factory::getApplication()->bootComponent('com_fields')->getMVCFactory()->createModel('Field', 'Administrator', ['ignore_request' => true]); + + $value = $fieldModel->getFieldValue($field_id, $user_id); + + return $value; + } + + // 06. Filter users + public static function filter_users($filters, $userfilters, $email = null) + { + $db = Factory::getDbo(); + $query = $db->getQuery(true); + + $query + ->select($db->quoteName(array('a.id'))) + ->from($db->quoteName('#__users', 'a')) + ->where($db->quoteName('a.block') . ' = ' . $db->quote(0)) + ->order('a.id ASC'); + + // Joomla Users Table + if (is_array(json_decode($filters, true)) && (json_last_error() == JSON_ERROR_NONE)) + { + $filters = json_decode($filters); + } + $filters_arr = (array) $filters; + + if (!empty($filters_arr)) + { + foreach ($filters_arr as $filter_obj) + { + $filter = (array) $filter_obj; + + // Case 1: Filter value is given + if (($filter['where_field'] != '') && ($filter['where_value'] != '')) + { + if ($filter['isDate']) + { + $date = Factory::getDate('now -' . $filter['where_value'] . ' day'); + $filter['where_value'] = $date->toSQL(); + } + + $query->andWhere($db->quoteName('a.' . $filter['where_field']) . ' ' . $filter['where_operator'] . ' ' . $db->quote($filter['where_value'])); + } + // Case 2: Filter value is not given (Example: IS NULL) + elseif (!empty($filter['where_field']) && empty($filter['where_value'])) + { + $query->andWhere($db->quoteName('a.' . $filter['where_field']) . ' ' . $filter['where_operator']); + } + } + } + + // Users Custom Fields + if (is_array(json_decode($userfilters, true)) && (json_last_error() == JSON_ERROR_NONE)) + { + $userfilters = json_decode($userfilters); + } + $userfilters_arr = (array) $userfilters; + + if (!empty($userfilters_arr)) + { + foreach ($userfilters_arr as $filter_obj) + { + $filter = (array) $filter_obj; + + // Case 1: Filter is for Joomla User Group + if ($filter['where_field'] == 'group_id') + { + $query->join('INNER', $db->quoteName('#__user_usergroup_map', 'd') . ' ON (' . $db->quoteName('a.id') . ' = ' . $db->quoteName('d.user_id') . ')') + ->andWhere($db->quoteName('d.group_id') . ' ' . $filter['where_operator'] . ' ' . $db->quote($filter['where_value'])); + } + // Case 2: When filter is for Joomla Users Custom Fields + elseif (is_numeric($filter['where_field'])) + { + $query->join('INNER', $db->quoteName('#__fields_values', 'c') . ' ON (' . $db->quoteName('a.id') . ' = ' . $db->quoteName('c.item_id') . ')') + ->andWhere($db->quoteName('c.field_id') . ' = ' . $db->quote($filter['where_field'])) + ->andWhere($db->quoteName('c.value') . ' ' . $filter['where_operator'] . ' ' . $db->quote($filter['where_value'])); + } + } + } + + if ($email != null) + { + $query->andWhere($db->quoteName('a.email') . ' = ' . $db->quote($email)); + $query->setLimit('1'); + } + + $db->setQuery($query); + + $users = $db->loadColumn(); + + return $users; + } + + // 07. + public static function check_otp($user_id, $otpkey) + { + $db = Factory::getDbo(); + $query = $db->getQuery(true); + + $query + ->select($db->quoteName('registerDate')) + ->from($db->quoteName('#__users')) + ->where($db->quoteName('id') . ' = ' . $db->quote($user_id)) + ->setLimit('1'); + + $db->setQuery($query); + + $register_date = $db->loadResult(); + + $date = Factory::getDate($register_date); + $user_otpkey = $date->toUnix(); + + return ($user_otpkey == $otpkey) ? Factory::getUser($user_id) : false; + } + + // 08. Get User Groups + public static function get_user_groups($user_id) + { + $ugs = UserHelper::getUserGroups($user_id); + + $arr = array(); + + foreach ($ugs as $ug) + { + $db = Factory::getDbo(); + $query = $db->getQuery(true); + + $query->select($db->quoteName('title')) + ->from($db->quoteName('#__usergroups')) + ->where($db->quoteName('id') . ' = ' . $db->quote($ug)); + + $db->setQuery($query); + + $group = $db->loadResult(); + + $arr[] = $group; + } + + return $arr; + } + + // 09. Delete user + public static function delete_user($user_id) + { + $user = Factory::getUser($user_id); + + $user->delete(); + } + + // 10. Add user to group + public static function add_user_to_group($user_id, $group_id) + { + return UserHelper::addUserToGroup($user_id, $group_id); + } + + // 11. Remove user from group + public static function remove_user_from_group($user_id, $group_id) + { + return UserHelper::removeUserFromGroup($user_id, $group_id); + } + + // 12. Get fields + public static function get_fields($grouped = false) + { + $fields = FieldsHelper::getFields('com_users.user'); + + if ($grouped) + { + // Organizing fields according to their group + $fieldsPerGroup = array(0 => array()); + + foreach ($fields as $field) + { + if (!array_key_exists($field->group_id, $fieldsPerGroup)) + { + $fieldsPerGroup[$field->group_id] = array(); + } + + $fieldsPerGroup[$field->group_id][] = $field; + } + + return $fieldsPerGroup; + } + else + { + return $fields; + } + } + + // 13. Block user + public static function block_user_email($email) + { + $user_id = self::find_user($email); + + if (!$user_id) + { + return false; + } + + $user = Factory::getUser($user_id); + if ($user->block) + { + return false; + } + + $userdata = array(); + + $userdata['id'] = $user_id; + $userdata['block'] = 1; + $userdata['requireReset'] = 0; + + $user = self::update_user($userdata, array('block', 'requireReset')); + + return $user; + } + + // 14. Login user + public static function login_user($user_id) + { + $app = Factory::getApplication(); + + $user = Factory::getUser($user_id); + + if (!empty($user->activation)) + { + return false; + } + + if ($user->block) + { + return false; + } + + $status_success = Authentication::STATUS_SUCCESS; + + $response = new AuthenticationResponse(); + + $response->status = $status_success; + $response->error_message = ''; + $response->email = $user->email; + $response->type = 'tf-login'; + + /* + // Run the user plugins + $options = array( + 'remember' => true, + 'action' => 'core.login.site', + ); + PluginHelper::importPlugin('user'); + $results = Joomla::runPlugins('onUserLogin', [(array) $response, $options], $app); + + if (in_array(false, $results, true) == false) + { + // Set the user in the session, letting Joomla! know that we are logged in. + Factory::getApplication()->getSession()->set('user', $user); + + // Trigger the onUserAfterLogin event + $options['user'] = $user; + $options['responseType'] = $response->type; + + // The user is successfully logged in. Run the after login events + Joomla::runPlugins('onUserAfterLogin', [$options], $app); + + return; + } + */ + + Factory::getApplication()->getSession()->set('user', $user); + } + + // 15. Get total users in a group + public static function total_users_by_group($group_id) + { + $db = Factory::getDbo(); + $query = $db->getQuery(true); + + $query->select('COUNT(DISTINCT map.user_id)') + ->from($db->quoteName('#__user_usergroup_map', 'map')) + ->join('LEFT', $db->quoteName('#__users', 'u') . ' ON ' . $db->quoteName('u.id') . ' = ' . $db->quoteName('map.user_id')) + ->where($db->quoteName('map.group_id') . ' = ' . $db->quote($group_id)) + ->where($db->quoteName('u.block') . ' = 0'); + + $db->setQuery($query); + + $total = $db->loadResult(); + + return $total; + } +} \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/src/TfXml.php b/deployed/tflearn/libraries/techfry/src/TfXml.php new file mode 100644 index 00000000..b1f2fdb1 --- /dev/null +++ b/deployed/tflearn/libraries/techfry/src/TfXml.php @@ -0,0 +1,412 @@ +name . '"'; + $output .= ' type="' . $field->type . '"'; + $output .= ' label="' . $field->label . '"'; + $output .= ' description="' . $field->description . '"'; + + $output .= (isset($field->default_value)) ? ' default="' . $field->default_value . '"' : ''; + + $output .= (isset($field->hint)) ? ' hint="' . $field->hint . '"' : ''; + + $output .= (isset($field->required)) ? ' required="' . $field->required . '"' : ''; + + $output .= (isset($field->readonly)) ? ' readonly="' . $field->readonly . '"' : ''; + + return $output; + } + + // Set options for list, radio, checkboxes + public static function set_field_options($options) + { + $output = ''; + + if (is_string($options)) + { + $options_obj = explode(',', $options); + foreach ($options_obj as $opt) + { + $output .= ''; + } + } + else + { + foreach ($options as $opt) + { + if (is_array($opt)) + { + $opt = (object) $opt; + } + $output .= ''; + } + } + + return $output; + } + + // A-01. Text Field + public static function field_text($field) + { + // maxlength + + $output = self::start_field($field); + + $output .= ' maxlength="' . $field->maxlength . '"'; + + $output .= '>
    '; + + return $output; + } + + // A-02. Email Field + public static function field_email($field) + { + $output = self::start_field($field); + + $output .= '>
    '; + + return $output; + } + + // A-03. Url Field + public static function field_url($field) + { + // maxlength, relative + + $output = self::start_field($field); + + $output .= (isset($field->relative)) ? ' relative="' . $field->relative . '"' : ''; + $output .= (isset($field->maxlength)) ? ' maxlength="' . $field->maxlength . '"' : ''; + + $output .= '>
    '; + + return $output; + } + + // A-04. List Field (Also used for checkboxes) + public static function field_list($field) + { + // multiple, layout + + $output = self::start_field($field); + + $output .= (isset($field->form_layout)) ? ' layout="' . $field->form_layout . '"' : ''; + $output .= (isset($field->multiple)) ? ' multiple="' . $field->multiple . '"' : ''; + + $output .= '>'; + + // Options + $output .= self::set_field_options($field->options); + + $output .= '
    '; + + return $output; + } + + // A-05. Radio Field + public static function field_radio($field) + { + // layout + + $output = self::start_field($field); + + $output .= (isset($field->form_layout)) ? ' layout="' . $field->form_layout . '"' : ''; + + $output .= '>'; + + // Options + $output .= self::set_field_options($field->options); + + $output .= '
    '; + + return $output; + } + + // A-06. Integer Field + public static function field_integer($field) + { + // first, last, step + + $output = self::start_field($field); + + $output .= ' first="' . $field->first . '"'; + $output .= ' last="' . $field->last . '"'; + $output .= ' step="' . $field->step . '"'; + + $output .= '>
    '; + + return $output; + } + + // A-07. Number Field (Also used for Range) + public static function field_number($field) + { + // min, max, step + + if ($field->options != '') + { + $arr = str_getcsv($field->options); + foreach ($arr as $v) + { + $a = explode(':', $v); + $var = $a[0]; + $field->$var = $a[1]; + } + } + + $output = self::start_field($field); + + $output .= ' min="' . $field->min . '"'; + $output .= ' max="' . $field->max . '"'; + $output .= ' step="' . $field->step . '"'; + + $output .= '>
    '; + + return $output; + } + + // A-08. Textarea Field + public static function field_textarea($field) + { + // rows, cols + + $output = self::start_field($field); + + $output .= ' rows="' . $field->rows . '"'; + $output .= ' cols="' . $field->cols . '"'; + + $output .= '>
    '; + + return $output; + } + + // A-09. Calendar Field + public static function field_calendar($field) + { + // showtime, singleheader, todaybutton, weeknumbers, filltable, translateformat, format, minyear, maxyear + + $output = self::start_field($field); + + $output .= (isset($field->showtime)) ? ' showtime="' . $field->showtime . '"' : ''; + $output .= (isset($field->singleheader)) ? ' singleheader="' . $field->singleheader . '"' : ''; + $output .= (isset($field->todaybutton)) ? ' todaybutton="' . $field->todaybutton . '"' : ''; + $output .= (isset($field->weeknumbers)) ? ' weeknumbers="' . $field->weeknumbers . '"' : ''; + $output .= (isset($field->filltable)) ? ' filltable="' . $field->filltable . '"' : ''; + $output .= (isset($field->translateformat)) ? ' translateformat="' . $field->translateformat . '"' : ''; + $output .= (isset($field->format)) ? ' format="' . $field->format . '"' : ''; + $output .= (isset($field->minyear)) ? ' minyear="' . $field->minyear . '"' : ''; + $output .= (isset($field->maxyear)) ? ' maxyear="' . $field->maxyear . '"' : ''; + + $output .= '>
    '; + + return $output; + } + + // A-10. Password Field + public static function field_password($field) + { + $output = self::start_field($field); + + $output .= '>
    '; + + return $output; + } + + // A-10. File Field + public static function field_file($field) + { + // multiple + + $output = self::start_field($field); + + $output .= (isset($field->multiple)) ? ' multiple="' . $field->multiple . '"' : ''; + + $output .= '>
    '; + + return $output; + } + + // A-11. Note Field + public static function field_note($field) + { + // class, close + + $output = self::start_field($field); + + $output .= (isset($field->class_value)) ? ' class="' . $field->class_value . '"' : ''; + $output .= (isset($field->close) && $field->close == 'true') ? ' close="' . $field->close . '"' : ''; + + $output .= '>
    '; + + return $output; + } + + // A-12. Filelist Field + public static function field_filelist($field) + { + // directory, fileFilter, exclude, stripext + + $output = self::start_field($field); + + $output .= (isset($field->directory)) ? ' directory="' . $field->directory . '"' : ''; + $output .= (isset($field->fileFilter)) ? ' fileFilter="' . $field->fileFilter . '"' : ''; + $output .= (isset($field->exclude)) ? ' exclude="' . $field->exclude . '"' : ''; + $output .= (isset($field->stripext)) ? ' stripext="' . $field->stripext . '"' : ''; + + $output .= '>
    '; + + return $output; + } + + // A-13. Folderlist Field + public static function field_folderlist($field) + { + // directory, folderFilter, exclude, recursive + + $output = self::start_field($field); + + $output .= (isset($field->directory)) ? ' directory="' . $field->directory . '"' : ''; + $output .= (isset($field->folderFilter)) ? ' folderFilter="' . $field->folderFilter . '"' : ''; + $output .= (isset($field->exclude)) ? ' exclude="' . $field->exclude . '"' : ''; + $output .= (isset($field->recursive)) ? ' recursive="' . $field->recursive . '"' : ''; + + $output .= '>
    '; + + return $output; + } + + // A-14. Imagelist Field + public static function field_imagelist($field) + { + // directory, filter, exclude, stripext + + $output = self::start_field($field); + + $output .= (isset($field->directory)) ? ' directory="' . $field->directory . '"' : ''; + $output .= (isset($field->filter)) ? ' filter="' . $field->filter . '"' : ''; + $output .= (isset($field->exclude)) ? ' exclude="' . $field->exclude . '"' : ''; + $output .= (isset($field->stripext)) ? ' stripext="' . $field->stripext . '"' : ''; + + $output .= '>
    '; + + return $output; + } + + // A-15. Color Field + public static function field_color($field) + { + // format + + $output = self::start_field($field); + + $output .= (isset($field->format)) ? ' class="' . $field->format . '"' : ''; + + $output .= '>'; + + return $output; + } + + // A-16. Subform Field + public static function field_subform($field) + { + // multiple, layout + + $output = self::start_field($field); + + $output .= (isset($field->form_layout)) ? ' layout="' . $field->form_layout . '"' : ''; + $output .= (isset($field->multiple)) ? ' multiple="' . $field->multiple . '"' : ''; + + $output .= '>'; + + // Subform fields - field_name, field_type + $output .= ''; + foreach ($field->subform_fields as $subform_field) + { + $output .= ''; + } + $output .= ''; + + $output .= ''; + + return $output; + } + + // B-01. Limit field + public static function filter_limit_field() + { + $element = ''; + + return $element; + } + + // B-02. Ordering field + public static function filter_ordering_field($orderCol) + { + $element = ''; + + $element .= ''; + + $element .= ''; + + return $element; + } + + // B-03. Published field + public static function filter_published_field() + { + $element = ''; + + $element .= ''; + $element .= ''; + $element .= ''; + + return $element; + } + + // B-04. Access field + public static function filter_access_field() + { + $element = ''; + $output .= $item[0]; + $output .= ''; + + $output .= '
    '; + + $output .= '
    '; + $output .= $item[1]; + $output .= '
    '; + + $output .= '
    '; + + $output .= ''; + + $i++; + } + + // Add javascript + $document = Factory::getDocument(); + + $script = 'function collapse(id) {'; + $script .= 'var x = document.getElementById(id);'; + $script .= 'if (x.className.indexOf("show") == -1) { + x.className += " show"; + } else { + x.className = x.className.replace(" show", ""); + }'; + $script .= '}'; + + $document->addScriptDeclaration($script); + + return $output; + } + + public static function display($items = array(), $properties = array('flush' => 0), $config = array()) + { + echo self::get_output($items, $properties, $config); + } +} \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/src/View/Air/Alert.php b/deployed/tflearn/libraries/techfry/src/View/Air/Alert.php new file mode 100644 index 00000000..e2557a7e --- /dev/null +++ b/deployed/tflearn/libraries/techfry/src/View/Air/Alert.php @@ -0,0 +1,41 @@ + 'bg-info'), $config = array()) + { + // Properties - alert_class + // Config - dismiss + + if ($text == '') + { + return; + } + + $output = ''; + + return $output; + } + + public static function display($text, $properties = array('alert_class' => 'bg-info'), $config = array()) + { + echo self::get_output($text, $properties, $config); + } +} \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/src/View/Air/Badge.php b/deployed/tflearn/libraries/techfry/src/View/Air/Badge.php new file mode 100644 index 00000000..d2f4a6ed --- /dev/null +++ b/deployed/tflearn/libraries/techfry/src/View/Air/Badge.php @@ -0,0 +1,40 @@ + 'bg-primary text-white'), $config = array()) + { + // Properties - badge_class + + if ($text == '') + { + return; + } + + if (!is_array($properties)) + { + $properties = (array) $properties; + } + + $output = ''; + + $output .= $text; + + $output .= ''; + + return $output; + } + + public static function display($text, $properties = array('badge_class' => 'bg-primary text-white'), $config = array()) + { + echo self::get_output($text, $properties, $config); + } +} \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/src/View/Air/Button.php b/deployed/tflearn/libraries/techfry/src/View/Air/Button.php new file mode 100644 index 00000000..ef59d23e --- /dev/null +++ b/deployed/tflearn/libraries/techfry/src/View/Air/Button.php @@ -0,0 +1,39 @@ + 'bg-primary text-white'), $config = array('url' => '#')) + { + // Properties - button_class + // Config - url, target + + if ($text == '') + { + return; + } + + $class = 'btn ' . $properties['button_class']; + + $output = ''; + + return $output; + } + + public static function display($text, $properties = array('button_class' => 'bg-primary text-white'), $config = array('url' => '#')) + { + echo self::get_output($text, $properties, $config); + } +} \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/src/View/Air/Card.php b/deployed/tflearn/libraries/techfry/src/View/Air/Card.php new file mode 100644 index 00000000..9c5f6482 --- /dev/null +++ b/deployed/tflearn/libraries/techfry/src/View/Air/Card.php @@ -0,0 +1,75 @@ + 1, 'show_date' => 1)) + { + // Item - image, title, description, url, when + // Properties - button_class, button_text, card_class + // Config - show_title, show_date, date_format + + $card_class = isset($properties['card_class']) && $properties['card_class'] ? 'card ' . $properties['card_class'] : 'card'; + + $output = '
    '; + + if (!empty($item->image)) + { + $img = HTMLHelper::cleanImageURL($item->image); + $image_size = filesize(JPATH_ROOT . '/' . $img->url); + + if ($image_size > 0) + { + $output .= ''; + + $output .= TfHtml::image($img->url, $item->title, 'card-img-top', false); + + $output .= ''; + } + } + + $output .= '
    '; + + if (isset($config['show_title']) && $config['show_title']) + { + $output .= '

    '; + $output .= '' . $item->title . ''; + $output .= '

    '; + } + + if (isset($config['show_date']) && $config['show_date']) + { + $output .= TfHtml::display_date($item->when, $config['date_format'], false); + } + + if (isset($item->description)) + { + $output .= '

    ' . $item->description . '

    '; + } + + if (isset($properties['button_text']) && !empty($properties['button_text'])) + { + $output .= Button::get_output($properties['button_text'], array('button_class' => $properties['button_class']), array('url' => $item->url)); + } + + $output .= '
    '; + + return $output; + } + + public static function display($item, $properties = array(), $config = array('show_title' => 1, 'show_date' => 1)) + { + echo self::get_output($item, $properties, $config); + } +} \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/src/View/Air/Carousel.php b/deployed/tflearn/libraries/techfry/src/View/Air/Carousel.php new file mode 100644 index 00000000..6ef801a3 --- /dev/null +++ b/deployed/tflearn/libraries/techfry/src/View/Air/Carousel.php @@ -0,0 +1,81 @@ +'; + + // Items + foreach ($items as $i => $item) + { + $item = (array) $item; + + $output .= ''; + } + + // Controls + if ($config['controls']) + { + $output .= ''; + + $output .= ''; + } + + $output .= ''; + + // Add javascript + $document = Factory::getDocument(); + + $script = 'var slideIndex = 1; + showDivs(slideIndex); + + function plusDivs(n) { + showDivs(slideIndex += n); + } + + function showDivs(n) { + var i; + var x = document.getElementsByClassName("carouselitem"); + if (n > x.length) {slideIndex = 1} + if (n < 1) {slideIndex = x.length} ; + for (i = 0; i < x.length; i++) { + x[i].style.display = "none"; + } + x[slideIndex-1].style.display = "block"; + }'; + + // Run script after HTML code + $output .= ''; + + // $document->addScriptDeclaration($script); + + return $output; + } + + public static function display($items, $properties = array(), $config = array()) + { + echo self::get_output($items, $properties, $config); + } +} \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/src/View/Air/Gallery.php b/deployed/tflearn/libraries/techfry/src/View/Air/Gallery.php new file mode 100644 index 00000000..5b63cf18 --- /dev/null +++ b/deployed/tflearn/libraries/techfry/src/View/Air/Gallery.php @@ -0,0 +1,63 @@ + 3)) + { + // Properties - + // Config - columns, folder + + if (empty($images)) + { + return; + } + + $columns = $config['columns']; + + $output = ''; + + // Display images as grid + $output .= '
    '; + + foreach ($images as $k => $image) + { + $path_info = pathinfo($image); + + $modal_id = 'Modal' . $k; + + $output .= '
    '; + $output .= TfHtml::image($config['folder'] . '/' . $image, $path_info['filename'], 'img-fluid img-thumbnail mb-3', false); + $output .= '
    '; + } + + $output .= '
    '; + + // Display images when in modal + foreach ($images as $k => $image) + { + $path_info = pathinfo($image); + + $modal_body = TfHtml::image($config['folder'] . '/' . $image, $path_info['filename'], 'img-fluid', false); + + $output .= Modal::get_output(array('title' => $path_info['filename'], 'body' => $modal_body), array(), array('modal_id' => 'Modal' . $k)); + } + + return $output; + } + + public static function display($images, $properties = array(), $config = array('columns' => 3)) + { + echo self::get_output($images, $properties, $config); + } +} \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/src/View/Air/Icon.php b/deployed/tflearn/libraries/techfry/src/View/Air/Icon.php new file mode 100644 index 00000000..0fb8fbd6 --- /dev/null +++ b/deployed/tflearn/libraries/techfry/src/View/Air/Icon.php @@ -0,0 +1,40 @@ +'; + + return $output; + } + + public static function display($icon, $properties = array(), $config = array()) + { + echo self::get_output($icon, $properties, $config); + } +} \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/src/View/Air/Iconbox.php b/deployed/tflearn/libraries/techfry/src/View/Air/Iconbox.php new file mode 100644 index 00000000..72b4b45f --- /dev/null +++ b/deployed/tflearn/libraries/techfry/src/View/Air/Iconbox.php @@ -0,0 +1,45 @@ +icon, array('icon_class' => $properties['icon_class'])); + + if (!empty($item->title)) + { + $output .= TfHtml::heading($item->title, 'h3', $properties['title_class'], false); + } + + if (!empty($item->description)) + { + $output .= TfHtml::text($item->description, 'p', $properties['desc_class'], false); + } + + if (!empty($item->url)) + { + $output .= Button::get_output($properties['button_text'], array('button_class' => $properties['button_class']), array('url' => $item->url)); + } + + return $output; + } + + public static function display($item, $properties = array(), $config = array()) + { + echo self::get_output($item, $properties, $config); + } +} \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/src/View/Air/Iconlist.php b/deployed/tflearn/libraries/techfry/src/View/Air/Iconlist.php new file mode 100644 index 00000000..6c7b5fa0 --- /dev/null +++ b/deployed/tflearn/libraries/techfry/src/View/Air/Iconlist.php @@ -0,0 +1,57 @@ +icon, $properties['icon']) . ' ' . TfHtml::text($item->title, 'span', $properties['title_class'], false); + if (!empty($item->url)) + { + $list_item = '' . $list_item . ''; + } + + $list_items[] = $list_item; + } + + if (trim($properties['list_class']) == 'list-inline') + { + $properties['list_item_class'] = 'list-inline-item'; + } + + $output = TfHtml::display_list($list_items, 'ul', $properties['list_class'], $properties['list_item_class'], false); + + return $output; + } + + public static function display($items, $properties = array(), $config = array()) + { + echo self::get_output($items, $properties, $config); + } +} \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/src/View/Air/Imagebox.php b/deployed/tflearn/libraries/techfry/src/View/Air/Imagebox.php new file mode 100644 index 00000000..e3352daf --- /dev/null +++ b/deployed/tflearn/libraries/techfry/src/View/Air/Imagebox.php @@ -0,0 +1,49 @@ +image, $item->title, $properties['image_class'], false); + + if (!empty($item->title)) + { + $output .= TfHtml::heading($item->title, 'h3', $properties['title_class'], false); + } + + if (!empty($item->subtitle)) + { + $output .= TfHtml::text($item->subtitle, 'p', $properties['subtitle_class'], false); + } + + if (!empty($item->description)) + { + $output .= TfHtml::text($item->description, 'p', $properties['desc_class'], false); + } + + if (!empty($item->url)) + { + $output .= Button::get_output($properties['button_text'], array('button_class' => $properties['button_class']), array('url' => $item->url)); + } + + return $output; + } + + public static function display($item, $properties = array(), $config = array()) + { + echo self::get_output($item, $properties, $config); + } +} \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/src/View/Air/Modal.php b/deployed/tflearn/libraries/techfry/src/View/Air/Modal.php new file mode 100644 index 00000000..340b3f0f --- /dev/null +++ b/deployed/tflearn/libraries/techfry/src/View/Air/Modal.php @@ -0,0 +1,58 @@ +'; + $output .= ''; + $output .= ''; + + return $output; + } + + public static function display($item, $properties = array(), $config = array()) + { + echo self::get_output($item, $properties, $config); + } +} \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/src/View/Air/Offcanvas.php b/deployed/tflearn/libraries/techfry/src/View/Air/Offcanvas.php new file mode 100644 index 00000000..9914879e --- /dev/null +++ b/deployed/tflearn/libraries/techfry/src/View/Air/Offcanvas.php @@ -0,0 +1,70 @@ +'; + $output .= '
    '; + + $output .= '
    '; + + $output .= '
    '; + $output .= $item['body']; + $output .= '
    '; + + $output .= '
    '; + + // Trigger + $output .= '
    '; + /* + $script = 'function open_canvas() { + document.getElementById("' . $offcanvas_id . '").style.display = "block"; + } + function close_canvas() { + document.getElementById("' . $offcanvas_id . '").style.display = "none"; + }'; + */ + + $script = 'function open_canvas() { + document.getElementById("' . $offcanvas_id . '").style.width = "250px"; + } + function close_canvas() { + document.getElementById("' . $offcanvas_id . '").style.width = "0"; + }'; + + + $output .= ''; + + return $output; + } + + public static function display($item, $properties = array(), $config = array()) + { + echo self::get_output($item, $properties, $config); + } +} \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/src/View/Air/Plain.php b/deployed/tflearn/libraries/techfry/src/View/Air/Plain.php new file mode 100644 index 00000000..c2477967 --- /dev/null +++ b/deployed/tflearn/libraries/techfry/src/View/Air/Plain.php @@ -0,0 +1,34 @@ +'; + $output .= '

    ' . $item[0] . '

    '; + $output .= $item[1]; + } + + return $output; + } + + public static function display($items, $properties = array(), $config = array()) + { + echo self::get_output($items, $properties, $config); + } +} \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/src/View/Air/Progress.php b/deployed/tflearn/libraries/techfry/src/View/Air/Progress.php new file mode 100644 index 00000000..36ad3e87 --- /dev/null +++ b/deployed/tflearn/libraries/techfry/src/View/Air/Progress.php @@ -0,0 +1,41 @@ + 'bg-primary text-white'), $config = array()) + { + // Properties - type, striped, animated + + if (!is_array($properties)) + { + $properties = (array) $properties; + } + + $class = ' ' . $properties['progress_class']; + + $output = '
    '; + + $output .= '
    '; + + $output .= $progress . '%'; + + $output .= '
    '; + + $output .= '
    '; + + return $output; + } + + public static function display($progress, $properties = array('progress_class' => 'bg-primary text-white'), $config = array()) + { + echo self::get_output($progress, $properties, $config); + } +} \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/src/View/Air/Search.php b/deployed/tflearn/libraries/techfry/src/View/Air/Search.php new file mode 100644 index 00000000..88b0b935 --- /dev/null +++ b/deployed/tflearn/libraries/techfry/src/View/Air/Search.php @@ -0,0 +1,58 @@ +input; + + $output = ''; + } + + return $output; + } + + public static function display($searches = array('title'), $properties = array(), $config = array()) + { + echo self::get_output($searches, $properties, $config); + } +} \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/src/View/Air/Tabs.php b/deployed/tflearn/libraries/techfry/src/View/Air/Tabs.php new file mode 100644 index 00000000..10a6d54e --- /dev/null +++ b/deployed/tflearn/libraries/techfry/src/View/Air/Tabs.php @@ -0,0 +1,89 @@ +'; + $i = 1; + + // Buttons + foreach ($items as $tab) + { + $tab = (array) $tab; + $tab = array_values($tab); + + $active = ($i == 1) ? ' active' : ''; + + $tab_id = 'Tab' . $i; + + $output .= ''; + + $i++; + } + $output .= ''; + + // Tab content + $output .= '
    '; + $i = 1; + foreach ($items as $tab) + { + $tab = (array) $tab; + $tab = array_values($tab); + + // $active = ($i == 1) ? ' show active' : ''; + + $tab_id = 'Tab' . $i; + + $display = ($i == 1) ? 'block' : 'none'; + + $output .= '
    '; + $output .= $tab[1]; + $output .= '
    '; + + $i++; + } + $output .= '
    '; + + // Add javascript + $script = 'function openTab(evt, tabId) { + var i, x, tablinks; + var x = document.getElementsByClassName("tab-pane"); + for (i = 0; i < x.length; i++) { + x[i].style.display = "none"; + } + tablinks = document.getElementsByClassName("tablink"); + for (i = 0; i < x.length; i++) { + tablinks[i].className = tablinks[i].className.replace(" active", ""); + } + document.getElementById(tabId).style.display = "block"; + evt.currentTarget.className += " active"; + }'; + + $output .= ''; + + return $output; + } + + public static function display($items, $properties = array(), $config = array()) + { + echo self::get_output($items, $properties, $config); + } +} \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/src/View/Back/TfView.php b/deployed/tflearn/libraries/techfry/src/View/Back/TfView.php new file mode 100644 index 00000000..3f0d2365 --- /dev/null +++ b/deployed/tflearn/libraries/techfry/src/View/Back/TfView.php @@ -0,0 +1,291 @@ +initiate_view(); + + // Set the toolbar + $this->addToolBar(); + + // Display the template + return parent::display($tpl); + } + + public function initiate_view() + { + $this->input = Factory::getApplication()->input; + + $this->option = $this->input->get('option'); + + $this->com_name = substr($this->option, 6); + + $this->view_name = $this->getName(); + + $this->layout = $this->getLayout(); + + $this->user = Factory::getApplication()->getIdentity(); + } + + protected function addToolBar() + { + ToolbarHelper::title(Text::_(strtoupper($this->option) . '_MANAGER_' . strtoupper($this->view_name)), $this->icon); + + if (in_array('back', $this->toolbar_buttons)) + { + ToolbarHelper::back(); + } + + $this->toolbar = Toolbar::getInstance('toolbar'); + + if (in_array('dashboard', $this->toolbar_buttons)) + { + $this->toolbar->linkButton('Dashboard') + ->text('COM_TF_DASHBOARD') + ->url('index.php?option=' . $this->option . '&view=dashboard') + ->icon('fas fa-th'); + } + + if ($this->user->authorise('core.admin', $this->option) || $this->user->authorise('core.options', $this->option)) + { + ToolbarHelper::preferences($this->option); + } + + if ($this->help_url) + { + $this->toolbar->help('', false, $this->help_url); + } + } + + // Display data in the form of 0 or 1 + public function get_binary($value) + { + $color = $value ? 'Green' : 'Red'; + + $output = ''; + + $output .= ''; + + return $output; + } + + // Display status icon with color + public function get_status($value) + { + switch ($value) + { + case 1 : + $color = 'MediumSeaGreen'; + $icon = 'check'; + break; + + case 0 : + $color = 'Tomato'; + $icon = 'times'; + break; + + case 2 : + $color = 'DodgerBlue'; + $icon = 'archive'; + break; + + case -2 : + $color = 'Gray'; + $icon = 'trash'; + } + + $output = ''; + + $output .= ''; + + return $output; + } + + // Display title with link to edit form + public function get_link($link, $text, $title = 'JGLOBAL_EDIT_ITEM') + { + $output = ''; + + if (!empty($link)) + { + $output .= '' . $text . ''; + } + return $output; + } + + // Display date + public function get_date($date) + { + $output = ''; + + if (!empty($date) && $date != 0) + { + $mydate = Factory::getDate($date); + $output = $mydate->format('d M Y'); + } + + return $output; + } + + // Display number or count + public function get_number($number, $style = 'success') + { + $output = ''; + + $output .= '' . $number . ''; + + return $output; + } + + // Display access level + public function get_access($id) + { + $access_level = TfDb::get_item('viewlevels', $id); + + return '' . $access_level->title . ''; + } + + // Display in small like alias + public function get_small($sm) + { + $output = ''; + + if (!empty($sm)) + { + $output .= '
    '; + $output .= $sm; + $output .= ''; + } + + return $output; + } + + // Display action button + public function get_button($link, $text, $type = 'success') + { + $output = ''; + + $output .= '' . Text::_($text) . ' '; + + return $output; + } + + // Display user email and id + public function get_user($user_id) + { + $output = ''; + + $user = Factory::getUser($user_id); + + $output .= ($user->email) ? $user->email : 'User Not Available'; + + $output .= $this->get_small(Text::_('COM_TF_USER_ID') . ': ' . $user_id); + + return $output; + } + + // Display badge or label + public function get_label($text, $class = 'bg-light text-dark border') + { + $output = ''; + + $output .= ''; + $output .= $text; + $output .= ''; + + return $output; + } + + // Display alert message + public function get_alert($message, $type = 'info') + { + echo '

    ' . $message . '

    '; + } + + public function get_joomla_version($type = 'major') + { + $version = JVERSION; + list ($major, $minor, $patch) = explode('.', $version); + + if (strpos($patch, '-') !== false) + { + $patch = explode('-', $patch)[0]; + } + + switch ($type) + { + case 'minor' : + return (int) $minor; + break; + + case 'patch' : + return (int) $patch; + break; + + case 'major' : + default : + return (int) $major; + } + } + + public function get_no_results_msg() + { + $output = '
    '; + $output .= ' '; + $output .= '' . Text::_('INFO') . ''; + $output .= Text::_('JGLOBAL_NO_MATCHING_RESULTS'); + $output .= '
    '; + + return $output; + } +} \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/src/View/Back/TfViewDashboard.php b/deployed/tflearn/libraries/techfry/src/View/Back/TfViewDashboard.php new file mode 100644 index 00000000..ba5fe5c3 --- /dev/null +++ b/deployed/tflearn/libraries/techfry/src/View/Back/TfViewDashboard.php @@ -0,0 +1,233 @@ +icon = 'fas fa-th'; + + return parent::display($tpl); + } + + // Fucntion to start displaying dashboard layout + public function start_dashboard_layout() + { + echo '
    '; + + $this->add_table_tiles(); + + $this->add_general_tiles(); + + $this->add_message(); + + echo '
    '; + echo '
    '; + echo '
    '; + echo '
    '; + echo ''; + echo '
    '; + echo '
    '; + echo '
    '; + echo '
    '; + } + + // Function to finish dashboard layout + public function end_dashboard_layout() + { + echo '
    '; + } + + // Add tile with table in database + public function add_tile_table($view, $table = null, $icon = 'check-circle') + { + $link = 'index.php?option=' . $this->option . '&view=' . $view; + $str = strtoupper($this->option) . '_' . strtoupper($view); + + $total_rows = null; + if ($table) + { + $total_rows = TfDb::total_rows($table); + } + + $output = $this->j4_tile($link, $icon, $str, $total_rows); + + return $output; + } + + // Add tile - Import, Export, Query + public function add_tile($view, $icon = 'checkin') + { + $model = $this->getModel(); + + $link = 'index.php?option=' . $this->option . '&view=' . $view; + $str = 'COM_TF_' . strtoupper($view); + $class = ''; + if (!$model->pro()) + { + $str .= '_PRO'; + $class = 'danger'; + } + + $output = $this->j4_tile($link, $icon, $str, false, false, $class); + + return $output; + } + + // Add tile with external link + public function add_tile_link($link, $text, $icon = 'checkin') + { + $str = 'COM_TF_' . strtoupper($text); + + $output = $this->j4_tile($link, $icon, $str, false, true); + + return $output; + } + + // Add message + public function add_message() + { + $model = $this->getModel(); + + $current_version = $model->get_current_version(); + $new_version = $model->get_new_version(); + + $is_pro = $model->get_param('is_pro', 0); + $mode = $is_pro ? 'Pro' : 'Lite'; + + // 01. Message for Component version + if ($current_version == $new_version) + { + $this->get_alert('You are using latest version ' . $current_version . ' in ' . $mode . ' mode.', 'success'); + } + else + { + $this->get_alert('New version ' . $new_version . ' is available! Please update the extension.', 'warning'); + } + + // 02. Message for Library version + $current_library = $model->get_current_version('techfry'); + $new_library = $model->get_new_library_version(); + if ($current_library != $new_library) + { + $this->get_alert('New version ' . $new_library . ' of library is available! Please update the extension.', 'warning'); + } + + // 03. Messages from component dashboard model + $this->alerts = $this->get('Alerts'); + if (!empty($this->alerts)) + { + foreach ($this->alerts as $type => $alert) + { + $this->get_alert('' . $alert . '', $type); + } + } + } + + public function j4_tile($link, $icon, $str, $total_rows = false, $target = false, $class = '') + { + $output = '
  • '; + $output .= ''; + $output .= '
  • '; + + return $output; + } + + // Add all general tiles without table + public function add_general_tiles() + { + foreach ($this->tiles_general as $tile) + { + $this->tiles[] = $this->add_tile($tile[0], $tile[1]); + } + + // Documentation tile + if (!empty($this->doc_link)) + { + $this->tiles[] = $this->add_tile_link($this->doc_link, 'Documentation', 'book'); + } + + // Support tile + $this->tiles[] = $this->add_tile_link('https://www.techfry.com/forum', 'Support', 'question-circle'); + + // Review tile + if (!empty($this->review_link)) + { + $this->tiles[] = $this->add_tile_link($this->review_link, 'Review', $icon = 'thumbs-up'); + } + + // Premium tile + $this->tiles[] = $this->add_tile_link('https://www.techfry.com/premium/premium-membership', 'Premium', 'star'); + } + + // Add all tiles which are associated with database tables + public function add_table_tiles() + { + foreach ($this->tiles_table as $tile) + { + if (!isset($tile[2])) + { + $tile[2] = 'check-circle'; + } + + $this->tiles[] = $this->add_tile_table($tile[0], $tile[1], $tile[2]); + } + } +} \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/src/View/Back/TfViewForm.php b/deployed/tflearn/libraries/techfry/src/View/Back/TfViewForm.php new file mode 100644 index 00000000..968c4ede --- /dev/null +++ b/deployed/tflearn/libraries/techfry/src/View/Back/TfViewForm.php @@ -0,0 +1,306 @@ +initiate_form(); + + // Display the template + return parent::display($tpl); + } + + public function initiate_form() + { + parent::initiate_view(); + + // Get data from model + $this->form = $this->get('Form'); + if ($this->loadData) + { + $this->item = $this->get('Item'); + } + + $this->fieldsets = $this->form->getFieldsets(); + + $this->first_fieldset = array_keys($this->fieldsets)[0]; + } + + protected function addToolBar() + { + $input = Factory::getApplication()->input; + + // Hide Joomla Administrator Main menu + $input->set('hidemainmenu', true); + + $this->toolbar = Toolbar::getInstance('toolbar'); + + if (in_array('dashboard', $this->toolbar_buttons)) + { + $this->toolbar->linkButton('Dashboard') + ->text('COM_TF_DASHBOARD') + ->url('index.php?option=' . $this->option . '&view=dashboard') + ->icon('fas fa-th'); + } + + if ($this->loadData) + { + $this->is_new = ($this->item->id == 0); + } + else + { + $this->is_new = 0; + } + + ToolbarHelper::title(Text::_(strtoupper($this->option) . '_' . strtoupper($this->view_name) . '_' . ($this->is_new ? 'ADD' : 'EDIT')), $this->icon); + + if (in_array('back', $this->toolbar_buttons)) + { + ToolbarHelper::back(); + } + + $toolbarButtons = array(); + + if ($this->layout == 'edit') + { + if (in_array('apply', $this->toolbar_buttons)) + { + $this->toolbar->apply($this->view_name . '.apply'); + } + + foreach ($this->toolbar_buttons as $button) + { + switch ($button) + { + case 'save' : + $toolbarButtons[] = ['save', $this->view_name . '.save']; + break; + + case 'save2new' : + $toolbarButtons[] = ['save2new', $this->view_name . '.save2new']; + break; + + case 'save2copy' : + $toolbarButtons[] = ['save2copy', $this->view_name . '.save2copy']; + } + } + + ToolbarHelper::saveGroup($toolbarButtons, 'btn-success'); + } + + if (in_array('cancel', $this->toolbar_buttons)) + { + $this->toolbar->cancel($this->view_name . '.cancel', $this->is_new ? 'JTOOLBAR_CANCEL' : 'JTOOLBAR_CLOSE'); + } + + if (in_array('preview', $this->toolbar_buttons)) + { + ToolbarHelper::custom($this->view_name . '.preview', 'eye', 'eye', 'COM_TF_TOOLBAR_PREVIEW', false); + } + + if (in_array('process', $this->toolbar_buttons)) + { + ToolbarHelper::custom($this->view_name . '.process', 'refresh', 'refresh', 'COM_TF_TOOLBAR_PROCESS', false); + } + + $this->custom_toolbar_buttons(); + + ToolbarHelper::inlinehelp(); + + ToolbarHelper::help('', false, $this->help_url); + } + + // Placeholder function to add custom toolbar buttons in view file + public function custom_toolbar_buttons() + { + + } + + // Fucntion to start displaying list layout + public function start_form_layout() + { + $wa = $this->document->getWebAssetManager(); + $wa->useScript('keepalive') + ->useScript('form.validate'); + + echo '
    fileUpload) + { + echo ' enctype="multipart/form-data"'; + } + echo ' name="adminForm" id="item-form" class="form-validate">'; + + if (!empty($this->main_fields)) + { + echo '
    '; + foreach ($this->main_fields as $main_field) + { + echo '
    '; + echo $this->form->renderField($main_field); + echo '
    '; + } + echo '
    '; + } + + echo '
    '; + echo HTMLHelper::_('uitab.startTabSet', 'myTab', array('active' => $this->first_fieldset)); + } + + // Function to finisy displaying list layout + public function end_form_layout() + { + echo HTMLHelper::_('uitab.endTabSet'); + + echo ''; + + echo HTMLHelper::_('form.token'); + + echo '
    '; + + echo '
    '; + } + + // Add tab in edit layout with form fieldset + public function add_tab_form($name, $text) + { + echo HTMLHelper::_('uitab.addTab', 'myTab', $name, Text::_($text)); + + $this->render_fieldset($this->fieldsets[$name]); + + echo HTMLHelper::_('uitab.endTab'); + } + + // Add tab in edit layout with sub template file + public function add_tab_tmpl($name, $text) + { + echo HTMLHelper::_('uitab.addTab', 'myTab', $name, Text::_($text)); + + echo $this->loadTemplate($name); + + echo HTMLHelper::_('uitab.endTab'); + } + + // Add tab in edit layout with two fieldsets + public function add_tab_forms($names, $text, $cols = array(9, 3)) + { + echo HTMLHelper::_('uitab.addTab', 'myTab', $names[0], Text::_($text)); + + echo '
    '; + + foreach ($names as $key => $name) + { + echo '
    '; + + $this->render_fieldset($this->fieldsets[$name]); + + echo '
    '; + } + + echo '
    '; + + echo HTMLHelper::_('uitab.endTab'); + } + + // Function to add all form fieldsets + public function add_fieldsets() + { + foreach ($this->fieldsets as $name => $fieldSet) + { + echo HTMLHelper::_('uitab.addTab', 'myTab', $name, Text::_($fieldSet->label)); + + $this->render_fieldset($fieldSet); + + echo HTMLHelper::_('uitab.endTab'); + } + } + + // Renders fieldset legend (label), description and all fields + public function render_fieldset($fieldset) + { + if (isset($fieldset->label) && !empty($fieldset->label)) + { + echo '
    '; + echo '' . Text::_($fieldset->label) . ''; + } + + if (isset($fieldset->description) && !empty($fieldset->description)) + { + echo '
    '; + echo ' ' . Text::_($fieldset->description); + echo '
    '; + } + + echo '
    '; + echo $this->form->renderFieldset($fieldset->name); + echo '
    '; + + if (isset($fieldset->label) && !empty($fieldset->label)) + { + echo '
    '; + } + } + + // Display table + public function get_table($heads, $rows) + { + echo ''; + echo ''; + foreach ($heads as $head) + { + echo ''; + } + echo ''; + echo ''; + + foreach ($rows as $row) + { + echo ''; + foreach ($row as $td) + { + echo ''; + } + echo ''; + } + + echo ''; + echo '
    ' . Text::_($head) . '
    ' . $td . '
    '; + } +} \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/src/View/Back/TfViewList.php b/deployed/tflearn/libraries/techfry/src/View/Back/TfViewList.php new file mode 100644 index 00000000..f0c643c4 --- /dev/null +++ b/deployed/tflearn/libraries/techfry/src/View/Back/TfViewList.php @@ -0,0 +1,511 @@ +initiate_list(); + + // Display template + return parent::display($tpl); + } + + public function initiate_list() + { + parent::initiate_view(); + + // Table name from model + $this->table_name = $this->getModel()->table_name; + + // Form view name + if (empty($this->form_view)) + { + $this->form_view = substr($this->view_name, 0, -1); + } + + // Get data from model + $this->items = $this->get('Items'); + $this->state = $this->get('State'); + $this->pagination = $this->get('Pagination'); + + $this->total = $this->get('Total'); + + // Adding Filters + $this->filterForm = $this->get('FilterForm'); + $this->activeFilters = $this->get('ActiveFilters'); + + if (!\count($this->items) && $this->isEmptyState = $this->get('IsEmptyState')) + { + $this->setLayout('emptystate'); + } + + $this->listOrder = $this->escape($this->state->get('list.ordering')); + $this->listDirn = $this->escape($this->state->get('list.direction')); + } + + protected function addToolBar() + { + ToolbarHelper::title(Text::_(strtoupper($this->option) . '_MANAGER_' . strtoupper($this->view_name)), $this->icon); + + if (in_array('back', $this->toolbar_buttons)) + { + ToolbarHelper::back(); + } + + $this->toolbar = Toolbar::getInstance('toolbar'); + + if (in_array('dashboard', $this->toolbar_buttons)) + { + $this->toolbar->linkButton('Dashboard') + ->text('COM_TF_DASHBOARD') + ->url('index.php?option=' . $this->option . '&view=dashboard') + ->icon('fas fa-th'); + } + + if (in_array('select', $this->toolbar_buttons)) + { + $this->toolbar->linkButton('new', 'JTOOLBAR_NEW') + ->url('index.php?option=' . $this->option . '&view=select&layout=default&select_type=' . $this->form_view) + ->buttonClass('btn btn-success') + ->icon('icon-new'); + } + + if (in_array('new', $this->toolbar_buttons)) + { + $this->toolbar->addNew($this->form_view . '.add'); + } + + $dropdown = $this->toolbar->dropdownButton('status-group') + ->text('JTOOLBAR_CHANGE_STATUS') + ->toggleSplit(false) + ->icon('icon-ellipsis-h') + ->buttonClass('btn btn-action') + ->listCheck(false); + + $this->childbar = $dropdown->getChildToolbar(); + + foreach ($this->toolbar_buttons as $button) + { + switch ($button) + { + case 'publish' : + $this->childbar->publish($this->view_name . '.publish')->listCheck(true); + + $this->childbar->unpublish($this->view_name . '.unpublish')->listCheck(true); + + $this->childbar->archive($this->view_name . '.archive')->listCheck(true); + break; + + case 'delete' : + /* + $this->childbar->delete($this->view_name . '.delete') + ->text('COM_TF_DELETE') + ->message('JGLOBAL_CONFIRM_DELETE') + ->icon('fas fa-trash-alt') + ->listCheck(true); + */ + if ($this->state->get('filter.published') != -2) + { + $this->childbar->trash($this->view_name . '.trash')->listCheck(true); + } + + break; + + // Checks for records in table before truncate + case 'empty' : + $this->childbar->standardButton('empty') + ->text('COM_TF_TRUNCATE_TABLE') + ->task($this->view_name . '.deleteTable') + ->icon('icon-trash') + ->listCheck(false); + break; + + case 'truncate' : + $this->childbar->standardButton('empty') + ->text('COM_TF_TRUNCATE_TABLE') + ->task($this->view_name . '.truncateTable') + ->icon('icon-trash') + ->listCheck(false); + break; + + case 'import' : + $this->childbar->linkButton('import') + ->url('/administrator/index.php?option=' . $this->option . '&view=import&type=' . $this->view_name) + ->text('COM_TF_TOOLBAR_IMPORT') + ->icon('icon-upload') + ->listCheck(false); + break; + + case 'export' : + $this->childbar->linkButton('export') + ->url('/administrator/index.php?option=' . $this->option . '&view=export&type=' . $this->view_name) + ->text('COM_TF_TOOLBAR_EXPORT') + ->icon('icon-download') + ->listCheck(false); + break; + + case 'query' : + $this->childbar->linkButton('query') + ->url('/administrator/index.php?option=' . $this->option . '&view=query&type=' . $this->table_name) + ->text('COM_TF_TOOLBAR_QUERY') + ->icon('icon-database') + ->listCheck(false); + break; + } + } + + if (!$this->isEmptyState && $this->state->get('filter.published') == -2) + { + $this->toolbar->delete($this->view_name . '.delete') + ->text('JTOOLBAR_EMPTY_TRASH') + ->message('JGLOBAL_CONFIRM_DELETE') + ->listCheck(true); + } + + $this->custom_toolbar_buttons(); + + if ($this->user->authorise('core.admin', $this->option) || $this->user->authorise('core.options', $this->option)) + { + ToolbarHelper::preferences($this->option); + } + + $this->help_url .= '?utm_source=tech&utm_medium=helpsite'; + + $this->toolbar->help('', false, $this->help_url); + } + + // Placeholder function to add custom toolbar buttons in view file + public function custom_toolbar_buttons() + { + + } + + // Fucntion to start displaying list layout + public function start_list_layout() + { + echo '
    '; + + echo '
    '; + + echo LayoutHelper::render('joomla.searchtools.default', array('view' => $this)); + + if (empty($this->items)) + { + echo $this->get_no_results_msg(); + } + else + { + echo ''; + + echo $this->add_thead(); + + echo ''; + } + } + + // Function to finish displaying list layout + public function end_list_layout() + { + if (!empty($this->items)) + { + echo ''; + echo '
    '; + + echo $this->pagination->getListFooter(); + } + + echo ''; + echo ''; + echo HTMLHelper::_('form.token'); + echo '
    '; + echo '
    '; + } + + // Empty state layout + public function es_layout() + { + $displayData = array( + 'title' => Text::_(strtoupper($this->option) . '_MANAGER_' . strtoupper($this->view_name)), + 'textPrefix' => strtoupper($this->option . '_' . $this->view_name), + 'helpURL' => $this->help_url, + 'icon' => $this->icon); + + if ($this->es_add) + { + $displayData['createURL'] = 'index.php?option=' . $this->option . '&task=' . $this->form_view . '.add'; + } + + echo LayoutHelper::render('joomla.content.emptystate', $displayData); + } + + // Add table head in list layout + public function add_thead($layout = 'default') + { + echo ''; + if (in_array('id', $this->columns) && $layout == 'default') + { + echo '' . HTMLHelper::_('grid.checkall') . ''; + } + + if (in_array('published', $this->columns)) + { + echo '' . HTMLHelper::_('searchtools.sort', 'JSTATUS', 'a.published', $this->listDirn, $this->listOrder) . ''; + } + + foreach ($this->ths as $th) + { + // To Do: Use key value pairs instead of $th array + echo ''; + if (isset($th[1])) + { + echo HTMLHelper::_('searchtools.sort', $th[0], $th[1], $this->listDirn, $this->listOrder); + } + else + { + echo Text::_($th[0]); + } + echo ''; + } + + if (in_array('id', $this->columns)) + { + echo '' . HTMLHelper::_('searchtools.sort', 'JGRID_HEADING_ID', 'a.id', $this->listDirn, $this->listOrder) . ''; + } + + echo ''; + } + + // Add row in list layouts + public function add_tr($i, $row) + { + $output = ''; + + $output .= ''; + + if (in_array('id', $this->columns)) + { + $output .= '' . HTMLHelper::_('grid.id', $i, $row->id) . ''; + } + + if (in_array('published', $this->columns)) + { + $output .= '' . $this->get_status($row->published) . ''; + } + + foreach ($this->tr as $tr) + { + $output .= ''; + $output .= $tr; + $output .= ''; + } + + if (in_array('id', $this->columns)) + { + $output .= '' . $row->id . ''; + } + + $output .= ''; + + return $output; + } + + public function modal_layout($js_file) + { + HTMLHelper::_('script', $this->option . '/' . $js_file, array('version' => 'auto', 'relative' => true)); + + $default_function = 'jSelect' . ucwords($this->form_view); + $function = $this->input->getCmd('function', $default_function); + + $onclick = $this->escape($function); + $multilang = Multilanguage::isEnabled(); + + echo '
    '; + + echo LayoutHelper::render('joomla.searchtools.default', array('view' => $this)); + + if (empty($this->items)) + { + echo $this->get_no_results_msg(); + } + else + { + $this->ths = array(array('JGLOBAL_TITLE', 'a.title')); + + echo ''; + + echo $this->add_thead('modal'); + + echo ''; + + foreach ($this->items as $i => $item) + { + if ($item->language && $multilang) + { + $tag = strlen($item->language); + if ($tag == 5) + { + $lang = substr($item->language, 0, 2); + } + elseif ($tag == 6) + { + $lang = substr($item->language, 0, 3); + } + else { + $lang = ''; + } + } + elseif (!$multilang) + { + $lang = ''; + } + + echo ''; + echo ''; + + echo ''; + + echo ''; + echo ''; + } + + echo ''; + + echo '
    ' . $this->get_binary($item->published) . ''; + $link = 'index.php?option=' . $this->option . '&view=' . $this->form_view . '&id=' . $item->id; + $attribs = 'data-function="' . $this->escape($onclick) . '"' + . ' data-id="' . $item->id . '"' + . ' data-title="' . $this->escape($item->title) . '"' + . ' data-uri="' . $link . '"' + . ' data-language="' . $this->escape($lang) . '"'; + + echo '' . $this->escape($item->title) . ''; + + echo '' . (int) $item->id . '
    '; + } + + echo $this->pagination->getListFooter(); + + echo ''; + echo ''; + echo ''; + echo HTMLHelper::_('form.token'); + + echo '
    '; + } + + public function get_lang($item) + { + $output .= '' . LayoutHelper::render('joomla.content.language', $item) . ''; + + return $output; + } + + public function get_assoc($item_id, $context) + { + $html = ''; + + if ($associations = Associations::getAssociations($this->option, '#__' . $this->table_name, $context, (int) $item_id, 'id', 'alias', '')) + { + foreach ($associations as $tag => $associated) + { + $associations[$tag] = (int) $associated->id; + } + + // Get the associated menu items + $db = Factory::getDbo(); + + $query = $db->getQuery(true) + ->select('a.*') + ->select('l.sef as lang_sef') + ->select('l.lang_code') + ->from('#__' . $this->table_name . ' as a') + ->where('a.id IN (' . implode(',', array_values($associations)) . ')') + ->join('LEFT', '#__languages as l ON a.language=l.lang_code') + ->select('l.image') + ->select('l.title as language_title'); + + $db->setQuery($query); + + $items = $db->loadObjectList('id'); + + if ($items) + { + $languages = LanguageHelper::getContentLanguages(array(0, 1)); + $content_languages = array_column($languages, 'lang_code'); + + foreach ($items as &$item) + { + if (in_array($item->lang_code, $content_languages)) + { + $text = $item->lang_sef ? strtoupper($item->lang_sef) : 'XX'; + + $url = Route::_('index.php?option=' . $this->option . '&view=' . $this->form_view . '&layout=edit&id=' . (int) $item->id); + + $tooltip = htmlspecialchars($item->greeting, ENT_QUOTES, 'UTF-8') . '
    ' . Text::sprintf('JCATEGORY_SPRINTF', $item->category_title); + + $classes = 'badge bg-info'; + + $item->link = '' + . $text . ''; + } + else + { + Factory::getApplication()->enqueueMessage(Text::sprintf('JGLOBAL_ASSOCIATIONS_CONTENTLANGUAGE_WARNING', $item->lang_code), 'warning'); + } + } + } + + $html = LayoutHelper::render('joomla.content.associations', $items); + } + + return $html; + } +} \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/src/View/Back/TfViewSelect.php b/deployed/tflearn/libraries/techfry/src/View/Back/TfViewSelect.php new file mode 100644 index 00000000..c6b5335e --- /dev/null +++ b/deployed/tflearn/libraries/techfry/src/View/Back/TfViewSelect.php @@ -0,0 +1,83 @@ +icon = 'fas fa-list'; + + $this->state = $this->get('State'); + + $this->items = $this->get('Items'); + + parent::display($tpl); + } + + public function select_search() + { + echo '
    '; + echo '
    '; + echo ''; + echo '
    '; + echo ''; + echo '
    '; + echo ''; + echo '
    '; + echo '
    '; + echo '
    '; + echo '
    '; + } + + public function select_items() + { + $input = Factory::getApplication()->input; + + $select_type = $input->get('select_type'); + + echo '
    '; + + echo '

    Select ' . ucwords($select_type) . ' Type

    '; + + echo '
    '; + foreach ($this->items as $item) + { + $link = 'index.php?option=com_tfimport&view=' . $select_type . '&layout=edit&type=' . $item['value']; + + echo ''; + echo '
    '; + echo '

    ' . $item['title'] . '

    '; + echo '

    ' . $item['desc'] . '

    '; + echo '
    '; + echo ''; + echo '
    '; + } + echo '
    '; + + echo '
    '; + } +} \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/src/View/Bs/Accordion.php b/deployed/tflearn/libraries/techfry/src/View/Bs/Accordion.php new file mode 100644 index 00000000..2200770f --- /dev/null +++ b/deployed/tflearn/libraries/techfry/src/View/Bs/Accordion.php @@ -0,0 +1,71 @@ + 0), $config = array()) + { + // Properties - flush + + if (empty($items)) + { + return; + } + + $extra_class = ''; + if ($properties['flush']) + { + $extra_class = ' accordion-flush'; + } + + $output = '
    '; + + $i = 1; + + foreach ($items as $item) + { + $item = (array) $item; + $item = array_values($item); + $show = ($i == 1) ? ' show' : ''; + + $output .= '
    '; + + $output .= '

    '; + + $output .= ''; + + $output .= '

    '; + + $output .= '
    '; + + $output .= '
    '; + $output .= $item[1]; + $output .= '
    '; + + $output .= '
    '; + + $output .= '
    '; + + $i++; + } + + $output .= '
    '; + + return $output; + } + + public static function display($items = array(), $properties = array('flush' => 0), $config = array()) + { + echo self::get_output($items, $properties, $config); + } +} \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/src/View/Bs/Alert.php b/deployed/tflearn/libraries/techfry/src/View/Bs/Alert.php new file mode 100644 index 00000000..d1cb21ac --- /dev/null +++ b/deployed/tflearn/libraries/techfry/src/View/Bs/Alert.php @@ -0,0 +1,46 @@ + 'primary', 'dismiss' => 0), $config = array()) + { + // Properties - type, dismiss + + if ($text == '') + { + return; + } + + $extra_class = ''; + if ($properties['dismiss']) + { + $extra_class = ' alert-dismissible fade show'; + } + + $output = ''; + + return $output; + } + + public static function display($text, $properties = array('type' => 'primary', 'dismiss' => 0), $config = array()) + { + echo self::get_output($text, $properties, $config); + } +} \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/src/View/Bs/Badge.php b/deployed/tflearn/libraries/techfry/src/View/Bs/Badge.php new file mode 100644 index 00000000..a349e6a2 --- /dev/null +++ b/deployed/tflearn/libraries/techfry/src/View/Bs/Badge.php @@ -0,0 +1,54 @@ + 'primary'), $config = array()) + { + // Properties - type, border, pill + + if ($text == '') + { + return; + } + + if (!is_array($properties)) + { + $properties = (array) $properties; + } + + $extra_class = ''; + if (isset($properties['border']) && $properties['border']) + { + $extra_class .= ' border'; + } + if (isset($properties['pill']) && $properties['pill']) + { + $extra_class .= ' rounded-pill'; + } + if ($properties['type'] == 'light' || $properties['type'] == 'info') + { + $properties['type'] = $properties['type'] . ' text-dark'; + } + + $output = ''; + + $output .= $text; + + $output .= ''; + + return $output; + } + + public static function display($text, $properties = array('type' => 'primary'), $config = array()) + { + echo self::get_output($text, $properties, $config); + } +} \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/src/View/Bs/Button.php b/deployed/tflearn/libraries/techfry/src/View/Bs/Button.php new file mode 100644 index 00000000..c78bd66f --- /dev/null +++ b/deployed/tflearn/libraries/techfry/src/View/Bs/Button.php @@ -0,0 +1,54 @@ + 'primary'), $config = array('url' => '#')) + { + // Properties - type, outline, size, radius + // Config - url, target + + if ($text == '') + { + return; + } + + if (is_object($properties)) + { + $properties = (array) $properties; + } + + $extra_class = ''; + if (isset($properties['outline']) && $properties['outline']) + { + $properties['type'] = 'outline-' . $properties['type']; + } + if (isset($properties['size']) && $properties['size']) + { + $extra_class .= ' ' . $properties['size']; + } + if (isset($properties['radius']) && $properties['radius']) + { + $extra_class .= ' ' . $properties['radius']; + } + + $class = 'me-2 btn btn-' . $properties['type'] . $extra_class; + + $output = '' . $text . ''; + + return $output; + } + + public static function display($text, $properties = array('type' => 'primary'), $config = array('url' => '#')) + { + echo self::get_output($text, $properties, $config); + } +} \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/src/View/Bs/Card.php b/deployed/tflearn/libraries/techfry/src/View/Bs/Card.php new file mode 100644 index 00000000..fb03db1c --- /dev/null +++ b/deployed/tflearn/libraries/techfry/src/View/Bs/Card.php @@ -0,0 +1,75 @@ + 1, 'show_date' => 1)) + { + // Properties - button + // Config - show_title, show_date + + $output = '
    '; + + if (!empty($item->image)) + { + $img = HTMLHelper::cleanImageURL($item->image); + $image_size = filesize(JPATH_ROOT . '/' . $img->url); + + if ($image_size > 0) + { + $output .= ''; + + $output .= TfHtml::image($item->image, $item->title, 'card-img-top', false); + + $output .= ''; + } + } + + $output .= '
    '; + + if (isset($config['show_title']) && $config['show_title']) + { + $output .= '

    '; + $output .= '' . $item->title . ''; + $output .= '

    '; + } + + if (isset($config['show_date']) && $config['show_date']) + { + $output .= TfHtml::display_date($item->when, $config['date_format'], false); + } + + if (isset($item->description)) + { + $output .= '

    ' . $item->description . '

    '; + } + + if (isset($properties['button']) && !empty($properties['button'])) + { + $button = (array) $properties['button']; + $btn_text = $button['text']; + $output .= Button::get_output($btn_text, $button, array('url' => $item->url)); + } + + $output .= '
    '; + + return $output; + } + + public static function display($item, $properties = array(), $config = array('show_title' => 1, 'show_date' => 1)) + { + echo self::get_output($item, $properties, $config); + } +} \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/src/View/Bs/Carousel.php b/deployed/tflearn/libraries/techfry/src/View/Bs/Carousel.php new file mode 100644 index 00000000..a0f8fbfc --- /dev/null +++ b/deployed/tflearn/libraries/techfry/src/View/Bs/Carousel.php @@ -0,0 +1,110 @@ +'; + + // Indicators + if ($config['indicators']) + { + $output .= ''; + } + + // Items + $output .= ''; + + // Controls + if ($config['controls']) + { + $output .= ' + '; + } + + $output .= ''; + + return $output; + } + + public static function display($items, $properties = array(), $config = array()) + { + echo self::get_output($items, $properties, $config); + } +} \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/src/View/Bs/Gallery.php b/deployed/tflearn/libraries/techfry/src/View/Bs/Gallery.php new file mode 100644 index 00000000..55665af2 --- /dev/null +++ b/deployed/tflearn/libraries/techfry/src/View/Bs/Gallery.php @@ -0,0 +1,74 @@ + 3)) + { + // Properties - + // Config - columns, folder + + if (empty($images)) + { + return; + } + + $columns = $config['columns']; + + $output = ''; + + $counter = 0; + + foreach ($images as $k => $image) + { + if ($counter == 0) + { + $output .= '
    '; + } + + $path_info = pathinfo($image); + + $output .= '
    '; + $output .= TfHtml::image($config['folder'] . '/' . $image, $path_info['filename'], 'img-fluid img-thumbnail mb-3', false); + $output .= '
    '; + + $counter++; + if ($counter == $columns) + { + $output .= '
    '; + $counter = 0; + } + } + + if ($counter != 0) + { + $output .= ''; + } + + foreach ($images as $k => $image) + { + $path_info = pathinfo($image); + + $modal_body = TfHtml::image($config['folder'] . '/' . $image, $path_info['filename'], 'img-fluid img-thumbnail mb-3', false); + + $output .= Modal::get_output(array('title' => $path_info['filename'], 'body' => $modal_body), array(), array('modal_id' => 'Modal' . $k)); + } + + return $output; + } + + public static function display($images, $properties = array(), $config = array('columns' => 3)) + { + echo self::get_output($images, $properties, $config); + } +} \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/src/View/Bs/Grid.php b/deployed/tflearn/libraries/techfry/src/View/Bs/Grid.php new file mode 100644 index 00000000..233d2c6c --- /dev/null +++ b/deployed/tflearn/libraries/techfry/src/View/Bs/Grid.php @@ -0,0 +1,43 @@ +'; + } + } + + public static function end_row($counter, $columns = 2) + { + $counter++; + + if ($counter == $columns) + { + echo ''; + $counter = 0; + } + + return $counter; + } + + public static function start_col($class = 'col-lg') + { + echo '
    '; + } + + public static function end_col() + { + echo '
    '; + } +} \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/src/View/Bs/Icon.php b/deployed/tflearn/libraries/techfry/src/View/Bs/Icon.php new file mode 100644 index 00000000..4f53efcb --- /dev/null +++ b/deployed/tflearn/libraries/techfry/src/View/Bs/Icon.php @@ -0,0 +1,42 @@ +'; + + return $output; + } + + public static function display($icon, $properties = array(), $config = array()) + { + echo self::get_output($icon, $properties, $config); + } +} \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/src/View/Bs/Iconbox.php b/deployed/tflearn/libraries/techfry/src/View/Bs/Iconbox.php new file mode 100644 index 00000000..ae1ec65a --- /dev/null +++ b/deployed/tflearn/libraries/techfry/src/View/Bs/Iconbox.php @@ -0,0 +1,45 @@ +icon, $icon_class); + + if (!empty($item->title)) + { + $output .= TfHtml::heading($item->title, 'h3', $properties['title_class'], false); + } + + if (!empty($item->description)) + { + $output .= TfHtml::text($item->description, 'p', $properties['desc_class'], false); + } + + if (!empty($item->url)) + { + $output .= Button::get_output($properties['button_text'], array('button' => $properties['button_class']), array('url' => $item->url)); + } + + return $output; + } + + public static function display($item, $properties = array(), $config = array()) + { + echo self::get_output($item, $properties, $config); + } +} \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/src/View/Bs/Iconlist.php b/deployed/tflearn/libraries/techfry/src/View/Bs/Iconlist.php new file mode 100644 index 00000000..b2ff4cba --- /dev/null +++ b/deployed/tflearn/libraries/techfry/src/View/Bs/Iconlist.php @@ -0,0 +1,57 @@ +icon, $properties['icon']) . ' ' . TfHtml::text($item->title, 'span', $properties['title_class'], false); + if (!empty($item->url)) + { + $list_item = '' . $list_item . ''; + } + + $list_items[] = $list_item; + } + + if (trim($properties['list_class']) == 'list-inline') + { + $properties['list_item_class'] = 'list-inline-item'; + } + + $output = TfHtml::display_list($list_items, 'ul', $properties['list_class'], $properties['list_item_class'], false); + + return $output; + } + + public static function display($items, $properties = array(), $config = array()) + { + echo self::get_output($items, $properties, $config); + } +} \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/src/View/Bs/Imagebox.php b/deployed/tflearn/libraries/techfry/src/View/Bs/Imagebox.php new file mode 100644 index 00000000..b76025d2 --- /dev/null +++ b/deployed/tflearn/libraries/techfry/src/View/Bs/Imagebox.php @@ -0,0 +1,49 @@ +image, $item->title, $properties['image_class'], false); + + if (!empty($item->title)) + { + $output .= TfHtml::heading($item->title, 'h4', $properties['title_class'], false); + } + + if (!empty($item->subtitle)) + { + $output .= TfHtml::text($item->subtitle, 'p', $properties['subtitle_class'], false); + } + + if (!empty($item->description)) + { + $output .= TfHtml::text($item->description, 'p', $properties['desc_class'], false); + } + + if (!empty($item->url)) + { + $output .= Button::get_output($properties['button_text'], $properties['button_class'], array('url' => $item->url)); + } + + return $output; + } + + public static function display($item, $properties = array(), $config = array()) + { + echo self::get_output($item, $properties, $config); + } +} \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/src/View/Bs/Modal.php b/deployed/tflearn/libraries/techfry/src/View/Bs/Modal.php new file mode 100644 index 00000000..48752e3a --- /dev/null +++ b/deployed/tflearn/libraries/techfry/src/View/Bs/Modal.php @@ -0,0 +1,59 @@ +'; + $output .= ''; + $output .= ''; + + return $output; + } + + public static function display($item, $properties = array(), $config = array()) + { + echo self::get_output($item, $properties, $config); + } +} \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/src/View/Bs/Plain.php b/deployed/tflearn/libraries/techfry/src/View/Bs/Plain.php new file mode 100644 index 00000000..b9ef5d7c --- /dev/null +++ b/deployed/tflearn/libraries/techfry/src/View/Bs/Plain.php @@ -0,0 +1,34 @@ +'; + $output .= '
    ' . $item[0] . '
    '; + $output .= $item[1]; + } + + return $output; + } + + public static function display($items, $properties = array(), $config = array()) + { + echo self::get_output($items, $properties, $config); + } +} \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/src/View/Bs/Progress.php b/deployed/tflearn/libraries/techfry/src/View/Bs/Progress.php new file mode 100644 index 00000000..754e8beb --- /dev/null +++ b/deployed/tflearn/libraries/techfry/src/View/Bs/Progress.php @@ -0,0 +1,49 @@ + 'primary'), $config = array()) + { + // Properties - type, striped, animated + + if (!is_array($properties)) + { + $properties = (array) $properties; + } + + $class = ' bg-' . $properties['type']; + if ($properties['striped']) + { + $class .= ' progress-bar-striped'; + } + if ($properties['animated']) + { + $class .= ' progress-bar-animated'; + } + + $output = '
    '; + + $output .= '
    '; + + $output .= $progress . '%'; + + $output .= '
    '; + + $output .= '
    '; + + return $output; + } + + public static function display($progress, $properties = array(), $config = array()) + { + echo self::get_output($progress, $properties, $config); + } +} \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/src/View/Bs/Search.php b/deployed/tflearn/libraries/techfry/src/View/Bs/Search.php new file mode 100644 index 00000000..53edc9b8 --- /dev/null +++ b/deployed/tflearn/libraries/techfry/src/View/Bs/Search.php @@ -0,0 +1,59 @@ +input; + + $output = '
    '; + $output .= '
    '; + + foreach ($searches as $search) + { + $$search = $input->get($search, '', 'RAW'); + + $output .= '
    '; + $output .= '
    '; + $output .= ''; + $output .= '
    '; + $output .= '
    '; + } + + $output .= '
    '; + $output .= ''; + $output .= '
    '; + $output .= '
    '; + $output .= '
    '; + } + + return $output; + } + + public static function display($searches = array('title'), $properties = array(), $config = array()) + { + echo self::get_output($searches, $properties, $config); + } +} \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/src/View/Bs/Tabs.php b/deployed/tflearn/libraries/techfry/src/View/Bs/Tabs.php new file mode 100644 index 00000000..d1a4ee9b --- /dev/null +++ b/deployed/tflearn/libraries/techfry/src/View/Bs/Tabs.php @@ -0,0 +1,67 @@ +'; + + // Tab content + $output .= ''; + + return $output; + } + + public static function display($items, $properties = array(), $config = array()) + { + echo self::get_output($items, $properties, $config); + } +} \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/src/View/Bs/Utility.php b/deployed/tflearn/libraries/techfry/src/View/Bs/Utility.php new file mode 100644 index 00000000..b11b78b6 --- /dev/null +++ b/deployed/tflearn/libraries/techfry/src/View/Bs/Utility.php @@ -0,0 +1,61 @@ +addStyleSheet($style_url); + } + elseif ($load_bs == 2) + { + $document->addScript($script_url); + } + elseif ($load_bs == 3) + { + $document->addStyleSheet($style_url); + $document->addScript($script_url); + } + } +} diff --git a/deployed/tflearn/libraries/techfry/src/View/Front/TfView.php b/deployed/tflearn/libraries/techfry/src/View/Front/TfView.php new file mode 100644 index 00000000..c8b394f0 --- /dev/null +++ b/deployed/tflearn/libraries/techfry/src/View/Front/TfView.php @@ -0,0 +1,184 @@ +uri = Uri::getInstance(); + + $this->app = Factory::getApplication(); + $this->input = $this->app->input; + + $this->option = $this->input->get('option'); + + $this->layout = $this->getLayout(); + + $this->view_name = $this->getName(); + + $this->user = Factory::getUser(); + + // Active menu parameters + $this->params = $this->app->getMenu()->getActive()->getParams(); + + // Load Resources + TfResource::add_resources($this->getModel()->get_param('load_rs')); + + $this->_prepareDocument(); + } + + protected function _prepareDocument() + { + $pathway = $this->app->getPathway(); + + // 01. Page heading of document + $menus = $this->app->getMenu(); + $menu = $menus->getActive(); + if ($menu) + { + $this->params->def('page_heading', $this->params->get('page_title', $menu->title)); + } + + // 02. Add item path to breadcrumb + $pathway->addItem($this->title); + + // 03. Title of document + $title = $this->title; + + $this->setDocumentTitle($title); + } + + public function action_buttons($actions = array()) + { + foreach ($actions as $action) + { + $this->action_button($action[0], $action[1], $action[2], $action[3]); + } + } + + public function action_button($text, $task, $class, $icon = '', $hidden = array()) + { + echo '
    '; + + echo ''; + echo ''; + + // echo ''; + + foreach ($hidden as $k => $v) + { + echo ''; + } + + echo ''; + + echo '
    '; + } + + public function handle_access() + { + $app = Factory::getApplication(); + + if ($this->user->get('guest')) + { + $return = base64_encode(Uri::getInstance()); + $login_url_with_return = Route::_('index.php?option=com_users&view=login&return=' . $return); + $app->enqueueMessage(Text::_('COM_TF_LOGIN_TO_CONTINUE'), 'notice'); + $app->redirect($login_url_with_return, 403); + } + else + { + $app->enqueueMessage(Text::_('JERROR_ALERTNOAUTHOR'), 'error'); + $app->setHeader('status', 403, true); + } + } + + public function get_no_results_msg() + { + return Text::_('JGLOBAL_NO_MATCHING_RESULTS'); + } + + // Start page display + public function start_page_layout() + { + if (!empty($this->params->get('pageclass_sfx'))) + { + echo '
    '; + } + + if ($this->params->get('show_page_heading')) + { + echo '

    ' . $this->escape($this->params->get('page_heading')) . '

    '; + } + + if (!empty($this->params->get('image'))) + { + echo ''; + } + + if (!empty($this->params->get('description'))) + { + echo $this->params->get('description'); + } + } + + // End page display + public function end_page_layout() + { + if (!empty($this->params->get('pageclass_sfx'))) + { + echo '
    '; + } + } + + // Get parameter from component options + public function get_param($type, $default = null) + { + $input = Factory::getApplication()->input; + $option = $input->get('option'); + + $param = ComponentHelper::getParams($option)->get($type, $default); + + return $param; + } +} \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/src/View/Front/TfViewFeed.php b/deployed/tflearn/libraries/techfry/src/View/Front/TfViewFeed.php new file mode 100644 index 00000000..d4ad2482 --- /dev/null +++ b/deployed/tflearn/libraries/techfry/src/View/Front/TfViewFeed.php @@ -0,0 +1,98 @@ +app = Factory::getApplication(); + + $this->doc = Factory::getDocument(); + + $siteEmail = $this->app->get('mailfrom'); + + $this->doc->link = $this->current_link; + + $this->app->input->set('limit', $this->app->get('feed_limit')); + + $rows = $this->get('Items'); + + foreach ($rows as $row) + { + // A. Title of Feed Item + $title = $this->escape($row->title); + $title = html_entity_decode($title, ENT_COMPAT, 'UTF-8'); + + // B. Link of Feed Item + $link = $this->base_item_link . '&id=' . $row->id; + + // C. Description of Feed Item + $description = ''; + + // C1. Image in description + if (!empty($row->image)) + { + $image = preg_match('/http/', $row->image) ? $row->image : URI::root() . $row->image; + $description = '

    '; + } + + // C2. Text in description + $desc = htmlspecialchars(trim(strip_tags($row->description))); + $feed_summary_limit = $this->getModel()->get_param('feed_summary_limit'); + if (strlen($desc) > $feed_summary_limit) + { + $position = strpos($desc, ' ', $feed_summary_limit); + $desc = substr($desc, 0, $position); + } + $description .= $desc; + + // C3. Read more in description + if ($this->getModel()->get_param('feed_show_readmore')) + { + $description .= '

    ' . Text::_('COM_TF_FEED_READMORE') . '

    '; + } + + // Load individual item + $item = new FeedItem; + $item->title = $title; + $item->link = Route::_($link); + + if (isset($row->modified) && !empty($row->modified)) + { + $item->date = $row->modified; + } + else + { + $item->date = $row->created; + } + + $item->authorEmail = $siteEmail; + + $item->description = '
    ' . $description . '
    '; + + // Loads item info into rss array + $this->doc->addItem($item); + } + } +} \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/src/View/Front/TfViewForm.php b/deployed/tflearn/libraries/techfry/src/View/Front/TfViewForm.php new file mode 100644 index 00000000..8996c686 --- /dev/null +++ b/deployed/tflearn/libraries/techfry/src/View/Front/TfViewForm.php @@ -0,0 +1,171 @@ +form = $this->get('Form'); + if ($this->loadData) + { + $this->item = $this->get('Item'); + } + + $this->initiate_view(); + } + + // Function to start displaying form layout + public function start_form_layout() + { + $link = Route::_('index.php?option=' . $this->option . '&view=' . $this->view_name); + + echo '
    fileUpload) + { + echo ' enctype="multipart/form-data"'; + } + echo '>'; + } + + // Function to finish displaying form layout + public function end_form_layout() + { + // Captcha Field + if ($this->params->get('show_captcha', 0) && !$this->user->id) + { + $num1 = rand(1, 9); + $num2 = rand(1, 9); + $answer = $num1 + $num2; + + $math = $num1 . ' + ' . $num2 . ' = ?'; + $hint = Text::_(strtoupper($this->option) . '_CAPTCHA') . ': ' . $num1 . ' + ' . $num2 . ' equals to'; + + $this->form->setFieldAttribute('captcha', 'label', Text::_(strtoupper($this->option) . '_CAPTCHA') . ': ' . $math); + $this->form->setFieldAttribute('captcha', 'hint', $hint); + $this->form->setFieldAttribute('captcha', 'required', 'true'); + + $fieldsets = $this->form->getFieldsets(); + if ($this->f_layout == 'fieldsets') + { + echo $this->render_fieldset($fieldsets['captcha']); + } + else + { + echo $this->render_fieldset($fieldsets['captcha'], false); + } + echo ''; + } + + // Custom Redirect + if (!empty($this->params->get('custom_redirect', ''))) + { + $this->form->setValue('custom_redirect', null, $this->params->get('custom_redirect')); + } + else + { + $this->form->setValue('custom_redirect', null, Uri::getInstance()); + } + + // Custom Message + if (!empty($this->params->get('custom_message', ''))) + { + $this->form->setValue('custom_message', null, $this->params->get('custom_message')); + } + + echo $this->form->renderFieldset('details'); + + echo ''; + + echo ''; + + echo HTMLHelper::_('form.token'); + + // Submit or Save Button + if (empty($this->button)) + { + $this->button = $this->params->get('button'); + } + if (is_null($this->button)) + { + $this->button = new \stdClass(); + $this->button->text = 'Submit'; + $this->button->button_class = 'bg-primary text-white'; + } + echo ''; + + echo '
    '; + } + + // Renders fieldset legend (label), description and all fields + public function render_fieldset($fieldset, $show_label = true) + { + $output = ''; + + if (isset($fieldset->label) && !empty($fieldset->label) && $show_label) + { + $output .= '
    '; + $output .= '' . Text::_($fieldset->label) . ''; + } + + if (isset($fieldset->description) && !empty($fieldset->description)) + { + $output .= '
    '; + $output .= ' ' . Text::_($fieldset->description); + $output .= '
    '; + } + + $output .= $this->form->renderFieldset($fieldset->name); + + if (isset($fieldset->label) && !empty($fieldset->label) && $show_label) + { + $output .= '
    '; + } + + return $output; + } + + protected function _prepareDocument() + { + $app = Factory::getApplication(); + $title = null; + + // 01. Page heading of document + $menus = $app->getMenu(); + $menu = $menus->getActive(); + if ($menu) + { + $this->params->def('page_heading', $this->params->get('page_title', $menu->title)); + } + + // 02. Title of document + $title = $this->params->get('page_title', $menu->title); + + $this->setDocumentTitle($title); + } +} \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/src/View/Front/TfViewItem.php b/deployed/tflearn/libraries/techfry/src/View/Front/TfViewItem.php new file mode 100644 index 00000000..41c4f001 --- /dev/null +++ b/deployed/tflearn/libraries/techfry/src/View/Front/TfViewItem.php @@ -0,0 +1,84 @@ +form_view = substr($this->view_name, 0, -1); + + // Get data from model + $this->item = $this->get('Item'); + + $this->initiate_view(); + } + + protected function _prepareDocument() + { + $app = Factory::getApplication(); + $pathway = $app->getPathway(); + + // 01. Page heading of document + $menus = $app->getMenu(); + $menu = $menus->getActive(); + if ($menu) + { + $this->params->def('page_heading', $this->params->get('page_title', $menu->title)); + } + + // 02. Add item path to breadcrumb + $pathway->addItem($this->item->title); + + // 03. Title of document + $title = $this->item->title; + + $this->setDocumentTitle($title); + } + + // Fucntion to start displaying item layout + public function start_item_layout() + { + if (!empty($this->item->title)) + { + echo '

    ' . $this->item->title . '

    '; + } + + if (!empty($this->item->image)) + { + echo ''; + } + + if (!empty($this->item->description)) + { + echo $this->item->description; + } + } + + // Function to finish displaying item layout + public function end_item_layout() + { + // Record Hits + if ($this->getModel()->get_param('record_hits')) + { + $this->getModel()->record_hits(); + } + } +} \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/src/View/Front/TfViewList.php b/deployed/tflearn/libraries/techfry/src/View/Front/TfViewList.php new file mode 100644 index 00000000..b344644b --- /dev/null +++ b/deployed/tflearn/libraries/techfry/src/View/Front/TfViewList.php @@ -0,0 +1,121 @@ +form_view = substr($this->view_name, 0, -1); + + // Get data from model + $this->items = $this->get('Items'); + $this->state = $this->get('State'); + $this->pagination = $this->get('Pagination'); + + $this->total = $this->get('Total'); + + $this->initiate_view(); + } + + protected function _prepareDocument() + { + $app = Factory::getApplication(); + + // 01. Page heading of document + $menus = $app->getMenu(); + $menu = $menus->getActive(); + if ($menu) + { + $this->params->def('page_heading', $this->params->get('page_title', $menu->title)); + } + + // 02. Browser title + $title = $this->params->get('page_title', ''); + if (empty($title)) + { + $title = $menu->title; + } + + $this->setDocumentTitle($title); + + // 03. Add feed link + if ($this->getModel()->get_param('show_feed_link')) + { + $this->add_feed(); + } + } + + // Start displaying list layout + public function start_list_layout() + { + if (!empty($this->params->get('pageclass_sfx'))) + { + echo '
    '; + } + + if ($this->params->get('show_page_heading')) + { + echo '

    ' . $this->escape($this->params->get('page_heading')) . '

    '; + } + + if (!empty($this->params->get('description'))) + { + echo $this->params->get('description'); + } + + if (empty($this->items)) + { + $no_results_msg = $this->get_no_results_msg(); + + echo '
    ' . $no_results_msg . '
    '; + } + } + + // Finish displaying list layout + public function end_list_layout() + { + echo $this->pagination->getListFooter(); + + if (!empty($this->params->get('pageclass_sfx'))) + { + echo '
    '; + } + } + + public function add_feed() + { + $link = '&format=feed&limitstart='; + + $attribs = array('type' => 'application/rss+xml', 'title' => 'RSS 2.0'); + $this->document->addHeadLink(Route::_($link . '&type=rss'), 'alternate', 'rel', $attribs); + + $attribs = array('type' => 'application/atom+xml', 'title' => 'Atom 1.0'); + $this->document->addHeadLink(Route::_($link . '&type=atom'), 'alternate', 'rel', $attribs); + } +} \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/src/View/Others/Youtube.php b/deployed/tflearn/libraries/techfry/src/View/Others/Youtube.php new file mode 100644 index 00000000..ea8d8d7f --- /dev/null +++ b/deployed/tflearn/libraries/techfry/src/View/Others/Youtube.php @@ -0,0 +1,36 @@ +'; + + return $output; + } + + public static function display($video_id, $properties = array(), $config = array()) + { + echo self::get_output($video_id, $properties, $config); + } +} \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/src/View/TfViewExport.php b/deployed/tflearn/libraries/techfry/src/View/TfViewExport.php new file mode 100644 index 00000000..6707f112 --- /dev/null +++ b/deployed/tflearn/libraries/techfry/src/View/TfViewExport.php @@ -0,0 +1,36 @@ +start_form_layout(); + + $this->add_tab_forms(array('general', 'options'), 'COM_TF_GENERAL', array(6, 6)); + + $this->end_form_layout(); + } +} \ No newline at end of file diff --git a/deployed/tflearn/libraries/techfry/src/View/TfViewQuery.php b/deployed/tflearn/libraries/techfry/src/View/TfViewQuery.php new file mode 100644 index 00000000..e3bebca7 --- /dev/null +++ b/deployed/tflearn/libraries/techfry/src/View/TfViewQuery.php @@ -0,0 +1,36 @@ + + + Tech Fry Library + Tech Fry + August 2022 + Tech Fry + https://www.gnu.org/licenses/gpl-3.0.en.html + mail@techfry.com + https://www.techfry.com + 1.3.4 + Tech Fry Library - used by Tech Fry extensions + + techfry + TechFry\Library + + + css + + + + forms + src + techfry.xml + + + + https://labs.techfry.com/joomla/library/techfry/extension.xml + + diff --git a/deployed/tflearn/media/techfry/css/grid.css b/deployed/tflearn/media/techfry/css/grid.css new file mode 100644 index 00000000..4e6392ad --- /dev/null +++ b/deployed/tflearn/media/techfry/css/grid.css @@ -0,0 +1,34 @@ +/* Grid */ +.grid {display: grid; gap: 1rem; height: 100%;} + +.grid-1 {grid-template-columns: repeat(1, 1fr);} +.grid-2 {grid-template-columns: repeat(1, 1fr);} +.grid-3 {grid-template-columns: repeat(1, 1fr);} +.grid-4 {grid-template-columns: repeat(1, 1fr);} +.grid-6 {grid-template-columns: repeat(1, 1fr);} + +.g-col-2 {grid-column: auto / span 2;} +.g-col-3 {grid-column: auto / span 3;} +.g-col-4 {grid-column: auto / span 4;} + +.g-start-2 {grid-column-start: 2;} +.g-start-3 {grid-column-start: 3;} +.g-start-4 {grid-column-start: 4;} + +/* Tablets and above : 3 columns */ +@media screen and (min-width: 768px) { + .grid-1 {grid-template-columns: repeat(1, 1fr);} + .grid-2 {grid-template-columns: repeat(2, 1fr);} + .grid-3 {grid-template-columns: repeat(3, 1fr);} + .grid-4 {grid-template-columns: repeat(2, 1fr);} + .grid-6 {grid-template-columns: repeat(3, 1fr);} +} + +/* Desktop and above : 3 or more columns */ +@media screen and (min-width: 992px) { + .grid-1 {grid-template-columns: repeat(1, 1fr);} + .grid-2 {grid-template-columns: repeat(2, 1fr);} + .grid-3 {grid-template-columns: repeat(3, 1fr);} + .grid-4 {grid-template-columns: repeat(4, 1fr);} + .grid-6 {grid-template-columns: repeat(6, 1fr);} +} \ No newline at end of file