PageRenderTime 58ms CodeModel.GetById 26ms RepoModel.GetById 0ms app.codeStats 0ms

/app/models/ca_bookmarks.php

https://github.com/libis/providencelibiscode
PHP | 200 lines | 107 code | 21 blank | 72 comment | 0 complexity | a5957981136a6fd53fce182e1f9dd99f 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_bookmarks.php
  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 2011 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_MODELS_DIR__.'/ca_bookmark_folders.php');
  36. BaseModel::$s_ca_models_definitions['ca_bookmarks'] = array(
  37. 'NAME_SINGULAR' => _t('bookmark'),
  38. 'NAME_PLURAL' => _t('bookmarks'),
  39. 'FIELDS' => array(
  40. 'bookmark_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' => _t('CollectiveAccess id'), 'DESCRIPTION' => _t('Unique numeric identifier used by CollectiveAccess internally to identify this bookmark')
  46. ),
  47. 'folder_id' => array(
  48. 'FIELD_TYPE' => FT_NUMBER, 'DISPLAY_TYPE' => DT_SELECT,
  49. 'DISPLAY_WIDTH' => 40, 'DISPLAY_HEIGHT' => 1,
  50. 'DISPLAY_FIELD' => array('ca_bookmark_folders.folder_id'),
  51. 'DISPLAY_ORDERBY' => array('ca_bookmark_folders.name'),
  52. 'IS_NULL' => false,
  53. 'DEFAULT' => '',
  54. 'LABEL' => _t('Folder'), 'DESCRIPTION' => _t('Indicates the folder to which the bookmark belongs.')
  55. ),
  56. 'table_num' => array(
  57. 'FIELD_TYPE' => FT_NUMBER, 'DISPLAY_TYPE' => DT_SELECT,
  58. 'DISPLAY_WIDTH' => 40, 'DISPLAY_HEIGHT' => 1,
  59. 'IS_NULL' => false,
  60. 'DEFAULT' => '',
  61. 'LABEL' => _t('Bookmark type'), 'DESCRIPTION' => _t('Indicates type of item bookmark represents.'),
  62. 'BOUNDS_CHOICE_LIST' => array(
  63. _t('objects') => 57,
  64. _t('object lots') => 51,
  65. _t('entities') => 20,
  66. _t('places') => 72,
  67. _t('occurrences') => 67,
  68. _t('collections') => 13,
  69. _t('storage locations') => 89,
  70. _t('loans') => 133,
  71. _t('movements') => 137,
  72. _t('tours') => 153,
  73. _t('tour stops') => 155,
  74. _t('object representations') => 56,
  75. _t('representation annotations') => 82,
  76. _t('list items') => 33
  77. ),
  78. 'BOUNDS_LENGTH' => array(1,100)
  79. ),
  80. 'row_id' => array(
  81. 'FIELD_TYPE' => FT_NUMBER, 'DISPLAY_TYPE' => DT_OMIT,
  82. 'DISPLAY_WIDTH' => 10, 'DISPLAY_HEIGHT' => 1,
  83. 'IS_NULL' => false,
  84. 'DEFAULT' => '',
  85. 'LABEL' => 'Row id', 'DESCRIPTION' => 'Identifier for row included in the bookmark list'
  86. ),
  87. 'rank' => array(
  88. 'FIELD_TYPE' => FT_NUMBER, 'DISPLAY_TYPE' => DT_FIELD,
  89. 'DISPLAY_WIDTH' => 10, 'DISPLAY_HEIGHT' => 1,
  90. 'IS_NULL' => false,
  91. 'DEFAULT' => '',
  92. 'LABEL' => _t('Sort order'), 'DESCRIPTION' => _t('Sort order'),
  93. ),
  94. 'notes' => array(
  95. 'FIELD_TYPE' => FT_TEXT, 'DISPLAY_TYPE' => DT_FIELD,
  96. 'DISPLAY_WIDTH' => 80, 'DISPLAY_HEIGHT' => 5,
  97. 'IS_NULL' => false,
  98. 'DEFAULT' => '',
  99. 'LABEL' => _t('Notes'), 'DESCRIPTION' => _t('Notes pertaining to the bookmark and/or bookmarked item.'),
  100. 'BOUNDS_LENGTH' => array(0,65535)
  101. ),
  102. 'created_on' => array(
  103. 'FIELD_TYPE' => FT_TIMESTAMP, 'DISPLAY_TYPE' => DT_FIELD, 'UPDATE_ON_UPDATE' => true,
  104. 'DISPLAY_WIDTH' => 10, 'DISPLAY_HEIGHT' => 1,
  105. 'IS_NULL' => false,
  106. 'DEFAULT' => '',
  107. 'LABEL' => _t('Bookmark created on'), 'DESCRIPTION' => _t('Date/time the bookmark was created.'),
  108. ),
  109. )
  110. );
  111. class ca_bookmarks extends BaseModel {
  112. # ---------------------------------
  113. # --- Object attribute properties
  114. # ---------------------------------
  115. # Describe structure of content object's properties - eg. database fields and their
  116. # associated types, what modes are supported, et al.
  117. #
  118. # ------------------------------------------------------
  119. # --- Basic object parameters
  120. # ------------------------------------------------------
  121. # what table does this class represent?
  122. protected $TABLE = 'ca_bookmarks';
  123. # what is the primary key of the table?
  124. protected $PRIMARY_KEY = 'bookmark_id';
  125. # ------------------------------------------------------
  126. # --- Properties used by standard editing scripts
  127. #
  128. # These class properties allow generic scripts to properly display
  129. # records from the table represented by this class
  130. #
  131. # ------------------------------------------------------
  132. # Array of fields to display in a listing of records from this table
  133. protected $LIST_FIELDS = array('bookmark_id');
  134. # When the list of "list fields" above contains more than one field,
  135. # the LIST_DELIMITER text is displayed between fields as a delimiter.
  136. # This is typically a comma or space, but can be any string you like
  137. protected $LIST_DELIMITER = ' ';
  138. # What you'd call a single record from this table (eg. a "person")
  139. protected $NAME_SINGULAR;
  140. # What you'd call more than one record from this table (eg. "people")
  141. protected $NAME_PLURAL;
  142. # List of fields to sort listing of records by; you can use
  143. # SQL 'ASC' and 'DESC' here if you like.
  144. protected $ORDER_BY = array('bookmark_id');
  145. # If you want to order records arbitrarily, add a numeric field to the table and place
  146. # its name here. The generic list scripts can then use it to order table records.
  147. protected $RANK = '';
  148. # ------------------------------------------------------
  149. # Hierarchical table properties
  150. # ------------------------------------------------------
  151. protected $HIERARCHY_TYPE = null;
  152. protected $HIERARCHY_LEFT_INDEX_FLD = null;
  153. protected $HIERARCHY_RIGHT_INDEX_FLD = null;
  154. protected $HIERARCHY_PARENT_ID_FLD = null;
  155. protected $HIERARCHY_DEFINITION_TABLE = null;
  156. protected $HIERARCHY_ID_FLD = null;
  157. protected $HIERARCHY_POLY_TABLE = null;
  158. # ------------------------------------------------------
  159. # Change logging
  160. # ------------------------------------------------------
  161. protected $UNIT_ID_FIELD = null;
  162. protected $LOG_CHANGES_TO_SELF = false;
  163. protected $LOG_CHANGES_USING_AS_SUBJECT = array(
  164. "FOREIGN_KEYS" => array(
  165. ),
  166. "RELATED_TABLES" => array(
  167. )
  168. );
  169. # ------------------------------------------------------
  170. # $FIELDS contains information about each field in the table. The order in which the fields
  171. # are listed here is the order in which they will be returned using getFields()
  172. protected $FIELDS;
  173. # ----------------------------------------
  174. public function __construct($pn_id=null) {
  175. parent::__construct($pn_id);
  176. }
  177. # ----------------------------------------
  178. }
  179. ?>