From d821c32013222719a4dcabf1b605cbff47ba95e0 Mon Sep 17 00:00:00 2001 From: ahwelp Date: Tue, 24 Jan 2023 20:35:43 +0000 Subject: [PATCH] Common functionalities --- app/common/Routes.php | 8 ++ app/common/defaults/DefaultsController.php | 111 +++++++++++++++ app/common/defaults/Routes.php | 21 +++ app/common/defaults/classes/Defaults.php | 14 ++ app/common/defaults/db/Migrate.php | 40 ++++++ app/common/defaults/lang/en.php | 2 + app/common/defaults/lang/pt_br.php | 2 + app/common/defaults/version.php | 8 ++ app/common/defaults/views/form.mustache | 10 ++ app/common/defaults/views/index.mustache | 4 + app/common/email/EmailController.php | 136 +++++++++++++++++++ app/common/email/EmailTemplateController.php | 107 +++++++++++++++ app/common/email/Routes.php | 28 ++++ app/common/email/classes/Email.php | 49 +++++++ app/common/email/classes/EmailsCongifs.php | 19 +++ app/common/email/classes/EmailsTemplate.php | 19 +++ app/common/email/db/Migrate.php | 57 ++++++++ app/common/email/lang/en.php | 2 + app/common/email/lang/pt_br.php | 2 + app/common/email/todo.md | 0 app/common/email/version.php | 6 + app/common/email/views/form.mustache | 62 +++++++++ app/common/email/views/index.mustache | 2 + app/common/email/views/templateForm.mustache | 48 +++++++ app/common/files/FilesController.php | 111 +++++++++++++++ app/common/files/Routes.php | 16 +++ app/common/files/classes/Files.php | 21 +++ app/common/files/db/Migrate.php | 33 +++++ app/common/files/lang/en.php | 2 + app/common/files/lang/pt_br.php | 2 + app/common/files/version.php | 6 + app/common/files/views/form.mustache | 10 ++ app/common/files/views/index.mustache | 4 + app/common/glossary/GlossaryController.php | 111 +++++++++++++++ app/common/glossary/Routes.php | 22 +++ app/common/glossary/classes/Glossary.php | 49 +++++++ app/common/glossary/db/Migrate.php | 36 +++++ app/common/glossary/lang/en.php | 2 + app/common/glossary/lang/pt_br.php | 2 + app/common/glossary/todo.md | 0 app/common/glossary/version.php | 6 + app/common/glossary/views/form.mustache | 86 ++++++++++++ app/common/glossary/views/index.mustache | 2 + 43 files changed, 1278 insertions(+) create mode 100644 app/common/Routes.php create mode 100644 app/common/defaults/DefaultsController.php create mode 100644 app/common/defaults/Routes.php create mode 100644 app/common/defaults/classes/Defaults.php create mode 100644 app/common/defaults/db/Migrate.php create mode 100644 app/common/defaults/lang/en.php create mode 100644 app/common/defaults/lang/pt_br.php create mode 100644 app/common/defaults/version.php create mode 100644 app/common/defaults/views/form.mustache create mode 100644 app/common/defaults/views/index.mustache create mode 100644 app/common/email/EmailController.php create mode 100644 app/common/email/EmailTemplateController.php create mode 100644 app/common/email/Routes.php create mode 100644 app/common/email/classes/Email.php create mode 100644 app/common/email/classes/EmailsCongifs.php create mode 100644 app/common/email/classes/EmailsTemplate.php create mode 100644 app/common/email/db/Migrate.php create mode 100644 app/common/email/lang/en.php create mode 100644 app/common/email/lang/pt_br.php create mode 100644 app/common/email/todo.md create mode 100644 app/common/email/version.php create mode 100644 app/common/email/views/form.mustache create mode 100644 app/common/email/views/index.mustache create mode 100644 app/common/email/views/templateForm.mustache create mode 100644 app/common/files/FilesController.php create mode 100644 app/common/files/Routes.php create mode 100644 app/common/files/classes/Files.php create mode 100644 app/common/files/db/Migrate.php create mode 100644 app/common/files/lang/en.php create mode 100644 app/common/files/lang/pt_br.php create mode 100644 app/common/files/version.php create mode 100644 app/common/files/views/form.mustache create mode 100644 app/common/files/views/index.mustache create mode 100644 app/common/glossary/GlossaryController.php create mode 100644 app/common/glossary/Routes.php create mode 100644 app/common/glossary/classes/Glossary.php create mode 100644 app/common/glossary/db/Migrate.php create mode 100644 app/common/glossary/lang/en.php create mode 100644 app/common/glossary/lang/pt_br.php create mode 100644 app/common/glossary/todo.md create mode 100644 app/common/glossary/version.php create mode 100644 app/common/glossary/views/form.mustache create mode 100644 app/common/glossary/views/index.mustache diff --git a/app/common/Routes.php b/app/common/Routes.php new file mode 100644 index 0000000..20f515b --- /dev/null +++ b/app/common/Routes.php @@ -0,0 +1,8 @@ + 'nav-link'], 10 ); +}, -10)->doIgnore(); \ No newline at end of file diff --git a/app/common/defaults/DefaultsController.php b/app/common/defaults/DefaultsController.php new file mode 100644 index 0000000..2d69ede --- /dev/null +++ b/app/common/defaults/DefaultsController.php @@ -0,0 +1,111 @@ + 0]); + Output::render(); + } + + /** + * Store + * + * Store the param on the database + * @param Defaults $defaults + */ + function store(Defaults $defaults){ + + } + + /** + * Search + * + * Store the param on the database + * @param Defaults $defaults + */ + function search(){ + + } + + /** + * Show + * + * Render one register + * + * @param Defaults $defaults + */ + function show(Defaults $defaults){ + + } + + /** + * Edit + * + * Render the formular for a database Defaults + * + * @param Defaults $defaults + */ + function edit(Defaults $defaults){ + Output::setView('form', $defaults); + Output::render(); + } + + /** + * Update + * Store the changes of the param on the database + * + * @param Defaults $defaults + */ + function update(Defaults $defaults){ + + } + + /** + * Destroy + * If the object has soft delete. + * + * @param Defaults $defaults + */ + function destroy(Defaults $defaults){ + + } + + /** + * Purge + * Remove object even with soft delete. + * + * @param Defaults $defaults + */ + function purge(Defaults $defaults){ + + } +} \ No newline at end of file diff --git a/app/common/defaults/Routes.php b/app/common/defaults/Routes.php new file mode 100644 index 0000000..00c8604 --- /dev/null +++ b/app/common/defaults/Routes.php @@ -0,0 +1,21 @@ +", ['class' => 'nav-link']); + Output::addOnSubmenu('config', '/defaults', "Padrões", "", ['class' => 'nav-link']); +}, -10)->doIgnore(); + +RouteCollection::group("/defaults", function(){ + RouteCollection::get ("/", "\App\Common\Defaults\DefaultsController@index"); + RouteCollection::get ("/form", "\App\Common\Defaults\DefaultsController@create"); + RouteCollection::post ("/", "\App\Common\Defaults\DefaultsController@store"); + RouteCollection::post ("/search", "\App\Common\Defaults\DefaultsController@search"); + RouteCollection::get ("/[i:id]", "\App\Common\Defaults\DefaultsController@show"); + RouteCollection::get ("/[i:id]/edit", "\App\Common\Defaults\DefaultsController@edit"); + RouteCollection::put ("/[i:id]/edit", "\App\Common\Defaults\DefaultsController@update"); + RouteCollection::delete("/[i:id]", "\App\Common\Defaults\DefaultsController@destroy"); +}); \ No newline at end of file diff --git a/app/common/defaults/classes/Defaults.php b/app/common/defaults/classes/Defaults.php new file mode 100644 index 0000000..829a223 --- /dev/null +++ b/app/common/defaults/classes/Defaults.php @@ -0,0 +1,14 @@ +addColumn("module", "string", Array("null" => true)); + $table->addColumn("table", "string", Array("null" => true)); + $table->addColumn("key", "string", Array("null" => false)); + $table->addColumn("value", "string", Array("null" => false)); + $table->create(); + + $table = Wrapper::get_table("common_user_defaults"); + $table->addColumn("user_id", "integer", Array("null" => false)); + $table->addColumn("module", "string", Array("null" => true)); + $table->addColumn("table", "string", Array("null" => true)); + $table->addColumn("key", "string", Array("null" => false)); + $table->addColumn("value", "string", Array("null" => false)); + $table->addForeignKey('user_id', Wrapper::get_table('core_auth_user')); + + Migrator::getInstance()->update_plugin_version("common_defaults", "1.0.0"); + return; + } + + //if ($pluginversion < "0.0.2") { + //$table = Wrapper::get_table("common_defaultss"); + //Migrator::getInstance()->update_plugin_version("common_defaults", "1.0.1"); + //return; + //} +} + +function common_defaults_rollback($pluginversion) { + if($pluginversion > "0.0.1"){ + $table = Wrapper::get_table("common_defaultss"); + $table->drop(); + return; + } +} \ No newline at end of file diff --git a/app/common/defaults/lang/en.php b/app/common/defaults/lang/en.php new file mode 100644 index 0000000..1ae0a04 --- /dev/null +++ b/app/common/defaults/lang/en.php @@ -0,0 +1,2 @@ +name = "common_defaults"; +$plugin->version = "0.0.0"; + +$plugin->require = Array( + Array("name" => "core_auth", "version" => "1.0.0") +); \ No newline at end of file diff --git a/app/common/defaults/views/form.mustache b/app/common/defaults/views/form.mustache new file mode 100644 index 0000000..f679953 --- /dev/null +++ b/app/common/defaults/views/form.mustache @@ -0,0 +1,10 @@ +{{@ if( {{id}} ): @}} +
+ + +{{@ else: @}} + + +{{@ endif; @}} + +
\ No newline at end of file diff --git a/app/common/defaults/views/index.mustache b/app/common/defaults/views/index.mustache new file mode 100644 index 0000000..33e5d57 --- /dev/null +++ b/app/common/defaults/views/index.mustache @@ -0,0 +1,4 @@ +Adicionar +
+ +
\ No newline at end of file diff --git a/app/common/email/EmailController.php b/app/common/email/EmailController.php new file mode 100644 index 0000000..043adac --- /dev/null +++ b/app/common/email/EmailController.php @@ -0,0 +1,136 @@ +SMTPDebug = SMTP::DEBUG_SERVER; // for detailed debug output + $mail->isSMTP(); + $mail->Host = 'smtp.gmail.com'; + $mail->SMTPAuth = true; + $mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS; + $mail->Port = 587; + + $mail->Username = 'ahwelp@universo.univates.br'; + $mail->Password = '********'; + + // Sender and recipient settings + $mail->setFrom('ahwelp@universo.univates.br', 'Sender Name'); + $mail->addAddress('ahwelp@univates.br', 'Receiver Name'); + $mail->addReplyTo('ahwelp@universo.univates.br', 'Sender Name'); + + // Setting the email content + $mail->IsHTML(true); + $mail->Subject = "Send email using Gmail SMTP and PHPMailer"; + $mail->Body = 'HTML message body. Gmail SMTP email body.'; + $mail->AltBody = 'Plain text message body for non-HTML email client. Gmail SMTP email body.'; + + $mail->send(); + echo "Email message sent.";*/ + } + + /** + * Create + * + * Render the main Email formulary + */ + function create() + { + Output::render('form', ['id' => 0]); + } + + /** + * Store + * + * Store the param on the database + * @param Email $email + */ + function store(Email $email) + { + } + + /** + * Search + * + * Store the param on the database + * @param Email $email + */ + function search() + { + } + + /** + * Show + * + * Render one register + * + * @param Email $email + */ + function show(Email $email) + { + } + + /** + * Edit + * + * Render the formular for a database Email + * + * @param Email $email + */ + function edit(Email $email) + { + Output::render('form', $email); + } + + /** + * Update + * Store the changes of the param on the database + * + * @param Email $email + */ + function update(Email $email) + { + } + + /** + * Destroy + * If the object has soft delete. + * + * @param Email $email + */ + function destroy(Email $email) + { + } + + /** + * Purge + * Remove object even with soft delete. + * + * @param Email $email + */ + function purge(Email $email) + { + } +} diff --git a/app/common/email/EmailTemplateController.php b/app/common/email/EmailTemplateController.php new file mode 100644 index 0000000..8225922 --- /dev/null +++ b/app/common/email/EmailTemplateController.php @@ -0,0 +1,107 @@ + 0]); + } + + /** + * Store + * + * Store the param on the database + * @param Email $email + */ + function store(Email $email) + { + var_dump($email); + } + + /** + * Search + * + * Store the param on the database + * @param Email $email + */ + function search() + { + } + + /** + * Show + * + * Render one register + * + * @param Email $email + */ + function show(Email $email) + { + } + + /** + * Edit + * + * Render the formular for a database Email + * + * @param Email $email + */ + function edit(Email $email) + { + Output::render('form', $email); + } + + /** + * Update + * Store the changes of the param on the database + * + * @param Email $email + */ + function update(Email $email) + { + } + + /** + * Destroy + * If the object has soft delete. + * + * @param Email $email + */ + function destroy(Email $email) + { + } + + /** + * Purge + * Remove object even with soft delete. + * + * @param Email $email + */ + function purge(Email $email) + { + } +} diff --git a/app/common/email/Routes.php b/app/common/email/Routes.php new file mode 100644 index 0000000..23057ab --- /dev/null +++ b/app/common/email/Routes.php @@ -0,0 +1,28 @@ + 'nav-link']); +}, -10)->doIgnore(); + +RouteCollection::group("/email", function(){ + RouteCollection::get ("/", "\App\Common\Email\EmailController@index"); + RouteCollection::get ("/form", "\App\Common\Email\EmailController@create"); + RouteCollection::post ("/", "\App\Common\Email\EmailController@store"); + RouteCollection::post ("/search", "\App\Common\Email\EmailController@search"); + RouteCollection::get ("/[i:id]", "\App\Common\Email\EmailController@show"); + RouteCollection::get ("/[i:id]/edit", "\App\Common\Email\EmailController@edit"); + RouteCollection::put ("/[i:id]/edit", "\App\Common\Email\EmailController@update"); + RouteCollection::delete("/[i:id]", "\App\Common\Email\EmailController@destroy"); + + //RouteCollection::get ("/template", "\App\Common\Email\EmailTemplateController@index"); + RouteCollection::get ("/template/form", "\App\Common\Email\EmailTemplateController@create"); + RouteCollection::post ("/template", "\App\Common\Email\EmailTemplateController@store"); + RouteCollection::get ("/template/[i:id]", "\App\Common\Email\EmailTemplateController@show"); + RouteCollection::get ("/template/[i:id]/edit", "\App\Common\Email\EmailTemplateController@edit"); + RouteCollection::put ("/template/[i:id]/edit", "\App\Common\Email\EmailTemplateController@update"); + +}); \ No newline at end of file diff --git a/app/common/email/classes/Email.php b/app/common/email/classes/Email.php new file mode 100644 index 0000000..d61bfef --- /dev/null +++ b/app/common/email/classes/Email.php @@ -0,0 +1,49 @@ + "", "min" => 0, "max" => 100000, "step" => 2); + + const _tableName = "emails"; + + /*const _properties = Array( + "id" => ['listable' => true, 'searcheble' => false, 'orderable' => false], + "name" => ['listable' => true, 'searcheble' => true]); + */ + + const _properties = Array( + 'id', + 'name', + 'description' + ); + + /*protected $_ignore = Array( + + );*/ + + const _listable = Array( + 'id', + 'name' + ); + + const _searchable = Array( + 'name' + ); + + const _orderable = Array( + + ); + + /*const _datatables = Array( + + );*/ + + //const _timestamps = true; + //const _softdelete = true; + + //const _connectionName = ""; +} \ No newline at end of file diff --git a/app/common/email/classes/EmailsCongifs.php b/app/common/email/classes/EmailsCongifs.php new file mode 100644 index 0000000..692c2b4 --- /dev/null +++ b/app/common/email/classes/EmailsCongifs.php @@ -0,0 +1,19 @@ +addColumn("name", "string", Array("null" => false)); + $table->addColumn("smtphosts", "string", Array("null" => false)); + $table->addColumn("smtpsecure", "integer", Array("null" => false, "default" => 0)); + $table->addColumn("smtpauthtype", "integer", Array("null" => false, "default" => 0)); + $table->addColumn("smtpuser", "string", Array("null" => false)); + $table->addColumn("smtppass", "string", Array("null" => false)); + $table->addColumn("smtpmaxbulk", "integer", Array("null" => false, "default" => 1)); + $table->addColumn("noreplyaddress", "string", Array("null" => false, "default" => '')); + $table->addColumn("sitemailcharset", "string", Array("null" => false, "default" => 'UTF-8')); + $table->addTimestamps(); + $table->addSoftDelete(); + $table->create(); + + $table = Wrapper::get_table("common_emails_templates"); + $table->addColumn("name", "string", Array("null" => false)); + $table->addColumn("title", "string", Array("null" => false)); + $table->addColumn("body", "text"); + $table->addTimestamps(); + $table->addSoftDelete(); + $table->create(); + + $table = Wrapper::get_table("common_emails"); + $table->addColumn("name", "string", Array("null" => false)); + $table->addColumn("template", "integer", Array()); + $table->addColumn("title", "text"); + $table->addColumn("body", "text"); + $table->addColumn("timesent", "timestamp", Array()); + $table->create(); + + Migrator::getInstance()->update_plugin_version("common_email", "1.0.0"); + return; + } + + //if ($pluginversion < "0.0.2") { + //$table = Wrapper::get_table("common_emails"); + //Migrator::getInstance()->update_plugin_version("common_email", "1.0.1"); + //return; + //} +} + +function common_email_rollback($pluginversion) { + if($pluginversion > "0.0.1"){ + $table = Wrapper::get_table("common_emails"); + $table->drop(); + return; + } +} \ No newline at end of file diff --git a/app/common/email/lang/en.php b/app/common/email/lang/en.php new file mode 100644 index 0000000..196bb04 --- /dev/null +++ b/app/common/email/lang/en.php @@ -0,0 +1,2 @@ +name = "common_email"; +$plugin->version = "0.0.0"; + +//$plugin->require = Array( ["name" => "plugin_name", "version" => "x.x.x"] ); \ No newline at end of file diff --git a/app/common/email/views/form.mustache b/app/common/email/views/form.mustache new file mode 100644 index 0000000..1ff3bcc --- /dev/null +++ b/app/common/email/views/form.mustache @@ -0,0 +1,62 @@ +{{#id}} +
+ + +{{/id}} +{{^id}} + + +{{/id}} +
+
+
+
Header
+
+
+
+ + +
+
+ + +
+
+ +
+
+ + +
+
+
+
+
+
+
+
+
+
Header
+
+
+
+ + +
+
+ + +
+
+ +
+
+ + +
+
+
+
+
+
+
\ No newline at end of file diff --git a/app/common/email/views/index.mustache b/app/common/email/views/index.mustache new file mode 100644 index 0000000..43cc679 --- /dev/null +++ b/app/common/email/views/index.mustache @@ -0,0 +1,2 @@ + Adicionar modelo + Adicionar configuração \ No newline at end of file diff --git a/app/common/email/views/templateForm.mustache b/app/common/email/views/templateForm.mustache new file mode 100644 index 0000000..c7fe09c --- /dev/null +++ b/app/common/email/views/templateForm.mustache @@ -0,0 +1,48 @@ +

