Overview

Packages

  • Auth
    • Ads
    • Ldap
    • Xoops
  • Autotasks
  • Config
    • Category
    • Item
    • Option
  • Core
    • Filesystem
    • Filters
    • Logger
    • Mail
    • Message
    • Password
    • Security
    • StopSpammer
    • Template
    • Textsanitizer
    • VersionChecker
  • Data
    • Avatar
    • Comment
  • Database
    • Connection
    • Criteria
    • Legacy
    • MySQL
    • PDO
    • Updater
  • Feeds
    • RSS
  • File
  • Form
    • Base
    • Elements
  • ICMS
    • IPF
      • View
  • Image
    • Category
  • Ipf
    • Category
    • Controller
    • Export
    • form
    • Keyhighlighter
    • Member
    • Object
    • Permission
    • richfile
    • Tree
    • urllink
    • View
  • kernel
    • Set
  • Member
    • Group
    • GroupMembership
    • GroupPermission
    • User
  • Messaging
  • Module
  • None
  • Notification
  • Page
  • Plugins
    • Editor
  • Preload
    • Libraries
  • Privmessage
  • Session
  • SmartObject
  • View
    • Block
    • Breadcrumb
    • PageNav
    • PrinterFriendly
    • Template
    • Templates
    • Theme
    • Tree

Classes

  • icms_data_file_Object
  • icms_data_urllink_Object
  • icms_ipf_Object
  • icms_ipf_registry_Handler
  • icms_ipf_seo_Object
  • Overview
  • Package
  • Class

Class icms_ipf_Object

icms_ipf_Object base class

Base class representing a single icms_ipf_Object

icms_core_Object
Extended by icms_ipf_Object

Direct known subclasses

icms_data_file_Object, icms_data_page_Object, icms_data_urllink_Object, icms_ipf_seo_Object, icms_view_block_Object, icms_view_block_position_Object

Indirect known subclasses

icms_ipf_category_Object
Package: Ipf\Object
Category: ICMS
Copyright: The ImpressCMS Project http://www.impresscms.org/
License: GNU General Public License (GPL)
Author: marcan marcan@smartfactory.ca
Located at ipf/Object.php
Methods summary
public
# __construct( & $handler )

constructor

constructor

normally, this is called from child classes only

Overrides

icms_core_Object::__construct()
public
# IcmsPersistableObject( & $handler )

For backward compat

For backward compat

public boolean
# accessGranted( string $perm_name )

Checks if the user has a specific access on this object

Checks if the user has a specific access on this object

Parameters

$perm_name
$gperm_name name of the permission to test

Returns

boolean
: TRUE if user has access, false if not
public
# openFormSection( str $section_name, boolean $value = FALSE )

open a new form section to seperate form elements

open a new form section to seperate form elements

Parameters

$section_name
$value
public
# closeFormSection( str $section_name )

close a form section

close a form section

Parameters

$section_name
public
# initVar( string $key, integer $data_type, mixed $value = null, boolean $required = false, integer $maxlength = null, string $options = '', boolean $multilingual = false, string $form_caption = '', string $form_dsc = '', boolean $sortby = false, boolean $persistent = true, boolean $displayOnForm = true )

Parameters

$key
key of this field. This needs to be the name of the field in the related database table
$data_type
set to one of XOBJ_DTYPE_XXX constants (set to XOBJ_DTYPE_OTHER if no data type ckecking nor text sanitizing is required)
$value
default value of this variable
$required
set to TRUE if this variable needs to have a value set before storing the object in the table
$maxlength
maximum length of this variable, for XOBJ_DTYPE_TXTBOX type only
$options
does this data have any select options?
$multilingual
is this field needs to support multilingual features (NOT YET IMPLEMENTED...)
$form_caption
caption of this variable in a icms_ipf_form_Base and title of a column in a icms_ipf_ObjectTable
$form_dsc
description of this variable in a icms_ipf_form_Base
$sortby
set to TRUE to make this field used to sort objects in icms_ipf_ObjectTable
$persistent
set to FALSE if this field is not to be saved in the database
$displayOnForm
to be displayed on the form or not

Overrides

icms_core_Object::initVar()
public
# initNonPersistableVar( $key, $data_type, str $itemName = false, str $form_caption = '', $sortby = false, $value = '', boolean $displayOnForm = false, boolean $required = false )

Parameters

$key
$data_type
$itemName
$form_caption
$sortby
$value
$displayOnForm
$required
public
# quickInitVar( string $key, integer $data_type, boolean $required = false, string $form_caption = '', string $form_dsc = '', mixed $value = null )

Quickly initiate a var

Quickly initiate a var

Since many vars do have the same config, let's use this method with some of these configuration as a convention ;-)

  • $maxlength = 0 unless $data_type is a TEXTBOX, then $maxlength will be 255
  • all other vars are NULL or '' depending of the parameter

Parameters

