예제 #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;
 }
예제 #2
0
 /**
  * Creates a css-styled link button for phpWebSite modules.
  *
  * For local links ONLY. It adds the hub web address and index.php automatically.
  * You supply the name of the module and the variables.
  * CSS class "button" controls the display features of this link.
  * An additional set of <span> tags is added to the HTML so that different button styles can be acheived.
  * http://www.onextrapixel.com/2009/04/24/5-different-tutorials-of-creating-dynamic-css-round-corners-link-buttons/
  *
  *
  * ex: $vars = array('op' => 'create_topic', 'forum' => $this->id);
  * ex: $str = dgettext('phpwsbb', 'Submit a new topic');
  * ex: $result = PHPWS_Text::moduleButton($str, 'phpwsbb', $vars);
  * ex: <a href="index.php?module=phpwsbb&amp;op=create_topic&amp;forum=15" title="Submit a new topic" class="phpws_button"><span>Submit a new topic</span></a>
  *
  * For customization of a specific button, specify a CSS class name.
  *
  * @author Eloi George <eloi at bygeorgeware dot com>
  * @param string subject String to appear as the 'click on' word(s)
  * @param string module Name of module to access
  * @param array getVars Associative array of GET variable to append to the link
  * @param string target The target attribute of the link.
  * @param string title The title attribute (alt-text) of the link.
  * @param string class_name String added to css class
  * @return string The complated link button HTML.
  */
 public static function moduleButton($subject, $module = null, $getVars = null, $target = null, $title = null, $class_name = null)
 {
     if (empty($title)) {
         $title = $subject;
     }
     $subject = '<span>' . $subject . '</span>';
     $class_name = trim('phpws_button ' . $class_name);
     $link = PHPWS_Text::quickLink($subject, $module, $getVars, $target, $title, $class_name);
     return $link->get();
 }