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 numeric id to projects #566

Merged
merged 3 commits into from
Oct 25, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<div class="inner-container">
<h1><?= $this->text('dashboard-menu-activity-summary') ?></h1>
<h5><?= $this->ee($this->project->name) ?></h5>
<h6><?= $this->text('dashboard-menu-project-nid') ?>: <?= $this->project->getNumericId() ?></h6>

<div class="panel section-content">
<div class="panel-body">
Expand Down
10 changes: 10 additions & 0 deletions src/Goteo/Model/Project.php
Original file line number Diff line number Diff line change
Expand Up @@ -896,6 +896,16 @@ public function getImage() {
return $this->imageInstance;
}

/**
* Convert the alfanumeric string ID into a numeric string ID
* @param int $surface Collission chance = 10**$surface
* @return string number-only string ID
*/
public function getNumericId(int $surface = 10): string
{
return substr(base_convert(hash('sha256', $this->id), 16, 10), 0, $surface);
}

/**
* Handy method to know if project can be edited (not in campaing or finished)
*/
Expand Down
1 change: 1 addition & 0 deletions translations/ca/dashboard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ dashboard-menu-profile-personal: 'Dades personals'
dashboard-menu-profile-preferences: 'Preferències'
dashboard-menu-profile-profile: 'Edita el Perfil'
dashboard-menu-profile-public: 'Perfil públic'
dashboard-menu-project-nid: 'Identificador numèric de projecte'
dashboard-menu-projects: 'Projectes'
dashboard-menu-projects-analytics: Analítica
dashboard-menu-projects-commons: Retorns
Expand Down
1 change: 1 addition & 0 deletions translations/en/dashboard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ dashboard-menu-profile-personal: 'Personal information'
dashboard-menu-profile-preferences: 'Preferences'
dashboard-menu-profile-profile: 'Edit profile'
dashboard-menu-profile-public: 'Public profile'
dashboard-menu-project-nid: 'Numeric project identifier'
dashboard-menu-projects: 'My projects'
dashboard-menu-projects-analytics: Analytics
dashboard-menu-projects-commons: Rewards
Expand Down
1 change: 1 addition & 0 deletions translations/es/dashboard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ dashboard-menu-profile-personal: 'Datos personales'
dashboard-menu-profile-preferences: 'Mis preferencias'
dashboard-menu-profile-profile: 'Editar perfil'
dashboard-menu-profile-public: 'Perfil público'
dashboard-menu-project-nid: 'Identificador numérico de proyecto'
dashboard-menu-projects: 'Mis proyectos'
dashboard-menu-projects-analytics: Analítica
dashboard-menu-projects-commons: Retornos
Expand Down
Loading