KWeb
6.4
|
Podstawowa klasa do implementowania atrybutow. More...
Public Member Functions | |
__construct ($id, $title, $opt=array()) | |
__get ($name) | |
__set ($name, $value) | |
getType () | |
Zwraca nazwę typu . | |
getAttributeId () | |
getTitle () | |
getSelectSql () | |
addCSSClass ($css) | |
getCSSClasses () | |
getTemplatePrinters () | |
Returns an array of template printers (attribute/edit/__PRINTER.inc) | |
warmupAttribute (KWebObject_Attributable $object, $lang=false, $cache=false) | |
Warms up this attribute's data on the object. | |
containsKScript (KWebObject_Attributable $object, $lang=false, $value=null) | |
canEdit (KWebObject_Attributable $object, $lang=false) | |
Czy można element edytować? . | |
canView (KWebObject_Attributable $object) | |
canTranslate () | |
canDraft () | |
canSynch () | |
shouldTranslate (KWebObject_Attributable $object, $lang=false) | |
canEditInLanguage (KWebObject_Attributable $object, $lang=false) | |
isTranslated (KWebObject_Attributable $object, $lang=false) | |
isData () | |
Return TRUE if this attribute is a data attribute. | |
addToForm (KWebAttribute_Table_Form $form) | |
Adds this attribute's clone to the form, according to form intents ($group and $forms). | |
onFormPosted (KWebAttribute_Table_Form $form) | |
Called from KWebAttribute_Table_Form::setPostedData Attribute can change the data on the form, but should not yet convert or validate it... | |
onFormCreated (KWebAttribute_Table_Form $form) | |
Called when form is created, and the data is attached to it. | |
onFormPostStored (KWebAttribute_Table_Form $form, $success) | |
Called from KWebAttribute_Table_Form::storePostedData, after successfully storing all the posted data. | |
handleRemoteAction (KWebAttribute_Table_Form $form, KWebObject_Attributable $object, $action, $data) | |
Handles remote action called on /object,view-attribute-action. | |
checkValue (KWebObject_Attributable $object, &$value, $lang=false) | |
Checks the value for correctness. | |
getIdInSource () | |
Returns id (ie column) in the source. | |
setValue (KWebObject_Attributable $object, $value, $lang=false) | |
getValue (KWebObject_Attributable $object, $lang=false) | |
Zwraca wartość atrybutu elementu z pominięciem konwersji. | |
getPostedData (KWebAttribute_Table_Form $form) | |
Returns data posted in the form for this attribute (in FORMAT_FORM) | |
getFormValue (KWebAttribute_Table_Form $form) | |
Returns object's attribute value in FORMAT_FORM, or posted value directly. | |
convertData ($value, $format, $conversion) | |
convertValue ($value, $conversion, $lang=false) | |
convertSQLValue ($value, $conversion) | |
doConvertValue ($func, $value, $conversion) | |
Executes value conversion. | |
storePostedFormData (KWebAttribute_Table_Form $form, $value) | |
Stores attribute's data in the object... | |
copyAttributeValue (KWebObject_Attributable $to, KWebObject_Attributable $from) | |
check_alphaNumericOnly (&$value) | |
check_number (&$value) | |
check_var (&$value) | |
check_nonempty (&$value) | |
check_required (&$value) | |
check_unique (&$value) | |
check_email (&$value) | |
check_json ($value) | |
convert_double ($value, $conversion) | |
Converts any double (with dot or comma) to english double (dot) | |
convert_size ($value, $conversion) | |
Converts FROM array(##, ##) TO string '##x##'. | |
convert_keywords ($value, $conversion) | |
Converts FROM array TO semicolon (;) separated list. | |
printInForm (KWebAttribute_Table_Form $form, KWebAttribute_Table_Group $group, array $options=array()) | |
Prints the whole attribute/form/group - with label and widget... | |
printAttribute (KWebAttribute_Table_Form $form, KWebAttribute_Table_Group $group, array $options=array()) | |
Prints the attribute's contents (widget) | |
getErrorId () | |
getErrorStack () | |
pushError ($type, $msg) | |
getClone () | |
Returns a clone of this attribute. | |
Static Public Member Functions | |
static | loadClass ($name) |
static | convert_checkbox ($value, $conversion, $delimiter= ';') |
Converts FROM hashmap TO delimited string. | |
static | convert_set ($value, $conversion) |
Converts FROM hashmap TO delimited string. | |
static | convert_serialize ($value, $conversion) |
Converts FROM object TO serialized. | |
static | convert_json ($value, $conversion) |
Converts FROM object TO JSON string. | |
static | convert_hashmap ($value, $conversion) |
Converts FROM hashmap TO URL encoded. | |
static | convert_options ($value, $conversion) |
Converts FROM hashmap (key=>value) TO hashmap list in format: key = value key = value. | |
static | convert_time ($value, $conversion) |
Converts FROM unix seconds TO time string in "YYYY-MM-DD HH:MM:SS" format. | |
static | convert_flags ($value, $conversion) |
Converts FROM flags (integer bitmask) TO hashmap (bit => true) | |
static | getFromTable (&$table, $id, $remove=false, &$group=null) |
Finds attribute in the table ... | |
static | addToTable (&$table, $attr, $position) |
Adds attribute to specified table at the specified position. | |
Data Fields | |
const | GROUP_MAIN = 'group-main' |
const | FORM_FULL = 'full' |
Full form. | |
const | FORM_SHORT = 'short' |
Short form version. | |
const | FORM_ADD = 'add' |
Adding form. | |
const | FORM_EDIT = 'edit' |
Editing form. | |
const | FORM_MAINLANGUAGE = 'mainlang' |
Object's main language form. | |
const | FORM_TRANSLATION = 'translation' |
Object's translation form. | |
const | FORM_SUBFORM = 'subform' |
const | FORM_OPT_LANGUAGE = 'lang' |
const | TRANS_REQUIRED = 'required' |
$id | |
Attribute ID (the same as the property, or data field in the object), or FALSE for non-writeable data. | |
$title | |
$check = '' | |
List of checks to perform on the attribute. | |
$info = '' | |
tekst objaśniający atrybut | |
$onlyView = false | |
tylko podgląd | |
$value = null | |
wartość początkowa | |
$translate = false | |
TRUE if this attribute can be translated. | |
$draft = false | |
Czy atrybut może być zmieniany w draftach. | |
$more = false | |
Atrybut jest dostępny w "więcej"? | |
$synch = null | |
$source | |
Data source of this attribute. | |
$idInSource | |
Id of this attribute in the source, or null to use the $id. | |
$r_edit = 0 | |
prawo wymagane do edycji | |
$r_view = 0 | |
prawo wymagane do przeglądania | |
$required = false | |
$convertSql = false | |
Function for converting attribute value between INTERNAL and SQL database. | |
$convert = false | |
Function for converting attribute value between INTERNAL and STRING. | |
$convertForm = false | |
Function for converting attribute value between FORMAT_INTERNAL and FORMAT_FORM. | |
$kscript = false | |
Treść może zawierać KScript. | |
$css = '' | |
$length = 0 | |
Dopuszczalna liczba znaków. | |
$propagates = false | |
True if change in this value can propagate to child items. | |
$group = self::GROUP_MAIN | |
Which group in a form this attribute should default to. | |
$forms = false | |
In which forms this attribute should be included automatically. | |
Static Protected Attributes | |
static | $fieldMap |
Podstawowa klasa do implementowania atrybutow.
KWebAttribute::__construct | ( | $ | id, |
$ | title, | ||
$ | opt = array() |
||
) |
Reimplemented in KWebAttribute_File, KWebAttribute_Media, KWebAttribute_Image, KWebAttribute_Geometry, KWebAttribute_Reference, KWebAttribute_String, KWebAttribute_Number, KWebAttribute_Task, KWebAttribute_Text, KWebAttribute_Calendar, KWebAttribute_Checkbox, KWebAttribute_Date, KWebAttribute_Html, KWebAttribute_Item_Keywords, KWebAttribute_Item_Name, KWebAttribute_Item_RequestId, and KWebAttribute_Inc.
KWebAttribute::__get | ( | $ | name | ) |
KWebAttribute::__set | ( | $ | name, |
$ | value | ||
) |
KWebAttribute::addCSSClass | ( | $ | css | ) |
KWebAttribute::addToForm | ( | KWebAttribute_Table_Form $ | form | ) |
Adds this attribute's clone to the form, according to form intents ($group and $forms).
Returns the element.
Reimplemented in KWebAttribute_Linkage.
static KWebAttribute::addToTable | ( | &$ | table, |
$ | attr, | ||
$ | position | ||
) | [static] |
Adds attribute to specified table at the specified position.
$table | - table of attributes, as returned by KWebItem::getAttributeTable() (grouped in arrays) , or specific group |
$attr | - KWebAttribute object, or identifier to look for. When id is provided, the attribute will be moved to the new position. If the position is numeric, then the attribute will be moved inside it's current group. |
$position | - position of the attribute insertion. Can be a:
|
KWebAttribute::canDraft | ( | ) |
KWebAttribute::canEdit | ( | KWebObject_Attributable $ | object, |
$ | lang = false |
||
) |
Czy można element edytować? .
Reimplemented in KWebAttribute_Data, KWebAttribute_Info, and KWebAttribute_Item_Language.
KWebAttribute::canEditInLanguage | ( | KWebObject_Attributable $ | object, |
$ | lang = false |
||
) |
KWebAttribute::canSynch | ( | ) |
Reimplemented in KWebAttribute_Item_Changes.
KWebAttribute::canTranslate | ( | ) |
Reimplemented in KWebAttribute_ChildItems.
KWebAttribute::canView | ( | KWebObject_Attributable $ | object | ) |
Reimplemented in KWebAttribute_ChildItems, and KWebAttribute_Data.
KWebAttribute::check_alphaNumericOnly | ( | &$ | value | ) |
KWebAttribute::check_email | ( | &$ | value | ) |
KWebAttribute::check_json | ( | $ | value | ) |
KWebAttribute::check_nonempty | ( | &$ | value | ) |
KWebAttribute::check_number | ( | &$ | value | ) |
KWebAttribute::check_required | ( | &$ | value | ) |
KWebAttribute::check_unique | ( | &$ | value | ) |
KWebAttribute::check_var | ( | &$ | value | ) |
KWebAttribute::checkValue | ( | KWebObject_Attributable $ | object, |
&$ | value, | ||
$ | lang = false |
||
) |
Checks the value for correctness.
Value is in FORMAT_INTERNAL. In case of severe problem, an Exception may be thrown Value may be altered if necessary
Reimplemented in KWebAttribute_Linkage, KWebAttribute_ChildItems, KWebAttribute_Item_Language, KWebAttribute_Checkboxes, KWebAttribute_Fields, KWebAttribute_Item_Keywords, KWebAttribute_Flags, KWebAttribute_Enum, KWebAttribute_Item_Name, KWebAttribute_Inc, and KWebAttribute_Item_RequestId.
KWebAttribute::containsKScript | ( | KWebObject_Attributable $ | object, |
$ | lang = false , |
||
$ | value = null |
||
) |
static KWebAttribute::convert_checkbox | ( | $ | value, |
$ | conversion, | ||
$ | delimiter = ';' |
||
) | [static] |
Converts FROM hashmap TO delimited string.
hashmap: array('a' => true, 'b' => true) Is converted to string: "a;b"
unknown_type | $value | |
unknown_type | $conversion |
KWebAttribute::convert_double | ( | $ | value, |
$ | conversion | ||
) |
Converts any double (with dot or comma) to english double (dot)
static KWebAttribute::convert_flags | ( | $ | value, |
$ | conversion | ||
) | [static] |
Converts FROM flags (integer bitmask) TO hashmap (bit => true)
static KWebAttribute::convert_hashmap | ( | $ | value, |
$ | conversion | ||
) | [static] |
Converts FROM hashmap TO URL encoded.
static KWebAttribute::convert_json | ( | $ | value, |
$ | conversion | ||
) | [static] |
Converts FROM object TO JSON string.
KWebAttribute::convert_keywords | ( | $ | value, |
$ | conversion | ||
) |
Converts FROM array TO semicolon (;) separated list.
static KWebAttribute::convert_options | ( | $ | value, |
$ | conversion | ||
) | [static] |
Converts FROM hashmap (key=>value) TO hashmap list in format: key = value key = value.
static KWebAttribute::convert_serialize | ( | $ | value, |
$ | conversion | ||
) | [static] |
Converts FROM object TO serialized.
static KWebAttribute::convert_set | ( | $ | value, |
$ | conversion | ||
) | [static] |
Converts FROM hashmap TO delimited string.
hashmap: array('a' => true, 'b' => true) Is converted to string: "a,b"
unknown_type | $value | |
unknown_type | $conversion |
KWebAttribute::convert_size | ( | $ | value, |
$ | conversion | ||
) |
Converts FROM array(##, ##) TO string '##x##'.
static KWebAttribute::convert_time | ( | $ | value, |
$ | conversion | ||
) | [static] |
Converts FROM unix seconds TO time string in "YYYY-MM-DD HH:MM:SS" format.
KWebAttribute::convertData | ( | $ | value, |
$ | format, | ||
$ | conversion | ||
) |
$conversion | true (CONVERT_TO) - dane mają być pokazane W formularzu, false (CONVERT_FROM) - dane pochodzą Z formularza |
Reimplemented in KWebAttribute_File, KWebAttribute_Checkboxes, KWebAttribute_Password, KWebAttribute_Item_Keywords, KWebAttribute_Array, KWebAttribute_Number, KWebAttribute_Geometry, and KWebAttribute_Checkbox.
KWebAttribute::convertSQLValue | ( | $ | value, |
$ | conversion | ||
) |
KWebAttribute::convertValue | ( | $ | value, |
$ | conversion, | ||
$ | lang = false |
||
) |
$conversion | true (CONVERT_TO) - dane mają być pokazane W formularzu, false (CONVERT_FROM) - dane pochodzą Z formularza |
KWebAttribute::copyAttributeValue | ( | KWebObject_Attributable $ | to, |
KWebObject_Attributable $ | from | ||
) |
Reimplemented in KWebAttribute_Linkage.
KWebAttribute::doConvertValue | ( | $ | func, |
$ | value, | ||
$ | conversion | ||
) |
Executes value conversion.
$func | - Can be either:
|
KWebAttribute::getAttributeId | ( | ) |
Implements KWebAttribute_Interface.
KWebAttribute::getClone | ( | ) |
KWebAttribute::getCSSClasses | ( | ) |
Implements KWebAttribute_Interface.
KWebAttribute::getErrorId | ( | ) |
KWebAttribute::getErrorStack | ( | ) |
KWebAttribute::getFormValue | ( | KWebAttribute_Table_Form $ | form | ) |
Returns object's attribute value in FORMAT_FORM, or posted value directly.
Reimplemented in KWebAttribute_ChildItems.
static KWebAttribute::getFromTable | ( | &$ | table, |
$ | id, | ||
$ | remove = false , |
||
&$ | group = null |
||
) | [static] |
Finds attribute in the table ...
$table | - table of attributes, as returned by KWebItem::getAttributeTable() (grouped in arrays) , or specific group |
$id | - id of item to find |
$remove | - TRUE if item should be removed |
$group | - group where the attribute was found in, will be set in this variable |
KWebAttribute::getIdInSource | ( | ) |
Returns id (ie column) in the source.
KWebAttribute::getPostedData | ( | KWebAttribute_Table_Form $ | form | ) |
Returns data posted in the form for this attribute (in FORMAT_FORM)
Reimplemented in KWebAttribute_ChildItems, and KWebAttribute_Fields.
KWebAttribute::getSelectSql | ( | ) |
Reimplemented in KWebAttribute_DataTime, KWebAttribute_Date, and KWebAttribute_Flags.
KWebAttribute::getTemplatePrinters | ( | ) |
Returns an array of template printers (attribute/edit/__PRINTER.inc)
Implements KWebAttribute_Interface.
Reimplemented in KWebAttribute_Flags, KWebAttribute_Linkage, KWebAttribute_Array, KWebAttribute_Item_Keywords, KWebAttribute_Item_Name, KWebAttribute_Inc, and KWebAttribute_Info.
KWebAttribute::getTitle | ( | ) |
Implements KWebAttribute_Interface.
KWebAttribute::getType | ( | ) |
Zwraca nazwę typu .
Reimplemented in KWebAttribute_DataTime, KWebAttribute_ChildItems, KWebAttribute_DataNumber, KWebAttribute_Checkboxes, KWebAttribute_File, KWebAttribute_Flags, KWebAttribute_Linkage, KWebAttribute_Media, KWebAttribute_Fields, KWebAttribute_Enum, KWebAttribute_Radio, KWebAttribute_Array, KWebAttribute_Date, KWebAttribute_Task, KWebAttribute_Password, KWebAttribute_Geometry, KWebAttribute_Number, KWebAttribute_Image, KWebAttribute_Reference, KWebAttribute_Item_Language, KWebAttribute_String, KWebAttribute_Text, KWebAttribute_Calendar, KWebAttribute_Checkbox, KWebAttribute_Html, KWebAttribute_Item_Keywords, KWebAttribute_Item_Name, KWebAttribute_Inc, KWebAttribute_Item_Changes, KWebAttribute_Data, and KWebAttribute_Info.
KWebAttribute::getValue | ( | KWebObject_Attributable $ | object, |
$ | lang = false |
||
) |
Zwraca wartość atrybutu elementu z pominięciem konwersji.
Reimplemented in KWebAttribute_Item_Language, KWebAttribute_Linkage, KWebAttribute_Task, and KWebAttribute_Item_Keywords.
KWebAttribute::handleRemoteAction | ( | KWebAttribute_Table_Form $ | form, |
KWebObject_Attributable $ | object, | ||
$ | action, | ||
$ | data | ||
) |
Handles remote action called on /object,view-attribute-action.
Reimplemented in KWebAttribute_ChildItems.
KWebAttribute::isData | ( | ) |
Return TRUE if this attribute is a data attribute.
Implements KWebAttribute_Interface.
Reimplemented in KWebAttribute_ChildItems, KWebAttribute_Linkage, KWebAttribute_Task, KWebAttribute_Info, and KWebAttribute_Item_Language.
KWebAttribute::isTranslated | ( | KWebObject_Attributable $ | object, |
$ | lang = false |
||
) |
Reimplemented in KWebAttribute_File.
static KWebAttribute::loadClass | ( | $ | name | ) | [static] |
KWebAttribute::onFormCreated | ( | KWebAttribute_Table_Form $ | form | ) |
Called when form is created, and the data is attached to it.
Regardles of data post
Reimplemented in KWebAttribute_ChildItems.
KWebAttribute::onFormPosted | ( | KWebAttribute_Table_Form $ | form | ) |
Called from KWebAttribute_Table_Form::setPostedData Attribute can change the data on the form, but should not yet convert or validate it...
In case of error, an Exception should be thrown
Reimplemented in KWebAttribute_ChildItems, KWebAttribute_File, and KWebAttribute_Password.
KWebAttribute::onFormPostStored | ( | KWebAttribute_Table_Form $ | form, |
$ | success | ||
) |
Called from KWebAttribute_Table_Form::storePostedData, after successfully storing all the posted data.
Reimplemented in KWebAttribute_ChildItems, and KWebAttribute_Item_Language.
KWebAttribute::printAttribute | ( | KWebAttribute_Table_Form $ | form, |
KWebAttribute_Table_Group $ | group, | ||
array $ | options = array() |
||
) |
Prints the attribute's contents (widget)
$group | - Group which this attribute belongs to |
KWebAttribute::printInForm | ( | KWebAttribute_Table_Form $ | form, |
KWebAttribute_Table_Group $ | group, | ||
array $ | options = array() |
||
) |
Prints the whole attribute/form/group - with label and widget...
Implements KWebAttribute_Interface.
KWebAttribute::pushError | ( | $ | type, |
$ | msg | ||
) |
KWebAttribute::setValue | ( | KWebObject_Attributable $ | object, |
$ | value, | ||
$ | lang = false |
||
) |
Reimplemented in KWebAttribute_Linkage, and KWebAttribute_Flags.
KWebAttribute::shouldTranslate | ( | KWebObject_Attributable $ | object, |
$ | lang = false |
||
) |
KWebAttribute::storePostedFormData | ( | KWebAttribute_Table_Form $ | form, |
$ | value | ||
) |
Stores attribute's data in the object...
Data is already validated and converted to FORMAT_INTERNAL. This function is called for EVERY attribute with an id, even those, that were not posted.
You should check if it is posted ($form->isAttributedPosted()), and act accordingly.
Data is in FORMAT_INTERNAL
Reimplemented in KWebAttribute_File, KWebAttribute_ChildItems, KWebAttribute_Password, and KWebAttribute_Item_Language.
KWebAttribute::warmupAttribute | ( | KWebObject_Attributable $ | object, |
$ | lang = false , |
||
$ | cache = false |
||
) |
Warms up this attribute's data on the object.
Reimplemented in KWebAttribute_Item_Keywords.
KWebAttribute::$check = '' |
List of checks to perform on the attribute.
Can be a comma separated string or array.
Every item can be :
KWebAttribute::$convert = false |
Function for converting attribute value between INTERNAL and STRING.
This is the basis fo all conversions. $convert* will override this setting on specified data format. Can be:
KWebAttribute::$convertForm = false |
Function for converting attribute value between FORMAT_INTERNAL and FORMAT_FORM.
KWebAttribute::$convertSql = false |
Function for converting attribute value between INTERNAL and SQL database.
Can be:
KWebAttribute::$css = '' |
KWebAttribute::$draft = false |
Czy atrybut może być zmieniany w draftach.
KWebAttribute::$fieldMap [static, protected] |
array( 'sqlTable' => '!source', )
KWebAttribute::$forms = false |
In which forms this attribute should be included automatically.
TRUE - visible in all FALSE - invisible in all FORM_* - in specified form array() - in forms having ALL these specifications
defaults to false
KWebAttribute::$group = self::GROUP_MAIN |
Which group in a form this attribute should default to.
KWebAttribute::$id |
Attribute ID (the same as the property, or data field in the object), or FALSE for non-writeable data.
KWebAttribute::$idInSource |
Id of this attribute in the source, or null to use the $id.
KWebAttribute::$info = '' |
tekst objaśniający atrybut
KWebAttribute::$kscript = false |
Treść może zawierać KScript.
KWebAttribute::$length = 0 |
Dopuszczalna liczba znaków.
KWebAttribute::$more = false |
Atrybut jest dostępny w "więcej"?
KWebAttribute::$onlyView = false |
tylko podgląd
KWebAttribute::$propagates = false |
True if change in this value can propagate to child items.
KWebAttribute::$r_edit = 0 |
prawo wymagane do edycji
KWebAttribute::$r_view = 0 |
prawo wymagane do przeglądania
KWebAttribute::$required = false |
KWebAttribute::$source |
Data source of this attribute.
A table name, data field name, or special sources like SOURCE_MAIN and SOURCE_DATA
KWebAttribute::$synch = null |
KWebAttribute::$title |
KWebAttribute::$translate = false |
TRUE if this attribute can be translated.
self::TRANS_REQUIRED if it is required (use === for comparison!).
KWebAttribute::$value = null |
wartość początkowa
const KWebAttribute::FORM_ADD = 'add' |
Adding form.
const KWebAttribute::FORM_EDIT = 'edit' |
Editing form.
const KWebAttribute::FORM_FULL = 'full' |
Full form.
const KWebAttribute::FORM_MAINLANGUAGE = 'mainlang' |
Object's main language form.
const KWebAttribute::FORM_OPT_LANGUAGE = 'lang' |
const KWebAttribute::FORM_SHORT = 'short' |
Short form version.
const KWebAttribute::FORM_SUBFORM = 'subform' |
const KWebAttribute::FORM_TRANSLATION = 'translation' |
Object's translation form.
const KWebAttribute::GROUP_MAIN = 'group-main' |
const KWebAttribute::TRANS_REQUIRED = 'required' |