From: Anthony Talarico Date: Mon, 31 Jul 2017 19:50:27 +0000 (-0400) Subject: adding individual sections for each of the trails, updating the database script X-Git-Tag: v1.0.0^2~7 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=dbdcaea70ae19b3b18e73349e8f1c459763c335a;p=WP-Plugins%2Fglm-member-db-trailreports.git adding individual sections for each of the trails, updating the database script adjusting the front end output for the trail data, adding default data to the create database script --- diff --git a/classes/data/dataTrailReports.php b/classes/data/dataTrailReports.php index c6b378c..09ebc51 100644 --- a/classes/data/dataTrailReports.php +++ b/classes/data/dataTrailReports.php @@ -136,6 +136,12 @@ class GlmDataTrailReports extends GlmDataAbstract 'view_only' => true, 'use' => 'a' ), + 'report_active' => array ( + 'field' => 'report_active', + 'type' => 'checkbox', + 'default' => false, + 'use' => 'a' + ), 'report_date' => array ( 'field' => 'report_date', 'type' => 'date', @@ -145,128 +151,164 @@ class GlmDataTrailReports extends GlmDataAbstract 'report_notes' => array ( 'field' => 'report_notes', 'type' => 'text', - 'required' => false, + 'required' => true, 'use' => 'a' ), 'big_bay_cond' => array ( 'field' => 'big_bay_cond', 'type' => 'text', - 'required' => false, + 'required' => true, + 'use' => 'a' + ), + 'big_bay_name' => array ( + 'field' => 'big_bay_name', + 'type' => 'text', + 'required' => true, 'use' => 'a' ), - 'big_bay_groom' => array ( 'field' => 'big_bay_groom', 'type' => 'date', - 'required' => false, + 'required' => true, 'use' => 'a' ), 'big_bay_base' => array ( 'field' => 'big_bay_base', 'type' => 'text', - 'required' => false, + 'required' => true, 'use' => 'a' ), 'big_bay_notes' => array ( 'field' => 'big_bay_notes', 'type' => 'text', - 'required' => false, + 'required' => true, + 'use' => 'a' + ), + 'alston_name' => array ( + 'field' => 'alston_name', + 'type' => 'text', + 'required' => true, 'use' => 'a' ), 'alston_cond' => array ( 'field' => 'alston_cond', 'type' => 'text', - 'required' => false, + 'required' => true, 'use' => 'a' ), 'alston_groom' => array ( 'field' => 'alston_groom', 'type' => 'date', - 'required' => false, + 'required' => true, 'use' => 'a' ), 'alston_base' => array ( 'field' => 'alston_base', 'type' => 'text', - 'required' => false, + 'required' => true, 'use' => 'a' ), 'alston_notes' => array ( 'field' => 'alston_notes', 'type' => 'text', - 'required' => false, + 'required' => true, 'use' => 'a' ), 'nestoria_cond' => array ( 'field' => 'nestoria_cond', 'type' => 'text', - 'required' => false, + 'required' => true, 'use' => 'a' ), + 'nestoria_name' => array ( + 'field' => 'nestoria_name', + 'type' => 'text', + 'required' => true, + 'use' => 'a' + ), + 'nestoria_groom' => array ( 'field' => 'nestoria_groom', 'type' => 'date', - 'required' => false, + 'required' => true, 'use' => 'a' ), 'nestoria_base' => array ( 'field' => 'nestoria_base', 'type' => 'text', - 'required' => false, + 'required' => true, 'use' => 'a' ), 'nestoria_notes' => array ( 'field' => 'nestoria_notes', 'type' => 'text', - 'required' => false, + 'required' => true, 'use' => 'a' ), 'chassell_cond' => array ( 'field' => 'chassell_cond', 'type' => 'text', - 'required' => false, + 'required' => true, + 'use' => 'a' + ), + 'chassell_name' => array ( + 'field' => 'chassell_name', + 'type' => 'text', + 'required' => true, 'use' => 'a' ), 'chassell_groom' => array ( 'field' => 'chassell_groom', 'type' => 'date', - 'required' => false, + 'required' => true, 'use' => 'a' ), 'chassell_base' => array ( 'field' => 'chassell_base', 'type' => 'text', - 'required' => false, + 'required' => true, 'use' => 'a' ), 'chassell_notes' => array ( 'field' => 'chassell_notes', 'type' => 'text', + 'required' => true, + 'use' => 'a' + ), + 'pinery_name' => array ( + 'field' => 'pinery_name', + 'type' => 'text', + 'required' => true, + 'use' => 'a' + ), + 'pinery_cond' => array ( + 'field' => 'pinery_cond', + 'type' => 'text', 'required' => false, 'use' => 'a' ), 'pinery_base' => array ( 'field' => 'pinery_base', 'type' => 'text', - 'required' => false, + 'required' => true, 'use' => 'a' ), 'pinery_notes' => array ( 'field' => 'pinery_notes', 'type' => 'text', - 'required' => false, + 'required' => true, 'use' => 'a' ), 'pinery_groom' => array ( 'field' => 'pinery_groom', 'type' => 'date', - 'required' => false, + 'required' => true, 'use' => 'a' ), 'report_blurb' => array ( 'field' => 'report_blurb', 'type' => 'text', - 'required' => false, + 'required' => true, 'use' => 'a' ), diff --git a/css/admin.css b/css/admin.css index dd6539d..787904f 100644 --- a/css/admin.css +++ b/css/admin.css @@ -5,19 +5,19 @@ .trail-notes{ height: 100px; } -.trail-conditions{ - margin-bottom: 20px; -} -.condition-label{ +.condition-label,.trail-label{ margin-bottom: 5px; } .ui-datepicker-trigger{ margin-left: 5px; position: absolute; } -.ui-tabs-panel .groom-date{ +.ui-tabs-panel .groom-date,.ui-tabs-panel .snow-base,.trail-conditions{ margin-bottom: 20px; } -.ui-tabs-panel .snow-base{ +.trail-name{ margin-bottom: 20px; +} +.no-padding{ + padding: 0 !important; } \ No newline at end of file diff --git a/css/front.css b/css/front.css new file mode 100644 index 0000000..17e281d --- /dev/null +++ b/css/front.css @@ -0,0 +1,22 @@ +.trail-data{ + padding: 0 5px; +} +.trail-data-notes{ + margin: 10px 0px; +} +.trail-data-label{ + font-weight: bold; +} +.trail-row{ + border-top: 1px solid #1e4178; + border-right: 1px solid #1e4178; + border-left: 1px solid #1e4178; +} +.trail-row:last-child{ + border-bottom: 1px solid #1e4178; + border-right: 1px solid #1e4178; + border-left: 1px solid #1e4178; +} +.trail-name-front{ + padding: 5px 0 0 5px; +} \ No newline at end of file diff --git a/models/admin/trailreports/index.php b/models/admin/trailreports/index.php index ce608fd..128527b 100644 --- a/models/admin/trailreports/index.php +++ b/models/admin/trailreports/index.php @@ -183,14 +183,16 @@ class GlmMembersAdmin_trailreports_index extends GlmDataTrailReports break; case 'delete': - - $report = $this->deleteObit($this->report_id); + echo "delte"; + $report = $this->deleteEntry($this->report_id,true); if ($report) { $reportDeleted = true; } else { $reportDeleteError = true; } + $view_file = "index"; + $trail_data = $this->getList(); break; default: $trail_data = $this->getList(); diff --git a/models/front/trailreports/list.php b/models/front/trailreports/list.php index c2ac892..a07fbe1 100644 --- a/models/front/trailreports/list.php +++ b/models/front/trailreports/list.php @@ -108,10 +108,21 @@ class GlmMembersFront_trailreports_list extends GlmDataTrailReports if (isset($_REQUEST['option']) && trim($_REQUEST['option']) != '') { $option = $_REQUEST['option']; } - - $trail_data = $this->getList(); - $view_file = 'index'; + $trail_reports = array(); + // separate the main report info and the individual details + $trail_data = $this->getList(); + foreach($trail_data as $id=>$record){ + foreach($record as $key=>$value){ + if(strpos($key, "report") !== false){ + $trail_reports['trail_report'][$id]['report_info'][$key] = $value; + } else { + $trail_reports['trail_report'][$id]['trail_info'][$key] = $value; + } + } + } +// echo '
', print_r($trail_reports), '
'; + $view_file = 'list'; switch ($option) { case "edit": @@ -128,14 +139,14 @@ class GlmMembersFront_trailreports_list extends GlmDataTrailReports // Compile template data $templateData = array( - 'trailData' => $trail_data + 'trailData' => $trail_reports ); // Return status, any suggested view, and any data to controller return array( 'status' => true, 'modelRedirect' => false, - 'view' => 'admin/trailreports/'.$view_file.'.html', + 'view' => 'front/trailreports/'.$view_file.'.html', 'data' => $templateData ); diff --git a/setup/databaseScripts/create_database_V0.0.1.sql b/setup/databaseScripts/create_database_V0.0.1.sql index d5814fb..1237383 100644 --- a/setup/databaseScripts/create_database_V0.0.1.sql +++ b/setup/databaseScripts/create_database_V0.0.1.sql @@ -14,27 +14,34 @@ -- Conditions Table CREATE TABLE {prefix}reports ( id INT NOT NULL AUTO_INCREMENT, + report_active BOOL NOT NULL, report_date DATE NOT NULL, report_notes TEXT NOT NULL, + big_bay_name TEXT NOT NULL, big_bay_cond TEXT NOT NULL, big_bay_groom DATE NOT NULL, big_bay_base TINYTEXT NOT NULL, big_bay_notes TEXT NOT NULL, alston_cond TEXT NOT NULL, + alston_name TEXT NOT NULL, alston_groom DATE NOT NULL, alston_base TINYTEXT NOT NULL, alston_notes TEXT NOT NULL, + nestoria_name TEXT NOT NULL, nestoria_cond TEXT NOT NULL, nestoria_groom DATE NOT NULL, nestoria_base TINYTEXT NOT NULL, nestoria_notes TEXT NOT NULL, + chassell_name TEXT NOT NULL, chassell_cond TEXT NOT NULL, chassell_groom DATE NOT NULL, chassell_base TINYTEXT NOT NULL, chassell_notes TEXT NOT NULL, + pinery_name TEXT NOT NULL, pinery_groom DATE NOT NULL, pinery_base TINYTEXT NOT NULL, pinery_notes TEXT NOT NULL, + pinery_cond TEXT NULL, report_blurb TEXT NOT NULL, PRIMARY KEY (id) ); @@ -42,5 +49,5 @@ CREATE TABLE {prefix}reports ( ---- -- Trail Reports default entries in table -INSERT INTO {prefix}reports ( id,report_date,report_notes,big_bay_cond,big_bay_groom,big_bay_base,big_bay_notes,alston_cond,alston_groom,alston_base,alston_notes,nestoria_cond,nestoria_groom,nestoria_base,nestoria_notes,chassell_cond,chassell_groom,chassell_base,chassell_notes,pinery_groom,pinery_base,pinery_notes,report_blurb) VALUES -(1,NOW(),'Trail Notes','Fair',NOW(),'8"-12"','Notes','Fair',NOW(),'8"-12"','Notes','Fair',NOW(),'8"-12"','Notes','Fair',NOW(),'8"-12"','Notes',NOW(),'8"-12"','Notes','Grooming'); \ No newline at end of file +INSERT INTO {prefix}reports ( id,report_date,report_notes,big_bay_name,big_bay_cond,big_bay_groom,big_bay_base,big_bay_notes,alston_name,alston_cond,alston_groom,alston_base,alston_notes,nestoria_name,nestoria_cond,nestoria_groom,nestoria_base,nestoria_notes,chassell_name,chassell_cond,chassell_groom,chassell_base,chassell_notes,pinery_name,pinery_groom,pinery_base,pinery_notes,pinery_cond,report_blurb) VALUES +(1,NOW(),'Trail Notes','Big Bay Trail','Fair',NOW(),'8"-12"','Notes','Alston Trail','Fair',NOW(),'8"-12"','Notes','Nestoria Trail','Fair',NOW(),'8"-12"','Notes','Chassell Trail','Fair',NOW(),'8"-12"','Notes','Pinery Trail',NOW(),'8"-12"','Notes','Poor','Grooming'); \ No newline at end of file diff --git a/views/admin/trailreports/edit.html b/views/admin/trailreports/edit.html index f0c5ab2..825e12c 100644 --- a/views/admin/trailreports/edit.html +++ b/views/admin/trailreports/edit.html @@ -5,7 +5,7 @@ Return to Reports List {if $option == 'edit' || $option == 'update'} - Delete this Report + Delete this Report

Edit Trail Report {else}

Add New Trail Report @@ -37,6 +37,13 @@

+ + + +
Report Active: + + {if $report.fieldFail.report_active}

{$report.fieldFail.report_active}

{/if}
+
Report Date: @@ -87,7 +94,7 @@

Cancel

-

+

WARNING:

@@ -128,7 +135,7 @@ $("#deleteReportDialog").dialog("close"); }); $('#deleteReportSubmit').click( function() { - window.location.replace("{$thisUrl}?page={$thisPage}&glm_action=list&option=delete&report={$report.fieldData.id}"); + window.location.replace("{$thisUrl}?page={$thisPage}&glm_action=index&option=delete&report={$report.fieldData.id}"); }); {/if} diff --git a/views/admin/trailreports/parts/alston.html b/views/admin/trailreports/parts/alston.html index 50589c5..6c84b04 100644 --- a/views/admin/trailreports/parts/alston.html +++ b/views/admin/trailreports/parts/alston.html @@ -1,4 +1,6 @@
+
Trail Name
+
{$a_con = $report.fieldData.alston_cond}
Conditions
diff --git a/views/admin/trailreports/parts/bigBay.html b/views/admin/trailreports/parts/bigBay.html index 17170b3..71a5d8b 100644 --- a/views/admin/trailreports/parts/bigBay.html +++ b/views/admin/trailreports/parts/bigBay.html @@ -1,4 +1,6 @@
+
Trail Name
+
Conditions
{$b_con = $report.fieldData.big_bay_cond} diff --git a/views/admin/trailreports/parts/chassell.html b/views/admin/trailreports/parts/chassell.html index b5f7fde..f2fbdf0 100644 --- a/views/admin/trailreports/parts/chassell.html +++ b/views/admin/trailreports/parts/chassell.html @@ -1,4 +1,6 @@
+
Trail Name
+
{$c_con = $report.fieldData.chassell_cond}
Conditions
diff --git a/views/admin/trailreports/parts/nestoria.html b/views/admin/trailreports/parts/nestoria.html index ea095d2..718cd9f 100644 --- a/views/admin/trailreports/parts/nestoria.html +++ b/views/admin/trailreports/parts/nestoria.html @@ -1,4 +1,6 @@
+
Trail Name
+
Conditions
{$n_con = $report.fieldData.nestoria_cond} diff --git a/views/admin/trailreports/parts/pinery.html b/views/admin/trailreports/parts/pinery.html index 789904d..362a51a 100644 --- a/views/admin/trailreports/parts/pinery.html +++ b/views/admin/trailreports/parts/pinery.html @@ -7,7 +7,9 @@ Good Very Good
--> -
Date Groomed
+
Trail Name
+ +
Date Groomed
Snow Base
diff --git a/views/front/trailreports/list.html b/views/front/trailreports/list.html index e69de29..d780bb2 100644 --- a/views/front/trailreports/list.html +++ b/views/front/trailreports/list.html @@ -0,0 +1,32 @@ +{foreach $trailData as $key=>$value} + {foreach $value as $id=>$trail} + {if $trail.report_info.report_active.value == 1} +
+
+ Report Date: {$trail.report_info.report_date.date|date_format:"%B %e, %Y"} +

{$trail.report_info.report_notes}

+
+
+
+ {include file='front/trailreports/parts/bigBay.html'} +
+
+ {include file='front/trailreports/parts/alston.html'} +
+
+ {include file='front/trailreports/parts/nestoria.html'} +
+
+ {include file='front/trailreports/parts/chassell.html'} +
+
+ {include file='front/trailreports/parts/pinery.html'} +
+
+
+ {else} + No Active Trail Reports + {/if} + + {/foreach} +{/foreach} \ No newline at end of file diff --git a/views/front/trailreports/parts/alston.html b/views/front/trailreports/parts/alston.html new file mode 100644 index 0000000..9f9660b --- /dev/null +++ b/views/front/trailreports/parts/alston.html @@ -0,0 +1,5 @@ +
{$trail.trail_info.alston_name}
+
Date Groomed: {$trail.trail_info.alston_groom.date}
+
Conditions: {$trail.trail_info.alston_cond}
+
Snow Base: {$trail.trail_info.alston_base}
+
Trail Notes:
{$trail.trail_info.alston_notes}
diff --git a/views/front/trailreports/parts/bigBay.html b/views/front/trailreports/parts/bigBay.html new file mode 100644 index 0000000..af372c0 --- /dev/null +++ b/views/front/trailreports/parts/bigBay.html @@ -0,0 +1,5 @@ +
{$trail.trail_info.big_bay_name}
+
Date Groomed: {$trail.trail_info.big_bay_groom.date}
+
Conditions: {$trail.trail_info.big_bay_cond}
+
Snow Base: {$trail.trail_info.big_bay_base}
+
Trail Notes:
{$trail.trail_info.big_bay_notes}
\ No newline at end of file diff --git a/views/front/trailreports/parts/chassell.html b/views/front/trailreports/parts/chassell.html new file mode 100644 index 0000000..fe43437 --- /dev/null +++ b/views/front/trailreports/parts/chassell.html @@ -0,0 +1,5 @@ +
{$trail.trail_info.chassell_name}
+
Date Groomed: {$trail.trail_info.chassell_groom.date}
+
Conditions: {$trail.trail_info.chassell_cond}
+
Snow Base: {$trail.trail_info.chassell_base}
+
Trail Notes:
{$trail.trail_info.chassell_notes}
\ No newline at end of file diff --git a/views/front/trailreports/parts/nestoria.html b/views/front/trailreports/parts/nestoria.html new file mode 100644 index 0000000..6f59c03 --- /dev/null +++ b/views/front/trailreports/parts/nestoria.html @@ -0,0 +1,5 @@ +
{$trail.trail_info.nestoria_name}
+
Date Groomed: {$trail.trail_info.nestoria_groom.date}
+
Conditions: {$trail.trail_info.nestoria_cond}
+
Snow Base: {$trail.trail_info.nestoria_base}
+
Trail Notes:
{$trail.trail_info.nestoria_notes}
\ No newline at end of file diff --git a/views/front/trailreports/parts/pinery.html b/views/front/trailreports/parts/pinery.html new file mode 100644 index 0000000..7d3b781 --- /dev/null +++ b/views/front/trailreports/parts/pinery.html @@ -0,0 +1,5 @@ +
{$trail.trail_info.pinery_name}
+
Date Groomed: {$trail.trail_info.pinery_groom.date}
+
Conditions: {$trail.trail_info.pinery_cond}
+
Snow Base: {$trail.trail_info.pinery_base}
+
Trail Notes:
{$trail.trail_info.pinery_notes}
\ No newline at end of file