Source for file button-defs.php

Documentation is available at button-defs.php

  1. <?php
  2. /* ******************************************************************** */
  3. /* CATALYST PHP Source Code */
  4. /* -------------------------------------------------------------------- */
  5. /* This program is free software; you can redistribute it and/or modify */
  6. /* it under the terms of the GNU General Public License as published by */
  7. /* the Free Software Foundation; either version 2 of the License, or */
  8. /* (at your option) any later version. */
  9. /* */
  10. /* This program is distributed in the hope that it will be useful, */
  11. /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
  12. /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
  13. /* GNU General Public License for more details. */
  14. /* */
  15. /* You should have received a copy of the GNU General Public License */
  16. /* along with this program; if not, write to: */
  17. /* The Free Software Foundation, Inc., 59 Temple Place, Suite 330, */
  18. /* Boston, MA 02111-1307 USA */
  19. /* -------------------------------------------------------------------- */
  20. /* */
  21. /* Filename: button-defs.php */
  22. /* Author: Paul Waite */
  23. /* Description: Definitions for managing and using BUTTONS. */
  24. /* USING BUTTONS: */
  25. /* With these buttons, the 'onclick' parameter can be set */
  26. /* to STD_ONCLICK to use the buttons with the standard framework */
  27. /* of navigation provided with "nav-action.php". In this case */
  28. /* the "$action" parameter of the button is used to set "$nav_action" */
  29. /* and the "$parms" parameter is used to set "$nav_parms". */
  30. /* But mostly this feature will not be of interest as it was */
  31. /* developed for rugbylive. */
  32. /* */
  33. /* ******************************************************************** */
  34. /** @package buttons */
  35. include_once("image-defs.php");
  36.  
  37. // ----------------------------------------------------------------------
  38. /** This value is used with buttons. If specified in place of
  39. * the $onclick parameter when making a button, it will
  40. * format the default onclick call, which dovetails in
  41. * with our framework for navigating the site with calls
  42. * to "nav-action.php".
  43. */
  44. define("STD_ONCLICK", "STD_ONCLICK" );
  45.  
  46. /** Same as above, execpt we are indicating that we want the
  47. * action to be directed to a new window.
  48. */
  49. define("STD_ONCLICK_NEWWIN", "STD_ONCLICK_NEWWIN" );
  50.  
  51. // ----------------------------------------------------------------------
  52. /**
  53. * Virtual button_object
  54. * A standard button object for a form. This is a virtual class so we can
  55. * define a set of common functionality for descendants. Never
  56. * instantiate this class.
  57. * @access private
  58. * @package buttons
  59. */
  60. class button_object extends RenderableObject {
  61. /** Name of this button */
  62.  
  63. var $action;
  64. /** Label associated with the button */
  65.  
  66. var $label = "";
  67. /** Miscellaneous optional parameters */
  68.  
  69. var $parms = "";
  70. /** Button style string */
  71.  
  72. var $style = "";
  73. // ....................................................................
  74. /**
  75. * Constructor
  76. * Create a button object. Sets basic button attributes.
  77. * @param string $action The name of the form control
  78. * @param string $label The text label for std HTML buttons
  79. * @param string $parms Special parameter string (RugbyLive)
  80. * @param string $style Style setting to apply to the button
  81. */
  82. function button_object($action, $label="", $parms="", $style="") {
  83. $this->action = $action;
  84. $this->label = $label;
  85. $this->parms = $parms;
  86. $this->style = $style;
  87. }
  88. // ....................................................................
  89. /**
  90. * Sets the label for the button.
  91. * On a standard HTML button this will be displayed on the
  92. * top of the button. For buttons which use custom images, setting
  93. * this property has no effect.
  94. * @param string $label The text label to display on the button
  95. */
  96. function set_label($label) {
  97. $this->label = $label;
  98. }
  99. // ....................................................................
  100. /**
  101. * Sets parameter string associated with the button.
  102. *
  103. * This is useful only for the RugbyLive website, where a particular
  104. * button-clicking framework was implemented.
  105. * Sets the parameters associated with the button. This is only
  106. * useful if you are using the STD_ONCLICK behaviour in the
  107. * way used by the rugbyvu website.
  108. * @param string $parms The paramters to associate with the button
  109. * @access private
  110. */
  111. function setparms($parms) {
  112. $this->parms = $parms;
  113. }
  114. // ....................................................................
  115. /**
  116. * Sets button style
  117. *
  118. * @param string $style The style setting to apply to this button
  119. */
  120. function setstyle($style) {
  121. $this->style = $style;
  122. }
  123. } // button_object class
  124. // ----------------------------------------------------------------------
  125.  
  126. /**
  127. * A standard button for a form. Does nothing unless you define an
  128. * onclick event handler for it.
  129. * @package buttons
  130. */
  131. class button extends button_object {
  132. /** Script to be executed onclick */
  133.  
  134. var $onclick = "";
  135. /** Speed-key associated with button (ALT-<key>) */
  136.  
  137. var $accesskey = "";
  138. /** Confirmation text for onclick */
  139.  
  140. var $confirmation = "";
  141. // ....................................................................
  142. /**
  143. * Constructor
  144. * Create a button object. Sets basic button attributes.
  145. * @param string $action The name of the form control
  146. * @param string $label The text label for std HTML buttons
  147. * @param string $parms Special parameter string (RugbyLive)
  148. * @param string $onclick Javascript code to execute onclick
  149. * @param string $accesskey Speed-key to assoicate with button
  150. * @see button_object
  151. */
  152. function button($action, $label="", $parms="", $onclick="", $accesskey="") {
  153. $this->button_object($action, $label, $parms);
  154. $this->accesskey = $accesskey;
  155. $this->confirmation = "";
  156. $this->set_onclick($onclick);
  157. }
  158. // ....................................................................
  159. /**
  160. * Sets parameter string associated with the button.
  161. * Sets the onclick script to execute when the button is clicked.
  162. * @param string $onclick Javascript code to execute onclick
  163. */
  164. function set_onclick($onclick) {
  165. if ($onclick != "") {
  166. // Check if they want the standard onclick handler to be
  167. // invoked by this button. This assumes the relevant handler
  168. // is defined in the header. See "gen-header.php" (rugbyvu).
  169. if ($onclick == STD_ONCLICK) {
  170. $this->onclick = "";
  171. if ($this->confirmation != "") $this->onclick .= "btn_confirm('$this->confirmation'); ";
  172. $this->onclick .= "set_nav_parms('$this->parms'); btn_press('$this->action');";
  173. } else $this->onclick = $onclick;
  174. }
  175. else $this->onclick = "";
  176. return $this;
  177. }
  178. // ....................................................................
  179. /**
  180. * Sets parameter string associated with the button.
  181. * Sets the confirm text to use when this button is clicked. This is
  182. * a way of, for example, dealing with warnings for record delete.
  183. * NOTE: This is only applicable with the rugbyvu STD framework.
  184. * @param string $conf Confirmation text for Javascript popup
  185. */
  186. function set_confirmation($conf) {
  187. $this->confirmation = $conf;
  188. $this->set_onclick(STD_ONCLICK);
  189. return $this;
  190. }
  191. // ....................................................................
  192. /**
  193. * Use render() to render this element in your page.
  194. * Renders the button as HTML.
  195. * @see render()
  196. * @return string HTML rendering of button
  197. */
  198. function html() {
  199. $html = "<input name=\"$this->action\"";
  200. $html .= " type=button";
  201. if ($this->label != "") $html .= " value=\"$this->label\"";
  202. if ($this->onclick != "") $html .= " onclick=\"$this->onclick\"";
  203. if ($this->style != "") $html .= " style=\"$this->style\"";
  204. if ($this->accesskey != "") $html .= " accesskey=\"" . $this->accesskey . "\"";
  205. $html .= ">";
  206. return $html;
  207. }
  208. } // button class
  209. // ----------------------------------------------------------------------
  210.  
  211. /**
  212. * Image button.
  213. * A form elelement which behaves like a submit
  214. * button, but takes the form of the given image
  215. * @package buttons
  216. */
  217. class image_button extends button {
  218. /** Image object for this button */
  219.  
  220. var $img;
  221. /** Target URL for a window to open when button clicked */
  222.  
  223. var $target = "";
  224. /** Form element type ID */
  225.  
  226. var $type = "image";
  227. /** Title/tooltip */
  228.  
  229. var $title = "";
  230. /** Border size, pixels */
  231.  
  232. var $border = 0;
  233. /** Popup confirmation text to display on button click */
  234.  
  235. var $confirm_text = "";
  236. /** Whether to allow form submit on-click */
  237.  
  238. var $onclick_form_submit = false;
  239. // ....................................................................
  240. /**
  241. * Constructor
  242. * @param string $action The name of the button control in the form
  243. * @param string $label The label which might be attached to the button
  244. * @param string $parms Optional parameters
  245. * @param string $onclick Optional javascript for onclick event
  246. * @param string $src URL or path to image for the button
  247. * @param integer $width Button image width (px)
  248. * @param integer $height Button image height (px)
  249. * @param string $alt Button image alt tag content
  250. * @param string $border Size of border around image
  251. * @see button()
  252. */
  253. function image_button($action, $label="", $parms="", $onclick="", $src="", $width=0, $height=0, $alt="", $border=0) {
  254. // This is traditionally used as a title/tooltip string..
  255. $this->title = $alt;
  256. // Whereas really, alts should just show the button action..
  257. $alt = $action;
  258. $this->button($action, $label, $parms, $onclick);
  259. $this->img = new image($action, $src, $alt, $width, $height);
  260. $this->border = $border;
  261. }
  262. // ....................................................................
  263. /**
  264. * Sets the image to display for this button.
  265. * Usually these details are specified in the initial instantiation
  266. * @see image_button()
  267. * @param string $src URL or path to image for the button
  268. * @param integer $width Button image width (px)
  269. * @param integer $height Button image height (px)
  270. * @param string $alt Button image alt tag content
  271. * @param string $border Size of border around image
  272. */
  273. function set_image($src, $width=0, $height=0, $alt="", $border=0) {
  274. $this->img->src = $src;
  275. if ($width != 0) $this->img->width = $width;
  276. if ($height != 0) $this->img->height = $height;
  277. if ($alt != "") $this->img->alt = $alt;
  278. if ($alt != "") $this->img->alt = $alt;
  279. $this->border = $border;
  280. return $this;
  281. }
  282. // ....................................................................
  283. /**
  284. * Set the confirmation text to popup on click.
  285. * @param string $conf Tetx to display in the confirmation popup.
  286. */
  287. function set_confirm_text($conf) {
  288. $this->confirm_text = $conf;
  289. }
  290. // ....................................................................
  291. /**
  292. * Specific function for use with the rugbyvu framework. This causes
  293. * a button click to open another browser window as a popup.
  294. * @param string $target URL to fill window with
  295. * @param integer $win_width Width of new window (px)
  296. * @param integer $win_height Height of new window (px)
  297. */
  298. function set_window_target($target, $win_width=200, $win_height=200) {
  299. $this->target = $target;
  300. $this->onclick = " make_dialog('$this->target','$win_width','$win_height','$this->action','$this->parms');";
  301. return $this;
  302. }
  303. // ....................................................................
  304. /**
  305. * Use render() to render this element in your page.
  306. *
  307. * This renders the image button as HTML. If we have onclick then we render
  308. * this as a simple image with a javascript URL rather than a INPUT
  309. * form element of type "image". This is done to cope with Netscape's
  310. * lack of an onclick event handler for INPUT TYPE=IMAGE, and we
  311. * don't use BUTTON since that's only HTML4.
  312. * @see render()
  313. * @return string HTML rendering of button
  314. */
  315. function html($action="") {
  316. global $RESPONSE;
  317. $img = $this->img;
  318. // Lame Netscape doesn't support onclick, so use HREF surrogate..
  319. if ($this->onclick && isset($RESPONSE) && $RESPONSE->browser == BROWSER_NETSCAPE) {
  320. $html = "<a href=\"javascript:$this->onclick\"";
  321. if ($this->label != "") {
  322. $html .= " onmouseover=\"window.status='$this->label'; return true;\"";
  323. $html .= " onmouseout=\"window.status=''; return true;\"";
  324. }
  325. $html .= ">";
  326. $html .= "<img src=\"$img->src\"";
  327. if ($img->width) $html .= " width=\"$img->width\"";
  328. if ($img->height) $html .= " height=\"$img->height\"";
  329. $html .= " border=\"0\"";
  330. if ($img->alt) $html .= " alt=\"$img->alt\"";
  331. if ($this->title != "") $html .= " title=\"$this->title\"";
  332. $html .= "></a>";
  333. }
  334. else {
  335. // This will act as a submit button by default, and
  336. // will return its value with the form..
  337. if ($action != "") $this->action = $action;
  338. $html = "<input name=\"$this->action\"";
  339. $html .= " type=\"image\"";
  340. $html .= " src=\"$img->src\"";
  341. $html .= " border=\"$this->border\"";
  342. if ($img->alt) $html .= " alt=\"$img->alt\"";
  343. if ($this->title != "") $html .= " title=\"$this->title\"";
  344. if (!$this->onclick && $this->confirm_text != "") {
  345. $this->onclick="return confirm('$this->confirm_text');";
  346. }
  347. if ($this->onclick) {
  348. // Append return false if form submit not allowed..
  349. if (!$this->onclick_form_submit) {
  350. if ($this->onclick != "" && substr($this->onclick, -1) != ";") {
  351. $this->onclick .= ";";
  352. }
  353. $this->onclick .= "return false;";
  354. }
  355. $html .= " onclick=\"$this->onclick\"";
  356. }
  357. if ($this->label) $html .= " value=\"$this->label\"";
  358. if (!isset($RESPONSE) || $RESPONSE->browser != BROWSER_NETSCAPE) {
  359. if ($img->width) $this->style .= " width:" . $img->width . "px;";
  360. if ($img->height) $this->style .= " height:" . $img->height . "px;";
  361. }
  362. if ($this->style != "") $html .= " style=\"" . trim($this->style) . "\"";
  363. $html .= ">";
  364. }
  365. return $html;
  366. }
  367. } // image_button class
  368. // ----------------------------------------------------------------------
  369.  
  370. /**
  371. * Hover button.
  372. * Hover button. Uses the 'hover' class to implement a button which has a
  373. * an alternate rollover image, and will also implement our forms submission
  374. * action. Uses the "hover" class from the "image" module.
  375. * Here's how we might implement a hover button..
  376. * $hb = new hover_button("commentary", "Do commentary", "commentary", $onclick=STD_ONCLICK);
  377. * $hb->set_image("img/bCommentate.gif", 99, 23);
  378. * $hb->set_image_over("img/bCommentate_over.gif", 99, 23);
  379. * Then to display it: echo $hb->render();
  380. * @package buttons
  381. * @see button
  382. */
  383. class hover_button extends button {
  384. /** The hover image associated with the button */
  385.  
  386. var $hover;
  387. // ....................................................................
  388. /**
  389. * Constructor
  390. * @param string $action The name of the button control in the form
  391. * @param string $label The label which might be attached to the button
  392. * @param string $parms Optional parameters
  393. * @param string $onclick Optional javascript for onclick event
  394. * @see button()
  395. */
  396. function hover_button($action, $label="", $parms="", $onclick="") {
  397. $this->button($action, $label, $parms, $onclick);
  398. if ($this->onclick != "")
  399. $hover_url = "javascript:" . $this->onclick;
  400. else $hover_url = "";
  401. $this->hover = new hover($action, $hover_url, $label);
  402. }
  403. // ....................................................................
  404. /**
  405. * Sets button mouse-out image
  406. * Sets the standard image for this button. This is the image which
  407. * is shown with the mouse NOT over the top of it.
  408. * @see set_image_over()
  409. */
  410. function set_image($src, $width, $height, $border=0) {
  411. $this->hover = $this->hover->set_image($src, $width, $height, $border);
  412. }
  413. // ....................................................................
  414. /**
  415. * Sets button mouse-over image
  416. * Sets the mouse-over image for this button. This is the image which
  417. * is shown with the mouse over the top of it.
  418. * @see set_image()
  419. */
  420. function set_image_over($src, $width, $height, $border=0) {
  421. $this->hover = $this->hover->set_image_over($src, $width, $height, $border);
  422. }
  423. // ....................................................................
  424. /**
  425. * Use render() to render this element in your page.
  426. * Renders the hover button as HTML. In this case we simply render the
  427. * hover image which is associated with this button.
  428. * @see render(), hover_image()
  429. * @return string HTML rendering of button
  430. */
  431. function html() {
  432. return $this->hover->html();
  433. }
  434. } // hover_button class
  435. // ----------------------------------------------------------------------
  436.  
  437. /**
  438. * Submit button
  439. *
  440. * A standard form submit button appearing as the standard grey widget.
  441. * @package buttons
  442. * @see button
  443. */
  444. class submit_button extends button {
  445. /**
  446. * Constructor
  447. * @param string $action The name of the button control in the form
  448. * @param string $label The label which might be attached to the button
  449. * @param string $parms Optional parameters
  450. * @param string $onclick Optional javascript for onclick event
  451. * @see button()
  452. */
  453. function submit_button($action, $label="", $parms="", $onclick="") {
  454. $this->button($action, $label, $parms, $onclick);
  455. }
  456. // ....................................................................
  457. /**
  458. * Use render() to render this element in your page.
  459. * Renders the submit button as HTML.
  460. * @see render()
  461. * @return string HTML rendering of button
  462. */
  463. function html() {
  464. $html = "<input name=\"$this->action\" type=submit";
  465. if ($this->label) $html .= " value=\"$this->label\"";
  466. if ($this->onclick) $html .= " onclick=\"$this->onclick\"";
  467. if ($this->style != "") $html .= " style=\"$this->style\"";
  468. $html .= ">";
  469. return $html;
  470. }
  471. } // submit_button class
  472. // ----------------------------------------------------------------------
  473.  
  474. /**
  475. * Reset button
  476. * A standard form reset button appearing as the standard grey widget.
  477. * @package buttons
  478. * @see button
  479. */
  480. class reset_button extends button {
  481. /**
  482. * Constructor
  483. * @param string $action The name of the button control in the form
  484. * @param string $label The label which might be attached to the button
  485. * @param string $parms Optional parameters
  486. * @param string $onclick Optional javascript for onclick event
  487. * @see button()
  488. */
  489. function reset_button($action, $label="", $parms="", $onclick="") {
  490. $this->button($action, $label, $parms, $onclick);
  491. }
  492. // ....................................................................
  493. /**
  494. * Use render() to render this element in your page.
  495. *
  496. * Renders the reset button as HTML.
  497. * @see render()
  498. * @return string HTML rendering of button
  499. */
  500. function html() {
  501. $html = "<input name=\"$this->action\" type=reset>";
  502. if ($this->label) $html .= " value=\"$this->label\"";
  503. if ($this->onclick) $html .= " onclick=\"$this->onclick\"";
  504. if ($this->style != "") $html .= " style=\"$this->style\"";
  505. return $html;
  506. }
  507. } // reset_button class
  508. // ----------------------------------------------------------------------
  509.  
  510. /**
  511. * Clickable link
  512. * A standard clickable link. This class incorporates a few useful
  513. * features over and above the standard <A> tag functionality. You can
  514. * define linkover text to appear in the browser status bar when the
  515. * mouse moves over the link, and the object can be rendered as
  516. * either HTML or WML.
  517. * @package buttons
  518. */
  519. class Link extends RenderableObject {
  520. /** The URL to go to when link is clicked */
  521.  
  522. var $href = "";
  523. /** The label to display for the link */
  524.  
  525. var $label = "";
  526. /** Target frame for the URL */
  527.  
  528. var $target = "";
  529. /** Script to execute on mouse over */
  530.  
  531. var $onmouseover = "";
  532. /** Script to execute on mouse out */
  533.  
  534. var $onmouseout = "";
  535. /** Font settings for link text */
  536.  
  537. var $font = "";
  538. /** Status bar text when link moused over */
  539.  
  540. var $linkover_text = "";
  541. /** Stylesheet class name for highlighted link */
  542.  
  543. var $highlightclass = false;
  544. /** Style to apply to the link text */
  545.  
  546. var $style = "";
  547. /**
  548. * Constructor
  549. * @param string $href The URL to go to when clicked
  550. * @param string $label The text to display for the link
  551. * @param string $onmouseover Javascript to execute on mouse-over
  552. * @param string $onmouseout Javascript to execute on mouse-out
  553. * @param string $font Font settings
  554. * @param string $target Target frame eg: '_blank', 'myframe' etc.
  555. */
  556. function Link($href, $label="", $onmouseover="", $onmouseout="", $font="", $target="") {
  557. $this->href = $href;
  558. $this->label = $label;
  559. $this->target = $target;
  560. $this->onmouseover = $onmouseover;
  561. $this->onmouseout = $onmouseout;
  562. $this->font = $font;
  563. }
  564. // ....................................................................
  565. /**
  566. * Sets the font
  567. * Deprecated. Sets the font to use with the link text. Better
  568. * to use a stylesheet these days.
  569. */
  570. function set_font($font) {
  571. $this->font = $font;
  572. }
  573. // ....................................................................
  574. /**
  575. * Sets the URL
  576. * Sets the URL to go to when the link is clicked. usually this
  577. * is specified on instantiation.
  578. * @see Link()
  579. */
  580. function set_href($href) {
  581. $this->href = $href;
  582. }
  583. // ....................................................................
  584. /**
  585. * Sets the style
  586. * Sets the style for the href tag.
  587. */
  588. function setstyle($style) {
  589. $this->style = $style;
  590. }
  591. // ....................................................................
  592. /**
  593. * Defines special highlight class name
  594. * Defines the name of a class in your stylesheet to use for the
  595. * purpose of highlighting. This property is initialised to be
  596. * 'false', but if defined, then the link is spanned by a <span>
  597. * tag with the given class name to highlight it accordingly.
  598. */
  599. function highlight($highlightclass) {
  600. $this->highlightclass = $highlightclass;
  601. }
  602. // ....................................................................
  603. /**
  604. * Set status text to show on mouseover
  605. * Will do a mouseover status message, if onmouseover is not already
  606. * defined, otherwise it will be ignored. This is useful to avoid
  607. * long and ugly URL's appearing in the status bar.
  608. */
  609. function set_linkover_text($txt) {
  610. $this->linkover_text = $txt;
  611. }
  612. // ....................................................................
  613. /**
  614. * Renders the reset button as WML.
  615. * @see render()
  616. * @return string WML rendering of button
  617. */
  618. function wml() {
  619. if (function_exists("href_rewrite")) {
  620. $this->href = href_rewrite($this->href);
  621. }
  622. return "<a href=\"" . $this->href . "\">" . $this->label . "</a>";
  623. }
  624. // ....................................................................
  625. /**
  626. * Use render() to render this element in your page.
  627. *
  628. * Renders the reset button as HTML.
  629. * @see render()
  630. * @return string HTML rendering of button
  631. */
  632. function html() {
  633. $html = "";
  634. if ($this->highlightclass != "") $html .= "<span class=$this->highlightclass>";
  635. $html .= "<a href=\"" . $this->href . "\"";
  636. if (isset($this->style) && $this->style != "") $html .= " style=\"$this->style\"";
  637. if ($this->target != "") $html .= " target=\"$this->target\"";
  638. if ($this->linkover_text != "" && $this->onmouseover == "") {
  639. $this->onmouseover = "status='$this->linkover_text';return true;";
  640. $this->onmouseout = "status='';return true;";
  641. }
  642. if ($this->onmouseover != "") $html .= " onmouseover=\"" . $this->onmouseover . "\"";
  643. if ($this->onmouseout != "") $html .= " onmouseout=\"" . $this->onmouseout . "\"";
  644. $html .= ">";
  645. if ($this->font != "") $html .= "<font " . $this->font . ">";
  646. $html .= $this->label;
  647. if ($this->font != "") $html .= "</font>";
  648. $html .= "</a>";
  649. if ($this->highlightclass != "") $html .= "</span>";
  650. return $html;
  651. }
  652. } // Link
  653. // ----------------------------------------------------------------------
  654.  
  655. /**
  656. * RugbyLive Action link
  657. *
  658. * Note: this class is only of use for the RugbyLive framework.
  659. * A clickable link, which is dedicated to our 'nav_action' methodology
  660. * of routing the user to the appropriate page as used in rugbyvu.
  661. * @access private
  662. * @package buttons
  663. */
  664. class action_link extends RenderableObject {
  665. /** The label to display for the link */
  666.  
  667. var $label = "";
  668. /** Nav Action parameter string */
  669.  
  670. var $parms = "";
  671. /** Font settings for link text */
  672.  
  673. var $font = "";
  674. /** Nav Action action string */
  675.  
  676. var $action = "";
  677. /** Status bar text when link moused over */
  678.  
  679. var $linkover_text = "";
  680. /**
  681. * Constructor
  682. * @param string $action The nav-action action to perform
  683. * @param string $label The text to display for the link
  684. * @param string $parms The parameter string to sned with the action
  685. * @param string $font Font settings to use with label
  686. * @param string $linkover_text Text to show in status bar on mouseover
  687. */
  688. function action_link($action, $label="", $parms="", $font="", $linkover_text="") {
  689. $this->action = $action;
  690. $this->label = $label;
  691. $this->parms = $parms;
  692. $this->font = $font;
  693. if ($linkover_text == "") $this->linkover_text = $label;
  694. else $this->linkover_text = $linkover_text;
  695. }
  696. // ....................................................................
  697. /**
  698. * Sets the font
  699. * Deprecated. Sets the font to use with the link text. Better
  700. * to use a stylesheet these days.
  701. */
  702. function set_font($font) {
  703. $this->font = $font;
  704. return $this;$this->pagetext .= " " . $pglink->wml();
  705. }
  706. // ....................................................................
  707. /**
  708. * Use render() to render this element in your page.
  709. * Renders the reset button as WML.
  710. * @see render()
  711. * @return string WML rendering of button
  712. */
  713. function wml() {
  714. $href = "nav_action.php?action=" . $this->action . "&amp;" . "parms=" . $this->parms;
  715. $link = new Link($href, $this->label);
  716. return $link->wml();
  717. }
  718. // ....................................................................
  719. /**
  720. * Use render() to render this element in your page.
  721. * Renders the reset button as HTML.
  722. * @see render()
  723. * @return string HTML rendering of button
  724. */
  725. function html() {
  726. $href = "javascript:set_nav_parms('" . $this->parms . "'); btn_press('" . $this->action . "');";
  727. $link = new Link($href, $this->label, "", "", $this->font);
  728. $link->set_linkover_text($this->linkover_text);
  729. return $link->html();
  730. }
  731. } // action_link class
  732. // ----------------------------------------------------------------------
  733.  
  734. ?>

Documentation generated by phpDocumentor 1.3.0RC3