{{#string}} emailTemplates,email {{/string}}

+ +{{#id}} +
+ + +{{/id}} +{{^id}} + + +{{/id}} +
+
+
+
Header
+
+
+
+ + +
+
+ + +
+
+ +
+
+ + +
+
+
+
+
+
+
+
+
+ +
+ +
+ + \ No newline at end of file diff --git a/app/common/files/FilesController.php b/app/common/files/FilesController.php new file mode 100644 index 0000000..7fcdbf9 --- /dev/null +++ b/app/common/files/FilesController.php @@ -0,0 +1,111 @@ + 0]); + Output::render(); + } + + /** + * Store + * + * Store the param on the database + * @param Files $files + */ + function store(Files $files){ + + } + + /** + * Search + * + * Store the param on the database + * @param Files $files + */ + function search(){ + + } + + /** + * Show + * + * Render one register + * + * @param Files $files + */ + function show(Files $files){ + + } + + /** + * Edit + * + * Render the formular for a database Files + * + * @param Files $files + */ + function edit(Files $files){ + Output::setView('form', $files); + Output::render(); + } + + /** + * Update + * Store the changes of the param on the database + * + * @param Files $files + */ + function update(Files $files){ + + } + + /** + * Destroy + * If the object has soft delete. + * + * @param Files $files + */ + function destroy(Files $files){ + + } + + /** + * Purge + * Remove object even with soft delete. + * + * @param Files $files + */ + function purge(Files $files){ + + } +} \ No newline at end of file diff --git a/app/common/files/Routes.php b/app/common/files/Routes.php new file mode 100644 index 0000000..1eec323 --- /dev/null +++ b/app/common/files/Routes.php @@ -0,0 +1,16 @@ + 'nav-link']); +}, -10)->doIgnore(); + +RouteCollection::group("/files", function(){ + RouteCollection::post ("/", "\App\Common\Files\FilesController@store"); + RouteCollection::get ("/[i:id]", "\App\Common\Files\FilesController@show"); + RouteCollection::put ("/[i:id]/edit", "\App\Common\Files\FilesController@update"); + RouteCollection::delete("/[i:id]", "\App\Common\Files\FilesController@destroy"); +}); \ No newline at end of file diff --git a/app/common/files/classes/Files.php b/app/common/files/classes/Files.php new file mode 100644 index 0000000..200b557 --- /dev/null +++ b/app/common/files/classes/Files.php @@ -0,0 +1,21 @@ + "", "min" => 0, "max" => 100000, "step" => 2); + + const _tableName = "filess"; + /*const _properties = Array( + "id" => ['listable' => true, 'searcheble' => false, 'orderable' => false], + "name" => ['listable' => true, 'searcheble' => true]); + */ + + //const _timestamps = true; + //const _softdelete = true; + + //const _connectionName = ""; +} \ No newline at end of file diff --git a/app/common/files/db/Migrate.php b/app/common/files/db/Migrate.php new file mode 100644 index 0000000..60a4f37 --- /dev/null +++ b/app/common/files/db/Migrate.php @@ -0,0 +1,33 @@ +addColumn("name", "string", Array("null" => false)); + $table->addColumn("time", "timestamp", Array("null" => true, "default"=>null)); + $table->addColumn("areaid", "integer", Array("null" => false)); + $table->addTimestamps(); + $table->addSoftDelete(); + $table->create(); + + Migrator::getInstance()->update_plugin_version("common_files", "1.0.0"); + return; + } + + //if ($pluginversion < "0.0.2") { + //$table = Wrapper::get_table("common_filess"); + //Migrator::getInstance()->update_plugin_version("common_files", "1.0.1"); + //return; + //} +} + +function common_files_rollback($pluginversion) { + if($pluginversion > "0.0.1"){ + $table = Wrapper::get_table("common_filess"); + $table->drop(); + return; + } +} \ No newline at end of file diff --git a/app/common/files/lang/en.php b/app/common/files/lang/en.php new file mode 100644 index 0000000..ccffaa5 --- /dev/null +++ b/app/common/files/lang/en.php @@ -0,0 +1,2 @@ +name = "common_files"; +$plugin->version = "0.0.0"; + +//$plugin->require = Array( ["name" => "plugin_name", "version" => "x.x.x"] ); \ No newline at end of file diff --git a/app/common/files/views/form.mustache b/app/common/files/views/form.mustache new file mode 100644 index 0000000..cbe6141 --- /dev/null +++ b/app/common/files/views/form.mustache @@ -0,0 +1,10 @@ +{{@ if( {{id}} ): @}} +
+ + +{{@ else: @}} + + +{{@ endif; @}} + +
\ No newline at end of file diff --git a/app/common/files/views/index.mustache b/app/common/files/views/index.mustache new file mode 100644 index 0000000..41f7988 --- /dev/null +++ b/app/common/files/views/index.mustache @@ -0,0 +1,4 @@ +Adicionar +
+ +
\ No newline at end of file diff --git a/app/common/glossary/GlossaryController.php b/app/common/glossary/GlossaryController.php new file mode 100644 index 0000000..afabe1b --- /dev/null +++ b/app/common/glossary/GlossaryController.php @@ -0,0 +1,111 @@ + $list)); + } + + /** + * Create + * + * Render the main Glossary formulary + */ + function create(){ + Output::render('form', ['id' => 0]); + } + + /** + * Store + * + * Store the param on the database + * @param Glossary $glossary + */ + function store(Glossary $glossary){ + + } + + /** + * Search + * + * Store the param on the database + * @param Glossary $glossary + */ + function search(){ + + } + + /** + * Show + * + * Render one register + * + * @param Glossary $glossary + */ + function show(Glossary $glossary){ + + } + + /** + * Edit + * + * Render the formular for a database Glossary + * + * @param Glossary $glossary + */ + function edit(Glossary $glossary){ + Output::render('form', $glossary); + } + + /** + * Update + * Store the changes of the param on the database + * + * @param Glossary $glossary + */ + function update(Glossary $glossary){ + + } + + /** + * Destroy + * If the object has soft delete. + * + * @param Glossary $glossary + */ + function destroy(Glossary $glossary){ + + } + + /** + * Purge + * Remove object even with soft delete. + * + * @param Glossary $glossary + */ + function purge(Glossary $glossary){ + + } +} \ No newline at end of file diff --git a/app/common/glossary/Routes.php b/app/common/glossary/Routes.php new file mode 100644 index 0000000..ed9e5b8 --- /dev/null +++ b/app/common/glossary/Routes.php @@ -0,0 +1,22 @@ + 'nav-link']); +}, -10)->doIgnore(); + +RouteCollection::group("/glossary", function(){ + RouteCollection::get ("/", "\App\Common\Glossary\GlossaryController@index"); + RouteCollection::get ("/table", "\App\Common\Glossary\GlossaryController@table"); + RouteCollection::post ("/table", "\App\Common\Glossary\GlossaryController@searchTable"); + RouteCollection::get ("/form", "\App\Common\Glossary\GlossaryController@create"); + RouteCollection::post ("/", "\App\Common\Glossary\GlossaryController@store"); + RouteCollection::post ("/search", "\App\Common\Glossary\GlossaryController@search"); + RouteCollection::get ("/[i:id]", "\App\Common\Glossary\GlossaryController@show"); + RouteCollection::get ("/[i:id]/edit", "\App\Common\Glossary\GlossaryController@edit"); + RouteCollection::put ("/[i:id]/edit", "\App\Common\Glossary\GlossaryController@update"); + RouteCollection::delete("/[i:id]", "\App\Common\Glossary\GlossaryController@destroy"); +}); \ No newline at end of file diff --git a/app/common/glossary/classes/Glossary.php b/app/common/glossary/classes/Glossary.php new file mode 100644 index 0000000..e504d61 --- /dev/null +++ b/app/common/glossary/classes/Glossary.php @@ -0,0 +1,49 @@ + "", "min" => 0, "max" => 100000, "step" => 2); + + const _tableName = "glossarys"; + + /*const _properties = Array( + "id" => ['listable' => true, 'searcheble' => false, 'orderable' => false], + "name" => ['listable' => true, 'searcheble' => true]); + */ + + const _properties = Array( + 'id', + 'name', + 'description' + ); + + /*protected $_ignore = Array( + + );*/ + + const _listable = Array( + 'id', + 'name' + ); + + const _searchable = Array( + 'name' + ); + + const _orderable = Array( + + ); + + /*const _datatables = Array( + + );*/ + + //const _timestamps = true; + //const _softdelete = true; + + //const _connectionName = ""; +} \ No newline at end of file diff --git a/app/common/glossary/db/Migrate.php b/app/common/glossary/db/Migrate.php new file mode 100644 index 0000000..77ae83c --- /dev/null +++ b/app/common/glossary/db/Migrate.php @@ -0,0 +1,36 @@ +addColumn("area_id", "integer", Array("null" => false)); + $table->addColumn("name", "string", Array("null" => false)); + $table->addColumn("description", "text", Array("null" => true)); + //$table->addColumn("time", "timestamp", Array("null" => true, "default"=>null)); + + $table->addTimestamps(); + $table->addSoftDelete(); + $table->create(); + + Migrator::getInstance()->update_plugin_version("common_glossary", "1.0.0"); + return; + } + + //if ($pluginversion < "0.0.2") { + //$table = Wrapper::get_table("common_glossarys"); + //Migrator::getInstance()->update_plugin_version("common_glossary", "1.0.1"); + //return; + //} +} + +function common_glossary_rollback($pluginversion) { + if($pluginversion > "0.0.1"){ + $table = Wrapper::get_table("common_glossarys"); + $table->drop(); + return; + } +} \ No newline at end of file diff --git a/app/common/glossary/lang/en.php b/app/common/glossary/lang/en.php new file mode 100644 index 0000000..ab1e9c0 --- /dev/null +++ b/app/common/glossary/lang/en.php @@ -0,0 +1,2 @@ +name = "common_glossary"; +$plugin->version = "0.0.0"; + +//$plugin->require = Array( ["name" => "plugin_name", "version" => "x.x.x"] ); \ No newline at end of file diff --git a/app/common/glossary/views/form.mustache b/app/common/glossary/views/form.mustache new file mode 100644 index 0000000..b3ec86e --- /dev/null +++ b/app/common/glossary/views/form.mustache @@ -0,0 +1,86 @@ +{{#id}} +
+ + +{{/id}} +{{^id}} + + +{{/id}} +
+
+
+
Header
+
+
+
+ + +
+
+ + +
+
+ +
+
+ + +
+
+
+
+
+
+
+
Header
+
+
+
+ + +
+
+ + +
+
+ +
+
+ + +
+
+
+
+
+
+
+
+
+
Header
+
+
+
+ + +
+
+ + +
+
+ +
+
+ + +
+
+
+
+
+
+
\ No newline at end of file diff --git a/app/common/glossary/views/index.mustache b/app/common/glossary/views/index.mustache new file mode 100644 index 0000000..003595c --- /dev/null +++ b/app/common/glossary/views/index.mustache @@ -0,0 +1,2 @@ +Adicionar +
\ No newline at end of file