function xoonips_insert_event_and_send_notification_of_certification($item_id)
{
    $xconfig_handler =& xoonips_getormhandler('xoonips', 'config');
    $xnpsid = $_SESSION['XNPSID'];
    $formdata =& xoonips_getutility('formdata');
    $xoonipsCheckedXID = $formdata->getValue('post', 'xoonipsCheckedXID', 's', false);
    if (empty($xoonipsCheckedXID) || !xnpIsCommaSeparatedNumber($xoonipsCheckedXID)) {
        return;
    }
    $index_ids = explode(',', $xoonipsCheckedXID);
    $certify_item = $xconfig_handler->getValue('certify_item');
    if (is_null($certify_item)) {
        $certify_item = 'on';
    }
    $eventlog_handler =& xoonips_getormhandler('xoonips', 'event_log');
    foreach ($index_ids as $i) {
        $index = array();
        $result = xnp_get_index($xnpsid, $i, $index);
        if ($result == RES_OK) {
            if ($index['open_level'] == OL_PRIVATE) {
                continue;
            }
            // record events(request certify item)
            $eventlog_handler->recordRequestCertifyItemEvent($item_id, $i);
            if ($certify_item == 'auto') {
                xoonips_notification_item_certified_auto($item_id, $i);
                // record events(certify item)
                $eventlog_handler->recordCertifyItemEvent($item_id, $i);
            } else {
                if ($certify_item == 'on') {
                    xoonips_notification_item_certify_request($item_id, $i);
                }
            }
        }
    }
}
 /** 
  * @brief helper function for putItem, updateItem2. 
  * update notify, update rss
  * @param response XooNIpsResponse object
  * @param item XooNIpsItem object
  * @return result true if succeeded.
  */
 function touchItem2(&$error, &$item, $uid)
 {
     $basic = $item->getVar('basic');
     $item_id = $basic->get('item_id');
     // notify
     $index_item_link_handler =& xoonips_getormhandler('xoonips', 'index_item_link');
     $index_item_links = $index_item_link_handler->getByItemId($item_id, array(OL_GROUP_ONLY, OL_PUBLIC));
     foreach ($index_item_links as $link) {
         if ($link->get('certify_state') == CERTIFY_REQUIRED) {
             xoonips_notification_item_certify_request($link->get('item_id'), $link->get('index_id'));
         } else {
             if ($link->get('certify_state') == CERTIFIED) {
                 xoonips_notification_item_certified_auto($link->get('item_id'), $link->get('index_id'));
             }
         }
     }
     return true;
 }