17 require_once SQ_INCLUDE_PATH.
'/general_occasional.inc';
18 require_once SQ_CORE_PACKAGE_PATH.
'/system/triggers/trigger_action/trigger_action.inc';
51 public static function execute($settings, &$state)
53 if (empty($state[
'asset'])) {
55 if (empty($state[
'assetid'])) {
58 $state[
'asset'] = $GLOBALS[
'SQ_SYSTEM']->am->getAsset($state[
'assetid']);
63 switch ($settings[
'release_type']) {
65 if (!$GLOBALS[
'SQ_SYSTEM']->am->releaseLock($state[
'asset']->id,
'all')) {
72 if ($state[
'asset'] instanceof
User) {
73 $state[
'asset']->releaseUserLocks();
82 'assetid' => $state[
'asset']->
id,
98 public static function getInterface($settings, $prefix, $write_access=FALSE)
101 $lock_type = array_get_index($settings,
'release_type',
'on_asset');
103 if (!$write_access) {
104 $form_element_extras =
'disabled="disabled"';
106 $form_element_extras =
'';
110 echo
'<ul style="margin: 0; list-style: none">';
112 echo radio_button($prefix.
'[release_type]',
'on_asset', ($lock_type ==
'on_asset'),
'', $form_element_extras);
113 echo translate(
'trigger_action_release_lock_on_asset');
116 echo radio_button($prefix.
'[release_type]',
'held', ($lock_type ==
'held'),
'', $form_element_extras);
117 echo translate(
'trigger_action_release_lock_held');
120 $interface = ob_get_clean();
140 $release_type = array_get_index($request_data,
'release_type', FALSE);
141 if (!$release_type)
return 'Release type has not been specified';
143 $release_list = Array(
144 'on_asset' =>
'Release Locks on Asset',
145 'held' =>
'Release Locks Held by Asset',
149 if (isset($release_list[$release_type])) {
150 $settings[
'release_type'] = $release_type;
153 return 'Specified release type is invalid';
168 public static function getLocks($settings, &$state)
170 return Array($state[
'assetid'] => Array(
'permissions'));