Mini Kabibi Habibi

Current Path : C:/xampp/htdocs/todolist/php/
Upload File :
Current File : C:/xampp/htdocs/todolist/php/functions.php

<?php 
function waiter(){
  insertTask();
  deleteTask();
  completeTask();
}
function insertTask(){
	if(!empty($_GET['item'])){
    $insert = new insert($_GET['item']);
    if($insert->insertTask()){
      echo '<div class="col-md-9 alert alert-success alert-dismissible fade show" role="alert">
  				<strong>Congratulations!</strong> You have Inserted Task Successfully.
  				<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close">
  				</button>
			</div>';
    }else{
      echo '<div class="col-md-9 alert alert-danger alert-dismissible fade show" role="alert">
  				<strong>Congratulations!</strong> Insert Task Error.
  				<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close">
  				</button>
			</div>';
    }
  }
}

function deleteTask(){
  if(!empty($_GET['delete'])){
    $delete = new delete($_GET['delete']);
    if($delete->deleteTask()){
      echo '<div class="col-md-9 alert alert-warning alert-dismissible fade show" role="alert">
          <strong>Congratulations!</strong> You have Deleted Task Successfully.
          <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close">
          </button>
      </div>';
    }else{
      echo '<div class="col-md-9 alert alert-danger alert-dismissible fade show" role="alert">
          <strong>Congratulations!</strong> Delete Task Error.
          <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close">
          </button>
      </div>';
    }
  }
}

function completeTask(){
  if(!empty($_GET['complete'])){
    $complete = new complete($_GET['complete']);
    if($complete->completeTask()){
      echo '<div class="col-md-9 alert alert-info alert-dismissible fade show" role="alert">
          <strong>Congratulations!</strong> You have Completed the Task Successfully.
          <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close">
          </button>
      </div>';
    }else{
      echo '<div class="col-md-9 alert alert-danger alert-dismissible fade show" role="alert">
          <strong>Congratulations!</strong> Task Completion Error.
          <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close">
          </button>
      </div>';
    }
  }
}

function viewTable(){
  $view = new view();
  $view->viewData();
  $view->viewCompletedData();
}
?>