/**
  * @brief check that each field has valid value.
  * 
  * @param[in] $in_array associative array of item
  * @param[out] $error XooNIpsError to add error
  * @retval ture valid
  * @retval false some invalid fields
  */
 function checkFields($in_array, &$error)
 {
     parent::checkFields($in_array, $fields);
     $result = true;
     //set false if error
     $basic_handler =& xoonips_getormhandler('xoonips', 'item_basic');
     $item_ids = array();
     foreach ($in_array['detail_field'] as $field) {
         if (trim($field['name']) != 'item_id') {
             continue;
         }
         $basic =& $basic_handler->get($field['value']);
         if (!$basic) {
             $error->add(XNPERR_INVALID_PARAM, 'item(' . $field['value'] . ') is not exists');
             $result = false;
             continue;
         }
         if (ITID_INDEX == $basic->get('item_type_id')) {
             $error->add(XNPERR_INVALID_PARAM, 'binder can not have index');
             $result = false;
             continue;
         }
         $item_ids[] = $field['value'];
     }
     $index_ids = $in_array['indexes'];
     // use following functions defined in view.php
     if (xnpbinder_no_binder_item($item_ids)) {
         $error->add(XNPERR_INVALID_PARAM, 'binder needs at least one item');
         $result = false;
     }
     if (xnpbinder_public_binder_has_not_public_item($item_ids, $index_ids)) {
         $error->add(XNPERR_INVALID_PARAM, 'public binder cannot have private and group items');
         $result = false;
     }
     if (xnpbinder_group_binder_has_private_item($item_ids, $index_ids)) {
         $error->add(XNPERR_INVALID_PARAM, 'group binder cannot have private item ');
         $result = false;
     }
     return $result;
 }
function xnpbinderCheckRegisterParameters(&$msg)
{
    $message = '';
    $formdata =& xoonips_getutility('formdata');
    if (xnpbinder_no_binder_item($formdata->getValueArray('post', 'xoonips_item_id', 'i', false))) {
        $message = $message . '<br /><span style="color: red;">' . _MD_XNPBINDER_ITEM_REQUIRED . '</span>';
    }
    if (xnpbinder_public_binder_has_not_public_item($formdata->getValueArray('post', 'xoonips_item_id', 'i', false), xnpbinder_get_add_to_index_id_form_data())) {
        $message = $message . '<br /><span style="color: red;">' . _MD_XNPBINDER_PUBLIC_BINDER_HAS_NOT_PUBLIC_ITEM . '</span>';
    }
    if (xnpbinder_group_binder_has_private_item($formdata->getValueArray('post', 'xoonips_item_id', 'i', false), xnpbinder_get_add_to_index_id_form_data())) {
        $message = $message . '<br /><span style="color: red;">' . _MD_XNPBINDER_GROUP_BINDER_HAS_PRIVATE_ITEM . '</span>';
    }
    $msg .= $message;
    return empty($message);
}