PageRenderTime 57ms CodeModel.GetById 32ms RepoModel.GetById 0ms app.codeStats 0ms

/app/models/ca_place_labels.php

https://github.com/libis/providencelibiscode
PHP | 226 lines | 108 code | 26 blank | 92 comment | 0 complexity | 209c1187a403ccbfdbe107b3d9e3f00e MD5 | raw file
Possible License(s): LGPL-2.1, Apache-2.0, GPL-3.0, LGPL-2.0, LGPL-3.0
  1. <?php
  2. /** ---------------------------------------------------------------------
  3. * app/models/ca_place_labels.php : table access class for table ca_place_labels
  4. * ----------------------------------------------------------------------
  5. * CollectiveAccess
  6. * Open-source collections management software
  7. * ----------------------------------------------------------------------
  8. *
  9. * Software by Whirl-i-Gig (http://www.whirl-i-gig.com)
  10. * Copyright 2008-2012 Whirl-i-Gig
  11. *
  12. * For more information visit http://www.CollectiveAccess.org
  13. *
  14. * This program is free software; you may redistribute it and/or modify it under
  15. * the terms of the provided license as published by Whirl-i-Gig
  16. *
  17. * CollectiveAccess is distributed in the hope that it will be useful, but
  18. * WITHOUT ANY WARRANTIES whatsoever, including any implied warranty of
  19. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  20. *
  21. * This source code is free and modifiable under the terms of
  22. * GNU General Public License. (http://www.gnu.org/copyleft/gpl.html). See
  23. * the "license.txt" file for details, or visit the CollectiveAccess web site at
  24. * http://www.CollectiveAccess.org
  25. *
  26. * @package CollectiveAccess
  27. * @subpackage models
  28. * @license http://www.gnu.org/copyleft/gpl.html GNU Public License version 3
  29. *
  30. * ----------------------------------------------------------------------
  31. */
  32. /**
  33. *
  34. */
  35. require_once(__CA_LIB_DIR__.'/ca/BaseLabel.php');
  36. BaseModel::$s_ca_models_definitions['ca_place_labels'] = array(
  37. 'NAME_SINGULAR' => _t('place name'),
  38. 'NAME_PLURAL' => _t('place names'),
  39. 'FIELDS' => array(
  40. 'label_id' => array(
  41. 'FIELD_TYPE' => FT_NUMBER, 'DISPLAY_TYPE' => DT_HIDDEN,
  42. 'IDENTITY' => true, 'DISPLAY_WIDTH' => 10, 'DISPLAY_HEIGHT' => 1,
  43. 'IS_NULL' => false,
  44. 'DEFAULT' => '',
  45. 'LABEL' => 'Label id', 'DESCRIPTION' => 'Identifier for Label'
  46. ),
  47. 'place_id' => array(
  48. 'FIELD_TYPE' => FT_NUMBER, 'DISPLAY_TYPE' => DT_OMIT,
  49. 'DISPLAY_WIDTH' => 10, 'DISPLAY_HEIGHT' => 1,
  50. 'IS_NULL' => false,
  51. 'DEFAULT' => '',
  52. 'LABEL' => 'Place id', 'DESCRIPTION' => 'Identifier for Place'
  53. ),
  54. 'locale_id' => array(
  55. 'FIELD_TYPE' => FT_NUMBER, 'DISPLAY_TYPE' => DT_SELECT,
  56. 'DISPLAY_WIDTH' => 40, 'DISPLAY_HEIGHT' => 1,
  57. 'IS_NULL' => false,
  58. 'DEFAULT' => '',
  59. 'DISPLAY_FIELD' => array('ca_locales.name'),
  60. 'LABEL' => _t('Locale'), 'DESCRIPTION' => _t('Locale of label'),
  61. ),
  62. 'type_id' => array(
  63. 'FIELD_TYPE' => FT_NUMBER, 'DISPLAY_TYPE' => DT_SELECT,
  64. 'DISPLAY_WIDTH' => 10, 'DISPLAY_HEIGHT' => 1,
  65. 'IS_NULL' => true,
  66. 'DEFAULT' => '',
  67. 'LIST_CODE' => 'place_label_types',
  68. 'LABEL' => _t('Type'), 'DESCRIPTION' => _t('Indicates the type of label and how it should be employed.')
  69. ),
  70. 'name' => array(
  71. 'FIELD_TYPE' => FT_TEXT, 'DISPLAY_TYPE' => DT_FIELD,
  72. 'DISPLAY_WIDTH' => 100, 'DISPLAY_HEIGHT' => 3,
  73. 'IS_NULL' => false,
  74. 'DEFAULT' => '',
  75. 'LABEL' => _t('Name'), 'DESCRIPTION' => _t('Name'),
  76. 'BOUNDS_LENGTH' => array(1,255)
  77. ),
  78. 'name_sort' => array(
  79. 'FIELD_TYPE' => FT_TEXT, 'DISPLAY_TYPE' => DT_OMIT,
  80. 'DISPLAY_WIDTH' => 255, 'DISPLAY_HEIGHT' => 1,
  81. 'IS_NULL' => false,
  82. 'DEFAULT' => '',
  83. 'LABEL' => _t('Sort order'), 'DESCRIPTION' => _t('Sortable version of name value'),
  84. 'BOUNDS_LENGTH' => array(0,255)
  85. ),
  86. 'source_info' => array(
  87. 'FIELD_TYPE' => FT_VARS, 'DISPLAY_TYPE' => DT_OMIT,
  88. 'DISPLAY_WIDTH' => 88, 'DISPLAY_HEIGHT' => 15,
  89. 'IS_NULL' => false,
  90. 'DEFAULT' => '',
  91. 'LABEL' => _t('Source info'), 'DESCRIPTION' => _t('Source info')
  92. ),
  93. 'is_preferred' => array(
  94. 'FIELD_TYPE' => FT_BIT, 'DISPLAY_TYPE' => DT_SELECT,
  95. 'DISPLAY_WIDTH' => 10, 'DISPLAY_HEIGHT' => 1,
  96. 'IS_NULL' => false,
  97. 'DEFAULT' => '',
  98. 'LABEL' => _t('Is preferred'), 'DESCRIPTION' => _t('Is preferred'),
  99. 'BOUNDS_VALUE' => array(0,1)
  100. )
  101. )
  102. );
  103. class ca_place_labels extends BaseLabel {
  104. # ---------------------------------
  105. # --- Object attribute properties
  106. # ---------------------------------
  107. # Describe structure of content object's properties - eg. database fields and their
  108. # associated types, what modes are supported, et al.
  109. #
  110. # ------------------------------------------------------
  111. # --- Basic object parameters
  112. # ------------------------------------------------------
  113. # what table does this class represent?
  114. protected $TABLE = 'ca_place_labels';
  115. # what is the primary key of the table?
  116. protected $PRIMARY_KEY = 'label_id';
  117. # ------------------------------------------------------
  118. # --- Properties used by standard editing scripts
  119. #
  120. # These class properties allow generic scripts to properly display
  121. # records from the table represented by this class
  122. #
  123. # ------------------------------------------------------
  124. # Array of fields to display in a listing of records from this table
  125. protected $LIST_FIELDS = array('name');
  126. # When the list of "list fields" above contains more than one field,
  127. # the LIST_DELIMITER text is displayed between fields as a delimiter.
  128. # This is typically a comma or space, but can be any string you like
  129. protected $LIST_DELIMITER = ' ';
  130. # What you'd call a single record from this table (eg. a "person")
  131. protected $NAME_SINGULAR;
  132. # What you'd call more than one record from this table (eg. "people")
  133. protected $NAME_PLURAL;
  134. # List of fields to sort listing of records by; you can use
  135. # SQL 'ASC' and 'DESC' here if you like.
  136. protected $ORDER_BY = array('name');
  137. # Maximum number of record to display per page in a listing
  138. protected $MAX_RECORDS_PER_PAGE = 20;
  139. # How do you want to page through records in a listing: by number pages ordered
  140. # according to your setting above? Or alphabetically by the letters of the first
  141. # LIST_FIELD?
  142. protected $PAGE_SCHEME = 'alpha'; # alpha [alphabetical] or num [numbered pages; default]
  143. # If you want to order records arbitrarily, add a numeric field to the table and place
  144. # its name here. The generic list scripts can then use it to order table records.
  145. protected $RANK = '';
  146. # ------------------------------------------------------
  147. # Hierarchical table properties
  148. # ------------------------------------------------------
  149. protected $HIERARCHY_TYPE = null;
  150. protected $HIERARCHY_LEFT_INDEX_FLD = null;
  151. protected $HIERARCHY_RIGHT_INDEX_FLD = null;
  152. protected $HIERARCHY_PARENT_ID_FLD = null;
  153. protected $HIERARCHY_DEFINITION_TABLE = null;
  154. protected $HIERARCHY_ID_FLD = null;
  155. protected $HIERARCHY_POLY_TABLE = null;
  156. # ------------------------------------------------------
  157. # Change logging
  158. # ------------------------------------------------------
  159. protected $UNIT_ID_FIELD = null;
  160. protected $LOG_CHANGES_TO_SELF = false;
  161. protected $LOG_CHANGES_USING_AS_SUBJECT = array(
  162. "FOREIGN_KEYS" => array(
  163. 'place_id'
  164. ),
  165. "RELATED_TABLES" => array(
  166. )
  167. );
  168. # ------------------------------------------------------
  169. # Labels
  170. # ------------------------------------------------------
  171. # --- List of fields used in label user interface
  172. protected $LABEL_UI_FIELDS = array(
  173. 'name'
  174. );
  175. protected $LABEL_DISPLAY_FIELD = 'name';
  176. # --- Name of field used for sorting purposes
  177. protected $LABEL_SORT_FIELD = 'name_sort';
  178. # --- Name of table this table contains label for
  179. protected $LABEL_SUBJECT_TABLE = 'ca_places';
  180. # ------------------------------------------------------
  181. # $FIELDS contains information about each field in the table. The order in which the fields
  182. # are listed here is the order in which they will be returned using getFields()
  183. protected $FIELDS;
  184. # ------------------------------------------------------
  185. # --- Constructor
  186. #
  187. # This is a function called when a new instance of this object is created. This
  188. # standard constructor supports three calling modes:
  189. #
  190. # 1. If called without parameters, simply creates a new, empty objects object
  191. # 2. If called with a single, valid primary key value, creates a new objects object and loads
  192. # the record identified by the primary key value
  193. #
  194. # ------------------------------------------------------
  195. public function __construct($pn_id=null) {
  196. parent::__construct($pn_id); # call superclass constructor
  197. }
  198. # ------------------------------------------------------
  199. }
  200. ?>