17 require_once SQ_INCLUDE_PATH.
'/asset_status/asset_status.inc';
51 assert_is_a($owner,
'Workflow_Bundle');
53 $this->status_tag = SQ_STATUS_PENDING_APPROVAL;
67 return translate(
'core_workflow_bundle_approving');
81 $available_statuses = Array();
102 if ($this->owner->adminAccess(
'') === TRUE) {
106 $wfm = $GLOBALS[
'SQ_SYSTEM']->getWorkflowManager();
107 $mm = $GLOBALS[
'SQ_SYSTEM']->getMetadataManager();
109 $our_asset_links = $GLOBALS[
'SQ_SYSTEM']->am->getLinks($this->owner->id, SQ_LINK_NOTICE);
110 foreach ($our_asset_links as $our_asset_link) {
112 if ($can_reject === FALSE) {
113 $asset = $GLOBALS[
'SQ_SYSTEM']->am->getAsset($our_asset_link[
'minorid']);
114 if ($asset->adminAccess(
'') === TRUE) {
117 $GLOBALS[
'SQ_SYSTEM']->am->forgetAsset($asset);
121 if ($can_approve === FALSE) {
122 $next_publishers = $wfm->whoCanPublish($our_asset_link[
'minorid']);
123 if (in_array($GLOBALS[
'SQ_SYSTEM']->currentUserId(), $next_publishers) !== FALSE) {
129 if ($can_complete === TRUE) {
130 if ($wfm->testPublish($our_asset_link[
'minorid'], $GLOBALS[
'SQ_SYSTEM']->currentUserId()) === FALSE) {
131 $can_complete = FALSE;
138 if ($can_complete === TRUE) {
139 $available_statuses[SQ_STATUS_APPROVED] = translate(
'status_change_approve');
140 }
else if ($can_approve === TRUE) {
141 $available_statuses[SQ_STATUS_PENDING_APPROVAL] = translate(
'status_change_approve_changes');
145 if ($can_reject === TRUE) {
146 $available_statuses[SQ_STATUS_UNDER_CONSTRUCTION] = translate(
'status_change_reject_changes');
149 return $available_statuses;