本文整理汇总了PHP中category::import方法的典型用法代码示例。如果您正苦于以下问题:PHP category::import方法的具体用法?PHP category::import怎么用?PHP category::import使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类category
的用法示例。
在下文中一共展示了category::import方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: keep_authority_infos
function keep_authority_infos($authority_number, $type, $origin_authority, $notice_id, $authority_infos = array())
{
//on a un numéro d'autorité, on regarde si on l'a déjà rencontré
$query = "select id_authority_source,num_authority from authorities_sources where authority_number = '" . $authority_number . "' and num_origin_authority='" . $origin_authority . "' and authority_type = '" . $type . "'";
$result = mysql_query($query);
if (mysql_num_rows($result)) {
$row = mysql_fetch_object($result);
$num_authority = $row->num_authority;
$num_authority_source = $row->id_authority_source;
// on cherche la préférence... dès fois que...
$query = "select id_authority_source, num_authority from authorities_sources where authority_number = '" . $authority_number . "' and authority_type = '" . $type . "' and authority_favorite = 1";
$result = mysql_query($query);
if (mysql_num_rows($result)) {
$row = mysql_fetch_object($result);
$num_authority = $row->num_authority;
$num_authority_source = $row->id_authority_source;
}
} else {
// c'est un petit nouveau
switch ($type) {
case "author":
$num_authority = auteur::import($authority_infos);
break;
case "uniform_title":
$num_authority = titre_uniforme::import($authority_infos);
break;
case "category":
$num_authority = category::import($authority_infos);
break;
case "collection":
$num_authority = collection::import($authority_infos);
break;
case "subcollection":
$num_authority = subcollection::import($authority_infos);
break;
case "serie":
break;
}
$query = "insert into authorities_sources set \n\t\t\tnum_authority = '{$num_authority}',\n\t\t\tauthority_number = '" . $authority_number . "',\n\t\t\tauthority_type = '{$type}',\n\t\t\tnum_origin_authority = " . $origin_authority . ",\n\t\t\timport_date = now()";
mysql_query($query);
$num_authority_source = mysql_insert_id();
}
//certaines autorités sont créés avant la notice...
if ($notice_id != 0) {
$query = "insert into notices_authorities_sources set \n\t\tnum_authority_source = " . $num_authority_source . ",\n\t\tnum_notice = " . $notice_id;
mysql_query($query);
}
return $num_authority;
}
示例2: insert_authority_infos
function insert_authority_infos($authority_number, $type, $id_origin_authority, $authority_infos = array())
{
global $opac_enrichment_bnf_sparql;
//on a un numéro d'autorité, on regarde si on l'a déjà rencontré
$num_authority = $authority_infos['id'];
$query = "select id_authority_source,num_authority from authorities_sources where authority_number = '" . $authority_number . "' and num_origin_authority='" . $id_origin_authority . "' and authority_type = '" . $type . "'";
$result = pmb_mysql_query($query) or die("can't select authorities_sources :" . $query);
if (pmb_mysql_num_rows($result)) {
$row = pmb_mysql_fetch_object($result);
$num_authority = $row->num_authority;
$num_authority_source = $row->id_authority_source;
// on cherche la préférence... dès fois que...
$query = "select id_authority_source, num_authority from authorities_sources where authority_number = '" . $authority_number . "' and authority_type = '" . $type . "' and authority_favorite = 1";
$result = pmb_mysql_query($query) or die("can't select authorities_sources :" . $query);
if (pmb_mysql_num_rows($result)) {
$row = pmb_mysql_fetch_object($result);
$num_authority = $row->num_authority;
$num_authority_source = $row->id_authority_source;
}
} else {
// on importe l'autorité dans la base si elle n'a pas d'id
if ($num_authority == 0) {
switch ($type) {
case "author":
$num_authority = auteur::import($authority_infos);
break;
case "uniform_title":
$num_authority = titre_uniforme::import($authority_infos);
break;
case "category":
$num_authority = category::import($authority_infos);
break;
case "collection":
$num_authority = collection::import($authority_infos);
break;
case "subcollection":
$num_authority = subcollection::import($authority_infos);
break;
case "serie":
break;
}
}
// on intègre la source de l'autorité
$query = "insert into authorities_sources set\n\t\t\tnum_authority = '{$num_authority}',\n\t\t\tauthority_number = '" . $authority_number . "',\n\t\t\tauthority_type = '{$type}',\n\t\t\tnum_origin_authority = " . $id_origin_authority . ",\n\t\t\timport_date = now()";
pmb_mysql_query($query) or die("can't insert authorities_sources :" . $query);
$num_authority_source = pmb_mysql_insert_id();
////////////////////////////////////////////////////////////////
if ($opac_enrichment_bnf_sparql && $type == 'author') {
auteur::author_enrichment($num_authority);
}
}
return $num_authority;
}
示例3: create_authority
public function create_authority()
{
switch ($this->notice->type) {
case "author":
$this->authority_id = auteur::import($this->notice->specifics_data);
break;
case "uniform_title":
$this->authority_id = titre_uniforme::import($this->notice->specifics_data);
break;
case "collection":
$this->authority_id = collection::import($this->notice->specifics_data);
if ($this->authority_id != 0 && $this->notice->specifics_data['subcollections']) {
for ($i = 0; $i < count($this->notice->specifics_data['subcollections']); $i++) {
$this->notice->specifics_data['subcollections'][$i]['coll_parent'] = $this->authority_id;
$subcoll_id = subcollection::check_if_exists($this->notice->specifics_data['subcollections'][$i]);
if ($subcoll_id != 0 && $this->notice->specifics_data['subcollections'][$i]['authority_number']) {
$query = "insert into authorities_sources set \n\t\t\t\t\t\t\t\t\tnum_authority = " . $subcoll_id . ",\n\t\t\t\t\t\t\t\t\tauthority_number = '" . $this->notice->specifics_data['subcollections'][$i]['authority_number'] . "',\t\n\t\t\t\t\t\t\t\t\tauthority_type = 'subcollection',\n\t\t\t\t\t\t\t\t\tnum_origin_authority = " . $this->num_origin . ",\n\t\t\t\t\t\t\t\t\tauthority_favorite = 0,\n\t\t\t\t\t\t\t\t\timport_date = now()";
mysql_query($query);
}
}
}
break;
case "subcollection":
$this->authority_id = subcollection::import($this->notice->specifics_data);
if ($this->authority_id != 0 && $this->notice->specifics_data['collection'] && $this->notice->specifics_data['collection']['authority_number']) {
$coll_id = collection::check_if_exists($this->notice->specifics_data['collection']);
$query = "insert into authorities_sources set \n\t\t\t\t\t\t\tnum_authority = " . $coll_id . ",\n\t\t\t\t\t\t\tauthority_number = '" . $this->notice->specifics_data['collection']['authority_number'] . "',\t\n\t\t\t\t\t\t\tauthority_type = 'collection',\n\t\t\t\t\t\t\tnum_origin_authority = " . $this->num_origin . ",\n\t\t\t\t\t\t\tauthority_favorite = 0,\n\t\t\t\t\t\t\timport_date = now()";
mysql_query($query);
}
break;
case "category":
$this->authority_id = category::import($this->notice->specifics_data, $this->id_thesaurus, $this->get_parent_category(), $this->notice->common_data['lang']);
break;
default:
// on fait rien...
break;
}
if ($this->authority_id) {
$query = "insert into authorities_sources set \n\t\t\t\tnum_authority = " . $this->authority_id . ",\n\t\t\t\tauthority_number = '" . $this->notice->common_data['authority_number'] . "',\t\n\t\t\t\tauthority_type = '" . $this->notice->type . "',\n\t\t\t\tnum_origin_authority = " . $this->num_origin . ",\n\t\t\t\tauthority_favorite = 1,\n\t\t\t\timport_date = now(),\n\t\t\t\tupdate_date = now()";
mysql_query($query);
} else {
return false;
}
}