Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add Status field per service (choice_status) #44

Merged
merged 1 commit into from
Aug 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions install.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
->ensureColumn(new rex_sql_column('rex_domain', 'varchar(191)'))
->ensureColumn(new rex_sql_column('script', 'text'))
->ensureColumn(new rex_sql_column('updatedate', 'datetime'))
->ensureColumn(new rex_sql_column('status', 'tinyint(1)'))
->ensureIndex(new rex_sql_index('group', ['group']))
->ensure();

Expand Down
63 changes: 44 additions & 19 deletions install/rex_wenns_sein_muss_service.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,19 @@
{
"table_name": "rex_wenns_sein_muss_service",
"prio": 4,
"type_id": "validate",
"type_name": "empty",
"db_type": "",
"list_hidden": 1,
"search": 0,
"name": "service",
"label": "",
"not_required": "",
"message": "Geben Sie einen Namen an"
},
{
"table_name": "rex_wenns_sein_muss_service",
"prio": 5,
"type_id": "value",
"type_name": "html",
"db_type": "none",
Expand All @@ -90,7 +103,7 @@
},
{
"table_name": "rex_wenns_sein_muss_service",
"prio": 5,
"prio": 6,
"type_id": "value",
"type_name": "text",
"db_type": "varchar(191)",
Expand All @@ -108,7 +121,7 @@
},
{
"table_name": "rex_wenns_sein_muss_service",
"prio": 6,
"prio": 7,
"type_id": "value",
"type_name": "text",
"db_type": "varchar(191)",
Expand All @@ -126,7 +139,7 @@
},
{
"table_name": "rex_wenns_sein_muss_service",
"prio": 7,
"prio": 8,
"type_id": "value",
"type_name": "text",
"db_type": "varchar(191)",
Expand All @@ -144,7 +157,7 @@
},
{
"table_name": "rex_wenns_sein_muss_service",
"prio": 8,
"prio": 9,
"type_id": "value",
"type_name": "html",
"db_type": "none",
Expand All @@ -157,7 +170,7 @@
},
{
"table_name": "rex_wenns_sein_muss_service",
"prio": 9,
"prio": 10,
"type_id": "value",
"type_name": "be_manager_relation",
"db_type": "int(10) unsigned",
Expand All @@ -179,7 +192,7 @@
},
{
"table_name": "rex_wenns_sein_muss_service",
"prio": 10,
"prio": 11,
"type_id": "value",
"type_name": "domain",
"db_type": "varchar(191)",
Expand All @@ -193,7 +206,7 @@
},
{
"table_name": "rex_wenns_sein_muss_service",
"prio": 11,
"prio": 12,
"type_id": "value",
"type_name": "html",
"db_type": "none",
Expand All @@ -206,7 +219,7 @@
},
{
"table_name": "rex_wenns_sein_muss_service",
"prio": 12,
"prio": 13,
"type_id": "value",
"type_name": "be_manager_relation",
"db_type": "varchar(191)",
Expand All @@ -228,7 +241,7 @@
},
{
"table_name": "rex_wenns_sein_muss_service",
"prio": 13,
"prio": 14,
"type_id": "value",
"type_name": "textarea",
"db_type": "text",
Expand All @@ -244,20 +257,32 @@
},
{
"table_name": "rex_wenns_sein_muss_service",
"prio": 14,
"type_id": "validate",
"type_name": "empty",
"db_type": "",
"list_hidden": 1,
"search": 0,
"name": "service",
"label": "",
"prio": 15,
"type_id": "value",
"type_name": "choice_status",
"db_type": "tinyint(1)",
"list_hidden": 0,
"search": 1,
"name": "status",
"label": "translate:wsm_service_status",
"not_required": "",
"message": "Geben Sie einen Namen an"
"multiple": "0",
"expanded": "0",
"choices": "Alexplusde\\Wsm\\Service::getStatusOptions",
"choice_attributes": "",
"attributes": "",
"default": "0",
"no_db": "0",
"notice": "",
"preferred_choices": "",
"group_by": "",
"placeholder": "",
"group_attributes": "",
"choice_label": ""
},
{
"table_name": "rex_wenns_sein_muss_service",
"prio": 15,
"prio": 16,
"type_id": "value",
"type_name": "datestamp",
"db_type": "datetime",
Expand Down
3 changes: 3 additions & 0 deletions lang/de_de.lang
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ wsm_service_iframe = Iframe-Manager
wsm_service_domain = Domain(s)
wsm_service_entry_ids = Cookies, LocalStorage und Tracking-Bilder
wsm_service_script = JavaScript (nach Einwilligung)
wsm_service_status = Status
wsm_service_status_draft = Entwurf
wsm_service_status_published = Veröffentlicht

wsm_group_name = Name
wsm_group_title = Titel
Expand Down
219 changes: 119 additions & 100 deletions lib/Service.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,16 @@
namespace Alexplusde\Wsm;

use rex_yform_manager_collection;
use yrewrite_domain;
use rex_yform_manager_dataset;
use rex_yrewrite;

class Service extends \rex_yform_manager_dataset
{

const STATUS_OPTIONS = [
0 => 'translate:wsm_service_status_draft',
1 => 'translate:wsm_service_status_published',
];
public function getName() :string
{
return $this->getService();
Expand All @@ -25,102 +29,117 @@ public static function findServices(int $group_id): rex_yform_manager_collection
return self::query()->whereRaw('`group` = '.$group_id.' AND (FIND_IN_SET(0, `rex_domain`) || FIND_IN_SET('.wsm::getDomainId() .', `rex_domain`))')->find();
}

/* Gruppe */
/** @api */
public function getGroup() : ?rex_yform_manager_dataset {
return $this->getRelatedDataset("group");
}

/* Name */
/** @api */
public function getService() : ?string {
return $this->getValue("service");
}
/** @api */
public function setService(mixed $value) : self {
$this->setValue("service", $value);
return $this;
}

/* Name des Unternehmens */
/** @api */
public function getCompanyName() : ?string {
return $this->getValue("company_name");
}
/** @api */
public function setCompanyName(string $value) : self {
$this->setValue("company_name", $value);
return $this;
}

/* Anschrift */
/** @api */
public function getCompanyAddress() : ?string {
return $this->getValue("company_address");
}
/** @api */
public function setCompanyAddress(string $value) : self {
$this->setValue("company_address", $value);
return $this;
}

/* Datenschutzerklärung */
/** @api */
public function getPrivacyPolicyUrl() : ?string {
return $this->getValue("privacy_policy_url");
}
/** @api */
public function setPrivacyPolicyUrl(string $value) : self {
$this->setValue("privacy_policy_url", $value);
return $this;
}

/* Iframe-Manager */
/** @api */
public function getIframe() : ?rex_yform_manager_dataset {
return $this->getRelatedDataset("iframe");
}

/* Domain(s) */
/** @api */
public function getRexDomain() : ? \rex_yrewrite_domain {
return rex_yrewrite::getDomainById($this->getValue("rex_domain"));
}
/** @api */
public function getRexDomainId() : ?int {
return $this->getValue("rex_domain");
}
/** @api */
public function setRexDomain(int $value) : self {
$this->setValue("rex_domain", $value);
return $this;
}

/* Cookies, LocalStorage und Tracking-Bilder */
/** @api */
public function getEntry() : ?rex_yform_manager_collection {
return $this->getRelatedCollection("entry_ids");
}

/* JavaScript (nach Einwilligung) */
/** @api */
public function getScript() : ?string {
return $this->getValue("script");
}
/** @api */
public function setScript(string $value) : self {
$this->setValue("script", $value);
return $this;
}

/* Aktualisiert am... */
/** @api */
public function getUpdatedate() : ?string {
return $this->getValue("updatedate");
}
/** @api */
public function setUpdatedate(string $value) : self {
$this->setValue("updatedate", $value);
return $this;
}
}
/* Gruppe */
/** @api */
public function getGroup() : ?rex_yform_manager_dataset {
return $this->getRelatedDataset("group");
}

/* Name */
/** @api */
public function getService() : ?string {
return $this->getValue("service");
}
/** @api */
public function setService(mixed $value) : self {
$this->setValue("service", $value);
return $this;
}

/* Name des Unternehmens */
/** @api */
public function getCompanyName() : ?string {
return $this->getValue("company_name");
}
/** @api */
public function setCompanyName(string $value) : self {
$this->setValue("company_name", $value);
return $this;
}

/* Anschrift */
/** @api */
public function getCompanyAddress() : ?string {
return $this->getValue("company_address");
}
/** @api */
public function setCompanyAddress(string $value) : self {
$this->setValue("company_address", $value);
return $this;
}

/* Datenschutzerklärung */
/** @api */
public function getPrivacyPolicyUrl() : ?string {
return $this->getValue("privacy_policy_url");
}
/** @api */
public function setPrivacyPolicyUrl(string $value) : self {
$this->setValue("privacy_policy_url", $value);
return $this;
}

/* Iframe-Manager */
/** @api */
public function getIframe() : ?rex_yform_manager_dataset {
return $this->getRelatedDataset("iframe");
}

/* Domain(s) */
/** @api */
public function getRexDomain() : ? \rex_yrewrite_domain {
return rex_yrewrite::getDomainById($this->getValue("rex_domain"));
}
/** @api */
public function getRexDomainId() : ?int {
return $this->getValue("rex_domain");
}
/** @api */
public function setRexDomain(int $value) : self {
$this->setValue("rex_domain", $value);
return $this;
}

/* Cookies, LocalStorage und Tracking-Bilder */
/** @api */
public function getEntry() : ?rex_yform_manager_collection {
return $this->getRelatedCollection("entry_ids");
}

/* JavaScript (nach Einwilligung) */
/** @api */
public function getScript() : ?string {
return $this->getValue("script");
}
/** @api */
public function setScript(string $value) : self {
$this->setValue("script", $value);
return $this;
}

/* Aktualisiert am... */
/** @api */
public function getUpdatedate() : ?string {
return $this->getValue("updatedate");
}
/** @api */
public function setUpdatedate(string $value) : self {
$this->setValue("updatedate", $value);
return $this;
}

/* Status */
/** @api */
public function getStatus() : ?int {
return $this->getValue("status");
}
/** @api */
public function setStatus(int $value) : self {
$this->setValue("status", $value);
return $this;
}

public static function getStatusOptions() : array {
return self::STATUS_OPTIONS;
}
}
Loading
Loading