19 declare(strict_types=1);
34 private array
$edit_actions = [ActionTarget::EDIT, ActionTarget::EMBED_EDIT];
35 private array
$view_actions = [ActionTarget::VIEW, ActionTarget::EMBED_VIEW];
47 fn(
ActionTarget $target):
string => $this->db->quote($target->value,
'text'),
61 if (isset($cache[$suffix][$implode_targets])) {
62 return $cache[$suffix][$implode_targets];
65 $query =
'SELECT * FROM ' 67 .
' WHERE ext = %s AND name IN(' . $implode_targets .
')';
69 $result = $this->db->queryF(
74 return $cache[$suffix][$implode_targets] = $result->numRows() > 0;
95 $query =
'SELECT * FROM ' 97 .
' WHERE ext = %s AND name = %s';
99 $result = $this->db->queryF($query, [
'text',
'text'], [strtolower($suffix), $action_target->value]);
100 $row = $this->db->fetchAssoc($result);
106 foreach ($this->edit_actions as $action_target) {
108 if ($action !==
null) {
117 foreach ($this->view_actions as $action_target) {
119 if ($action !==
null) {
129 $query =
'SELECT * FROM ' . self::TABLE_NAME;
130 $result = $this->db->query($query);
131 while ($row = $this->db->fetchAssoc($result)) {
139 $query =
'SELECT * FROM ' . self::TABLE_NAME .
' WHERE name = %s';
140 $result = $this->db->queryF($query, [
'text'], [$action_target->value]);
142 while ($row = $this->db->fetchAssoc($result)) {
151 foreach ($action_target as $target) {
159 $query =
'SELECT ext FROM ' 161 .
' WHERE name IN (' . $this->
implodeTargets(...$action_target) .
')';
162 $result = $this->db->query($query);
164 while ($row = $this->db->fetchAssoc($result)) {
165 $suffixes[] = $row[
'ext'];
173 $query =
'SELECT * FROM ' . self::TABLE_NAME .
' WHERE app_id = %s';
174 $result = $this->db->queryF($query, [
'integer'], [$app->
getId()]);
175 while ($row = $this->db->fetchAssoc($result)) {
185 (
string) $row[
'name'],
186 (
string) $row[
'ext'],
187 new URI((
string) $row[
'urlsrc']),
188 empty($row[
'url_appendix']) ?
null : (
string) $row[
'url_appendix'],
189 empty($row[
'target_text']) ?
null : (
string) $row[
'target_text']
195 $query =
'DELETE FROM ' . self::TABLE_NAME;
196 $this->db->manipulate($query);
205 $query =
'DELETE FROM ' . self::TABLE_NAME .
' WHERE ' . $this->db->in(
'id', $collected_ids,
true,
'integer');
206 $this->db->manipulate($query);
217 $query =
'SELECT * FROM ' . self::TABLE_NAME .
' WHERE name = %s AND ext = %s AND target_ext = %s';
218 $result = $this->db->queryF(
220 [
'text',
'text',
'text'],
224 if ($this->db->numRows($result) > 0) {
225 $row = $this->db->fetchAssoc($result);
226 $action = $action->
withId((
int) $row[
'id']);
229 if ($this->db->queryF(
230 'SELECT * FROM ' . self::TABLE_NAME .
' WHERE id = %s',
233 )->numRows() === 0) {
234 $next_id = (
int) $this->db->nextId(self::TABLE_NAME);
235 $this->db->insert(self::TABLE_NAME, [
236 'id' => [
'integer', $next_id],
237 'name' => [
'text', $action->
getName()],
240 'app_id' => [
'integer', $for_app->
getId()],
244 $action = $action->
withId($next_id);
246 $this->db->update(self::TABLE_NAME, [
247 'name' => [
'text', $action->
getName()],
250 'app_id' => [
'integer', $for_app->
getId()],
254 'id' => [
'integer', $action->
getId()],
getActionsForApp(App $app)
implodeTargets(ActionTarget ... $targets)
clearSuperfluous(Action ... $actions)
hasEditActionForSuffix(string $suffix)
hasViewActionForSuffix(string $suffix)
getViewActionForSuffix(string $suffix)
store(Action $action, App $for_app)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
getActionsForTargets(ActionTarget ... $action_target)
ActionTarget
Officialy supported action targets, see https://learn.microsoft.com/en-us/openspecs/office_protocols/...
hasActionForSuffix(string $suffix, ActionTarget ... $action_target)
getActionsForTarget(ActionTarget $action_target)
getSupportedSuffixes(ActionTarget ... $action_target)
getEditActionForSuffix(string $suffix)
getActionForSuffix(string $suffix, ActionTarget $action_target)
__construct(private \ilDBInterface $db)