Initial commit
This commit is contained in:
113
local/modules/Carousel/Model/Carousel.php
Normal file
113
local/modules/Carousel/Model/Carousel.php
Normal file
@@ -0,0 +1,113 @@
|
||||
<?php
|
||||
|
||||
namespace Carousel\Model;
|
||||
|
||||
use Carousel\Form\CarouselImageForm;
|
||||
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\Core\HttpFoundation\Request;
|
||||
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();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $objectId the object ID
|
||||
*
|
||||
* @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;
|
||||
}
|
||||
}
|
||||
10
local/modules/Carousel/Model/CarouselI18n.php
Normal file
10
local/modules/Carousel/Model/CarouselI18n.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace Carousel\Model;
|
||||
|
||||
use Carousel\Model\Base\CarouselI18n as BaseCarouselI18n;
|
||||
|
||||
class CarouselI18n extends BaseCarouselI18n
|
||||
{
|
||||
|
||||
}
|
||||
21
local/modules/Carousel/Model/CarouselI18nQuery.php
Normal file
21
local/modules/Carousel/Model/CarouselI18nQuery.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
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
|
||||
25
local/modules/Carousel/Model/CarouselQuery.php
Normal file
25
local/modules/Carousel/Model/CarouselQuery.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
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