-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feat/report_module_bootstrap' into feat/FinishNewDesign…
…sMigration
- Loading branch information
Showing
16 changed files
with
386 additions
and
207 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,28 @@ | ||
<?php | ||
|
||
function index_ALL(Web $w) { | ||
function index_ALL(Web $w) | ||
{ | ||
$connections = ReportService::getInstance($w)->getConnections(); | ||
$table_header = array("Driver", "Host", "Database", "Port", "Username", "Actions"); | ||
$table_body = array(); | ||
|
||
$table_header = ["Driver", "Host", "Database", "Port", "Username", "Actions"]; | ||
$table_body = []; | ||
if (!empty($connections)) { | ||
foreach($connections as $conn) { | ||
foreach ($connections as $conn) { | ||
$conn->decrypt(); | ||
$table_body[] = array( | ||
$conn->db_driver, $conn->db_host, $conn->db_database, $conn->db_port, $conn->s_db_user, | ||
Html::box("/report-connections/test/{$conn->id}", "Test Connection", true) . | ||
Html::box("/report-connections/edit/{$conn->id}", "Edit", true) . | ||
Html::b("/report-connections/delete/{$conn->id}", "Delete", "Are you sure you want to remove this connection?") | ||
); | ||
$table_body[] = [ | ||
$conn->db_driver, | ||
$conn->db_host, | ||
$conn->db_database, | ||
$conn->db_port, | ||
$conn->s_db_user, | ||
HtmlBootstrap5::buttonGroup( | ||
Html::box("/report-connections/test/{$conn->id}", "Test Connection", true) . | ||
Html::box("/report-connections/edit/{$conn->id}", "Edit", true) . | ||
Html::b("/report-connections/delete/{$conn->id}", "Delete", "Are you sure you want to remove this connection?", null, false, "btn-danger") | ||
) | ||
]; | ||
} | ||
} | ||
$w->ctx("connections_table", Html::table($table_body, null, "tablesorter", $table_header)); | ||
} | ||
|
||
$w->ctx("connections_table", HtmlBootstrap5::table($table_body, null, "tablesorter", $table_header)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,57 @@ | ||
<?php | ||
|
||
use Html\Form\InputField\Checkbox; | ||
use Html\Form\InputField\Hidden; | ||
use Html\Form\Select; | ||
|
||
// edit a member | ||
function editmember_GET(Web &$w) { | ||
$p = $w->pathMatch("repid","userid"); | ||
// get member details for edit | ||
$member = ReportService::getInstance($w)->getReportMember($p['repid'], $p['userid']); | ||
function editmember_GET(Web &$w) | ||
{ | ||
$p = $w->pathMatch("repid", "userid"); | ||
// get member details for edit | ||
$member = ReportService::getInstance($w)->getReportMember($p['repid'], $p['userid']); | ||
|
||
// build editable form for a member allowing change of membership type | ||
$f = Html::form(array( | ||
array("Member Details","section"), | ||
array("","hidden", "report_id",$p['repid']), | ||
array("Name","static", "name", ReportService::getInstance($w)->getUserById($member->user_id)), | ||
array("Role","select","role",$member->role,ReportService::getInstance($w)->getReportPermissions()), | ||
array("Is email recipient", "checkbox", "is_email_recipient", $member->is_email_recipient) | ||
),$w->localUrl("/report/editmember/".$p['userid']),"POST"," Update "); | ||
// build editable form for a member allowing change of membership type | ||
$f = HtmlBootstrap5::multiColForm([ | ||
"Edit Member" => [ | ||
[new Hidden([ | ||
"id|name" => "report_id", | ||
"value" => $p["id"] | ||
])], | ||
[ | ||
(new Select([ | ||
"id|name" => "member", | ||
"label" => "Member", | ||
"options" => [ReportService::getInstance($w)->getUserById($member->user_id)], | ||
"disabled" => true, | ||
])) | ||
->setSelectedOption(ReportService::getInstance($w)->getUserById($member->user_id)) | ||
], | ||
[ | ||
(new Select([ | ||
"id|name" => "role", | ||
"label" => "Role", | ||
"options" => ReportService::getInstance($w)->getReportPermissions() | ||
])) | ||
->setSelectedOption($member->role) | ||
], | ||
[new Checkbox(["id|name" => "is_email_recipient", "label" => "Is email recipient", "value" => $member->is_email_recipient])] | ||
] | ||
], $w->localUrl("/report/editmember/" . $p['userid']), "POST", " Update "); | ||
|
||
// display form | ||
$w->setLayout(null); | ||
$w->ctx("editmember",$f); | ||
// display form | ||
$w->setLayout(null); | ||
$w->ctx("editmember", $f); | ||
} | ||
|
||
function editmember_POST(Web &$w) { | ||
$p = $w->pathMatch("id"); | ||
$member = ReportService::getInstance($w)->getReportMember($_POST['report_id'], $p['id']); | ||
function editmember_POST(Web &$w) | ||
{ | ||
$p = $w->pathMatch("id"); | ||
$member = ReportService::getInstance($w)->getReportMember($_POST['report_id'], $p['id']); | ||
|
||
$member->fill($_POST); | ||
$member->is_email_recipient = intval(!empty($_POST['is_email_recipient'])); | ||
$member->update(); | ||
$member->fill($_POST); | ||
$member->is_email_recipient = intval(!empty($_POST['is_email_recipient'])); | ||
$member->update(); | ||
|
||
$w->msg("Member updated","/report/edit/".$_POST['report_id']."#members"); | ||
$w->msg("Member updated", "/report/edit/" . $_POST['report_id'] . "#members"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.