Add modules to repository

This commit is contained in:
Sebastian Kinne
2017-11-16 16:42:22 +11:00
commit d0aa1e38ef
707 changed files with 96750 additions and 0 deletions

View File

@@ -0,0 +1,14 @@
<!-- This HTML has bootstrap classes such as "col-md-12" and "jumbotron". For more information, see http://getbootstrap.com/css/ -->
<!-- This HTML makes use of AngularJS data-bindings and controllers. For more information, see https://docs.angularjs.org/api/ -->
<!-- Don't forget to look at the module.js and module.php files too! -->
<!-- This HTML is a template for generated modules via the Module Maker. -->
<div class="col-md-12" ng-controller="ExampleController"> <!-- This special argument wires the HTML to your controller (in module.js) -->
<div class="jumbotron" style="border-radius: 7px;">
<div class="container">
<h1>{{ greeting }}</h1> <!-- This is an AngularJS data binding -->
<p>{{ content }}</p> <!-- They represent the $scope.xxxxx inside of your module.js -->
</div>
</div>
</div>

View File

@@ -0,0 +1,18 @@
/* This is our AngularJS controller, called "ExampleController". */
registerController('ExampleController', ['$api', '$scope', function($api, $scope) {
/* It is good practice to 'initialize' your variables with nothing */
$scope.greeting = "";
$scope.content = "";
/* Use the API to send a request to your module.php */
$api.request({
module: '_MODULE_NAME', //Your module name
action: 'getContents' //Your action defined in module.php
}, function(response) {
if (response.success === true) { //If the response has an index called "success" that returns the boolean "true", then:
$scope.greeting = response.greeting; // Set the variable $scope.greeting to the response index "greeting"
$scope.content = response.content; // Set the variable $scope.content to the response index "content".
}
console.log(response) //Log the response to the console, this is useful for debugging.
});
}]);

View File

@@ -0,0 +1,27 @@
<?php namespace pineapple;
/* The class name must be the name of your module, without spaces. */
/* It must also extend the "Module" class. This gives your module access to API functions */
class _MODULE_NAME extends Module
{
public function route()
{
switch ($this->request->action) {
case 'getContents': // If you request the action "getContents" from your Javascript, this is where the PHP will see it, and use the correct function
$this->getContents(); // $this->getContents(); refers to your private function that contains all of the code for your request.
break; // Break here, and add more cases after that for different requests.
}
}
private function getContents() // This is the function that will be executed when you send the request "getContents".
{
$this->response = array("success" => true, // define $this->response. We can use an array to set multiple responses.
"greeting" => "Hey there!",
"content" => "This is the HTML template for your new module! The example shows you the basics of using HTML, AngularJS and PHP to seamlessly pass information to and from Javascript and PHP and output it to HTML.");
}
}