Translations of this page:

Personal Links (alias: My Infobar)

This component was designed to display content of personal links outside the infobar area. This component is suitable for the interface design without the infobar or with infobar hidden by default.

This article will explain how to show personal links. For the company links see Company Links (alias: Infobar, Corporate Links).

1. Create file called TemplaterComponentPersonalLinks.php and paste in the following code.

<?php
/**
 * A component to display Personal Links
 *
 * @author Julian Cohen [julian@claromentis.com]
 */
 
require_once("../people/classes/InfobarPersonalLinksList.php");
 
class TemplaterComponentPersonalLinks extends TemplaterComponentTmpl
{
    public function Show($attributes)
    {
        if (!$_SESSION['SESSION_UID'])
            return '';
 
        $personal_links_list = new InfobarPersonalLinksList($_SESSION['SESSION_UID']);
        $personal_links = $personal_links_list->GetInfobarDatasource();
 
        $args['links.datasrc'] = $personal_links;
        return $this->CallTemplater('common/personal_links.html', $args);
    }
}
?>

2. Copy this file into

/intranet/common/classes/

3. Create the following HTML file

<ul name="links" datasrc="">
<li><a name="link" href=""></a></li>
</ul>
<a href="/intranet/people/my_infobar.php">edit my links</a>

4. Copy this to interface_{custom}/common/personal_links.html

5. Paste the following component code anywhere on templater file

<component class="TemplaterComponentPersonalLinks">

Suggested location:

/interface_{custom}/main/intranet_home.html  

or

/interface_{custom}/main/right_column.html

Problem with the code above, try use bottom code with no templater

<?php
/**
 * A component to display Personal Links
 *
 * @author Julian Cohen [julian@claromentis.com]
 */
 
require_once("../people/classes/InfobarPersonalLink.php");
require_once("../people/classes/InfobarPersonalLinksList.php");
 
class TemplaterComponentPersonalLinks implements TemplaterComponent
{
    protected $html = NULL;
 
    public function Show($attributes)
    {
        if (!$_SESSION['SESSION_UID'])
            return '';
 
        $personal_links_list = new InfobarPersonalLinksList($_SESSION['SESSION_UID']);
        $personal_links = $personal_links_list->GetInfobarDatasource();
 
 
        if (sizeof($personal_links) <= 0)
        {
            return '<ul><li><a href="/intranet/people/my_infobar.php">[+] edit my shortcuts</a></li></ul>';
        }
 
        $this->html .= '<ul>';
        foreach ($personal_links as $link)
        {
            $this->html .= '<li>';
            $this->html .= '<a href="' . htmlspecialchars($link['link.href']) . '" target="' . $link['link.target'] . ' ';
            $this->html .= '">' . htmlspecialchars($link['link.body']) . '</a>';
            $this->html .= '</li>';
        }
	 $this->html .= '<li><a href="/intranet/people/my_infobar.php">[+] edit my shortcuts</a></li>';
        $this->html .= '</ul>';
 
        return $this->html;
    }
 
}
?>
 
components/personal_links.txt · Last modified: 07/06/2011 10:49 by admin
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki