Full Plugin

You are here:
< Back

<?php
/**
* Plugin template for ClinDATC Free/Plus Version 2.x
* Use this PHP template to create a plugin
* Author: Mike Goh, ClinDATC developer
* Last update: 2016-01-13
*/

/**
* Declare plugin variables
* Filename of main plugin file (.php) must be identical to directory name of plugin
* If main plugin filename is jquery-report.php; directory name must be jquery-report E.g. /jquery-report/jquery-report.php
* $plugin_id: UNIQUE identifier in ClinDATC plugin library
* plugin_menu: array("menu location"=>"menu name")
* "menu location" under MAIN menus: Questionnaires, Participants, Study
* "menu location" under TAB menus: Register New, Users & Groups, Tools, Settings, Developer Tools
* "menu name": short name (normally 1-3 words) in the menu that end-users see and click to open plugin
*/
$plugin_id = "report-generator";
$plugin_name = "Questionnaires Completion Report";
$plugin_description = "This plugin generates a report on the participants' completion of questionnaires. This report can be downloaded in CSV format by study coordinators.";
$plugin_version = "1.0";
$plugin_by = '<a href="http://yoursite.com/">Your name</a>';
$plugin_details = 'http://yoursite.com/report-generator-screenshot-preview.jpg';
$plugin_menu = array("Tools"=>"Generate Report");

/**
* INCLUDE external files in other pages (if plugin is to add features to other pages)
* include positions in a page: in_head, before_topNav, before_content, after_content
* If file extension is .css, Add <link rel="stylesheet" type="text/css" href="your-plugin.css"> in <head>
* If file extension is .js, Add <script src="first-plugin.js"></script> in <head>
* else include 'file-to-include.php' at include position
* <html>
* <head>
* "in_head" external files
* </head>
* <body>
* "before_topNav" external files
* [Top Nav]
* "before_content" external files
* [Content]
* "after_content" external files
* </body>
* </html>
* $plugin_includes = array(
*     "in_header"=>array("external-style.css"),
*     "before_topNav"=>array("file1.php", "file2.php"),
*     "before_content"=>array("file3.php"),
*     "after_content"=>array("file4.php"),
* );
*/
$plugin_includes = array(
   // files to include
);

/**
* INSERT codes between <head>(here)</head> OR in <body (here)> tag
* Write CSS internal style sheet or link external style sheet
* Write simple JavaScript/ jQuery functions or link external script
* $custom_head = '<style>body {background-color: blue;} h1 {margin-left: 40px;}</style>';
* $custom_head .= '<script>document.getElementById("demo").innerHTML = "My First JavaScript";</script>';
* $custom_body = 'style="font-size:24px; margin-top:10px;"';
*/
$custom_head = ''; // <head>(here)</head>
$custom_body = ''; // <body (here)>

get_header($plugin_name, $custom_head, $custom_body); // REQUIRED (but can redefine $plugin_name to other)
get_topNav($login); // REQUIRED (unless skip top nav display e.g. for more view space)

/**
* Action on <form> submit
*/
if (isset($_POST['submit'])) {
    //...
    //...
}
?>

<div id="content" class="container"><!-- container -->

<!-- Page header -->
<div class="page-header">
<h2><?php echo $plugin_name; ?></h2>
</div>

<!-- Tab nav -->
<?php echo tools_tabs_nav(); ?>
<br><!-- line break between tab nav and Bootstrap alerts -->

<!-- Generate report form -->
<form class="form-horizontal" method="post" action="?plugin=<?php echo $plugin_id; ?>">
//...
//...
</form>

</div><!-- container -->