2016-01-04 12:48:08 +01:00
< ? php
/*
2016-08-30 13:47:42 +02:00
* 2007 - 2011 PrestaShop
2016-01-04 12:48:08 +01:00
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License ( OSL 3.0 )
* that is bundled with this package in the file LICENSE . txt .
* It is also available through the world - wide - web at this URL :
* http :// opensource . org / licenses / osl - 3.0 . php
* If you did not receive a copy of the license and are unable to
* obtain it through the world - wide - web , please send an email
* to license @ prestashop . com so we can send you a copy immediately .
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future . If you wish to customize PrestaShop for your
* needs please refer to http :// www . prestashop . com for more information .
*
* @ author PrestaShop SA < contact @ prestashop . com >
* @ copyright 2007 - 2011 PrestaShop SA
* @ version Release : $Revision : 9015 $
* @ license http :// opensource . org / licenses / osl - 3.0 . php Open Software License ( OSL 3.0 )
* International Registered Trademark & Property of PrestaShop SA
*/
class AdminCategories extends AdminTab
{
2016-08-30 13:47:42 +02:00
protected $maxImageSize = 3000000 ;
/** @var object Category() instance for navigation*/
private $_category ;
public function __construct ()
{
global $cookie ;
$this -> table = 'category' ;
$this -> className = 'Category' ;
$this -> lang = true ;
$this -> edit = true ;
$this -> view = true ;
$this -> delete = true ;
$this -> fieldImageSettings = array ( 'name' => 'image' , 'dir' => 'c' );
$this -> fieldsDisplay = array (
'id_category' => array ( 'title' => $this -> l ( 'ID' ), 'align' => 'center' , 'width' => 30 ),
'name' => array ( 'title' => $this -> l ( 'Name' ), 'width' => 100 , 'small_title' => true ),
'description' => array ( 'title' => $this -> l ( 'Description' ), 'width' => 500 , 'maxlength' => 90 , 'orderby' => false ),
'position' => array ( 'title' => $this -> l ( 'Position' ), 'width' => 40 , 'filter_key' => 'position' , 'align' => 'center' , 'position' => 'position' ),
'active' => array ( 'title' => $this -> l ( 'Displayed' ), 'active' => 'status' , 'align' => 'center' , 'type' => 'bool' , 'orderby' => false ));
$this -> _category = AdminCatalog :: getCurrentCategory ();
$this -> _filter = 'AND `id_parent` = ' . ( int )( $this -> _category -> id );
$this -> _select = 'position ' ;
if ( $this -> _category -> id == 1 ) {
$this -> _orderBy = 'id_category' ;
$this -> _orderWay = 'DESC' ;
}
parent :: __construct ();
}
2017-09-15 16:13:15 +02:00
protected function recurseCategoryTreeFlat ( $id_category , $category_selected , $level_start = 0 )
2017-09-15 10:57:16 +02:00
{
global $currentIndex ;
2017-09-25 10:59:34 +02:00
2017-09-15 10:57:16 +02:00
$id_lang = _USER_ID_LANG_ ;
$categoriesOption = " " ;
$active = false ;
$sql = ' SELECT c . `id_category` , cl . `name` , c . `level_depth`
FROM `'._DB_PREFIX_.'category` c
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON c . `id_category` = cl . `id_category`
WHERE `id_lang` = '.(int)($id_lang).'
AND c . `id_parent` = '.(int)($id_category).'
'.($active ? ' AND `active` = 1 ' : ' ').'
ORDER BY `position` ASC ' ;
$categories = Db :: getInstance ( _PS_USE_SQL_SLAVE_ ) -> executeS ( $sql );
// Get level
if ( count ( $categories ) > 0 ) {
foreach ( $categories as $c ) {
$levelStr = " " ;
$levelStr = str_pad ( $levelStr , $c [ 'level_depth' ] - $level_start , '-' , STR_PAD_LEFT );
if ( $levelStr == " " ) {
$levelStr = " " ;
}
$categoriesOption .= '<option value="" data-url="' . $currentIndex . '&' .
$this -> identifier . '=' . $c [ 'id_category' ] . '&view' . $this -> table . '&token=' . ( $token != NULL ? $token : $this -> token ) . '"' .
( $category_selected == $c [ 'id_category' ] ? ' selected="selected"' : '' ) . '>' .
$levelStr . $c [ 'name' ] . '</option>' ;
$children = $this -> recurseCategoryTreeFlat ( $c [ 'id_category' ], $category_selected , $level_start );
$categoriesOption .= $children ;
}
}
2017-09-25 10:59:34 +02:00
2017-09-15 10:57:16 +02:00
return $categoriesOption ;
}
2017-09-25 10:59:34 +02:00
2017-09-15 10:57:16 +02:00
protected function displayListTree ()
{
2017-09-15 16:19:44 +02:00
global $currentIndex ;
2017-09-25 10:59:34 +02:00
2017-09-15 10:57:16 +02:00
if ( $this -> _category -> id_category == 1 ) {
echo " " ;
}
// Go to list category and subcategory
else {
$categoryMain = null ;
// Get Upper category_id
$categoryM = new Category ( $this -> _category -> id_category );
$categoryParents = $categoryM -> getParentsCategories ();
if ( count ( $categoryParents ) > 0 ) {
$categoryRoot = $categoryParents [ count ( $categoryParents ) - 1 ];
}
2017-09-25 10:59:34 +02:00
2017-09-15 10:57:16 +02:00
if ( $categoryRoot ) {
echo ' < select id = " selectCategory " style = " margin:0 5px;padding:4px;font-size:14px; "
onchange = " document.location= $ (this).find( \ 'option:selected \ ').data( \ 'url \ '); " > ' ;
2017-09-15 16:13:15 +02:00
// Add root category
echo '<option value="" data-url="' . $currentIndex . '&' .
$this -> identifier . '=' . $categoryRoot [ 'id_category' ] . '&view' . $this -> table . '&token=' . ( $token != NULL ? $token : $this -> token ) . '"' .
( $this -> _category -> id_category == $categoryRoot [ 'id_category' ] ? ' selected="selected"' : '' ) . '>' .
$levelStr . $categoryRoot [ 'name' ] . '</option>' ;
// List recursively
2017-09-15 10:57:16 +02:00
echo $this -> recurseCategoryTreeFlat ( $categoryRoot [ 'id_category' ], $this -> _category -> id_category );
echo '</select>' ;
}
}
}
2017-09-25 10:59:34 +02:00
2016-08-30 13:47:42 +02:00
public function displayListContent ( $token = NULL )
{
global $currentIndex , $cookie ;
if ( $this -> _category -> id_parent == 1 ) {
$sub_categories = array ();
foreach ( $this -> _list as $key => $category_one ) {
$subcategories = Category :: getChildren ( $category_one [ 'id_category' ], $cookie -> id_lang );
if ( $subcategories ) {
foreach ( $subcategories as $subcat ) {
if ( ! is_array ( $this -> _list [ $key ][ 'childs' ])) {
$this -> _list [ $key ][ 'childs' ] = array ();
}
$category_tmp = new Category ( $subcat [ 'id_category' ], $cookie -> id_lang );
$this -> _list [ $key ][ 'childs' ][] = get_object_vars ( $category_tmp );
}
}
}
$currency = new Currency ( Configuration :: get ( 'PS_CURRENCY_DEFAULT' ));
$id_category = 1 ; // default categ
$irow = 0 ;
if ( $this -> _list AND isset ( $this -> fieldsDisplay [ 'position' ]))
{
$positions = array_map ( create_function ( '$elem' , 'return (int)($elem[\'position\']);' ), $this -> _list );
sort ( $positions );
}
if ( $this -> _list )
{
$isCms = false ;
if ( preg_match ( '/cms/Ui' , $this -> identifier ))
$isCms = true ;
$keyToGet = 'id_' . ( $isCms ? 'cms_' : '' ) . 'category' . ( in_array ( $this -> identifier , array ( 'id_category' , 'id_cms_category' )) ? '_parent' : '' );
foreach ( $this -> _list AS $tr )
{
$id = $tr [ $this -> identifier ];
echo '<tr' . ( array_key_exists ( $this -> identifier , $this -> identifiersDnd ) ? ' id="tr_' . (( $id_category = ( int )( Tools :: getValue ( 'id_' . ( $isCms ? 'cms_' : '' ) . 'category' , '1' ))) ? $id_category : '' ) . '_' . $id . '_' . $tr [ 'position' ] . '"' : '' ) . ( $irow ++ % 2 ? ' class="alt_row"' : '' ) . ' ' . (( isset ( $tr [ 'color' ]) AND $this -> colorOnBackground ) ? 'style="background-color: ' . $tr [ 'color' ] . '"' : '' ) . ' >
< td class = " center " > ' ;
if ( $this -> delete AND ( ! isset ( $this -> _listSkipDelete ) OR ! in_array ( $id , $this -> _listSkipDelete )))
echo '<input type="checkbox" name="' . $this -> table . 'Box[]" value="' . $id . '" class="noborder" />' ;
echo '</td>' ;
foreach ( $this -> fieldsDisplay AS $key => $params )
{
$tmp = explode ( '!' , $key );
$key = isset ( $tmp [ 1 ]) ? $tmp [ 1 ] : $tmp [ 0 ];
echo '
< td '.(isset($params[' position ']) ? ' id = " td_'.(isset( $id_category ) AND $id_category ? $id_category : 0).'_'. $id .' " ' : ' ').' class = " '.((!isset( $this->noLink ) OR ! $this->noLink ) ? 'pointer' : '').((isset( $params['position'] ) AND $this->_orderBy == 'position')? ' dragHandle' : ''). (isset( $params['align'] ) ? ' '. $params['align'] : '').' " ' ;
if ( ! isset ( $params [ 'position' ]) AND ( ! isset ( $this -> noLink ) OR ! $this -> noLink ))
echo ' onclick="document.location = \'' . $currentIndex . '&' . $this -> identifier . '=' . $id . ( $this -> view ? '&view' : '&update' ) . $this -> table . '&token=' . ( $token != NULL ? $token : $this -> token ) . '\'">' . ( isset ( $params [ 'prefix' ]) ? $params [ 'prefix' ] : '' );
else
echo '>' ;
if ( isset ( $params [ 'active' ]) AND isset ( $tr [ $key ]))
$this -> _displayEnableLink ( $token , $id , $tr [ $key ], $params [ 'active' ], Tools :: getValue ( 'id_category' ), Tools :: getValue ( 'id_product' ));
elseif ( isset ( $params [ 'activeVisu' ]) AND isset ( $tr [ $key ]))
echo '<img src="../img/admin/' . ( $tr [ $key ] ? 'enabled.gif' : 'disabled.gif' ) . ' "
alt = " '.( $tr[$key] ? $this->l ('Enabled') : $this->l ('Disabled')).' " title = " '.( $tr[$key] ? $this->l ('Enabled') : $this->l ('Disabled')).' " /> ' ;
elseif ( isset ( $params [ 'position' ]))
{
if ( $this -> _orderBy == 'position' AND $this -> _orderWay != 'DESC' )
{
echo '<a' . ( ! ( $tr [ $key ] != $positions [ sizeof ( $positions ) - 1 ]) ? ' style="display: none;"' : '' ) . ' href="' . $currentIndex .
'&' . $keyToGet . '=' . ( int )( $id_category ) . '&' . $this -> identifiersDnd [ $this -> identifier ] . '=' . $id . '
& way = 1 & position = '.(int)($tr[' position '] + 1).' & token = '.($token!=NULL ? $token : $this->token).' " >
< img src = " ../img/admin/'.( $this->_orderWay == 'ASC' ? 'down' : 'up').'.gif "
alt = " '. $this->l ('Down').' " title = " '. $this->l ('Down').' " /></ a > ' ;
echo '<a' . ( ! ( $tr [ $key ] != $positions [ 0 ]) ? ' style="display: none;"' : '' ) . ' href="' . $currentIndex .
'&' . $keyToGet . '=' . ( int )( $id_category ) . '&' . $this -> identifiersDnd [ $this -> identifier ] . '=' . $id . '
& way = 0 & position = '.(int)($tr[' position '] - 1).' & token = '.($token!=NULL ? $token : $this->token).' " >
< img src = " ../img/admin/'.( $this->_orderWay == 'ASC' ? 'up' : 'down').'.gif "
alt = " '. $this->l ('Up').' " title = " '. $this->l ('Up').' " /></ a > ' ; }
else
echo ( int )( $tr [ $key ] + 1 );
}
elseif ( isset ( $params [ 'image' ]))
{
// item_id is the product id in a product image context, else it is the image id.
$item_id = isset ( $params [ 'image_id' ]) ? $tr [ $params [ 'image_id' ]] : $id ;
// If it's a product image
if ( isset ( $tr [ 'id_image' ]))
{
$image = new Image (( int ) $tr [ 'id_image' ]);
$path_to_image = _PS_IMG_DIR_ . $params [ 'image' ] . '/' . $image -> getExistingImgPath () . '.' . $this -> imageType ;
} else
$path_to_image = _PS_IMG_DIR_ . $params [ 'image' ] . '/' . $item_id . ( isset ( $tr [ 'id_image' ]) ? '-' . ( int )( $tr [ 'id_image' ]) : '' ) . '.' . $this -> imageType ;
echo cacheImage ( $path_to_image , $this -> table . '_mini_' . $item_id . '.' . $this -> imageType , 45 , $this -> imageType );
}
elseif ( isset ( $params [ 'icon' ]) AND ( isset ( $params [ 'icon' ][ $tr [ $key ]]) OR isset ( $params [ 'icon' ][ 'default' ])))
echo '<img src="../img/admin/' . ( isset ( $params [ 'icon' ][ $tr [ $key ]]) ? $params [ 'icon' ][ $tr [ $key ]] : $params [ 'icon' ][ 'default' ] . '" alt="' . $tr [ $key ]) . '" title="' . $tr [ $key ] . '" />' ;
elseif ( isset ( $params [ 'price' ]))
echo Tools :: displayPrice ( $tr [ $key ], ( isset ( $params [ 'currency' ]) ? Currency :: getCurrencyInstance (( int )( $tr [ 'id_currency' ])) : $currency ), false );
elseif ( isset ( $params [ 'float' ]))
echo rtrim ( rtrim ( $tr [ $key ], '0' ), '.' );
elseif ( isset ( $params [ 'type' ]) AND $params [ 'type' ] == 'date' )
echo Tools :: displayDate ( $tr [ $key ], ( int ) $cookie -> id_lang );
elseif ( isset ( $params [ 'type' ]) AND $params [ 'type' ] == 'datetime' )
echo Tools :: displayDate ( $tr [ $key ], ( int ) $cookie -> id_lang , true );
elseif ( isset ( $tr [ $key ]))
{
$echo = ( $key == 'price' ? round ( $tr [ $key ], 2 ) : isset ( $params [ 'maxlength' ]) ? Tools :: substr ( $tr [ $key ], 0 , $params [ 'maxlength' ]) . '...' : $tr [ $key ]);
echo isset ( $params [ 'callback' ]) ? call_user_func_array ( array ( $this -> className , $params [ 'callback' ]), array ( $echo , $tr )) : $echo ;
}
else
echo '--' ;
echo ( isset ( $params [ 'suffix' ]) ? $params [ 'suffix' ] : '' ) .
'</td>' ;
}
if ( $this -> edit OR $this -> delete OR ( $this -> view AND $this -> view !== 'noActionColumn' ))
{
echo '<td class="center" style="white-space: nowrap;">' ;
if ( $this -> view )
$this -> _displayViewLink ( $token , $id );
if ( $this -> edit )
$this -> _displayEditLink ( $token , $id );
if ( $this -> delete AND ( ! isset ( $this -> _listSkipDelete ) OR ! in_array ( $id , $this -> _listSkipDelete )))
$this -> _displayDeleteLink ( $token , $id );
if ( $this -> duplicate )
$this -> _displayDuplicate ( $token , $id );
echo '</td>' ;
}
echo '</tr>' ;
if ( $tr [ 'childs' ]) {
foreach ( $tr [ 'childs' ] as $key => $child ) {
$id = $child [ 'id_category' ];
echo '<tr>' ;
echo '<td>-</td>' ;
echo '<td style="cursor:pointer" onclick="window.location.href= \'' . $currentIndex . '&' . $this -> identifier . '=' . $id . ( $this -> view ? '&view' : '&update' ) . $this -> table . '&token=' . ( $token != NULL ? $token : $this -> token ) . '\'" >' . $child [ 'id_category' ] . '</td>' ;
echo '<td style="cursor:pointer" onclick="window.location.href= \'' . $currentIndex . '&' . $this -> identifier . '=' . $id . ( $this -> view ? '&view' : '&update' ) . $this -> table . '&token=' . ( $token != NULL ? $token : $this -> token ) . '\'" colspan="4">-- ' . $child [ 'name' ] . '</td>' ;
if ( $this -> edit OR $this -> delete OR ( $this -> view AND $this -> view !== 'noActionColumn' )) {
echo '<td class="center" style="white-space: nowrap;">' ;
if ( $this -> view )
$this -> _displayViewLink ( $token , $id );
if ( $this -> edit )
$this -> _displayEditLink ( $token , $id );
if ( $this -> delete AND ( ! isset ( $this -> _listSkipDelete ) OR ! in_array ( $id , $this -> _listSkipDelete )))
$this -> _displayDeleteLink ( $token , $id );
if ( $this -> duplicate )
$this -> _displayDuplicate ( $token , $id );
echo '</td>' ;
}
echo '</tr>' ;
}
}
}
}
} else {
$currency = new Currency ( Configuration :: get ( 'PS_CURRENCY_DEFAULT' ));
$id_category = 1 ; // default categ
$irow = 0 ;
if ( $this -> _list AND isset ( $this -> fieldsDisplay [ 'position' ]))
{
$positions = array_map ( create_function ( '$elem' , 'return (int)($elem[\'position\']);' ), $this -> _list );
sort ( $positions );
}
if ( $this -> _list )
{
$isCms = false ;
$ids_categories = array_map ( function ( $elem ) {
return $elem [ 'id_category' ];
}, $this -> _list );
$small_titles = array ();
foreach ( Db :: getInstance () -> executeS ( '
SELECT ex . `value` , ps . `id_category`
FROM `'._DB_PREFIX_.'privatesale_extrafield_sale` ex
LEFT JOIN `'._DB_PREFIX_.'privatesale` ps on ex . `id_sale` = ps . `id_sale`
LEFT JOIN `'._DB_PREFIX_.'category` c on c . `id_category` = ps . `id_category`
WHERE ex . `id_field` = 1
AND ex . `id_lang` = '. (int) $cookie->id_lang.'
AND c . `id_category` IN ( '.implode(' , ', $ids_categories).' )
' ) as $key => $data ) {
$small_titles [( int ) $data [ 'id_category' ]] = $data [ 'value' ];
}
if ( preg_match ( '/cms/Ui' , $this -> identifier ))
$isCms = true ;
$keyToGet = 'id_' . ( $isCms ? 'cms_' : '' ) . 'category' . ( in_array ( $this -> identifier , array ( 'id_category' , 'id_cms_category' )) ? '_parent' : '' );
foreach ( $this -> _list AS $tr )
{
$id = $tr [ $this -> identifier ];
echo '<tr' . ( array_key_exists ( $this -> identifier , $this -> identifiersDnd ) ? ' id="tr_' . (( $id_category = ( int )( Tools :: getValue ( 'id_' . ( $isCms ? 'cms_' : '' ) . 'category' , '1' ))) ? $id_category : '' ) . '_' . $id . '_' . $tr [ 'position' ] . '"' : '' ) . ( $irow ++ % 2 ? ' class="alt_row"' : '' ) . ' ' . (( isset ( $tr [ 'color' ]) AND $this -> colorOnBackground ) ? 'style="background-color: ' . $tr [ 'color' ] . '"' : '' ) . ' >
< td class = " center " > ' ;
if ( $this -> delete AND ( ! isset ( $this -> _listSkipDelete ) OR ! in_array ( $id , $this -> _listSkipDelete )))
echo '<input type="checkbox" name="' . $this -> table . 'Box[]" value="' . $id . '" class="noborder" />' ;
echo '</td>' ;
foreach ( $this -> fieldsDisplay AS $key => $params )
{
$tmp = explode ( '!' , $key );
$key = isset ( $tmp [ 1 ]) ? $tmp [ 1 ] : $tmp [ 0 ];
echo '
< td '.(isset($params[' position ']) ? ' id = " td_'.(isset( $id_category ) AND $id_category ? $id_category : 0).'_'. $id .' " ' : ' ').' class = " '.((!isset( $this->noLink ) OR ! $this->noLink ) ? 'pointer' : '').((isset( $params['position'] ) AND $this->_orderBy == 'position')? ' dragHandle' : ''). (isset( $params['align'] ) ? ' '. $params['align'] : '').' " ' ;
if ( ! isset ( $params [ 'position' ]) AND ( ! isset ( $this -> noLink ) OR ! $this -> noLink ))
echo ' onclick="document.location = \'' . $currentIndex . '&' . $this -> identifier . '=' . $id . ( $this -> view ? '&view' : '&update' ) . $this -> table . '&token=' . ( $token != NULL ? $token : $this -> token ) . '\'">' . ( isset ( $params [ 'prefix' ]) ? $params [ 'prefix' ] : '' );
else
echo '>' ;
if ( isset ( $params [ 'active' ]) AND isset ( $tr [ $key ]))
$this -> _displayEnableLink ( $token , $id , $tr [ $key ], $params [ 'active' ], Tools :: getValue ( 'id_category' ), Tools :: getValue ( 'id_product' ));
elseif ( isset ( $params [ 'activeVisu' ]) AND isset ( $tr [ $key ]))
echo '<img src="../img/admin/' . ( $tr [ $key ] ? 'enabled.gif' : 'disabled.gif' ) . ' "
alt = " '.( $tr[$key] ? $this->l ('Enabled') : $this->l ('Disabled')).' " title = " '.( $tr[$key] ? $this->l ('Enabled') : $this->l ('Disabled')).' " /> ' ;
elseif ( isset ( $params [ 'position' ]))
{
if ( $this -> _orderBy == 'position' AND $this -> _orderWay != 'DESC' )
{
echo '<a' . ( ! ( $tr [ $key ] != $positions [ sizeof ( $positions ) - 1 ]) ? ' style="display: none;"' : '' ) . ' href="' . $currentIndex .
'&' . $keyToGet . '=' . ( int )( $id_category ) . '&' . $this -> identifiersDnd [ $this -> identifier ] . '=' . $id . '
& way = 1 & position = '.(int)($tr[' position '] + 1).' & token = '.($token!=NULL ? $token : $this->token).' " >
< img src = " ../img/admin/'.( $this->_orderWay == 'ASC' ? 'down' : 'up').'.gif "
alt = " '. $this->l ('Down').' " title = " '. $this->l ('Down').' " /></ a > ' ;
echo '<a' . ( ! ( $tr [ $key ] != $positions [ 0 ]) ? ' style="display: none;"' : '' ) . ' href="' . $currentIndex .
'&' . $keyToGet . '=' . ( int )( $id_category ) . '&' . $this -> identifiersDnd [ $this -> identifier ] . '=' . $id . '
& way = 0 & position = '.(int)($tr[' position '] - 1).' & token = '.($token!=NULL ? $token : $this->token).' " >
< img src = " ../img/admin/'.( $this->_orderWay == 'ASC' ? 'up' : 'down').'.gif "
alt = " '. $this->l ('Up').' " title = " '. $this->l ('Up').' " /></ a > ' ; }
else
echo ( int )( $tr [ $key ] + 1 );
}
elseif ( isset ( $params [ 'image' ]))
{
// item_id is the product id in a product image context, else it is the image id.
$item_id = isset ( $params [ 'image_id' ]) ? $tr [ $params [ 'image_id' ]] : $id ;
// If it's a product image
if ( isset ( $tr [ 'id_image' ]))
{
$image = new Image (( int ) $tr [ 'id_image' ]);
$path_to_image = _PS_IMG_DIR_ . $params [ 'image' ] . '/' . $image -> getExistingImgPath () . '.' . $this -> imageType ;
} else
$path_to_image = _PS_IMG_DIR_ . $params [ 'image' ] . '/' . $item_id . ( isset ( $tr [ 'id_image' ]) ? '-' . ( int )( $tr [ 'id_image' ]) : '' ) . '.' . $this -> imageType ;
echo cacheImage ( $path_to_image , $this -> table . '_mini_' . $item_id . '.' . $this -> imageType , 45 , $this -> imageType );
}
elseif ( isset ( $params [ 'icon' ]) AND ( isset ( $params [ 'icon' ][ $tr [ $key ]]) OR isset ( $params [ 'icon' ][ 'default' ])))
echo '<img src="../img/admin/' . ( isset ( $params [ 'icon' ][ $tr [ $key ]]) ? $params [ 'icon' ][ $tr [ $key ]] : $params [ 'icon' ][ 'default' ] . '" alt="' . $tr [ $key ]) . '" title="' . $tr [ $key ] . '" />' ;
elseif ( isset ( $params [ 'price' ]))
echo Tools :: displayPrice ( $tr [ $key ], ( isset ( $params [ 'currency' ]) ? Currency :: getCurrencyInstance (( int )( $tr [ 'id_currency' ])) : $currency ), false );
elseif ( isset ( $params [ 'float' ]))
echo rtrim ( rtrim ( $tr [ $key ], '0' ), '.' );
elseif ( isset ( $params [ 'type' ]) AND $params [ 'type' ] == 'date' )
echo Tools :: displayDate ( $tr [ $key ], ( int ) $cookie -> id_lang );
elseif ( isset ( $params [ 'type' ]) AND $params [ 'type' ] == 'datetime' )
echo Tools :: displayDate ( $tr [ $key ], ( int ) $cookie -> id_lang , true );
elseif ( isset ( $tr [ $key ]))
{
$echo = ( $key == 'price' ? round ( $tr [ $key ], 2 ) : isset ( $params [ 'maxlength' ]) ? Tools :: substr ( $tr [ $key ], 0 , $params [ 'maxlength' ]) . '...' : $tr [ $key ]);
if ( isset ( $params [ 'small_title' ])
&& isset ( $small_titles [( int ) $tr [ 'id_category' ]])
) {
$echo .= ' - <span style="color:#666">' . $small_titles [( int ) $tr [ 'id_category' ]] . '</span>' ;
}
echo isset ( $params [ 'callback' ]) ? call_user_func_array ( array ( $this -> className , $params [ 'callback' ]), array ( $echo , $tr )) : $echo ;
}
else
echo '--' ;
echo ( isset ( $params [ 'suffix' ]) ? $params [ 'suffix' ] : '' ) .
'</td>' ;
}
if ( $this -> edit OR $this -> delete OR ( $this -> view AND $this -> view !== 'noActionColumn' ))
{
echo '<td class="center" style="white-space: nowrap;">' ;
if ( $this -> view )
$this -> _displayViewLink ( $token , $id );
if ( $this -> edit )
$this -> _displayEditLink ( $token , $id );
if ( $this -> delete AND ( ! isset ( $this -> _listSkipDelete ) OR ! in_array ( $id , $this -> _listSkipDelete )))
$this -> _displayDeleteLink ( $token , $id );
if ( $this -> duplicate )
$this -> _displayDuplicate ( $token , $id );
echo '</td>' ;
}
echo '</tr>' ;
}
}
}
}
public function displayList ( $token = NULL )
{
global $currentIndex ;
/* Display list header (filtering, pagination and column names) */
$this -> displayListHeader ( $token );
if ( ! sizeof ( $this -> _list ))
echo '<tr><td class="center" colspan="' . ( sizeof ( $this -> fieldsDisplay ) + 2 ) . '">' . $this -> l ( 'No items found' ) . '</td></tr>' ;
/* Show the content of the table */
$this -> displayListContent ( $token );
/* Close list table and submit button */
$this -> displayListFooter ( $token );
}
public function display ( $token = NULL )
{
global $currentIndex , $cookie ;
$this -> getList (( int )( $cookie -> id_lang ), ! $cookie -> __get ( $this -> table . 'Orderby' ) ? 'position' : NULL , ! $cookie -> __get ( $this -> table . 'Orderway' ) ? 'ASC' : NULL );
echo '<h3>' . ( ! $this -> _listTotal ? ( $this -> l ( 'There are no subcategories' )) : ( $this -> _listTotal . ' ' . ( $this -> _listTotal > 1 ? $this -> l ( 'subcategories' ) : $this -> l ( 'subcategory' )))) . ' ' . $this -> l ( 'in category' ) . ' "' . stripslashes ( $this -> _category -> getName ()) . '"</h3>' ;
2017-06-19 12:18:25 +02:00
// if ($this->tabAccess['add'] === '1')
// echo '<a href="'.__PS_BASE_URI__.substr($_SERVER['PHP_SELF'], strlen(__PS_BASE_URI__)).'?tab=AdminCatalog&add'.$this->table.'&id_parent='.Tools::getValue('id_category', 1).'&token='.($token!=NULL ? $token : $this->token).'"><img src="../img/admin/add.gif" border="0" /> '.$this->l('Add a new subcategory').'</a>';
2016-08-30 13:47:42 +02:00
echo '<div style="margin:10px;">' ;
2016-12-14 10:28:03 +01:00
/**
* @ Override regenerateEntireNTree
*/
2017-09-15 10:57:16 +02:00
echo '<br/><a onclick="return confirm(\'' . $this -> l ( 'Regenerate entire categories tree ?' ) . '\');" class="button btn" href="' . __PS_BASE_URI__ . substr ( $_SERVER [ 'PHP_SELF' ], strlen ( __PS_BASE_URI__ )) . '?tab=AdminCatalog®enerateTree&token=' . ( $token != NULL ? $token : $this -> token ) . '"">' . $this -> l ( 'Regenerate NTree' ) . '</a>' ;
$this -> displayListTree ();
echo '<br/>' ;
2017-09-25 10:59:34 +02:00
2016-08-30 13:47:42 +02:00
$this -> displayList ( $token );
echo '</div>' ;
}
public function postProcess ( $token = NULL )
{
global $cookie , $currentIndex ;
$this -> tabAccess = Profile :: getProfileAccess ( $cookie -> profile , $this -> id );
2016-12-14 10:28:03 +01:00
/**
* @ Override regenerate Ntree
*/
if ( Tools :: isSubmit ( 'regenerateTree' )){
Category :: regenerateEntireNtree ();
}
2016-08-30 13:47:42 +02:00
if ( Tools :: isSubmit ( 'submitAdd' . $this -> table ))
{
if ( $id_category = ( int )( Tools :: getValue ( 'id_category' )))
{
if ( ! Category :: checkBeforeMove ( $id_category , ( int )( Tools :: getValue ( 'id_parent' ))))
{
$this -> _errors [] = Tools :: displayError ( 'Category cannot be moved here' );
return false ;
}
}
}
2017-09-25 10:59:34 +02:00
// @Override Antadis - Delete Image Thumb && Mobile
2017-04-18 12:48:42 +02:00
elseif ( isset ( $_GET [ 'deleteImageThumb' ]) && isset ( $_GET [ 'id_lang' ]))
2016-08-30 13:47:42 +02:00
{
if ( Validate :: isLoadedObject ( $object = $this -> loadObject ())) {
2017-04-18 12:48:42 +02:00
$this -> deleteImageThumb ( $object , $_GET [ 'id_lang' ]);
2016-08-30 13:47:42 +02:00
Tools :: redirectAdmin ( $currentIndex . '&updatecategory&token=' . Tools :: getValue ( 'token' ) . '&id_category=' . ( int )( $object -> id ));
}
2017-09-25 10:59:34 +02:00
}
elseif ( isset ( $_GET [ 'deleteImageMobile' ]) && isset ( $_GET [ 'id_lang' ]))
{
if ( Validate :: isLoadedObject ( $object = $this -> loadObject ())) {
$this -> deleteImageMobile ( $object , $_GET [ 'id_lang' ]);
Tools :: redirectAdmin ( $currentIndex . '&updatecategory&token=' . Tools :: getValue ( 'token' ) . '&id_category=' . ( int )( $object -> id ));
}
2016-08-30 13:47:42 +02:00
}
// @EndOverride Antadis
/* Delete object */
elseif ( isset ( $_GET [ 'delete' . $this -> table ]))
{
if ( $this -> tabAccess [ 'delete' ] === '1' )
{
if ( Validate :: isLoadedObject ( $object = $this -> loadObject ()) AND isset ( $this -> fieldImageSettings ))
{
// check if request at least one object with noZeroObject
if ( isset ( $object -> noZeroObject ) AND sizeof ( $taxes = call_user_func ( array ( $this -> className , $object -> noZeroObject ))) <= 1 )
$this -> _errors [] = Tools :: displayError ( 'You need at least one object.' ) . ' <b>' . $this -> table . '</b><br />' . Tools :: displayError ( 'You cannot delete all of the items.' );
else
{
if ( $this -> deleted )
{
// @Override Antadis
2017-04-18 12:48:42 +02:00
foreach ( Language :: getLanguages ( FALSE ) as $language ) {
$this -> deleteImageThumb ( $object , $language [ 'id_lang' ]);
2017-09-25 10:59:34 +02:00
$this -> deleteImageMobile ( $object , $language [ 'id_lang' ]);
2017-04-18 12:48:42 +02:00
}
2016-08-30 13:47:42 +02:00
// @End Antadis
$object -> deleteImage ();
$object -> deleted = 1 ;
if ( $object -> update ())
Tools :: redirectAdmin ( $currentIndex . '&conf=1&token=' . Tools :: getValue ( 'token' ) . '&id_category=' . ( int )( $object -> id_parent ));
}
elseif ( $object -> delete ())
Tools :: redirectAdmin ( $currentIndex . '&conf=1&token=' . Tools :: getValue ( 'token' ) . '&id_category=' . ( int )( $object -> id_parent ));
$this -> _errors [] = Tools :: displayError ( 'An error occurred during deletion.' );
}
}
else
$this -> _errors [] = Tools :: displayError ( 'An error occurred while deleting object.' ) . ' <b>' . $this -> table . '</b> ' . Tools :: displayError ( '(cannot load object)' );
}
else
$this -> _errors [] = Tools :: displayError ( 'You do not have permission to delete here.' );
}
elseif ( isset ( $_GET [ 'position' ]))
{
if ( $this -> tabAccess [ 'edit' ] !== '1' )
$this -> _errors [] = Tools :: displayError ( 'You do not have permission to edit here.' );
elseif ( ! Validate :: isLoadedObject ( $object = new Category (( int )( Tools :: getValue ( $this -> identifier , Tools :: getValue ( 'id_category_to_move' , 1 ))))))
$this -> _errors [] = Tools :: displayError ( 'An error occurred while updating status for object.' ) . ' <b>' . $this -> table . '</b> ' . Tools :: displayError ( '(cannot load object)' );
if ( ! $object -> updatePosition (( int )( Tools :: getValue ( 'way' )), ( int )( Tools :: getValue ( 'position' ))))
$this -> _errors [] = Tools :: displayError ( 'Failed to update the position.' );
else
Tools :: redirectAdmin ( $currentIndex . '&' . $this -> table . 'Orderby=position&' . $this -> table . 'Orderway=asc&conf=5' . (( $id_category = ( int )( Tools :: getValue ( $this -> identifier , Tools :: getValue ( 'id_category_parent' , 1 )))) ? ( '&' . $this -> identifier . '=' . $id_category ) : '' ) . '&token=' . Tools :: getAdminTokenLite ( 'AdminCatalog' ));
}
/* Delete multiple objects */
elseif ( Tools :: getValue ( 'submitDel' . $this -> table ))
{
if ( $this -> tabAccess [ 'delete' ] === '1' )
{
if ( isset ( $_POST [ $this -> table . 'Box' ]))
{
$category = new Category ();
$result = true ;
$result = $category -> deleteSelection ( Tools :: getValue ( $this -> table . 'Box' ));
if ( $result )
{
$category -> cleanPositions (( int )( Tools :: getValue ( 'id_category' )));
Tools :: redirectAdmin ( $currentIndex . '&conf=2&token=' . Tools :: getAdminTokenLite ( 'AdminCatalog' ) . '&id_category=' . ( int )( Tools :: getValue ( 'id_category' )));
}
$this -> _errors [] = Tools :: displayError ( 'An error occurred while deleting selection.' );
}
else
$this -> _errors [] = Tools :: displayError ( 'You must select at least one element to delete.' );
}
else
$this -> _errors [] = Tools :: displayError ( 'You do not have permission to delete here.' );
return ;
}
parent :: postProcess ();
}
protected function postImage ( $id )
{
// @Override Antadis
2017-04-18 12:48:42 +02:00
if ( $id_category = ( int )( Tools :: getValue ( 'id_category' ))) {
foreach ( Language :: getLanguages ( FALSE ) as $language ) {
$id_lang = ( int ) $language [ 'id_lang' ];
if ( $id_lang == 3
&& ( ! isset ( $_FILES [ 'image_thumb_' . $id_lang ]) || $_FILES [ 'image_thumb_' . $id_lang ][ 'name' ] == '' )
&& ( isset ( $_FILES [ 'image_thumb_2' ]) && $_FILES [ 'image_thumb_2' ][ 'name' ] != '' )
){
if ( ! copy ( $_FILES [ 'image_thumb_2' ][ 'tmp_name' ], _PS_CAT_IMG_DIR_ . $id_category . '_thumb_vp_' . $id_lang . '.jpg' )) {
echo $this -> displayError ( $this -> l ( 'An error occured during the image upload.' ));
}
}
elseif ( isset ( $_FILES [ 'image_thumb_' . $id_lang ]) && $_FILES [ 'image_thumb_' . $id_lang ][ 'name' ] != '' ) {
if ( ! copy ( $_FILES [ 'image_thumb_' . $id_lang ][ 'tmp_name' ], _PS_CAT_IMG_DIR_ . $id_category . '_thumb_vp_' . $id_lang . '.jpg' )) {
echo $this -> displayError ( $this -> l ( 'An error occured during the image upload.' ));
}
}
2017-09-15 16:19:44 +02:00
if ( $id_lang == 3
&& ( ! isset ( $_FILES [ 'image_mobile_' . $id_lang ]) || $_FILES [ 'image_mobile_' . $id_lang ][ 'name' ] == '' )
&& ( isset ( $_FILES [ 'image_mobile_2' ]) && $_FILES [ 'image_mobile_2' ][ 'name' ] != '' )
){
if ( ! copy ( $_FILES [ 'image_mobile_2' ][ 'tmp_name' ], _PS_CAT_IMG_DIR_ . $id_category . '_mobile_vp_' . $id_lang . '.jpg' )) {
echo $this -> displayError ( $this -> l ( 'An error occured during the image upload.' ));
}
}
elseif ( isset ( $_FILES [ 'image_mobile_' . $id_lang ]) && $_FILES [ 'image_mobile_' . $id_lang ][ 'name' ] != '' ) {
if ( ! copy ( $_FILES [ 'image_mobile_' . $id_lang ][ 'tmp_name' ], _PS_CAT_IMG_DIR_ . $id_category . '_mobile_vp_' . $id_lang . '.jpg' )) {
echo $this -> displayError ( $this -> l ( 'An error occured during the image upload.' ));
}
}
2016-08-30 13:47:42 +02:00
}
}
// @End Antadis
$ret = parent :: postImage ( $id );
if (( $id_category = ( int )( Tools :: getValue ( 'id_category' ))) AND isset ( $_FILES ) AND sizeof ( $_FILES ) AND $_FILES [ 'image' ][ 'name' ] != NULL AND file_exists ( _PS_CAT_IMG_DIR_ . $id_category . '.jpg' ))
{
$imagesTypes = ImageType :: getImagesTypes ( 'categories' );
foreach ( $imagesTypes AS $k => $imageType )
imageResize ( _PS_CAT_IMG_DIR_ . $id_category . '.jpg' , _PS_CAT_IMG_DIR_ . $id_category . '-' . stripslashes ( $imageType [ 'name' ]) . '.jpg' , ( int )( $imageType [ 'width' ]), ( int )( $imageType [ 'height' ]));
}
return $ret ;
}
// @Adding Antadis
2017-04-18 12:48:42 +02:00
public function deleteImageThumb ( $object , $id_lang )
2016-08-30 13:47:42 +02:00
{
2017-04-18 12:48:42 +02:00
if ( file_exists ( _PS_ROOT_DIR_ . '/img/c/' . $object -> id . '_thumb_vp_' . ( int ) $id_lang . '.jpg' )) {
unlink ( _PS_ROOT_DIR_ . '/img/c/' . $object -> id . '_thumb_vp_' . ( int ) $id_lang . '.jpg' );
2016-08-30 13:47:42 +02:00
}
}
2017-09-15 16:19:44 +02:00
public function deleteImageMobile ( $object , $id_lang )
{
if ( file_exists ( _PS_ROOT_DIR_ . '/img/c/' . $object -> id . '_mobile_vp_' . ( int ) $id_lang . '.jpg' )) {
unlink ( _PS_ROOT_DIR_ . '/img/c/' . $object -> id . '_mobile_vp_' . ( int ) $id_lang . '.jpg' );
}
}
2016-08-30 13:47:42 +02:00
// @End Antadis
public function displayForm ( $token = NULL )
{
global $currentIndex , $cookie ;
parent :: displayForm ();
if ( ! ( $obj = $this -> loadObject ( true )))
return ;
$active = $this -> getFieldValue ( $obj , 'active' );
$customer_groups = $obj -> getGroups ();
echo '
< form action = " '. $currentIndex .'&submitAdd'. $this->table .'=1&token='.( $token !=NULL ? $token : $this->token ).' " method = " post " enctype = " multipart/form-data " >
'.($obj->id ? ' < input type = " hidden " name = " id_'. $this->table .' " value = " '. $obj->id .' " /> ' : ' ').'
< fieldset >< legend >< img src = " ../img/admin/tab-categories.gif " /> '.$this->l(' Category ').' </ legend >
< label > '.$this->l(' Name : ').' </ label >
< div class = " margin-form translatable " > ' ;
foreach ( $this -> _languages AS $language )
echo '
< div class = " lang_'. $language['id_lang'] .' " style = " display: '.( $language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none').'; float: left; " >
< input type = " text " style = " width: 260px " name = " name_'. $language['id_lang'] .' " id = " name_'. $language['id_lang'] .' " value = " '.htmlentities( $this->getFieldValue ( $obj , 'name', (int)( $language['id_lang'] )), ENT_COMPAT, 'UTF-8').' " '.((!$obj->id) ? ' onkeyup = " copy2friendlyURLCategory(); " ' : ' ').' />< sup > *</ sup >
< span class = " hint " name = " help_box " > '.$this->l(' Invalid characters : ').' <> ; = #{}<span class="hint-pointer"> </span></span>
</ div > ' ;
if ( Module :: isInstalled ( 'categoryfamily' )) {
// ADD category
require_once '..' . _MODULE_DIR_ . 'categoryfamily/models/CategoryFamily.php' ;
echo '<script type="text/javascript" src="../modules/categoryfamily/family.js"></script>' ;
if ( ! empty ( $obj -> id )) {
$data = CategoryFamilyCore :: loadAssociations ( $obj -> id , $cookie -> id_lang );
echo '
< p class = " clear " ></ p > ' ;
echo $data ;
}
// ADD CATEGORY
else {
$familles = CategoryFamilyCore :: getParentFamily ( $cookie -> id_lang );
echo '
< p class = " clear " ></ p >
</ div >
< label > '.$this->l(' Famille : ').' </ label >
< div class = " margin-form " >
< div id = " select_1 " style = " margin-bottom:10px " >
< select name = " family[1] " id = " family_1 " data - id - family = " 1 " style = " width:150px " > ' ;
echo '<option value="0">' . $this -> l ( '-- Choisir -- ' ) . '</option>' ;
foreach ( $familles as $key => $famille ) {
echo '<option value="' . $famille [ 'id_category_family' ] . '">' . $famille [ 'name' ] . '</option>' ;
}
echo ' </ select >
</ div >
< p class = " clear " ></ p > ' ;
}
}
echo ' < p class = " clear " ></ p >
</ div >
< label > '.$this->l(' Displayed : ').' </ label >
< div class = " margin-form " >
< input type = " radio " name = " active " id = " active_on " value = " 1 " '.($active ? ' checked = " checked " ' : ' ').' />
< label class = " t " for = " active_on " >< img src = " ../img/admin/enabled.gif " alt = " '. $this->l ('Enabled').' " title = " '. $this->l ('Enabled').' " /></ label >
< input type = " radio " name = " active " id = " active_off " value = " 0 " '.(!$active ? ' checked = " checked " ' : ' ').' />
< label class = " t " for = " active_off " >< img src = " ../img/admin/disabled.gif " alt = " '. $this->l ('Disabled').' " title = " '. $this->l ('Disabled').' " /></ label >
</ div >
< label > '.$this->l(' Parent category : ').' </ label >
< div class = " margin-form " > ' ;
// Translations are not automatic for the moment ;)
$trads = array (
'Home' => $this -> l ( 'Home' ),
'selected' => $this -> l ( 'selected' ),
'Collapse All' => $this -> l ( 'Collapse All' ),
'Expand All' => $this -> l ( 'Expand All' ),
'Toggle' => 'Masquer/Voir' ,
);
echo Helper :: renderAdminCategorieTree ( $trads , array ( isset ( $obj -> id_parent ) ? $obj -> id_parent : Tools :: getValue ( 'id_parent' , 1 )), 'id_parent' , true );
echo ' </ div >
< label > '.$this->l(' Description : ').' </ label >
< div class = " margin-form translatable " > ' ;
foreach ( $this -> _languages AS $language ){
$data = htmlentities ( $this -> getFieldValue ( $obj , 'description' , ( int )( $language [ 'id_lang' ])), ENT_COMPAT , 'UTF-8' );
if ( empty ( $data ))
$data = date ( 'Y' ) . '-' . date ( 'm' );
echo '
< div class = " lang_'. $language['id_lang'] .' " style = " display: '.( $language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none').'; float: left; " >
< textarea name = " description_'. $language['id_lang'] .' " rows = " 10 " cols = " 100 " > '.$data.' </ textarea >
</ div > ' ;
}
echo ' < p class = " clear " ></ p >
</ div >
< label > '.$this->l(' Image : ').' </ label >
< div class = " margin-form " > ' ;
echo $this -> displayImage ( $obj -> id , _PS_IMG_DIR_ . 'c/' . $obj -> id . '.jpg' , 350 , NULL , Tools :: getAdminToken ( 'AdminCatalog' . ( int )( Tab :: getIdFromClassName ( 'AdminCatalog' )) . ( int )( $cookie -> id_employee )), true );
echo ' < br />< input type = " file " name = " image " />
< p > '.$this->l(' Upload category logo from your computer ').' </ p >
</ div >
< div class = " clear " >< br /></ div > ' ;
// @Override Antadis
2017-04-18 12:48:42 +02:00
echo '<label>' . $this -> l ( 'Image logo:' ) . ' </ label >
< div class = " margin-form translatable " > ' ;
foreach ( $this -> _languages as $language ) {
echo '
< div class = " lang_'. $language['id_lang'] .' " style = " display: '.( $language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none').'; float: left; " > ' ;
if ( file_exists ( _PS_ROOT_DIR_ . '/img/c/' . $obj -> id . '_thumb_vp_' . $language [ 'id_lang' ] . '.jpg' )) {
echo ' < div id = " image " >
< img src = " '.__PS_BASE_URI__.'img/c/'. $obj->id .'_thumb_vp_'. $language['id_lang'] .'.jpg " alt = " " class = " imgm " >
< p ></ p >
< a href = " '. $currentIndex .'&id_category='. $obj->id .'&token='.Tools::getAdminTokenLite('AdminCatalog').'&deleteImageThumb=1&id_lang='. $language['id_lang'] .' " >
< img src = " ../img/admin/delete.gif " alt = " Supprimer " > Supprimer </ a >
</ div > ' ;
}
echo '<input id="image_thumb_' . $language [ 'id_lang' ] . '" type="file" name="image_thumb_' . $language [ 'id_lang' ] . ' " />
</ div > ' ;
}
echo ' < p class = " clear " ></ p >
</ div > ' ;
2017-09-15 16:19:44 +02:00
// @Override Antadis
2017-09-28 15:38:03 +02:00
// echo '<label>'.$this->l('Image app mobile:').'</label>
// <div class="margin-form translatable">';
// foreach($this->_languages as $language) {
// echo '
// <div class="lang_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none').'; float: left;">';
// if(file_exists(_PS_ROOT_DIR_.'/img/c/'.$obj->id.'_mobile_vp_'.$language['id_lang'].'.jpg')) {
// echo '<div id="image">
// <img src="'.__PS_BASE_URI__.'img/c/'.$obj->id.'_mobile_vp_'.$language['id_lang'].'.jpg" alt="" class="imgm">
// <p></p>
// <a href="'.$currentIndex.'&id_category='.$obj->id.'&token='.Tools::getAdminTokenLite('AdminCatalog').'&deleteImageMobile=1&id_lang='.$language['id_lang'].'">
// <img src="../img/admin/delete.gif" alt="Supprimer"> Supprimer</a>
// </div>';
// }
// echo '<input id="image_thumb_'.$language['id_lang'].'" type="file" name="image_mobile_'.$language['id_lang'].'" />
// </div>';
// }
// echo '<p class="clear"></p>
// </div>';
2017-09-15 16:19:44 +02:00
2017-04-18 12:48:42 +02:00
// echo ' <label>'.$this->l('Image logo:').' </label>
// <div class="margin-form">';
// if(file_exists(_PS_ROOT_DIR_.'/img/c/'.$obj->id.'_thumb_vp.jpg')) {
// echo '<div id="image">
// <img src="'.__PS_BASE_URI__.'img/c/'.$obj->id.'_thumb_vp.jpg" alt="" class="imgm">
// <p></p>
// <a href="'.$currentIndex.'&id_category='.$obj->id.'&token='.Tools::getAdminTokenLite('AdminCatalog').'&deleteImageThumb=1">
// <img src="../img/admin/delete.gif" alt="Supprimer"> Supprimer</a>
// </div>';
// }
// echo ' <br /><input type="file" name="image_thumb" />
// <p>'.$this->l('Upload logo from your computer').'</p>
// </div>
// <div class="clear"><br /></div>';
2016-08-30 13:47:42 +02:00
// @EndOverride Antadis
echo ' <label>' . $this -> l ( 'Meta title:' ) . ' </ label >
< div class = " margin-form translatable " > ' ;
foreach ( $this -> _languages AS $language )
echo '
< div class = " lang_'. $language['id_lang'] .' " style = " display: '.( $language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none').'; float: left; " >
< input type = " text " name = " meta_title_'. $language['id_lang'] .' " id = " meta_title_'. $language['id_lang'] .' " value = " '.htmlentities( $this->getFieldValue ( $obj , 'meta_title', (int)( $language['id_lang'] )), ENT_COMPAT, 'UTF-8').' " />
< span class = " hint " name = " help_box " > '.$this->l(' Forbidden characters : ').' <> ; = #{}<span class="hint-pointer"> </span></span>
</ div > ' ;
echo ' < p class = " clear " ></ p >
</ div >
< label > '.$this->l(' Meta description : ').' </ label >
< div class = " margin-form translatable " > ' ;
foreach ( $this -> _languages AS $language )
echo '<div class="lang_' . $language [ 'id_lang' ] . '" style="display: ' . ( $language [ 'id_lang' ] == $this -> _defaultFormLanguage ? 'block' : 'none' ) . ' ; float : left ; " >
< input type = " text " name = " meta_description_'. $language['id_lang'] .' " id = " meta_description_'. $language['id_lang'] .' " value = " '.htmlentities( $this->getFieldValue ( $obj , 'meta_description', (int)( $language['id_lang'] )), ENT_COMPAT, 'UTF-8').' " />
< span class = " hint " name = " help_box " > '.$this->l(' Forbidden characters : ').' <> ; = #{}<span class="hint-pointer"> </span></span>
</ div > ' ;
echo ' < p class = " clear " ></ p >
</ div >
< label > '.$this->l(' Meta keywords : ').' </ label >
< div class = " margin-form translatable " > ' ;
foreach ( $this -> _languages AS $language )
echo '
< div class = " lang_'. $language['id_lang'] .' " style = " display: '.( $language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none').'; float: left; " >
< input type = " text " name = " meta_keywords_'. $language['id_lang'] .' " id = " meta_keywords_'. $language['id_lang'] .' " value = " '.htmlentities( $this->getFieldValue ( $obj , 'meta_keywords', (int)( $language['id_lang'] )), ENT_COMPAT, 'UTF-8').' " />
< span class = " hint " name = " help_box " > '.$this->l(' Forbidden characters : ').' <> ; = #{}<span class="hint-pointer"> </span></span>
</ div > ' ;
echo ' < p class = " clear " ></ p >
</ div >
< label > '.$this->l(' Friendly URL : ').' </ label >
< div class = " margin-form translatable " > ' ;
foreach ( $this -> _languages AS $language )
echo '<div class="lang_' . $language [ 'id_lang' ] . '" style="display: ' . ( $language [ 'id_lang' ] == $this -> _defaultFormLanguage ? 'block' : 'none' ) . ' ; float : left ; " >
< input type = " text " name = " link_rewrite_'. $language['id_lang'] .' " id = " link_rewrite_'. $language['id_lang'] .' " value = " '.htmlentities( $this->getFieldValue ( $obj , 'link_rewrite', (int)( $language['id_lang'] )), ENT_COMPAT, 'UTF-8').' " onchange = " this.value = str2url(this.value); " />< sup > *</ sup >
< span class = " hint " name = " help_box " > '.$this->l(' Only letters and the minus ( - ) character are allowed ').' < span class = " hint-pointer " >& nbsp ; </ span ></ span >
</ div > ' ;
echo ' < p class = " clear " ></ p >
</ div >
< label > '.$this->l(' Groups access : ').' </ label >
< div class = " margin-form " > ' ;
$groups = Group :: getGroups (( int )( $cookie -> id_lang ));
if ( sizeof ( $groups ))
{
echo '
< table cellspacing = " 0 " cellpadding = " 0 " class = " table " style = " width: 28em; " >
< tr >
< th >< input type = " checkbox " name = " checkme " class = " noborder " onclick = " checkDelBoxes(this.form, \ 'groupBox[] \ ', this.checked) " '.(!isset($obj->id) ? ' checked = " checked " ' : ' ').' /></ th >
< th > '.$this->l(' ID ').' </ th >
< th > '.$this->l(' Group name ').' </ th >
</ tr > ' ;
$irow = 0 ;
foreach ( $groups AS $group )
echo '
< tr class = " '.( $irow ++ % 2 ? 'alt_row' : '').' " >
< td >< input type = " checkbox " name = " groupBox[] " class = " groupBox " id = " groupBox_'. $group['id_group'] .' " value = " '. $group['id_group'] .' " '.((in_array($group[' id_group '], $customer_groups) OR (!isset($obj->id))) ? ' checked = " checked " ' : ' ').' /></ td >
< td > '.$group[' id_group '].' </ td >
< td >< label for = " groupBox_'. $group['id_group'] .' " class = " t " > '.$group[' name '].' </ label ></ td >
</ tr > ' ;
echo '
</ table >
< p style = " padding:0px; margin:10px 0px 10px 0px; " > '.$this->l(' Mark all groups you want to give access to this category ').' </ p >
' ;
} else
echo '<p>' . $this -> l ( 'No group created' ) . '</p>' ;
echo '
</ div >
< div class = " margin-form " >
< input type = " submit " value = " '. $this->l ('Save and back to parent category').' " name = " submitAdd'. $this->table .'AndBackToParent " class = " button " />
& nbsp ; < input type = " submit " class = " button " name = " submitAdd'. $this->table .' " value = " '. $this->l ('Save').' " />
</ div >
< div class = " small " >< sup >*</ sup > '.$this->l(' Required field ').' </ div >
</ fieldset >
</ form >
< p class = " clear " ></ p > ' ;
}
2016-01-04 12:48:08 +01:00
}