Mod_edit

This module allows you to build a very user friendly management environment for a website in Ariadne without much effort. A user can browse an ariadne website just like any normal visitor. To edit a page he or she just types user.edit.html at the end of the current URL, and a WYSIWYG editor starts with the current page in its normal layout, but each data field is now editable.

You can read more about how to use this module in the tutorial: Using mod_edit

Methods

(bool) getEditMode Returns true when in editmode.
(string) getEditTemplate Returns the name of the edit template, default is 'user.edit.page.html'.
(string) getEditTarget Returns the name of the editor frame.
(bool) isEmpty Returns true if the field is empty of text, images, flash and other visible objects.
(int) registerDataField Registers an editable field to the edit component.
(void) registerGroup Allows you to group different fields together. When one of these fields is saved, the rest is also saved.
(void) setEditMode Enable editmode.
(int) showCheckBox Adds a checkbox.
(int) showDiv Adds an editable div field.
(int) showEditableLink Adds an editable link. Double click to follow the link.
(int) showHref Adds the correct href="" attribute for links or forms.
(int) showInput Adds an input field.
(int) showInputText Adds a text input field.
(int) showSelect Adds a select field.
(int) showSpan Adds an editable span.
(int) showUrl Adds the correct url for links or forms.

getEditMode

getEditMode()

returns true when in editmode, false otherwise.

getEditTemplate

getEditTemplate()

returns the template set with setEditMode(). 

getEditTarget

getEditTarget()

Returns the target set with setEditMode().

isEmpty

isEmpty($var) 

This method returns true if the variable doesn't contain text, images, object, embed or forms.

registerDataField

registerDataField($name) 

This method registers an editable field with name $name. It returns the field id for this data field.

registerGroup

registerGroup($name, $id) 

Allows you to group different fields together. When one of these fields is saved, the rest is also saved. $name is the name of the group. $id is the field id of an editable field. Field id's are generated by most show* methods and by registerDataField. 

setEditMode

setEditMode($mode=false, $template='user.edit.html', $target='_top')

Toggles edit mode on or off, and sets the template and target to use in links when in editmode.

showCheckbox

showCheckbox($checked, $name, $title, $extra='', $group='') 

Shows a checkbox. If $checked is true the checkbox is checked. $name is the name of the checkbox, $title is set as the title attribute. $extra may contain extra attributes for the checkbox. $group is a name for a group of checkboxes. This automatically registers these checkboxes as a group in the editor. This way when one of the checkboxes changes, all checkbox values are saved.

showDiv

showDiv($var, $name, $title='', $extra='')

Shows an editable field in the form of a DIV element.

showEditableLink

showEditableLink($path='', $extra='', $url=false)

Shows a link to an internal path. When in the editor double clicking on the link will open the new page in the editor. In combination with showSpan or showInput this allows you to still edit the text of the link. The $url parameter is an optional url to use when not in the editor.

showHref

showHref($path='', $extra='')

This method just echoes the href="" and a target="" part of a link, allowing special link styles. 

showInput

showInput($var, $name, $title, $type='text', $extra='')

Shows an editable field,  in the form of an input element, the type depends on $type, e.g. 'radio','checkbox', etc. See showInputText for the other arguments. 

showInputText

showInputText($var, $name, $title='', $extra='')

Shows an editable field, in the form of a text input element, with $var as content, $name as name, and optional title $title. In addition you can add extra parameters through the $extra variable. $extra should have a form like this: 'attribute="value"'.

showLink

showLink($path='', $extra='')

Shows a link to an internal path. In the editor the link will automatically start the editor in the new page. 

showSelect

showSelect($var, $name, $title, $list, $bykey=false, $extra='')

Shows a select list, with the items in the array $list. If $bykey is true, then the keys of the array will be used as the value for the options. If $var is available in $list, the corresponding option will be selected.

showSpan

showSpan($var, $name, $title='', $extra='')

Shows an editable field in the form of a span element.

showUrl

showUrl($path='')

This method just echoes the correct URL for an internal path. In editmode this includes the correct template to start the editor.