本文整理汇总了PHP中parametres_perso::import方法的典型用法代码示例。如果您正苦于以下问题:PHP parametres_perso::import方法的具体用法?PHP parametres_perso::import怎么用?PHP parametres_perso::import使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类parametres_perso
的用法示例。
在下文中一共展示了parametres_perso::import方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildNotice
/**
* @param array $entry le tableau $entry généré par la fonction buildEntry()
*
* Fonction d'import d'une notice formaté par la fonction buildEntry()
* Ajoute les informations d'audit
* Ajoute les champs personnalisés
* Ajoute les tables annexes [responsability], [notices_categories] et [notices_langues]
* Met à jours l'indexation de la notice
*/
static function buildNotice(&$entry)
{
global $pmb_type_audit;
global $webdav_current_user_name, $webdav_current_user_id;
//la notice existe déjà ? si oui, on renvoi l'id trouvé
if ($entry['niveau_biblio'] . $entry['niveau_hierar'] == 'a2') {
$query = '
SELECT n1.* FROM notices AS n1
JOIN analysis ON n1.notice_id=analysis_notice
JOIN bulletins ON bulletin_id=analysis_bulletin
JOIN notices AS n2 ON n2.notice_id=bulletin_notice
WHERE n1.tit1="' . addslashes($entry['tit1']) . '"
AND n1.niveau_biblio="' . addslashes($entry['niveau_biblio']) . '"
AND n1.niveau_hierar="' . addslashes($entry['niveau_hierar']) . '"
AND bulletin_numero="' . addslashes($entry['bulletin']['bulletin_numero']) . '"
AND mention_date="' . addslashes($entry['bulletin']['mention_date']) . '"
AND date_date="' . addslashes($entry['bulletin']['date_date']) . '"
AND n2.tit1="' . addslashes($entry['periodique']['tit1']) . '"
AND n2.niveau_biblio="' . addslashes($entry['periodique']['niveau_biblio']) . '"
AND n2.niveau_hierar="' . addslashes($entry['periodique']['niveau_hierar']) . '"
';
$result = mysql_query($query);
} else {
$query = 'SELECT * FROM notices WHERE tit1="' . addslashes($entry['tit1']) . '" AND niveau_biblio="' . addslashes($entry['niveau_biblio']) . '" AND niveau_hierar="' . addslashes($entry['niveau_hierar']) . '"';
$result = mysql_query($query);
}
if (mysql_num_rows($result)) {
// La notice existe
$entry = array_merge(mysql_fetch_array($result, MYSQL_ASSOC), $entry);
//TODO : A vérifier
$first = true;
$query = 'UPDATE notices SET ';
foreach (array_keys($entry) as $fieldName) {
if (!is_array($entry[$fieldName]) && $entry[$fieldName] != '' && $fieldName != 'ancien_num_name') {
if (!$first) {
$query .= ',';
}
$query .= $fieldName . '="' . addslashes($entry[$fieldName]) . '"';
$first = false;
}
}
$query .= ' WHERE notice_id="' . addslashes($entry['notice_id']) . '"';
mysql_query($query) or die('echec de la requete : ' . $query . '<br/>' . mysql_error() . "\n");
} else {
//les éditeurs
if (sizeof($entry['publishers'])) {
foreach ($entry['publishers'] as $id => $publisher) {
if ($id < 2) {
if ($id === 0) {
$entry['ed1_id'] = \editeur::import($publisher);
} elseif ($id === 1) {
$entry['ed2_id'] = \editeur::import($publisher);
}
}
}
}
//la collection
if (sizeof($entry['collections']) && $entry['ed1_id']) {
$entry['collections']['parent'] = $entry['ed1_id'];
$entry['coll_id'] = \collection::import($entry['collections']);
}
$first = true;
$query = 'INSERT INTO notices SET ';
foreach ($entry as $fieldName => $value) {
if (!is_array($value) && $value != '') {
if (!$first) {
$query .= ',';
}
$query .= $fieldName . '="' . addslashes(trim($value)) . '"';
$first = false;
}
}
mysql_query($query) or die('Echec d\'execution de la requete ' . $query . ' : ' . mysql_error());
$entry['notice_id'] = mysql_insert_id();
if ($pmb_type_audit && ($webdav_current_user_id || $webdav_current_user_name) && $entry['create_date']) {
//ajout des informations d'audit
$query = 'INSERT INTO audit (type_obj,object_id,user_id,user_name,type_modif,quand) VALUES (1,' . $entry['notice_id'] . ',' . $webdav_current_user_id . ',"' . addslashes($webdav_current_user_name) . '",1,"' . $entry['create_date'] . '")';
mysql_query($query) or die('Echec d\'execution de la requete ' . $query . ' : ' . mysql_error());
}
}
//les champs persos
if (sizeof($entry['cp'])) {
foreach ($entry['cp'] as $cp) {
\parametres_perso::import($entry['notice_id'], $cp['field'], $cp['value'], 'notices');
}
}
//ajout dans les tables annexes a la notice
if (sizeof($entry['annexes'])) {
foreach ($entry['annexes'] as $typeAnnexe => $annexes) {
foreach ($annexes as $id => $annexe) {
switch ($typeAnnexe) {
//.........这里部分代码省略.........