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: class WorkflowActions extends ItemCollection {
23:
24: 25: 26:
27: public function __construct() {
28: global $cfg;
29: parent::__construct($cfg["tab"]["workflow_actions"], "idworkflowaction");
30: $this->_setItemClass("WorkflowAction");
31: }
32:
33: public function get($idworkflowitem, $action) {
34: $this->select("idworkflowitem = " . (int) $idworkflowitem . " AND action = '" . $this->escape($action) . "'");
35: if ($this->next()) {
36: return true;
37: } else {
38: return false;
39: }
40: }
41:
42: public function getAvailableWorkflowActions() {
43: $availableWorkflowActions = array(
44: "publish" => i18n("Publish article", "workflow"),
45: "lock" => i18n("Lock article", "workflow"),
46: "last" => i18n("Move back to last editor", "workflow"),
47: "reject" => i18n("Reject article", "workflow"),
48: "articleedit" => i18n("Edit article content", "workflow"),
49: "propertyedit" => i18n("Edit article properties", "workflow"),
50: "templateedit" => i18n("Edit template", "workflow"),
51: "revise" => i18n("Revise article", "workflow")
52: );
53:
54: return ($availableWorkflowActions);
55: }
56:
57: public function set($idworkflowitem, $action) {
58: $this->select("idworkflowitem = " . (int) $idworkflowitem . " AND action = '" . $this->escape($action) . "'");
59: if (!$this->next()) {
60: $newitem = $this->createNewItem();
61: $newitem->setField("idworkflowitem", $idworkflowitem);
62: $newitem->setField("action", $action);
63: $newitem->store();
64: }
65: }
66:
67: public function remove($idworkflowitem, $action) {
68: $this->select("idworkflowitem = " . (int) $idworkflowitem . " AND action = '" . $this->escape($action) . "'");
69: if (($item = $this->next()) !== false) {
70: $this->delete($item->getField("idworkflowaction"));
71: }
72: }
73:
74: public function select($where = "", $group_by = "", $order_by = "", $limit = "") {
75: global $client;
76:
77: return parent::select($where, $group_by, $order_by, $limit);
78: }
79:
80: }
81:
82: 83: 84: 85: 86: 87: 88: 89: 90: 91:
92: class WorkflowAction extends Item {
93:
94: 95: 96:
97: public function __construct() {
98: global $cfg;
99:
100: parent::__construct($cfg["tab"]["workflow_actions"], "idworkflowaction");
101: }
102:
103: }
104:
105: ?>