Added a basic show part info with new design. Not finished yet...

This commit is contained in:
Jan Böhmer 2019-02-24 18:05:06 +01:00
parent f8bd1458d3
commit f0bea8ff4d
22 changed files with 7883 additions and 25 deletions

View file

@ -0,0 +1,39 @@
<?php
/**
* Created by PhpStorm.
* User: janhb
* Date: 24.02.2019
* Time: 13:00
*/
namespace App\Controller;
use App\Entity\Part;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Routing\Annotation\Route;
class PartController extends AbstractController
{
/**
* @Route("/part/{id}/info")
* @Route("/part/{id}")
*/
function show(int $id)
{
$repo = $this->getDoctrine()->getRepository(Part::class);
/** @var Part $part */
$part = $repo->find($id);
dump($part);
return $this->render('show_part_info.html.twig',
[
"part" => $part
]
);
}
}

View file

@ -69,14 +69,11 @@ abstract class NamedDBElement extends DBElement
/**
* Returns the last time when the element was modified.
* @param $formatted bool When true, the date gets formatted with the locale and timezone settings.
* When false, the raw value from the DB is returned.
* @return string The time of the last edit.
*/
public function getLastModified(bool $formatted = true) : string
public function getLastModified() : \DateTime
{
//TODO
return "TODO";
return $this->lastModified;
}
/**
@ -85,10 +82,10 @@ abstract class NamedDBElement extends DBElement
* When false, the raw value from the DB is returned.
* @return string The creation time of the part.
*/
public function getDatetimeAdded(bool $formatted = true) : string
public function getDatetimeAdded() : \DateTime
{
//TODO
return "TODO";
return $this->addedDate;
}
/********************************************************************************

View file

@ -15,7 +15,7 @@ use Doctrine\ORM\Mapping as ORM;
* Class Orderdetail
* @package App\Entity
*
* @ORM\Table("oderdetails")
* @ORM\Table("orderdetails")
* @ORM\Entity()
*/
class Orderdetail extends DBElement

View file

@ -219,7 +219,7 @@ class Part extends AttachmentContainingDBElement
* @param boolean|int $bbcode_parsing_level Should BBCode converted to HTML, before returning
* @return string the comment
*/
public function getComment($bbcode_parsing_level = BBCodeParsingLevel::PARSE) : string
public function getComment($bbcode_parsing_level = true /*= BBCodeParsingLevel::PARSE*/) : string
{
$val = htmlspecialchars($this->comment);

View file

@ -187,13 +187,13 @@ abstract class StructuralDBElement extends AttachmentContainingDBElement
if (! \is_array($this->full_path_strings)) {
$this->full_path_strings = array();
$this->full_path_strings[] = $this->getName();
$parent_id = $this->getParentID();
while ($parent_id > 0) {
/** @var StructuralDBElement $element */
$element = static::getInstance($this->database, $this->current_user, $this->log, $parent_id);
$parent_id = $element->getParentID();
$element = $this;
while ($element->parent != null) {
$element = $element->parent;
$this->full_path_strings[] = $element->getName();
}
$this->full_path_strings = array_reverse($this->full_path_strings);
}