Improve this Doc

Simple Usable Views

Agile Toolkit has many objects which you as developer can use out of the box. This chapter will focus on listing the most simple views.

Headers

The following classes can be used to easily emulate markup of headings. All of those objects are extended from View, so you should remember to call View::set.

class H1

Creates H1 header object

class H2

Creates H2 header object

Boxes

Box represents an outlined text.

class View_Box

Outlined text

class View_Info

Info box

class View_Warning

Warning box

class View_Error

Error box

class View_Hint

Box containing a hint

Icons

class View_Icon

Will display icon without text. Use set() to set name of the icon. See http://css.agiletoolkit.org/ for a list of usable icons.

Buttons and ButtonSets

Agile Toolkit since 4.3 no longer uses jQuery UI buttons. Instead the atk-button is used for a <div>. (See /css/buttons)

Button directly extends View and retains it’s methods such as View::addClass or View::addComponents.

Button also inherits a JavaScipt binding techniques: AbstractView::js and AbstractView::on for custom actions.

class Button

Implements a UI Button.

Uses <a> markup for a button and creates a non-javascript link to a page. Supports URL Array hash.

Button::addPopOver()

Adds pop-over to a button, a sort of fall-out menu. Returns Popover object.

Button::setIcon()

Adds icon inside a button.

Button::addSplitButton()

Splits button into 2 parts. Visually this appears as two buttons, one which would perform an action, and other one wich would display some additional options.

WARNING: migth be refactored into a separate class.

Button::addMenu()

Similar to pop-over but will link button with vertical menu. Returns Menu_Vertical.

Button::isClicked()

Creates a binding on a button which will call back to original page. The method will return false, initially, but when a callback is used, will return true.

You must execute a JavaScript PHP Chains at the end of your code.

Button::onClick($callback)

Similar to isClicked, but will execute a callback code. You can return a JavaScript Chais, but if you don’t a default JS action will be executed saying “Success”

A second argument to this method could be a confirmation message which will appear before callback being triggered.

Callback will receive two arguments. 1. The button object. 2. POST data which would be comming form $('button').data(). See Documentation on ajaxec(url, data, fn).

Callback can also return string which will be considered to be a success message.

class View_ButtonSet

This class is a container for buttons, so that they appear visually grouped.

View_ButtonSet::addButton()

Adds a new button into set.