diff --git a/PHPCI/Application.php b/PHPCI/Application.php index ee1f6e15..8582fc41 100644 --- a/PHPCI/Application.php +++ b/PHPCI/Application.php @@ -137,7 +137,13 @@ class Application extends b8\Application { /** @var \PHPCI\Store\ProjectStore $projectStore */ $projectStore = b8\Store\Factory::getStore('Project'); - $layout->projects = $projectStore->getAll(); + $layout->projects = $projectStore->getWhere( + array('archived' => (int)isset($_GET['archived'])), + 50, + 0, + array(), + array('title' => 'ASC') + ); } /** diff --git a/PHPCI/Controller/HomeController.php b/PHPCI/Controller/HomeController.php index 65abf79a..2455e709 100644 --- a/PHPCI/Controller/HomeController.php +++ b/PHPCI/Controller/HomeController.php @@ -48,7 +48,13 @@ class HomeController extends \PHPCI\Controller { $this->layout->title = Lang::get('dashboard'); - $projects = $this->projectStore->getWhere(array(), 50, 0, array(), array('title' => 'ASC')); + $projects = $this->projectStore->getWhere( + array('archived' => (int)isset($_GET['archived'])), + 50, + 0, + array(), + array('title' => 'ASC') + ); $builds = $this->buildStore->getLatestBuilds(null, 10); diff --git a/PHPCI/Controller/ProjectController.php b/PHPCI/Controller/ProjectController.php index f2f63b26..285982a1 100644 --- a/PHPCI/Controller/ProjectController.php +++ b/PHPCI/Controller/ProjectController.php @@ -282,6 +282,7 @@ class ProjectController extends PHPCI\Controller 'ssh_public_key' => $this->getParam('pubkey', null), 'build_config' => $this->getParam('build_config', null), 'allow_public_status' => $this->getParam('allow_public_status', 0), + 'archived' => $this->getParam('archived', 0), 'branch' => $this->getParam('branch', null), ); @@ -357,6 +358,12 @@ class ProjectController extends PHPCI\Controller $field->setValue(0); $form->addField($field); + $field = Form\Element\Checkbox::create('archived', Lang::get('archived'), false); + $field->setContainerClass('form-group'); + $field->setCheckedValue(1); + $field->setValue(0); + $form->addField($field); + $field = new Form\Element\Submit(); $field->setValue(Lang::get('save_project')); $field->setContainerClass('form-group'); diff --git a/PHPCI/Languages/lang.da.php b/PHPCI/Languages/lang.da.php index 5010f28e..5ba3d96f 100644 --- a/PHPCI/Languages/lang.da.php +++ b/PHPCI/Languages/lang.da.php @@ -112,6 +112,7 @@ i din foretrukne hosting-platform.', (hvis du ikke har mulighed for at tilføje en phpci.yml fil i projektets repository)', 'default_branch' => 'Default branch navn', 'allow_public_status' => 'Tillad offentlig status-side og -billede for dette projekt?', + 'archived' => 'Archived', 'save_project' => 'Gem Projekt', 'error_mercurial' => 'Mercurial repository-URL skal starte med http:// eller https://', diff --git a/PHPCI/Languages/lang.de.php b/PHPCI/Languages/lang.de.php index c40ef23d..bdcc1459 100644 --- a/PHPCI/Languages/lang.de.php +++ b/PHPCI/Languages/lang.de.php @@ -113,6 +113,7 @@ generiert. Um es zu verwenden, fügen Sie einfach den folgenden Public Key im Ab (falls Sie Ihrem Projektrepository kein phpci.yml hinzufügen können)', 'default_branch' => 'Name des Standardbranches', 'allow_public_status' => 'Öffentliche Statusseite und -bild für dieses Projekt einschalten?', + 'archived' => 'Archived', 'save_project' => 'Projekt speichern', 'error_mercurial' => 'Mercurial Repository-URL muss mit http://, oder https:// beginnen', diff --git a/PHPCI/Languages/lang.el.php b/PHPCI/Languages/lang.el.php index c611a87d..82b3cf22 100644 --- a/PHPCI/Languages/lang.el.php +++ b/PHPCI/Languages/lang.el.php @@ -113,6 +113,7 @@ PHPCI', (αν δεν μπορείτε να προσθέσετε ένα αρχείο phpci.yml στο αποθετήριο έργων)', 'default_branch' => 'Προκαθορισμένο όνομα διακλάδωσης', 'allow_public_status' => 'Ενεργοποίηση της σελίδας δημόσιας κατάστασης και την εικόνα για το έργο αυτό;', + 'archived' => 'Archived', 'save_project' => 'Αποθήκευση έργου', 'error_mercurial' => 'Ο σύνδεσμος URL του ευμετάβλητου αποθετηρίου πρέπει να ξεκινάει με http:// ή https://', diff --git a/PHPCI/Languages/lang.en.php b/PHPCI/Languages/lang.en.php index ec2306e0..450be1ef 100644 --- a/PHPCI/Languages/lang.en.php +++ b/PHPCI/Languages/lang.en.php @@ -114,6 +114,7 @@ PHPCI', (if you cannot add a phpci.yml file in the project repository)', 'default_branch' => 'Default branch name', 'allow_public_status' => 'Enable public status page and image for this project?', + 'archived' => 'Archived', 'save_project' => 'Save Project', 'error_mercurial' => 'Mercurial repository URL must be start with http:// or https://', diff --git a/PHPCI/Languages/lang.fr.php b/PHPCI/Languages/lang.fr.php index 45cc3958..20410684 100644 --- a/PHPCI/Languages/lang.fr.php +++ b/PHPCI/Languages/lang.fr.php @@ -113,6 +113,7 @@ PHPCI', (si vous ne pouvez pas ajouter de fichier phpci.yml à la racine du dépôt)', 'default_branch' => 'Nom de la branche par défaut', 'allow_public_status' => 'Activer la page de statut publique et l\'image pour ce projet ?', + 'archived' => 'Archived', 'save_project' => 'Enregistrer le projet', 'error_mercurial' => 'Les URLs de dépôt Mercurial doivent commencer par http:// ou https://', diff --git a/PHPCI/Languages/lang.it.php b/PHPCI/Languages/lang.it.php index c5c4e01b..46ca14fd 100644 --- a/PHPCI/Languages/lang.it.php +++ b/PHPCI/Languages/lang.it.php @@ -113,6 +113,7 @@ PHPCI', 'default_branch' => 'Nome del branch di default', 'allow_public_status' => 'Vuoi rendere pubblica la pagina dello stato e l\'immagine per questo progetto?', 'save_project' => 'Salva il Progetto', + 'archived' => 'Archived', 'error_mercurial' => 'L\'URL del repository Mercurial URL deve iniziare con http:// o https://', 'error_remote' => 'L\'URL del repository deve iniziare con git://, http:// o https://', diff --git a/PHPCI/Languages/lang.nl.php b/PHPCI/Languages/lang.nl.php index f38272c4..83d5e317 100644 --- a/PHPCI/Languages/lang.nl.php +++ b/PHPCI/Languages/lang.nl.php @@ -113,6 +113,7 @@ van je gekozen source code hosting platform', (indien je geen phpci.yml bestand aan de project repository kan toevoegen)', 'default_branch' => 'Standaard branch naam', 'allow_public_status' => 'Publieke statuspagina en afbeelding beschikbaar maken voor dit project?', + 'archived' => 'Archived', 'save_project' => 'Project opslaan', 'error_mercurial' => 'Mercurial repository URL dient te starten met http:// of https://', diff --git a/PHPCI/Languages/lang.pl.php b/PHPCI/Languages/lang.pl.php index 5bf5e043..9d6de6c8 100644 --- a/PHPCI/Languages/lang.pl.php +++ b/PHPCI/Languages/lang.pl.php @@ -114,6 +114,7 @@ od wybranego kodu źródłowego platformy hostingowej.', (jeśli nie możesz dodać pliku phpci.yml do repozytorium projektu)', 'default_branch' => 'Domyślna nazwa gałęzi', 'allow_public_status' => 'Włączyć status publiczny dla tego projektu?', + 'archived' => 'Archived', 'save_project' => 'Zachowaj Projekt', 'error_mercurial' => 'URL repozytorium Mercurialnego powinno zaczynać się od http:// and https://', diff --git a/PHPCI/Languages/lang.ru.php b/PHPCI/Languages/lang.ru.php index 836db6f4..2f9ab0ee 100644 --- a/PHPCI/Languages/lang.ru.php +++ b/PHPCI/Languages/lang.ru.php @@ -112,6 +112,7 @@ PHPCI', (если вы не добавили файл phpci.yml в репозиторий вашего проекта)', 'default_branch' => 'Ветка по умолчанию', 'allow_public_status' => 'Разрешить публичный статус и изображение (статуса) для проекта', + 'archived' => 'Archived', 'save_project' => 'Сохранить проект', 'error_mercurial' => 'URL репозитория Mercurial должен начинаться с http:// или https://', diff --git a/PHPCI/Languages/lang.uk.php b/PHPCI/Languages/lang.uk.php index f51bd885..7e4a2191 100644 --- a/PHPCI/Languages/lang.uk.php +++ b/PHPCI/Languages/lang.uk.php @@ -112,6 +112,7 @@ PHPCI', (якщо ви не додали файл phpci.yml до репозиторію вашого проекту)', 'default_branch' => 'Назва гілки за замовчуванням', 'allow_public_status' => 'Увімкнути публічну сторінку статусу та зображення для цього проекта?', + 'archived' => 'Archived', 'save_project' => 'Зберегти проект', 'error_mercurial' => 'URL репозиторію Mercurial повинен починатись із http:// або https://', diff --git a/PHPCI/Migrations/20150131075425_archive_project.php b/PHPCI/Migrations/20150131075425_archive_project.php new file mode 100644 index 00000000..796fd48b --- /dev/null +++ b/PHPCI/Migrations/20150131075425_archive_project.php @@ -0,0 +1,26 @@ +table('project'); + $project->addColumn('archived', 'boolean'); + $project->save(); + } + + /** + * Migrate Down. + */ + public function down() + { + $project = $this->table('project'); + $project->removeColumn('archived'); + $project->save(); + } +} \ No newline at end of file diff --git a/PHPCI/Model/Base/ProjectBase.php b/PHPCI/Model/Base/ProjectBase.php index 305cafbf..0ea77b78 100644 --- a/PHPCI/Model/Base/ProjectBase.php +++ b/PHPCI/Model/Base/ProjectBase.php @@ -44,6 +44,7 @@ class ProjectBase extends Model 'build_config' => null, 'ssh_public_key' => null, 'allow_public_status' => null, + 'archived' => null, ); /** @@ -62,6 +63,7 @@ class ProjectBase extends Model 'build_config' => 'getBuildConfig', 'ssh_public_key' => 'getSshPublicKey', 'allow_public_status' => 'getAllowPublicStatus', + 'archived' => 'getArchived', // Foreign key getters: ); @@ -82,6 +84,7 @@ class ProjectBase extends Model 'build_config' => 'setBuildConfig', 'ssh_public_key' => 'setSshPublicKey', 'allow_public_status' => 'setAllowPublicStatus', + 'archived' => 'setArchived', // Foreign key setters: ); @@ -148,6 +151,12 @@ class ProjectBase extends Model 'type' => 'int', 'length' => 11, ), + 'archived' => array( + 'type' => 'tinyint', + 'length' => 4, + 'nullable' => true, + 'default' => null, + ), ); /** @@ -296,6 +305,18 @@ class ProjectBase extends Model return $rtn; } + /** + * Get the value of Archived / archived. + * + * @return int + */ + public function getArchived() + { + $rtn = $this->data['archived']; + + return $rtn; + } + /** * Set the value of Id / id. * @@ -506,6 +527,24 @@ class ProjectBase extends Model $this->_setModified('allow_public_status'); } + /** + * Set the value of Archived / archived. + * + * @param $value int + */ + public function setArchived($value) + { + $this->_validateInt('Archived', $value); + + if ($this->data['archived'] === $value) { + return; + } + + $this->data['archived'] = $value; + + $this->_setModified('archived'); + } + /** * Get Build models by ProjectId for this Project. * diff --git a/PHPCI/Service/ProjectService.php b/PHPCI/Service/ProjectService.php index 22e940ac..c7ba787c 100644 --- a/PHPCI/Service/ProjectService.php +++ b/PHPCI/Service/ProjectService.php @@ -81,6 +81,10 @@ class ProjectService $project->setAllowPublicStatus((int)$options['allow_public_status']); } + if (array_key_exists('archived', $options)) { + $project->setArchived((bool)$options['archived']); + } + if (array_key_exists('branch', $options)) { $project->setBranch($options['branch']); } diff --git a/PHPCI/View/layout.phtml b/PHPCI/View/layout.phtml index 64ec0834..6c384a9e 100644 --- a/PHPCI/View/layout.phtml +++ b/PHPCI/View/layout.phtml @@ -147,7 +147,7 @@ - + User()->getIsAdmin()): ?>
  • @@ -242,6 +242,12 @@
  • +
  • + + + +
  • +