function list_rows($arr, $row) { global $tpl; global $display; $col = 0; if (!$this->disable_mass_delete) { $display->rows[$row][$col] = '<input type="checkbox" name="delete[]" value="' . $arr['id'] . '">'; $display->width[$row][$col] = '1%'; $col++; } foreach ($arr as $field => $value) { if (isset($this->allow_single_update) && in_array($field, $this->allow_single_update)) { $link = $this->link_base . '&command=update_field&data[id]=' . $arr['id'] . '&data[field]=' . $field; if ($this->limit_start) { $link .= '&data[limit_start]=' . $this->limit_start; } if ($this->orderby) { $link .= '&data[orderby]=' . $this->orderby; } if ($this->sort) { $link .= '&data[sort]=' . $this->sort; } $display->links[$row][$col] = $link; } elseif (method_exists($this, 'form')) { $link = $this->file . '?class=' . get_class($this) . '&command=edit&data[id]=' . $arr['id']; } else { $link = ''; } if ($field == 'name' && CONF_SHOW_SUMMARY_ON_LIST) { $ingred = new ingredient($arr['id']); $value .= '<span class="admin_ingreds_list">'; $dishes = $ingred->find_connected_dishes(); if (!empty($dishes['included']) && is_array($dishes['included'])) { $value .= '<br/>' . ucphr('INCLUDED') . ': '; foreach ($dishes['included'] as $key2 => $value2) { $value .= ucfirst($value2) . ", "; } $value = substr($value, 0, -2); $value .= ''; } if (!empty($dishes['available']) && is_array($dishes['available'])) { $value .= '<br/>' . ucphr('AVAILABLE') . ': '; foreach ($dishes['available'] as $key2 => $value2) { $value .= ucfirst($value2) . ", "; } $value = substr($value, 0, -2); $value .= ''; } $value .= '</span>'; } elseif ($field == 'unit_type') { $value = get_user_unit($arr['unit_type']); } elseif ($field == 'quantity') { $unit = get_user_unit($arr['unit_type']); $default_unit = get_default_unit($arr['unit_type']); $value = convert_units($value . ' ' . $default_unit, $unit); } $display->rows[$row][$col] = $value; if ($link && $field == 'name') { $display->links[$row][$col] = $link; } if ($link) { $display->clicks[$row][$col] = 'redir(\'' . $link . '\');'; } $col++; } }
function list_rows($arr, $row) { global $tpl; global $display; $col = 0; if (!$this->disable_mass_delete) { $display->rows[$row][$col] = '<input type="checkbox" name="delete[]" value="' . $arr['id'] . '">'; $display->width[$row][$col] = '1%'; $col++; } $dish = new dish(); foreach ($arr as $field => $value) { if (isset($this->hide) && in_array($field, $this->hide)) { continue; } $stock = new stock_object($arr['obj_id']); $ingred = new ingredient(); $link = $ingred->file . '?class=ingredient&command=edit&data[id]=' . $stock->data['ref_id']; if ($field == 'dish_name') { if (!empty($value)) { $link = $dish->file . '?class=dish&command=edit&data[id]=' . $arr['dish_id']; $display->links[$row][$col] = $link; } else { $value = ''; } } elseif ($field == 'unit_type') { $value = get_user_unit($value); } elseif ($field == 'quantity') { $unit = get_user_unit($arr['unit_type']); $default_unit = get_default_unit($arr['unit_type']); $value = convert_units($value . ' ' . $default_unit, $unit); } $display->rows[$row][$col] = $value; if ($link && $field == 'name') { $display->links[$row][$col] = $link; } if ($link) { $display->clicks[$row][$col] = 'redir(\'' . $link . '\');'; } $col++; } }