Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
soap_api_edit_fns.inc
1 <?php
18 require_once SQ_INCLUDE_PATH.'/asset_edit/asset_edit_fns.inc';
19 
32 {
33 
34 
39  function __construct()
40  {
41  parent::__construct();
42 
43  }//end constructor
44 
45 
56  function paintFunctionList(&$asset, &$o, $prefix)
57  {
58  $am = $GLOBALS['SQ_SYSTEM']->am;
59  $admin_access = $asset->writeAccess('attributes');
60  $prefix = $asset->getPrefix();
61  $enabled_function_list = $asset->attr('function_list');
62  $function_list = $asset->getFunctionList();
63  ?>
64  <table class="sq-backend-table">
65  <tr>
66  <td class="sq-backend-table-header">
67  <?php echo translate('operations'); ?>
68  </td>
69  <td class="sq-backend-table-header">
70  <?php echo translate('enabled'); ?>
71  </td>
72  </tr>
73  <?php
74  foreach ($function_list as $func_name => $default) {
75  $switch = FALSE;
76  if (array_key_exists($func_name, $enabled_function_list)) {
77  if (isset($enabled_function_list[$func_name]) && $enabled_function_list[$func_name]) {
78  $switch = TRUE;
79  }
80  }
81  ?>
82  <tr>
83  <td class="sq-backend-table-cell">
84  <span name="<?php echo $prefix.'_'.$func_name ?>" id="<?php echo $prefix.'_'.$func_name ?>"><?php echo $func_name ?></span>
85  </td>
86  <td align="left" class="sq-backend-table-cell">
87  <?php
88  if ($admin_access) {
89  check_box($prefix.'_enable['.$func_name.']', '1', $switch);
90  } else {
91  ?>
92  &nbsp;
93  <img src="<?php echo sq_web_path('lib'); ?>/web/images/<?php echo ($switch) ? 'tick' : 'cross'; ?>.gif" width="15" height="15" />
94  <?php
95  }
96  ?>
97  </td>
98  </tr>
99  <?php
100  }//end foreach
101  ?>
102  </table>
103  <?php
104 
105  return TRUE;
106 
107  }//end paintFunctionList()
108 
109 
120  function processFunctionList(&$asset, &$o, $prefix)
121  {
122  $write_access = $asset->writeAccess('attributes');
123  $prefix = $asset->getPrefix();
124 
125  $regen_wsdl = FALSE;
126  if ($write_access) {
127  if (isset($_POST[$prefix.'_enable']) && !empty($_POST[$prefix.'_enable'])) {
128  $save_func_list = Array();
129  foreach ($_POST[$prefix.'_enable'] as $funcname => $enabled) {
130  if (empty($funcname)) continue;
131 
132  // Save the entry
133  $save_func_list[$funcname] = $enabled;
134  }
135 
136  if (!empty($save_func_list)) {
137  $regen_wsdl = TRUE;
138  $GLOBALS['SQ_SYSTEM']->setRunLevel(SQ_RUN_LEVEL_FORCED);
139  $asset->setAttrValue('function_list', $save_func_list);
140  $GLOBALS['SQ_SYSTEM']->restoreRunLevel();
141  }
142  } else {
143  // If it is not set then there is nothing enabled.
144  $empty_function_list = Array();
145  $regen_wsdl = TRUE;
146  $asset->setAttrValue('function_list', $empty_function_list);
147  $asset->saveAttributes();
148  }//end else
149  }
150  if ($regen_wsdl) {
151  $parents = $GLOBALS['SQ_SYSTEM']->am->getParents($asset->id, 'soap_server');
152  foreach ($parents as $parent_id => $type_code) {
153  $parent = $GLOBALS['SQ_SYSTEM']->am->getAsset($parent_id);
154  $parent->generateWSDL();
155  }//end foreach
156  //$asset->generateWSDL();
157  }//end if
158 
159  }//end processFunctionList()
160 
161 
162 }//end class
163 ?>