18 require_once SQ_INCLUDE_PATH.
'/asset_edit/asset_edit_fns.inc';
41 parent::__construct();
42 unset($this->static_screens[
'workflow']);
43 unset($this->static_screens[
'metadataSchemas']);
44 unset($this->static_screens[
'metadata']);
62 $wfm = $GLOBALS[
'SQ_SYSTEM']->getWorkflowManager();
63 require_once SQ_LIB_PATH.
'/html_form/html_form.inc';
65 $cond_logic = $asset->
attr(
'logic');
66 $cond_logic_num = $asset->
attr(
'logic_num');
67 if (!$cond_logic_num) $cond_logic_num =
'';
69 $userid = $asset->
attr(
'userid');
71 $user_info = $GLOBALS[
'SQ_SYSTEM']->am->getAssetInfo(Array($userid), Array(
'user',
'user_group'), FALSE);
72 if (empty($user_info))
return FALSE;
75 <td
class=
"sq-backend-table-cell"><?php echo get_asset_tag_line($userid); ?></td>
76 <td
class=
"sq-backend-table-cell">
78 $notify = $asset->
attr(
'notify');
80 echo ($notify) ? translate(
'yes') : translate(
'no');
82 check_box($prefix.
'_notify',
'1', $notify);
86 <td
class=
"sq-backend-table-cell">
88 $require_comment = $asset->
attr(
'require_comment');
90 echo ($require_comment) ? translate(
'yes') : translate(
'no');
92 check_box($prefix.
'_require_comment',
'1', $require_comment);
96 <td
class=
"sq-backend-table-cell">
98 $user = $GLOBALS[
'SQ_SYSTEM']->am->getAsset($userid);
100 $user = $GLOBALS[
'SQ_SYSTEM']->am->getAsset($userid);
101 if (($user instanceof
User)) {
104 if (isset($wfm->_valid_cond_logic[$cond_logic])) {
105 echo
'<i>'.$wfm->_valid_cond_logic[$cond_logic];
106 if ($cond_logic_num) {
107 echo
' '.$cond_logic_num.
' group member'.(($cond_logic_num > 1) ?
's' :
'').
' must approve</i>';
112 if (($user instanceof
User)) {
113 hidden_field($prefix.
'_logic',
'>=');
114 hidden_field($prefix.
'_logic_num',
'1');
116 combo_box($prefix.
'_logic', $wfm->_valid_cond_logic, FALSE, $cond_logic);
120 text_box($prefix.
'_logic_num', $cond_logic_num, 4);
121 $text_box = ob_get_contents();
123 echo translate(
'members_must_approve', $text_box);
147 if (!$asset->
writeAccess(
'attributes'))
return FALSE;
151 $GLOBALS[
'SQ_SYSTEM']->changeDatabaseConnection(
'db2');
152 $GLOBALS[
'SQ_SYSTEM']->doTransaction(
'BEGIN');
154 $cond_logic = array_get_index($_POST, $prefix.
'_logic');
156 $GLOBALS[
'SQ_SYSTEM']->doTransaction(
'ROLLBACK');
157 $GLOBALS[
'SQ_SYSTEM']->restoreDatabaseConnection();
161 if (isset($_POST[$prefix.
'_logic_num']) && $cond_logic !=
'all') {
162 $cond_logic_num = (!empty($_POST[$prefix.
'_logic_num'])) ? (
int) $_POST[$prefix.
'_logic_num'] : 0;
166 if (!$asset->
setAttrValue(
'logic_num', $cond_logic_num)) {
167 $GLOBALS[
'SQ_SYSTEM']->doTransaction(
'ROLLBACK');
168 $GLOBALS[
'SQ_SYSTEM']->restoreDatabaseConnection();
172 $notify = (bool) array_get_index($_POST, $prefix.
'_notify', FALSE);
174 $GLOBALS[
'SQ_SYSTEM']->doTransaction(
'ROLLBACK');
175 $GLOBALS[
'SQ_SYSTEM']->restoreDatabaseConnection();
179 $require_comment = (bool) array_get_index($_POST, $prefix.
'_require_comment', FALSE);
180 if (!$asset->
setAttrValue(
'require_comment', $require_comment)) {
181 $GLOBALS[
'SQ_SYSTEM']->doTransaction(
'ROLLBACK');
182 $GLOBALS[
'SQ_SYSTEM']->restoreDatabaseConnection();
187 $GLOBALS[
'SQ_SYSTEM']->doTransaction(
'ROLLBACK');
188 $GLOBALS[
'SQ_SYSTEM']->restoreDatabaseConnection();
192 $GLOBALS[
'SQ_SYSTEM']->doTransaction(
'COMMIT');
193 $GLOBALS[
'SQ_SYSTEM']->restoreDatabaseConnection();
215 $logic = $asset->
attr(
'logic');
216 $logic_num = $asset->
attr(
'logic_num');
218 $wfm = $GLOBALS[
'SQ_SYSTEM']->getWorkflowManager();
219 if (in_array($logic, $wfm->_valid_logic_with_right_operand)) {
220 $logic = $logic.(($logic_num) ?
" $logic_num" :
' 0');
222 $logic = $logic.(($logic_num) ?
" $logic_num" :
'');
225 $publisher = $asset->
attr(
'userid');
226 $workflow_array[$publisher] = Array(
'logic' => $logic,
'published_by' => Array());
229 $workflow_array[$publisher][
'require_comment'] = $asset->
attr(
'require_comment');