소스 검색

Gestion pages CMS

reduction
Guillaume 4 년 전
부모
커밋
d7a59be516
9개의 변경된 파일150개의 추가작업 그리고 9개의 파일을 삭제
  1. +8
    -0
      ShopBundle/Context/PageInterface.php
  2. +16
    -0
      ShopBundle/Model/AbstractDocumentEntity.php
  3. +0
    -2
      ShopBundle/Model/Address.php
  4. +33
    -0
      ShopBundle/Model/Page.php
  5. +10
    -0
      ShopBundle/Repository/BaseRepository.php
  6. +51
    -0
      ShopBundle/Repository/PageRepository.php
  7. +8
    -1
      ShopBundle/Resources/public/js/backend/script/utils.js
  8. +18
    -5
      ShopBundle/Services/Utils.php
  9. +6
    -1
      ShopBundle/Twig/BridgeTwigExtension.php

+ 8
- 0
ShopBundle/Context/PageInterface.php 파일 보기

@@ -0,0 +1,8 @@
<?php

namespace Lc\ShopBundle\Context;

interface PageInterface
{

}

+ 16
- 0
ShopBundle/Model/AbstractDocumentEntity.php 파일 보기

@@ -38,6 +38,11 @@ abstract class AbstractDocumentEntity extends AbstractEntity implements StatusIn
*/
protected $image;

/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
protected $devAlias;


public function getTitle(): ?string
{
@@ -87,5 +92,16 @@ abstract class AbstractDocumentEntity extends AbstractEntity implements StatusIn
return $this;
}

public function getDevAlias(): ?string
{
return $this->devAlias;
}

public function setDevAlias(?string $devAlias): self
{
$this->devAlias = $devAlias;

return $this;
}

}

+ 0
- 2
ShopBundle/Model/Address.php 파일 보기

@@ -2,8 +2,6 @@

namespace Lc\ShopBundle\Model;

use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;

/**

+ 33
- 0
ShopBundle/Model/Page.php 파일 보기

@@ -0,0 +1,33 @@
<?php

namespace Lc\ShopBundle\Model;

use Doctrine\ORM\Mapping as ORM;

/**
* @ORM\MappedSuperclass()
*/
abstract class Page extends AbstractDocumentEntity
{
/**
* @ORM\Column(type="text", nullable=true)
*/
protected $content;

public function __toString()
{
return $this->getTitle() ;
}

public function getContent(): ?string
{
return $this->content;
}

public function setContent(?string $content): self
{
$this->content = $content;

return $this;
}
}

+ 10
- 0
ShopBundle/Repository/BaseRepository.php 파일 보기

@@ -36,5 +36,15 @@ class BaseRepository extends EntityRepository implements ServiceEntityRepository

}

public function findOneByDevAlias($devAlias)
{
return $this->createQueryBuilder('e')
->where('e.devAlias = :devAlias')
->andWhere('object.status = 1')
->setParameter('devAlias', $devAlias)
->getQuery()
->getResult();
}


}

+ 51
- 0
ShopBundle/Repository/PageRepository.php 파일 보기

@@ -0,0 +1,51 @@
<?php

namespace Lc\ShopBundle\Repository;

use App\Entity\Page;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Common\Persistence\ManagerRegistry;
use Lc\ShopBundle\Repository\BaseRepository;

/**
* @method Page|null find($id, $lockMode = null, $lockVersion = null)
* @method Page|null findOneBy(array $criteria, array $orderBy = null)
* @method Page[] findAll()
* @method Page[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class PageRepository extends BaseRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, Page::class);
}

// /**
// * @return Page[] Returns an array of Page objects
// */
/*
public function findByExampleField($value)
{
return $this->createQueryBuilder('p')
->andWhere('p.exampleField = :val')
->setParameter('val', $value)
->orderBy('p.id', 'ASC')
->setMaxResults(10)
->getQuery()
->getResult()
;
}
*/

/*
public function findOneBySomeField($value): ?Page
{
return $this->createQueryBuilder('p')
->andWhere('p.exampleField = :val')
->setParameter('val', $value)
->getQuery()
->getOneOrNullResult()
;
}
*/
}

+ 8
- 1
ShopBundle/Resources/public/js/backend/script/utils.js 파일 보기

@@ -45,7 +45,14 @@ function initLcCkEditor(){
var elements = $( '.lc-ckeditor' );

for ( var i = 0; i < elements.length; ++i ) {
CKEDITOR.replace( elements[ i ], {"toolbar":[{"name":"styles","items":["Bold","Italic","BulletedList","Link","imageUpload","ckfinder"]}],"language":"fr"} );
var editor = CKEDITOR.replace( elements[ i ], {"toolbar":[
{name:"styles",items:["Format",'Bold', 'Italic', 'Underline', 'Strike',"Link","BulletedList"]},
{name: 'paragraph', items: ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'] },
{name: 'insert', items: [ 'Image','SpecialChar'] },
{name:"document",items:["Source"]},
],
"language":"fr"} );
CKFinder.setupCKEditor(editor);
}
}


+ 18
- 5
ShopBundle/Services/Utils.php 파일 보기

@@ -2,8 +2,13 @@

namespace Lc\ShopBundle\Services;

use Doctrine\ORM\EntityManagerInterface;
use Lc\ShopBundle\Context\PageInterface;

class Utils
{
protected $em ;

protected $unitsArray = [
'piece' => [
'unit' => 'piece',
@@ -55,10 +60,15 @@ class Utils
],
];

public function __construct(EntityManagerInterface $em)
{
$this->em = $em ;
}

public static function getDayByNumber($number)
{
$daysArray = [
1 => 'Lundu',
1 => 'Lundi',
2 => 'Mardi',
3 => 'Mercredi',
4 => 'Jeudi',
@@ -74,17 +84,20 @@ class Utils
return '' ;
}

public function getUnitsListFormatedForType(){
public function getUnitsListFormatedForType() {
foreach ($this->unitsArray as $unit=>$unitInfo){
$choices[$unitInfo['wording_unit']] = $unit;
};
return $choices;
}
public function getUnitsList(){
public function getUnitsList() {
return $this->unitsArray;
}



public function getElementByDevAlias($devAlias, $class = PageInterface::class)
{
$class = $this->em->getClassMetadata($class)->getName();
return $this->em->getRepository($class)->findOneByDevAlias($devAlias) ;
}

}

+ 6
- 1
ShopBundle/Twig/BridgeTwigExtension.php 파일 보기

@@ -2,9 +2,9 @@

namespace Lc\ShopBundle\Twig;

use Lc\ShopBundle\Context\PageInterface;
use Lc\ShopBundle\Services\Utils;
use Twig\Extension\AbstractExtension;
use Twig\TwigFilter;
use Twig\TwigFunction;

class BridgeTwigExtension extends AbstractExtension
@@ -21,6 +21,7 @@ class BridgeTwigExtension extends AbstractExtension
return array(
new TwigFunction('getDayByNumber', [$this, 'getDayByNumber']),
new TwigFunction('getUnitsList', [$this, 'getUnitsList']),
new TwigFunction('getElementByDevAlias', [$this, 'getElementByDevAlias']),
);
}

@@ -40,4 +41,8 @@ class BridgeTwigExtension extends AbstractExtension
return $this->utils->getUnitsList() ;
}

public function getElementByDevAlias($devAlias, $class = PageInterface::class)
{
return $this->utils->getElementByDevAlias($devAlias, $class) ;
}
}

Loading…
취소
저장