Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
xml_user_bridge_edit_fns.inc
1 <?php
18 require_once SQ_INCLUDE_PATH.'/asset_edit/asset_edit_fns.inc';
19 require_once SQ_FUDGE_PATH.'/datetime_field/datetime_field.inc';
20 require_once SQ_ATTRIBUTES_PATH.'/option_list/option_list.inc';
21 
33 {
34 
35 
42  function __construct()
43  {
44  parent::__construct();
45  $this->static_screens = Array(
46  'details' => Array(
47  'name' => 'Details',
48  'force_unlock' => TRUE,
49  'lock_type' => 'attributes',
50  ),
51  );
52 
53  }//end constructor
54 
55 
66  function paintUserTypeChooser(&$asset, &$o, $prefix)
67  {
68  $user_type_codes = array_diff($GLOBALS['SQ_SYSTEM']->am->getTypeDescendants('user', TRUE), Array('root_user'));
69 
70  $user_names = $GLOBALS['SQ_SYSTEM']->am->getTypeInfo($user_type_codes, 'name');
71  if ($asset->writeAccess('attributes')) {
72  combo_box($prefix.'_user_type', $user_names, FALSE, $asset->attr('user_type'));
73  return TRUE;
74  } else {
75  echo $user_names[$asset->attr('user_type')];
76  return FALSE;
77  }
78 
79  }//end paintUserTypeChooser()
80 
81 
92  function processUserTypeChooser(&$asset, &$o, $prefix)
93  {
94  if (!empty($_POST[$prefix.'_user_type'])) {
95  $user_type_codes = array_diff($GLOBALS['SQ_SYSTEM']->am->getTypeDescendants('user', TRUE), Array('root_user'));
96  if (in_array($_POST[$prefix.'_user_type'], $user_type_codes)) {
97  return $asset->setAttrValue('user_type', $_POST[$prefix.'_user_type']);
98  }
99  }
100  return FALSE;
101 
102  }//end processUserTypeChooser()
103 
104 
115  function paintXMLFormat(&$asset, &$o, $prefix)
116  {
117  $o->openField('');
118  ?>
119  <p>The required format for the source XML file is shown in <a href="<?php echo sq_web_path('data'); ?>/asset_types/xml_user_bridge/files/user_bridge_example.xml">this example file</a>. The attributes of the 'user' node must include 'id' and may include any of the attributes of the asset type selected above</p>
120  <?php
121  $o->closeField();
122 
123  }//end paintXMLFormat()
124 
125 
126 }//end class
127 ?>