Objective: Provide Support & Useful Information to Farmers Regarding - Grazing, Livestock, and Natural Disasters
Product name: Amazing Grazing
Start date: August 6th, 2020
End date: November 1st, 2020
Website: Amazing Grazing
Product video: Product Video @ Youtube
Repository: Github
Audience: Australian English speaking farmers age 30-45
- 1.0 Team members
- 2.0 Programming languages
- 3.0 Project description
- 4.0 Project iterations
- 5.0 Setup website
- 6.0 Configure identical parts of every page
- 7.0 Configure index.php page
- 8.0 Configure livestock-statistics.php page
- 9.0 Configure employment-statistics.php page
- 10.0 Configure techniques.php page
- 11.0 Configure drought.php page
- 12.0 Configure invasive-species.php page
- 13.0 Configure news.php page
- 14.0 Licence / Copyright
- Maxim Zaika
- Education: Bachelors in Computer Science & Masters in Business Information Systems
- Role in the team: leader, project manager, front-end & Back-end web developer, UX Designer
- Linkedin: https://www.linkedin.com/in/maxim-zaika
- Minjia Ji
- Education: Masters in Business Information Systems
- Role in the team: business analyst and researcher
- Chongyang Liu
- Education: Masters in Network & Security
- Role in the team: network & security and web developer
- Linkedin: https://www.linkedin.com/in/chongyang-liu/
- ChiHang Li
- Education: Masters in Information Systems
- Role in the team: web developer and data analyst
- Linkedin: https://www.linkedin.com/in/eric-li-02a2361ba
- HTML, PHP, JavaScript, jQuery, CSS, SCSS
- SQL (phpMyAdmin)
Responsive mobile website developed by the Monash University students for the 'FIT5120 Industry Experience Studio Project' unit based on the Bootstrap 4 platform. The root cause of the problem has been researched from scratch based on the information provided online. Developers tried their best to utilise copyright/royalty-free resources. No help was provided by anyone since this problem is relatively new in Australia. In total, the project consisted of 3 iterations in 3 months.
- Latest news regarding grazing, wildfires, drought, and livestock. These news’ are the latest possible and can be filtered based on the country and sorted by date. Few bugs are present here, which are fixed later on in iterations 2 and 3. To implement this feature GnewsAPI has been used.
- Grazing techniques that need to be avoided/utilized by the farmers. Animated images, developed by us, are provided with the quick bullet-point information. Users can read additional information regarding these techniques and can download brochures.
- Improvements: bug fixes of iteration 1. Iteration 1 content has no visible change due to not keeping track of this change.
- Livestock statistics page contains the facts regarding the current livestock situation in Australia based on the dataset retrieved from Australian Government Data.Gov.Au. Users are given the option to sort the analysis based on the livestock. Additionally, we have provided predictions of what is going to happen in the future (like years 2030-2060). On top of that, various fact calculations are done based on the data (like beef, milk, wool, etc. remaining). Additionally, the user can view the graph.
- Employment statistics show the current employment situation of farmers responsible for dairy or beef cattle, or sheep livestock. Employment numbers are shown by state. The highest qualification and age groups are provided. The datasets were retrieved from: Australian Government Joboutlook 1, Australian Government Joboutlook 2, and Australian Government Joboutlook 3. These datasets are represented using Tableau API. Additionally, analysis & URLs to various agricultural communities, where farmers can communicate with other farmers, are provided.
- Lots of improvements to iterations 1 and 2. Various bug fixes and UX improvements. Mobile version is completely user friendly now on both mobile and desktop devices.
- The drought page contains locations of drought based on the rainfall (mm). Users can learn what seasons are usually affected by drought. The dataset was retrieved from Australian Governement Bureau of Meteorology. Additionally, farmers can learn how drought impacts grassland, what the government does to assist them (with URLs to government dedicated websites), and what they can do to protect themselves.
- The invasive species page contains various species (plants & animals). Farmers can know what impact do these species have on grassland and their livestock. Additionally, farmers can learn preventative measures against them and what states in Australia are infested by these species. Plant and animal datasets were retrieved from WeedsAustralia and Australian Government Department of Agriculture, Water and the Environment. These datasets are represented using Tableau API. On top of that, users can download brochures of the preventative measures for their convenience.
Note: find additional documentation like ER Diagram, System Architecture, etc. in the ../readme/
folder.
- [Locally] Configure XAMPP Control Panel v3.2.4 (or any other alternative):
- Apache & MySQL must be configured within the XAMPP
- [Externally] Configure Amazon Web Server EC2
(or any other alternative) with LAMPP (or any other alternative):
- Apache & MySQL must be configured within the LAMPP
- Website files must be stored in any of the methods mentioned above:
- Download from GitHub: contact [email protected] to get access
- Download from Google Drive
- Following actions need to be taken to launch the website:
- Create the table
amazing-grazing
in your database - Add the
server_config.php
file to the main directory (if it is not there yet):<?php define("DB_SERVER", "add-server-ip-here"); define('DB_USERNAME', 'add-MySQL-username-here'); define('DB_PASSWORD', 'add-MySQL-password-here'); define('DB_NAME', 'add-table-from-MySQL-here'); $con = mysqli_connect(DB_SERVER, DB_USERNAME, DB_PASSWORD, DB_NAME); if ($con -> connect_error) { die("Connection failed: " . $con->connect_error); } ?>
- Modify
DB_SERVER
(server name),DB_USERNAME
(username to access the database),DB_PASSWORD
(password to access the database), andDB_NAME
(table name)
- Modify
- Go to
../db_backup/full_db_backup
. Importamazing-grazing.sql
file to MySQL database
- Create the table
- [Website can run without this step, but it becomes vulnerable] When the server is fully configured, add
.htaccess
file to main directory (if it is not there yet):# Prevent access to Directory Listing Options -Indexes Options +FollowSymLinks -MultiViews # Turn mod_rewrite on RewriteEngine On RewriteBase / # X-XSS-Protection, X-Frame-Options, X-Content-Type nosniff, HSTS Strict Transport Security (HSTS) <IfModule mod_headers.c> Header set X-XSS-Protection "1; mode=block" Header always append X-Frame-Options SAMEORIGIN Header set X-Content-Type-Options nosniff Header set Strict-Transport-Security "max-age=31536000" env=HTTPS </IfModule> # Session cookies HTTP & SEcure Flag php_value session.cookie_httponly 1 php_value session.cookie_secure 1 # Rewrite everything to access to https except http RewriteCond %{HTTPS} !=on #RewriteCond %{HTTP_HOST} !^(localhost|127.0.0.1) RewriteRule ^/(.*) https://%{SERVER_NAME}/$1 [R,L] # To externally redirect /dir/foo.php to /dir/foo excluding POST requests RewriteCond %{REQUEST_METHOD} !POST RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php [NC] RewriteRule ^ %1 [R=302,L,NE] ## To internally redirect /dir/foo to /dir/foo.php RewriteCond %{REQUEST_FILENAME}.php -f [NC] RewriteRule ^ %{REQUEST_URI}.php [L] ### Website password protection #AuthUserFile /opt/lampp/htdocs/.htpasswd #AuthType Basic #AuthName "Restricted Access to AG" #Require valid-user
- Option 1: directly modify the table
nav_bar
in the MySQL - Option 2: open
../db_backup/nav_bar.sql
in notepad, modify the content, and import it to MySQL
- Open
../php/navigation.php
in notepad, read comments, modify the content, save it, and reload the page
- Headers (main image and the title) are not stored in the database. To modify the images or text, open any of the web page file using notepad.
- Go to commented out section called
Page header
, make direct modifications, save them, and reload the page
- Footers are not stored in the database. To modify the content, open any of the web page file using notepad.
- Go to commented out section called
Footer
orLicense
, make direct modifications, save them, and reload the page
- Open any of the webpages other than
index.php
(it is not on this page) - Go to commented out section called
Breadcrumbs
, make direct modifications, save them, and reload the page
- HTML generation of the interface is explained below.
- When user clicks send, javascript
../js/amazing-grazing/feedback.js
catches the click of afeedback-form form
, then uses function.ajax()
to access../php/feedback.php
server file, which then compares the tokens (read more below) to ensure that the sender is authorized, and uses sql query to write to MySQL database table calleduser_feedback
Note: perform these actions when creating a new page ONLY
- Add the following line to the
<body>
of the webpage:<?php echo htmlspecialchars_decode(feedbackRead(basename(__FILE__, '.php')));?>
- Add the following code to the top of the webpage before
<html>
:<?php session_start(); if (empty($_SESSION['csrf_token'])) { $_SESSION['csrf_token'] = bin2hex(random_bytes(32)); } ?>
- Add the following code to the top of the webpage inside the `<head>` section (used for sending tokens between the client and server to verify the identity):
```html
<meta name="csrf-token" content="<?php $_SESSION['csrf_token']; echo $_SESSION['csrf_token']; ?>">
- Add the following scripts to the bottom of the
<body>
section:<script src="js/amazing-grazing/feedback.js"></script> <script src='https://www.google.com/recaptcha/api.js'></script>
- The HTML is generated via .PHP file. To modify it, open
../php/generate-feedback-tab.php
in notepad, read comments, perform direct manipulations, save the file, and reload the page
Note: perform these actions when creating a new page ONLY
- Add the following line to the bottom of the
<body>
section before<scripts>
:<div class="scrollToTop js-top"><a href="" class="js-gotop"><i class="fa fa-arrow-up" aria-hidden="true"></i></a></div>
- Add the following script to the bottom of the
<body>
section:<script src="js/amazing-grazing/main.js"></script>
Scroll to top button...
section of../js/amazing-grazing/main.js
file is responsible for the back to top button
Note: perform these actions if necessary ONLY
- Tableau graphs are located on the
livestock-statistics.php
,employment-statistics.php
,drought.php
, andinvasive-species.php
pages - Tableau server needs to be installed on the local machine to perform modifications (refer to Tableau documentation to learn more)
Instructions:
- Go to the folder
dataset_and_tableau
and select any of the folders related to your page:- Folder
tableau-drought
- Folder
tableau-employment-statistics
- Folder
tableau-invasive-species
- Folder
tableau-livestock-statistics
- Folder
- Open any of the tableau files (with
.twb
extension) in any of the folders mentioned above, modify, and publish as public - Open the tableau page where your public graph is located, click on the "share" button, copy and paste "Embed Code" in some other
.txt
editor - Retrieve
id
of the first<div>
container, retrievesrc
of the<img>
container,value
of the<param name='name'>
container, andvalue
of the<param name='static_image'>
container - Refer to the following sections related to the dedicated webpages to learn where to insert content retrieved in step 4
- Directly access
index.php
in notepad - Dind
SERVICES
section - Modify directly, save, and reload the page
- Option 1: directly modify
index_offerings
table in MySQL - Option 2: open
../db_backup/index_offerings.sql
in notepad, modify the content, and import it to MySQL
- Ensure that the the following line is inside the
SERVICES CARDS
section (it is used to retrieved content from the database):<?php echo htmlspecialchars_decode(generateOfferings2($con));?>
- Open
../php/home_offerings.php
in notepad, read comments, modify the content, save it, and reload the page
- Option 1: directly modify
livestock_spinner
table in MySQL - Option 2: open
../db_backup/livestock_spinner.sql
in notepad, modify the content, and import it to MySQL
- Ensure that the the following line is inside the "Spinner containing livestock, beef..." section (it is used to retrieve content from the database) of the
livestock-statistics.php
:<?php echo htmlspecialchars_decode($spinner_full);?>
- Open
../php/livestock-statistics-content.php
in notepad, read comments, refer to section1) Spinner
, perform manipulations, save the file, and reload the page
- The following javascript file is responsible for the spinner execution on load of the page (located at the bottom of the
<body>
section:<script src="js/amazing-grazing/animated-spinner.js"></script>
Note: each time page is resized, it needs to be refreshed to ensure that the spinner fits the screen size - suggested future improvement. Refer to the
../js/amazing-grazing/animated-spinner.js
file to read more.
- Option 1: directly modify
livestock_landing
table in MySQL - Option 2: open
../db_backup/livestock_landing.sql
in notepad, modify the content, and import it to MySQL
- Ensure that the the following line is inside the "Livestock reduction impacts..." section (it is used to retrieve content from the database):
<?php echo htmlspecialchars_decode($live_intro);?>
- Open
../php/livestock-statistics-content.php
in notepad, read comments, refer to section2) Intro
, perform manipulations, save the file, and reload the page
- On page load:
- The script at the bottom of the page (refer to comments) automatically simulates the click on the year set by default.
- This click triggers javascript function
yearSelection
injs/amazing-grazing/livestock-prediction.js
file. - This function calls function
.ajax()
to access the../php/prediction_POST.php
file to receive cards content from MySQL database, updates the data base on the year & filters selected, calculates facts using fomulas, decides what cards to show.../php/prediction_POST.php
accesses the following tables in MySQL database:livestock_prediction_dataset
andlivestock_cards
- Click on year selection:
- Year selection triggers javascript function
yearSelection
injs/amazing-grazing/livestock-prediction.js
file. - Same as point (c or 3) above
- Year selection triggers javascript function
- Click on filter selection:
- Filter selection options trigger javascript function
selectLivestock
injs/amazing-grazing/livestock-picker.js
file. - This function identifies active/inactive buttons, unchecks all other buttons if TOTAL button is clicked, sends error if all buttons are inactive, and simulates click on the year (Refer to above section On page load b-c (or 2-3)).
- Filter selection options trigger javascript function
- Click on display graph:
- Triggers function at the bottom of the webpage related to the "display graph" id
#hide-graph
. - This function clears the place where graph is supposed to go, identifies filter parameters and year, calls function
.ajax()
to access../php/livestock-graph.php
file to receive various urls, ids, etc. related to tableau, then uses this data to create a graph.../php/livestock-graph.php
accesses thelivestock_graph
table in MySQL database
- Triggers function at the bottom of the webpage related to the "display graph" id
These are not stored in the database
- Directly access
livestock-statistics.php
in notepad - Scroll down to "CONSEQUENCES OF LIVESTOCK..." section
- Modify directly
It is not stored in the database
- Directly access
livestock-statistics.php
in notepad - Scroll down to "Sorting" section
- Modify directly
- Option 1: directly modify
livestock_graph
table in MySQL - Option 2: open
../db_backup/livestock_graph.sql
in notepad, modify the content, and import it to MySQL
Note: refer to section * 6.7 Configure tableau graphs to learn what each string related to tableau does and where to get it
- Option 1: directly modify
livestock_cards
table in MySQL - Option 2: open
../db_backup/livestock_cards.sql
in notepad, modify the content, and import it to MySQL
Note: perform operations if necessary ONLY
- Open
../js/amazing-grazing/livestock-prediction.js
in notepad - Find function
contentHTML()
- Perform modifications, save, and refresh the page
- Accessed by going to
../dataset_and_tableau/datasets-livestock-statistics/
:- File 1:
livestock_year_1973_2016.xlsx
is the original datasets. It is not in database and not used. - File 2:
livestock_year_2017_2060.xlsx
is the predicted dataset based on the previous dataset. It is stored inlivestock_prediction_dataset
database table.
- File 1:
- Website has many graphs related to various filters for years. Tableau is used to generated these line graphs.
- Tableau server is required to be installed on your local machine to modify the tableau files.
- Go to
../dataset_and_tableau/tableau-livestock-statistics/
folder, and select the graph needed for modifications. - Perform modifications to the graphs referring to Tableau Documentation, then publish this graph publicly, and retrieve required content. Refer to 6.7 Configure tableau graphs section to learn more.
Both headers, subheaders, content, image, and video can be modified through MySQL database:
- Option 1: directly modify
emp_landing
table in MySQL - Option 2: open
../db_backup/emp_landing.sql
in notepad, modify the content, and import it to MySQL
Note: perform operations if necessary ONLY
employment-statstics.php
contains"Left and right sides (video & content) retrieved from db"
section that stores the following code (used to access the database and create HTML content):<?php echo htmlspecialchars_decode($emp_landing);?>
- Open
../php/employee-statistics-content.php
file in notepad, read the comments, scroll down to section1) Landing
, perform changes, save, ane reload the page- Section
1) Landing
retrives the content directly from the database's tableemp_landing
and converts it to HTML
- Section
-
On load:
- Click of the sort button
$(emp_type_select).trigger("click");
is simulated in the<script>
section at the bottom of theemployment-statistics.php
page based on theid
of the button selected by default. Examples of ids:#e-beef
,#e-dairy
, and#e-sheep
. - These buttons have
.select-employment
class. FunctionselectEmployment()
in the../js/amazing-grazing/employment-picker.js
is listening for a click of this class, which is simulated in step 1. - Once this function is triggered, it receives the
id
of step 1, and sends thisid
to functionselectEmploymentType()
in the same file. - This function compares the
received id
with theclicked id
and retrieves the content of the graph and its license (graph data and license are not stored in the database - suggested improvement). - Then this function sends all the content of step 4 to the function
placeGraph()
in the same file, which generates the graph. This function inserts the graph intoemployment-statistics.php
section that hasid
set as#tableau-chart
. Addtitionally sets license to a text box withid
#reference
- Function
selectEmployment()
from step 2 continues execution and sends a request using function.ajax()
to the server file../php/employment-card-POST.php
to retrieve the content of all the cards in HTML format. - It inserts HTML content directly to
employment-statistics.php
section that hasid
cards-data
.
Note: refer to../js/amazing-grazing/employment-picker.js
file to learn more in the commented out section.
- Click of the sort button
-
On sort button click:
- Refer to 'On load step b (or 2)'
Note: It is not stored in the database
- Directly access
employment-statistics.php
in notepad - Find "Section 3: NUMBER OF EDUCATED..." section
- Modify directly
Note: It is not stored in the database
- Directly access
employment-statistics.php
in notepad - Find "Sorting" section
- Modify directly
Additionally, if more sorting options have been added to HTML, then the function $(".select-employment").click(function()
in the <script>
at the bottom of the page needs to be modified.
Note: it is not stored in the database - suggested improvement
- Open
../js/amazing-grazing/employment-picker.js
in notepad - Find function
selectEmploymentType()
- Replace content where necessary, save, and reload page
Note: Refer to section 6.7 Configure tableau graphs to learn what each string related to tableau does and where to get it from.
- Option 1: directly modify
emp_cards
table in MySQL - Option 2: open
../db_backup/emp_cards.sql
in notepad, modify the content, and import it to MySQL
Note: tables emp_age
, emp_education
, and emp_state
are related to each card. This data can be modified, but it is related to datasets used in this project. Refer to
section 9.4.1 Employment datasets to learn more.
Note: perform operations if necessary ONLY
- Open
../php/employment-card-POST.php
- This file retrieves card, employee age, employee education, and employee region affected content from MySQL database from the following tables:
emp_state
,emp_education
,emp_age
, andemp_cards
- Then it converts all the content to HTML and sends to file
../js/amazing-grazing/employment-picker.js
using function.ajax()
. Refer to section 9.3.1 How does it work? to learn more
- This file retrieves card, employee age, employee education, and employee region affected content from MySQL database from the following tables:
- Perform direct manipulations, save, and reload the page
- Accessed by going to
../dataset_and_tableau/datasets-employment-statistics/
:- File 1:
livestock_farmers.xlsx
is the original dataset. It is not in database and not used. - File 2:
farmers_data.xlsx
. Data wrangling has been performed on this file. It is stored in the following tables:emp_state
,emp_education
,emp_age
, andemp_cards
- File 1:
- Website has three graphs generated in tableau.
- Tableau server is required to be installed on your local machine to modify the tableau files.
- Go to
../dataset_and_tableau/tableau-employment-statistics/
folder, and select the graphfarmer123.twbx
- Perform modifications to the graphs referring to Tableau Documentation, then publish this graph publicly, and retrieve required content. Refer to 6.7 Configure tableau graphs section to learn more.
Note: these are stored in the database
- Directly access
employment-statistics.php
in notepad - Find "Section 4: AGRICULTURAL COMMUNITIES" section
- Modify directly
- Option 1: directly modify
emp_agri_comm
table in MySQL - Option 2: open
../db_backup/emp_agri_comm.sql
in notepad, modify the content, and import it to MySQL
Note: Pperform operations if necessary ONLY
employment-statistics.php
containsStart carousel
section that stores the following code (used to access the database and create HTML content):<?php echo htmlspecialchars_decode($emp_agri);?>
- Open
../php/employee-statistics-content.php
file in notepad, read the comments, scroll down to section "2) Agricultural communities", perform changes, save, ane reload the page- Section '2) Agricultural communities' retrieves content directly from the database's table
emp_agri_comm
and converts it to HTML
- Section '2) Agricultural communities' retrieves content directly from the database's table
- On load:
- Section
Section 2: Grazing Technqiues
of the webpage contains the following line, which connects to the server file called../php/retrieve_techniques.php
:<?php echo htmlspecialchars_decode(retrieveTechniques($con));?>
- The line above connects to the database table
techniques_landing
to retrieve all 4 techniques - Sections
Pop up seasonal grazing modal
,Pop up rotational grazing modal
, andPop up patch-burn grazing modal
contain the following lines of code, which also connects to the server file called../php/retrieve_techniques.php
:Pop up seasonal grazing modal
:<?php echo retrieveTechniquePage($con, "SEASONAL GRAZING", "Carousel");?>
Pop up rotational grazing modal
:<?php echo retrieveTechniquePage($con, "ROTATIONAL GRAZING", "Methods");?>
Pop up patch-burn grazing modal
:<?php echo retrieveTechniquePage($con, "PATCH-BURN GRAZING", "No");?>
- Above lines connect to the database table
technique_selected
to retrieve the content of all the pages that can be accessed by clickingRead more
buttons
- Section
Note: refer to commented out sections of ../php/retrieve_techniques.php
to learn more.
Note: perform operations if necessary ONLY
- Directly access
../php/retrieve_techniques.php
in notepad - Find
retrieveTechniques($con)
section - Read comments, modify, save, and reload the page
- Option 1: directly modify
techniques_landing
table in MySQL - Option 2: open
../db_backup/techniques_landing.sql
in notepad, modify the content, and import it to MySQL
- Option 1: directly modify
technique_selected
table in MySQL- Column
selected-techn
contains the title of the techniques, for exampleSEASONAL GRAZING
. The row related to this content needs to be modified.
- Column
- Option 2: open
../db_backup/technique_selected.sql
in notepad, modify the content, and import it to MySQL
To modify the suggestions content:
- Option 1: directly modify
suggestion_tech
table in MySQL - Option 2: open
../db_backup/suggestion_tech.sql
in notepad, modify the content, and import it to MySQL
Note: there is no dedicated content for this technique because the objective of the website is to avoid promoting it
- Option 1: directly modify
technique_selected
table in MySQL- Column
selected-techn
contains the title of the techniques, for exampleROTATIONAL GRAZING
. The row related to this content needs to be modified.
- Column
- Option 2: open
../db_backup/technique_selected.sql
in notepad, modify the content, and import it to MySQL
To modify the suggestions content:
- Option 1: directly modify
suggestion_tech
table in MySQL - Option 2: open
../db_backup/suggestion_tech.sql
in notepad, modify the content, and import it to MySQL
- Option 1: directly modify
technique_selected
table in MySQL- Column
selected-techn
contains the title of the techniques, for examplePATCH-BURN GRAZING
. The row related to this content needs to be modified.
- Column
- Option 2: open
../db_backup/technique_selected.sql
in notepad, modify the content, and import it to MySQL
To modify the suggestions content:
- Option 1: directly modify
suggestion_tech
table in MySQL - Option 2: open
../db_backup/suggestion_tech.sql
in notepad, modify the content, and import it to MySQL
Note: perform operations if necessary ONLY
- Directly access
../php/retrieve_techniques.php
in notepad - Find
retrieveTechniquePage($con, $page, $extraContent)
section - Read comments and modify directly
- On load:
- Executes section
2: Drought species impact grasslands
with the two following sections:Graph containing drought regions
- This section executes tableau graph together with the javascript
Description: executes the drought page graph
at the bottom of the page. Refer to 6.7 Configure tableau graphs section to learn more.
- This section executes tableau graph together with the javascript
Invasive species impact grasslands section
- This section executes the "DROUGHT IMPACTS GRASSLANDS" section, the subheader, and the content using the following line
which connects to the server's database through the server file
<?php echo htmlspecialchars_decode($drought_intro);?>
../php/generate-feedback-tab.php
. - Section
1) Intro
of this file retrieves the information from thedrought_landing
table and generates HTML that is sent to the client
- This section executes the "DROUGHT IMPACTS GRASSLANDS" section, the subheader, and the content using the following line
- Executes section
3: What the government does
:- The HEADER and SUBHEADER are executed in the HTML itself
- Section
Flip cards
contains the following line of code:which connects to the server's database through the server file<?php echo htmlspecialchars_decode($governmentInfo);?>
../php/generate-feedback-tab.php
.- Section
2) what the government does
of this file retrieves the information from thedrought_government
table and generates HTML that is sent to the client
- Section
- Executes section
4: PREPARE YOURSELF FOR DROUGHT
- The HEADER and SUBHEADER are executed in the HTML itself
- Section
Actions that farmers can take
contains the following line of code:which connects to the server's database through the server file<?php echo htmlspecialchars_decode($prepareInfo);?>
../php/generate-feedback-tab.php
.- Section
3) Prepare yourself for drought
of this file retrieves the information from thedrought_prepare
table and generates HTML that is sent to the client
- Section
- Executes section
Note: both headers, subheaders, content, image, and video can be modified through MySQL database:
- Option 1: directly modify
drought_landing
table in MySQL - Option 2: open
../db_backup/drought_landing.sql
in notepad, modify the content, and import it to MySQL
Note: perform operations if necessary ONLY
- Directly access
../php/drought-content.php
file in notepad - Find
1) Intro
section - Read comments and modify directly
Note: it is not stored in the database - suggested improvement
- Open
drought.php
in notepad - Find section
Graph containing drought regions
- Replace content where necessary, save, and reload page
Note: refer to section 6.7 Configure tableau graphs to learn what each string related to tableau does and where to get it from.
- Accessed by going to
../dataset_and_tableau/datasets-drought/
:- File 1:
drought-condition.xlsx
is the dataset that has been data wrangled and inserted into the tableau. It is not stored in the database.
- File 1:
- Website generates one map in tableau.
- Tableau server is required to be installed on your local machine to modify the tableau files.
- Go to
../dataset_and_tableau/tableau-drought/
folder, and select the tableau mapAU Drought.twbx
- Perform modifications to the map referring to Tableau Documentation, then publish this graph publicly, and retrieve required content. Refer to 6.7 Configure tableau graphs section to learn more.
Note: these are not stored in the database
- Directly access
drought.php
file in notepad - Find "Section 3: What the government does" section
- Modify directly
- Option 1: directly modify
drought_government
table in MySQL - Option 2: open
../db_backup/drought_government.sql
in notepad, modify the content, and import it to MySQL
Note: perform operations if necessary ONLY
- The following line must be within the
Flip cards
section of thedrought.php
webpage (it retrieves database content from adrought-content.php
file)<?php echo htmlspecialchars_decode($governmentInfo);?>
- Open
../php/drought-content.php
file in notepad - Read comments, find
2) What the government does
section, perform changes directly, save, and reload the page
Note: it is not stored in the database
- Directly access
drought.php
file in notepad - Find "Flip cards get inserted here" section
<h5 class="pull-right"><u><i><a href="https://www.agriculture.gov.au/ag-farm-food/drought">Learn more</i></u></a></h5>
- Modify directly
Note: It is not stored in the database
- Directly access
drought.php
file in notepad - Find "Section 4: PREPARE YOURSELF FOR DROUGHT" section
- Modify directly
- Option 1: directly modify
drought_prepare
table in MySQL - Option 2: open
../db_backup/drought_prepare.sql
in notepad, modify the content, and import it to MySQL
Note: Perform operations if necessary ONLY
- The following line must be within the
Actions that farmers can take
section of thedrought.php
webpage (it retrieves database content from a../php/drought-content.php
file)<?php echo htmlspecialchars_decode($governmentInfo);?>
- Open
../php/drought-content.php
file in notepad - Read comments, find
3) Prepare yourself for drought
section, perform changes directly, save, and reload the page
- Option 1: directly modify
species_spinner
table in MySQL - Option 2: open
../db_backup/species_spinner.sql
in notepad, modify the content, and import it to MySQL
Note: Perform operations if necessary ONLY
- The following line must be within the
Spinner containing root cause, animals, management...
section of theinvasive-species.php
webpage (it retrieves database content from a../php/invasive-species-content.php
file)<?php echo htmlspecialchars_decode($spinner_full);?>
- Open
../php/invasive-species-content.php
in notepad - Read comments, find
1) Spinner
section, perform changes directly, save, and reload the page
- The following javascript file is responsible for the spinner execution on load of the page (located at the bottom of the
<body>
section:<script src="js/amazing-grazing/animated-spinner.js"></script>
Note: each time page is resized, it needs to be refreshed to ensure that the spinner fits the screen size - suggested future improvement. Refer to the file to read more.
Note: Both headers, subheaders, and content can be modified through MySQL database:
- Option 1: directly modify
species_landing
table in MySQL - Option 2: open
../db_backup/species_landing.sql
in notepad, modify the content, and import it to MySQL
Note: Perform operations if necessary ONLY
- The following line must be within the
Invasive species impact grasslands
section of theinvasive-species.php
webpage (it retrieves database content from a../php/invasive-species-content.php
file)<?php echo htmlspecialchars_decode($species_intro);?>
- Open
../php/invasive-species-content.php
in notepad - Read comments, find
2) Intro
section, perform changes directly, save, and reload the page
-
On load:
.ajax()
function (located at the bottom ofinvasive-species.php
file) that accesses the server's../php/invasive-species-gallery.php
file to retrieve the gallery content in HTML format from the database's tablespecies_types
and push it to the content withid
#animals-content
(located in theGallery
section of theinvasive-species.php
:<div class="col-md-12 sort-species-item filter-animals"> <div id="animals-content" class="carousel-species owl-carousel ftco-owl"> <!-- animals content goes here --> </div> </div>
- class
sort-species-item
represents that everything within this class is treated as a sortable item.
- class
.ajax()
resizes the gallery items to make the height similar..ajax()
activates the carousel, sorting/filtering animations.
-
On "Show affected areas" click;
- These buttons contain
.location-button
class, which is triggered upon users click. - The modal with
id
#tableau-chart
gets cleared just in case old graph is there - This part is done on load: server file
../php/invasive-species-gallery-get-js.php
is executed that accessesspecies_types
table once again to retrieve graph/map content and license in the form ofjavascript if-else statements
that are pushed to the javascript using the following php line:<?php echo htmlspecialchars_decode($if_statement);?>
- Content retrieved in step 3 is used to generate the graph, push it inside the
#tableau-chart
. - Then this function generates the license container that goes below the graph.
- These buttons contain
Note: the following code of the "Sort" section is responsible for sorting the galleries:
<li data-filter=".filter-plants" class="filter-active">Plants</li>
data-filter=".filter-plants"
assigns a unique identifier to an item, which gallery followsclass="filter-active"
makes an item active by default. You may exclude this line if the item is not active by default.Plants
is the name of an item that user sees
Note: These are not stored in the database - suggested improvement if more items added. Perform operations if necessary ONLY
- Directly access
invasive-species.php
file in notepad - Find "Sort" section
- Add/remove/replace items referring to 12.3.1 How does it work? section.
Note: these are not stored in the database
- Directly access
invasive-species.php
file in notepad - Find "3: INVASIVE SPECIES & LOCATIONS" section
- Modify directly
- Option 1: directly modify
species_types
table in MySQL - Option 2: open
../db_backup/species_types.sql
in notepad, modify the content, and import it to MySQL
Note: perform operations if necessary ONLY
- It is retrieved by the system using
.ajax()
from the../php/invasive-species-gallery.php
file andspecies_type
database table. Refer to 12.3.1 How does it work? to learn more.
Instructions:
- Open
../php/invasive-species-gallery.php
file in notepad - Read comments, modify, save, and reload the page
Note: these are not stored in the database
- Directly access
invasive-species.php
file in notepad - Find "4: PREVENTATIVE MEASURES" section
- Modify directly
- Option 1: directly modify
species_measures
table in MySQL - Option 2: open
../db_backup/species_measures.sql
in notepad, modify the content, and import it to MySQL
Note: Perform operations if necessary ONLY
- The following lines must be within the
Invasive species impact grasslands
section of theinvasive-species.php
webpage (it retrieves database content from a../php/invasive-species-content.php
file)and<?php echo htmlspecialchars_decode($plants_measures);?>
<?php echo htmlspecialchars_decode($animal_measures);?>
- Open
../php/invasive-species-content.php
in notepad - Read comments, find
3) Preventative Masures
section, perform changes directly, save, and reload the page
- Accessed by going to
../dataset_and_tableau/datasets-invasive-species/
:- File 1:
Athel Pine.xlsx
is the data wrangled file that contains the locations of Athel Pine plant. - File 2:
Buffalos.xlsx
is the data wrangled file that contains the locations of Buffalo animals. - File 3:
Buffel Grass.xlsx
is the data wrangled file that contains the locations of Buffel Grass plant. - File 4:
Camels.xlsx
is the data wrangled file that contains the locations of Camels animals. - File 5:
Cattle.xlsx
is the data wrangled file that contains the locations of Cattle animals. - File 6:
Donkeys.xlsx
is the data wrangled file that contains the locations of Donkey animals. - File 7:
Goat.xlsx
is the data wrangled file that contains the locations of Goat animals. - File 8:
Horses.xlsx
is the data wrangled file that contains the locations of Horse animals. - File 9:
Kangaroos.xlsx
is the data wrangled file that contains the locations of Kangaroo animals. - File 10:
Mesquite.xlsx
is the data wrangled file that contains the locations of Mesquite plants. - File 11:
Mission Grass.xlsx
is the data wrangled file that contains the locations of Mission Grass plants. - File 12:
Pigs.xlsx
is the data wrangled file that contains the locations of Pig animals. - File 13:
Prickly_Acacia.xlsx
is the data wrangled file that contains the locations of Prickly Acacia plants. - File 14:
Rabbit.xlsx
is the data wrangled file that contains the locations of Mission Rabbit animals. - File 15:
Reed Sweetgrass.xlsx
is the data wrangled file that contains the locations of Reed Sweetgrass plants.
- File 1:
Note: above datasets are not stored in the database but directly forwarded to tableau API map.
- Website has many locations of invasive species. Tableau is used to generate maps.
- Tableau server is required to be installed on the local machine to modify the tableau files.
- Go to
../dataset_and_tableau/tableau-invasive-species/
folder, and select the graph needed for modifications. - Perform modifications to the graphs referring to Tableau Documentation, then publish this graph publicly,
retrieve required content, and update
species_types
table. Refer to 6.7 Configure tableau graphs section to learn more.
Note: News are generated using GnewsAPI. News are not stored in the database. Tokens that are used to connect to google servers are stored in the database. There are 7 tokens in database and each token allows 100 transactions daily. It is important to reset the counter every day to 0 to let users use them. Drop down content of the topics and region is also stored in the database. Refer to 12.1 How does it work? section to learn more.
- On load:
- Client connects to the server's file
../php/news_navigation.php
to generate the drop down buttons.- The following php line must be located inside the
News Navigation
section of thenews.php
:<?php echo htmlspecialchars_decode(generateNewsNav($con, $startDate));?>
- Once it is connected, the topics and regions are retrieved from the following tables:
news_region_content
andnews_topic_content
. This content is used to generate the HTML code, which is sent to the client to display the navigation bar. Read comments in../php/news_navigation.php
to learn more.
- The following php line must be located inside the
- Client connects to another server's file
../php/gnewsAPI.php
to do the following actions:- The following php line must be located inside the
All The news are displayed here
section of thenews.php
:<?php echo htmlspecialchars_decode(newsGenerator($newsData, $totalNews));?>
- Retrieves the token from the server's table
g_news_api
, use it, and increases the counter ofg_news_count
row in the table. - Retrieves user's current date and reduces it by 3 to ensure that the news are 3 days old.
- Connects to the GnewsAPI using its dedicated URL, which retrives the news in JSON format.
- Then it uses
newsGenerator($data, $total)
function to generate the news in HTML format, which is pushed to the client's side to display the news. Refer comments in../php/gnewsAPI.php
to learn more.
- Retrieves the token from the server's table
- The following php line must be located inside the
- Client connects to the server's file
- On topic, country, or date selection:
- The javascript
../js/amazing-graizing/news-picker.js
is listening for a click of any of the drop-down items using.updateNewsJS
class - Then it retrieves the
id
of the clicked class, which allows it to catch what option user has selected - It retrieves all of the user's selections, converts the long names of the states to short, like "Australia" is converted to "au"
- It clears the current news section that has
id
#update-news
- Uses
.ajax()
function to connect to the server's file../php/gnewsAPI_POST.php
(which is similar tognewsAPI.php
but with slight modifications) - Then,
../php/gnewsAPI_POST.php
:- Retrieves the token from the server's table
g_news_api
, use it, and increases the counter ofg_news_count
row in the table. - Retrieves user's current date and reduces it by 3 to ensure that the news are 3 days old.
- Connects to the GnewsAPI using its dedicated URL, which retrives the news in JSON format.
- Then it uses
newsGenerator($data, $total, $sort)
function to generate the news based on the sort user has selected in HTML format. This HTML code is pushed back to.ajax()
function, which sends this HTML code to theid
calledupdate-news
250 milliseconds after. Refer to comments in./php/gnewsAPI_POST.php
to learn more.
- Retrieves the token from the server's table
- The javascript
Note: The system can be improved by automatically resetting the GnewsAPI tokens when reached the limit.
- Option 1: directly modify
news_topic_content
table in MySQL - Option 2: open
../db_backup/news_topic_content.sql
in notepad, modify the content, and import it to MySQL
- Option 1: directly modify
news_region_content
table in MySQL - Option 2: open
../db_backup/news_region_content.sql
in notepad, modify the content, and import it to MySQL
Then, open ../js/amazing-graizing/news-picker.js
in notepad, find Country selection
section, and add the following line:
if (regionName == "Country_Long_Name") { regionName = "Country_Short_name" }
- Where
Country_Long_Name
is the same name as inside the drop down menu ornews_reg_topic
column innews_region_content
table. - Where
Country_Short_name
is the short name for the country, for example if the long name isAustralia
, then the short name isau
.
Note: Refer to comments in ../db_backup/news_region_content.sql
to learn more.