Translations of this page:

Company Links (alias: Infobar, Corporate Links)

This component was designed to display content of company 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 company links. For the personal links see Personal Links (alias: My Infobar).

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

<?php
/**
 * A component to display Personal Links
 *
 * @author Julian Cohen [julian@claromentis.com]
 */
class TemplaterComponentCompanyLinks implements TemplaterComponent
{
    protected $html = NULL;
    protected $db = NULL;
 
    public function __construct()
    {
        global $db;
        $this->db = $db;
    }
 
    public function Show($attributes)
    {
        $query = 
            'SELECT name, link, new_window FROM infobar_menu, permissions WHERE ' .
            PermCheckAsSQL(PERM_CLASS_INFOBAR, "id", PERM_VIEW) . ' ' .
            'GROUP BY name, link, new_window, displayorder '.
            'ORDER BY displayorder';
        $result = $this->db->Query($query);
 
        if ($result->numRows() <= 0)
        {
            return;
        }
 
        $this->html .= '<ul>';
        while ($link = $result->fetchArray())
        {
            $this->html .= '<li>';
            $this->html .= '<a href="' . htmlspecialchars($link['link']) . '" ';
            if ($link['new_window'] > 0)
            {
                $this->html .= 'target="_blank"';
            }
            $this->html .= '>' . htmlspecialchars($link['name']) . '</a>';
            $this->html .= '</li>';
        }
        $this->html .= '</ul>';
            
        return $this->html;
    }
}
?>

2. Copy this file into

/intranet/common/classes/

3. Paste the following component code anywhere on templater file

<component class="TemplaterComponentCompanyLinks">

Suggested location:

/interface_{custom}/main/intranet_home.html  

or

/interface_{custom}/main/right_column.html
 
components/company_links.txt · Last modified: 07/06/2011 10:49 by sweta
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki