function inser_update_review($parent) { global $wb; $ctrl_map = review_ctrl_mapping(); $table_name = $wb->setting["Settings"]["review_table"]; $set_str = ""; while (list($ctrl_name, $field_name) = each($ctrl_map)) { $value = wb_get_text(wb_get_control($parent, $ctrl_name)); if ($field_name == 'category') { include PATH_CONFIG . "common.php"; $set_str .= "{$field_name}='" . array_search($value, $ReviewwayOption) . "',"; } else { $set_str .= "{$field_name}='{$value}',"; } } $set_str = rtrim($set_str, ','); if ($wb->current_action == 'update') { $id = $wb->current_ids; $set_str .= " ,add_ip='" . $wb->add_ip . "',update_at=now() "; $sql = "UPDATE {$table_name} SET {$set_str} WHERE id='{$id}' "; } else { $set_str .= " ,add_ip='" . $wb->add_ip . "',created_at=now() "; $sql = "INSERT INTO {$table_name} SET {$set_str} "; } $wb->db->query($sql); reset_review_view(); }
function process_review_search($window, $id, $ctrl) { global $wb; switch ($id) { case IDC_SEARCH_SUBMIT: $wb->current_page = 1; $wb->keyword = wb_get_text(wb_get_control($window, IDC_KEYWORD)); reset_review_view(); wb_destroy_window($window); break; case IDCLOSE: // IDCLOSE is predefined // IDCLOSE is predefined case IDCANCEL: // set_default_accel(); wb_destroy_window($window); break; } }
function process_review($window, $id, $ctrl, $lparam1 = 0, $lparam2 = 0) { global $wb; switch ($id) { case IDC_NAV_FIRST: $wb->current_page = 1; reset_review_view(); break; case IDC_NAV_PRE: $wb->current_page -= 1; $wb->current_page = $wb->current_page < 1 ? 1 : $wb->current_page; reset_review_view(); break; case IDC_NAV_NEXT: $wb->current_page += 1; $wb->current_page = $wb->current_page > $wb->total_page ? $wb->total_page : $wb->current_page; reset_review_view(); break; case IDC_NAV_LAST: $wb->current_page = $wb->total_page; reset_review_view(); break; case IDC_REVIEW_LIST: if ($lparam1 == WBC_DBLCLICK) { $current_rows = wb_get_text($ctrl); $current_id = $current_rows[0][0]; $wb->current_ids = $current_id; $wb->current_form_state = false; $wb->current_action = 'update'; if ($wb->current_ids) { include_once PATH_FORM . "yc_review_edit.form.inc.php"; create_review_edit_dlg(); } } // Show current selection and checked items $sel = wb_get_selected($ctrl); $sel = $sel ? implode(", ", $sel) : "none"; $contents = wb_get_text($ctrl); $text = ""; if ($contents) { foreach ($contents as $row) { $text .= $row ? "[" . implode(", ", $row) . "] " : ""; } } $checked = wb_get_value($ctrl); $temp_str = ""; if ($checked) { foreach ($checked as $value) { $row_data = wb_get_text($ctrl, $value, 0); $temp_str .= $row_data . ","; } $del_ids = rtrim($temp_str, ','); $wb->del_ids = $del_ids; } $checked = $checked ? implode(", ", $checked) : "none"; wb_set_text($wb->statusbar, "Selected lines: " . $sel . " / checked: " . $checked . " / deleted: " . $del_ids . " / contents: " . $text); break; } }