Giter VIP home page Giter VIP logo

sport-manager's Introduction

Sure! Here's the documentation for the given tasks:

Solution Documentation

1. Creating Database Tables

The MySQL queries to create the required tables can be found in the backend/tables.php file. These queries create the following tables:

  1. teams table: This table stores information about the teams participating in the games.

    • Columns:
      • id (INT): The unique identifier for each team.
      • name (VARCHAR): The name of the team.
  2. leagues table: This table stores information about the leagues in which the games are played.

    • Columns:
      • id (INT): The unique identifier for each league.
      • name (VARCHAR): The name of the league.
  3. games table: This table stores information about the games.

    • Columns:
      • id (INT): The unique identifier for each game.
      • team1_id (INT): The ID of the first team participating in the game (foreign key to teams table).
      • team2_id (INT): The ID of the second team participating in the game (foreign key to teams table).
      • league_id (INT): The ID of the league in which the game is played (foreign key to leagues table).
      • unix_time (INT): The Unix timestamp representing the game's time.
      • ht_score (INT): The score of the game at halftime.
      • ft_score (INT): The score of the game at full time.

2. Creating HTML Forms

The HTML forms for inserting data into the tables can be found in the backend/forms.php file. These forms include front-end validations using HTML5 to ensure the required fields are filled before submitting the form.

The forms are using PHP validation as instructed.

3. Backend Data Validation

The PHP code for validating the form data is implemented using Object-Oriented Programming (OOP) principles and can be found in the backend/validation_class.php file. The FormValidator class is responsible for validating the form data based on specific rules and returning any validation errors.

4. Saving Form Data into Database

The MySQL queries to save the form data into the tables are implemented in the backend/validate_and_save.php file. This script retrieves the form data, validates it using the FormValidator class, and performs the necessary database insertions if the data is valid. If any errors occur during the database insertion process, appropriate error messages are returned.

5. Retrieving Games from Database

The PHP code to retrieve games from the database as an associative array is implemented in the backend/games.php file. This script queries the database using MySQL and fetches the required information about each game, including the team names, league name, unix_time, and scores for half time and full time. The retrieved data is stored in an associative array.

6. Outputting Games as JSON

The associative array containing the game data is then output as JSON using the json_encode() function in the backend/games.php file. This JSON data can be consumed by client-side applications to display the games in the desired format.

Frontend (VueJS)

The frontend implementation is done using VueJS and can be found in the frontend/sport-manager directory. To start the Vue app, navigate to the frontend directory using the command line and run the following commands:

cd frontend/sport-manager
npm install       # Install project dependencies
npm run serve     # Start the

 development server

This will start the Vue app and provide a local development server where you can access the application in your web browser.

In the frontend, the VueJS framework is used to handle the form submission, perform client-side validations, and display error messages or success messages based on the response received from the backend.

The frontend design and layout can be customized as per the requirements of the application.

sport-manager's People

Contributors

alexonozor avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.