adjusting the front end output for the trail data, adding default data to the create
database script
'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',
'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'
),
.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
--- /dev/null
+.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
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();
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 '<pre>', print_r($trail_reports), '</pre>';
+ $view_file = 'list';
switch ($option) {
case "edit":
// 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
);
-- 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)
);
----
-- 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
<a href="{$thisUrl}?page={$thisPage}&glm_action=index" class="button button-secondary glm-button glm-right">Return to Reports List</a>
{if $option == 'edit' || $option == 'update'}
- <a href="{$thisUrl}?page={$thisPage}&glm_action=index&option=delete&report={$report.fieldData.id}" id="deleteObitButton" class="button button-secondary glm-button glm-right">Delete this Report</a>
+ <a id="deleteReportButton" class="button button-secondary glm-button glm-right">Delete this Report</a>
<h2>Edit Trail Report
{else}
<h2>Add New Trail Report
</h2>
<table id="glm-table-descr" class="glm-admin-table glm-report-table">
+ <tr>
+ <th {if $report.fieldRequired.report_active}class="glm-required"{/if}>Report Active:</th>
+ <td {if $report.fieldFail.report_active}class="glm-form-bad-input" data-tabid="glm-report-descr"{/if}>
+ <input type="checkbox" name="report_active" class="" {if $report.fieldData.report_active.value == 1} checked="checked" {/if}>
+ {if $report.fieldFail.report_active}<p>{$report.fieldFail.report_active}</p>{/if}<br>
+ </td>
+ </tr>
<tr>
<th {if $report.fieldRequired.report_date}class="glm-required"{/if}>Report Date:</th>
<td {if $report.fieldFail.report_date}class="glm-form-bad-input" data-tabid="glm-report-descr"{/if}>
<div id="deleteReportDialog" class="glm-dialog-box" title="Delete Obit">
<center>
<p><a id="deleteReportCancel" class="button button-primary">Cancel</a></p>
- <p><input id="deleteObitSubmit" type="submit" value="Delete this report"></p>
+ <p><input id="deleteReportSubmit" type="submit" value="Delete this report"></p>
</center>
<div class="glm-item-container">
<p><center><span class="glm-error">WARNING:</span></center></p>
$("#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}
<div id="tabs-2">
+ <div class="trail-label">Trail Name </div>
+ <input type="text" class="trail-name" name="alston_name" value="{$report.fieldData.alston_name}">
<div id="alston-conditions" class="trail-conditions">
{$a_con = $report.fieldData.alston_cond}
<div class="condition-label"> Conditions</div>
<div id="tabs-1">
+ <div class="trail-label">Trail Name </div>
+ <input type="text" class="trail-name" name="big_bay_name" value="{$report.fieldData.big_bay_name}">
<div id="bay-conditions trail-conditions" class="trail-conditions">
<div class="condition-label"> Conditions</div>
{$b_con = $report.fieldData.big_bay_cond}
<div id="tabs-4">
+ <div class="trail-label">Trail Name </div>
+ <input type="text" class="trail-name" name="chassell_name" value="{$report.fieldData.chassell_name}">
<div id="chassell-conditions" class="trail-conditions">
{$c_con = $report.fieldData.chassell_cond}
<div class="condition-label"> Conditions</div>
<div id="tabs-3">
+ <div class="trail-label">Trail Name </div>
+ <input type="text" class="trail-name" name="nestoria_name" value="{$report.fieldData.pinery_name}">
<div id="nestoria-conditions" class="trail-conditions">
<div class="condition-label"> Conditions</div>
{$n_con = $report.fieldData.nestoria_cond}
<input type="radio" name="pinery_cond" value="Good"> Good
<input type="radio" name="pinery_cond" value="Very Good"> Very Good
</div>-->
-<div class="groom-date-label">Date Groomed</div>
+ <div class="trail-label">Trail Name </div>
+ <input type="text" class="trail-name" name="pinery_name" value="{$report.fieldData.pinery_name}">
+ <div class="groom-date-label">Date Groomed</div>
<input type="text" class="groom-date" name="pinery_groom" value="{$report.fieldData.pinery_groom.date}">
<div class="snow-base-label">Snow Base</div>
<input type="text" class="snow-base" name="pinery_base" value="{$report.fieldData.pinery_base|escape:html}">
+{foreach $trailData as $key=>$value}
+ {foreach $value as $id=>$trail}
+ {if $trail.report_info.report_active.value == 1}
+ <div id='trail-report-{$id}' class="trail-report">
+ <div class='trail-info'>
+ <span class='report-date'> Report Date: {$trail.report_info.report_date.date|date_format:"%B %e, %Y"}
+ <p class='report-notes'> {$trail.report_info.report_notes}</p>
+ </div>
+ <div class="trail-info">
+ <div class="glm-row trail-row">
+ {include file='front/trailreports/parts/bigBay.html'}
+ </div>
+ <div class="glm-row trail-row">
+ {include file='front/trailreports/parts/alston.html'}
+ </div>
+ <div class="glm-row trail-row">
+ {include file='front/trailreports/parts/nestoria.html'}
+ </div>
+ <div class="glm-row trail-row">
+ {include file='front/trailreports/parts/chassell.html'}
+ </div>
+ <div class="glm-row trail-row">
+ {include file='front/trailreports/parts/pinery.html'}
+ </div>
+ </div>
+ </div>
+ {else}
+ No Active Trail Reports
+ {/if}
+
+ {/foreach}
+{/foreach}
\ No newline at end of file
--- /dev/null
+<h5 class="trail-name-front">{$trail.trail_info.alston_name}</h5>
+<div class="glm-small-12 trail-data glm-medium-4 glm-columns"><span class="trail-data-label">Date Groomed:</span> {$trail.trail_info.alston_groom.date} </div>
+<div class="glm-small-12 trail-data glm-medium-4 glm-columns"><span class="trail-data-label">Conditions:</span> {$trail.trail_info.alston_cond}</div>
+<div class="glm-small-12 trail-data glm-medium-4 glm-columns"><span class="trail-data-label">Snow Base:</span> {$trail.trail_info.alston_base}</div>
+<div class="glm-small-12 trail-data trail-data-notes glm-columns"><span class="trail-data-label">Trail Notes:</span><br> {$trail.trail_info.alston_notes}</div>
--- /dev/null
+<h5 class="trail-name-front">{$trail.trail_info.big_bay_name}</h5>
+<div class="glm-small-12 trail-data glm-medium-4 glm-columns"><span class="trail-data-label">Date Groomed:</span> {$trail.trail_info.big_bay_groom.date}</div>
+<div class="glm-small-12 trail-data glm-medium-4 glm-columns"><span class="trail-data-label">Conditions:</span> {$trail.trail_info.big_bay_cond}</div>
+<div class="glm-small-12 trail-data glm-medium-4 glm-columns"><span class="trail-data-label">Snow Base:</span> {$trail.trail_info.big_bay_base}</div>
+<div class="glm-small-12 trail-data trail-data-notes glm-columns"><span class="trail-data-label">Trail Notes:</span><br> {$trail.trail_info.big_bay_notes}</div>
\ No newline at end of file
--- /dev/null
+<h5 class="trail-name-front">{$trail.trail_info.chassell_name}</h5>
+<div class="glm-small-12 trail-data glm-medium-4 glm-columns"><span class="trail-data-label">Date Groomed:</span> {$trail.trail_info.chassell_groom.date}</div>
+<div class="glm-small-12 trail-data glm-medium-4 glm-columns"><span class="trail-data-label">Conditions:</span> {$trail.trail_info.chassell_cond}</div>
+<div class="glm-small-12 trail-data glm-medium-4 glm-columns"><span class="trail-data-label">Snow Base:</span> {$trail.trail_info.chassell_base}</div>
+<div class="glm-small-12 trail-data trail-data-notes glm-columns"><span class="trail-data-label">Trail Notes:</span><br> {$trail.trail_info.chassell_notes}</div>
\ No newline at end of file
--- /dev/null
+<h5 class="trail-name-front">{$trail.trail_info.nestoria_name}</h5>
+<div class="glm-small-12 trail-data glm-medium-4 glm-columns"><span class="trail-data-label">Date Groomed:</span> {$trail.trail_info.nestoria_groom.date}</div>
+<div class="glm-small-12 trail-data glm-medium-4 glm-columns"><span class="trail-data-label">Conditions:</span> {$trail.trail_info.nestoria_cond}</div>
+<div class="glm-small-12 trail-data glm-medium-4 glm-columns"><span class="trail-data-label">Snow Base:</span> {$trail.trail_info.nestoria_base}</div>
+<div class="glm-small-12 trail-data-notes trail-data glm-columns"><span class="trail-data-label">Trail Notes:</span><br>{$trail.trail_info.nestoria_notes}</div>
\ No newline at end of file
--- /dev/null
+<h5 class="trail-name-front">{$trail.trail_info.pinery_name}</h5>
+<div class="glm-small-12 trail-data glm-medium-4 glm-columns"><span class="trail-data-label">Date Groomed:</span> {$trail.trail_info.pinery_groom.date}</div>
+<div class="glm-small-12 trail-data glm-medium-4 glm-columns"><span class="trail-data-label">Conditions:</span> {$trail.trail_info.pinery_cond}</div>
+<div class="glm-small-12 trail-data glm-medium-4 glm-columns"><span class="trail-data-label">Snow Base:</span> {$trail.trail_info.pinery_base}</div>
+<div class="glm-small-12 trail-data-notes trail-data glm-columns"><span class="trail-data-label">Trail Notes:</span><br> {$trail.trail_info.pinery_notes}</div>
\ No newline at end of file