/** * Display the component. * * @return string */ function display() { if (!Portfolio::is_enabled()) { return ''; } $id = $this->id; $tool = $this->tool; $attributes = $this->attributes; $attributes['z-index'] = 100000; $s = ' '; foreach ($attributes as $key => $value) { $s .= $key . '="' . $value . '" '; } $result = array(); $result[] = '<span ' . $s . ' >'; $result[] = '<span class="dropdown" >'; $result[] = '<a href="#" data-toggle="dropdown" class="dropdown-toggle">'; $result[] = Display::return_icon('document_send.png', get_lang('Send'), array(), ICON_SIZE_SMALL) . '<b class="caret"></b>'; $result[] = '</a>'; $result[] = '<ul class="dropdown-menu">'; $portfolios = Portfolio::all(); foreach ($portfolios as $portfolio) { $parameters = Uri::course_params(); $parameters[PortfolioController::PARAM_ACTION] = PortfolioController::ACTION_SHARE; $parameters[PortfolioController::PARAM_CONTROLLER] = PortfolioController::NAME; $parameters[PortfolioController::PARAM_PORTFOLIO] = $portfolio->get_name(); $parameters[PortfolioController::PARAM_SECURITY_TOKEN] = self::security_token(); $parameters[PortfolioController::PARAM_TOOL] = $this->get_tool(); $parameters[PortfolioController::PARAM_ID] = $id; $parameters[PortfolioController::PARAM_TOOL] = $tool; $url = Chamilo::url('/main/portfolio/share.php', $parameters); $result[] = '<li>'; $result[] = '<a href="' . $url . '">' . $portfolio->get_title() . '</a>'; $result[] = '</li>'; } $result[] = '</ul>'; $result[] = '</span>'; $result[] = '</span>'; return implode("\n", $result); }