/** * Action methods */ public function index() { switch ($_REQUEST['evento']) { case 'cedola': $events = $this->get_cedole(); break; case 'dividendo': $events = $this->get_dividendi(); break; case 'rimborso': $events = $this->get_rimborsi(); break; default: if (isset($_REQUEST['isin']) && isset($_REQUEST['use_helper'])) { $this->roi = PortfolioHelper::roi_with_timeline($_REQUEST['isin'], $_COOKIE['username'], $_REQUEST['month-from'], $_REQUEST['month-to']); $events = $this->roi->payments; $this->investito = $this->roi->investito; $this->totale = $this->roi->totale; $this->plusminus = $this->roi->plusminus; } else { $events = array_merge($this->get_cedole(), $this->get_rimborsi(), $this->get_dividendi()); $this->investito = 0; $this->plusminus = 0; foreach ($events as $event) { $investito = $event->portfolio_stock->prezzo * $event->quantita / 100; $investito = Change::convert($investito, $event->stock->divisa); if ($event->tipo == 'rimborso') { $this->investito += $investito; } $plusminus = $event->importo_eur() - $investito; $this->plusminus += $plusminus; } } } $this->payments($events); $this->render(array('action' => 'payments')); }
<?php /* * check if the URL matches /portfolio/<slug> and if the slug is a real project * if it is we render the detail page */ if (isset($_SERVER['REQUEST_URI']) && preg_match('#^/portfolio/(.*)$#', $_SERVER['REQUEST_URI'], $matches) && ($slug = $matches[1]) && ($project = PortfolioHelper::getProject($slug))) { // if we have a full page_tpl then use it if (isset($project['page_tpl'])) { return render($project['page_tpl'], array('project' => $project)); } // if we didn't have a full page_tpl then render a default project page, try using a content_tpl return render('project', array('project' => $project, 'content' => isset($project['content_tpl']) ? render($project['content_tpl'], array('project' => $project)) : null)); } // render overview page if we didn't render detail page return render('portfolio', array('projects' => PortfolioHelper::getAllProjects()));
echo $i == 0 ? 'active' : ''; ?> " src="<?php echo asset(PortfolioHelper::getLargeImage($img)); ?> " /> <?php } ?> </div> <div class="nav_area"> <?php foreach ($project['images'] as $i => $img) { ?> <a href="#carousel_show_<?php echo PortfolioHelper::getImageId($img); ?> " class="span <?php echo $i == 0 ? 'active' : ''; ?> "> <img width="130" height="82" src="<?php echo asset($img); ?> " /> <div class="mask"></div> </a> <?php } ?> </div>