$key
key of this field. This needs to be the name of the field in the related database table
$data_type
set to one of XOBJ_DTYPE_XXX constants (set to XOBJ_DTYPE_OTHER if no data type ckecking nor text sanitizing is required)
$required
set to TRUE if this variable needs to have a value set before storing the object in the table
$form_caption
caption of this variable in a icms_ipf_form_Base and title of a column in a icms_ipf_ObjectTable
$form_dsc
description of this variable in a icms_ipf_form_Base
$value
default value of this variable
public
# initCommonVar( str $varname, boolean $displayOnForm = true, str $default = 'notdefined' )

Parameters

$varname
$displayOnForm
$default
public
# setControl( string $var, array $options = array() )

Set control information for an instance variable

Set control information for an instance variable

The $options parameter can be a string or an array. Using a string is the quickest way :

$this->setControl('date', 'datetime');

This will create a date and time selectbox for the 'date' var on the form to edit or create this item.

Here are the currently supported controls :

  • color
  • country
  • datetime
  • date
  • email
  • group
  • group_multi
  • image
  • imageupload
  • label
  • language
  • parentcategory
  • password
  • selectmulti
  • select
  • text
  • textarea
  • theme
  • theme_multi
  • timezone
  • user
  • user_multi
  • yesno

Now, using an array as $options, you can customize what information to use in the control. For example, if one needs to display a select box for the user to choose the status of an item. We only need to tell icms_ipf_Object what method to execute within what handler to retreive the options of the selectbox.

$this->setControl('status', array('name' => false, 'itemHandler' => 'item', 'method' => 'getStatus', 'module' => 'smartshop'));

In this example, the array elements are the following : - name : false, as we don't need to set a special control here. we will use the default control related to the object type (defined in initVar) - itemHandler : name of the object for which we will use the handler - method : name of the method of this handler that we will execute - module : name of the module from wich the handler is

So in this example, icms_ipf_Object will create a selectbox for the variable 'status' and it will populate this selectbox with the result from SmartshopItemHandler::getStatus()

Another example of the use of $options as an array is for TextArea :

$this->setControl('body', array('name' => 'textarea', 'form_editor' => 'default'));

In this example, icms_ipf_Object will create a TextArea for the variable 'body'. And it will use the 'default' editor, providing it is defined in the module preferences : $icmsModuleConfig['default_editor']

Of course, you can force the use of a specific editor :

$this->setControl('body', array('name' => 'textarea', 'form_editor' => 'koivi'));

Here is a list of supported editor : - tiny : TinyEditor - dhtmltextarea : ImpressCMS DHTML Area - fckeditor : FCKEditor - inbetween : InBetween - koivi : Koivi - spaw : Spaw WYSIWYG Editor - htmlarea : HTMLArea - textarea : basic textarea with no options

Parameters

$var
name of the variable for which we want to set a control
$options
public
# getControl( string $var )

Get control information for an instance variable

Get control information for an instance variable

Parameters

$var
public a
# getForm( $form_caption, $form_name, $form_action = false, $submit_button_caption = _CO_ICMS_SUBMIT, $cancel_js_action = false, $captcha = false )

Create the form for this object

Create the form for this object

Returns

a
SmartobjectForm object for this object

See

icms_ipf_ObjectForm::icms_ipf_ObjectForm()
public a
# getSecureForm( $form_caption, $form_name, $form_action = false, $submit_button_caption = _CO_ICMS_SUBMIT, $cancel_js_action = false, $captcha = false )

Create the secure form for this object

Create the secure form for this object

Returns

a
icms_ipf_form_Secure object for this object

See

icms_ipf_ObjectForm::icms_ipf_ObjectForm()
public
# toArray( )
public
# setErrors( string $err_str, $prefix = false )

add an error

add an error

Parameters

$err_str
$value error to add
$prefix

Overrides

icms_core_Object::setErrors()
public
# setFieldAsRequired( $field, $required = true )

Parameters

$field
$required
public
# setFieldForSorting( $field )

Parameters

$field
public
# hasError( )
public
# setImageDir( $url, $path )

Parameters

$url
$path
public string
# getGroupPerm( $group_perm )

Retreive the group that have been granted access to a specific permission for this object

Retreive the group that have been granted access to a specific permission for this object

Returns

string
$group_perm name of the permission
public
# getImageDir( $path = false )

Parameters

$path
public
# getUploadDir( str $path = false )

Parameters

$path
public
# getVarInfo( str $key = '', str $info = '' )

Parameters

$key
$info
public integer
# id( )

Get the id of the object

Get the id of the object

Returns

integer
id of this object
public string
# title( $format = 's' )

Return the value of the title field of this object

Return the value of the title field of this object

Returns

string
public string
# summary( )

Return the value of the title field of this object

Return the value of the title field of this object

Returns

string
public string
# getAdminViewItemLink( boolean $onlyUrl = false )

Retreive the object admin side link, displayijng a SingleView page

Retreive the object admin side link, displayijng a SingleView page

Parameters

$onlyUrl
wether or not to return a simple URL or a full link

Returns

