$path, // 'title' => $title, // 'access' => $access, // 'callback' => 'portfolio_page', // 'weight' => 0 ); // return $items; if ($may_cache) { $access = user_access('use portfolio'); $title = t(variable_get("portfolio_overview_title", "portfolio link")); $path = 'portfolio'; // add main portfolio node $items[] = array( 'path' => $path, 'title' => $title, 'access' => $access, 'callback' => 'portfolio_overview', 'weight' => 0); // Top level portfolio tabs $items[] = array( 'path' => 'portfolio/list', 'title' => t('list'), 'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10); $items[] = array( 'path' => 'portfolio/add', 'title' => t('add'), 'callback' => 'portfolio_add', 'access' => $access, 'type' => MENU_LOCAL_TASK); //ttt (edit) $items[] = array( 'path' => 'portfolio/ttt', 'title' => t('ttt'), 'callback' => 'portfolio_ttt', 'access' => $access, 'type' => MENU_LOCAL_TASK); // String related callbacks $items[] = array( 'path' => 'portfolio/edit', 'title' => t('edit'), 'callback' => 'portfolio_edit', 'access' => $access, 'type' => MENU_CALLBACK); $items[] = array('path' => 'portfolio/delete', 'title' => t('confirm'), 'callback' => 'portfolio_delete_screen', 'access' => $access, 'type' => MENU_CALLBACK); } return $items; } function _portfolio_list($refresh = 0) { static $list; if (!$list || $refresh) { $result = db_query('SELECT * FROM {stock_portfolio}'); $list = array(); while ($a = db_fetch_object($result)) { $list[] = $a; } } return $list; } function _stock_list($refresh = 0) { static $list; if (!$list || $refresh) { $result = db_query('SELECT * FROM {stock_stock} where pid ="1"'); $list = array(); while ($a = db_fetch_object($result)) { $list[] = $a; } } return $list; } function portfolio_list() { //$output .= t('ci devo scrivere qualcosina'); $header = array(t('portfolio'), t('description'), t('currency'), t('operation')); $rows = array(); $list = _portfolio_list(1); foreach ($list as $portfolio) { $rows[] = array( $portfolio->pid, $portfolio->name, $portfolio->currency, l(t('edit'), 'portfolio/edit/'. $portfolio->pid) ); } $output .= theme('table', $header, $rows); return $output; } function stock_list() { //$output .= t('ci devo scrivere qualcosina'); $header = array( t('stock'), t('quantity'), t('price_paid'), t(alert_high), t(alert_low),t('operation')); $rows = array(); $list = _stock_list(1); foreach ($list as $stock) { $rows[] = array( $stock->ticker, $stock->quantity, $stock->price_paid, $stock->alert_high, $stock->alert_low, l(t('edit'), 'portfolio/edit/asset/'.$stock->pid.'/'.$stock->ticker ) ); } $output .= theme('table', $header, $rows); return $output; } // Display the asset edit page function portfolio_edit_asset() { $output .= t('asset edit'); print theme("page", $output ); } // Display the portfolio edit page function portfolio_edit() { $output .= t('aggiungo prima'); $output .= stock_list(); $output .= t('aggiungo dopo'); print theme("page", $output ); } // Display the portfolio add page function portfolio_add() { $output .= t( 'add' ); print theme("page", $output ); } // ttt function portfolio_ttt() { $output .= t( 'ttt' ); print theme("page", $output ); } // Display the delete portfolio page function portfolio_delete_screen() { $output .= t( 'tttt' ); print theme("page", $output ); } // Display the portfolio page function portfolio_overview() { $output .= t('aggiungo prima'); $output .= portfolio_list(); $output .= t('aggiungo dopo'); print theme('page', $output); } // Display the portfolio page function portfolio_page() { // $output .= t( 'ttttestststste' ); // print theme("page", $output ); $output .= portfolio_list(); print theme('page', $output); } ?>