示例#1
0
 public static function bibliolog_compare($obj_db, $biblio_id, $user_id, $realname, $title, $current, $previous = NULL)
 {
     if ($previous == NULL) {
         if ($current[0]['classification'] != 'NONE') {
             api::bibliolog_write($obj_db, $biblio_id, $user_id, $realname, $title, 'update', 'classification', $current, 'New data. Classification. Number: ' . $current[0]['classification']);
         }
         if ($current[0]['image'] != NULL) {
             api::bibliolog_write($obj_db, $biblio_id, $user_id, $realname, $title, 'update', 'cover', $current, 'New data. Image. File: ' . $current[0]['image']);
         }
         if ($current[0]['authors'] != NULL) {
             $_authors = '';
             foreach ($current[0]['authors'] as $key => $value) {
                 $_authors .= $value['author_name'] . '; ';
             }
             api::bibliolog_write($obj_db, $biblio_id, $user_id, $realname, $title, 'update', 'author', $current, 'New data. Author. Names: ' . $_authors);
         }
         if ($current[0]['subjects'] != NULL) {
             $_subjects = '';
             foreach ($current[0]['subjects'] as $key => $value) {
                 $_subjects .= $value['topic'] . '; ';
             }
             api::bibliolog_write($obj_db, $biblio_id, $user_id, $realname, $title, 'update', 'subject', $current, 'New data. Subject. Names: ' . $_subjects);
         }
     } else {
         if ($current[0]['hash']['biblio'] != $previous[0]['hash']['biblio']) {
             api::bibliolog_write($obj_db, $biblio_id, $user_id, $realname, $title, 'update', 'description', $current, 'Updated data. Bibliography.');
         }
         if ($current[0]['classification'] != 'NONE' and $current[0]['classification'] != $previous[0]['classification']) {
             api::bibliolog_write($obj_db, $biblio_id, $user_id, $realname, $title, 'update', 'classification', $current, 'Updated data. Classification. Number: ' . $current[0]['classification']);
         }
         if ($current[0]['image'] != NULL and $current[0]['image'] != $previous[0]['image']) {
             api::bibliolog_write($obj_db, $biblio_id, $user_id, $realname, $title, 'update', 'cover', $current, 'Updated data. Image. File: ' . $current[0]['image']);
         }
         if ($current[0]['authors'] != NULL and $current[0]['hash']['authors'] != $previous[0]['hash']['authors']) {
             $_authors = '';
             foreach ($current[0]['authors'] as $key => $value) {
                 $_authors .= $value['author_name'] . '; ';
             }
             api::bibliolog_write($obj_db, $biblio_id, $user_id, $realname, $title, 'update', 'author', $current, 'Updated data. Author. Names: ' . $_authors);
         }
         if ($current[0]['subjects'] != NULL and $current[0]['hash']['subjects'] != $previous[0]['hash']['subjects']) {
             $_subjects = '';
             foreach ($current[0]['subjects'] as $key => $value) {
                 $_subjects .= $value['topic'] . '; ';
             }
             api::bibliolog_write($obj_db, $biblio_id, $user_id, $realname, $title, 'update', 'subject', $current, 'Updated data. Subject. Names: ' . $_subjects);
         }
     }
 }
示例#2
0
       $_POST['itemID'] = array((int) $_POST['itemID']);
   }
   // loop array
   $http_query = '';
   foreach ($_POST['itemID'] as $itemID) {
       $itemID = (int) $itemID;
       // check if this biblio data still have an item
       $_sql_biblio_item_q = sprintf('SELECT b.title, COUNT(item_id) FROM biblio AS b
 LEFT JOIN item AS i ON b.biblio_id=i.biblio_id
 WHERE b.biblio_id=%d GROUP BY title', $itemID);
       $biblio_item_q = $dbs->query($_sql_biblio_item_q);
       $biblio_item_d = $biblio_item_q->fetch_row();
       if ($biblio_item_d[1] < 1) {
           if ($sysconf['log']['biblio']) {
               $_rawdata = api::biblio_load($dbs, $itemID);
               api::bibliolog_write($dbs, $itemID, $_SESSION['uid'], $_SESSION['realname'], $biblio_item_d[0], 'delete', 'description', $_rawdata, 'Data bibliografi dihapus.');
           }
           if (!$sql_op->delete('biblio', "biblio_id={$itemID}")) {
               $error_num++;
           } else {
               // write log
               utility::writeLogs($dbs, 'staff', $_SESSION['uid'], 'bibliography', $_SESSION['realname'] . ' DELETE bibliographic data (' . $biblio_item_d[0] . ') with biblio_id (' . $itemID . ')');
               // delete related data
               $sql_op->delete('biblio_topic', "biblio_id={$itemID}");
               $sql_op->delete('biblio_author', "biblio_id={$itemID}");
               $sql_op->delete('biblio_attachment', "biblio_id={$itemID}");
               $sql_op->delete('biblio_relation', "biblio_id={$itemID}");
               $sql_op->delete('search_biblio', "biblio_id={$itemID}");
               // add to http query for UCS delete
               $http_query .= "itemID[]={$itemID}&";
           }