/**
  * 
  * Update item_id and sess_id of xoonips_file.
  * 
  * @param $item XooNIpsImportItem that is imported.
  * @param $import_items array of all of XooNIpsImportItems
  */
 function onImportFinished(&$item, &$import_items)
 {
     if ('xnpmodelimportitem' != strtolower(get_class($item))) {
         return;
     }
     $this->_set_file_delete_flag($item);
     if ($item->hasModelData()) {
         $model_data =& $item->getVar('model_data');
         $this->_fix_item_id_of_file($item, $model_data);
         $this->_create_text_search_index($model_data);
     }
     // nothing to do if no previews
     $previews =& $item->getVar('preview');
     foreach (array_keys($previews) as $key) {
         if ($previews[$key]->get('file_id') > 0) {
             $this->_fix_item_id_of_file($item, $previews[$key]);
         }
     }
     parent::onImportFinished($item, $import_items);
 }
 /**
  * 
  * Update item_id and sess_id of xoonips_file.
  * 
  * @param $item XooNIpsImportItem that is imported.
  * @param $import_items array of all of XooNIpsImportItems
  */
 function onImportFinished(&$item, &$import_items)
 {
     if ('xnpbookimportitem' != strtolower(get_class($item))) {
         return;
     }
     $this->_set_file_delete_flag($item);
     if ($item->hasBookPdf()) {
         $book_pdf =& $item->getVar('book_pdf');
         $this->_fix_item_id_of_file($item, $book_pdf);
         $this->_create_text_search_index($book_pdf);
     }
     parent::onImportFinished($item, $import_items);
 }
 /**
  * 
  * Update item_id and sess_id of xoonips_file.
  * 
  * @param $item XooNIpsImportItem that is imported.
  * @param $import_items array of all of XooNIpsImportItems
  */
 function onImportFinished(&$item, &$import_items)
 {
     if ('xnpurlimportitem' != strtolower(get_class($item))) {
         return;
     }
     $this->_set_file_delete_flag($item);
     // nothing to do if no file
     if ($item->hasUrlBannerFile()) {
         $url_banner_file =& $item->getVar('url_banner_file');
         $this->_fix_item_id_of_file($item, $url_banner_file);
     }
     parent::onImportFinished($item, $import_items);
 }
 /**
  * 
  * Update item_id and sess_id of xoonips_file.
  * 
  * @param $item XooNIpsImportItem that is imported.
  * @param $import_items array of all of XooNIpsImportItems
  */
 function onImportFinished(&$item, &$import_items)
 {
     if ('xnppaperimportitem' != strtolower(get_class($item))) {
         return;
     }
     $this->_set_file_delete_flag($item);
     // nothing to do if no file
     if ($item->hasPaperPdfReprint()) {
         $paper_pdf_reprint =& $item->getVar('paper_pdf_reprint');
         $this->_fix_item_id_of_file($item, $paper_pdf_reprint);
         $this->_create_text_search_index($paper_pdf_reprint);
     }
     parent::onImportFinished($item, $import_items);
 }
 /**
  * 
  * Update item_id of xnpbinder_binder_item_link
  * 
  * @param $item XooNIpsImportItem that is imported.
  * @param $import_items array of all of XooNIpsImportItems
  */
 function onImportFinished(&$item, &$import_items)
 {
     if ('xnpbinderimportitem' != strtolower(get_class($item))) {
         return;
     }
     // nothing to do for not updated, not imported binder.
     if (!$item->getUpdateFlag() && !$item->getImportAsNewFlag()) {
         return;
     }
     $pseudo_id2id = array();
     foreach ($import_items as $i) {
         $basic =& $i->getVar('basic');
         if (!$i->getUpdateFlag() && !$i->getImportAsNewFlag()) {
             continue;
         }
         if (array_key_exists($i->getPseudoId(), $pseudo_id2id)) {
             $pseudo_id2id[$i->getPseudoId()][] = $basic->get('item_id');
         } else {
             $pseudo_id2id[$i->getPseudoId()] = array($basic->get('item_id'));
         }
     }
     // update xnpbinder_binder_item_link.item_id from pseudo
     //  item id to item id
     $handler =& xoonips_getormhandler('xnpbinder', 'binder_item_link');
     $links =& $item->getVar('binder_item_links');
     $new_links = array();
     foreach (array_keys($links) as $key) {
         if (!array_key_exists($links[$key]->get('item_id'), $pseudo_id2id)) {
             continue;
         }
         foreach ($pseudo_id2id[$links[$key]->get('item_id')] as $item_id) {
             $l =& $handler->create();
             $l->set('binder_id', $links[$key]->get('binder_id'));
             $l->set('item_id', $item_id);
             $handler->insert($l);
             $new_links[] =& $l;
         }
         $handler->delete($links[$key]);
     }
     $item->setVar('binder_item_links', $new_links);
     parent::onImportFinished($item, $import_items);
 }
 /**
  * 
  * Update item_id and sess_id of xoonips_file.
  * 
  * @param $item XooNIpsImportItem that is imported.
  * @param $import_items array of all of XooNIpsImportItems
  */
 function onImportFinished(&$item, &$import_items)
 {
     if ('xnpmemoimportitem' != strtolower(get_class($item))) {
         return;
     }
     $this->_set_file_delete_flag($item);
     // nothing to do if no file
     if ($item->hasMemoFile()) {
         $memo_file =& $item->getVar('memo_file');
         $this->_fix_item_id_of_file($item, $memo_file);
         $this->_create_text_search_index($memo_file);
     }
     parent::onImportFinished($item, $import_items);
 }
 /**
  * 
  * Update item_id and sess_id of xoonips_file.
  * 
  * @param $item XooNIpsImportItem that is imported.
  * @param $import_items array of all of XooNIpsImportItems
  */
 function onImportFinished(&$item, &$import_items)
 {
     if ('xnpdataimportitem' != strtolower(get_class($item))) {
         return;
     }
     $this->_set_file_delete_flag($item);
     // nothing to do if no data file
     if ($item->hasDataFile()) {
         $data_file =& $item->getVar('data_file');
         $this->_fix_item_id_of_file($item, $data_file);
         $this->_create_text_search_index($data_file);
     }
     //         foreach (
     //           array(
     //             'experimenter'             ,
     //           ) as $name ){
     //             $rows = $this->getVar('detail_'.$name);
     //             $cleans = array();
     //             foreach ( $rows as $val ){
     //                 $ar = $this->stripSurplusString( $this->childColumnLengths[strtoupper($name)], array( $name => $val ) );
     //                 if ( count( $ar ) ){
     //                     $this -> setErrors( E_XOONIPS_DATA_TOO_LONG, "detail $name is too long :" . $val . $this -> getErrorAt( __LINE__, __FILE__, __FUNCTION__ ) );
     //                     $cleans[] = $ar[$name];
     //                     $retval = false;
     //                 }
     //                 else
     //                     $cleans[] = $val;
     //             }
     //             $this->cleanVars['detail_'.$name] = $cleans;
     //         }
     // nothing to do if no previews
     $previews =& $item->getVar('preview');
     foreach (array_keys($previews) as $key) {
         if ($previews[$key]->get('file_id') > 0) {
             $this->_fix_item_id_of_file($item, $previews[$key]);
             $this->_create_text_search_index($previews[$key]);
         }
     }
     parent::onImportFinished($item, $import_items);
 }
 /**
  * 
  * Update item_id and sess_id of xoonips_file.
  * 
  * @param $item XooNIpsImportItem that is imported.
  * @param $import_items array of all of XooNIpsImportItems
  */
 function onImportFinished(&$item, &$import_items)
 {
     if ('xnpconferenceimportitem' != strtolower(get_class($item))) {
         return;
     }
     $this->_set_file_delete_flag($item);
     if ($item->hasConferenceFile()) {
         $conference_file =& $item->getVar('conference_file');
         $this->_fix_item_id_of_file($item, $conference_file);
         $this->_create_text_search_index($conference_file);
     }
     if ($item->hasConferencePaper()) {
         $conference_paper =& $item->getVar('conference_paper');
         $this->_fix_item_id_of_file($item, $conference_paper);
         $this->_create_text_search_index($conference_paper);
     }
     parent::onImportFinished($item, $import_items);
 }