add some phpdoc
This commit is contained in:
@@ -5,12 +5,10 @@
|
|||||||
xsi:schemaLocation="http://thelia.net/schema/dic/config http://thelia.net/schema/dic/config/thelia-1.0.xsd">
|
xsi:schemaLocation="http://thelia.net/schema/dic/config http://thelia.net/schema/dic/config/thelia-1.0.xsd">
|
||||||
|
|
||||||
<testLoops>
|
<testLoops>
|
||||||
<testLoop name="equal" class="Test\TestLoop\Equal"/>
|
<testLoop name="equal" class="Thelia\Core\Template\TestLoop\Equal"/>
|
||||||
</testLoops>
|
</testLoops>
|
||||||
|
|
||||||
<loops>
|
<loops>
|
||||||
<loop name="foo" class="Foo\Bar"/>
|
|
||||||
<loop name="fooz" class="Foo\Barz"/>
|
|
||||||
<loop class="Thelia\Core\Template\Loop\Category" name="category"/>
|
<loop class="Thelia\Core\Template\Loop\Category" name="category"/>
|
||||||
</loops>
|
</loops>
|
||||||
|
|
||||||
|
|||||||
@@ -25,11 +25,39 @@
|
|||||||
namespace Thelia\Core\Template\Loop;
|
namespace Thelia\Core\Template\Loop;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
use Thelia\Log\Tlog;
|
|
||||||
use Thelia\Tpex\Element\Loop\BaseLoop;
|
use Thelia\Tpex\Element\Loop\BaseLoop;
|
||||||
use Thelia\Model\CategoryQuery;
|
use Thelia\Model\CategoryQuery;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Category loop, all params available :
|
||||||
|
*
|
||||||
|
* - id : can be an id (eq : 3) or a "string list" (eg: 3, 4, 5)
|
||||||
|
* - parent : categories having this parent id
|
||||||
|
* - current : current id is used if you are on a category page
|
||||||
|
* - not_empty : if value is 1, category and subcategories must have at least 1 product
|
||||||
|
* - visible : default 1, if you want category not visible put 0
|
||||||
|
* - order : all value available :
|
||||||
|
* * alpha : sorting by title alphabetical order
|
||||||
|
* * alpha_reverse : sorting by title alphabetical reverse order
|
||||||
|
* * reverse : sorting by position descending
|
||||||
|
* * by default results are sorting by position ascending
|
||||||
|
* - random : if 1, random results. Default value is 0
|
||||||
|
* - exclude : all category id you want to exclude (as for id, an integer or a "string list" can be used)
|
||||||
|
* - limit : number of results. Default value is 10
|
||||||
|
* - offset : at witch id start the search
|
||||||
|
*
|
||||||
|
* example :
|
||||||
|
*
|
||||||
|
* <THELIA_cat type="category" parent="3" limit="4">
|
||||||
|
* #TITLE : #ID
|
||||||
|
* </THELIA_cat>
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Class Category
|
||||||
|
* @package Thelia\Core\Template\Loop
|
||||||
|
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||||
|
*/
|
||||||
class Category extends BaseLoop {
|
class Category extends BaseLoop {
|
||||||
|
|
||||||
public $id;
|
public $id;
|
||||||
@@ -41,7 +69,7 @@ class Category extends BaseLoop {
|
|||||||
public $order;
|
public $order;
|
||||||
public $random;
|
public $random;
|
||||||
public $exclude;
|
public $exclude;
|
||||||
public $start;
|
public $limit;
|
||||||
public $offset;
|
public $offset;
|
||||||
|
|
||||||
public function defineArgs()
|
public function defineArgs()
|
||||||
@@ -64,7 +92,7 @@ class Category extends BaseLoop {
|
|||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* @param \Thelia\Tpex\Element\Loop\text $text
|
* @param string $text
|
||||||
* @return mixed|string
|
* @return mixed|string
|
||||||
*/
|
*/
|
||||||
public function exec($text)
|
public function exec($text)
|
||||||
@@ -72,7 +100,7 @@ class Category extends BaseLoop {
|
|||||||
$search = CategoryQuery::create();
|
$search = CategoryQuery::create();
|
||||||
|
|
||||||
if (!is_null($this->id)) {
|
if (!is_null($this->id)) {
|
||||||
$search->filterById($this->id);
|
$search->filterById($this->id, \Criteria::IN);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!is_null($this->parent)) {
|
if(!is_null($this->parent)) {
|
||||||
|
|||||||
51
core/lib/Thelia/Core/Template/TestLoop/Equal.php
Normal file
51
core/lib/Thelia/Core/Template/TestLoop/Equal.php
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
<?php
|
||||||
|
/*************************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* Thelia */
|
||||||
|
/* */
|
||||||
|
/* Copyright (c) OpenStudio */
|
||||||
|
/* email : info@thelia.net */
|
||||||
|
/* web : http://www.thelia.net */
|
||||||
|
/* */
|
||||||
|
/* This program is free software; you can redistribute it and/or modify */
|
||||||
|
/* it under the terms of the GNU General Public License as published by */
|
||||||
|
/* the Free Software Foundation; either version 3 of the License */
|
||||||
|
/* */
|
||||||
|
/* This program is distributed in the hope that it will be useful, */
|
||||||
|
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||||
|
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||||
|
/* GNU General Public License for more details. */
|
||||||
|
/* */
|
||||||
|
/* You should have received a copy of the GNU General Public License */
|
||||||
|
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||||
|
/* */
|
||||||
|
/*************************************************************************************/
|
||||||
|
|
||||||
|
namespace Thelia\Core\Template\TestLoop;
|
||||||
|
|
||||||
|
use Thelia\Tpex\Element\TestLoop\BaseTestLoop;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* TestLoop equal, test if value and variable are equal
|
||||||
|
*
|
||||||
|
* example :
|
||||||
|
*
|
||||||
|
* <TEST_equal test="equal" variable="3" value="1">
|
||||||
|
* Result display here if variable and value are equal
|
||||||
|
* </TEST_equal>
|
||||||
|
* Result display here if variable and value are not equal
|
||||||
|
* <//TEST_equal>
|
||||||
|
*
|
||||||
|
* Class Equal
|
||||||
|
* @package Thelia\Core\Template\TestLoop
|
||||||
|
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||||
|
*/
|
||||||
|
class Equal extends BaseTestLoop
|
||||||
|
{
|
||||||
|
|
||||||
|
public function exec($variable, $value)
|
||||||
|
{
|
||||||
|
return $variable == $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,7 +7,7 @@
|
|||||||
<body>
|
<body>
|
||||||
<div>TODO write content<br />
|
<div>TODO write content<br />
|
||||||
|
|
||||||
<THELIA_cat type="category" not_empty="1">
|
<THELIA_cat type="category">
|
||||||
#__COUNT__ - #TITLE <br />
|
#__COUNT__ - #TITLE <br />
|
||||||
nb child : #NB_CHILD <br /><br />
|
nb child : #NB_CHILD <br /><br />
|
||||||
</THELIA_cat>
|
</THELIA_cat>
|
||||||
|
|||||||
Reference in New Issue
Block a user