Update Layout.hlp
[civicrm-core.git] / xml / templates / listAll.tpl
CommitLineData
6b5ff8c9
ARW
1<?php
2
3/*
4 +--------------------------------------------------------------------+
5 | CiviCRM version 4.3 |
6 +--------------------------------------------------------------------+
7 | Copyright CiviCRM LLC (c) 2004-2013 |
8 +--------------------------------------------------------------------+
9 | This file is a part of CiviCRM. |
10 | |
11 | CiviCRM is free software; you can copy, modify, and distribute it |
12 | under the terms of the GNU Affero General Public License |
13 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
14 | |
15 | CiviCRM is distributed in the hope that it will be useful, but |
16 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. |
19 | |
20 | You should have received a copy of the GNU Affero General Public |
21 | License and the CiviCRM Licensing Exception along |
22 | with this program; if not, contact CiviCRM LLC |
23 | at info[AT]civicrm[DOT]org. If you have questions about the |
24 | GNU Affero General Public License or the licensing of CiviCRM, |
25 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
26 +--------------------------------------------------------------------+
27*/
28
29/**
30 *
31 * @package CRM
32 * @copyright CiviCRM LLC (c) 2004-2013
33 * $Id$
34 *
35 */
36
4d1d7aca 37class CRM_Core_DAO_AllCoreTables {ldelim}
6b5ff8c9 38
fed67e4d
TO
39 static private $tables = null;
40 static private $daoToClass = null;
41
42 static private function init() {ldelim}
43 static $init = FALSE;
44 if ($init) return;
45
46 $entityTypes = array(
6b5ff8c9 47{foreach from=$tables key=tableName item=table}
fed67e4d
TO
48 '{$table.className}' => array(
49 'name' => '{$table.objectName}',
50 'class' => '{$table.className}',
51 'table' => '{$tableName}',
52 ),
53{/foreach}
54 );
6b5ff8c9 55
fed67e4d 56 CRM_Utils_Hook::entityTypes($entityTypes);
58d8ecd0 57
fed67e4d
TO
58 self::$tables = array();
59 self::$daoToClass = array();
60 foreach ($entityTypes as $entityType) {ldelim}
61 self::registerEntityType($entityType['name'], $entityType['class'], $entityType['table']);
62 {rdelim}
6b5ff8c9 63
fed67e4d
TO
64 $init = TRUE;
65 {rdelim}
66
67 static private function registerEntityType($daoName, $className, $tableName) {ldelim}
68 self::$daoToClass[$daoName] = $className;
69 self::$tables[$tableName] = $className;
70 {rdelim}
71
72 static public function tables() {ldelim}
73 self::init();
6b5ff8c9
ARW
74 return self::$tables;
75 {rdelim}
76
fed67e4d
TO
77 static public function daoToClass() {ldelim}
78 self::init();
79 return self::$daoToClass;
80 {rdelim}
81
82 static public function getCoreTables() {ldelim}
83 return self::tables();
84 {rdelim}
85
6b5ff8c9 86 static public function isCoreTable($tableName) {ldelim}
fed67e4d 87 return FALSE !== array_search($tableName, self::tables());
6b5ff8c9
ARW
88 {rdelim}
89
439a6148 90 static public function getClasses() {ldelim}
fed67e4d 91 return array_values(self::daoToClass());
439a6148
TO
92 {rdelim}
93
94 static public function getClassForTable($tableName) {ldelim}
fed67e4d 95 return CRM_Utils_Array::value($tableName, self::tables());
439a6148
TO
96 {rdelim}
97
6b5ff8c9 98 static public function getFullName($daoName) {ldelim}
fed67e4d 99 return CRM_Utils_Array::value($daoName, self::daoToClass());
6b5ff8c9
ARW
100 {rdelim}
101
edc091f1 102 static public function getBriefName($className) {ldelim}
fed67e4d 103 return CRM_Utils_Array::value($className, array_flip(self::daoToClass()));
edc091f1
ARW
104 {rdelim}
105
6b5ff8c9 106{rdelim}