string
user side link to the object
public string
# getItemLink( boolean $onlyUrl = false )

Retreive the object user side link

Retreive the object user side link

Parameters

$onlyUrl
wether or not to return a simple URL or a full link

Returns

string
user side link to the object
public
# getViewItemLink( $onlyUrl = false, $withimage = true, $userSide = false )

Parameters

$onlyUrl
$withimage
$userSide
public
# getEditItemLink( boolean $onlyUrl = false, boolean $withimage = true, boolean $userSide = false )

Parameters

$onlyUrl
$withimage
$userSide
public
# getDeleteItemLink( boolean $onlyUrl = false, boolean $withimage = false, boolean $userSide = false )

Parameters

$onlyUrl
$withimage
$userSide
public
# getPrintAndMailLink( )
public
# getFieldsForSorting( $sortsel )

Parameters

$sortsel
public
# setType( $key, $newType )

Parameters

$key
$newType
public
# setVarInfo( unknown_type $key, unknown_type $info, unknown_type $value )

Parameters

$key
$info
$value
public boolean
# store( boolean $force = false )

store object

store object

Parameters

$force

Returns

boolean
true if successful, false if not
public
# getValueFor( unknown_type $key, unknown_type $editor = true )

Parameters

$key
$editor
public mixed
# getVar( string $key, string $format = 's' )

returns a specific variable for the object in a proper format

returns a specific variable for the object in a proper format

We had to put this method in the icms_ipf_Object because the XOBJ_DTYPE_ARRAY does not work properly at least on PHP 5.1. So we have created a new type XOBJ_DTYPE_SIMPLE_ARRAY to handle 1 level array as a string separated by |

Parameters

$key
key of the object's variable to be returned
$format
format to use for the output

Returns

mixed
formatted value of the variable

Overrides

icms_core_Object::getVar()
public
# doMakeFieldreadOnly( str $key )

Parameters

$key
public
# makeFieldReadOnly( str|arr $key )

Parameters

$key
public
# doHideFieldFromForm( str $key )

Parameters

$key
public
# doHideFieldFromSingleView( $key )

Parameters

$key
public
# hideFieldFromForm( $key )

Parameters

$key
public
# hideFieldFromSingleView( $key )

Parameters

$key
public
# doShowFieldOnForm( unknown_type $key )

Parameters

$key
public content
# displaySingleObject( boolean $fetchOnly = false, boolean $userSide = false, $actions = array(), $headerAsRow = true )

Display an automatic SingleView of the object, based on the displayOnSingleView param of each vars

Display an automatic SingleView of the object, based on the displayOnSingleView param of each vars

Parameters

$fetchOnly
if set to TRUE, then the content will be return, if set to FALSE, the content will be outputed
$userSide
for futur use, to do something different on the user side
$actions
$headerAsRow

Returns

content
of the template if $fetchOnly or nothing if !$fetchOnly
public
# doDisplayFieldOnSingleView( unknown_type $key )

Parameters

$key
public
# doSetFieldAsRequired( $field, $required = true )

Parameters

$field
$required
public
# doSetFieldForSorting( unknown_type $field )

Parameters

$field
public
# showFieldOnForm( unknown_type $key )

Parameters

$key
public boolean
# delete( boolean $force = false )

delete object

delete object

Parameters

$force

Returns

boolean
true if successful, false if not
public
# displayFieldOnSingleView( $key )

Parameters

$key
public
# doSetAdvancedFormFields( $key )

Parameters

$key
public
# setAdvancedFormFields( <type> $key )

Parameters

$key
public icms_data_urllink_Object
# getUrlLinkObj( string $key )

get urllink object

get urllink object

Parameters

$key
field name

Returns

icms_data_urllink_Object
public boolean
# storeUrlLinkObj( icms_data_urllink_Object $urllinkObj )

store urllink object

store urllink object

Parameters

$urllinkObj

Returns

boolean
public icms_data_file_Object
# getFileObj( string $key )

store file object

store file object

Parameters

$key
field name

Returns

icms_data_file_Object
public boolean
# storeFileObj( icms_data_file_Object $fileObj )

store file object

store file object

Parameters

$fileObj

Returns

boolean
Methods inherited from icms_core_Object
assignVar(), assignVars(), cleanVars(), getErrors(), getHtmlErrors(), getValues(), getVars(), isDirty(), isNew(), isNewConfig(), registerFilter(), setDirty(), setFormVars(), setNew(), setNewConfig(), setVar(), setVars(), unsetDirty(), unsetNew(), unsetNewConfig(), xoopsClone()
Properties summary
public $_image_path
#
public $_image_url
#
public boolean $seoEnabled
# false
public $titleField
#
public boolean $summaryField
# false
public object $handler

Reference to the handler managing this object

Reference to the handler managing this object

#
public array $controls

References to control objects, managing the form fields of this object

References to control objects, managing the form fields of this object

# array()
Properties inherited from icms_core_Object
$_isNewConfig, $cleanVars, $vars
API documentation generated by ApiGen