[11/06/2024] Les premières modifs + installation de quelques modules indispensables
This commit is contained in:
120
domokits/local/modules/Carousel/Model/Carousel.php
Normal file
120
domokits/local/modules/Carousel/Model/Carousel.php
Normal file
@@ -0,0 +1,120 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Thelia package.
|
||||
* http://www.thelia.net
|
||||
*
|
||||
* (c) OpenStudio <info@thelia.net>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Carousel\Model;
|
||||
|
||||
use Carousel\Model\Base\Carousel as BaseCarousel;
|
||||
use Propel\Runtime\ActiveQuery\ModelCriteria;
|
||||
use Propel\Runtime\Connection\ConnectionInterface;
|
||||
use Symfony\Component\Filesystem\Exception\IOException;
|
||||
use Symfony\Component\Filesystem\Filesystem;
|
||||
use Thelia\Files\FileModelInterface;
|
||||
use Thelia\Files\FileModelParentInterface;
|
||||
use Thelia\Form\BaseForm;
|
||||
|
||||
class Carousel extends BaseCarousel implements FileModelInterface
|
||||
{
|
||||
public function preDelete(ConnectionInterface $con = null)
|
||||
{
|
||||
$carousel = new \Carousel\Carousel();
|
||||
|
||||
$fs = new Filesystem();
|
||||
|
||||
try {
|
||||
$fs->remove($carousel->getUploadDir().DS.$this->getFile());
|
||||
|
||||
return true;
|
||||
} catch (IOException $e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set file parent id.
|
||||
*
|
||||
* @param int $parentId parent id
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setParentId($parentId)
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get file parent id.
|
||||
*
|
||||
* @return int parent id
|
||||
*/
|
||||
public function getParentId()
|
||||
{
|
||||
return $this->getId();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return FileModelParentInterface the parent file model
|
||||
*/
|
||||
public function getParentFileModel()
|
||||
{
|
||||
return new static();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the ID of the form used to change this object information.
|
||||
*
|
||||
* @return BaseForm the form
|
||||
*/
|
||||
public function getUpdateFormId()
|
||||
{
|
||||
return 'carousel.image';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string the path to the upload directory where files are stored, without final slash
|
||||
*/
|
||||
public function getUploadDir()
|
||||
{
|
||||
$carousel = new \Carousel\Carousel();
|
||||
|
||||
return $carousel->getUploadDir();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string the URL to redirect to after update from the back-office
|
||||
*/
|
||||
public function getRedirectionUrl()
|
||||
{
|
||||
return '/admin/module/Carousel';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Query instance for this object.
|
||||
*
|
||||
* @return ModelCriteria
|
||||
*/
|
||||
public function getQueryInstance()
|
||||
{
|
||||
return CarouselQuery::create();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $visible true if the file is visible, false otherwise
|
||||
*
|
||||
* @return FileModelInterface
|
||||
*/
|
||||
public function setVisible($visible)
|
||||
{
|
||||
// Not implemented
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
19
domokits/local/modules/Carousel/Model/CarouselI18n.php
Normal file
19
domokits/local/modules/Carousel/Model/CarouselI18n.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Thelia package.
|
||||
* http://www.thelia.net
|
||||
*
|
||||
* (c) OpenStudio <info@thelia.net>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Carousel\Model;
|
||||
|
||||
use Carousel\Model\Base\CarouselI18n as BaseCarouselI18n;
|
||||
|
||||
class CarouselI18n extends BaseCarouselI18n
|
||||
{
|
||||
}
|
||||
26
domokits/local/modules/Carousel/Model/CarouselI18nQuery.php
Normal file
26
domokits/local/modules/Carousel/Model/CarouselI18nQuery.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Thelia package.
|
||||
* http://www.thelia.net
|
||||
*
|
||||
* (c) OpenStudio <info@thelia.net>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Carousel\Model;
|
||||
|
||||
use Carousel\Model\Base\CarouselI18nQuery as BaseCarouselI18nQuery;
|
||||
|
||||
/**
|
||||
* Skeleton subclass for performing query and update operations on the 'carousel_i18n' table.
|
||||
*
|
||||
* You should add additional methods to this class to meet the
|
||||
* application requirements. This class will only be generated as
|
||||
* long as it does not already exist in the output directory.
|
||||
*/
|
||||
class CarouselI18nQuery extends BaseCarouselI18nQuery
|
||||
{
|
||||
} // CarouselI18nQuery
|
||||
31
domokits/local/modules/Carousel/Model/CarouselQuery.php
Normal file
31
domokits/local/modules/Carousel/Model/CarouselQuery.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Thelia package.
|
||||
* http://www.thelia.net
|
||||
*
|
||||
* (c) OpenStudio <info@thelia.net>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Carousel\Model;
|
||||
|
||||
use Carousel\Model\Base\CarouselQuery as BaseCarouselQuery;
|
||||
|
||||
/**
|
||||
* Skeleton subclass for performing query and update operations on the 'carousel' table.
|
||||
*
|
||||
* You should add additional methods to this class to meet the
|
||||
* application requirements. This class will only be generated as
|
||||
* long as it does not already exist in the output directory.
|
||||
*/
|
||||
class CarouselQuery extends BaseCarouselQuery
|
||||
{
|
||||
public function findAllByPosition()
|
||||
{
|
||||
return $this->orderByPosition()
|
||||
->find();
|
||||
}
|
||||
} // CarouselQuery
|
||||
Reference in New Issue
Block a user