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