Used CKEditor for being able to edit the post body. Added the ability to make a post and send it to the backend. Formatted post on backend by moving images into respective directory with the post name and unique ID. Showed message if errored or succeeded.
Signed-off-by: rodude123 <rodude123@gmail.com>
This commit is contained in:
@@ -16,7 +16,7 @@ class timelineData
|
||||
* Get all education data
|
||||
* @return array - Array of all education data or error message
|
||||
*/
|
||||
function getEduData(): array
|
||||
public function getEduData(): array
|
||||
{
|
||||
$conn = dbConn();
|
||||
$stmt = $conn->prepare("SELECT ID, startPeriod, endPeriod, grade, course FROM edu ORDER BY startPeriod DESC;");
|
||||
@@ -24,7 +24,7 @@ class timelineData
|
||||
|
||||
// set the resulting array to associative
|
||||
$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
|
||||
|
||||
if ($result)
|
||||
{
|
||||
return $result;
|
||||
@@ -36,7 +36,7 @@ class timelineData
|
||||
* Get all work data
|
||||
* @return array - Array of all work data or error message
|
||||
*/
|
||||
function getWorkData(): array
|
||||
public function getWorkData(): array
|
||||
{
|
||||
$conn = dbConn();
|
||||
$stmt = $conn->prepare("SELECT ID, startPeriod, endPeriod, companyName, area, title FROM work ORDER BY work.startPeriod DESC;");
|
||||
@@ -61,7 +61,7 @@ class timelineData
|
||||
* @param string $id - ID of the education data
|
||||
* @return bool - True if successful, false if not
|
||||
*/
|
||||
function updateEduData(string $dateFrom, string $dateTo, string $grade, string $course, string $id): bool
|
||||
public function updateEduData(string $dateFrom, string $dateTo, string $grade, string $course, string $id): bool
|
||||
{
|
||||
$conn = dbConn();
|
||||
$stmt = $conn->prepare("UPDATE edu SET startPeriod = :dateFrom, endPeriod = :dateTo, grade = :grade, course = :course WHERE ID = :id;");
|
||||
@@ -101,7 +101,7 @@ class timelineData
|
||||
* @param int $id
|
||||
* @return bool - True if successful, false if not
|
||||
*/
|
||||
function deleteEduData(int $id): bool
|
||||
public function deleteEduData(int $id): bool
|
||||
{
|
||||
$conn = dbConn();
|
||||
$stmt = $conn->prepare("DELETE FROM edu WHERE ID = :id;");
|
||||
@@ -130,7 +130,7 @@ class timelineData
|
||||
* @param string $course - Course
|
||||
* @return bool|int - ID of the new education data or false if not successful
|
||||
*/
|
||||
function addEduData(string $dateFrom, string $dateTo, string $grade, string $course): bool|int
|
||||
public function addEduData(string $dateFrom, string $dateTo, string $grade, string $course): bool|int
|
||||
{
|
||||
$conn = dbConn();
|
||||
$stmt = $conn->prepare("INSERT INTO edu (startPeriod, endPeriod, grade, course) VALUES (:dateFrom, :dateTo, :grade, :course);");
|
||||
@@ -138,8 +138,8 @@ class timelineData
|
||||
$stmt->bindParam(":dateTo", $dateTo);
|
||||
$stmt->bindParam(":grade", $grade);
|
||||
$stmt->bindParam(":course", $course);
|
||||
|
||||
if($stmt->execute())
|
||||
|
||||
if ($stmt->execute())
|
||||
{
|
||||
return $conn->lastInsertId();
|
||||
}
|
||||
@@ -155,7 +155,7 @@ class timelineData
|
||||
* @param string $title - Title
|
||||
* @return bool|int - ID of the new work data if successful, false if not
|
||||
*/
|
||||
function addWorkData(string $dateFrom, string $dateTo, string $companyName, string $area, string $title): bool|int
|
||||
public function addWorkData(string $dateFrom, string $dateTo, string $companyName, string $area, string $title): bool|int
|
||||
{
|
||||
$conn = dbConn();
|
||||
$stmt = $conn->prepare("INSERT INTO work (startPeriod, endPeriod, companyName, area, title) VALUES (:dateFrom, :dateTo, :companyName, :area, :title);");
|
||||
@@ -164,8 +164,8 @@ class timelineData
|
||||
$stmt->bindParam(":companyName", $companyName);
|
||||
$stmt->bindParam(":area", $area);
|
||||
$stmt->bindParam(":title", $title);
|
||||
|
||||
if($stmt->execute())
|
||||
|
||||
if ($stmt->execute())
|
||||
{
|
||||
return $conn->lastInsertId();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user