1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12:
13:
14: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
15:
16: 17: 18: 19: 20: 21: 22: 23:
24: class WorkflowActions extends ItemCollection {
25: 26: 27: 28: 29:
30: public function __construct() {
31: global $cfg;
32: parent::__construct($cfg["tab"]["workflow_actions"], "idworkflowaction");
33: $this->_setItemClass("WorkflowAction");
34: }
35:
36: 37: 38: 39: 40: 41:
42: public function get($idworkflowitem, $action) {
43: $this->select("idworkflowitem = " . (int) $idworkflowitem . " AND action = '" . $this->escape($action) . "'");
44: if ($this->next()) {
45: return true;
46: } else {
47: return false;
48: }
49: }
50:
51: 52: 53:
54: public function getAvailableWorkflowActions() {
55: $availableWorkflowActions = array(
56: "publish" => i18n("Publish article", "workflow"),
57: "lock" => i18n("Lock article", "workflow"),
58: "last" => i18n("Move back to last editor", "workflow"),
59: "reject" => i18n("Reject article", "workflow"),
60: "articleedit" => i18n("Edit article content", "workflow"),
61: "propertyedit" => i18n("Edit article properties", "workflow"),
62: "templateedit" => i18n("Edit template", "workflow"),
63: "revise" => i18n("Revise article", "workflow")
64: );
65:
66: return ($availableWorkflowActions);
67: }
68:
69: 70: 71: 72: 73: 74: 75: 76:
77: public function set($idworkflowitem, $action) {
78: $this->select("idworkflowitem = " . (int) $idworkflowitem . " AND action = '" . $this->escape($action) . "'");
79: if (!$this->next()) {
80: $newitem = $this->createNewItem();
81: $newitem->setField("idworkflowitem", $idworkflowitem);
82: $newitem->setField("action", $action);
83: $newitem->store();
84: }
85: }
86:
87: 88: 89: 90: 91: 92: 93: 94:
95: public function remove($idworkflowitem, $action) {
96: $this->select("idworkflowitem = " . (int) $idworkflowitem . " AND action = '" . $this->escape($action) . "'");
97: if (($item = $this->next()) !== false) {
98: $this->delete($item->getField("idworkflowaction"));
99: }
100: }
101:
102: 103: 104: 105: 106: 107: 108: 109:
110: public function select($where = "", $group_by = "", $order_by = "", $limit = "") {
111: global $client;
112:
113: return parent::select($where, $group_by, $order_by, $limit);
114: }
115:
116: }
117:
118: 119: 120: 121: 122: 123: 124: 125: 126: 127:
128: class WorkflowAction extends Item {
129:
130: 131: 132:
133: public function __construct() {
134: global $cfg;
135:
136: parent::__construct($cfg["tab"]["workflow_actions"], "idworkflowaction");
137: }
138:
139: }
140: