17 require_once SQ_CORE_PACKAGE_PATH.
'/folder/folder.inc';
42 parent::__construct($assetid);
72 $GLOBALS[
'SQ_SYSTEM']->am->includeAsset(
'workflow_stream');
74 $new_stream->setAttrValue(
'name',
'Default Stream');
78 'link_type' => SQ_LINK_TYPE_2,
79 'value' =>
'default_stream',
80 'is_exclusive' => TRUE,
81 'is_dependant' => FALSE,
84 if (!$new_stream->create($link_info)) {
102 $lock_types = parent::lockTypes();
103 $lock_types[
'content'] = ($lock_types[
'attributes'] | $lock_types[
'links']);
119 SQ_LINK_TYPE_1 => Array(),
120 SQ_LINK_TYPE_2 => Array(
121 'workflow_stream' => Array(
123 'exclusive' => FALSE,
125 'workflow_step' => Array(
127 'exclusive' => FALSE,
130 SQ_LINK_TYPE_3 => Array(),
131 SQ_LINK_NOTICE => Array(),
157 public function prepareLink(
Asset $asset, $side_of_link, &$link_type, &$value, &$sort_order, &$dependant, &$exclusive)
160 if ($side_of_link ==
'major' && ($asset instanceof
Workflow_Stream) && $dependant !=
'1') {
197 public function delete($release_lock=TRUE, $check_locked=TRUE)
200 $wfm = $GLOBALS[
'SQ_SYSTEM']->getWorkflowManager();
201 $schema_treeids_sql =
'SELECT
202 assetid, granted, wflow
203 FROM (sq_ast_lnk_tree ta
204 JOIN sq_ast_lnk la ON ta.linkid = la.linkid
205 JOIN sq_ast_wflow wa ON la.minorid = wa.assetid)
206 WHERE wa.schemaid = :schemaid
208 SELECT * FROM (sq_ast_lnk_tree tb
209 JOIN sq_ast_lnk lb ON tb.linkid = lb.linkid
210 JOIN sq_ast_wflow wb ON lb.minorid = wb.assetid)
211 WHERE wb.schemaid = wa.schemaid
212 AND length(ta.treeid) - LENGTH(tb.treeid) = :tree_size
213 AND SUBSTR(ta.treeid, 1, LENGTH(ta.treeid) - :tree_size_1) = tb.treeid
214 AND wa.granted = wb.granted
215 AND wa.cascades = wb.cascades
225 $running_schema = FALSE;
226 $running_id = array();
227 foreach ($results as $index => $info) {
228 if(!empty($info[
'wflow'])) {
229 $running_schema = TRUE;
230 $running_id[] = $info[
'assetid'];
233 if($running_schema) {
234 trigger_error(
'Purged Workflow Schema Id #'.$this->
id.
' is applied and running on assets with Id: '. implode(
', ', $running_id), E_USER_NOTICE);
240 foreach ($results as $index => $info) {
241 if(empty($info[
'wflow'])) {
242 $GLOBALS[
'SQ_SYSTEM']->setRunLevel(SQ_RUN_LEVEL_FORCED);
243 $wfm->deleteSchema($info[
'assetid'], $this->
id);
244 $GLOBALS[
'SQ_SYSTEM']->restoreRunLevel();
248 trigger_error(
'Purged Workflow Schema Id #'.$this->
id.
' is applied and running on Asset Id #'.$info[
'assetid'].
'.', E_USER_NOTICE);
254 if(!parent::delete($release_lock, $check_locked)) {