Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
asset_status_approved.inc
1 <?php
17 require_once SQ_INCLUDE_PATH.'/asset_status/asset_status.inc';
18 
34 {
35 
36 
42  function Asset_Status_Approved($owner)
43  {
44  $this->Asset_Status($owner);
45  $this->status_tag = SQ_STATUS_APPROVED;
46 
47  }//end constructor
48 
49 
57  public static function getDescription()
58  {
59  return translate('status_approved');
60 
61  }//end getDescription()
62 
63 
71  function getAvailableStatii()
72  {
73  $statii = Array();
74 
75  // cant do anything without admin access
76  if (!$this->owner->adminAccess('')) return $statii;
77 
78  $wfm = $GLOBALS['SQ_SYSTEM']->getWorkflowManager();
79  $running_schemas = $wfm->getSchemas($this->owner->id, true, true);
80 
81  if (!empty($running_schemas)) {
82  // workflow is currently running, but it should not be
83  // because APPROVED means workflow is finished
84  pre_echo('FIXME: SOMETHING HAS GONE WRONG HERE');
85  } else {
86  // workflow is not currently running for this asset
87  $statii[SQ_STATUS_LIVE] = translate('status_change_make_live');
88  $statii[SQ_STATUS_UNDER_CONSTRUCTION] = translate('status_change_reject_changes');
89  }//end if workflow running
90 
91  return $statii;
92 
93  }//end getAvailableStatii()
94 
95 
106  function processStatusChange($new_status, $update_parent=true)
107  {
108  if (!parent::processStatusChange($new_status, $update_parent)) {
109  return false;
110  }
111 
112  if ($new_status == SQ_STATUS_LIVE) {
113  // notify people that the asset has gone live
114  $wfm = $GLOBALS['SQ_SYSTEM']->getWorkflowManager();
115  if (!$wfm->notifyOnLive($this->owner->id, $this->status_tag)) {
116  return false;
117  }
118 
119  // update the last published date
120  if (!$this->owner->setDate('published', time())) {
121  return false;
122  }
123  }
124 
125  return true;
126 
127  }//end processStatusChange()
128 
129 
130 }//end class
131 
132 ?>