Fix: Solve phpcodesniffer errors and warning
This commit is contained in:
parent
3cdc7abf40
commit
852a997559
@ -72,6 +72,7 @@ class Categorie
|
||||
* Load category into memory from database
|
||||
*
|
||||
* @param int $id Id of category
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function fetch($id)
|
||||
{
|
||||
@ -290,7 +291,8 @@ class Categorie
|
||||
/**
|
||||
* Delete a category from database
|
||||
*
|
||||
* @param user Object user that ask to delete
|
||||
* @param User $user Object user that ask to delete
|
||||
* @return void
|
||||
*/
|
||||
function delete($user)
|
||||
{
|
||||
@ -399,7 +401,7 @@ class Categorie
|
||||
/**
|
||||
* Ajout d'une sous-categorie
|
||||
*
|
||||
* @return int 1 : OK
|
||||
* @return int 1 : OK
|
||||
* -2 : $fille est deja dans la famille de $this
|
||||
* -3 : categorie ($this ou $fille) invalide
|
||||
*/
|
||||
@ -422,9 +424,9 @@ class Categorie
|
||||
/**
|
||||
* Suppression d'une sous-categorie (seulement "desassociation")
|
||||
*
|
||||
* @param $fille objet categorie
|
||||
* @return int 1 : OK
|
||||
* -3 : categorie ($this ou $fille) invalide
|
||||
* @param Category $fille Objet category
|
||||
* @return int 1 : OK
|
||||
* -3 : categorie ($this ou $fille) invalide
|
||||
*/
|
||||
function del_fille($fille)
|
||||
{
|
||||
@ -450,9 +452,9 @@ class Categorie
|
||||
/**
|
||||
* Link an object to the category
|
||||
*
|
||||
* @param obj Object to link to category
|
||||
* @param type Type of category
|
||||
* @return int 1 : OK, -1 : erreur SQL, -2 : id non renseign, -3 : Already linked
|
||||
* @param Object $obj Object to link to category
|
||||
* @param string $type Type of category
|
||||
* @return int 1 : OK, -1 : erreur SQL, -2 : id non renseign, -3 : Already linked
|
||||
*/
|
||||
function add_type($obj,$type)
|
||||
{
|
||||
@ -484,11 +486,11 @@ class Categorie
|
||||
}
|
||||
|
||||
/**
|
||||
* Suppresion d'un produit de la categorie
|
||||
* Delete object from category
|
||||
*
|
||||
* @param $obj Object
|
||||
* @param $type Type
|
||||
* @return int 1 if OK, -1 if KO
|
||||
* @param Object $obj Object
|
||||
* @param string $type Type
|
||||
* @return int 1 if OK, -1 if KO
|
||||
*/
|
||||
function del_type($obj,$type)
|
||||
{
|
||||
@ -510,9 +512,10 @@ class Categorie
|
||||
/**
|
||||
* Return list of contents of a category
|
||||
*
|
||||
* @param field Field name for select in table. Full field name will be fk_field.
|
||||
* @param classname PHP Class of object to store entity
|
||||
* @param table Table name for select in table. Full table name will be PREFIX_categorie_table.
|
||||
* @param string $field Field name for select in table. Full field name will be fk_field.
|
||||
* @param string $classname PHP Class of object to store entity
|
||||
* @param string $table Table name for select in table. Full table name will be PREFIX_categorie_table.
|
||||
* @return void
|
||||
*/
|
||||
function get_type($field,$classname,$table='')
|
||||
{
|
||||
@ -547,8 +550,10 @@ class Categorie
|
||||
|
||||
/**
|
||||
* Retourne les filles de la categorie
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function get_filles ()
|
||||
function get_filles()
|
||||
{
|
||||
$sql = "SELECT fk_categorie_fille FROM ".MAIN_DB_PREFIX."categorie_association ";
|
||||
$sql .= "WHERE fk_categorie_mere = ".$this->id;
|
||||
@ -587,13 +592,14 @@ class Categorie
|
||||
$res = $this->db->query($sql);
|
||||
$n = $this->db->fetch_array($res);
|
||||
|
||||
return ($n[0]);
|
||||
return($n[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
* La categorie $fille est-elle une fille de cette categorie ?
|
||||
*
|
||||
* @param Category $fille Object category
|
||||
* @return void
|
||||
*/
|
||||
function is_fille($fille)
|
||||
{
|
||||
@ -601,7 +607,6 @@ class Categorie
|
||||
$sql .= "WHERE fk_categorie_mere = ".$this->id." AND fk_categorie_fille = ".$fille->id;
|
||||
|
||||
$res = $this->db->query($sql);
|
||||
|
||||
$n = $this->db->fetch_array($res);
|
||||
|
||||
return ($n[0] > 0);
|
||||
@ -724,8 +729,9 @@ class Categorie
|
||||
/**
|
||||
* For category id_categ and its childs available in this->cats, define property fullpath and fulllabel
|
||||
*
|
||||
* @param id_categ id_categ entry to update
|
||||
* @param protection Deep counter to avoid infinite loop
|
||||
* @param int $id_categ id_categ entry to update
|
||||
* @param int $protection Deep counter to avoid infinite loop
|
||||
* @return void
|
||||
*/
|
||||
function build_path_from_id_categ($id_categ,$protection=0)
|
||||
{
|
||||
@ -775,6 +781,8 @@ class Categorie
|
||||
|
||||
/**
|
||||
* Affiche contenu de $this->cats
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function debug_cats()
|
||||
{
|
||||
@ -824,7 +832,7 @@ class Categorie
|
||||
*
|
||||
* @return int Nombre de categories
|
||||
*/
|
||||
function get_nb_categories ()
|
||||
function get_nb_categories()
|
||||
{
|
||||
$sql = "SELECT count(rowid)";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."categorie";
|
||||
@ -897,7 +905,9 @@ class Categorie
|
||||
}
|
||||
|
||||
/**
|
||||
* Retourne les categories de premier niveau (qui ne sont pas filles)
|
||||
* Retourne les categories de premier niveau (qui ne sont pas filles)
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function get_main_categories()
|
||||
{
|
||||
@ -926,6 +936,10 @@ class Categorie
|
||||
/**
|
||||
* Retourne les chemin de la categorie, avec les noms des categories
|
||||
* separes par $sep (" >> " par defaut)
|
||||
*
|
||||
* @param string $sep Separator
|
||||
* @param string $url Url
|
||||
* @return void
|
||||
*/
|
||||
function print_all_ways ($sep = " >> ", $url='')
|
||||
{
|
||||
@ -953,10 +967,11 @@ class Categorie
|
||||
|
||||
|
||||
/**
|
||||
* affiche le chemin le plus court pour se rendre a un produit
|
||||
* Affiche le chemin le plus court pour se rendre a un produit
|
||||
*
|
||||
* @param id
|
||||
* @param type
|
||||
* @param int $id Id of category
|
||||
* @param string $type Type of category
|
||||
* @return void
|
||||
*/
|
||||
function get_primary_way($id, $type="")
|
||||
{
|
||||
@ -978,12 +993,13 @@ class Categorie
|
||||
}
|
||||
|
||||
/**
|
||||
* Affiche le chemin le plus court pour se rendre a un produit
|
||||
* Affiche le chemin le plus court pour se rendre a un produit
|
||||
*
|
||||
* @param int $id
|
||||
* @param string $sep
|
||||
* @param string $url
|
||||
* @param string $type
|
||||
* @param int $id Id of category
|
||||
* @param string $sep Separator
|
||||
* @param string $url Url
|
||||
* @param string $type Type
|
||||
* @return void
|
||||
*/
|
||||
function print_primary_way($id, $sep= " >> ", $url="", $type="")
|
||||
{
|
||||
@ -1006,7 +1022,9 @@ class Categorie
|
||||
}
|
||||
|
||||
/**
|
||||
* Retourne un tableau contenant la liste des categories meres
|
||||
* Retourne un tableau contenant la liste des categories meres
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function get_meres()
|
||||
{
|
||||
@ -1033,8 +1051,10 @@ class Categorie
|
||||
}
|
||||
|
||||
/**
|
||||
* Retourne dans un tableau tous les chemins possibles pour arriver a la categorie
|
||||
* en partant des categories principales, representes par des tableaux de categories
|
||||
* Retourne dans un tableau tous les chemins possibles pour arriver a la categorie
|
||||
* en partant des categories principales, representes par des tableaux de categories
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function get_all_ways ()
|
||||
{
|
||||
@ -1060,9 +1080,9 @@ class Categorie
|
||||
/**
|
||||
* Return list of categories linked to element of type $type with id $typeid
|
||||
*
|
||||
* @param id Id of element
|
||||
* @param typeid Type id of link (0,1,2,3...)
|
||||
* @return array List of category objects
|
||||
* @param int $id Id of element
|
||||
* @param int $typeid Type id of link (0,1,2,3...)
|
||||
* @return array List of category objects
|
||||
*/
|
||||
function containing($id,$typeid)
|
||||
{
|
||||
@ -1101,11 +1121,11 @@ class Categorie
|
||||
* Retourne les categories dont l'id ou le nom correspond
|
||||
* ajoute des wildcards au nom sauf si $exact = true
|
||||
*
|
||||
* @param id
|
||||
* @param nom
|
||||
* @param type
|
||||
* @param exact
|
||||
* @return int or array
|
||||
* @param int $id Id
|
||||
* @param string $nom Name
|
||||
* @param string $type Type
|
||||
* @param boolean $exact Ture or false
|
||||
* @return array Array of category id
|
||||
*/
|
||||
function rechercher($id, $nom, $type, $exact = false)
|
||||
{
|
||||
@ -1148,10 +1168,10 @@ class Categorie
|
||||
/**
|
||||
* Return name and link of category (with picto)
|
||||
*
|
||||
* @param withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul
|
||||
* @param option Sur quoi pointe le lien ('', 'xyz')
|
||||
* @param maxlength Max length of text
|
||||
* @return string Chaine avec URL
|
||||
* @param int $withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul
|
||||
* @param string $option Sur quoi pointe le lien ('', 'xyz')
|
||||
* @param int $maxlength Max length of text
|
||||
* @return string Chaine avec URL
|
||||
*/
|
||||
function getNomUrl($withpicto=0,$option='',$maxlength=0)
|
||||
{
|
||||
@ -1174,12 +1194,13 @@ class Categorie
|
||||
|
||||
|
||||
/**
|
||||
* Deplace fichier uploade sous le nom $files dans le repertoire sdir
|
||||
* Deplace fichier uploade sous le nom $files dans le repertoire sdir
|
||||
*
|
||||
* @param sdir Repertoire destination finale
|
||||
* @param $file Nom du fichier uploade
|
||||
* @param maxWidth Largeur maximum que dois faire la miniature (160 par defaut)
|
||||
* @param maxHeight Hauteur maximum que dois faire la miniature (120 par defaut)
|
||||
* @param string $sdir Repertoire destination finale
|
||||
* @param string $file Nom du fichier uploade
|
||||
* @param int $maxWidth Largeur maximum que dois faire la miniature (160 par defaut)
|
||||
* @param int $maxHeight Hauteur maximum que dois faire la miniature (120 par defaut)
|
||||
* @return void
|
||||
*/
|
||||
function add_photo($sdir, $file, $maxWidth = 160, $maxHeight = 120)
|
||||
{
|
||||
@ -1209,11 +1230,12 @@ class Categorie
|
||||
}
|
||||
|
||||
/**
|
||||
* Build thumb
|
||||
* Build thumb
|
||||
*
|
||||
* @param string $file Chemin du fichier d'origine
|
||||
* @param int $maxWidth Largeur maximum que dois faire la miniature (160 par defaut)
|
||||
* @param int $maxHeight Hauteur maximum que dois faire la miniature (120 par defaut)
|
||||
* @param string $file Chemin du fichier d'origine
|
||||
* @param int $maxWidth Largeur maximum que dois faire la miniature (160 par defaut)
|
||||
* @param int $maxHeight Hauteur maximum que dois faire la miniature (120 par defaut)
|
||||
* @return void
|
||||
*/
|
||||
function add_thumb($file, $maxWidth = 160, $maxHeight = 120)
|
||||
{
|
||||
@ -1282,7 +1304,8 @@ class Categorie
|
||||
/**
|
||||
* Efface la photo de la categorie et sa vignette
|
||||
*
|
||||
* @param file Chemin de l'image
|
||||
* @param string $file Path to file
|
||||
* @return void
|
||||
*/
|
||||
function delete_photo($file)
|
||||
{
|
||||
@ -1307,9 +1330,10 @@ class Categorie
|
||||
}
|
||||
|
||||
/**
|
||||
* Load size of image file
|
||||
* Load size of image file
|
||||
*
|
||||
* @param file Path to file
|
||||
* @param string $file Path to file
|
||||
* @return void
|
||||
*/
|
||||
function get_image_size($file)
|
||||
{
|
||||
@ -1320,8 +1344,10 @@ class Categorie
|
||||
|
||||
|
||||
/**
|
||||
* Initialise an example of instance with random values
|
||||
* Used to build previews or test instances
|
||||
* Initialise an example of instance with random values
|
||||
* Used to build previews or test instances
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function initAsSpecimen()
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user