function uc_order_pane_admin_comments in Ubercart 7.3
Same name and namespace in other branches
- 5 uc_order/uc_order_order_pane.inc \uc_order_pane_admin_comments()
- 6.2 uc_order/uc_order.order_pane.inc \uc_order_pane_admin_comments()
Handles the "Admin Comments" order pane.
1 call to uc_order_pane_admin_comments()
- uc_order_pane_products_ajax_callback in uc_order/
uc_order.order_pane.inc - AJAX callback to render the order product controls.
2 string references to 'uc_order_pane_admin_comments'
- hook_uc_order_pane in uc_order/
uc_order.api.php - Registers callbacks for an order pane.
- uc_order_uc_order_pane in uc_order/
uc_order.module - Implements hook_uc_order_pane().
File
- uc_order/
uc_order.order_pane.inc, line 895 - This file contains the callbacks for the default order panes supplied with Ubercart and their corresponding helper functions.
Code
function uc_order_pane_admin_comments($op, $order, &$form = NULL, &$form_state = NULL) {
global $user;
switch ($op) {
case 'view':
$comments = uc_order_comments_load($order->order_id, TRUE);
return tapir_get_table('uc_op_admin_comments_view_table', $comments);
case 'edit-form':
$form['admin_comment_field'] = array(
'#type' => 'fieldset',
'#title' => t('Add an admin comment'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['admin_comment_field']['admin_comment'] = array(
'#type' => 'textarea',
'#description' => t('Admin comments are only seen by store administrators.'),
);
return $form;
case 'edit-theme':
$comments = uc_order_comments_load($form['order_id']['#value'], TRUE);
if (is_array($comments) && count($comments) > 0) {
foreach ($comments as $comment) {
$items[] = '[' . theme('uc_uid', array(
'uid' => $comment->uid,
)) . '] ' . filter_xss_admin($comment->message);
}
}
else {
$items = array(
t('No admin comments have been entered for this order.'),
);
}
$output = theme('item_list', array(
'items' => $items,
)) . drupal_render($form['admin_comment_field']);
return $output;
case 'edit-process':
if (!empty($form_state['values']['admin_comment'])) {
uc_order_comment_save($form_state['values']['order_id'], $user->uid, $form_state['values']['admin_comment']);
}
return;
}
}