1, 'ajt' => 0, 'idcaddie' => 0, ); } return static::$parameters[$name]; } public static function init_filtering_parameters() { static::$filtering_parameters = array( 'chkrestrict' => 1, 'caddies_noti' => array(), 'caddies_bull' => array(), 'caddies_expl' => array() ); } public static function init_parameters() { static::$parameters = array( 'noti' => static::get_parameter('noti'), 'vign' => static::get_parameter('vign'), 'cp' => static::get_parameter('cp'), 'enum' => static::get_parameter('enum'), 'bull' => static::get_parameter('bull'), 'cp_etatcoll' => static::get_parameter('cp_etatcoll'), 'autaut' => static::get_parameter('autaut'), 'autpub' => static::get_parameter('autpub'), 'autcol' => static::get_parameter('autcol'), 'autsco' => static::get_parameter('autsco'), 'authorities_thumbnail' => static::get_parameter('authorities_thumbnail'), 'editorialcontentcp' => static::get_parameter('editorialcontentcp'), ); } public static function init_curl_timeout() { global $pmb_curl_timeout; static::$curl_timeout = (int) $pmb_curl_timeout; } public static function init_curl() { global $chkcurltimeout; @set_time_limit(0) ; static::$curl = new Curl(); $chkcurltimeout += 0; if($chkcurltimeout) { static::$curl->timeout = $chkcurltimeout; } elseif(static::$curl_timeout) { static::$curl->timeout = static::$curl_timeout; } else { static::$curl->timeout = 5; } static::$curl->limit=1000;//Limite à 1Ko pmb_mysql_query("set wait_timeout=3600"); } public static function init_progress_bar() { static::$progress_bar=new progress_bar(); static::$progress_bar->pas=10; } public static function init_queries() { static::$queries['notice'] = array(); static::$queries['vign'] = array(); static::$queries['explnum_noti'] = array(); static::$queries['explnum_bull'] = array(); static::$queries['cp'] = array(); static::$queries['cp_etatcoll'] = array(); $requete_notice ="select notice_id as id, lien as link from notices !!JOIN!! where lien!='' and lien is not null"; $requete_vign ="select notice_id as id, thumbnail_url as link from notices !!JOIN!! where thumbnail_url!='' and thumbnail_url is not null"; $requete_explnum_noti = "select notice_id, explnum_url as link, explnum_id from notices !!JOIN!! join explnum on explnum_notice=notice_id and explnum_notice != 0 where explnum_mimetype = 'URL'"; $requete_explnum_bull = "select bulletin_id, concat(notices.tit1,' ',bulletin_numero,' ',date_date) as tit, explnum_url as link, explnum_id, notices.notice_id from notices join bulletins on notices.notice_id=bulletin_notice !!JOIN!! join explnum on explnum_bulletin=bulletin_id and explnum_bulletin != 0 where explnum_mimetype = 'URL'"; $requete_cp = "select distinct notice_id as id from notices join notices_custom_values on notice_id = notices_custom_origine join notices_custom on idchamp = notices_custom_champ !!JOIN!! where type in ('url','resolve')"; $requete_cp_etatcoll = "select distinct notice_id, collstate_id from notices join collections_state on id_serial = notice_id join collstate_custom_values on collstate_id = collstate_custom_origine join collstate_custom on idchamp = collstate_custom_champ !!JOIN!! where type in ('url','resolve')"; //on s'occupe des restrictions if(static::$filtering_parameters['chkrestrict']){ //pour les paniers de notice if(is_array(static::$filtering_parameters['caddies_noti']) && count(static::$filtering_parameters['caddies_noti'])){ $paniers_ids = implode(",", static::$filtering_parameters['caddies_noti']); //restriction aux notices des paniers $limit_noti = "join caddie_content as c1 on c1.caddie_id in ($paniers_ids) and notice_id = c1.object_id"; //restriction aux bulletins des notices de bulletins des paniers $limit_noti_bull = "join notices as n1 on n1.niveau_biblio = 'b' and n1.niveau_hierar = '2' and num_notice = n1.notice_id join caddie_content as c2 on n1.notice_id = c2.object_id and c2.caddie_id in ($paniers_ids)"; static::$queries['notice'][] =str_replace("!!JOIN!!",$limit_noti,$requete_notice); static::$queries['vign'][] =str_replace("!!JOIN!!",$limit_noti,$requete_vign); static::$queries['explnum_noti'][]= str_replace("!!JOIN!!",$limit_noti,$requete_explnum_noti); static::$queries['explnum_bull'][]=str_replace("!!JOIN!!",$limit_noti_bull,$requete_explnum_bull); static::$queries['cp'][] = str_replace("!!JOIN!!",$limit_noti,$requete_cp); static::$queries['cp_etatcoll'][] = str_replace("!!JOIN!!",$limit_noti,$requete_cp_etatcoll); } //pour les paniers de bulletins if(is_array(static::$filtering_parameters['caddies_bull']) && count(static::$filtering_parameters['caddies_bull'])){ $paniers_ids = implode(",",static::$filtering_parameters['caddies_bull']); //restriction aux bulletins du paniers $limit_bull = "join caddie_content as c3 on c3.caddie_id in ($paniers_ids) and bulletin_id = c3.object_id"; //restriction aux notices de bulletins associées aux bulletins des paniers $limit_bull_noti = "join bulletins as b1 on b1.num_notice = notice_id join caddie_content as c4 on c4.caddie_id in ($paniers_ids) and c4.object_id = b1.bulletin_id"; static::$queries['notice'][] =str_replace("!!JOIN!!",$limit_bull_noti,$requete_notice); static::$queries['vign'][] =str_replace("!!JOIN!!",$limit_bull_noti,$requete_vign); static::$queries['explnum_noti'][]= str_replace("!!JOIN!!",$limit_bull_noti,$requete_explnum_noti); static::$queries['explnum_bull'][]=str_replace("!!JOIN!!",$limit_bull,$requete_explnum_bull); static::$queries['cp'][] = str_replace("!!JOIN!!",$limit_noti,$requete_cp); } //pour les paniers d'exemplaires if(is_array(static::$filtering_parameters['caddies_expl']) && count(static::$filtering_parameters['caddies_expl'])){ $paniers_ids = implode(",",static::$filtering_parameters['caddies_expl']); //restriction aux notices associées au exemplaires des paniers $limit_expl_noti = "join exemplaires as e1 on e1.expl_notice = notice_id and e1.expl_notice != 0 join caddie_content as c5 on c5.caddie_id in ($paniers_ids) and e1.expl_id = c5.object_id"; //restrictions aux bulletin associés au exemplaires des paniers $limit_expl_bull = "join exemplaires as e2 on e2.expl_bulletin = bulletin_id join caddie_content as c6 on c6.caddie_id in ($paniers_ids) and e2.expl_id = c6.object_id"; //restriction aux notices de bulletins associées aux bulletins dont les exemplaires sont dans le paniers $limit_expl_bull_noti ="join bulletins as b2 on b2.num_notice = notice_id join exemplaires as e3 on e3.expl_bulletin = b2.bulletin_id join caddie_content as c7 on c7.caddie_id in ($paniers_ids) and e3.expl_id = c7.object_id"; static::$queries['notice'][] =str_replace("!!JOIN!!",$limit_expl_noti,$requete_notice); static::$queries['notice'][] =str_replace("!!JOIN!!",$limit_expl_bull_noti,$requete_notice); static::$queries['vign'][] =str_replace("!!JOIN!!",$limit_expl_noti,$requete_vign); static::$queries['vign'][] =str_replace("!!JOIN!!",$limit_expl_bull_noti,$requete_vign); static::$queries['explnum_noti'][]= str_replace("!!JOIN!!",$limit_expl_noti,$requete_explnum_noti); static::$queries['explnum_bull'][]=str_replace("!!JOIN!!",$limit_expl_bull,$requete_explnum_bull); static::$queries['cp'][] =str_replace("!!JOIN!!",$limit_expl_noti,$requete_cp); static::$queries['cp'][] =str_replace("!!JOIN!!",$limit_expl_bull_noti,$requete_cp); } }else{ //si on a pas restreint par panier, static::$queries['notice'][] =str_replace("!!JOIN!!","",$requete_notice); static::$queries['vign'][] =str_replace("!!JOIN!!","",$requete_vign); static::$queries['explnum_noti'][]= str_replace("!!JOIN!!","",$requete_explnum_noti); static::$queries['explnum_bull'][]=str_replace("!!JOIN!!","",$requete_explnum_bull); static::$queries['cp'][] = str_replace("!!JOIN!!","",$requete_cp); static::$queries['cp_etatcoll'][] = str_replace("!!JOIN!!","",$requete_cp_etatcoll); } } public static function proceed_parameter($name, $class_name, $caddie_type='NOTI') { if (static::$parameters[$name]['chk']) { $class_name_instance = new $class_name(); if (static::$parameters[$name]['ajt']) { $caddie_instance = caddie_root::get_instance_from_object_type($caddie_type, static::$parameters[$name]['idcaddie']); $class_name_instance->set_caddie_instance($caddie_instance); $class_name_instance->set_caddie_type($caddie_type); } $class_name_instance->process(); } } public static function proceed_custom_field_parameter($name, $sub_type, $caddie_type='NOTI') { if (static::$parameters[$name]['chk']) { $chklnk_custom_fields = new chklnk_custom_fields(); $chklnk_custom_fields->set_sub_type($sub_type); if (static::$parameters[$name]['ajt']) { $caddie_instance = caddie_root::get_instance_from_object_type($caddie_type, static::$parameters[$name]['idcaddie']); $chklnk_custom_fields->set_caddie_instance($caddie_instance); $chklnk_custom_fields->set_caddie_type($caddie_type); } $chklnk_custom_fields->process(); } } public static function proceed() { global $cms_active; static::proceed_parameter('noti', 'chklnk_records'); static::proceed_parameter('vign', 'chklnk_vign'); static::proceed_custom_field_parameter('cp', 'notices'); static::proceed_parameter('enum', 'chklnk_enum'); static::proceed_parameter('bull', 'chklnk_bull', 'BULL'); static::proceed_custom_field_parameter('cp_etatcoll', 'collstate'); static::proceed_parameter('autaut', 'chklnk_authors', 'AUTHORS'); static::proceed_parameter('autpub', 'chklnk_publishers', 'PUBLISHERS'); static::proceed_parameter('autcol', 'chklnk_collections', 'COLLECTIONS'); static::proceed_parameter('autsco', 'chklnk_subcollections', 'SUBCOLLECTIONS'); static::proceed_parameter('authorities_thumbnail', 'chklnk_authorities_thumbnail', 'MIXED'); if($cms_active && static::$parameters['editorialcontentcp']['chk']){ $chklnk_custom_fields = new chklnk_custom_fields(); $chklnk_custom_fields->set_sub_type('cms_editorial'); $chklnk_custom_fields->process(); } } protected function get_query_caddie($type='NOTI') { global $PMBuserid; $instance = caddie_root::get_instance_from_object_type($type); return "SELECT ".$instance::$field_name.", name FROM ".$instance::$table_name." where type='".$type."' and (autorisations='$PMBuserid' or autorisations like '$PMBuserid %' or autorisations like '% $PMBuserid %' or autorisations like '% $PMBuserid') order by name "; } protected function get_filtering_selector($name, $type='NOTI') { $restrict_selector=""; return $restrict_selector; } protected function get_selector($name, $type='NOTI') { if(!isset(static::$parameters[$name]['idcaddie'])) static::$parameters[$name]['idcaddie'] = 0; return gen_liste ($this->get_query_caddie($type), "idcaddie", "name", "parameters[".$name."][idcaddie]", "", static::$parameters[$name]['idcaddie'], "", "","","",0); } public static function set_filtering_parameters($filtering_parameters) { if(!isset(static::$filtering_parameters)) { static::init_filtering_parameters(); } if(!empty($filtering_parameters)) { foreach($filtering_parameters as $key=>$value) { static::$filtering_parameters[$key] = (isset($filtering_parameters[$key]) && $filtering_parameters[$key] ? $filtering_parameters[$key] : 0); } } } public static function set_parameters($parameters) { if(!isset(static::$parameters)) { static::init_parameters(); } foreach(static::$parameters as $name=>$parameter) { foreach($parameter as $key=>$value) { static::$parameters[$name][$key] = (isset($parameters[$name][$key]) && $parameters[$name][$key] ? $parameters[$name][$key] : 0); } } } public static function set_curl_timeout($curl_timeout) { static::$curl_timeout = (int) $curl_timeout; } protected function get_checkbox_checking_input_form($property) { global $msg; if(!isset(static::$parameters[$property]['chk'])) static::$parameters[$property]['chk'] = 1; return " "; } protected function get_checkbox_adding_form($property, $type) { global $msg; if(!isset(static::$parameters[$property]['ajt'])) static::$parameters[$property]['ajt'] = 0; return "
".$msg['chklnk_choix_caddie_'.$property]." ".$this->get_selector($property, $type).""; } protected function get_line_content($property, $type='NOTI') { return "