/**
 * Check whether component is active or not.
 *
 * @param string $comn Component id
 *
 * @return bool
 */
function com_is_active($comn)
{
    $com = new OssnComponents();
    if ($com->isActive($comn)) {
        return true;
    }
    return false;
}
/**
 *    OpenSource-SocialNetwork
 *
 * @package   (Informatikon.com).ossn
 * @author    OSSN Core Team <*****@*****.**>
 * @copyright 2014 iNFORMATIKON TECHNOLOGIES
 * @license   General Public Licence http://opensource-socialnetwork.com/licence
 * @link      http://www.opensource-socialnetwork.com/licence
 */
$OssnComs = new OssnComponents();
foreach ($OssnComs->getComponents() as $Com) {
    $Component = $OssnComs->getCom($Com);
    echo "<div class='ossn-components-item'>";
    echo "<div class='component-controls'>";
    if (!$OssnComs->isActive($Com)) {
        $enable = ossn_site_url("action/component/enable?com={$Com}", true);
        echo "<a href='{$enable}' class='components-button components-button-green'>" . ossn_print('admin:button:enable') . "</a>";
    } elseif (!in_array($Com, $OssnComs->requiredComponents())) {
        $disable = ossn_site_url("action/component/disable?com={$Com}", true);
        echo "<a href='{$disable}' class='components-button components-button-orange'>" . ossn_print('admin:button:disable') . "</a>";
    }
    if (in_array($Com, ossn_registered_com_panel())) {
        $configure = ossn_site_url("administrator/component/{$Com}", true);
        echo "<a href='{$configure}' class='components-button components-button-blue'>" . ossn_print('admin:button:configure') . "</a>";
    }
    if (!in_array($Com, $OssnComs->requiredComponents())) {
        $delete = ossn_site_url("action/component/delete?component={$Com}", true);
        echo "<a href='{$delete}' class='components-button components-button-red'>" . ossn_print('admin:button:delete') . "</a>";
    }
    echo "</div>";