?>
<fieldset class="menuBox">
<div class="menuBoxInner exportIcon">
    <?php 
echo strtoupper(__('Export Data')) . '<hr />' . __('Export member(s) data to CSV file');
?>
</div>
</fieldset>
<?php 
// create new instance
$form = new simbio_form_table('mainForm', $_SERVER['PHP_SELF'] . '', 'post');
$form->submit_button_attr = 'name="doExport" value="' . __('Export Now') . '" class="button"';
// form table attributes
$form->table_attr = 'align="center" class="dataList" cellpadding="5" cellspacing="0"';
$form->table_header_attr = 'class="alterCell" style="font-weight: bold;"';
$form->table_content_attr = 'class="alterCell2"';
/* Form Element(s) */
// field separator
$form->addTextField('text', 'fieldSep', __('Field Separator') . '*', '' . htmlentities(',') . '', 'style="width: 10%;"');
//  field enclosed
$form->addTextField('text', 'fieldEnc', __('Field Enclosed With'), '' . htmlentities('"') . '', 'style="width: 10%;"');
// record separator
$rec_sep_options[] = array('NEWLINE', 'NEWLINE');
$rec_sep_options[] = array('RETURN', 'CARRIAGE RETURN');
$form->addSelectList('recordSep', __('Record Separator'), $rec_sep_options);
// number of records to export
$form->addTextField('text', 'recordNum', __('Number of Records To Export (0 for all records)'), '0', 'style="width: 10%;"');
// records offset
$form->addTextField('text', 'recordOffset', __('Start From Record'), '1', 'style="width: 10%;"');
// output the form
echo $form->printOut();
    $form->table_attr = 'align="center" class="dataList" cellpadding="5" cellspacing="0"';
    $form->table_header_attr = 'class="alterCell" style="font-weight: bold;"';
    $form->table_content_attr = 'class="alterCell2"';
    // edit mode flag set
    if ($rec_q->num_rows > 0) {
        $form->edit_mode = true;
        // record ID for delete process
        $form->record_id = $itemID;
        // form record title
        $form->record_title = $rec_d['item_status_name'];
        // submit button attribute
        $form->submit_button_attr = 'name="saveData" value="' . __('Update') . '" class="button"';
    }
    /* Form Element(s) */
    // item status code
    $form->addTextField('text', 'itemStatusID', __('Item Status Code') . '*', $rec_d['item_status_id'], 'style="width: 20%;" maxlength="3"');
    // item status name
    $form->addTextField('text', 'itemStatus', __('Item Status Name') . '*', $rec_d['item_status_name'], 'style="width: 60%;"');
    // item status rules
    $form->addCheckbox('rules', __('Rules'), $rules_option, unserialize($rec_d['rules']));
    // edit mode messagge
    if ($form->edit_mode) {
        echo '<div class="infoBox">' . __('You are going to edit Item Status data') . ' : <b>' . $rec_d['item_status_name'] . '</b>  <br />' . __('Last Update') . $rec_d['last_update'] . '</div>';
        //mfc
    }
    // print out the form object
    echo $form->printOut();
} else {
    /* ITEM STATUS LIST */
    // table spec
    $table_spec = 'mst_item_status AS ist';
    $form->table_attr = 'align="center" class="dataList" cellpadding="5" cellspacing="0"';
    $form->table_header_attr = 'class="alterCell" style="font-weight: bold;"';
    $form->table_content_attr = 'class="alterCell2"';
    // edit mode flag set
    if ($rec_q->num_rows > 0) {
        $form->edit_mode = true;
        // record ID for delete process
        $form->record_id = $itemID;
        // form record title
        $form->record_title = $rec_d['gmd_name'];
        // submit button attribute
        $form->submit_button_attr = 'name="saveData" value="' . __('Update') . '" class="button"';
    }
    /* Form Element(s) */
    // gmd code
    $form->addTextField('text', 'gmdCode', __('GMD Code') . '*', $rec_d['gmd_code'], 'style="width: 20%;" maxlength="3"');
    // gmd name
    $form->addTextField('text', 'gmdName', __('GMD Name') . '*', $rec_d['gmd_name'], 'style="width: 60%;"');
    // edit mode messagge
    if ($form->edit_mode) {
        echo '<div class="infoBox">' . __('You are going to edit gmd data') . ' : <b>' . $rec_d['gmd_name'] . '</b>  <br />' . __('Last Update') . $rec_d['last_update'] . '</div>';
        //mfc
    }
    // print out the form object
    echo $form->printOut();
} else {
    /* GMD LIST */
    // table spec
    $table_spec = 'mst_gmd AS g';
    // create datagrid
    $datagrid = new simbio_datagrid();
 $form->table_attr = 'align="center" class="dataList" cellpadding="5" cellspacing="0"';
 $form->table_header_attr = 'class="alterCell" style="font-weight: bold;"';
 $form->table_content_attr = 'class="alterCell2"';
 // edit mode flag set
 if ($rec_q->num_rows > 0) {
     $form->edit_mode = true;
     // record ID for delete process
     $form->record_id = $itemID;
     // form record title
     $form->record_title = $rec_d['supplier_name'];
     // submit button attribute
     $form->submit_button_attr = 'name="saveData" value="' . __('Update') . '" class="button"';
 }
 /* Form Element(s) */
 // supplier name
 $form->addTextField('text', 'supplierName', __('Supplier Name') . '*', $rec_d['supplier_name'], 'style="width: 60%;"');
 // supplier address
 $form->addTextField('textarea', 'supplierPlace', __('Address'), $rec_d['address'], 'style="width: 100%;" rows="2"');
 // supplier contact
 $form->addTextField('text', 'supplierContact', __('Contact'), $rec_d['contact'], 'style="width: 60%;"');
 // supplier phone
 $form->addTextField('text', 'supplierPhone', __('Phone Number'), $rec_d['phone'], 'style="width: 60%;"');
 // supplier fax
 $form->addTextField('text', 'supplierFax', __('Fax Number'), $rec_d['fax'], 'style="width: 60%;"');
 // supplier account number
 $form->addTextField('text', 'supplierAccount', __('Account Number'), $rec_d['account'], 'style="width: 60%;"');
 // edit mode messagge
 if ($form->edit_mode) {
     echo '<div class="infoBox">' . __('You are going to edit Supplier data') . ' : <b>' . $rec_d['supplier_name'] . '</b> <br />' . __('Last Update') . $rec_d['last_update'] . '</div>';
     //mfc
 }
 $ctype_options = array();
 while ($ctype_data = $ctype_query->fetch_row()) {
     $ctype_options[] = array($ctype_data[0], $ctype_data[1]);
 }
 $ctype_options[] = array('0', __('ALL'));
 $form->addSelectList('collTypeID', __('Collection Type'), $ctype_options, $rec_d['coll_type_id'], 'style="width: 50%;"');
 // gmd
 // get gmd data related to this record from database
 $gmd_query = $dbs->query('SELECT gmd_id, gmd_name FROM mst_gmd');
 $gmd_options[] = array(0, __('ALL'));
 while ($gmd_data = $gmd_query->fetch_row()) {
     $gmd_options[] = array($gmd_data[0], $gmd_data[1]);
 }
 $form->addSelectList('gmdID', __('GMD'), $gmd_options, $rec_d['gmd_id'], 'style="width: 50%;"');
 // loan limit
 $form->addTextField('text', 'loanLimit', __('Loan Limit'), $rec_d['loan_limit'], 'size="5"');
 // loan periode
 $form->addTextField('text', 'loanPeriode', __('Loan Period'), $rec_d['loan_periode'], 'size="5"');
 // reborrow limit
 $form->addTextField('text', 'reborrowLimit', __('Reborrow Limit'), $rec_d['reborrow_limit'], 'size="5"');
 // fine each day
 $form->addTextField('text', 'fineEachDay', __('Fines Each Day'), $rec_d['fine_each_day']);
 // overdue grace periode
 $form->addTextField('text', 'gracePeriode', __('Overdue Grace Periode'), $rec_d['grace_periode']);
 // edit mode messagge
 if ($form->edit_mode) {
     echo '<div class="infoBox">' . __('You are going to edit loan rules') . ' : <br />' . __('Last Update') . $rec_d['last_update'] . '</div>' . "\n";
     //mfc
 }
 // print out the form object
 echo $form->printOut();
    $form->table_attr = 'align="center" class="dataList" cellpadding="5" cellspacing="0"';
    $form->table_header_attr = 'class="alterCell" style="font-weight: bold;"';
    $form->table_content_attr = 'class="alterCell2"';
    // edit mode flag set
    if ($rec_q->num_rows > 0) {
        $form->edit_mode = true;
        // record ID for delete process
        $form->record_id = $itemID;
        // form record title
        $form->record_title = $rec_d['place_name'];
        // submit button attribute
        $form->submit_button_attr = 'name="saveData" value="' . __('Update') . '" class="button"';
    }
    /* Form Element(s) */
    // place name
    $form->addTextField('text', 'placeName', __('Place Name') . '*', $rec_d['place_name'], 'style="width: 60%;"');
    // edit mode messagge
    if ($form->edit_mode) {
        echo '<div class="infoBox">' . __('You are going to edit place data') . ' : <b>' . $rec_d['place_name'] . '</b>  <br />' . __('Last Update') . $rec_d['last_update'] . '</div>';
        //mfc
    }
    // print out the form object
    echo $form->printOut();
} else {
    /* PLACE LIST */
    // table spec
    $table_spec = 'mst_place AS pl';
    // create datagrid
    $datagrid = new simbio_datagrid();
    if ($can_read and $can_write) {
        $datagrid->setSQLColumn('pl.place_id', 'pl.place_name AS \'' . __('Place Name') . '\'', 'pl.last_update AS \'' . __('Last Update') . '\'');
 // edit mode flag set
 if ($rec_q->num_rows > 0) {
     $form->edit_mode = true;
     // record ID for delete process
     $form->record_id = $itemID;
     // form record title
     $form->record_title = $rec_d['period'];
     // submit button attribute
     $form->submit_button_attr = 'name="saveData" value="' . __('Update') . '" class="button"';
 }
 /* Form Element(s) */
 // serial date start
 $form->addDateField('dateStart', __('Subscription Start') . '*', $rec_d['date_start']);
 if (!$form->edit_mode) {
     // serial exemplar
     $form->addTextField('text', 'exemplar', __('Total Exemplar Expected') . '*', '1');
 }
 // serial periode name
 $form->addTextField('text', 'period', __('Period Name') . '*', $rec_d['period'], 'style="width: 100%;"');
 // serial notes
 $form->addTextField('textarea', 'notes', __('Subscription Notes'), $rec_d['notes'], 'style="width: 100%;" rows="3"');
 // serial gmd
 // get gmd data related to this record from database
 $gmd_q = $dbs->query('SELECT gmd_id, gmd_name FROM mst_gmd');
 $gmd_options = array();
 while ($gmd_d = $gmd_q->fetch_row()) {
     $gmd_options[] = array($gmd_d[0], $gmd_d[1]);
 }
 $form->addSelectList('gmdID', __('GMD'), $gmd_options, $rec_d['gmd_id']);
 // serial biblio ID
 $form->addHidden('biblioID', $biblioID);
 $form->table_attr = 'align="center" class="dataList" cellpadding="5" cellspacing="0"';
 $form->table_header_attr = 'class="alterCell" style="font-weight: bold;"';
 $form->table_content_attr = 'class="alterCell2"';
 // edit mode flag set
 if ($rec_q->num_rows > 0) {
     $form->edit_mode = true;
     // record ID for delete process
     $form->record_id = $itemID;
     // form record title
     $form->record_title = str_ireplace('label-', '', $rec_d['label_name']);
     // submit button attribute
     $form->submit_button_attr = 'name="saveData" value="' . __('Update') . '" class="button"';
 }
 /* Form Element(s) */
 // label name
 $form->addTextField('text', 'labelName', __('Label Name') . '*', $rec_d['label_name'], 'style="width: 60%;" maxlength="20"');
 // label image
 if (empty($rec_d['label_image'])) {
     $str_input = simbio_form_element::textField('file', 'labelImage');
     $str_input .= ' Maximum ' . $sysconf['max_image_upload'] . ' KB. All image will be automatically resized.';
     $form->addAnything(__('File Attachment'), $str_input);
 } else {
     $str_input = '<div><img src="' . SENAYAN_WEB_ROOT_DIR . IMAGES_DIR . '/labels/' . $rec_d['label_image'] . '" align="middle" /> <strong>' . $rec_d['label_image'] . '</strong></div>';
     $str_input .= simbio_form_element::textField('file', 'labelImage');
     $str_input .= ' Maximum ' . $sysconf['max_image_upload'] . ' KB. All image will be automatically resized.';
     $form->addAnything(__('File Attachment'), $str_input);
 }
 // label desc
 $form->addTextField('text', 'labelDesc', __('Label Description'), $rec_d['label_desc'], 'style="width: 100%;" maxlength="50"');
 // edit mode messagge
 if ($form->edit_mode) {
 $form->table_attr = 'align="center" class="dataList" cellpadding="5" cellspacing="0"';
 $form->table_header_attr = 'class="alterCell" style="font-weight: bold;"';
 $form->table_content_attr = 'class="alterCell2"';
 // edit mode flag set
 if ($rec_q->num_rows > 0) {
     $form->edit_mode = true;
     // record ID for delete process
     $form->record_id = $itemID;
     // form record title
     $form->record_title = $rec_d['member_type_name'];
     // submit button attribute
     $form->submit_button_attr = 'name="saveData" value="' . __('Update') . '" class="button"';
 }
 /* Form Element(s) */
 // member type name
 $form->addTextField('text', 'memberTypeName', __('Member Type Name') . '*', $rec_d['member_type_name'], 'style="width: 100%;"');
 // loan limit
 $form->addTextField('text', 'loanLimit', __('Loan Limit'), $rec_d['loan_limit'], 'size="5"');
 // loan periode
 $form->addTextField('text', 'loanPeriode', __('Loan Periode (In Days)'), $rec_d['loan_periode'], 'size="5"');
 // enable reserve
 $enable_resv_chbox[0] = array('1', __('Enable'));
 $enable_resv_chbox[1] = array('0', __('Disable'));
 $form->addRadio('enableReserve', __('Reserve'), $enable_resv_chbox, !empty($rec_d['enable_reserve']) ? $rec_d['enable_reserve'] : '1');
 // reserve limit
 $form->addTextField('text', 'reserveLimit', __('Reserve Limit'), $rec_d['reserve_limit'], 'size="5"');
 // membership periode
 $form->addTextField('text', 'memberPeriode', __('Membership Periode (In Days)'), $rec_d['member_periode'], 'size="5"');
 // reborrow limit
 $form->addTextField('text', 'reborrowLimit', __('Reborrow Limit'), $rec_d['reborrow_limit'], 'size="5"');
 // fine each day
    $form->table_attr = 'align="center" class="dataList" cellpadding="5" cellspacing="0"';
    $form->table_header_attr = 'class="alterCell" style="font-weight: bold;"';
    $form->table_content_attr = 'class="alterCell2"';
    // edit mode flag set
    if ($rec_q->num_rows > 0) {
        $form->edit_mode = true;
        // record ID for delete process
        $form->record_id = $itemID;
        // form record title
        $form->record_title = $rec_d['coll_type_name'];
        // submit button attribute
        $form->submit_button_attr = 'name="saveData" value="' . __('Update') . '" class="button"';
    }
    /* Form Element(s) */
    // coll_type_name
    $form->addTextField('text', 'collTypeName', __('Collection Type') . '*', $rec_d['coll_type_name'], 'style="width: 60%;"');
    // edit mode messagge
    if ($form->edit_mode) {
        echo '<div class="infoBox">' . __('You are going to edit collection type data') . ' : <b>' . $rec_d['coll_type_name'] . '</b>  <br />' . __('Last Update') . $rec_d['last_update'] . '</div>';
        //mfc
    }
    // print out the form object
    echo $form->printOut();
} else {
    /* COLLECTION TYPE LIST */
    // table spec
    $table_spec = 'mst_coll_type AS ct';
    // create datagrid
    $datagrid = new simbio_datagrid();
    if ($can_read and $can_write) {
        $datagrid->setSQLColumn('ct.coll_type_id', 'ct.coll_type_name AS \'' . __('Collection Type') . '\'', 'ct.last_update AS \'' . __('Last Update') . '\'');
 // edit mode flag set
 if ($rec_q->num_rows > 0) {
     $form->edit_mode = true;
     // record ID for delete process
     $form->record_id = $itemID;
     // form record title
     $form->record_title = $rec_d['period'];
     // submit button attribute
     $form->submit_button_attr = 'name="saveData" value="' . lang_sys_common_form_update . '" class="button"';
 }
 /* Form Element(s) */
 // serial date start
 $form->addDateField('dateStart', lang_mod_serial_field_date_start . '*', $rec_d['date_start']);
 if (!$form->edit_mode) {
     // serial exemplar
     $form->addTextField('text', 'exemplar', lang_mod_serial_field_exemplar . '*', '1');
 }
 // serial periode name
 $form->addTextField('text', 'period', lang_mod_serial_field_period . '*', $rec_d['period'], 'style="width: 100%;"');
 // serial notes
 $form->addTextField('textarea', 'notes', lang_mod_serial_field_notes, $rec_d['notes'], 'style="width: 100%;" rows="3"');
 // serial gmd
 // get gmd data related to this record from database
 $gmd_q = $dbs->query('SELECT gmd_id, gmd_name FROM mst_gmd');
 $gmd_options = array();
 while ($gmd_d = $gmd_q->fetch_row()) {
     $gmd_options[] = array($gmd_d[0], $gmd_d[1]);
 }
 $form->addSelectList('gmdID', lang_mod_biblio_field_gmd, $gmd_options, $rec_d['gmd_id']);
 // serial biblio ID
 $form->addHidden('biblioID', $biblioID);
         // record ID for delete process
         $form->record_id = $itemID;
         // form record title
         $form->record_title = $rec_d['description'];
         // submit button attribute
         $form->submit_button_attr = 'name="saveData" value="' . __('Update') . '" class="button"';
     }
     /* Form Element(s) */
     // holiday date start
     $form->addDateField('holDate', __('Holiday Date Start'), $rec_d['holiday_date']);
     // holiday date end
     if (!$form->edit_mode) {
         $form->addDateField('holDateEnd', __('Holiday Date End'), $rec_d['holiday_date']);
     }
     // holiday description
     $form->addTextField('text', 'holDesc', __('Holiday Description') . '*', $rec_d['description'], 'style="width: 100%;"');
     // edit mode messagge
     if ($form->edit_mode) {
         echo '<div class="infoBox">' . __('You are going to edit holiday data') . ' : <b>' . $rec_d['description'] . '</b></div>';
         //mfc
     }
     // print out the form object
     echo $form->printOut();
 } else {
     /* HOLIDAY LIST */
     // table spec
     $table_spec = 'holiday';
     // create datagrid
     $datagrid = new simbio_datagrid();
     if ($can_read and $can_write) {
         $datagrid->setSQLColumn('holiday_id', "holiday_dayname AS '" . __('Day name') . "'", "holiday_date AS '" . __('Holiday Date Start') . "'", "description AS '" . __('Holiday Description') . "'");
 $form->table_attr = 'align="center" class="dataList" cellpadding="5" cellspacing="0"';
 $form->table_header_attr = 'class="alterCell" style="font-weight: bold;"';
 $form->table_content_attr = 'class="alterCell2"';
 // edit mode flag set
 if ($rec_q->num_rows > 0) {
     $form->edit_mode = true;
     // record ID for delete process
     $form->record_id = $itemID;
     // form record title
     $form->record_title = $rec_d['group_name'];
     // submit button attribute
     $form->submit_button_attr = 'name="saveData" value="' . __('Update') . '" class="button"';
 }
 /* Form Element(s) */
 // group
 $form->addTextField('text', 'groupName', __('Group Name') . '*', $rec_d['group_name'], 'style="width: 60%;"');
 // privileges
 // get group access data
 $priv_data = array();
 $rec_q = $dbs->query('SELECT * FROM group_access WHERE group_id=' . (!empty($rec_d['group_id']) ? $rec_d['group_id'] : 0));
 while ($access_data = $rec_q->fetch_assoc()) {
     $priv_data[$access_data['module_id']]['r'] = $access_data['r'];
     $priv_data[$access_data['module_id']]['w'] = $access_data['w'];
 }
 $priv_table = '';
 include 'module_priv_form.inc.php';
 $form->addAnything(__('Privileges'), $priv_table);
 // edit mode messagge
 if ($form->edit_mode) {
     // print out the object
     echo '<div class="infoBox">' . __('You are going to edit Group data') . ' : <b>' . $rec_d['group_name'] . '</b>  <br />' . __('Last Update') . $rec_d['last_update'] . '</div>';
    $form->table_attr = 'align="center" class="dataList" cellpadding="5" cellspacing="0"';
    $form->table_header_attr = 'class="alterCell" style="font-weight: bold;"';
    $form->table_content_attr = 'class="alterCell2"';
    // edit mode flag set
    if ($rec_q->num_rows > 0) {
        $form->edit_mode = true;
        // record ID for delete process
        $form->record_id = $itemID;
        // form record title
        $form->record_title = $rec_d['location_name'];
        // submit button attribute
        $form->submit_button_attr = 'name="saveData" value="' . __('Update') . '" class="button"';
    }
    /* Form Element(s) */
    // location code
    $form->addTextField('text', 'locationID', __('Location Code') . '*', $rec_d['location_id'], 'style="width: 20%;" maxlength="3"');
    // location name
    $form->addTextField('text', 'locationName', __('Location Name') . '*', $rec_d['location_name'], 'style="width: 60%;"');
    // edit mode messagge
    if ($form->edit_mode) {
        echo '<div class="infoBox">' . __('You are going to edit location data') . ' : <b>' . $rec_d['location_name'] . '</b> <br />' . __('Last Update') . $rec_d['last_update'] . '</div>';
        //mfc
    }
    // print out the form object
    echo $form->printOut();
} else {
    /* LOCATION LIST */
    // table spec
    $table_spec = 'mst_location AS l';
    // create datagrid
    $datagrid = new simbio_datagrid();
    $form->table_attr = 'align="center" class="dataList" cellpadding="5" cellspacing="0"';
    $form->table_header_attr = 'class="alterCell" style="font-weight: bold;"';
    $form->table_content_attr = 'class="alterCell2"';
    // edit mode flag set
    if ($rec_q->num_rows > 0) {
        $form->edit_mode = true;
        // record ID for delete process
        $form->record_id = $itemID;
        // form record title
        $form->record_title = $rec_d['author_name'];
        // submit button attribute
        $form->submit_button_attr = 'name="saveData" value="' . __('Update') . '" class="button"';
    }
    /* Form Element(s) */
    // author name
    $form->addTextField('text', 'authorName', __('Author Name') . '*', $rec_d['author_name'], 'style="width: 60%;"');
    // authority type
    foreach ($sysconf['authority_type'] as $auth_type_id => $auth_type) {
        $auth_type_options[] = array($auth_type_id, $auth_type);
    }
    $form->addSelectList('authorityType', __('Authority Type'), $auth_type_options, $rec_d['authority_type']);
    // authority list
    $form->addTextField('text', 'authList', __('Authority Files'), $rec_d['auth_list'], 'style="width: 30%;"');
    // edit mode messagge
    if ($form->edit_mode) {
        echo '<div class="infoBox">' . __('You are going to edit author data') . ' : <b>' . $rec_d['author_name'] . '</b> <br />' . __('Last Update') . $rec_d['last_update'] . '</div>';
        //mfc
    }
    // print out the form object
    echo $form->printOut();
} else {
$form->table_header_attr = 'class="alterCell" style="font-weight: bold;"';
$form->table_content_attr = 'class="alterCell2"';
// query
$file_attach_q = $dbs->query("SELECT fl.*, batt.* FROM files AS fl\n    LEFT JOIN biblio_attachment AS batt ON fl.file_id=batt.file_id\n    WHERE batt.biblio_id={$biblioID} AND batt.file_id={$fileID}");
$file_attach_d = $file_attach_q->fetch_assoc();
// edit mode
if ($file_attach_d['biblio_id'] and $file_attach_d['file_id']) {
    $form->addHidden('updateBiblioID', $file_attach_d['biblio_id']);
    $form->addHidden('updateFileID', $file_attach_d['file_id']);
} else {
    if ($biblioID) {
        $form->addHidden('updateBiblioID', $biblioID);
    }
}
// file title
$form->addTextField('text', 'fileTitle', lang_mod_biblio_attach_form_field_title, $file_attach_d['file_title'], 'style="width: 100%; overflow: auto;"');
// file attachment
if ($file_attach_d['file_name']) {
    $form->addAnything('Attachment', $file_attach_d['file_dir'] . '/' . $file_attach_d['file_name']);
} else {
    // file upload dir
    // create simbio directory object
    $repo = new simbio_directory(REPO_BASE_DIR);
    $repo_dir_tree = $repo->getDirectoryTree(5);
    // sort array by index
    ksort($repo_dir_tree);
    // loop array
    foreach ($repo_dir_tree as $dir) {
        $repodir_options[] = array($dir, $dir);
    }
    $form->addSelectList('fileDir', lang_mod_biblio_attach_form_field_filedir, $repodir_options);
 // title
 if (!$in_pop_up) {
     $str_input = $b_title;
     $str_input .= '<div class="makeHidden"><a title="Edit Bibliographic Data" style="font-weight: bold; color: #ff9900;" href="javascript: openWin(\'' . MODULES_WEB_ROOT_DIR . 'bibliography/pop_biblio.php?inPopUp=true&action=detail&itemID=' . $rec_d['biblio_id'] . '&itemCollID=' . $rec_d['item_id'] . '\', \'popBiblio\', 600, 400, true)">Edit Biblographic data</a></div>';
 } else {
     $str_input = $b_title;
 }
 $form->addAnything(__('Title'), $str_input);
 $form->addHidden('biblioTitle', $b_title);
 $form->addHidden('biblioID', $b_id);
 // item code
 $str_input = simbio_form_element::textField('text', 'itemCode', $rec_d['item_code'], 'onblur="ajaxCheckID(\'' . SENAYAN_WEB_ROOT_DIR . 'admin/AJAX_check_id.php\', \'item\', \'item_code\', \'msgBox\', \'itemCode\')" style="width: 40%;"');
 $str_input .= ' &nbsp; <span id="msgBox">&nbsp;</span>';
 $form->addAnything(__('Item Code'), $str_input);
 // call number
 $form->addTextField('text', 'callNumber', __('Call Number'), isset($rec_d['call_number']) ? $rec_d['call_number'] : $def_call_number, 'style="width: 40%;"');
 // inventory code
 $form->addTextField('text', 'inventoryCode', __('Inventory Code'), $rec_d['inventory_code'], 'style="width: 100%;"');
 // item location
 // get location data related to this record from database
 $location_q = $dbs->query("SELECT location_id, location_name FROM mst_location");
 $location_options = array();
 while ($location_d = $location_q->fetch_row()) {
     $location_options[] = array($location_d[0], $location_d[1]);
 }
 $form->addSelectList('locationID', __('Location'), $location_options, $rec_d['location_id']);
 // item site
 $form->addTextField('text', 'itemSite', __('Shelf Location'), $rec_d['site'], 'style="width: 40%;"');
 // collection type
 // get collection type data related to this record from database
 $coll_type_q = $dbs->query("SELECT coll_type_id, coll_type_name FROM mst_coll_type");
    $form->table_attr = 'align="center" class="dataList" cellpadding="5" cellspacing="0"';
    $form->table_header_attr = 'class="alterCell" style="font-weight: bold;"';
    $form->table_content_attr = 'class="alterCell2"';
    // edit mode flag set
    if ($rec_q->num_rows > 0) {
        $form->edit_mode = true;
        // record ID for delete process
        $form->record_id = $itemID;
        // form record title
        $form->record_title = $rec_d['module_name'];
        // submit button attribute
        $form->submit_button_attr = 'name="saveData" value="' . __('Update') . '" class="button"';
    }
    /* Form Element(s) */
    // module
    $form->addTextField('text', 'moduleName', __('Module Name') . '*', $rec_d['module_name'], 'style="width: 50%;"');
    // module path
    $form->addTextField('text', 'modulePath', __('Module Path') . '*', $rec_d['module_path'], 'style="width: 100%;"');
    // module desc
    $form->addTextField('text', 'moduleDesc', __('Module Description'), $rec_d['module_desc'], 'style="width: 100%;"');
    // edit mode messagge
    if ($form->edit_mode) {
        echo '<div class="infoBox">' . __('You are going to edit data') . ' : <b>' . $rec_d['module_name'] . '</b></div>';
        //mfc
    }
    // print out the form object
    echo $form->printOut();
} else {
    /* MODULE LIST */
    // table spec
    $table_spec = 'mst_module AS mdl';
    $form->table_attr = 'align="center" class="dataList" cellpadding="5" cellspacing="0"';
    $form->table_header_attr = 'class="alterCell" style="font-weight: bold;"';
    $form->table_content_attr = 'class="alterCell2"';
    // edit mode flag set
    if ($rec_q->num_rows > 0) {
        $form->edit_mode = true;
        // record ID for delete process
        $form->record_id = $itemID;
        // form record title
        $form->record_title = $rec_d['language_name'];
        // submit button attribute
        $form->submit_button_attr = 'name="saveData" value="' . __('Update') . '" class="button"';
    }
    /* Form Element(s) */
    // language ID
    $form->addTextField('text', 'langID', __('Language Code') . '*', $rec_d['language_id'], 'style="width: 20%;" maxlength="5"');
    // language_name
    $form->addTextField('text', 'langName', __('Language') . '*', $rec_d['language_name'], 'style="width: 60%;"');
    // print out the form object
    echo '<div class="infoBox">' . __('You are going to edit language data') . ' : <b>' . $rec_d['language_name'] . '</b>  <br />' . __('Last Update') . $rec_d['last_update'] . '</div>';
    //mfc
    echo $form->printOut();
} else {
    /* DOCUMENT LANGUAGE LIST */
    // table spec
    $table_spec = 'mst_language AS l';
    // create datagrid
    $datagrid = new simbio_datagrid();
    if ($can_read and $can_write) {
        $datagrid->setSQLColumn('l.language_id', 'l.language_name AS \'' . __('Language') . '\'', 'l.last_update AS \'' . __('Last Update') . '\'');
    } else {
 $form->table_attr = 'align="center" class="dataList" cellpadding="5" cellspacing="0"';
 $form->table_header_attr = 'class="alterCell" style="font-weight: bold;"';
 $form->table_content_attr = 'class="alterCell2"';
 // edit mode flag set
 if ($rec_q->num_rows > 0) {
     $form->edit_mode = true;
     // record ID for delete process
     $form->record_id = $itemID;
     // form record title
     $form->record_title = $rec_d['frequency'];
     // submit button attribute
     $form->submit_button_attr = 'name="saveData" value="' . __('Update') . '" class="button"';
 }
 /* Form Element(s) */
 // frequency name
 $form->addTextField('text', 'frequencyName', __('Frequency') . '*', $rec_d['frequency'], 'style="width: 60%;"');
 // frequency language
 // get language data related to this record from database
 $lang_q = $dbs->query('SELECT language_id, language_name FROM mst_language');
 $lang_options = array();
 while ($lang_d = $lang_q->fetch_row()) {
     $lang_options[] = array($lang_d[0], $lang_d[1]);
 }
 $form->addSelectList('languagePrefix', __('Language'), $lang_options, $rec_d['language_prefix']);
 // frequency time increment
 $form->addTextField('text', 'timeIncrement', __('Time Increment') . '*', $rec_d['time_increment'], 'style="width: 10%;"');
 // frequency time unit
 $unit_options[] = array('day', __('Day'));
 $unit_options[] = array('week', __('Week'));
 $unit_options[] = array('month', __('Month'));
 $unit_options[] = array('year', __('Year'));
                 utility::jsAlert(__('Stock Taking FAILED to Initialized.\\nNo item to stock take!'));
             }
             exit;
         }
     }
 }
 // create new instance
 $form = new simbio_form_table('mainForm', $_SERVER['PHP_SELF'] . '?action=new', 'post');
 $form->submit_button_attr = 'name="saveData" value="' . __('Initialize Stock Take') . '" class="button"';
 // form table attributes
 $form->table_attr = 'align="center" class="dataList" cellpadding="5" cellspacing="0"';
 $form->table_header_attr = 'class="alterCell" style="font-weight: bold;"';
 $form->table_content_attr = 'class="alterCell2"';
 /* Form Element(s) */
 // stock take name
 $form->addTextField('text', 'name', __('Stock Take Name') . '*', '', 'style="width: 60%;"');
 // gmd
 // get gmd data related to this record from database
 $gmd_q = $dbs->query('SELECT gmd_id, gmd_name FROM mst_gmd');
 $gmd_options[] = array('0', __('ALL'));
 while ($gmd_d = $gmd_q->fetch_row()) {
     $gmd_options[] = array($gmd_d[0], $gmd_d[1]);
 }
 $form->addSelectList('gmdID', __('GMD'), $gmd_options);
 // collection type
 // get coll_type data related to this record from database
 $coll_type_q = $dbs->query('SELECT coll_type_id, coll_type_name FROM mst_coll_type');
 $coll_type_options[] = array('0', __('ALL'));
 while ($coll_type_d = $coll_type_q->fetch_row()) {
     $coll_type_options[] = array($coll_type_d[0], $coll_type_d[1]);
 }
     // record ID for delete process
     if (!$changecurrent) {
         // form record id
         $form->record_id = $itemID;
     } else {
         $form->addHidden('updateRecordID', $itemID);
         $form->back_button = false;
     }
     // form record title
     $form->record_title = $rec_d['realname'];
     // submit button attribute
     $form->submit_button_attr = 'name="saveData" value="' . __('Update') . '" class="button"';
 }
 /* Form Element(s) */
 // user name
 $form->addTextField('text', 'userName', __('Login Username') . '*', $rec_d['username'], 'style="width: 50%;"');
 // user real name
 $form->addTextField('text', 'realName', __('Real Name') . '*', $rec_d['realname'], 'style="width: 50%;"');
 // user group
 // only appear by user who hold system module privileges
 if (!$changecurrent and $can_read and $can_write) {
     // add hidden element as a flag that we dont change group data
     $form->addHidden('noChangeGroup', '1');
     // user group
     $group_query = $dbs->query('SELECT group_id, group_name FROM
         user_group WHERE group_id != 1');
     // initiliaze group options
     $group_options = array();
     while ($group_data = $group_query->fetch_row()) {
         $group_options[] = array($group_data[0], $group_data[1]);
     }
Exemple #23
0
        // record ID for delete process
        $form->record_id = $itemID;
        // delete button only showed for admin user
        if ($_SESSION['uid'] != 1) {
            $form->delete_button = false;
        }
        // form record title
        $form->record_title = 'Fines Detail';
        // submit button attribute
        $form->submit_button_attr = 'name="saveData" value="' . __('Update') . '" class="button"';
    }
    /* Form Element(s) */
    // fines dates
    $form->addDateField('finesDate', __('Fines Date'), $rec_d['fines_date']);
    // fines description
    $form->addTextField('text', 'finesDesc', __('Description/Name') . '*', $rec_d['description'], 'style="width: 60%;"');
    // fines debet
    $form->addTextField('text', 'debet', __('Debit') . '*', !empty($rec_d['debet']) ? $rec_d['debet'] : '0', 'style="width: 60%;"');
    // fines credit
    $form->addTextField('text', 'credit', __('Credit'), !empty($rec_d['credit']) ? $rec_d['credit'] : '0', 'style="width: 60%;"');
    // edit mode messagge
    if ($form->edit_mode) {
        echo '<div class="infoBox">' . __('You are going to edit fines data') . ' : <b>' . $rec_d['description'] . '</b></div>';
        //mfc
    }
    // print out the form object
    echo $form->printOut();
} else {
    $fines_alert = FALSE;
    $total_unpaid_fines = 0;
    $_unpaid_fines = $dbs->query('SELECT * FROM fines WHERE member_id=' . $_SESSION['memberID'] . ' AND debet > credit');
        // record ID for delete process
        $form->record_id = $itemID;
        // delete button only showed for admin user
        if ($_SESSION['uid'] != 1) {
            $form->delete_button = false;
        }
        // form record title
        $form->record_title = 'Fines Detail';
        // submit button attribute
        $form->submit_button_attr = 'name="saveData" value="' . lang_sys_common_form_update . '" class="button"';
    }
    /* Form Element(s) */
    // fines dates
    $form->addDateField('finesDate', lang_mod_circ_fines_field_date, $rec_d['fines_date']);
    // fines description
    $form->addTextField('text', 'finesDesc', lang_mod_circ_fines_field_description . '*', $rec_d['description'], 'style="width: 60%;"');
    // fines debet
    $form->addTextField('text', 'debet', lang_mod_circ_fines_field_debit . '*', !empty($rec_d['debet']) ? $rec_d['debet'] : '0', 'style="width: 60%;"');
    // fines credit
    $form->addTextField('text', 'credit', lang_mod_circ_fines_field_credit, !empty($rec_d['credit']) ? $rec_d['credit'] : '0', 'style="width: 60%;"');
    // edit mode messagge
    if ($form->edit_mode) {
        echo '<div class="infoBox">' . lang_mod_circ_fines_common_info . '<b>' . $rec_d['description'] . '</b></div>';
    }
    // print out the form object
    echo $form->printOut();
} else {
    /* FINES LIST */
    $memberID = trim($_SESSION['memberID']);
    // table spec
    $table_spec = 'fines AS f';
Exemple #25
0
$form->table_header_attr = 'class="alterCell" style="font-weight: bold;"';
$form->table_content_attr = 'class="alterCell2"';
// query
$file_attach_q = $dbs->query("SELECT fl.*, batt.* FROM files AS fl\r\n    LEFT JOIN biblio_attachment AS batt ON fl.file_id=batt.file_id\r\n    WHERE batt.biblio_id={$biblioID} AND batt.file_id={$fileID}");
$file_attach_d = $file_attach_q->fetch_assoc();
// edit mode
if ($file_attach_d['biblio_id'] and $file_attach_d['file_id']) {
    $form->addHidden('updateBiblioID', $file_attach_d['biblio_id']);
    $form->addHidden('updateFileID', $file_attach_d['file_id']);
} else {
    if ($biblioID) {
        $form->addHidden('updateBiblioID', $biblioID);
    }
}
// file title
$form->addTextField('text', 'fileTitle', __('Title') . '*', $file_attach_d['file_title'], 'style="width: 100%; overflow: auto;"');
// file attachment
if ($file_attach_d['file_name']) {
    $form->addAnything('Attachment', $file_attach_d['file_dir'] . '/' . $file_attach_d['file_name']);
} else {
    // file upload dir
    // create simbio directory object
    $repo = new simbio_directory(REPO_BASE_DIR);
    $repo_dir_tree = $repo->getDirectoryTree(5);
    $repodir_options[] = array('', __('Repository ROOT'));
    if (is_array($repo_dir_tree)) {
        // sort array by index
        ksort($repo_dir_tree);
        // loop array
        foreach ($repo_dir_tree as $dir) {
            $repodir_options[] = array($dir, $dir);
         $form->record_id = $itemID;
     } else {
         $form->addHidden('updateRecordID', $itemID);
         $form->addHidden('itemCollID', $_POST['itemCollID']);
         $form->back_button = false;
     }
     // form record title
     $form->record_title = $rec_d['title'];
     // submit button attribute
     $form->submit_button_attr = 'name="saveData" value="' . __('Update') . '" class="button"';
     // element visibility class toogle
     $visibility = 'makeHidden';
 }
 /* Form Element(s) */
 // biblio title
 $form->addTextField('textarea', 'title', __('Title') . '*', $rec_d['title'], 'rows="1" style="width: 100%; overflow: auto;"');
 // biblio edition
 $form->addTextField('text', 'edition', __('Edition'), $rec_d['edition'], 'style="width: 40%;"');
 // biblio specific detail info/area
 $form->addTextField('textarea', 'specDetailInfo', __('Specific Detail Info'), $rec_d['spec_detail_info'], 'rows="2" style="width: 100%"');
 // biblio item add
 if (!$in_pop_up and $form->edit_mode) {
     $str_input = '<div class="makeHidden"><a href="javascript: openWin(\'' . MODULES_WEB_ROOT_DIR . 'bibliography/pop_item.php?inPopUp=true&action=detail&biblioID=' . $rec_d['biblio_id'] . '\', \'popItem\', 600, 400, true)">' . __('Add New Items') . '</a></div>';
     $str_input .= '<iframe name="itemIframe" id="itemIframe" class="borderAll" style="width: 100%; height: 70px;" src="' . MODULES_WEB_ROOT_DIR . 'bibliography/iframe_item_list.php?biblioID=' . $rec_d['biblio_id'] . '"></iframe>' . "\n";
     $form->addAnything('Item(s) Data', $str_input);
 }
 // biblio authors
 $str_input = '<div class="' . $visibility . '"><a href="javascript: openWin(\'' . MODULES_WEB_ROOT_DIR . 'bibliography/pop_author.php?biblioID=' . $rec_d['biblio_id'] . '\', \'popAuthor\', 500, 200, true)">' . __('Add Author(s)') . '</a></div>';
 $str_input .= '<iframe name="authorIframe" id="authorIframe" class="borderAll" style="width: 100%; height: 70px;" src="' . MODULES_WEB_ROOT_DIR . 'bibliography/iframe_author.php?biblioID=' . $rec_d['biblio_id'] . '"></iframe>';
 $form->addAnything(__('Author(s)'), $str_input);
 // biblio gmd