/app/models/ca_place_labels.php
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
- <?php
- /** ---------------------------------------------------------------------
- * app/models/ca_place_labels.php : table access class for table ca_place_labels
- * ----------------------------------------------------------------------
- * CollectiveAccess
- * Open-source collections management software
- * ----------------------------------------------------------------------
- *
- * Software by Whirl-i-Gig (http://www.whirl-i-gig.com)
- * Copyright 2008-2012 Whirl-i-Gig
- *
- * For more information visit http://www.CollectiveAccess.org
- *
- * This program is free software; you may redistribute it and/or modify it under
- * the terms of the provided license as published by Whirl-i-Gig
- *
- * CollectiveAccess is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTIES whatsoever, including any implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * This source code is free and modifiable under the terms of
- * GNU General Public License. (http://www.gnu.org/copyleft/gpl.html). See
- * the "license.txt" file for details, or visit the CollectiveAccess web site at
- * http://www.CollectiveAccess.org
- *
- * @package CollectiveAccess
- * @subpackage models
- * @license http://www.gnu.org/copyleft/gpl.html GNU Public License version 3
- *
- * ----------------------------------------------------------------------
- */
-
- /**
- *
- */
- require_once(__CA_LIB_DIR__.'/ca/BaseLabel.php');
- BaseModel::$s_ca_models_definitions['ca_place_labels'] = array(
- 'NAME_SINGULAR' => _t('place name'),
- 'NAME_PLURAL' => _t('place names'),
- 'FIELDS' => array(
- 'label_id' => array(
- 'FIELD_TYPE' => FT_NUMBER, 'DISPLAY_TYPE' => DT_HIDDEN,
- 'IDENTITY' => true, 'DISPLAY_WIDTH' => 10, 'DISPLAY_HEIGHT' => 1,
- 'IS_NULL' => false,
- 'DEFAULT' => '',
- 'LABEL' => 'Label id', 'DESCRIPTION' => 'Identifier for Label'
- ),
- 'place_id' => array(
- 'FIELD_TYPE' => FT_NUMBER, 'DISPLAY_TYPE' => DT_OMIT,
- 'DISPLAY_WIDTH' => 10, 'DISPLAY_HEIGHT' => 1,
- 'IS_NULL' => false,
- 'DEFAULT' => '',
- 'LABEL' => 'Place id', 'DESCRIPTION' => 'Identifier for Place'
- ),
- 'locale_id' => array(
- 'FIELD_TYPE' => FT_NUMBER, 'DISPLAY_TYPE' => DT_SELECT,
- 'DISPLAY_WIDTH' => 40, 'DISPLAY_HEIGHT' => 1,
- 'IS_NULL' => false,
- 'DEFAULT' => '',
- 'DISPLAY_FIELD' => array('ca_locales.name'),
- 'LABEL' => _t('Locale'), 'DESCRIPTION' => _t('Locale of label'),
- ),
- 'type_id' => array(
- 'FIELD_TYPE' => FT_NUMBER, 'DISPLAY_TYPE' => DT_SELECT,
- 'DISPLAY_WIDTH' => 10, 'DISPLAY_HEIGHT' => 1,
- 'IS_NULL' => true,
- 'DEFAULT' => '',
-
- 'LIST_CODE' => 'place_label_types',
- 'LABEL' => _t('Type'), 'DESCRIPTION' => _t('Indicates the type of label and how it should be employed.')
- ),
- 'name' => array(
- 'FIELD_TYPE' => FT_TEXT, 'DISPLAY_TYPE' => DT_FIELD,
- 'DISPLAY_WIDTH' => 100, 'DISPLAY_HEIGHT' => 3,
- 'IS_NULL' => false,
- 'DEFAULT' => '',
- 'LABEL' => _t('Name'), 'DESCRIPTION' => _t('Name'),
- 'BOUNDS_LENGTH' => array(1,255)
- ),
- 'name_sort' => array(
- 'FIELD_TYPE' => FT_TEXT, 'DISPLAY_TYPE' => DT_OMIT,
- 'DISPLAY_WIDTH' => 255, 'DISPLAY_HEIGHT' => 1,
- 'IS_NULL' => false,
- 'DEFAULT' => '',
- 'LABEL' => _t('Sort order'), 'DESCRIPTION' => _t('Sortable version of name value'),
- 'BOUNDS_LENGTH' => array(0,255)
- ),
- 'source_info' => array(
- 'FIELD_TYPE' => FT_VARS, 'DISPLAY_TYPE' => DT_OMIT,
- 'DISPLAY_WIDTH' => 88, 'DISPLAY_HEIGHT' => 15,
- 'IS_NULL' => false,
- 'DEFAULT' => '',
- 'LABEL' => _t('Source info'), 'DESCRIPTION' => _t('Source info')
- ),
- 'is_preferred' => array(
- 'FIELD_TYPE' => FT_BIT, 'DISPLAY_TYPE' => DT_SELECT,
- 'DISPLAY_WIDTH' => 10, 'DISPLAY_HEIGHT' => 1,
- 'IS_NULL' => false,
- 'DEFAULT' => '',
- 'LABEL' => _t('Is preferred'), 'DESCRIPTION' => _t('Is preferred'),
- 'BOUNDS_VALUE' => array(0,1)
- )
- )
- );
- class ca_place_labels extends BaseLabel {
- # ---------------------------------
- # --- Object attribute properties
- # ---------------------------------
- # Describe structure of content object's properties - eg. database fields and their
- # associated types, what modes are supported, et al.
- #
- # ------------------------------------------------------
- # --- Basic object parameters
- # ------------------------------------------------------
- # what table does this class represent?
- protected $TABLE = 'ca_place_labels';
-
- # what is the primary key of the table?
- protected $PRIMARY_KEY = 'label_id';
- # ------------------------------------------------------
- # --- Properties used by standard editing scripts
- #
- # These class properties allow generic scripts to properly display
- # records from the table represented by this class
- #
- # ------------------------------------------------------
- # Array of fields to display in a listing of records from this table
- protected $LIST_FIELDS = array('name');
- # When the list of "list fields" above contains more than one field,
- # the LIST_DELIMITER text is displayed between fields as a delimiter.
- # This is typically a comma or space, but can be any string you like
- protected $LIST_DELIMITER = ' ';
- # What you'd call a single record from this table (eg. a "person")
- protected $NAME_SINGULAR;
- # What you'd call more than one record from this table (eg. "people")
- protected $NAME_PLURAL;
- # List of fields to sort listing of records by; you can use
- # SQL 'ASC' and 'DESC' here if you like.
- protected $ORDER_BY = array('name');
- # Maximum number of record to display per page in a listing
- protected $MAX_RECORDS_PER_PAGE = 20;
- # How do you want to page through records in a listing: by number pages ordered
- # according to your setting above? Or alphabetically by the letters of the first
- # LIST_FIELD?
- protected $PAGE_SCHEME = 'alpha'; # alpha [alphabetical] or num [numbered pages; default]
- # If you want to order records arbitrarily, add a numeric field to the table and place
- # its name here. The generic list scripts can then use it to order table records.
- protected $RANK = '';
-
-
- # ------------------------------------------------------
- # Hierarchical table properties
- # ------------------------------------------------------
- protected $HIERARCHY_TYPE = null;
- protected $HIERARCHY_LEFT_INDEX_FLD = null;
- protected $HIERARCHY_RIGHT_INDEX_FLD = null;
- protected $HIERARCHY_PARENT_ID_FLD = null;
- protected $HIERARCHY_DEFINITION_TABLE = null;
- protected $HIERARCHY_ID_FLD = null;
- protected $HIERARCHY_POLY_TABLE = null;
-
- # ------------------------------------------------------
- # Change logging
- # ------------------------------------------------------
- protected $UNIT_ID_FIELD = null;
- protected $LOG_CHANGES_TO_SELF = false;
- protected $LOG_CHANGES_USING_AS_SUBJECT = array(
- "FOREIGN_KEYS" => array(
- 'place_id'
- ),
- "RELATED_TABLES" => array(
-
- )
- );
-
- # ------------------------------------------------------
- # Labels
- # ------------------------------------------------------
- # --- List of fields used in label user interface
- protected $LABEL_UI_FIELDS = array(
- 'name'
- );
- protected $LABEL_DISPLAY_FIELD = 'name';
-
- # --- Name of field used for sorting purposes
- protected $LABEL_SORT_FIELD = 'name_sort';
-
- # --- Name of table this table contains label for
- protected $LABEL_SUBJECT_TABLE = 'ca_places';
-
- # ------------------------------------------------------
- # $FIELDS contains information about each field in the table. The order in which the fields
- # are listed here is the order in which they will be returned using getFields()
- protected $FIELDS;
-
- # ------------------------------------------------------
- # --- Constructor
- #
- # This is a function called when a new instance of this object is created. This
- # standard constructor supports three calling modes:
- #
- # 1. If called without parameters, simply creates a new, empty objects object
- # 2. If called with a single, valid primary key value, creates a new objects object and loads
- # the record identified by the primary key value
- #
- # ------------------------------------------------------
- public function __construct($pn_id=null) {
- parent::__construct($pn_id); # call superclass constructor
- }
- # ------------------------------------------------------
- }
- ?>