~oh-dev/openhealth/phit-tools

« back to all changes in this revision

Viewing changes to ihris-suite/lib/i2ce/modules/SwissFactory/lib/I2CE_Swiss_Default.php

  • Committer: litlfred at ibiblio
  • Date: 2009-10-26 13:55:16 UTC
  • Revision ID: litlfred@ibiblio.org-20091026135516-7er0260tad01febt
ihris suite updated to 4.0.1 pre-release...
follows that did not get added on the last attempt did this time... the problem is that bzr does not like to include branches in a sub-directory even if you add them in which 
  is how ihris-suite/lib/* was structed.  so i had to move ihris-suite/lib/*/.bzr to ihris-suite/lib/*/.bzr_dir to trick it
the site will now succesfully install.  have not attempted change the root drive letter yet

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
/**
 
3
 * @copyright © 2008, 2009 Intrahealth International, Inc.
 
4
 * This File is part of I2CE
 
5
 *
 
6
 * I2CE is free software; you can redistribute it and/or modify it
 
7
 * under the terms of the GNU General Public License as published by
 
8
 * the Free Software Foundation; either version 3 of the License, or
 
9
 * (at your option) any later version.
 
10
 * 
 
11
 * This program is distributed in the hope that it will be useful,
 
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
 * GNU General Public License for more details.
 
15
 * 
 
16
 * You should have received a copy of the GNU General Public License
 
17
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
18
*/
 
19
/**
 
20
*  I2CE_Swiss_Default
 
21
* @package I2CE
 
22
* @subpackage Core
 
23
* @author Carl Leitner <litlfred@ibiblio.org>
 
24
* @version 2.1
 
25
* @access public
 
26
*/
 
27
 
 
28
 
 
29
class I2CE_Swiss_Default extends I2CE_Swiss_Default_Base{
 
30
 
 
31
 
 
32
 
 
33
    protected function displayValues($contentNode,$transient_options,$action) {
 
34
        $this->template->addHeaderLink('swiss_default.css');
 
35
        $showExpert =  $this->factory->getStoredOptions('expert');
 
36
        $node = $this->template->appendFileByNode("configuration_main.html",'div',$contentNode);
 
37
        $displayName = $this->storage->getAttribute('displayName');
 
38
        if (!$displayName) { //the display name has not been set.  set it to the name of this configuration(Group) node
 
39
            $displayName = self::humanText($this->storage->getName());
 
40
        }
 
41
        $this->template->setDisplayDataImmediate('displayName',$this->getDisplayName(),$node);
 
42
        $this->template->setDisplayDataImmediate('description',$this->getDescription(),$node);        
 
43
 
 
44
 
 
45
        $configurationListNode = $this->template->getElementById('configuration_options',$node);
 
46
        if (!$configurationListNode instanceof DOMNode) {
 
47
            I2CE::raiseError ("No place to add scalars");
 
48
            return false;
 
49
        }
 
50
        $configurationGroupListNode = $this->template->getElementById('configurationGroup_options',$node);
 
51
        if (!$configurationGroupListNode instanceof DOMNode) {
 
52
            I2CE::raiseError ("No place to add parents");
 
53
            return false;
 
54
        }
 
55
        if ($this->path == '/') {
 
56
            $path = '';
 
57
        } else {
 
58
            $path = $this->path;
 
59
        }            
 
60
        $added = false;
 
61
        $children = $this->getChildNames();
 
62
        if (!array_key_exists('leaf_as_link',$transient_options)) {
 
63
            $mod_factory = I2CE_ModuleFactory::instance();
 
64
            $transient_options['leaf_as_link'] =  ($mod_factory->isEnabled('stub') && $this->template->hasAjax());
 
65
        }
 
66
        foreach ($children as $child) {
 
67
            $swissChild = $this->factory->getSwiss($this->path,$child);
 
68
            if (!$swissChild instanceof I2CE_Swiss) {
 
69
                continue;
 
70
            }
 
71
            $childStorage = $swissChild->getStorage();
 
72
            if ($childStorage->is_indeterminate()) {
 
73
                continue;
 
74
            }
 
75
            if ($swissChild->getStatus('visible') === false) {
 
76
                continue;
 
77
            }
 
78
            if ( (!$showExpert) && ($swissChild->getStatus('advanced') !== false)) {
 
79
                continue;
 
80
            }            
 
81
            if ( ($swissChild instanceof I2CE_Swiss_Default_Leaf )
 
82
                && ! (array_key_exists('leaf_as_link',$transient_options) && $transient_options['leaf_as_link'])) {
 
83
                if (!$swissChild->displayValue($configurationListNode,$transient_options, $action)) {
 
84
                    continue;
 
85
                }
 
86
                $added = true;
 
87
            } else  {
 
88
                $gNode = $this->template->appendFileByNode("configurationGroup_default.html","li",$configurationGroupListNode);
 
89
                if (!$gNode instanceof DOMNode) {
 
90
                    I2CE::raiseError("Cannot append configurationGroup_default.html");
 
91
                    continue;
 
92
                }
 
93
                $swissChild->addAjaxLink('configurationGroup_link','configuration_main_contents','configurationGroup_link_ajax',$gNode,$action);
 
94
                $added = true;
 
95
            }
 
96
        }
 
97
        if (!$added && $node instanceof DOMNode) {
 
98
            $this->template->removeNode($node);
 
99
        }
 
100
        return true;
 
101
            
 
102
    }
 
103
 
 
104
 
 
105
 
 
106
 
 
107
 
 
108
 
 
109
 
 
110
 
 
111
}
 
112
# Local Variables:
 
113
# mode: php
 
114
# c-default-style: "bsd"
 
115
# indent-tabs-mode: nil
 
116
# c-basic-offset: 4
 
117
# End: