Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
dependants.inc
1 <?php
17 require_once SQ_LIB_PATH.'/html_form/html_form.inc';
18 
39 function paintDependants(&$owner, &$o, &$ei, $keywords=NULL)
40 {
41  // this line has been added to hide the dependant screen from the limbo mode
42  // there is some issues with the 'a' tags printing this screen in the simple edit mode
43  // the links are not right and they are not working
44  // a feature request should be to enable and fix this screen
45  if (SQ_IN_LIMBO) return FALSE;
46  $o->openSection(translate('current_lock_status'));
47  $o->openField('&nbsp;');
48 
49  $locks = $GLOBALS['SQ_SYSTEM']->am->getLockInfo($owner->id, 'all');
50  $locks_acquired = Array();
51  foreach ($locks as $lock_type => $lock) {
52  if (!empty($lock)) {
53  $locks_acquired[] = ucwords(str_replace('_', ' ', $lock_type));
54  }
55  }
56  $lock_message = '';
57  if (!empty($locks_acquired)) {
58  $lock_message = translate('locked_types', '<span style="color:red"><b>[', ']</b></span> (', implode(', ', $locks_acquired).')');
59  } else {
60  $lock_message = '<span style="color:green"><b>['.translate('unlocked').']</b></span>';
61  }
62 
63  ?>
64  <table cellpadding="0" cellspacing="0" border="0" width="100%">
65  <tr>
66  <td class="sq-backend-data">
67  <table cellpadding="0" cellspacing="0" border="0">
68  <tr>
69  <td class="sq-backend-data"><img src="<?php echo $o->filesPath('/images/blank.gif');?>" width="20" height="20" border="0" alt="" /></td>
70  <td class="sq-backend-data" nowrap="nowrap">
71  <!-- <a href="<?php echo $owner->getBackendHref('dependants'); ?>"><b><?php echo $owner->name; ?></b></a> -->
72  <?php echo get_asset_tag_line($owner->id, 'dependants'); ?>
73  </td>
74  </tr>
75  </table>
76  </td>
77  <td><img src="<?php echo $o->filesPath('/images/blank.gif');?>" width="5" height="1" border="0" alt="" /></td>
78  <td class="sq-backend-data" nowrap="nowrap">
79  <?php echo $lock_message; ?>
80  </td>
81  <td background="<?php echo $o->filesPath('/images/tree/stalk.gif'); ?>"><img src="<?php echo $o->filesPath('/images/blank.gif');?>" width="20" height="1" border="0" alt="" /></td>
82  <td class="sq-backend-data" colspan="3" nowrap="nowrap">
83  <?php echo $owner->getStatusDescription(); ?>
84  </td>
85  <td width="100%">&nbsp;</td>
86  </tr>
87  <?php _recursePaintDependants($owner, $owner, $o); ?>
88  </table>
89  <table>
90  <tr>
91  <td class="sq-backend-data"><span style="color:red"><b>*</b></span></td>
92  <td class="sq-backend-data">
93  <?php echo translate('status_dependence_higher', htmlspecialchars($owner->name, ENT_COMPAT, SQ_CONF_DEFAULT_CHARACTER_SET)); ?>
94  </td>
95  </tr>
96  <tr>
97  <td class="sq-backend-data"><span style="color:red"><b>**</b></span></td>
98  <td class="sq-backend-data">
99  <?php echo translate('status_dependence_lower', htmlspecialchars($owner->name, ENT_COMPAT, SQ_CONF_DEFAULT_CHARACTER_SET)); ?>
100  </td>
101  </tr>
102  </table>
103  <?php
104 
105  $o->closeSection();
106 
107  return FALSE;
108 
109 }//end paintDependants()
110 
111 
124 function _recursePaintDependants(&$owner, &$asset, &$o, $levels=1, $print_stalks_at=Array())
125 {
126  $dependant_links = $GLOBALS['SQ_SYSTEM']->am->getLinks($asset->id, SQ_SC_LINK_SIGNIFICANT, '', TRUE, 'major', NULL, 1);
127  $num_kids = count($dependant_links);
128  for ($i = 0; $i < $num_kids; $i++) {
129  $dep_asset = $GLOBALS['SQ_SYSTEM']->am->getAsset($dependant_links[$i]['minorid'], $dependant_links[$i]['minor_type_code']);
130  $end = ($i == $num_kids - 1);
131  $stalk = 'background="'.$o->filesPath('/images/tree/stalk.gif').'"';
132  $bg = ($end) ? '' : $stalk;
133 
134  $locks = $GLOBALS['SQ_SYSTEM']->am->getLockInfo($dep_asset->id, 'all');
135  $locks_acquired = Array();
136  foreach ($locks as $lock_type => $lock) {
137  if (!empty($lock)) {
138  $locks_acquired[] = ucwords(str_replace('_', ' ', $lock_type));
139  }
140  }
141  $lock_message = '';
142  if (!empty($locks_acquired)) {
143  $lock_message = translate('locked_types', '<span style="color:red"><b>[', ']</b></span> (', implode(', ', $locks_acquired).')');
144  } else {
145  $lock_message = '<span style="color:green"><b>['.translate('unlocked').']</b></span>';
146  }
147 
148  $status_message = '';
149  if ($dep_asset->status < $owner->status) {
150  $status_message = '<span style="color:red"><b>**</b></span>';
151  } else if ($dep_asset->status > $owner->status) {
152  $status_message = '<span style="color:red"><b>*</b></span>';
153  }
154 
155  $new_print_stalks_at = Array();
156 
157  ?>
158  <tr>
159  <td class="sq-backend-data">
160  <table cellpadding="0" cellspacing="0" border="0">
161  <tr>
162  <?php
163  for ($x = 0; $x < $levels; $x++) {
164  $stalk_bg = '';
165  if (in_array($x, $print_stalks_at)) {
166  $stalk_bg = $stalk;
167  $new_print_stalks_at[] = $x;
168  }
169  ?>
170  <td class="sq-backend-data" <?php echo $stalk_bg; ?>><img src="<?php echo $o->filesPath('/images/blank.gif'); ?>" width="20" height="1" alt="blank" /></td>
171  <?php
172  }
173  ?>
174  <td class="sq-backend-data" <?php echo $bg; ?>><img src="<?php echo $o->filesPath('/images/tree/branch.gif');?>" width="20" height="20" border="0" alt="branch" /></td>
175  <td class="sq-backend-data" nowrap="nowrap">
176  &nbsp;
177  <?php
178  echo get_asset_tag_line($dependant_links[$i]['minorid'], 'dependants'); ?>
179  <!-- <a href="<?php echo $dep_asset->getBackendHref('dependants'); ?>"><b><?php echo $dep_asset->name; ?></b></a> -->
180  </td>
181  </tr>
182  </table>
183  </td>
184  <td><img src="<?php echo $o->filesPath('/images/blank.gif');?>" width="5" height="1" border="0" alt="" /></td>
185  <td class="sq-backend-data" nowrap="nowrap">
186  <?php echo $lock_message; ?>
187  </td>
188  <td background="<?php echo $o->filesPath('/images/tree/stalk.gif'); ?>"><img src="<?php echo $o->filesPath('/images/blank.gif');?>" width="20" height="1" border="0" alt="" /></td>
189  <td class="sq-backend-data" nowrap="nowrap">
190  <?php echo $dep_asset->getStatusDescription(); ?>
191  </td>
192  <td><img src="<?php echo $o->filesPath('/images/blank.gif');?>" width="5" height="1" border="0" alt="" /></td>
193  <td class="sq-backend-data" nowrap="nowrap">
194  <?php echo $status_message; ?>
195  </td>
196  </tr>
197  <?php
198  $child_deps = $GLOBALS['SQ_SYSTEM']->am->getLinks($dep_asset->id, SQ_SC_LINK_SIGNIFICANT, '', TRUE, 'major', NULL, 1);
199 
200  if (!empty($bg)) $new_print_stalks_at[] = $levels;
201 
202  if (!empty($child_deps)) {
203  _recursePaintDependants($owner, $dep_asset, $o, ($levels+1), $new_print_stalks_at);
204  }
205  }//end for
206 
207 }//end _recursePaintDependants()
208 
209 
221 function processDependants(&$owner, &$o, &$ei)
222 {
223  return FALSE;
224 
225 }//end processDependants()
226 
227 
228 ?>