check_ticket('g-monitor-instances'); $processMonitor->remove_aborted(); } if (isset($_REQUEST['remove_all'])) { check_ticket('g-monitor-instances'); $processMonitor->remove_all($_REQUEST['filter_process']); } if (isset($_REQUEST['sendInstance'])) { check_ticket('g-monitor-instances'); //activityId indicates the activity where the instance was //and we have to send it to some activity to be determined include_once 'lib/Galaxia/src/API/Instance.php'; $instance = new Instance($dbTiki); $instance->getInstance($_REQUEST['sendInstance']); // Do not add a workitem since the instance must be already completed! $instance->complete($_REQUEST['activityId'], true, false); unset($instance); } if (isset($_REQUEST['filter_status']) && $_REQUEST['filter_status']) { $wheres[] = "gi.status='" . $_REQUEST['filter_status'] . "'"; } if (isset($_REQUEST['filter_process']) && $_REQUEST['filter_process']) { $wheres[] = "gi.pId=" . $_REQUEST['filter_process'] . ""; } if (isset($_REQUEST['filter_instanceName']) && $_REQUEST['filter_instanceName']) { $wheres[] = "gi.name='" . $_REQUEST['filter_instanceName'] . "'"; } if (isset($_REQUEST['filter_owner']) && $_REQUEST['filter_owner']) { $wheres[] = "owner='" . $_REQUEST['filter_owner'] . "'"; } $where = implode(' and ', $wheres);
function gui_send_instance($user, $activityId, $instanceId) { if (!$this->getOne("select count(*)\n from " . GALAXIA_TABLE_PREFIX . "instance_activities\n where activityId=? and instanceId=? and user=?", array($activityId, $instanceId, $user)) || $this->getOne("select count(*) \n from " . GALAXIA_TABLE_PREFIX . "instance_activities gia\n INNER JOIN " . GALAXIA_TABLE_PREFIX . "activity_roles gar ON gar.activityId=gia.activityId\n INNER JOIN " . GALAXIA_TABLE_PREFIX . "user_roles gur ON gar.roleId=gur.roleId\n where gia.instanceId=? and gia.activityId=? and gia.user=? and gur.user=?", array($instanceId, $activityId, '*', $user))) { return false; } include_once GALAXIA_LIBRARY . '/src/API/Instance.php'; $instance = new Instance($this->db); $instance->getInstance($instanceId); $instance->complete($activityId, true, false); unset($instance); }
function gui_send_instance($user_id, $activity_id, $instance_id) { if (!isset($user_id)) { galaxia_show_error("No user id"); } if (!$this->mDb->getOne("select count(*)\n from `" . GALAXIA_TABLE_PREFIX . "instance_activities`\n where `activity_id`=? and `instance_id`=? and `user_id`=?", array($activity_id, $instance_id, $user_id)) || $this->mDb->getOne("select count(*)\n from `" . GALAXIA_TABLE_PREFIX . "instance_activities` gia\n INNER JOIN `" . GALAXIA_TABLE_PREFIX . "activity_roles` gar ON gar.`activity_id`=gia.`activity_id`\n INNER JOIN `" . GALAXIA_TABLE_PREFIX . "group_roles` ggr ON gar.`role_id`=ggr.`role_id`\n\t\t INNER JOIN `" . BIT_DB_PREFIX . "users_groups_map` ugm ON ugm.`group_id`=ggr.`group_id`\n where gia.`instance_id`=? and gia.`activity_id`=? and gia.`user_id` is ? and ugm.`user_id`=?", array($instance_id, $activity_id, NULL, $user_id))) { return false; } include_once GALAXIA_LIBRARY . '/src/API/Instance.php'; $instance = new Instance(); $instance->getInstance($instance_id); $instance->complete($activity_id, true, false); unset($instance); }