예제 #1
0
 public static function panelLink($fly_out = false)
 {
     Layout::addStyle('controlpanel', 'panel_link.css');
     $reg_link = PHPWS_Text::quickLink(dgettext('controlpanel', 'Control Panel'), 'controlpanel', array('command' => 'panel_view'));
     if (!$fly_out) {
         return $reg_link->get();
     }
     javascript('jquery');
     javascriptMod('controlpanel', 'subpanel');
     $reg_link->setId('cp-panel-link');
     $all_tabs = PHPWS_ControlPanel::loadTabs();
     $all_links = PHPWS_ControlPanel::getAllLinks(true);
     $tpl = new PHPWS_Template('controlpanel');
     $tpl->setFile('subpanel.tpl');
     $authkey = Current_User::getAuthKey();
     if (!empty($all_links)) {
         foreach ($all_links as $tab => $links) {
             foreach ($links as $link) {
                 $tpl->setCurrentBlock('links');
                 $tpl->setData(array('LINK' => sprintf('<a href="%s&amp;authkey=%s">%s</a>', $link->url, $authkey, str_replace(' ', '&#160;', $link->label))));
                 $tpl->parseCurrentBlock();
             }
             $tab_link = $all_tabs[$tab]->link . '&amp;tab=' . $all_tabs[$tab]->id;
             $tpl->setCurrentBlock('tab');
             $tpl->setData(array('TAB_TITLE' => sprintf('<a href="%s">%s</a>', $tab_link, $all_tabs[$tab]->title)));
             $tpl->parseCurrentBlock();
         }
     }
     $tpl->setCurrentBlock();
     $tpl->setData(array('CP_LINK' => $reg_link->get()));
     $tpl->parseCurrentBlock();
     $submenu = $tpl->get();
     return $submenu;
 }