Commit af9e0f54 authored by Bernhard Baumrock's avatar Bernhard Baumrock
Browse files

Add new file

parent 8d7462c7
<?php
class ProcessSimple extends Process {
public static function getModuleinfo() {
return [
'title' => 'Custom Admin Page Example',
'summary' => 'Minimalistic ProcessModule to show that nobody has to be afraid of building custom admin pages.',
'author' => 'Bernhard Baumrock, baumrock.com',
'version' => 1,
// page that you want created to execute this module
'page' => [
'name' => 'yourname', // your page will be online at /youradmin/setup/yourname/
'title' => 'Hello', // page title for this admin-page
],
];
}
public function ___execute() {
$out = '<p>Hello World :)</p>';
$out .= '<p><a href="./mysecondpage" class="ui-button ui-state-default">Go to Page2</a></p>';
return $out;
}
public function ___executeMysecondpage() {
$out = '<p>Hello Page2 :)</p>';
$out .= '<p><a href="./" class="ui-button ui-state-default">Go to Page1</a></p>';
return $out;
}
public function ___executeTable() {
$out = '';
$table = $this->modules->get('MarkupAdminDataTable');
$table->headerRow(['A', 'B', 'C']);
$table->row([1, 2, 3]);
$table->row([4, 5, 6]);
$out .= $table->render();
if(!$this->wire->input->get('modal')) {
$button = $this->modules->get('InputfieldButton');
$button->value = 'Open Page in Panel';
$button->attr('data-href', './table');
$button->addClass('pw-panel');
$out .= $button->render();
}
return $out;
}
public function ___executeChart() {
$this->config->scripts->add('https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.7.1/Chart.bundle.min.js');
$this->config->scripts->add('http://www.chartjs.org/samples/latest/utils.js');
$this->config->scripts->add($this->config->urls->siteModules . $this->className() . '/chart.js');
$out = '<canvas id="canvas"></canvas><br>';
$buttons = [
'randomizeData' => 'Randomize Data',
'addDataset' => 'Add Dataset',
'addData' => 'Add Data',
'removeDataset' => 'Remove Dataset',
'removeData' => 'Remove Data',
];
$button = $this->modules->get('InputfieldButton');
$button->setSmall(true);
foreach($buttons as $id=>$label) {
$button->id = $id;
$button->value = $label;
$out .= $button->render();
}
return $out;
}
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment