<?php

// +-------------------------------------------------+
// © 2002-2004 PMB Services / www.sigb.net pmb@sigb.net et contributeurs (voir www.sigb.net)
// +-------------------------------------------------+
// $Id: sphinx_series_indexer.class.php,v 1.4.6.1.2.1 2025/07/29 08:53:56 qvarin Exp $

if (stristr($_SERVER['REQUEST_URI'], ".inc.php")) {
    die("no access");
}

global $class_path;
require_once $class_path.'/sphinx/sphinx_indexer.class.php';

class sphinx_series_indexer extends sphinx_authorities_indexer
{
    public function __construct()
    {
        global $include_path;

        $this->type = AUT_TABLE_SERIES;
        $this->default_index = "series";

        parent::__construct();

        $this->setChampBaseFilepath($include_path . "/indexation/authorities/series/champs_base.xml");
    }

    protected function addSpecificsFilters($id, $filters = [])
    {
        $filters = parent::addSpecificsFilters($id, $filters);

        //Recuperation du statut
        $query = "select num_statut from authorities where id_authority = " . $id . " and type_object = " . $this->type;
        $result = pmb_mysql_query($query);
        $row = pmb_mysql_fetch_object($result);
        if (! array_key_exists('multi', $filters)) {
            $filters['multi'] = [];
        }
        if (is_object($row)) {
            $filters['multi']['status'] = $row->num_statut;
        }
        return $filters;
    }
}
