diff --git a/.gitignore b/.gitignore new file mode 100755 index 00000000..04246195 --- /dev/null +++ b/.gitignore @@ -0,0 +1,57 @@ + +# Symfony 2 related +# + +# cache, logs, etc +app/bootstrap.php.cache +app/bootstrap_cache.php.cache +app/cache/* +app/logs/* +app/sessions/* + +# vendor +vendor/* + +# bundle static +web/bundles/* + +# doctrine entities generation backup +*.php~ + +# environment sensitive +web/.htaccess # see web/.htaccess.dist +web/app.php # see web/app.php.dist +web/app_dev.php # see web/app_dev.php.dist +app/config/parameters.ini # see app/config/parameters.ini.dist + +# +# OS garbage, Editors, IDEs, etc +# +.DS_Store +.svn +code_coverage +*~ +*.swp +coverage +.coverage +nbproject +.nbproject +build +.build +.settings +.settings/.* +.project +project +*.project +.buildpath +*.db +*.tmproj +*.sublime-project +.idea +*.idea/* +bin/* + +# ignore files that will be customized +app/config/**/parameters.yml +app/config/common/security.yml +app/Resources/views/institution/* diff --git a/LICENSE b/LICENSE new file mode 100755 index 00000000..0b3292cf --- /dev/null +++ b/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2004-2014 Fabien Potencier + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished +to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/README.md b/README.md new file mode 100755 index 00000000..f555ed47 --- /dev/null +++ b/README.md @@ -0,0 +1,33 @@ +#NYUHSL Data Catalog + +Welcome to the NYU Health Sciences Library's Data Catalog project. Our aim is to encourage the sharing and reuse of research data among insitutions and individuals by providing a simple yet powerful search platform to expose existing datasets to the researchers who can use it. There is a basic backend interface for administrators to manage the metadata which describes these datasets. + +##Components +The Data Catalog runs on **Symfony2**, a popular PHP application framework. Installation and management of this package is best performed by a PHP developer familiar with this framework. + +The search functionality is powered by **Solr**, which will need to be running and accessible by the server hosting the website. A sample Solr schema is included with this package. The Solr index can be updated regularly by setting up a cron job which calls an update script. A sample update script is also included with this package. + +The metadata and some information about users is stored in a database. We used **MySQL** and there's a good chance you will too. + +**IMPORTANT NOTE:** This package comes with authentication disabled, meaning that the administrative interface is unprotected. This is so you can get started using the application in your DEV environment. It is very important to secure your website before it goes into production, and we have included code that will help you do so with **Active Directory/LDAP** authentication -- a common authentication mechanism. However, every institution will have a different configuration and some may use another scheme altogether. Some guidance on how we achieved authentication at NYU follows the installation instructions below. + +##Installation +This repository is essentially a Symfony2 distribution (i.e. it is not simply a Symfony "bundle"). As such, you should be able to install this site fairly easily, after configuring it for your environment. + +1. Install [Composer](https://getcomposer.org/download/), [Solr](https://wiki.apache.org/solr/SolrInstall), and set up a suitable database software such as MySQL. Create an empty database schema for this application. +2. Clone this repository into a directory your web server can serve. +``` +git clone https://github.com/nyuhsl/datacatalog.git +``` +3. Run `composer install` to install any dependencies +4. There are sample "parameters.yml" files in `app/config/dev` and `app/config/prod`. Fill in the information about your MySQL server, and the URL where your Solr installation lives. Remember to choose a "secret" according to the documentation [here](http://symfony.com/doc/current/reference/configuration/framework.html#secret). +5. [Configure your web server](http://symfony.com/doc/current/cookbook/configuration/web_server_configuration.html) to work with Symfony. NOTE: You will want to require HTTPS connections on the login and administrative pages (at least), so remember to set up an SSL certificate for your server when you move the site to production. There is code in app/config/common/security.yml that will tell Symfony to require HTTPS connections. +6. In the root of your Symfony installation, run `php app/console doctrine:schema:update --force`. If you have configured your database correctly, this will set up your database to match the data model used in this application. If you haven't configured it correctly, this will let you know. +7. Copy the example Solr schema ("SolrSchemaSample.xml") from the root site directory to your Solr installation's configuration directory. Copy the default "schema.xml" that came with Solr into "schema.xml.default", and rename this one "schema.xml". Perform any customizations you require, or leave as is. +8. At this point, the site should function, but you won't see any search results because there is nothing in the database, and thus nothing to be indexed by Solr. Click on the "Admin" tab, click "Add a New Dataset" in the sidebar menu, and get going! +9. Once you've added some test data, you'll want to index it in Solr. Navigate to your site's base directory and edit the file "SolrIndexer.py" to specify the URL of your Solr server where indicated. Then, run the script. + +###Follow-up Tasks +1. You'll most likely want to regularly re-index Solr to account for datasets you add or edit using the Admin section. There is a script in the root directory called "SolrUpdater.py" which can update a Solr index. You'll probably want to call this script or something similar with a cron job every Sunday or every night or whatever seems appropriate, depending on much updating you do. I recommend weekly, since you can also run this script on-demand from the command line if you want. +2. You'll most likely want to brand the site with your institution's logo or color scheme. Some placeholders have been left in `app/Resources/views/base.html.twig` that should get you started. +3. You'll most likely want to have some datasets to search. Get to it!! diff --git a/UPGRADE-2.2.md b/UPGRADE-2.2.md new file mode 100755 index 00000000..cad9eeb6 --- /dev/null +++ b/UPGRADE-2.2.md @@ -0,0 +1,30 @@ +UPGRADE FROM 2.1 to 2.2 +======================= + + * The [`web/.htaccess`](https://github.com/symfony/symfony-standard/blob/2.2/web/.htaccess) + file has been enhanced substantially to prevent duplicate content with and + without `/app.php` in the URI. It also improves functionality when using + Apache aliases or when mod_rewrite is not available. So you might want to + update your `.htaccess` file as well. + + * The ``_internal`` route is not used any more. It should then be removed + from both your routing and security configurations. A ``fragments`` key has + been added to the framework configuration and must be specified when ESI or + Hinclude are in use. No security configuration is required for this path as + by default ESI access is only permitted for trusted hosts and Hinclude + access uses an URL signing mechanism. + + ``` + framework: + # ... + fragments: { path: /_proxy } + ``` + +Functional Tests +---------------- + + * The profiler has been disabled by default in the test environment. You can + enable it again by modifying the ``config_test.yml`` configuration file or + even better, you can just enable it for the very next request by calling + ``$client->enableProfiler()`` when you need the profiler in a test (that + speeds up functional tests quite a bit). diff --git a/UPGRADE-2.3.md b/UPGRADE-2.3.md new file mode 100755 index 00000000..eb4b3ec2 --- /dev/null +++ b/UPGRADE-2.3.md @@ -0,0 +1,52 @@ +UPGRADE FROM 2.2 to 2.3 +======================= + +When upgrading Symfony from 2.2 to 2.3, you need to do the following changes +to the code that came from the Standard Edition: + + * The debugging tools are not enabled by default anymore and should be added + to the + [`web/app_dev.php`](https://github.com/symfony/symfony-standard/blob/2.3/web/app_dev.php) + front controller manually, just after including the bootstrap cache: + + use Symfony\Component\Debug\Debug; + + Debug::enable(); + + You also need to enable debugging in the + [`app/console`](https://github.com/symfony/symfony-standard/blob/2.3/app/console) + script, after the `$debug` variable is defined: + + use Symfony\Component\Debug\Debug; + + if ($debug) { + Debug::enable(); + } + + * The `parameters.yml` file can now be managed by the + `incenteev/composer-parameter-handler` bundle that comes with the 2.3 + Standard Edition: + + * add `"incenteev/composer-parameter-handler": "~2.0"` to your + `composer.json` file; + + * add `/app/config/parameters.yml` to your `.gitignore` file; + + * create a + [`app/config/parameters.yml.dist`](https://github.com/symfony/symfony-standard/blob/2.3/app/config/parameters.yml.dist) + file with sensible values for all your parameters. + + * It is highly recommended that you switch the minimum stability to `stable` + in your `composer.json` file. + + * If you are using Apache, have a look at the new + [`.htaccess`](https://github.com/symfony/symfony-standard/blob/2.3/web/.htaccess) + configuration and change yours accordingly. + + * In the + [`app/autoload.php`](https://github.com/symfony/symfony-standard/blob/2.3/app/autoload.php) + file, the section about `intl` should be removed as it is not needed anymore. + +You can also have a look at the +[diff](https://github.com/symfony/symfony-standard/compare/v2.2.0%E2%80%A62.3) +between the 2.2 version of the Standard Edition and the 2.3 version. diff --git a/UPGRADE-2.4.md b/UPGRADE-2.4.md new file mode 100755 index 00000000..a3e33954 --- /dev/null +++ b/UPGRADE-2.4.md @@ -0,0 +1,9 @@ +UPGRADE FROM 2.3 to 2.4 +======================= + +When upgrading Symfony from 2.3 to 2.4, you need to do the following changes +to the code that came from the Standard Edition: + + * We recommend to comment or remove the `firephp` and `chromephp` Monolog + handlers as they might cause issues with some configuration (`chromephp` + with Nginx for instance). diff --git a/UPGRADE.md b/UPGRADE.md new file mode 100755 index 00000000..a206d37f --- /dev/null +++ b/UPGRADE.md @@ -0,0 +1,268 @@ +Symfony Standard Edition Upgrade +================================ + +From Symfony 2.0 to Symfony 2.1 +------------------------------- + +### Project Dependencies + +As of Symfony 2.1, project dependencies are managed by +[Composer](http://getcomposer.org/): + +* The `bin/vendors` script can be removed as `composer.phar` does all the work + now (it is recommended to install it globally on your machine). + +* The `deps` file need to be replaced with the `composer.json` one. + +* The `composer.lock` is the equivalent of the generated `deps.lock` file and + it is automatically generated by Composer. + +Download the default +[`composer.json`](https://raw.github.com/symfony/symfony-standard/2.1/composer.json) +and +[`composer.lock`](https://raw.github.com/symfony/symfony-standard/2.1/composer.lock) +files for Symfony 2.1 and put them into the main directory of your project. If +you have customized your `deps` file, move the added dependencies to the +`composer.json` file (many bundles and PHP libraries are already available as +Composer packages -- search for them on [Packagist](http://packagist.org/)). + +Remove your current `vendor` directory. + +Finally, run Composer: + + $ composer.phar install + +Note: You must complete the upgrade steps below so composer can successfully generate the autoload files. + +### `app/autoload.php` + +The default `autoload.php` reads as follows (it has been simplified a lot as +autoloading for libraries and bundles declared in your `composer.json` file is +automatically managed by the Composer autoloader): + + add('', __DIR__.'/../vendor/symfony/symfony/src/Symfony/Component/Locale/Resources/stubs'); + } + + AnnotationRegistry::registerLoader(array($loader, 'loadClass')); + + return $loader; + +### `app/config/config.yml` + +The `framework.charset` setting must be removed. If you are not using `UTF-8` +for your application, override the `getCharset()` method in your `AppKernel` +class instead: + + class AppKernel extends Kernel + { + public function getCharset() + { + return 'ISO-8859-1'; + } + + // ... + } + +You might want to add the new `strict_requirements` parameter to +`framework.router` (it avoids fatal errors in the production environment when +a link cannot be generated): + + framework: + router: + strict_requirements: "%kernel.debug%" + +You can even disable the requirements check on production with `null` as you should +know that the parameters for URL generation always pass the requirements, e.g. by +validating them beforehand. This additionally enhances performance. See +[config_prod.yml](https://github.com/symfony/symfony-standard/blob/master/app/config/config_prod.yml). + +The `default_locale` parameter is now a setting of the main `framework` +configuration (it was under the `framework.session` in 2.0): + + framework: + default_locale: "%locale%" + +The `auto_start` setting under `framework.session` must be removed as it is +not used anymore (the session is now always started on-demand). If +`auto_start` was the only setting under the `framework.session` entry, don't +remove it entirely, but set its value to `~` (`~` means `null` in YAML) +instead: + + framework: + session: ~ + +The `trust_proxy_headers` setting was added in the default configuration file +(as it should be set to `true` when you install your application behind a +reverse proxy): + + framework: + trust_proxy_headers: false + +An empty `bundles` entry was added to the `assetic` configuration: + + assetic: + bundles: [] + +The default `swiftmailer` configuration now has the `spool` setting configured +to the `memory` type to defer email sending after the response is sent to the +user (recommended for better end-user performance): + + swiftmailer: + spool: { type: memory } + +The `jms_security_extra` configuration was moved to the `security.yml` +configuration file. + +### `app/config/config_dev.yml` + +An example of how to send all emails to a unique address was added: + + #swiftmailer: + # delivery_address: me@example.com + +### `app/config/config_test.yml` + +The `storage_id` setting must be changed to `session.storage.mock_file`: + + framework: + session: + storage_id: session.storage.mock_file + +### `app/config/parameters.ini` + +The file has been converted to a YAML file which reads as follows: + + parameters: + database_driver: pdo_mysql + database_host: localhost + database_port: ~ + database_name: symfony + database_user: root + database_password: ~ + + mailer_transport: smtp + mailer_host: localhost + mailer_user: ~ + mailer_password: ~ + + locale: en + secret: ThisTokenIsNotSoSecretChangeIt + +Note that if you convert your parameters file to YAML, you must also change +its reference in `app/config/config.yml`. + +### `app/config/routing_dev.yml` + +The `_assetic` entry was removed: + + #_assetic: + # resource: . + # type: assetic + +### `app/config/security.yml` + +Under `security.access_control`, the default rule for internal routes was changed: + + security: + access_control: + #- { path: ^/_internal/secure, roles: IS_AUTHENTICATED_ANONYMOUSLY, ip: 127.0.0.1 } + +Under `security.providers`, the `in_memory` example was updated to the following: + + security: + providers: + in_memory: + memory: + users: + user: { password: userpass, roles: [ 'ROLE_USER' ] } + admin: { password: adminpass, roles: [ 'ROLE_ADMIN' ] } + +### `app/AppKernel.php` + +The following bundles have been added to the list of default registered bundles: + + new JMS\AopBundle\JMSAopBundle(), + new JMS\DiExtraBundle\JMSDiExtraBundle($this), + +You must also rename the DoctrineBundle from: + + new Symfony\Bundle\DoctrineBundle\DoctrineBundle(), + +to: + + new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(), + +### `web/app.php` + +The default `web/app.php` file now reads as follows: + + register(true); + */ + + require_once __DIR__.'/../app/AppKernel.php'; + //require_once __DIR__.'/../app/AppCache.php'; + + $kernel = new AppKernel('prod', false); + $kernel->loadClassCache(); + //$kernel = new AppCache($kernel); + $request = Request::createFromGlobals(); + $response = $kernel->handle($request); + $response->send(); + $kernel->terminate($request, $response); + +### `web/app_dev.php` + +The default `web/app_dev.php` file now reads as follows: + + loadClassCache(); + $request = Request::createFromGlobals(); + $response = $kernel->handle($request); + $response->send(); + $kernel->terminate($request, $response); diff --git a/app/.htaccess b/app/.htaccess new file mode 100755 index 00000000..fb1de45b --- /dev/null +++ b/app/.htaccess @@ -0,0 +1,7 @@ + + Require all denied + + + Order deny,allow + Deny from all + diff --git a/app/AppCache.php b/app/AppCache.php new file mode 100755 index 00000000..ddb51db0 --- /dev/null +++ b/app/AppCache.php @@ -0,0 +1,9 @@ +getEnvironment(), array('dev', 'test'))) { + $bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle(); + $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle(); + $bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle(); + $bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle(); + } + + return $bundles; + } + + public function init() { + // Change timezone to avoid PHP error + date_default_timezone_set('America/New_York'); + + parent::init(); + } + + + public function registerContainerConfiguration(LoaderInterface $loader) + { + $loader->load(__DIR__.'/config/'.$this->getEnvironment().'/config.yml'); + } +} diff --git a/app/Resources/TwigBundle/views/Exception/error.html.twig b/app/Resources/TwigBundle/views/Exception/error.html.twig new file mode 100644 index 00000000..bc72fb57 --- /dev/null +++ b/app/Resources/TwigBundle/views/Exception/error.html.twig @@ -0,0 +1,13 @@ +{% extends 'base.html.twig' %} + +{% block content %} +
+

Something went wrong!

+ +
+

+ We're not sure what the problem is, but if you want to help out, you can let us know what happened.

+ Otherwise, you can return to the homepage. +

+
+{% endblock %} diff --git a/app/Resources/TwigBundle/views/Exception/error404.html.twig b/app/Resources/TwigBundle/views/Exception/error404.html.twig new file mode 100644 index 00000000..527407d7 --- /dev/null +++ b/app/Resources/TwigBundle/views/Exception/error404.html.twig @@ -0,0 +1,13 @@ +{% extends 'base.html.twig' %} + +{% block content %} +
+

Page not found

+ +
+

+ Oops! If you think something should be here, let us know.

+ Otherwise, you can return to the homepage. +

+
+{% endblock %} diff --git a/app/Resources/views/analytics.html.twig b/app/Resources/views/analytics.html.twig new file mode 100644 index 00000000..d6635824 --- /dev/null +++ b/app/Resources/views/analytics.html.twig @@ -0,0 +1,3 @@ +{# Insert your analytics code snippet here #} + diff --git a/app/Resources/views/base.html.twig b/app/Resources/views/base.html.twig new file mode 100755 index 00000000..4bf2063e --- /dev/null +++ b/app/Resources/views/base.html.twig @@ -0,0 +1,164 @@ + + + + + + + {% block page_title %} + {{ site_name }} + {% endblock %} + + + + + {# placeholder blocks for page-specific elements #} + {% block page_stylesheets %} + {% endblock %} + + {# if you use something like Google Analytics, put it in ./institution/analytics.html.twig and we'll include it here #} + {% include ['institution/analytics.html.twig', 'analytics.html.twig'] ignore missing %} + + {# placeholder block for JSON-LD output #} + {% block JSONLD_output %} + + + + {% endblock %} + + {% block results_JSONLD_output %} + {% endblock %} + + + +
+ +
+
+

Search here to find large public and licensed datasets

+
+ + + + +
+ +
+
+
+ + {# ADMIN NAV SIDEBAR #} + {% if is_granted('ROLE_USER') and adminPage is defined and adminPage==true %} +
+ +
+ {% endif %} + + {% block content %}{% endblock %} + {% block javascripts %} + + + + + + {% endblock %} + {# placeholder block for page-specific scripts #} + {% block page_scripts %} + {% endblock %} +
+
+
+ + + diff --git a/app/Resources/views/default/about.html.twig b/app/Resources/views/default/about.html.twig new file mode 100755 index 00000000..63707bb1 --- /dev/null +++ b/app/Resources/views/default/about.html.twig @@ -0,0 +1,28 @@ +{% extends 'base.html.twig' %} + +{% block page_title %} +About the Data Catalog +{% endblock %} + +{% block page_stylesheets %} +{% endblock %} + + +{% block page_scripts %} +{% endblock %} + + +{% block content %} +
+ +

+Content for this page can be customized by copying the template file "default/about.html.twig" into "institution/about.html.twig" and editing as needed +

+ + +
+ +{% endblock %} + diff --git a/app/Resources/views/default/add.html.twig b/app/Resources/views/default/add.html.twig new file mode 100755 index 00000000..8c52c198 --- /dev/null +++ b/app/Resources/views/default/add.html.twig @@ -0,0 +1,67 @@ +{% extends 'base.html.twig' %} +{% form_theme form with ['bootstrap_3_horizontal_layout.html.twig', + _self] %} + +{% block page_title %} +Add a Related Entity +{% endblock %} + +{% block page_stylesheets %} + +{% endblock %} + + +{% block page_scripts %} + + +{% endblock %} + + +{% block form_group_class -%} +col-sm-5 +{%- endblock form_group_class %} + + +{% block form_label_class -%} +col-sm-2 +{%- endblock form_label_class %} + + + +{% macro widget_prototype(widget,remove_text) %} + + {% if widget.vars.prototype is defined %} + {% set form = widget.vars.prototype %} + {% set name = widget.vars.prototype.vars.label %} + {% else %} + {% set form = widget %} + {% set name = widget.vars.label %} + {% endif %} + +
+
+ {{ form_widget(form) }} + {{ remove_text }} +
+ +{% endmacro %} + + + +{% block content %} + +
+ + +{{ form(form) }} + + {{ form_widget(form._token) }} +
+ +
+ + +{% endblock %} + diff --git a/app/Resources/views/default/add_dataset.html.twig b/app/Resources/views/default/add_dataset.html.twig new file mode 100755 index 00000000..dad57f91 --- /dev/null +++ b/app/Resources/views/default/add_dataset.html.twig @@ -0,0 +1,232 @@ +{% extends 'base.html.twig' %} +{% form_theme form with ['bootstrap_3_horizontal_layout.html.twig', + _self] %} + +{% block page_title %} +Add a Dataset +{% endblock %} + +{% block page_stylesheets %} + +{% endblock %} + + +{% block page_scripts %} + + +{% endblock %} + +{% block form_group_class -%} +col-sm-8 +{%- endblock form_group_class %} + +{% block form_label_class -%} +col-sm-4 +{%- endblock form_label_class %} + + + +{% macro widget_prototype(widget,remove_text) %} + + {% if widget.vars.prototype is defined %} + {% set form = widget.vars.prototype %} + {% set name = widget.vars.prototype.vars.label %} + {% else %} + {% set form = widget %} + {% set name = widget.vars.label %} + {% endif %} + +
+
+ {{ form_widget(form) }} + {# {{ remove_text }}#} +
+
+ +{% endmacro %} + + + +{% block content %} +
+ + {{ form_start(form) }} + {% if form.vars.valid == false %} +
There was an error in this form. Please scroll down for more information.
+ {% endif %} + {{ form_errors(form) }} +
+ General Dataset Information + {{ form_row(form.dataset_uid) }} + {{ form_row(form.title) }} + {# DATASET ALTERNATE TITLES #} +
+ +
+ Add item +
+
+ {% for widget in form.dataset_alternate_titles %} + {{ _self.widget_prototype(widget, 'Remove item') }} + {% endfor %} +
+
+ {% if userIsAdmin %} + {{ form_row(form.origin) }} + {% endif %} + {{ form_row(form.description) }} + {{ form_row(form.subject_domains) }} + {{ form_row(form.subject_keywords) }} + {% if userIsAdmin %} + {{ form_row(form.published) }} + {% endif %} +
+
+ Author Information + {{ form_row(form.authors) }} + {{ form_row(form.corresponding_authors) }} + {% if userIsAdmin %} + {{ form_row(form.publishers) }} + {% endif %} +
+
+ Data Location Information + {{ form_row(form.accession_number) }} + {# DATA LOCATION URLS #} +
+ +
+ Add item +
+
+ {% for widget in form.data_locations %} + {{ _self.widget_prototype(widget, 'Remove item') }} + {% endfor %} +
+
+ {% if userIsAdmin %} + {{ form_row(form.date_archived) }} + {% endif %} + {# OTHER RESOURCES #} +
+ +
+ Add item +
+
+ {% for widget in form.other_resources %} + {{ _self.widget_prototype(widget, 'Remove item') }} + {% endfor %} +
+
+
+
+ Access + {{ form_row(form.access_instructions) }} + {% if userIsAdmin %} + {{ form_row(form.access_restrictions) }} + {% endif %} +
+
+ Detailed Dataset Information + {{ form_row(form.study_types) }} + {{ form_row(form.dataset_formats) }} + {{ form_row(form.dataset_size) }} + {{ form_row(form.data_types) }} + {{ form_row(form.measurement_standards) }} + {{ form_row(form.subject_start_date) }} + {{ form_row(form.subject_end_date) }} + {{ form_row(form.subject_genders) }} + {{ form_row(form.subject_population_ages) }} + {{ form_row(form.subject_geographic_areas) }} + {{ form_row(form.subject_geographic_area_details) }} +
+
+ Grants and Publications + {{ form_row(form.publications) }} + {{ form_row(form.awards) }} + {% if userIsAdmin %} + {# RELATED DATASETS #} +
+ +
+ Add item +
+
+ {% for widget in form.related_datasets %} + {{ _self.widget_prototype(widget, 'Remove item') }} + {% endfor %} +
+
+ {% endif %} + + {% if userIsAdmin %} + {{ form_row(form.pubmed_search) }} + {% endif %} + {{ form_row(form.local_experts) }} +
+ {% if userIsAdmin %} +
+ Administration + {{ form_row(form.erd_url) }} + {{ form_row(form.library_catalog_url) }} + {{ form_row(form.licensing_details) }} + {{ form_row(form.license_expiration_date) }} + {{ form_row(form.subscriber) }} +
+ {% endif %} + {{ form_widget(form._token) }} + {{ form_widget(form.save) }} + + + +{# {% for child in form.children %} + {% if child.vars.prototype is defined %} +
+ +
+ Add item +
+
+ {% for widget in child %} + {{ _self.widget_prototype(widget, 'Remove item') }} + {% endfor %} + +
+
+ {% else %} + {{ form_row(child) }} + {% endif %} + +{% endfor %} + {{ form_widget(form._token) }} +#} + + + + + +
+ + + +{% endblock %} + diff --git a/app/Resources/views/default/add_dataset.html.twig.backup b/app/Resources/views/default/add_dataset.html.twig.backup new file mode 100755 index 00000000..7975447c --- /dev/null +++ b/app/Resources/views/default/add_dataset.html.twig.backup @@ -0,0 +1,99 @@ +{% extends 'base.html.twig' %} +{% form_theme form with ['bootstrap_3_horizontal_layout.html.twig', + _self] %} + +{% block page_title %} +Add a Dataset +{% endblock %} + +{% block page_stylesheets %} + +{% endblock %} + + +{% block page_scripts %} + + +{% endblock %} + +{% block form_group_class -%} +col-sm-8 +{%- endblock form_group_class %} + +{% block form_label_class -%} +col-sm-4 +{%- endblock form_label_class %} + + + +{% macro widget_prototype(widget,remove_text) %} + + {% if widget.vars.prototype is defined %} + {% set form = widget.vars.prototype %} + {% set name = widget.vars.prototype.vars.label %} + {% else %} + {% set form = widget %} + {% set name = widget.vars.label %} + {% endif %} + +
+
+ {{ form_widget(form) }} + {# {{ remove_text }}#} +
+ +{% endmacro %} + + + +{% block content %} +
+ + {{ form_start(form) }} + {% if form.vars.valid == false %} +
There was an error in this form. Please scroll down for more information.
+ {% endif %} + {{ form_errors(form) }} + + {% for child in form.children %} + {% if child.vars.prototype is defined %} +
+ +
+ Add item +
+
+ {% for widget in child %} + {{ _self.widget_prototype(widget, 'Remove item') }} + {% endfor %} + +
+
+ {% else %} + {{ form_row(child) }} + {% endif %} + +{% endfor %} + + + {{ form_widget(form._token) }} + + + + +
+ + + +{% endblock %} + diff --git a/app/Resources/views/default/add_dataset_admin.html.twig b/app/Resources/views/default/add_dataset_admin.html.twig new file mode 100755 index 00000000..83974ba6 --- /dev/null +++ b/app/Resources/views/default/add_dataset_admin.html.twig @@ -0,0 +1,235 @@ +{% extends 'base.html.twig' %} +{% form_theme form with ['bootstrap_3_horizontal_layout.html.twig', + _self] %} + +{% block page_title %} +Add a Dataset +{% endblock %} + +{% block page_stylesheets %} + +{% endblock %} + + +{% block page_scripts %} + + +{% endblock %} + +{% block form_group_class -%} +col-sm-8 +{%- endblock form_group_class %} + +{% block form_label_class -%} +col-sm-4 +{%- endblock form_label_class %} + + + +{% macro widget_prototype(widget,remove_text) %} + + {% if widget.vars.prototype is defined %} + {% set form = widget.vars.prototype %} + {% set name = widget.vars.prototype.vars.label %} + {% else %} + {% set form = widget %} + {% set name = widget.vars.label %} + {% endif %} + +
+
+ {{ form_widget(form) }} + {# {{ remove_text }}#} +
+
+ +{% endmacro %} + + + +{% block content %} +
+ + {{ form_start(form) }} + {% if form.vars.valid == false %} +
There was an error in this form. Please scroll down for more information.
+ {% endif %} + {{ form_errors(form) }} +
+ General Dataset Information + {{ form_row(form.dataset_uid) }} + {{ form_row(form.title) }} + {# DATASET ALTERNATE TITLES #} +
+ +
+ Add item +
+
+ {% for widget in form.dataset_alternate_titles %} + {{ _self.widget_prototype(widget, 'Remove item') }} + {% endfor %} +
+
+ {% if userIsAdmin %} + {{ form_row(form.origin) }} + {% endif %} + {{ form_row(form.description) }} + {{ form_row(form.subject_domains) }} + {{ form_row(form.subject_keywords) }} + {% if userIsAdmin %} + {{ form_row(form.published) }} + {% endif %} +
+
+ Author Information + {{ form_row(form.authors) }} + {{ form_row(form.corresponding_authors) }} + {% if userIsAdmin %} + {{ form_row(form.publishers) }} + {% endif %} +
+
+ Data Location Information + {{ form_row(form.accession_number) }} + {# DATA LOCATION URLS #} +
+ +
+ Add item +
+
+ {% for widget in form.data_locations %} + {{ _self.widget_prototype(widget, 'Remove item') }} + {% endfor %} +
+
+ {% if userIsAdmin %} + {{ form_row(form.date_archived) }} + {% endif %} + {# OTHER RESOURCES #} +
+ +
+ Add item +
+
+ {% for widget in form.other_resources %} + {{ _self.widget_prototype(widget, 'Remove item') }} + {% endfor %} +
+
+
+
+ Access + {{ form_row(form.access_instructions) }} + {% if userIsAdmin %} + {{ form_row(form.access_restrictions) }} + {% endif %} +
+
+ Detailed Dataset Information + {{ form_row(form.study_types) }} + {{ form_row(form.subject_of_study) }} + {{ form_row(form.related_equipment) }} + {{ form_row(form.related_software) }} + {{ form_row(form.dataset_formats) }} + {{ form_row(form.dataset_size) }} + {{ form_row(form.data_types) }} + {{ form_row(form.measurement_standards) }} + {{ form_row(form.subject_start_date) }} + {{ form_row(form.subject_end_date) }} + {{ form_row(form.subject_genders) }} + {{ form_row(form.subject_population_ages) }} + {{ form_row(form.subject_geographic_areas) }} + {{ form_row(form.subject_geographic_area_details) }} +
+
+ Grants and Publications + {{ form_row(form.publications) }} + {{ form_row(form.awards) }} + {% if userIsAdmin %} + {# RELATED DATASETS #} +
+ +
+ Add item +
+
+ {% for widget in form.related_datasets %} + {{ _self.widget_prototype(widget, 'Remove item') }} + {% endfor %} +
+
+ {% endif %} + + {% if userIsAdmin %} + {{ form_row(form.pubmed_search) }} + {% endif %} + {{ form_row(form.local_experts) }} +
+ {% if userIsAdmin %} +
+ Administration + {{ form_row(form.erd_url) }} + {{ form_row(form.library_catalog_url) }} + {{ form_row(form.licensing_details) }} + {{ form_row(form.license_expiration_date) }} + {{ form_row(form.subscriber) }} +
+ {% endif %} + {{ form_widget(form._token) }} + {{ form_widget(form.save) }} + + + +{# {% for child in form.children %} + {% if child.vars.prototype is defined %} +
+ +
+ Add item +
+
+ {% for widget in child %} + {{ _self.widget_prototype(widget, 'Remove item') }} + {% endfor %} + +
+
+ {% else %} + {{ form_row(child) }} + {% endif %} + +{% endfor %} + {{ form_widget(form._token) }} +#} + + + + + +
+ + + +{% endblock %} + diff --git a/app/Resources/views/default/add_dataset_success.html.twig b/app/Resources/views/default/add_dataset_success.html.twig new file mode 100755 index 00000000..d69b482f --- /dev/null +++ b/app/Resources/views/default/add_dataset_success.html.twig @@ -0,0 +1,35 @@ +{% extends 'base.html.twig' %} + +{% block page_title %} +Dataset Added! +{% endblock %} + +{% block page_stylesheets %} +{% endblock %} + + +{% block page_scripts %} +{% endblock %} + + +{% block content %} +
+ +

+The Dataset "{{ addedEntityName }}" was updated successfully. +

+
+

+To view the dataset, click here. +

+

+To make further edits, click here. +

+ + +
+ +{% endblock %} + diff --git a/app/Resources/views/default/add_dataset_user.html.twig b/app/Resources/views/default/add_dataset_user.html.twig new file mode 100755 index 00000000..20018b38 --- /dev/null +++ b/app/Resources/views/default/add_dataset_user.html.twig @@ -0,0 +1,128 @@ +{% extends 'base.html.twig' %} +{% form_theme form with ['bootstrap_3_horizontal_layout.html.twig', + _self] %} + +{% block page_title %} +Add a Dataset +{% endblock %} + +{% block page_stylesheets %} + +{% endblock %} + + +{% block page_scripts %} + + +{% endblock %} + +{% block form_group_class -%} +col-sm-8 +{%- endblock form_group_class %} + +{% block form_label_class -%} +col-sm-4 +{%- endblock form_label_class %} + + + +{% macro widget_prototype(widget,remove_text) %} + + {% if widget.vars.prototype is defined %} + {% set form = widget.vars.prototype %} + {% set name = widget.vars.prototype.vars.label %} + {% else %} + {% set form = widget %} + {% set name = widget.vars.label %} + {% endif %} + +
+
+ {{ form_widget(form) }} + {# {{ remove_text }}#} +
+
+ +{% endmacro %} + + + +{% block content %} +
+ + {{ form_start(form) }} + {% if form.vars.valid == false %} +
There was an error in this form. Please scroll down for more information.
+ {% endif %} + {{ form_errors(form) }} +
+ General Dataset Information + {{ form_row(form.title) }} + {{ form_row(form.description) }} + {{ form_row(form.subject_keywords) }} +
+
+ Author Information + {{ form_row(form.authors) }} +
+
+ Access + {{ form_row(form.access_instructions) }} +
+
+ Detailed Dataset Information + {{ form_row(form.subject_of_study) }} + {{ form_row(form.related_equipment) }} + {{ form_row(form.related_software) }} + {{ form_row(form.dataset_formats) }} + {{ form_row(form.measurement_standards) }} + {{ form_row(form.subject_start_date) }} + {{ form_row(form.subject_end_date) }} +
+ {{ form_widget(form._token) }} + {{ form_widget(form.save) }} + + + +{# {% for child in form.children %} + {% if child.vars.prototype is defined %} +
+ +
+ Add item +
+
+ {% for widget in child %} + {{ _self.widget_prototype(widget, 'Remove item') }} + {% endfor %} + +
+
+ {% else %} + {{ form_row(child) }} + {% endif %} + +{% endfor %} + {{ form_widget(form._token) }} +#} + + + + + +
+ + + +{% endblock %} + diff --git a/app/Resources/views/default/add_success.html.twig b/app/Resources/views/default/add_success.html.twig new file mode 100755 index 00000000..5ffa9b59 --- /dev/null +++ b/app/Resources/views/default/add_success.html.twig @@ -0,0 +1,36 @@ +{% extends 'base.html.twig' %} + +{% block page_title %} +Entity Added! +{% endblock %} + +{% block page_stylesheets %} +{% endblock %} + + +{% block page_scripts %} +{% endblock %} + + +{% block content %} +
+ +

+The {{ displayName }} "{{ addedEntityName }}" was updated successfully. +

+
+

+{% if userIsAdmin %} +To make further edits, click here. +{% else %} + Our staff will review your submission. Thank you for using the Data Catalog! +{% endif %} +

+ + +
+ +{% endblock %} + diff --git a/app/Resources/views/default/admin-home.html.twig b/app/Resources/views/default/admin-home.html.twig new file mode 100755 index 00000000..1babd1b3 --- /dev/null +++ b/app/Resources/views/default/admin-home.html.twig @@ -0,0 +1,16 @@ +{% extends 'base.html.twig' %} + +{% block page_title %} +Dataset Administration +{% endblock %} + +{% block content %} +
+ +

+ Welcome to the administrative area of the Data Catalog. Please use the links to your left to complete your administrative tasks. +

+
+{% endblock %} diff --git a/app/Resources/views/default/admin-manage.html.twig b/app/Resources/views/default/admin-manage.html.twig new file mode 100755 index 00000000..36f05f5e --- /dev/null +++ b/app/Resources/views/default/admin-manage.html.twig @@ -0,0 +1,39 @@ +{% extends 'base.html.twig' %} + +{% block page_title %} + Data Catalog - Manage Related Entities +{% endblock %} + +{% block content %} +
+ +

+ Here you can view and manage items that are not datasets, but are related to them.
+NOTE: When you edit an item here, the change will be reflected in all dataset records that reference it. +

+ +
+ + +
+ +{% endblock %} diff --git a/app/Resources/views/default/admin-users.html.twig b/app/Resources/views/default/admin-users.html.twig new file mode 100755 index 00000000..43522064 --- /dev/null +++ b/app/Resources/views/default/admin-users.html.twig @@ -0,0 +1,24 @@ +{% extends 'base.html.twig' %} + +{% block page_title %} +Manage Users +{% endblock %} + +{% block content %} +
+ +

+ Add, edit, or remove users of this website. +

+ +
+ + +
+ +{% endblock %} diff --git a/app/Resources/views/default/admin.html.twig b/app/Resources/views/default/admin.html.twig new file mode 100755 index 00000000..bb4ad567 --- /dev/null +++ b/app/Resources/views/default/admin.html.twig @@ -0,0 +1,37 @@ +{% extends 'base.html.twig' %} + +{% block page_stylesheets %} +{% endblock %} + + +{% block page_scripts %} +{% endblock %} + + +{% block content %} +
+ +

Dataset Administration

+
+ + + + +
+ +{% endblock %} + diff --git a/app/Resources/views/default/approval_queue.html.twig b/app/Resources/views/default/approval_queue.html.twig new file mode 100755 index 00000000..9e3a4d00 --- /dev/null +++ b/app/Resources/views/default/approval_queue.html.twig @@ -0,0 +1,26 @@ +{% extends 'base.html.twig' %} + +{% block page_title %} + Unpublished Datasets +{% endblock %} + +{% block content %} + +
+ + + + +
+ +{% endblock %} diff --git a/app/Resources/views/default/contact.html.twig b/app/Resources/views/default/contact.html.twig new file mode 100755 index 00000000..a6ab0c75 --- /dev/null +++ b/app/Resources/views/default/contact.html.twig @@ -0,0 +1,37 @@ +{% extends 'base.html.twig' %} +{% form_theme form with ['bootstrap_3_horizontal_layout.html.twig', +_self] %} + +{% block page_title %} + Contact Us +{% endblock %} + +{% block form_group_class -%} +col-sm-7 +{%- endblock form_group_class %} + +{% block form_label_class -%} +col-sm-5 +{%- endblock form_label_class %} + + +{% block page_stylesheets %} +{% endblock %} + + +{% block page_scripts %} +{% endblock %} + + +{% block content %} +
+ + +{{ form(form) }} + +
+ +{% endblock %} + diff --git a/app/Resources/views/default/contact_email_send_success.html.twig b/app/Resources/views/default/contact_email_send_success.html.twig new file mode 100755 index 00000000..09b8afdc --- /dev/null +++ b/app/Resources/views/default/contact_email_send_success.html.twig @@ -0,0 +1,40 @@ +{% extends 'base.html.twig' %} +{% form_theme form with ['bootstrap_3_horizontal_layout.html.twig', +_self] %} + +{% block page_title %} + Contact Form Submitted +{% endblock %} + + +{% block form_group_class -%} +col-sm-7 +{%- endblock form_group_class %} + +{% block form_label_class -%} +col-sm-5 +{%- endblock form_label_class %} + + +{% block page_stylesheets %} +{% endblock %} + + +{% block page_scripts %} +{% endblock %} + + +{% block content %} +
+ + +{{ form(form) }} + +
+ +{% endblock %} + diff --git a/app/Resources/views/default/feedback_email.html.twig b/app/Resources/views/default/feedback_email.html.twig new file mode 100755 index 00000000..8a610a29 --- /dev/null +++ b/app/Resources/views/default/feedback_email.html.twig @@ -0,0 +1,21 @@ + + +

Hello, some new feedback has been received about the Data Catalog.

+

+Name: {{ msg.getFullName }} +

+

+Employee ID: {{ msg.getEmployeeId }} +

+

+Affiliation: {{ msg.getAffiliation }} +

+

+Email: {{ msg.getEmailAddress }} +

+

+Reason for contacting us: {{ msg.getReason }} +

+

{{ msg.getMessageBody }}

+ + diff --git a/app/Resources/views/default/list_of_entities_to_remove.html.twig b/app/Resources/views/default/list_of_entities_to_remove.html.twig new file mode 100755 index 00000000..a2e14554 --- /dev/null +++ b/app/Resources/views/default/list_of_entities_to_remove.html.twig @@ -0,0 +1,25 @@ +{% extends 'base.html.twig' %} + +{% block page_title %} + Remove Entities +{% endblock %} + +{% block content %} + +
+ + + +
+ +{% endblock %} diff --git a/app/Resources/views/default/list_of_entities_to_update.html.twig b/app/Resources/views/default/list_of_entities_to_update.html.twig new file mode 100755 index 00000000..1173f514 --- /dev/null +++ b/app/Resources/views/default/list_of_entities_to_update.html.twig @@ -0,0 +1,29 @@ +{% extends 'base.html.twig' %} + +{% block page_title %} + Update Entities +{% endblock %} + +{% block content %} + +
+ + + + +
+ +
+ +{% endblock %} diff --git a/app/Resources/views/default/modal_add.html.twig b/app/Resources/views/default/modal_add.html.twig new file mode 100755 index 00000000..6aadefb2 --- /dev/null +++ b/app/Resources/views/default/modal_add.html.twig @@ -0,0 +1,22 @@ +{% form_theme form with ['bootstrap_3_layout.html.twig'] %} + + + + + + + diff --git a/app/Resources/views/default/modal_add_success.html.twig b/app/Resources/views/default/modal_add_success.html.twig new file mode 100755 index 00000000..520652f6 --- /dev/null +++ b/app/Resources/views/default/modal_add_success.html.twig @@ -0,0 +1,16 @@ + + + + diff --git a/app/Resources/views/default/modal_remove.html.twig b/app/Resources/views/default/modal_remove.html.twig new file mode 100755 index 00000000..5241ab9d --- /dev/null +++ b/app/Resources/views/default/modal_remove.html.twig @@ -0,0 +1,21 @@ +{% form_theme form with ['bootstrap_3_layout.html.twig'] %} + + + + + + + diff --git a/app/Resources/views/default/modal_update.html.twig b/app/Resources/views/default/modal_update.html.twig new file mode 100755 index 00000000..82035fec --- /dev/null +++ b/app/Resources/views/default/modal_update.html.twig @@ -0,0 +1,21 @@ +{% form_theme form with ['bootstrap_3_layout.html.twig'] %} + + + + + + + diff --git a/app/Resources/views/default/no_results.html.twig b/app/Resources/views/default/no_results.html.twig new file mode 100755 index 00000000..6c4c148e --- /dev/null +++ b/app/Resources/views/default/no_results.html.twig @@ -0,0 +1,84 @@ +{% extends 'base.html.twig' %} + +{% block page_scripts %} +{% endblock %} + + + +{% block content %} +{# {{ dump() }} #} +
+
+
+
+
+ {% if currentSearch.keyword %} + + {% endif %} + {% for facet in currentSearch.facets %} + {% set facetSplit = facet|split(':') %} + + + {% endfor %} +
+
+ + {% if (results.numResults) %} +
+ Results Found: {{ results.numResults }} +
+{% endif %} +
+
+
+
+

Sorry, this search returned no results.

+

Please try removing some search criteria or starting over.

+
+
+

Still not finding what you're looking for?

+ Contact us to suggest new datasets or new topic areas to cover. + + + + + + + + + + +
+
+{% endblock %} diff --git a/app/Resources/views/default/queue_notification.html.twig b/app/Resources/views/default/queue_notification.html.twig new file mode 100755 index 00000000..95931c7b --- /dev/null +++ b/app/Resources/views/default/queue_notification.html.twig @@ -0,0 +1,20 @@ +{% if queueLength > 0 %} + {{ queueLength }} + {# + + There + {% if queueLength == 1 %} + is + {% else %} + are + {% endif %} + {{ queueLength }} + unpublished + {% if queueLength == 1 %} + dataset + {% else %} + datasets + {% endif %} + +#} +{% endif %} diff --git a/app/Resources/views/default/related_dataset_link.html.twig b/app/Resources/views/default/related_dataset_link.html.twig new file mode 100755 index 00000000..311b813a --- /dev/null +++ b/app/Resources/views/default/related_dataset_link.html.twig @@ -0,0 +1 @@ +{{ title }} diff --git a/app/Resources/views/default/remove.html.twig b/app/Resources/views/default/remove.html.twig new file mode 100755 index 00000000..3d068778 --- /dev/null +++ b/app/Resources/views/default/remove.html.twig @@ -0,0 +1,30 @@ +{% extends 'base.html.twig' %} +{% form_theme form with ['bootstrap_3_layout.html.twig', _self] %} + +{% block page_title %} + Remove an Entity +{% endblock %} + +{% block form_group_class -%} +col-sm-5 +{%- endblock %} + +{% block form_label_class -%} +col-sm-2 +{%- endblock %} + +{% block content %} +
+ + +
WARNING! This action cannot be undone!
+
+

Really remove {{ displayName }} "{{ thisEntityName }}"?

+
+{{ form(form, {'attr':{'class':'col-xs-9 remove-form','data-targetentity':entityName}}) }} +
+
+ +{% endblock content %} diff --git a/app/Resources/views/default/remove_success.html.twig b/app/Resources/views/default/remove_success.html.twig new file mode 100755 index 00000000..efc2e304 --- /dev/null +++ b/app/Resources/views/default/remove_success.html.twig @@ -0,0 +1,31 @@ +{% extends 'base.html.twig' %} + +{% block page_stylesheets %} +{% endblock %} + +{% block page_title %} + Entity Removed +{% endblock %} + +{% block page_scripts %} +{% endblock %} + + +{% block content %} +
+ +

+The {{ entityName }} was removed successfully. +

+
+

+click here to manage other entities. +

+ + +
+ +{% endblock %} + diff --git a/app/Resources/views/default/required_field.html.twig b/app/Resources/views/default/required_field.html.twig new file mode 100755 index 00000000..8aa9807f --- /dev/null +++ b/app/Resources/views/default/required_field.html.twig @@ -0,0 +1,9 @@ +{% extends 'form_div_layout.html.twig' %} + +{% block form_label %} + {{ parent() }} + + {% if required %} + * + {% endif %} +{% endblock %} diff --git a/app/Resources/views/default/results.html.twig b/app/Resources/views/default/results.html.twig new file mode 100755 index 00000000..2da1a8c8 --- /dev/null +++ b/app/Resources/views/default/results.html.twig @@ -0,0 +1,191 @@ +{% extends 'base.html.twig' %} + +{% block page_scripts %} +{% endblock %} + +{% block results_JSONLD_output %} + +{% endblock %} + +{% block content %} +{# {{ dump(currentSearch) }} #} +
+
+
+ {% if currentSearch.keyword %} + {% if ':' in currentSearch.keyword %} + {# {% set keyword = currentSearch.keyword|split(':')[1] %} #} + + {% else %} + + {% endif %} + {% endif %} + {% for facet in currentSearch.facets %} + {% set facetSplit = facet|split(':') %} + + + {% endfor %} +
+
+
+ {% set maxPages = (results.numResults/currentSearch.resultsPP)|round(0,'ceil') %} + {% if currentSearch.page == 0 %} + {% set pageCounter = 1 %} + {% else %} + {% set pageCounter = currentSearch.page %} + {% endif %} + {% if currentSearch.page > 1 %} + < Prev + {% endif %} + Page of {{ maxPages }} + {% if (currentSearch.page == 0 and currentSearch.resultsPP <= results.numResults) or + ((currentSearch.page * currentSearch.resultsPP) <= results.numResults) %} + Next > + {% endif %} +
+ {% if (results.numResults) %} +
+ Results Found: {{ results.numResults }} +
+{% endif %} + +
+
+
+
+
    + {% for item in results.resultItems %} +
  • +

    {{ item.dataset_title }}

    +
    + {% if item.dataset_alt_title[0] %} +
    Alternate Title(s)
    +
    {{ item.dataset_alt_title|join(', ') }}
    + {% endif %} +
    Description

    {{ item.description[0] }}

    +
    Subject
    {% for subject in item.subject_domain %} +
    {{ subject }}
    + {% endfor %}
    +
    Geographic Coverage
    {% for area in item.subject_geographic_area %} +
    {{ area }}
    + {% endfor %}
    + {% if item.dataset_start_date is not empty %} +
    Timeframe
    +
    {{ item.dataset_start_date }} - {{ item.dataset_end_date }}
    + {% endif %} + {% if item.access_restrictions[0] %} +
    Access Rights
    {% for restrict in item.access_restrictions %}
    {{ restrict }}
    {% endfor %}
    + {% endif %} + {% if item.local_experts[0] %} +
    Local Expert
    {% for index,expert in item.local_experts %} +
    + {% if item.local_expert_biosketch[index] is defined %} + {{ expert }} + {% else %} + {{ expert }} + {% endif %} +
    + {% endfor %} + +
    + {% endif %} +
    +
  • +{% endfor %} +
    +{% if currentSearch.page > 1 %} + +{% endif %} +{% if (currentSearch.page == 0 and currentSearch.resultsPP <= results.numResults) or + ((currentSearch.page * currentSearch.resultsPP) <= results.numResults) %} + +{% endif %} +
    +
+
+
+
+

Filter by

+ {% for category,facets in results.facets %} + {% set facetSection = [] %} + {% for facet in facets %} + {% set fullFacet = results.facetMappings[category] ~ ':"' ~ facet.facetItem ~ '"' %} + {% if fullFacet not in currentSearch.facets %} + {% set facetSection = facetSection|merge([facet]) %} + {% endif %} + {% endfor %} + {% if facetSection|length > 0 %} +
+
{{ category }}
+
    + {% for facet in facetSection %} + {% if facet.facetItem != '' and facet.facetCount is defined and facet.facetCount > 0 %} +
  • + + {{ facet.facetItem }} + + + {{ facet.facetCount }} + +
  • + {% endif %} + {% endfor %} +
+
+ {% endif %} + {% endfor %} +
+{% endblock %} diff --git a/app/Resources/views/default/simple_add.html.twig b/app/Resources/views/default/simple_add.html.twig new file mode 100755 index 00000000..198ae617 --- /dev/null +++ b/app/Resources/views/default/simple_add.html.twig @@ -0,0 +1,3 @@ +{{ form_start(form) }} +{{ form_widget(form) }} +{{ form_end(form) }} diff --git a/app/Resources/views/default/update.html.twig b/app/Resources/views/default/update.html.twig new file mode 100755 index 00000000..cb27d1db --- /dev/null +++ b/app/Resources/views/default/update.html.twig @@ -0,0 +1,99 @@ +{% extends 'base.html.twig' %} +{% form_theme form with ['bootstrap_3_horizontal_layout.html.twig', + _self] %} + + +{% block page_title %} + Update an Entity +{% endblock %} + +{% block page_stylesheets %} + +{% endblock %} + + +{% block page_scripts %} + + +{% endblock %} + + +{% block form_group_class -%} +col-sm-5 +{%- endblock form_group_class %} + + +{% block form_label_class -%} +col-sm-2 +{%- endblock form_label_class %} + + + +{% macro widget_prototype(widget,remove_text) %} + + {% if widget.vars.prototype is defined %} + {% set form = widget.vars.prototype %} + {% set name = widget.vars.prototype.vars.label %} + {% else %} + {% set form = widget %} + {% set name = widget.vars.label %} + {% endif %} + +
+
+ {{ form_widget(form) }} + {{ remove_text }} +
+ +{% endmacro %} + + + +{% block content %} + +
+ + {{ form_start(form) }} + {{ form_errors(form) }} + {% for child in form.children %} + {% if child.vars.prototype is defined %} +
+ +
+ {% for widget in child %} + {{ _self.widget_prototype(widget, 'Remove item') }} + {% endfor %} + + Add item +
+
+ {% else %} + {{ form_row(child) }} + {% endif %} + +{% endfor %} + + + {{ form_widget(form._token) }} + +
+

+or Remove this item +

+ + +
+ + + +{% endblock %} + diff --git a/app/Resources/views/default/update_dataset.html.twig b/app/Resources/views/default/update_dataset.html.twig new file mode 100755 index 00000000..2f143053 --- /dev/null +++ b/app/Resources/views/default/update_dataset.html.twig @@ -0,0 +1,231 @@ +{% extends 'base.html.twig' %} +{% form_theme form with ['bootstrap_3_horizontal_layout.html.twig', + _self] %} + +{% block page_title %} +Update a Dataset +{% endblock %} + +{% block page_stylesheets %} + +{% endblock %} + + +{% block page_scripts %} + + +{% endblock %} + +{% block form_group_class -%} +col-sm-8 +{%- endblock form_group_class %} + +{% block form_label_class -%} +col-sm-4 +{%- endblock form_label_class %} + + + +{% macro widget_prototype(widget,remove_text) %} + + {% if widget.vars.prototype is defined %} + {% set form = widget.vars.prototype %} + {% set name = widget.vars.prototype.vars.label %} + {% else %} + {% set form = widget %} + {% set name = widget.vars.label %} + {% endif %} + +
+
+ {{ form_widget(form) }} + {# {{ remove_text }}#} +
+
+ +{% endmacro %} + + + +{% block content %} +
+ + {{ form_start(form) }} + {% if form.vars.valid == false %} +
There was an error in this form. Please scroll down for more information.
+ {% endif %} + {{ form_errors(form) }} +
+ General Dataset Information + {{ form_row(form.dataset_uid) }} + {{ form_row(form.title) }} + {# DATASET ALTERNATE TITLES #} +
+ +
+ Add item +
+
+ {% for widget in form.dataset_alternate_titles %} + {{ _self.widget_prototype(widget, 'Remove item') }} + {% endfor %} +
+
+ {% if userIsAdmin %} + {{ form_row(form.origin) }} + {% endif %} + {{ form_row(form.description) }} + {{ form_row(form.subject_domains) }} + {{ form_row(form.subject_keywords) }} + {% if userIsAdmin %} + {{ form_row(form.published) }} + {% endif %} +
+
+ Author Information + {{ form_row(form.authors) }} + {{ form_row(form.corresponding_authors) }} + {{ form_row(form.publishers) }} +
+
+ Data Location Information + {{ form_row(form.accession_number) }} + {# DATA LOCATION URLS #} +
+ +
+ Add item +
+
+ {% for widget in form.data_locations %} + {{ _self.widget_prototype(widget, 'Remove item') }} + {% endfor %} +
+
+ {% if userIsAdmin %} + {{ form_row(form.date_archived) }} + {% endif %} + {# OTHER RESOURCES #} +
+ +
+ Add item +
+
+ {% for widget in form.other_resources %} + {{ _self.widget_prototype(widget, 'Remove item') }} + {% endfor %} +
+
+
+
+ Access + {{ form_row(form.access_instructions) }} + {% if userIsAdmin %} + {{ form_row(form.access_restrictions) }} + {% endif %} +
+
+ Detailed Dataset Information + {{ form_row(form.study_types) }} + {{ form_row(form.dataset_formats) }} + {{ form_row(form.dataset_size) }} + {{ form_row(form.data_types) }} + {{ form_row(form.measurement_standards) }} + {{ form_row(form.subject_start_date) }} + {{ form_row(form.subject_end_date) }} + {{ form_row(form.subject_genders) }} + {{ form_row(form.subject_population_ages) }} + {{ form_row(form.subject_geographic_areas) }} + {{ form_row(form.subject_geographic_area_details) }} +
+
+ Grants and Publications + {{ form_row(form.publications) }} + {{ form_row(form.awards) }} + {% if userIsAdmin %} + {# RELATED DATASETS #} +
+ +
+ Add item +
+
+ {% for widget in form.related_datasets %} + {{ _self.widget_prototype(widget, 'Remove item') }} + {% endfor %} +
+
+ {{ form_row(form.pubmed_search) }} + {% endif %} + {{ form_row(form.local_experts) }} +
+ {% if userIsAdmin %} +
+ Administration + {{ form_row(form.erd_url) }} + {{ form_row(form.library_catalog_url) }} + {{ form_row(form.licensing_details) }} + {{ form_row(form.license_expiration_date) }} + {{ form_row(form.subscriber) }} +
+ {% endif %} + {{ form_widget(form._token) }} + {{ form_widget(form.save) }} + + + +{# {% for child in form.children %} + {% if child.vars.prototype is defined %} +
+ +
+ Add item +
+
+ {% for widget in child %} + {{ _self.widget_prototype(widget, 'Remove item') }} + {% endfor %} + +
+
+ {% else %} + {{ form_row(child) }} + {% endif %} + +{% endfor %} + {{ form_widget(form._token) }} +#} + + + + + +
+ + + +{% endblock %} + diff --git a/app/Resources/views/default/update_dataset.html.twig.bakcup b/app/Resources/views/default/update_dataset.html.twig.bakcup new file mode 100755 index 00000000..9b9437e3 --- /dev/null +++ b/app/Resources/views/default/update_dataset.html.twig.bakcup @@ -0,0 +1,106 @@ +{% extends 'base.html.twig' %} +{% form_theme form with ['bootstrap_3_horizontal_layout.html.twig', + _self] %} + + +{% block page_title %} + Update a Dataset +{% endblock %} + +{% block page_stylesheets %} + +{% endblock %} + + +{% block page_scripts %} + + +{% endblock %} + +{% block form_group_class -%} +col-sm-8 +{%- endblock form_group_class %} + +{% block form_label_class -%} +col-sm-4 +{%- endblock form_label_class %} + + + +{% macro widget_prototype(widget,remove_text) %} + + {% if widget.vars.prototype is defined %} + {% set form = widget.vars.prototype %} + {% set name = widget.vars.prototype.vars.label %} + {% else %} + {% set form = widget %} + {% set name = widget.vars.label %} + {% endif %} + +
+
+ {{ form_widget(form) }} + {# {{ remove_text }}#} +
+
+ +{% endmacro %} + + + +{% block content %} +
+ + + {{ form_start(form) }} + {% if form.vars.valid == false %} +
There was an error in this form. Please scroll down for more information.
+ {% endif %} + {{ form_errors(form) }} + + {% for child in form.children %} + {% if child.vars.prototype is defined %} +
+ +
+ Add item +
+
+ {% for widget in child %} + {{ _self.widget_prototype(widget, 'Remove item') }} + {% endfor %} + +
+
+ {% else %} + {{ form_row(child) }} + {% endif %} + +{% endfor %} + + + {{ form_widget(form._token) }} + + + + +
+
+ + + +{% endblock %} + diff --git a/app/Resources/views/default/update_dataset_admin.html.twig b/app/Resources/views/default/update_dataset_admin.html.twig new file mode 100755 index 00000000..00c4309b --- /dev/null +++ b/app/Resources/views/default/update_dataset_admin.html.twig @@ -0,0 +1,234 @@ +{% extends 'base.html.twig' %} +{% form_theme form with ['bootstrap_3_horizontal_layout.html.twig', + _self] %} + +{% block page_title %} +Update a Dataset +{% endblock %} + +{% block page_stylesheets %} + +{% endblock %} + + +{% block page_scripts %} + + +{% endblock %} + +{% block form_group_class -%} +col-sm-8 +{%- endblock form_group_class %} + +{% block form_label_class -%} +col-sm-4 +{%- endblock form_label_class %} + + + +{% macro widget_prototype(widget,remove_text) %} + + {% if widget.vars.prototype is defined %} + {% set form = widget.vars.prototype %} + {% set name = widget.vars.prototype.vars.label %} + {% else %} + {% set form = widget %} + {% set name = widget.vars.label %} + {% endif %} + +
+
+ {{ form_widget(form) }} + {# {{ remove_text }}#} +
+
+ +{% endmacro %} + + + +{% block content %} +
+ + {{ form_start(form) }} + {% if form.vars.valid == false %} +
There was an error in this form. Please scroll down for more information.
+ {% endif %} + {{ form_errors(form) }} +
+ General Dataset Information + {{ form_row(form.dataset_uid) }} + {{ form_row(form.title) }} + {# DATASET ALTERNATE TITLES #} +
+ +
+ Add item +
+
+ {% for widget in form.dataset_alternate_titles %} + {{ _self.widget_prototype(widget, 'Remove item') }} + {% endfor %} +
+
+ {% if userIsAdmin %} + {{ form_row(form.origin) }} + {% endif %} + {{ form_row(form.description) }} + {{ form_row(form.subject_domains) }} + {{ form_row(form.subject_keywords) }} + {% if userIsAdmin %} + {{ form_row(form.published) }} + {% endif %} +
+
+ Author Information + {{ form_row(form.authors) }} + {{ form_row(form.corresponding_authors) }} + {{ form_row(form.publishers) }} +
+
+ Data Location Information + {{ form_row(form.accession_number) }} + {# DATA LOCATION URLS #} +
+ +
+ Add item +
+
+ {% for widget in form.data_locations %} + {{ _self.widget_prototype(widget, 'Remove item') }} + {% endfor %} +
+
+ {% if userIsAdmin %} + {{ form_row(form.date_archived) }} + {% endif %} + {# OTHER RESOURCES #} +
+ +
+ Add item +
+
+ {% for widget in form.other_resources %} + {{ _self.widget_prototype(widget, 'Remove item') }} + {% endfor %} +
+
+
+
+ Access + {{ form_row(form.access_instructions) }} + {% if userIsAdmin %} + {{ form_row(form.access_restrictions) }} + {% endif %} +
+
+ Detailed Dataset Information + {{ form_row(form.study_types) }} + {{ form_row(form.subject_of_study) }} + {{ form_row(form.related_equipment) }} + {{ form_row(form.related_software) }} + {{ form_row(form.dataset_formats) }} + {{ form_row(form.dataset_size) }} + {{ form_row(form.data_types) }} + {{ form_row(form.measurement_standards) }} + {{ form_row(form.subject_start_date) }} + {{ form_row(form.subject_end_date) }} + {{ form_row(form.subject_genders) }} + {{ form_row(form.subject_population_ages) }} + {{ form_row(form.subject_geographic_areas) }} + {{ form_row(form.subject_geographic_area_details) }} +
+
+ Grants and Publications + {{ form_row(form.publications) }} + {{ form_row(form.awards) }} + {% if userIsAdmin %} + {# RELATED DATASETS #} +
+ +
+ Add item +
+
+ {% for widget in form.related_datasets %} + {{ _self.widget_prototype(widget, 'Remove item') }} + {% endfor %} +
+
+ {{ form_row(form.pubmed_search) }} + {% endif %} + {{ form_row(form.local_experts) }} +
+ {% if userIsAdmin %} +
+ Administration + {{ form_row(form.erd_url) }} + {{ form_row(form.library_catalog_url) }} + {{ form_row(form.licensing_details) }} + {{ form_row(form.license_expiration_date) }} + {{ form_row(form.subscriber) }} +
+ {% endif %} + {{ form_widget(form._token) }} + {{ form_widget(form.save) }} + + + +{# {% for child in form.children %} + {% if child.vars.prototype is defined %} +
+ +
+ Add item +
+
+ {% for widget in child %} + {{ _self.widget_prototype(widget, 'Remove item') }} + {% endfor %} + +
+
+ {% else %} + {{ form_row(child) }} + {% endif %} + +{% endfor %} + {{ form_widget(form._token) }} +#} + + + + + +
+ + + +{% endblock %} + diff --git a/app/Resources/views/default/update_dataset_user.html.twig b/app/Resources/views/default/update_dataset_user.html.twig new file mode 100755 index 00000000..a34ce154 --- /dev/null +++ b/app/Resources/views/default/update_dataset_user.html.twig @@ -0,0 +1,132 @@ +{% extends 'base.html.twig' %} +{% form_theme form with ['bootstrap_3_horizontal_layout.html.twig', + _self] %} + +{% block page_title %} +Update a Dataset +{% endblock %} + +{% block page_stylesheets %} + +{% endblock %} + + +{% block page_scripts %} + + +{% endblock %} + +{% block form_group_class -%} +col-sm-8 +{%- endblock form_group_class %} + +{% block form_label_class -%} +col-sm-4 +{%- endblock form_label_class %} + + + +{% macro widget_prototype(widget,remove_text) %} + + {% if widget.vars.prototype is defined %} + {% set form = widget.vars.prototype %} + {% set name = widget.vars.prototype.vars.label %} + {% else %} + {% set form = widget %} + {% set name = widget.vars.label %} + {% endif %} + +
+
+ {{ form_widget(form) }} + {# {{ remove_text }}#} +
+
+ +{% endmacro %} + + + +{% block content %} +
+ + {{ form_start(form) }} + {% if form.vars.valid == false %} +
There was an error in this form. Please scroll down for more information.
+ {% endif %} + {{ form_errors(form) }} +
+ General Dataset Information + {{ form_row(form.title) }} + {{ form_row(form.description) }} + {{ form_row(form.subject_keywords) }} +
+
+ Author Information + {{ form_row(form.authors) }} +
+
+ Access + {{ form_row(form.access_instructions) }} +
+
+ Detailed Dataset Information + {{ form_row(form.subject_of_study) }} + {{ form_row(form.related_equipment) }} + {{ form_row(form.related_software) }} + {{ form_row(form.dataset_formats) }} + {{ form_row(form.measurement_standards) }} + {{ form_row(form.subject_start_date) }} + {{ form_row(form.subject_end_date) }} +
+ {{ form_widget(form._token) }} + {{ form_widget(form.save) }} + + + +{# {% for child in form.children %} + {% if child.vars.prototype is defined %} +
+ +
+ Add item +
+
+ {% for widget in child %} + {{ _self.widget_prototype(widget, 'Remove item') }} + {% endfor %} + +
+
+ {% else %} + {{ form_row(child) }} + {% endif %} + +{% endfor %} + {{ form_widget(form._token) }} +#} + + + + + +
+ + + +{% endblock %} + diff --git a/app/Resources/views/default/update_success.html.twig b/app/Resources/views/default/update_success.html.twig new file mode 100755 index 00000000..3afd1789 --- /dev/null +++ b/app/Resources/views/default/update_success.html.twig @@ -0,0 +1,34 @@ +{% extends 'base.html.twig' %} + +{% block page_stylesheets %} +{% endblock %} + +{% block page_title %} + Entity Updated +{% endblock %} + +{% block page_scripts %} +{% endblock %} + + +{% block content %} +
+ +

+The {{ displayName }} "{{ addedEntityName }}" was updated successfully. +

+
+

+To view the item, click here. +

+

+To make further edits, click here. +

+ + +
+ +{% endblock %} + diff --git a/app/Resources/views/default/view_dataset.html.twig b/app/Resources/views/default/view_dataset.html.twig new file mode 100755 index 00000000..bd33fd19 --- /dev/null +++ b/app/Resources/views/default/view_dataset.html.twig @@ -0,0 +1,216 @@ +{% extends 'base.html.twig' %} + +{% block page_title %} + {{ dataset.title }} +{% endblock %} + +{% block content %} +
+
+
+ {% if is_granted('ROLE_ADMIN') %} + + {% endif %} +

{{ dataset.title }} {% if dataset.published == false %}[unpublished]{%endif%}

+ + {% if dataset.datasetAlternateTitles.count > 0 %} +
Alternate Titles(s): + {% for title in dataset.datasetAlternateTitles %} + {{ title.getDisplayName|trim }}{% if not loop.last %}, {% endif %} + {% endfor %} +
+ {% endif %} +

+ UID: {{ dataset.id }} +

+ {% if dataset.authors|length > 0 %} +

+ Author(s): + {% for author in dataset.authors %} + {% if author.bioUrl %} + {{ author.fullName }}{% if not loop.last %}, {% endif %} + {% else %} + {{ author.fullName }}{% if not loop.last %}, {% endif %} + {% endif %} + {% endfor %} + +

+ {% endif %} + +

+
+
+
+
+
+
Description
+
{{ dataset.description }}
+
Publisher
+
+ {% for publisher in dataset.publishers %} +
+ {% if publisher.publisherUrl %} + {{ publisher.publisherName }} + {% else %} + {{ publisher.publisherName }} + {% endif %} +
+ {% endfor %} +
+ +
Timeframe
+
{{ dataset.subjectStartDate }} - {{ dataset.subjectEndDate }}
+ +
Geographic Coverage
+
+ {% if dataset.subjectGeographicAreaDetails.count > 5 %} + {% for area in dataset.subjectGeographicAreaDetails|slice(0,5) %} +
+ {{ area.getDisplayName }} +
+ {% endfor %} +
+ {% for area in dataset.subjectGeographicAreaDetails|slice(5,dataset.subjectGeographicAreaDetails.count) %} +
+ {{ area.getDisplayName }} +
+ {% endfor %} +
+ + {% else %} + + {% for area in dataset.subjectGeographicAreaDetails %} +
+ {{ area.getDisplayName }} +
+ {% endfor %} + {% endif %} +
+ + {% if dataset.localExperts|length > 0 %} +
Local Expert
+ {% for expert in dataset.localExperts %} + + {% endfor %} + {% endif %} +
+
+ +
Subject Domain
+
{% for domain in dataset.subjectDomains %} +
{{ domain.getDisplayName }}
+ {% endfor %} +
+ + {% if (dataset.subjectPopulationAges.count > 0) %} +
Population Age
+
{% for ageGroup in dataset.subjectPopulationAges %} +
{{ ageGroup.getDisplayName }}
+ {% endfor %}
+ {% endif %} + + {% if (dataset.subjectKeywords.count > 0) %} +
Keywords
+
{% for keyword in dataset.subjectKeywords %} +
{{ keyword.getDisplayName }}
+ {% endfor %} +
+ {% endif %} + + +
+
+
+
+ +
+ {% for url in dataset.dataLocationUrls %} + {% if dataset.dataLocationUrls.count > 1 %} +
+ Access this dataset +

Option {{ loop.index }}

+
+ {% else %} + + {% endif %} + {% endfor %} +
+ + {% if (dataset.accessRestrictions.count > 0) %} +
Access Restrictions
+
+ {% for restriction in dataset.accessRestrictions %} +
{{ restriction.getDisplayName }}
+ {% endfor %} +
+ {% endif %} + +
Access Instructions
+
{{ dataset.accessInstructions|raw }}
+ + {% if (dataset.dataTypes.count > 0) %} +
Dataset Type
+
+ {% for type in dataset.dataTypes %} +
{{ type.getDisplayName }}
+ {% endfor %} +
+ {% endif %} + + {% if (dataset.datasetFormats.count > 0) %} +
Dataset Format(s)
+
+ {% for format in dataset.datasetFormats %} + {{ format.getDisplayName|trim }}{% if not loop.last %}, {% endif %} + {% endfor %} +
+ {% endif %} + + {% if (dataset.datasetSize is not null) %} +
Dataset Size
+
{{ dataset.datasetSize }}
+ {% endif %} + +
+
+
+
+
PubMed Search
+
View articles which use this dataset
+ + {% if (dataset.relatedDatasets.count > 0) %} +
Related Datasets
+ + {% if (related.relationshipNotes is defined) %} +
Related Dataset - Note
+
{{ related.relationshipNotes }}
+ {% endif %} + {% endif %} +
+
+
+
+
+ + + +{% endblock %} diff --git a/app/Resources/views/default/view_dataset_external.html.twig b/app/Resources/views/default/view_dataset_external.html.twig new file mode 100755 index 00000000..7539aa5c --- /dev/null +++ b/app/Resources/views/default/view_dataset_external.html.twig @@ -0,0 +1,409 @@ +{% extends 'base.html.twig' %} + + +{% block page_scripts %} + +{% endblock %} + + + +{% block page_title %} + {{ dataset.title }} +{% endblock %} + + + +{% block JSONLD_output %} +{% spaceless %} + +{% endspaceless %} +{% endblock %} + + + +{% block content %} +
+
+
+ {% if is_granted('ROLE_ADMIN') %} + + {% endif %} +

{{ dataset.title }} {% if dataset.published == false %}[unpublished]{%endif%}

+ + {% if dataset.datasetAlternateTitles.count > 0 %} +
Alternate Titles(s): + {% for title in dataset.datasetAlternateTitles %} + {{ title.getDisplayName|trim }}{% if not loop.last %}, {% endif %} + {% endfor %} +
+ {% endif %} +

+ UID: {{ dataset.id }} +

+ + {% if dataset.authors is not empty or dataset.correspondingAuthors is not empty %} +

+ Author(s): + {% if dataset.correspondingAuthors is not empty %} + {% for author in dataset.correspondingAuthors %} + {% if author.bioUrl %} + {% set popoverContent = "

View profile

View other datasets

" %} + + {% else %} + {% set popoverContent = "

View other datasets

" %} + + {% endif %} + {{ author.fullName }}*{% if not loop.last or dataset.authors is not empty %}, {% endif %} + {% endfor %} + {% endif %} + {% if dataset.authors is not empty %} + {% for author in dataset.authors %} + {% if author.bioUrl %} + {% set popoverContent = "

View profile

View other datasets

" %} + {% else %} + {% set popoverContent = "

View other datasets

" %} + {% endif %} + {{ author.fullName }}{% if not loop.last %}, {% endif %} + {% endfor %} + {% endif %} +
+

+ {% if dataset.correspondingAuthors is not empty %} + * Corresponding Author + {% endif %} + {% endif %} +

+
+
+
+
+
+
Description
+
{{ dataset.description }}
+ {% if dataset.publishers is not empty %} +
Publisher
+
+ {% for publisher in dataset.publishers %} +
+ {% if publisher.publisherUrl %} + {% set popoverContent = "

View publisher website

View other datasets

" %} + {% else %} + {% set popoverContent = "

View other datasets

" %} + {% endif %} + {{ publisher.publisherName }} +
+ {% endfor %} +
+ {% endif %} + + {% if dataset.subjectStartDate is not empty %} +
Timeframe
+
{{ dataset.subjectStartDate }} - {{ dataset.subjectEndDate }}
+ {% endif %} + + + {% if dataset.subjectGeographicAreaDetails is not empty %} +
Geographic Coverage
+
+ {% if dataset.subjectGeographicAreaDetails.count > 5 %} + {% for area in dataset.subjectGeographicAreaDetails|slice(0,5) %} +
+ {{ area.getDisplayName }} +
+ {% endfor %} +
+ {% for area in dataset.subjectGeographicAreaDetails|slice(5,dataset.subjectGeographicAreaDetails.count) %} +
+ {{ area.getDisplayName }} +
+ {% endfor %} +
+ + {% else %} + + {% for area in dataset.subjectGeographicAreaDetails %} +
+ {{ area.getDisplayName }} +
+ {% endfor %} + {% endif %} +
+ {% endif %} + + {% if dataset.localExperts|length > 0 %} +
Local Expert
+ {% for expert in dataset.localExperts %} + + {% endfor %} + {% endif %} +
+
+ + {% if dataset.subjectOfStudy is not empty %} +
Subject of Study
+
{% for subject in dataset.subjectOfStudy %} + + {% endfor %} +
+ {% endif %} + + {% if dataset.subjectDomains is not empty %} +
Subject Domain
+
{% for domain in dataset.subjectDomains %} + + {% endfor %} +
+ {% endif %} + + {% if (dataset.subjectPopulationAges.count > 0) %} +
Population Age
+
{% for ageGroup in dataset.subjectPopulationAges %} +
{{ ageGroup.getDisplayName }}
+ {% endfor %}
+ {% endif %} + + {% if (dataset.subjectKeywords.count > 0) %} +
Keywords
+
{% for keyword in dataset.subjectKeywords %} + + {% endfor %} +
+ {% endif %} + + +
+
+
+
+ +
+ {% for location in dataset.dataLocations %} +
+ Access via {{ location.getDataLocation }}

{{ location.getLocationContent }}

+
+ {% endfor %} +
+ + {% if (dataset.accessRestrictions.count > 0) %} +
Access Restrictions
+
+ {% for restriction in dataset.accessRestrictions %} +
{{ restriction.getDisplayName }}
+ {% endfor %} +
+ {% endif %} + +
Access Instructions
+
{{ dataset.accessInstructions|raw }}
+ + {% if (dataset.dataTypes.count > 0) %} +
Data Type
+
+ {% for type in dataset.dataTypes %} +
{{ type.getDisplayName }}
+ {% endfor %} +
+ {% endif %} + + {% if (dataset.relatedEquipment.count > 0) %} +
Equipment Used
+
+ {% for equip in dataset.relatedEquipment %} +
{{ equip.getDisplayName }}
+ {% endfor %} +
+ {% endif %} + + {% if (dataset.relatedSoftware is not empty) %} +
Software Used
+
+ {% for sw in dataset.relatedSoftware %} +
{{ sw.getDisplayName }}
+ {% endfor %} +
+ {% endif %} + + {% if (dataset.studyTypes.count > 0) %} +
Study Type
+
+ {% for type in dataset.studyTypes %} +
{{ type.getDisplayName }}
+ {% endfor %} +
+ {% endif %} + + {% if (dataset.datasetFormats.count > 0) %} +
Dataset Format(s)
+
+ {% for format in dataset.datasetFormats %} + {{ format.getDisplayName|trim }}{% if not loop.last %}, {% endif %} + {% endfor %} +
+ {% endif %} + + {% if (dataset.datasetSize is not null) %} +
Dataset Size
+
{{ dataset.datasetSize }}
+ {% endif %} + +
+
+
+
+ {% if dataset.pubmedSearch is not empty %} +
PubMed Search
+
View articles which use this dataset
+ {% endif %} + + {% if (dataset.otherResources.count > 0) %} +
Other Resources
+
+ {% for resource in dataset.otherResources %} +
+ {{ resource.getResourceName }}

{{ resource.getResourceDescription }}

+
+ {% endfor %} +
+ {% endif %} + + {% if (dataset.relatedDatasets.count > 0) %} +
Related Datasets
+ + {% if (related.relationshipNotes is defined) %} +
Related Dataset - Note
+
{{ related.relationshipNotes }}
+ {% endif %} + {% endif %} +
+
+
+
+ +
+ + + +{% endblock %} diff --git a/app/Resources/views/default/view_dataset_internal.html.twig b/app/Resources/views/default/view_dataset_internal.html.twig new file mode 100755 index 00000000..def9c134 --- /dev/null +++ b/app/Resources/views/default/view_dataset_internal.html.twig @@ -0,0 +1,420 @@ +{% extends 'base.html.twig' %} + +{% block page_scripts %} + +{% endblock %} + + +{% block JSONLD_output %} +{% spaceless %} + +{% endspaceless %} +{% endblock %} + + +{% block page_title %} + {{ dataset.title }} +{% endblock %} + + +{% block content %} +
+
+
+ {% if is_granted('ROLE_ADMIN') %} + + {% endif %} +

{{ dataset.title }} Internal Dataset {% if dataset.published == false %}[unpublished]{%endif%}

+ + {% if dataset.datasetAlternateTitles.count > 0 %} +
Alternate Titles(s): + {% for title in dataset.datasetAlternateTitles %} + {{ title.getDisplayName|trim }}{% if not loop.last %}, {% endif %} + {% endfor %} +
+ {% endif %} +

+ UID: {{ dataset.id }} +

+ {% if dataset.authors is not empty or dataset.correspondingAuthors is not empty %} +

+ Author(s): + {% if dataset.correspondingAuthors is not empty %} + {% for author in dataset.correspondingAuthors %} + {% if author.bioUrl %} + {% set popoverContent = "

View profile

View other datasets

" %} + + {% else %} + {% set popoverContent = "

View other datasets

" %} + + {% endif %} + {{ author.fullName }}*{% if not loop.last or dataset.authors is not empty %}, {% endif %} + {% endfor %} + {% endif %} + {% if dataset.authors is not empty %} + {% for author in dataset.authors %} + {% if author.bioUrl %} + {% set popoverContent = "

View profile

View other datasets

" %} + {% else %} + {% set popoverContent = "

View other datasets

" %} + {% endif %} + {{ author.fullName }}{% if not loop.last %}, {% endif %} + {% endfor %} + {% endif %} +
+

+ {% if dataset.correspondingAuthors is not empty %} + * Corresponding Author + {% endif %} + {% endif %} + +

+
+
+
+
+
+
Description
+
{{ dataset.description }}
+ + {% if dataset.subjectStartDate is not empty %} +
Timeframe
+
{{ dataset.subjectStartDate }} - {{ dataset.subjectEndDate }}
+ {% endif %} + + {% if dataset.subjectGeographicAreaDetails is not empty %} +
Geographic Coverage
+
+ {% if dataset.subjectGeographicAreaDetails.count > 5 %} + {% for area in dataset.subjectGeographicAreaDetails|slice(0,5) %} +
+ {{ area.getDisplayName }} +
+ {% endfor %} +
+ {% for area in dataset.subjectGeographicAreaDetails|slice(5,dataset.subjectGeographicAreaDetails.count) %} +
+ {{ area.getDisplayName }} +
+ {% endfor %} +
+ + {% else %} + + {% for area in dataset.subjectGeographicAreaDetails %} +
+ {{ area.getDisplayName }} +
+ {% endfor %} + {% endif %} +
+ {% endif %} + + + {% if dataset.localExperts|length > 0 %} +
Local Expert
+ {% for expert in dataset.localExperts %} + + {% endfor %} + {% endif %} +
+
+ + {% if dataset.subjectOfStudy is not empty %} +
Subject of Study
+
{% for subject in dataset.subjectOfStudy %} + + {% endfor %} +
+ {% endif %} + + {% if dataset.subjectDomains is not empty %} +
Subject Domain
+
{% for domain in dataset.subjectDomains %} + + {% endfor %} +
+ {% endif %} + + + {% if (dataset.subjectPopulationAges.count > 0) %} +
Population Age
+
{% for ageGroup in dataset.subjectPopulationAges %} +
{{ ageGroup.getDisplayName }}
+ {% endfor %}
+ {% endif %} + + {% if (dataset.subjectKeywords.count > 0) %} +
Keywords
+
{% for keyword in dataset.subjectKeywords %} + + {% endfor %} +
+ {% endif %} + + +
+
+
+
+ +
+ {% for location in dataset.dataLocations %} +
+ Access via {{ location.getDataLocation }}

{{ location.getLocationContent }}

+
+ {% endfor %} +
+ {% if (dataset.accessionNumber is not null) %} +
Accession Number
+
{{ dataset.accessionNumber }}
+ {% endif %} + + {% if (dataset.accessRestrictions.count > 0) %} +
Access Restrictions
+
+ {% for restriction in dataset.accessRestrictions %} +
{{ restriction.getDisplayName }}
+ {% endfor %} +
+ {% endif %} + +
Access Instructions
+
{{ dataset.accessInstructions|raw }}
+ + + + {% if (dataset.publications.count > 0) %} +
Associated Publications
+
+ {% for pub in dataset.publications %} +
+ {% if pub.url is not null %} + {{ pub.citation }} + {% else %} + {{ pub.citation }} + {% endif %} +
+ {% endfor %} +
+ {% endif %} + + {% if dataset.pubmedSearch is not empty %} +
PubMed Search
+
View articles which use this dataset
+ {% endif %} + + {% if (dataset.dataTypes.count > 0) %} +
Data Type
+
+ {% for type in dataset.dataTypes %} +
{{ type.getDisplayName }}
+ {% endfor %} +
+ {% endif %} + + {% if (dataset.relatedEquipment.count > 0) %} +
Equipment Used
+
+ {% for equip in dataset.relatedEquipment %} +
{{ equip.getDisplayName }}
+ {% endfor %} +
+ {% endif %} + + {% if (dataset.relatedSoftware is not empty) %} +
Software Used
+
+ {% for sw in dataset.relatedSoftware %} +
{{ sw.getDisplayName }}
+ {% endfor %} +
+ {% endif %} + + {% if (dataset.studyTypes.count > 0) %} +
Study Type
+
+ {% for type in dataset.studyTypes %} +
{{ type.getDisplayName }}
+ {% endfor %} +
+ {% endif %} + + {% if (dataset.datasetFormats.count > 0) %} +
Dataset Format(s)
+
+ {% for format in dataset.datasetFormats %} + {{ format.getDisplayName|trim }}{% if not loop.last %}, {% endif %} + {% endfor %} +
+ {% endif %} + + {% if (dataset.measurementStandards.count > 0) %} +
Data Collection Standards
+
+ {% for standard in dataset.measurementStandards %} +
{{ standard.getDisplayName }}
+ {% endfor %} +
+ {% endif %} + + {% if (dataset.datasetSize is not null) %} +
Dataset Size
+
{{ dataset.datasetSize }}
+ {% endif %} + +
+
+
+
+ {% if (dataset.awards.count > 0) %} +
Grant Support
+
+ {% for grant in dataset.awards %} + {% if grant.awardUrl is not empty %} + + {% else %} +
+ {{ grant.award }}/{{ grant.awardFunder }} +
+ {% endif %} + {% endfor %} +
+ {% endif %} + + {% if (dataset.otherResources.count > 0) %} +
Other Resources
+
+ {% for resource in dataset.otherResources %} +
+ {{ resource.getResourceName }}

{{ resource.getResourceDescription }}

+
+ {% endfor %} +
+ {% endif %} + + {% if (dataset.relatedDatasets.count > 0) %} +
Related Datasets
+ + {% if (related.relationshipNotes is defined) %} +
Related Dataset - Note
+
{{ related.relationshipNotes }}
+ {% endif %} + {% endif %} +
+
+
+
+ +
+ + + +{% endblock %} diff --git a/app/Resources/views/footer.html.twig b/app/Resources/views/footer.html.twig new file mode 100644 index 00000000..b2cdd140 --- /dev/null +++ b/app/Resources/views/footer.html.twig @@ -0,0 +1,3 @@ +{# Use this template for your institution's footer content #} + diff --git a/app/Resources/views/logo.html.twig b/app/Resources/views/logo.html.twig new file mode 100644 index 00000000..991e8d73 --- /dev/null +++ b/app/Resources/views/logo.html.twig @@ -0,0 +1,5 @@ +{# This assumes your logo has been uploaded to: /web/img/logo.jpg #} +{# Remember to enter a URL if you want the logo to link anywhere #} + + + diff --git a/app/Resources/views/security/login.html.twig b/app/Resources/views/security/login.html.twig new file mode 100755 index 00000000..94a4c87c --- /dev/null +++ b/app/Resources/views/security/login.html.twig @@ -0,0 +1,44 @@ +{% extends 'base.html.twig' %} + + +{% block content %} + + +
+ +

Login

+ {% if error %} +
+ + {{ error.messageKey }} + +
+ {% endif %} +
+
+ +
+ +
+
+
+ +
+ +
+
+ {# + If you want to control the URL the user + is redirected to on success (more details below) + + #} +
+
+ +
+
+
+ +
+ +{% endblock %} diff --git a/app/SymfonyRequirements.php b/app/SymfonyRequirements.php new file mode 100755 index 00000000..28b0dcdb --- /dev/null +++ b/app/SymfonyRequirements.php @@ -0,0 +1,764 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Users of PHP 5.2 should be able to run the requirements checks. + * This is why the file and all classes must be compatible with PHP 5.2+ + * (e.g. not using namespaces and closures). + * + * ************** CAUTION ************** + * + * DO NOT EDIT THIS FILE as it will be overridden by Composer as part of + * the installation/update process. The original file resides in the + * SensioDistributionBundle. + * + * ************** CAUTION ************** + */ + +/** + * Represents a single PHP requirement, e.g. an installed extension. + * It can be a mandatory requirement or an optional recommendation. + * There is a special subclass, named PhpIniRequirement, to check a php.ini configuration. + * + * @author Tobias Schultze + */ +class Requirement +{ + private $fulfilled; + private $testMessage; + private $helpText; + private $helpHtml; + private $optional; + + /** + * Constructor that initializes the requirement. + * + * @param bool $fulfilled Whether the requirement is fulfilled + * @param string $testMessage The message for testing the requirement + * @param string $helpHtml The help text formatted in HTML for resolving the problem + * @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags) + * @param bool $optional Whether this is only an optional recommendation not a mandatory requirement + */ + public function __construct($fulfilled, $testMessage, $helpHtml, $helpText = null, $optional = false) + { + $this->fulfilled = (bool) $fulfilled; + $this->testMessage = (string) $testMessage; + $this->helpHtml = (string) $helpHtml; + $this->helpText = null === $helpText ? strip_tags($this->helpHtml) : (string) $helpText; + $this->optional = (bool) $optional; + } + + /** + * Returns whether the requirement is fulfilled. + * + * @return bool true if fulfilled, otherwise false + */ + public function isFulfilled() + { + return $this->fulfilled; + } + + /** + * Returns the message for testing the requirement. + * + * @return string The test message + */ + public function getTestMessage() + { + return $this->testMessage; + } + + /** + * Returns the help text for resolving the problem. + * + * @return string The help text + */ + public function getHelpText() + { + return $this->helpText; + } + + /** + * Returns the help text formatted in HTML. + * + * @return string The HTML help + */ + public function getHelpHtml() + { + return $this->helpHtml; + } + + /** + * Returns whether this is only an optional recommendation and not a mandatory requirement. + * + * @return bool true if optional, false if mandatory + */ + public function isOptional() + { + return $this->optional; + } +} + +/** + * Represents a PHP requirement in form of a php.ini configuration. + * + * @author Tobias Schultze + */ +class PhpIniRequirement extends Requirement +{ + /** + * Constructor that initializes the requirement. + * + * @param string $cfgName The configuration name used for ini_get() + * @param bool|callback $evaluation Either a boolean indicating whether the configuration should evaluate to true or false, + * or a callback function receiving the configuration value as parameter to determine the fulfillment of the requirement + * @param bool $approveCfgAbsence If true the Requirement will be fulfilled even if the configuration option does not exist, i.e. ini_get() returns false. + * This is helpful for abandoned configs in later PHP versions or configs of an optional extension, like Suhosin. + * Example: You require a config to be true but PHP later removes this config and defaults it to true internally. + * @param string|null $testMessage The message for testing the requirement (when null and $evaluation is a boolean a default message is derived) + * @param string|null $helpHtml The help text formatted in HTML for resolving the problem (when null and $evaluation is a boolean a default help is derived) + * @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags) + * @param bool $optional Whether this is only an optional recommendation not a mandatory requirement + */ + public function __construct($cfgName, $evaluation, $approveCfgAbsence = false, $testMessage = null, $helpHtml = null, $helpText = null, $optional = false) + { + $cfgValue = ini_get($cfgName); + + if (is_callable($evaluation)) { + if (null === $testMessage || null === $helpHtml) { + throw new InvalidArgumentException('You must provide the parameters testMessage and helpHtml for a callback evaluation.'); + } + + $fulfilled = call_user_func($evaluation, $cfgValue); + } else { + if (null === $testMessage) { + $testMessage = sprintf('%s %s be %s in php.ini', + $cfgName, + $optional ? 'should' : 'must', + $evaluation ? 'enabled' : 'disabled' + ); + } + + if (null === $helpHtml) { + $helpHtml = sprintf('Set %s to %s in php.ini*.', + $cfgName, + $evaluation ? 'on' : 'off' + ); + } + + $fulfilled = $evaluation == $cfgValue; + } + + parent::__construct($fulfilled || ($approveCfgAbsence && false === $cfgValue), $testMessage, $helpHtml, $helpText, $optional); + } +} + +/** + * A RequirementCollection represents a set of Requirement instances. + * + * @author Tobias Schultze + */ +class RequirementCollection implements IteratorAggregate +{ + private $requirements = array(); + + /** + * Gets the current RequirementCollection as an Iterator. + * + * @return Traversable A Traversable interface + */ + public function getIterator() + { + return new ArrayIterator($this->requirements); + } + + /** + * Adds a Requirement. + * + * @param Requirement $requirement A Requirement instance + */ + public function add(Requirement $requirement) + { + $this->requirements[] = $requirement; + } + + /** + * Adds a mandatory requirement. + * + * @param bool $fulfilled Whether the requirement is fulfilled + * @param string $testMessage The message for testing the requirement + * @param string $helpHtml The help text formatted in HTML for resolving the problem + * @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags) + */ + public function addRequirement($fulfilled, $testMessage, $helpHtml, $helpText = null) + { + $this->add(new Requirement($fulfilled, $testMessage, $helpHtml, $helpText, false)); + } + + /** + * Adds an optional recommendation. + * + * @param bool $fulfilled Whether the recommendation is fulfilled + * @param string $testMessage The message for testing the recommendation + * @param string $helpHtml The help text formatted in HTML for resolving the problem + * @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags) + */ + public function addRecommendation($fulfilled, $testMessage, $helpHtml, $helpText = null) + { + $this->add(new Requirement($fulfilled, $testMessage, $helpHtml, $helpText, true)); + } + + /** + * Adds a mandatory requirement in form of a php.ini configuration. + * + * @param string $cfgName The configuration name used for ini_get() + * @param bool|callback $evaluation Either a boolean indicating whether the configuration should evaluate to true or false, + * or a callback function receiving the configuration value as parameter to determine the fulfillment of the requirement + * @param bool $approveCfgAbsence If true the Requirement will be fulfilled even if the configuration option does not exist, i.e. ini_get() returns false. + * This is helpful for abandoned configs in later PHP versions or configs of an optional extension, like Suhosin. + * Example: You require a config to be true but PHP later removes this config and defaults it to true internally. + * @param string $testMessage The message for testing the requirement (when null and $evaluation is a boolean a default message is derived) + * @param string $helpHtml The help text formatted in HTML for resolving the problem (when null and $evaluation is a boolean a default help is derived) + * @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags) + */ + public function addPhpIniRequirement($cfgName, $evaluation, $approveCfgAbsence = false, $testMessage = null, $helpHtml = null, $helpText = null) + { + $this->add(new PhpIniRequirement($cfgName, $evaluation, $approveCfgAbsence, $testMessage, $helpHtml, $helpText, false)); + } + + /** + * Adds an optional recommendation in form of a php.ini configuration. + * + * @param string $cfgName The configuration name used for ini_get() + * @param bool|callback $evaluation Either a boolean indicating whether the configuration should evaluate to true or false, + * or a callback function receiving the configuration value as parameter to determine the fulfillment of the requirement + * @param bool $approveCfgAbsence If true the Requirement will be fulfilled even if the configuration option does not exist, i.e. ini_get() returns false. + * This is helpful for abandoned configs in later PHP versions or configs of an optional extension, like Suhosin. + * Example: You require a config to be true but PHP later removes this config and defaults it to true internally. + * @param string $testMessage The message for testing the requirement (when null and $evaluation is a boolean a default message is derived) + * @param string $helpHtml The help text formatted in HTML for resolving the problem (when null and $evaluation is a boolean a default help is derived) + * @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags) + */ + public function addPhpIniRecommendation($cfgName, $evaluation, $approveCfgAbsence = false, $testMessage = null, $helpHtml = null, $helpText = null) + { + $this->add(new PhpIniRequirement($cfgName, $evaluation, $approveCfgAbsence, $testMessage, $helpHtml, $helpText, true)); + } + + /** + * Adds a requirement collection to the current set of requirements. + * + * @param RequirementCollection $collection A RequirementCollection instance + */ + public function addCollection(RequirementCollection $collection) + { + $this->requirements = array_merge($this->requirements, $collection->all()); + } + + /** + * Returns both requirements and recommendations. + * + * @return array Array of Requirement instances + */ + public function all() + { + return $this->requirements; + } + + /** + * Returns all mandatory requirements. + * + * @return array Array of Requirement instances + */ + public function getRequirements() + { + $array = array(); + foreach ($this->requirements as $req) { + if (!$req->isOptional()) { + $array[] = $req; + } + } + + return $array; + } + + /** + * Returns the mandatory requirements that were not met. + * + * @return array Array of Requirement instances + */ + public function getFailedRequirements() + { + $array = array(); + foreach ($this->requirements as $req) { + if (!$req->isFulfilled() && !$req->isOptional()) { + $array[] = $req; + } + } + + return $array; + } + + /** + * Returns all optional recommendations. + * + * @return array Array of Requirement instances + */ + public function getRecommendations() + { + $array = array(); + foreach ($this->requirements as $req) { + if ($req->isOptional()) { + $array[] = $req; + } + } + + return $array; + } + + /** + * Returns the recommendations that were not met. + * + * @return array Array of Requirement instances + */ + public function getFailedRecommendations() + { + $array = array(); + foreach ($this->requirements as $req) { + if (!$req->isFulfilled() && $req->isOptional()) { + $array[] = $req; + } + } + + return $array; + } + + /** + * Returns whether a php.ini configuration is not correct. + * + * @return bool php.ini configuration problem? + */ + public function hasPhpIniConfigIssue() + { + foreach ($this->requirements as $req) { + if (!$req->isFulfilled() && $req instanceof PhpIniRequirement) { + return true; + } + } + + return false; + } + + /** + * Returns the PHP configuration file (php.ini) path. + * + * @return string|false php.ini file path + */ + public function getPhpIniConfigPath() + { + return get_cfg_var('cfg_file_path'); + } +} + +/** + * This class specifies all requirements and optional recommendations that + * are necessary to run the Symfony Standard Edition. + * + * @author Tobias Schultze + * @author Fabien Potencier + */ +class SymfonyRequirements extends RequirementCollection +{ + const REQUIRED_PHP_VERSION = '5.3.3'; + + /** + * Constructor that initializes the requirements. + */ + public function __construct() + { + /* mandatory requirements follow */ + + $installedPhpVersion = phpversion(); + + $this->addRequirement( + version_compare($installedPhpVersion, self::REQUIRED_PHP_VERSION, '>='), + sprintf('PHP version must be at least %s (%s installed)', self::REQUIRED_PHP_VERSION, $installedPhpVersion), + sprintf('You are running PHP version "%s", but Symfony needs at least PHP "%s" to run. + Before using Symfony, upgrade your PHP installation, preferably to the latest version.', + $installedPhpVersion, self::REQUIRED_PHP_VERSION), + sprintf('Install PHP %s or newer (installed version is %s)', self::REQUIRED_PHP_VERSION, $installedPhpVersion) + ); + + $this->addRequirement( + version_compare($installedPhpVersion, '5.3.16', '!='), + 'PHP version must not be 5.3.16 as Symfony won\'t work properly with it', + 'Install PHP 5.3.17 or newer (or downgrade to an earlier PHP version)' + ); + + $this->addRequirement( + is_dir(__DIR__.'/../vendor/composer'), + 'Vendor libraries must be installed', + 'Vendor libraries are missing. Install composer following instructions from http://getcomposer.org/. '. + 'Then run "php composer.phar install" to install them.' + ); + + $cacheDir = is_dir(__DIR__.'/../var/cache') ? __DIR__.'/../var/cache' : __DIR__.'/cache'; + + $this->addRequirement( + is_writable($cacheDir), + 'app/cache/ or var/cache/ directory must be writable', + 'Change the permissions of either "app/cache/" or "var/cache/" directory so that the web server can write into it.' + ); + + $logsDir = is_dir(__DIR__.'/../var/logs') ? __DIR__.'/../var/logs' : __DIR__.'/logs'; + + $this->addRequirement( + is_writable($logsDir), + 'app/logs/ or var/logs/ directory must be writable', + 'Change the permissions of either "app/logs/" or "var/logs/" directory so that the web server can write into it.' + ); + + $this->addPhpIniRequirement( + 'date.timezone', true, false, + 'date.timezone setting must be set', + 'Set the "date.timezone" setting in php.ini* (like Europe/Paris).' + ); + + if (version_compare($installedPhpVersion, self::REQUIRED_PHP_VERSION, '>=')) { + $timezones = array(); + foreach (DateTimeZone::listAbbreviations() as $abbreviations) { + foreach ($abbreviations as $abbreviation) { + $timezones[$abbreviation['timezone_id']] = true; + } + } + + $this->addRequirement( + isset($timezones[@date_default_timezone_get()]), + sprintf('Configured default timezone "%s" must be supported by your installation of PHP', @date_default_timezone_get()), + 'Your default timezone is not supported by PHP. Check for typos in your php.ini file and have a look at the list of deprecated timezones at http://php.net/manual/en/timezones.others.php.' + ); + } + + $this->addRequirement( + function_exists('iconv'), + 'iconv() must be available', + 'Install and enable the iconv extension.' + ); + + $this->addRequirement( + function_exists('json_encode'), + 'json_encode() must be available', + 'Install and enable the JSON extension.' + ); + + $this->addRequirement( + function_exists('session_start'), + 'session_start() must be available', + 'Install and enable the session extension.' + ); + + $this->addRequirement( + function_exists('ctype_alpha'), + 'ctype_alpha() must be available', + 'Install and enable the ctype extension.' + ); + + $this->addRequirement( + function_exists('token_get_all'), + 'token_get_all() must be available', + 'Install and enable the Tokenizer extension.' + ); + + $this->addRequirement( + function_exists('simplexml_import_dom'), + 'simplexml_import_dom() must be available', + 'Install and enable the SimpleXML extension.' + ); + + if (function_exists('apc_store') && ini_get('apc.enabled')) { + if (version_compare($installedPhpVersion, '5.4.0', '>=')) { + $this->addRequirement( + version_compare(phpversion('apc'), '3.1.13', '>='), + 'APC version must be at least 3.1.13 when using PHP 5.4', + 'Upgrade your APC extension (3.1.13+).' + ); + } else { + $this->addRequirement( + version_compare(phpversion('apc'), '3.0.17', '>='), + 'APC version must be at least 3.0.17', + 'Upgrade your APC extension (3.0.17+).' + ); + } + } + + $this->addPhpIniRequirement('detect_unicode', false); + + if (extension_loaded('suhosin')) { + $this->addPhpIniRequirement( + 'suhosin.executor.include.whitelist', + create_function('$cfgValue', 'return false !== stripos($cfgValue, "phar");'), + false, + 'suhosin.executor.include.whitelist must be configured correctly in php.ini', + 'Add "phar" to suhosin.executor.include.whitelist in php.ini*.' + ); + } + + if (extension_loaded('xdebug')) { + $this->addPhpIniRequirement( + 'xdebug.show_exception_trace', false, true + ); + + $this->addPhpIniRequirement( + 'xdebug.scream', false, true + ); + + $this->addPhpIniRecommendation( + 'xdebug.max_nesting_level', + create_function('$cfgValue', 'return $cfgValue > 100;'), + true, + 'xdebug.max_nesting_level should be above 100 in php.ini', + 'Set "xdebug.max_nesting_level" to e.g. "250" in php.ini* to stop Xdebug\'s infinite recursion protection erroneously throwing a fatal error in your project.' + ); + } + + $pcreVersion = defined('PCRE_VERSION') ? (float) PCRE_VERSION : null; + + $this->addRequirement( + null !== $pcreVersion, + 'PCRE extension must be available', + 'Install the PCRE extension (version 8.0+).' + ); + + if (extension_loaded('mbstring')) { + $this->addPhpIniRequirement( + 'mbstring.func_overload', + create_function('$cfgValue', 'return (int) $cfgValue === 0;'), + true, + 'string functions should not be overloaded', + 'Set "mbstring.func_overload" to 0 in php.ini* to disable function overloading by the mbstring extension.' + ); + } + + /* optional recommendations follow */ + + if (file_exists(__DIR__.'/../vendor/composer')) { + require_once __DIR__.'/../vendor/autoload.php'; + + try { + $r = new ReflectionClass('Sensio\Bundle\DistributionBundle\SensioDistributionBundle'); + + $contents = file_get_contents(dirname($r->getFileName()).'/Resources/skeleton/app/SymfonyRequirements.php'); + } catch (ReflectionException $e) { + $contents = ''; + } + $this->addRecommendation( + file_get_contents(__FILE__) === $contents, + 'Requirements file should be up-to-date', + 'Your requirements file is outdated. Run composer install and re-check your configuration.' + ); + } + + $this->addRecommendation( + version_compare($installedPhpVersion, '5.3.4', '>='), + 'You should use at least PHP 5.3.4 due to PHP bug #52083 in earlier versions', + 'Your project might malfunction randomly due to PHP bug #52083 ("Notice: Trying to get property of non-object"). Install PHP 5.3.4 or newer.' + ); + + $this->addRecommendation( + version_compare($installedPhpVersion, '5.3.8', '>='), + 'When using annotations you should have at least PHP 5.3.8 due to PHP bug #55156', + 'Install PHP 5.3.8 or newer if your project uses annotations.' + ); + + $this->addRecommendation( + version_compare($installedPhpVersion, '5.4.0', '!='), + 'You should not use PHP 5.4.0 due to the PHP bug #61453', + 'Your project might not work properly due to the PHP bug #61453 ("Cannot dump definitions which have method calls"). Install PHP 5.4.1 or newer.' + ); + + $this->addRecommendation( + version_compare($installedPhpVersion, '5.4.11', '>='), + 'When using the logout handler from the Symfony Security Component, you should have at least PHP 5.4.11 due to PHP bug #63379 (as a workaround, you can also set invalidate_session to false in the security logout handler configuration)', + 'Install PHP 5.4.11 or newer if your project uses the logout handler from the Symfony Security Component.' + ); + + $this->addRecommendation( + (version_compare($installedPhpVersion, '5.3.18', '>=') && version_compare($installedPhpVersion, '5.4.0', '<')) + || + version_compare($installedPhpVersion, '5.4.8', '>='), + 'You should use PHP 5.3.18+ or PHP 5.4.8+ to always get nice error messages for fatal errors in the development environment due to PHP bug #61767/#60909', + 'Install PHP 5.3.18+ or PHP 5.4.8+ if you want nice error messages for all fatal errors in the development environment.' + ); + + if (null !== $pcreVersion) { + $this->addRecommendation( + $pcreVersion >= 8.0, + sprintf('PCRE extension should be at least version 8.0 (%s installed)', $pcreVersion), + 'PCRE 8.0+ is preconfigured in PHP since 5.3.2 but you are using an outdated version of it. Symfony probably works anyway but it is recommended to upgrade your PCRE extension.' + ); + } + + $this->addRecommendation( + class_exists('DomDocument'), + 'PHP-DOM and PHP-XML modules should be installed', + 'Install and enable the PHP-DOM and the PHP-XML modules.' + ); + + $this->addRecommendation( + function_exists('mb_strlen'), + 'mb_strlen() should be available', + 'Install and enable the mbstring extension.' + ); + + $this->addRecommendation( + function_exists('iconv'), + 'iconv() should be available', + 'Install and enable the iconv extension.' + ); + + $this->addRecommendation( + function_exists('utf8_decode'), + 'utf8_decode() should be available', + 'Install and enable the XML extension.' + ); + + $this->addRecommendation( + function_exists('filter_var'), + 'filter_var() should be available', + 'Install and enable the filter extension.' + ); + + if (!defined('PHP_WINDOWS_VERSION_BUILD')) { + $this->addRecommendation( + function_exists('posix_isatty'), + 'posix_isatty() should be available', + 'Install and enable the php_posix extension (used to colorize the CLI output).' + ); + } + + $this->addRecommendation( + extension_loaded('intl'), + 'intl extension should be available', + 'Install and enable the intl extension (used for validators).' + ); + + if (extension_loaded('intl')) { + // in some WAMP server installations, new Collator() returns null + $this->addRecommendation( + null !== new Collator('fr_FR'), + 'intl extension should be correctly configured', + 'The intl extension does not behave properly. This problem is typical on PHP 5.3.X x64 WIN builds.' + ); + + // check for compatible ICU versions (only done when you have the intl extension) + if (defined('INTL_ICU_VERSION')) { + $version = INTL_ICU_VERSION; + } else { + $reflector = new ReflectionExtension('intl'); + + ob_start(); + $reflector->info(); + $output = strip_tags(ob_get_clean()); + + preg_match('/^ICU version +(?:=> )?(.*)$/m', $output, $matches); + $version = $matches[1]; + } + + $this->addRecommendation( + version_compare($version, '4.0', '>='), + 'intl ICU version should be at least 4+', + 'Upgrade your intl extension with a newer ICU version (4+).' + ); + + $this->addPhpIniRecommendation( + 'intl.error_level', + create_function('$cfgValue', 'return (int) $cfgValue === 0;'), + true, + 'intl.error_level should be 0 in php.ini', + 'Set "intl.error_level" to "0" in php.ini* to inhibit the messages when an error occurs in ICU functions.' + ); + } + + $accelerator = + (extension_loaded('eaccelerator') && ini_get('eaccelerator.enable')) + || + (extension_loaded('apc') && ini_get('apc.enabled')) + || + (extension_loaded('Zend Optimizer+') && ini_get('zend_optimizerplus.enable')) + || + (extension_loaded('Zend OPcache') && ini_get('opcache.enable')) + || + (extension_loaded('xcache') && ini_get('xcache.cacher')) + || + (extension_loaded('wincache') && ini_get('wincache.ocenabled')) + ; + + $this->addRecommendation( + $accelerator, + 'a PHP accelerator should be installed', + 'Install and/or enable a PHP accelerator (highly recommended).' + ); + + if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { + $this->addRecommendation( + $this->getRealpathCacheSize() > 1000, + 'realpath_cache_size should be above 1024 in php.ini', + 'Set "realpath_cache_size" to e.g. "1024" in php.ini* to improve performance on windows.' + ); + } + + $this->addPhpIniRecommendation('short_open_tag', false); + + $this->addPhpIniRecommendation('magic_quotes_gpc', false, true); + + $this->addPhpIniRecommendation('register_globals', false, true); + + $this->addPhpIniRecommendation('session.auto_start', false); + + $this->addRecommendation( + class_exists('PDO'), + 'PDO should be installed', + 'Install PDO (mandatory for Doctrine).' + ); + + if (class_exists('PDO')) { + $drivers = PDO::getAvailableDrivers(); + $this->addRecommendation( + count($drivers) > 0, + sprintf('PDO should have some drivers installed (currently available: %s)', count($drivers) ? implode(', ', $drivers) : 'none'), + 'Install PDO drivers (mandatory for Doctrine).' + ); + } + } + + /** + * Loads realpath_cache_size from php.ini and converts it to int. + * + * (e.g. 16k is converted to 16384 int) + * + * @return int + */ + protected function getRealpathCacheSize() + { + $size = ini_get('realpath_cache_size'); + $size = trim($size); + $unit = strtolower(substr($size, -1, 1)); + switch ($unit) { + case 'g': + return $size * 1024 * 1024 * 1024; + case 'm': + return $size * 1024 * 1024; + case 'k': + return $size * 1024; + default: + return (int) $size; + } + } +} diff --git a/app/autoload.php b/app/autoload.php new file mode 100755 index 00000000..70526bb5 --- /dev/null +++ b/app/autoload.php @@ -0,0 +1,13 @@ +getPhpIniConfigPath(); + +echo_title('Symfony Requirements Checker'); + +echo '> PHP is using the following php.ini file:'.PHP_EOL; +if ($iniPath) { + echo_style('green', ' '.$iniPath); +} else { + echo_style('warning', ' WARNING: No configuration file (php.ini) used by PHP!'); +} + +echo PHP_EOL.PHP_EOL; + +echo '> Checking Symfony requirements:'.PHP_EOL.' '; + +$messages = array(); +foreach ($symfonyRequirements->getRequirements() as $req) { + /** @var $req Requirement */ + if ($helpText = get_error_message($req, $lineSize)) { + echo_style('red', 'E'); + $messages['error'][] = $helpText; + } else { + echo_style('green', '.'); + } +} + +$checkPassed = empty($messages['error']); + +foreach ($symfonyRequirements->getRecommendations() as $req) { + if ($helpText = get_error_message($req, $lineSize)) { + echo_style('yellow', 'W'); + $messages['warning'][] = $helpText; + } else { + echo_style('green', '.'); + } +} + +if ($checkPassed) { + echo_block('success', 'OK', 'Your system is ready to run Symfony projects'); +} else { + echo_block('error', 'ERROR', 'Your system is not ready to run Symfony projects'); + + echo_title('Fix the following mandatory requirements', 'red'); + + foreach ($messages['error'] as $helpText) { + echo ' * '.$helpText.PHP_EOL; + } +} + +if (!empty($messages['warning'])) { + echo_title('Optional recommendations to improve your setup', 'yellow'); + + foreach ($messages['warning'] as $helpText) { + echo ' * '.$helpText.PHP_EOL; + } +} + +echo PHP_EOL; +echo_style('title', 'Note'); +echo ' The command console could use a different php.ini file'.PHP_EOL; +echo_style('title', '~~~~'); +echo ' than the one used with your web server. To be on the'.PHP_EOL; +echo ' safe side, please check the requirements from your web'.PHP_EOL; +echo ' server using the '; +echo_style('yellow', 'web/config.php'); +echo ' script.'.PHP_EOL; +echo PHP_EOL; + +exit($checkPassed ? 0 : 1); + +function get_error_message(Requirement $requirement, $lineSize) +{ + if ($requirement->isFulfilled()) { + return; + } + + $errorMessage = wordwrap($requirement->getTestMessage(), $lineSize - 3, PHP_EOL.' ').PHP_EOL; + $errorMessage .= ' > '.wordwrap($requirement->getHelpText(), $lineSize - 5, PHP_EOL.' > ').PHP_EOL; + + return $errorMessage; +} + +function echo_title($title, $style = null) +{ + $style = $style ?: 'title'; + + echo PHP_EOL; + echo_style($style, $title.PHP_EOL); + echo_style($style, str_repeat('~', strlen($title)).PHP_EOL); + echo PHP_EOL; +} + +function echo_style($style, $message) +{ + // ANSI color codes + $styles = array( + 'reset' => "\033[0m", + 'red' => "\033[31m", + 'green' => "\033[32m", + 'yellow' => "\033[33m", + 'error' => "\033[37;41m", + 'success' => "\033[37;42m", + 'title' => "\033[34m", + ); + $supports = has_color_support(); + + echo($supports ? $styles[$style] : '').$message.($supports ? $styles['reset'] : ''); +} + +function echo_block($style, $title, $message) +{ + $message = ' '.trim($message).' '; + $width = strlen($message); + + echo PHP_EOL.PHP_EOL; + + echo_style($style, str_repeat(' ', $width).PHP_EOL); + echo_style($style, str_pad(' ['.$title.']', $width, ' ', STR_PAD_RIGHT).PHP_EOL); + echo_style($style, str_pad($message, $width, ' ', STR_PAD_RIGHT).PHP_EOL); + echo_style($style, str_repeat(' ', $width).PHP_EOL); +} + +function has_color_support() +{ + static $support; + + if (null === $support) { + if (DIRECTORY_SEPARATOR == '\\') { + $support = false !== getenv('ANSICON') || 'ON' === getenv('ConEmuANSI'); + } else { + $support = function_exists('posix_isatty') && @posix_isatty(STDOUT); + } + } + + return $support; +} diff --git a/app/config/README.md b/app/config/README.md new file mode 100644 index 00000000..06c0cdb0 --- /dev/null +++ b/app/config/README.md @@ -0,0 +1,15 @@ +This is the main configuration directory for Symfony, and you'll need to do some customization here. + +First, check out "parameters.yml.example". This file contains database connection strings, Solr and LDAP configuration settings, and opportunities to name and brand your site. You probably don't want to change most of the Solr settings, but be sure to give Symfony the URL of you Solr server. + +You'll need to rename this file to "parameters.yml" and put a copy in both the dev/ and prod/ directories -- this way Symfony can connect to your Dev or Prod databases where appropriate. + +The next file to look at is "security.yml.example". This tells Symfony how to protect certain areas of your site and how to handle authentication. This example file is meant for use in **DEV ONLY**. It contains a default admin account (with a very insecure password) that you can use right away to start entering datasets, creating real users, etc. + +This file need only exist in the common/ directory, as "security.yml". + +This example file also does not require HTTPS connections anywhere, but we suggest requiring HTTPS for every route once you get your certificate set up. + +There are some commented-out lines that can be used to set up LDAP authentication if you want to use it. Users must be created in this website's Admin section first, which is checked before going to the LDAP server -- i.e., it isn't enough to exist in your institution's LDAP, you must also grant access to specific users in this application. + +Symfony also has a robust built-in user management and authentication system if your institution doesn't use LDAP or you just don't want to. diff --git a/app/config/common/config.yml b/app/config/common/config.yml new file mode 100755 index 00000000..1ecc41ac --- /dev/null +++ b/app/config/common/config.yml @@ -0,0 +1,54 @@ +imports: + - { resource: security.yml } + - { resource: services.yml } + - { resource: "@AppBundle/Resources/config/services.yml" } + +framework: + #esi: ~ + #translator: { fallback: "%locale%" } + secret: "%secret%" + router: + resource: "%kernel.root_dir%/config/common/routing.yml" + strict_requirements: ~ + form: ~ + csrf_protection: ~ + validation: { enable_annotations: true } + templating: + engines: ['twig'] + #assets_version: SomeVersionScheme + default_locale: "%locale%" + trusted_hosts: ~ + trusted_proxies: ~ + session: + # handler_id set to null will use default session handler from php.ini + handler_id: session.handler.native_file + save_path: "%kernel.root_dir%/sessions" + fragments: ~ + http_method_override: true + +# Twig Configuration +twig: + debug: "%kernel.debug%" + strict_variables: "%kernel.debug%" + +# Assetic Configuration +assetic: + debug: "%kernel.debug%" + use_controller: true + bundles: [ ] + #java: /usr/bin/java + filters: + cssrewrite: ~ + #closure: + # jar: "%kernel.root_dir%/Resources/java/compiler.jar" + #yui_css: + # jar: "%kernel.root_dir%/Resources/java/yuicompressor-2.4.7.jar" + + +# Swiftmailer Configuration +swiftmailer: + transport: "%mailer_transport%" + host: "%mailer_host%" + username: "%mailer_user%" + password: "%mailer_password%" + spool: { type: memory } diff --git a/app/config/common/parameters.yml.dist b/app/config/common/parameters.yml.dist new file mode 100755 index 00000000..1da778f4 --- /dev/null +++ b/app/config/common/parameters.yml.dist @@ -0,0 +1,20 @@ +# This file is a "template" of what your parameters.yml file should look like +parameters: + database_driver: pdo_mysql + database_host: 127.0.0.1 + database_port: ~ + database_name: symfony + database_user: root + database_password: ~ + # You should uncomment this if you want use pdo_sqlite + # database_path: "%kernel.root_dir%/data.db3" + + mailer_transport: smtp + mailer_host: 127.0.0.1 + mailer_user: ~ + mailer_password: ~ + + locale: en + + # A secret key that's used to generate certain security-related tokens + secret: ThisTokenIsNotSoSecretChangeIt diff --git a/app/config/common/routing.yml b/app/config/common/routing.yml new file mode 100755 index 00000000..9b55ca4a --- /dev/null +++ b/app/config/common/routing.yml @@ -0,0 +1,3 @@ +app: + resource: @AppBundle/Controller/ + type: annotation diff --git a/app/config/common/services.yml b/app/config/common/services.yml new file mode 100755 index 00000000..c8e8639f --- /dev/null +++ b/app/config/common/services.yml @@ -0,0 +1,22 @@ +# Learn more about services, parameters and containers at +# http://symfony.com/doc/current/book/service_container.html +parameters: +# parameter_name: value + +services: + app.ldap: + class: Symfony\Component\Ldap\LdapClient + arguments: ["%ldap.host%", "%ldap.port%"] + db_user_provider: + class: AppBundle\Entity\Security\UserRepository + factory_service: doctrine + factory_method: getRepository + arguments: ["AppBundle:Security\\User"] + AppBundle.type.access_restriction_selector: + class: AppBundle\Form\Type\AccessRestrictionSelectorType + arguments: ["@doctrine.orm.entity_manager"] + tags: + - { name: form.type, alias: access_restriction_selector } +# service_name: +# class: AppBundle\Directory\ClassName +# arguments: ["@another_service_name", "plain_value", "%parameter_name%"] diff --git a/app/config/dev/config.yml b/app/config/dev/config.yml new file mode 100755 index 00000000..978dc1c9 --- /dev/null +++ b/app/config/dev/config.yml @@ -0,0 +1,88 @@ +imports: + - { resource: "../common/config.yml" } + - { resource: 'parameters.yml' } +# - { resource: 'security.yml' } + +framework: + router: + resource: "%kernel.root_dir%/config/dev/routing.yml" + strict_requirements: true + profiler: { only_exceptions: false } + +web_profiler: + toolbar: true + intercept_redirects: false + +# Twig template configuration +twig: + globals: + site_name: '%site_name%' + site_description: '%site_description%' + site_base_url: '%site_base_url%' + site_provider_name: '%site_provider_name%' + site_provider_url: '%site_provider_url%' + institution_name: '%institution_name%' + institution_address: '%institution_address%' + institution_url: '%institution_url%' + +# Doctrine Configuration +doctrine: + dbal: + driver: "%database_driver%" + host: "%database_host%" + port: "%database_port%" + dbname: "%database_name%" + user: "%database_user%" + password: "%database_password%" + charset: UTF8 + # if using pdo_sqlite as your database driver: + # 1. add the path in parameters.yml + # e.g. database_path: "%kernel.root_dir%/data/data.db3" + # 2. Uncomment database_path in parameters.yml.dist + # 3. Uncomment next line: + # path: "%database_path%" + + orm: + auto_generate_proxy_classes: "%kernel.debug%" + auto_mapping: true + + +monolog: + handlers: + main: + type: stream + path: "%kernel.logs_dir%/%kernel.environment%.log" + level: debug + console: + type: console + bubble: false + verbosity_levels: + VERBOSITY_VERBOSE: INFO + VERBOSITY_VERY_VERBOSE: DEBUG + channels: ["!doctrine"] + console_very_verbose: + type: console + bubble: false + verbosity_levels: + VERBOSITY_VERBOSE: NOTICE + VERBOSITY_VERY_VERBOSE: NOTICE + VERBOSITY_DEBUG: DEBUG + channels: ["doctrine"] + # uncomment to get logging in your browser + # you may have to allow bigger header sizes in your Web server configuration + #firephp: + # type: firephp + # level: info + #chromephp: + # type: chromephp + # level: info + +assetic: + use_controller: true + +swiftmailer: + delivery_address: lambi01@nyumc.org + transport: sendmail + host: localhost + port: 25 + diff --git a/app/config/dev/routing.yml b/app/config/dev/routing.yml new file mode 100755 index 00000000..1f31d450 --- /dev/null +++ b/app/config/dev/routing.yml @@ -0,0 +1,19 @@ +_wdt: + resource: "@WebProfilerBundle/Resources/config/routing/wdt.xml" + prefix: /_wdt + +_profiler: + resource: "@WebProfilerBundle/Resources/config/routing/profiler.xml" + prefix: /_profiler + +_configurator: + resource: "@SensioDistributionBundle/Resources/config/routing/webconfigurator.xml" + prefix: /_configurator + +_errors: + resource: "@TwigBundle/Resources/config/routing/errors.xml" + prefix: /_error + +_main: + resource: '@AppBundle/Resources/config/routing.yml' + diff --git a/app/config/dev/security.yml b/app/config/dev/security.yml new file mode 100755 index 00000000..22119941 --- /dev/null +++ b/app/config/dev/security.yml @@ -0,0 +1,36 @@ +# you can read more about security in the related section of the documentation +# http://symfony.com/doc/current/book/security.html +security: + # http://symfony.com/doc/current/book/security.html#encoding-the-user-s-password + encoders: + Symfony\Component\Security\Core\User\User: plaintext + + # http://symfony.com/doc/current/book/security.html#hierarchical-roles + role_hierarchy: + ROLE_ADMIN: ROLE_USER + ROLE_SUPER_ADMIN: [ROLE_USER, ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH] + + # http://symfony.com/doc/current/book/security.html#where-do-users-come-from-user-providers + providers: + in_memory: + memory: + users: + user: { password: userpass, roles: [ 'ROLE_USER' ] } + admin: { password: adminpass, roles: [ 'ROLE_ADMIN' ] } + + # the main part of the security, where you can set up firewalls + # for specific sections of your app + firewalls: + # disables authentication for assets and the profiler, adapt it according to your needs + dev: + pattern: ^/(_(profiler|wdt)|css|images|js)/ + security: false + + # with these settings you can restrict or allow access for different parts + # of your application based on roles, ip, host or methods + # http://symfony.com/doc/current/cookbook/security/access_control.html + access_control: + - { path: ^/login, roles: IS_AUTHENTICATED_ANONYMOUSLY, requires_channel: https } + - { path: ^/add, roles: IS_AUTHENTICATED_ANONYMOUSLY, requires_channel: https } + - { path: ^/remove, roles: IS_AUTHENTICATED_ANONYMOUSLY, requires_channel: https } + - { path: ^/update, roles: IS_AUTHENTICATED_ANONYMOUSLY, requires_channel: https } diff --git a/app/config/dev/services.yml b/app/config/dev/services.yml new file mode 100755 index 00000000..5c76fc59 --- /dev/null +++ b/app/config/dev/services.yml @@ -0,0 +1,9 @@ +# Learn more about services, parameters and containers at +# http://symfony.com/doc/current/book/service_container.html +parameters: +# parameter_name: value + +services: +# service_name: +# class: AppBundle\Directory\ClassName +# arguments: ["@another_service_name", "plain_value", "%parameter_name%"] diff --git a/app/config/parameters.yml b/app/config/parameters.yml new file mode 100755 index 00000000..c851e194 --- /dev/null +++ b/app/config/parameters.yml @@ -0,0 +1,14 @@ +# This file is auto-generated during the composer install +parameters: + database_driver: pdo_mysql + database_host: 127.0.0.1 + database_port: null + database_name: symfony + database_user: root + database_password: null + mailer_transport: smtp + mailer_host: 127.0.0.1 + mailer_user: null + mailer_password: null + locale: en + secret: ThisTokenIsNotSoSecretChangeIt diff --git a/app/config/parameters.yml.dist b/app/config/parameters.yml.dist new file mode 100755 index 00000000..1da778f4 --- /dev/null +++ b/app/config/parameters.yml.dist @@ -0,0 +1,20 @@ +# This file is a "template" of what your parameters.yml file should look like +parameters: + database_driver: pdo_mysql + database_host: 127.0.0.1 + database_port: ~ + database_name: symfony + database_user: root + database_password: ~ + # You should uncomment this if you want use pdo_sqlite + # database_path: "%kernel.root_dir%/data.db3" + + mailer_transport: smtp + mailer_host: 127.0.0.1 + mailer_user: ~ + mailer_password: ~ + + locale: en + + # A secret key that's used to generate certain security-related tokens + secret: ThisTokenIsNotSoSecretChangeIt diff --git a/app/config/parameters.yml.example b/app/config/parameters.yml.example new file mode 100755 index 00000000..4c640a86 --- /dev/null +++ b/app/config/parameters.yml.example @@ -0,0 +1,72 @@ +## +## +## This is a sample parameters.yml file. Your installation will need at +## least these parameters. Use this file to customize your installation +## and tell Symfony about your database and Solr servers. +## +## This file must be copied into the ./dev/ and ./prod/ directories: +## ./dev/parameters.yml will have your Dev database and Solr installation +## ./prod/parameters.yml will have the production info +## +## If you use git/github, MAKE SURE ALL THESE FILES ARE IN YOUR .GITIGNORE!!! +## You should see the line "app/config/**/parameters.yml" in there by default. +## +## + + +parameters: + # + # Set these parameters for your installation so we can use them in our templates + # Some of this information is used in the Structured Data output + # + site_name: "Generic Data Catalog" + site_description: "This is a generic description of a generic data catalog." + site_base_url: "http://www.example.com" + site_provider_name: "Generic Library or Department that Made the Data Catalog" + site_provider_url: "http://library.example.edu" + institution_name: "Generic Academic Institution" + institution_address: "123 Fake Street, Springfield USA" + institution_url: "http://www.example.edu" + contact_email_to: + contact_email_from: + + # + # Technical stuff + # + database_driver: pdo_mysql + database_name: + database_host: + database_user: + database_password: + database_port: + mailer_transport: smtp + mailer_host: 127.0.0.1 + mailer_user: null + mailer_password: null + locale: en + secret: + + # + # Solr stuff. You mostly want to set the server URL. + # The other settings are a bit more involved to change. + # + solrsearchr_server: + solrsearchr_format: json + solrsearchr_facets: + - subject_domain_fq + - subject_geographic_area_fq + - access_restrictions_fq + solrsearchr_fields_to_search: + - text + solrsearchr_fields_to_display: + - id + - dataset_title + - dataset_alt_title + - description + - subject_domain + - access_restrictions + - local_experts + - subject_geographic_area + - dataset_start_date + - dataset_end_date + diff --git a/app/config/prod/config.yml b/app/config/prod/config.yml new file mode 100755 index 00000000..1a36a865 --- /dev/null +++ b/app/config/prod/config.yml @@ -0,0 +1,44 @@ +imports: + - { resource: "../common/config.yml" } + - { resource: 'parameters.yml' } + # - { resource: 'security.yml' } + +framework: + validation: + cache: apc + router: + resource: "%kernel.root_dir%/config/prod/routing.yml" + strict_requirements: true + profiler: { only_exceptions: false } + +doctrine: + dbal: + driver: "%database_driver%" + host: "%database_host%" + port: "%database_port%" + dbname: "%database_name%" + user: "%database_user%" + password: "%database_password%" + charset: UTF8 + orm: + metadata_cache_driver: apc + result_cache_driver: apc + auto_mapping: true + query_cache_driver: apc + +monolog: + handlers: + main: + type: fingers_crossed + action_level: error + handler: nested + nested: + type: stream + path: "%kernel.logs_dir%/%kernel.environment%.log" + level: debug + console: + type: console +swiftmailer: + transport: sendmail + host: localhost + port: 25 diff --git a/app/config/prod/routing.yml b/app/config/prod/routing.yml new file mode 100755 index 00000000..bdb2ecd8 --- /dev/null +++ b/app/config/prod/routing.yml @@ -0,0 +1,5 @@ +_main: + resource: '@AppBundle/Resources/config/routing.yml' +#app: +# resource: @AppBundle/Controller/ +# type: annotation diff --git a/app/config/prod/security.yml b/app/config/prod/security.yml new file mode 100755 index 00000000..e69de29b diff --git a/app/config/prod/services.yml b/app/config/prod/services.yml new file mode 100755 index 00000000..5c76fc59 --- /dev/null +++ b/app/config/prod/services.yml @@ -0,0 +1,9 @@ +# Learn more about services, parameters and containers at +# http://symfony.com/doc/current/book/service_container.html +parameters: +# parameter_name: value + +services: +# service_name: +# class: AppBundle\Directory\ClassName +# arguments: ["@another_service_name", "plain_value", "%parameter_name%"] diff --git a/app/config/security.yml.example b/app/config/security.yml.example new file mode 100755 index 00000000..77abc945 --- /dev/null +++ b/app/config/security.yml.example @@ -0,0 +1,85 @@ +# +# +# !! NOTE: +# ! Please disable the in_memory provider for production +# ! It is meant for DEVELOPMENT only +# ! Please read all comments below +# +# +# +# you can read more about security in the related section of the documentation +# http://symfony.com/doc/current/book/security.html +security: + # http://symfony.com/doc/current/book/security.html#encoding-the-user-s-password + encoders: + Symfony\Component\Security\Core\User\User: plaintext + AppBundle\Entity\Security\User: plaintext + + # http://symfony.com/doc/current/book/security.html#hierarchical-roles + role_hierarchy: + ROLE_ADMIN: ROLE_USER + ROLE_SUPER_ADMIN: [ROLE_USER, ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH] + + # http://symfony.com/doc/current/book/security.html#where-do-users-come-from-user-providers + providers: + # ! DISABLE the in_memory provider for prod + in_memory: + memory: + users: + admin: { password: adminpass, roles: [ 'ROLE_ADMIN' ] } + db_provider: + id: db_user_provider + users: + entity: { class: AppBundle:Security\User, property: username } + + firewalls: + dev: + pattern: ^/(_(profiler|wdt)|css|images|js)/ + security: false + #login: + # security: false + #default: + # anonymous: ~ + # http_basic: ~ + + secured_area: + pattern: ^/ + anonymous: ~ + # + # ! The in_memory provider should be used in DEV ONLY + # ! + # ! Please configure the LDAP authentication below, or + # ! use Symfony's native user management/auth if you don't + # ! want to tie in to your institutional system + # + form_login: + provider: in_memory + login_path: /login + check_path: /login_check + default_target_path: admin_panel + #form_login_ldap: + # service: app.ldap + # dn_string: ** FILL THIS OUT ** + # login_path: /login + # check_path: /login_check + # default_target_path: admin_panel + logout: + path: /logout + target: / + + + # http://symfony.com/doc/current/cookbook/security/access_control.html + + # !!!! NOTE: this is a basic setup for DEVELOPMENT ONLY + # !!!! Production systems should require HTTPS + access_control: + # - { path: ^/login, roles: IS_AUTHENTICATED_ANONYMOUSLY, requires_channel: https } + # - { path: ^/login_check, roles: IS_AUTHENTICATED_ANONYMOUSLY, requires_channel: https } + - { path: ^/add, roles: ROLE_USER } + - { path: ^/remove, roles: ROLE_ADMIN } + - { path: ^/update, roles: ROLE_ADMIN } + - { path: ^/admin, roles: ROLE_USER } + - { path: ^/dashboard, roles: ROLE_USER } + - { path: ^/users, roles: ROLE_ADMIN } + - { path: ^/manage, roles: ROLE_ADMIN } + - { path: ^/, roles: IS_AUTHENTICATED_ANONYMOUSLY } diff --git a/app/config/test/config_test.yml b/app/config/test/config_test.yml new file mode 100755 index 00000000..2f6d9250 --- /dev/null +++ b/app/config/test/config_test.yml @@ -0,0 +1,16 @@ +imports: + - { resource: config_dev.yml } + +framework: + test: ~ + session: + storage_id: session.storage.mock_file + profiler: + collect: false + +web_profiler: + toolbar: false + intercept_redirects: false + +swiftmailer: + disable_delivery: true diff --git a/app/console b/app/console new file mode 100755 index 00000000..0ddb9727 --- /dev/null +++ b/app/console @@ -0,0 +1,27 @@ +#!/usr/bin/env php +getParameterOption(array('--env', '-e'), getenv('SYMFONY_ENV') ?: 'dev'); +$debug = getenv('SYMFONY_DEBUG') !== '0' && !$input->hasParameterOption(array('--no-debug', '')) && $env !== 'prod'; + +if ($debug) { + Debug::enable(); +} + +$kernel = new AppKernel($env, $debug); +$application = new Application($kernel); +$application->run($input); diff --git a/app/phpunit.xml.dist b/app/phpunit.xml.dist new file mode 100755 index 00000000..2b41503b --- /dev/null +++ b/app/phpunit.xml.dist @@ -0,0 +1,37 @@ + + + + + + + ../src/*/*Bundle/Tests + ../src/*/Bundle/*Bundle/Tests + ../src/*Bundle/Tests + + + + + + + + ../src + + ../src/*Bundle/Resources + ../src/*Bundle/Tests + ../src/*/*Bundle/Resources + ../src/*/*Bundle/Tests + ../src/*/Bundle/*Bundle/Resources + ../src/*/Bundle/*Bundle/Tests + + + + diff --git a/composer.json b/composer.json new file mode 100755 index 00000000..60ebdf7b --- /dev/null +++ b/composer.json @@ -0,0 +1,58 @@ +{ + "name": "symfony/framework-standard-edition", + "license": "MIT", + "type": "project", + "description": "The \"Symfony Standard Edition\" distribution", + "autoload": { + "psr-4": { "": "src/" }, + "classmap": [ "app/AppKernel.php", "app/AppCache.php" ] + }, + "require": { + "php": ">=5.3.9", + "symfony/symfony": "2.8.*", + "doctrine/orm": "^2.4", + "doctrine/doctrine-bundle": "1.4.*", + "symfony/assetic-bundle": "~2.3", + "symfony/swiftmailer-bundle": "~2.3", + "symfony/monolog-bundle": "^2.8", + "sensio/distribution-bundle": "~4.0", + "sensio/framework-extra-bundle": "^3.0.2", + "incenteev/composer-parameter-handler": "~2.0", + "jms/serializer-bundle": "^1.1" + }, + "require-dev": { + "sensio/generator-bundle": "~2.3" + }, + "scripts": { + "post-install-cmd": [ + "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters", + "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap", + "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache", + "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets", + "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile", + "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget" + ], + "post-update-cmd": [ + "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters", + "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap", + "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache", + "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets", + "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile", + "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget" + ] + }, + "config": { + "bin-dir": "bin" + }, + "extra": { + "symfony-app-dir": "app", + "symfony-web-dir": "web", + "symfony-assets-install": "relative", + "incenteev-parameters": { + "file": "app/config/parameters.yml" + }, + "branch-alias": { + "dev-master": "2.8-dev" + } + } +} diff --git a/composer.lock b/composer.lock new file mode 100755 index 00000000..20e20c84 --- /dev/null +++ b/composer.lock @@ -0,0 +1,2661 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "This file is @generated automatically" + ], + "hash": "0de6b548b0406ad9a096c692ba126bee", + "content-hash": "23b7a846146cf89f68230c02b22caf01", + "packages": [ + { + "name": "doctrine/annotations", + "version": "v1.2.7", + "source": { + "type": "git", + "url": "https://github.com/doctrine/annotations.git", + "reference": "f25c8aab83e0c3e976fd7d19875f198ccf2f7535" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/annotations/zipball/f25c8aab83e0c3e976fd7d19875f198ccf2f7535", + "reference": "f25c8aab83e0c3e976fd7d19875f198ccf2f7535", + "shasum": "" + }, + "require": { + "doctrine/lexer": "1.*", + "php": ">=5.3.2" + }, + "require-dev": { + "doctrine/cache": "1.*", + "phpunit/phpunit": "4.*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3.x-dev" + } + }, + "autoload": { + "psr-0": { + "Doctrine\\Common\\Annotations\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Docblock Annotations Parser", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "annotations", + "docblock", + "parser" + ], + "time": "2015-08-31 12:32:49" + }, + { + "name": "doctrine/cache", + "version": "v1.6.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/cache.git", + "reference": "f8af318d14bdb0eff0336795b428b547bd39ccb6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/cache/zipball/f8af318d14bdb0eff0336795b428b547bd39ccb6", + "reference": "f8af318d14bdb0eff0336795b428b547bd39ccb6", + "shasum": "" + }, + "require": { + "php": "~5.5|~7.0" + }, + "conflict": { + "doctrine/common": ">2.2,<2.4" + }, + "require-dev": { + "phpunit/phpunit": "~4.8|~5.0", + "predis/predis": "~1.0", + "satooshi/php-coveralls": "~0.6" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.6.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Common\\Cache\\": "lib/Doctrine/Common/Cache" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Caching library offering an object-oriented API for many cache backends", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "cache", + "caching" + ], + "time": "2015-12-31 16:37:02" + }, + { + "name": "doctrine/collections", + "version": "v1.3.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/collections.git", + "reference": "6c1e4eef75f310ea1b3e30945e9f06e652128b8a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/collections/zipball/6c1e4eef75f310ea1b3e30945e9f06e652128b8a", + "reference": "6c1e4eef75f310ea1b3e30945e9f06e652128b8a", + "shasum": "" + }, + "require": { + "php": ">=5.3.2" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2.x-dev" + } + }, + "autoload": { + "psr-0": { + "Doctrine\\Common\\Collections\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Collections Abstraction library", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "array", + "collections", + "iterator" + ], + "time": "2015-04-14 22:21:58" + }, + { + "name": "doctrine/common", + "version": "v2.6.1", + "source": { + "type": "git", + "url": "https://github.com/doctrine/common.git", + "reference": "a579557bc689580c19fee4e27487a67fe60defc0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/common/zipball/a579557bc689580c19fee4e27487a67fe60defc0", + "reference": "a579557bc689580c19fee4e27487a67fe60defc0", + "shasum": "" + }, + "require": { + "doctrine/annotations": "1.*", + "doctrine/cache": "1.*", + "doctrine/collections": "1.*", + "doctrine/inflector": "1.*", + "doctrine/lexer": "1.*", + "php": "~5.5|~7.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.8|~5.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.7.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Common\\": "lib/Doctrine/Common" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Common Library for Doctrine projects", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "annotations", + "collections", + "eventmanager", + "persistence", + "spl" + ], + "time": "2015-12-25 13:18:31" + }, + { + "name": "doctrine/dbal", + "version": "v2.5.4", + "source": { + "type": "git", + "url": "https://github.com/doctrine/dbal.git", + "reference": "abbdfd1cff43a7b99d027af3be709bc8fc7d4769" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/dbal/zipball/abbdfd1cff43a7b99d027af3be709bc8fc7d4769", + "reference": "abbdfd1cff43a7b99d027af3be709bc8fc7d4769", + "shasum": "" + }, + "require": { + "doctrine/common": ">=2.4,<2.7-dev", + "php": ">=5.3.2" + }, + "require-dev": { + "phpunit/phpunit": "4.*", + "symfony/console": "2.*" + }, + "suggest": { + "symfony/console": "For helpful console commands such as SQL execution and import of files." + }, + "bin": [ + "bin/doctrine-dbal" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.5.x-dev" + } + }, + "autoload": { + "psr-0": { + "Doctrine\\DBAL\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + } + ], + "description": "Database Abstraction Layer", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "database", + "dbal", + "persistence", + "queryobject" + ], + "time": "2016-01-05 22:11:12" + }, + { + "name": "doctrine/doctrine-bundle", + "version": "v1.4.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/DoctrineBundle.git", + "reference": "1986ff3a945b584c6505d07eae92d77e41131078" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/DoctrineBundle/zipball/1986ff3a945b584c6505d07eae92d77e41131078", + "reference": "1986ff3a945b584c6505d07eae92d77e41131078", + "shasum": "" + }, + "require": { + "doctrine/dbal": "~2.3", + "doctrine/doctrine-cache-bundle": "~1.0", + "jdorn/sql-formatter": "~1.1", + "php": ">=5.3.2", + "symfony/doctrine-bridge": "~2.2", + "symfony/framework-bundle": "~2.3" + }, + "require-dev": { + "doctrine/orm": "~2.3", + "phpunit/phpunit": "~4", + "satooshi/php-coveralls": "~0.6.1", + "symfony/validator": "~2.2", + "symfony/yaml": "~2.2", + "twig/twig": "~1.10" + }, + "suggest": { + "doctrine/orm": "The Doctrine ORM integration is optional in the bundle.", + "symfony/web-profiler-bundle": "to use the data collector" + }, + "type": "symfony-bundle", + "extra": { + "branch-alias": { + "dev-master": "1.4.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Bundle\\DoctrineBundle\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Symfony Community", + "homepage": "http://symfony.com/contributors" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Doctrine Project", + "homepage": "http://www.doctrine-project.org/" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "Symfony DoctrineBundle", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "database", + "dbal", + "orm", + "persistence" + ], + "time": "2015-02-28 11:04:45" + }, + { + "name": "doctrine/doctrine-cache-bundle", + "version": "1.3.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/DoctrineCacheBundle.git", + "reference": "18c600a9b82f6454d2e81ca4957cdd56a1cf3504" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/DoctrineCacheBundle/zipball/18c600a9b82f6454d2e81ca4957cdd56a1cf3504", + "reference": "18c600a9b82f6454d2e81ca4957cdd56a1cf3504", + "shasum": "" + }, + "require": { + "doctrine/cache": "^1.4.2", + "doctrine/inflector": "~1.0", + "php": ">=5.3.2", + "symfony/doctrine-bridge": "~2.2|~3.0" + }, + "require-dev": { + "instaclick/coding-standard": "~1.1", + "instaclick/object-calisthenics-sniffs": "dev-master", + "instaclick/symfony2-coding-standard": "dev-remaster", + "phpunit/phpunit": "~4", + "predis/predis": "~0.8", + "satooshi/php-coveralls": "~0.6.1", + "squizlabs/php_codesniffer": "~1.5", + "symfony/console": "~2.2|~3.0", + "symfony/finder": "~2.2|~3.0", + "symfony/framework-bundle": "~2.2|~3.0", + "symfony/phpunit-bridge": "~2.7|~3.0", + "symfony/security-acl": "~2.3|~3.0", + "symfony/validator": "~2.2|~3.0", + "symfony/yaml": "~2.2|~3.0" + }, + "suggest": { + "symfony/security-acl": "For using this bundle to cache ACLs" + }, + "type": "symfony-bundle", + "extra": { + "branch-alias": { + "dev-master": "1.2.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Bundle\\DoctrineCacheBundle\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Symfony Community", + "homepage": "http://symfony.com/contributors" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Fabio B. Silva", + "email": "fabio.bat.silva@gmail.com" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@hotmail.com" + }, + { + "name": "Doctrine Project", + "homepage": "http://www.doctrine-project.org/" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "Symfony Bundle for Doctrine Cache", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "cache", + "caching" + ], + "time": "2016-01-26 17:28:51" + }, + { + "name": "doctrine/inflector", + "version": "v1.1.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/inflector.git", + "reference": "90b2128806bfde671b6952ab8bea493942c1fdae" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/inflector/zipball/90b2128806bfde671b6952ab8bea493942c1fdae", + "reference": "90b2128806bfde671b6952ab8bea493942c1fdae", + "shasum": "" + }, + "require": { + "php": ">=5.3.2" + }, + "require-dev": { + "phpunit/phpunit": "4.*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1.x-dev" + } + }, + "autoload": { + "psr-0": { + "Doctrine\\Common\\Inflector\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Common String Manipulations with regard to casing and singular/plural rules.", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "inflection", + "pluralize", + "singularize", + "string" + ], + "time": "2015-11-06 14:35:42" + }, + { + "name": "doctrine/instantiator", + "version": "1.0.5", + "source": { + "type": "git", + "url": "https://github.com/doctrine/instantiator.git", + "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d", + "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d", + "shasum": "" + }, + "require": { + "php": ">=5.3,<8.0-DEV" + }, + "require-dev": { + "athletic/athletic": "~0.1.8", + "ext-pdo": "*", + "ext-phar": "*", + "phpunit/phpunit": "~4.0", + "squizlabs/php_codesniffer": "~2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com", + "homepage": "http://ocramius.github.com/" + } + ], + "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", + "homepage": "https://github.com/doctrine/instantiator", + "keywords": [ + "constructor", + "instantiate" + ], + "time": "2015-06-14 21:17:01" + }, + { + "name": "doctrine/lexer", + "version": "v1.0.1", + "source": { + "type": "git", + "url": "https://github.com/doctrine/lexer.git", + "reference": "83893c552fd2045dd78aef794c31e694c37c0b8c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/lexer/zipball/83893c552fd2045dd78aef794c31e694c37c0b8c", + "reference": "83893c552fd2045dd78aef794c31e694c37c0b8c", + "shasum": "" + }, + "require": { + "php": ">=5.3.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-0": { + "Doctrine\\Common\\Lexer\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers.", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "lexer", + "parser" + ], + "time": "2014-09-09 13:34:57" + }, + { + "name": "doctrine/orm", + "version": "v2.5.4", + "source": { + "type": "git", + "url": "https://github.com/doctrine/doctrine2.git", + "reference": "bc4ddbfb0114cb33438cc811c9a740d8aa304aab" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/doctrine2/zipball/bc4ddbfb0114cb33438cc811c9a740d8aa304aab", + "reference": "bc4ddbfb0114cb33438cc811c9a740d8aa304aab", + "shasum": "" + }, + "require": { + "doctrine/cache": "~1.4", + "doctrine/collections": "~1.2", + "doctrine/common": ">=2.5-dev,<2.7-dev", + "doctrine/dbal": ">=2.5-dev,<2.6-dev", + "doctrine/instantiator": "~1.0.1", + "ext-pdo": "*", + "php": ">=5.4", + "symfony/console": "~2.5|~3.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.0", + "symfony/yaml": "~2.3|~3.0" + }, + "suggest": { + "symfony/yaml": "If you want to use YAML Metadata Mapping Driver" + }, + "bin": [ + "bin/doctrine", + "bin/doctrine.php" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.6.x-dev" + } + }, + "autoload": { + "psr-0": { + "Doctrine\\ORM\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + } + ], + "description": "Object-Relational-Mapper for PHP", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "database", + "orm" + ], + "time": "2016-01-05 21:34:58" + }, + { + "name": "incenteev/composer-parameter-handler", + "version": "v2.1.2", + "source": { + "type": "git", + "url": "https://github.com/Incenteev/ParameterHandler.git", + "reference": "d7ce7f06136109e81d1cb9d57066c4d4a99cf1cc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Incenteev/ParameterHandler/zipball/d7ce7f06136109e81d1cb9d57066c4d4a99cf1cc", + "reference": "d7ce7f06136109e81d1cb9d57066c4d4a99cf1cc", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "symfony/yaml": "~2.3|~3.0" + }, + "require-dev": { + "composer/composer": "1.0.*@dev", + "phpspec/prophecy-phpunit": "~1.0", + "symfony/filesystem": "~2.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Incenteev\\ParameterHandler\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christophe Coevoet", + "email": "stof@notk.org" + } + ], + "description": "Composer script handling your ignored parameter file", + "homepage": "https://github.com/Incenteev/ParameterHandler", + "keywords": [ + "parameters management" + ], + "time": "2015-11-10 17:04:01" + }, + { + "name": "ircmaxell/password-compat", + "version": "v1.0.4", + "source": { + "type": "git", + "url": "https://github.com/ircmaxell/password_compat.git", + "reference": "5c5cde8822a69545767f7c7f3058cb15ff84614c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ircmaxell/password_compat/zipball/5c5cde8822a69545767f7c7f3058cb15ff84614c", + "reference": "5c5cde8822a69545767f7c7f3058cb15ff84614c", + "shasum": "" + }, + "require-dev": { + "phpunit/phpunit": "4.*" + }, + "type": "library", + "autoload": { + "files": [ + "lib/password.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Anthony Ferrara", + "email": "ircmaxell@php.net", + "homepage": "http://blog.ircmaxell.com" + } + ], + "description": "A compatibility library for the proposed simplified password hashing algorithm: https://wiki.php.net/rfc/password_hash", + "homepage": "https://github.com/ircmaxell/password_compat", + "keywords": [ + "hashing", + "password" + ], + "time": "2014-11-20 16:49:30" + }, + { + "name": "jdorn/sql-formatter", + "version": "v1.2.17", + "source": { + "type": "git", + "url": "https://github.com/jdorn/sql-formatter.git", + "reference": "64990d96e0959dff8e059dfcdc1af130728d92bc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/jdorn/sql-formatter/zipball/64990d96e0959dff8e059dfcdc1af130728d92bc", + "reference": "64990d96e0959dff8e059dfcdc1af130728d92bc", + "shasum": "" + }, + "require": { + "php": ">=5.2.4" + }, + "require-dev": { + "phpunit/phpunit": "3.7.*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3.x-dev" + } + }, + "autoload": { + "classmap": [ + "lib" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jeremy Dorn", + "email": "jeremy@jeremydorn.com", + "homepage": "http://jeremydorn.com/" + } + ], + "description": "a PHP SQL highlighting library", + "homepage": "https://github.com/jdorn/sql-formatter/", + "keywords": [ + "highlight", + "sql" + ], + "time": "2014-01-12 16:20:24" + }, + { + "name": "jms/metadata", + "version": "1.5.1", + "source": { + "type": "git", + "url": "https://github.com/schmittjoh/metadata.git", + "reference": "22b72455559a25777cfd28c4ffda81ff7639f353" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/schmittjoh/metadata/zipball/22b72455559a25777cfd28c4ffda81ff7639f353", + "reference": "22b72455559a25777cfd28c4ffda81ff7639f353", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "require-dev": { + "doctrine/cache": "~1.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.5.x-dev" + } + }, + "autoload": { + "psr-0": { + "Metadata\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache" + ], + "authors": [ + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com", + "homepage": "https://github.com/schmittjoh", + "role": "Developer of wrapped JMSSerializerBundle" + } + ], + "description": "Class/method/property metadata management in PHP", + "keywords": [ + "annotations", + "metadata", + "xml", + "yaml" + ], + "time": "2014-07-12 07:13:19" + }, + { + "name": "jms/parser-lib", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/schmittjoh/parser-lib.git", + "reference": "c509473bc1b4866415627af0e1c6cc8ac97fa51d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/schmittjoh/parser-lib/zipball/c509473bc1b4866415627af0e1c6cc8ac97fa51d", + "reference": "c509473bc1b4866415627af0e1c6cc8ac97fa51d", + "shasum": "" + }, + "require": { + "phpoption/phpoption": ">=0.9,<2.0-dev" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "psr-0": { + "JMS\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache2" + ], + "description": "A library for easily creating recursive-descent parsers.", + "time": "2012-11-18 18:08:43" + }, + { + "name": "jms/serializer", + "version": "1.1.0", + "source": { + "type": "git", + "url": "https://github.com/schmittjoh/serializer.git", + "reference": "fe13a1f993ea3456e195b7820692f2eb2b6bbb48" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/schmittjoh/serializer/zipball/fe13a1f993ea3456e195b7820692f2eb2b6bbb48", + "reference": "fe13a1f993ea3456e195b7820692f2eb2b6bbb48", + "shasum": "" + }, + "require": { + "doctrine/annotations": "1.*", + "doctrine/instantiator": "~1.0.3", + "jms/metadata": "~1.1", + "jms/parser-lib": "1.*", + "php": ">=5.4.0", + "phpcollection/phpcollection": "~0.1" + }, + "conflict": { + "twig/twig": "<1.12" + }, + "require-dev": { + "doctrine/orm": "~2.1", + "doctrine/phpcr-odm": "~1.0.1", + "jackalope/jackalope-doctrine-dbal": "1.0.*", + "phpunit/phpunit": "~4.0", + "propel/propel1": "~1.7", + "symfony/filesystem": "2.*", + "symfony/form": "~2.1", + "symfony/translation": "~2.0", + "symfony/validator": "~2.0", + "symfony/yaml": "2.*", + "twig/twig": "~1.12|~2.0" + }, + "suggest": { + "symfony/yaml": "Required if you'd like to serialize data to YAML format." + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "autoload": { + "psr-0": { + "JMS\\Serializer": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache2" + ], + "authors": [ + { + "name": "Johannes M. Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Library for (de-)serializing data of any complexity; supports XML, JSON, and YAML.", + "homepage": "http://jmsyst.com/libs/serializer", + "keywords": [ + "deserialization", + "jaxb", + "json", + "serialization", + "xml" + ], + "time": "2015-10-27 09:24:41" + }, + { + "name": "jms/serializer-bundle", + "version": "1.1.0", + "target-dir": "JMS/SerializerBundle", + "source": { + "type": "git", + "url": "https://github.com/schmittjoh/JMSSerializerBundle.git", + "reference": "3e396c980545350c2efb65a50041d2a9f9d6562e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/schmittjoh/JMSSerializerBundle/zipball/3e396c980545350c2efb65a50041d2a9f9d6562e", + "reference": "3e396c980545350c2efb65a50041d2a9f9d6562e", + "shasum": "" + }, + "require": { + "jms/serializer": "^1.0.0", + "php": ">=5.4.0", + "phpoption/phpoption": "^1.1.0", + "symfony/framework-bundle": "~2.3|~3.0" + }, + "require-dev": { + "doctrine/doctrine-bundle": "*", + "doctrine/orm": "*", + "symfony/browser-kit": "*", + "symfony/class-loader": "*", + "symfony/css-selector": "*", + "symfony/finder": "*", + "symfony/form": "*", + "symfony/process": "*", + "symfony/stopwatch": "*", + "symfony/twig-bundle": "*", + "symfony/validator": "*", + "symfony/yaml": "*" + }, + "suggest": { + "jms/di-extra-bundle": "Required to get lazy loading (de)serialization visitors, ~1.3" + }, + "type": "symfony-bundle", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "autoload": { + "psr-0": { + "JMS\\SerializerBundle": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache2" + ], + "authors": [ + { + "name": "Johannes M. Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Allows you to easily serialize, and deserialize data of any complexity", + "homepage": "http://jmsyst.com/bundles/JMSSerializerBundle", + "keywords": [ + "deserialization", + "jaxb", + "json", + "serialization", + "xml" + ], + "time": "2015-11-10 12:26:42" + }, + { + "name": "kriswallsmith/assetic", + "version": "v1.3.2", + "source": { + "type": "git", + "url": "https://github.com/kriswallsmith/assetic.git", + "reference": "9928f7c4ad98b234e3559d1049abd13387f86db5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/kriswallsmith/assetic/zipball/9928f7c4ad98b234e3559d1049abd13387f86db5", + "reference": "9928f7c4ad98b234e3559d1049abd13387f86db5", + "shasum": "" + }, + "require": { + "php": ">=5.3.1", + "symfony/process": "~2.1|~3.0" + }, + "conflict": { + "twig/twig": "<1.23" + }, + "require-dev": { + "cssmin/cssmin": "3.0.1", + "joliclic/javascript-packer": "1.1", + "kamicane/packager": "1.0", + "leafo/lessphp": "^0.3.7", + "leafo/scssphp": "~0.1", + "mrclay/minify": "~2.2", + "patchwork/jsqueeze": "~1.0|~2.0", + "phpunit/phpunit": "~4.8", + "psr/log": "~1.0", + "ptachoire/cssembed": "~1.0", + "symfony/phpunit-bridge": "~2.7|~3.0", + "twig/twig": "~1.8|~2.0" + }, + "suggest": { + "leafo/lessphp": "Assetic provides the integration with the lessphp LESS compiler", + "leafo/scssphp": "Assetic provides the integration with the scssphp SCSS compiler", + "leafo/scssphp-compass": "Assetic provides the integration with the SCSS compass plugin", + "patchwork/jsqueeze": "Assetic provides the integration with the JSqueeze JavaScript compressor", + "ptachoire/cssembed": "Assetic provides the integration with phpcssembed to embed data uris", + "twig/twig": "Assetic provides the integration with the Twig templating engine" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4-dev" + } + }, + "autoload": { + "psr-0": { + "Assetic": "src/" + }, + "files": [ + "src/functions.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Kris Wallsmith", + "email": "kris.wallsmith@gmail.com", + "homepage": "http://kriswallsmith.net/" + } + ], + "description": "Asset Management for PHP", + "homepage": "https://github.com/kriswallsmith/assetic", + "keywords": [ + "assets", + "compression", + "minification" + ], + "time": "2015-11-12 13:51:40" + }, + { + "name": "monolog/monolog", + "version": "1.19.0", + "source": { + "type": "git", + "url": "https://github.com/Seldaek/monolog.git", + "reference": "5f56ed5212dc509c8dc8caeba2715732abb32dbf" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/5f56ed5212dc509c8dc8caeba2715732abb32dbf", + "reference": "5f56ed5212dc509c8dc8caeba2715732abb32dbf", + "shasum": "" + }, + "require": { + "php": ">=5.3.0", + "psr/log": "~1.0" + }, + "provide": { + "psr/log-implementation": "1.0.0" + }, + "require-dev": { + "aws/aws-sdk-php": "^2.4.9", + "doctrine/couchdb": "~1.0@dev", + "graylog2/gelf-php": "~1.0", + "jakub-onderka/php-parallel-lint": "0.9", + "php-amqplib/php-amqplib": "~2.4", + "php-console/php-console": "^3.1.3", + "phpunit/phpunit": "~4.5", + "phpunit/phpunit-mock-objects": "2.3.0", + "raven/raven": "^0.13", + "ruflin/elastica": ">=0.90 <3.0", + "swiftmailer/swiftmailer": "~5.3" + }, + "suggest": { + "aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB", + "doctrine/couchdb": "Allow sending log messages to a CouchDB server", + "ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)", + "ext-mongo": "Allow sending log messages to a MongoDB server", + "graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server", + "mongodb/mongodb": "Allow sending log messages to a MongoDB server via PHP Driver", + "php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib", + "php-console/php-console": "Allow sending log messages to Google Chrome", + "raven/raven": "Allow sending log messages to a Sentry server", + "rollbar/rollbar": "Allow sending log messages to Rollbar", + "ruflin/elastica": "Allow sending log messages to an Elastic Search server" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Monolog\\": "src/Monolog" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + } + ], + "description": "Sends your logs to files, sockets, inboxes, databases and various web services", + "homepage": "http://github.com/Seldaek/monolog", + "keywords": [ + "log", + "logging", + "psr-3" + ], + "time": "2016-04-12 18:29:35" + }, + { + "name": "paragonie/random_compat", + "version": "v1.4.1", + "source": { + "type": "git", + "url": "https://github.com/paragonie/random_compat.git", + "reference": "c7e26a21ba357863de030f0b9e701c7d04593774" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/paragonie/random_compat/zipball/c7e26a21ba357863de030f0b9e701c7d04593774", + "reference": "c7e26a21ba357863de030f0b9e701c7d04593774", + "shasum": "" + }, + "require": { + "php": ">=5.2.0" + }, + "require-dev": { + "phpunit/phpunit": "4.*|5.*" + }, + "suggest": { + "ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes." + }, + "type": "library", + "autoload": { + "files": [ + "lib/random.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Paragon Initiative Enterprises", + "email": "security@paragonie.com", + "homepage": "https://paragonie.com" + } + ], + "description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7", + "keywords": [ + "csprng", + "pseudorandom", + "random" + ], + "time": "2016-03-18 20:34:03" + }, + { + "name": "phpcollection/phpcollection", + "version": "0.4.0", + "source": { + "type": "git", + "url": "https://github.com/schmittjoh/php-collection.git", + "reference": "b8bf55a0a929ca43b01232b36719f176f86c7e83" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/schmittjoh/php-collection/zipball/b8bf55a0a929ca43b01232b36719f176f86c7e83", + "reference": "b8bf55a0a929ca43b01232b36719f176f86c7e83", + "shasum": "" + }, + "require": { + "phpoption/phpoption": "1.*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "0.3-dev" + } + }, + "autoload": { + "psr-0": { + "PhpCollection": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache2" + ], + "authors": [ + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com", + "homepage": "https://github.com/schmittjoh", + "role": "Developer of wrapped JMSSerializerBundle" + } + ], + "description": "General-Purpose Collection Library for PHP", + "keywords": [ + "collection", + "list", + "map", + "sequence", + "set" + ], + "time": "2014-03-11 13:46:42" + }, + { + "name": "phpoption/phpoption", + "version": "1.5.0", + "source": { + "type": "git", + "url": "https://github.com/schmittjoh/php-option.git", + "reference": "94e644f7d2051a5f0fcf77d81605f152eecff0ed" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/schmittjoh/php-option/zipball/94e644f7d2051a5f0fcf77d81605f152eecff0ed", + "reference": "94e644f7d2051a5f0fcf77d81605f152eecff0ed", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "require-dev": { + "phpunit/phpunit": "4.7.*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3-dev" + } + }, + "autoload": { + "psr-0": { + "PhpOption\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache2" + ], + "authors": [ + { + "name": "Johannes M. Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Option Type for PHP", + "keywords": [ + "language", + "option", + "php", + "type" + ], + "time": "2015-07-25 16:39:46" + }, + { + "name": "psr/log", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "fe0936ee26643249e916849d48e3a51d5f5e278b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/fe0936ee26643249e916849d48e3a51d5f5e278b", + "reference": "fe0936ee26643249e916849d48e3a51d5f5e278b", + "shasum": "" + }, + "type": "library", + "autoload": { + "psr-0": { + "Psr\\Log\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "time": "2012-12-21 11:40:51" + }, + { + "name": "sensio/distribution-bundle", + "version": "v4.0.6", + "target-dir": "Sensio/Bundle/DistributionBundle", + "source": { + "type": "git", + "url": "https://github.com/sensiolabs/SensioDistributionBundle.git", + "reference": "181a47c527a04d2d03986a0b3e9c1b86eaacab40" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sensiolabs/SensioDistributionBundle/zipball/181a47c527a04d2d03986a0b3e9c1b86eaacab40", + "reference": "181a47c527a04d2d03986a0b3e9c1b86eaacab40", + "shasum": "" + }, + "require": { + "php": ">=5.3.9", + "sensiolabs/security-checker": "~3.0", + "symfony/class-loader": "~2.2", + "symfony/framework-bundle": "~2.3", + "symfony/process": "~2.2" + }, + "require-dev": { + "symfony/form": "~2.2", + "symfony/validator": "~2.2", + "symfony/yaml": "~2.2" + }, + "suggest": { + "symfony/form": "If you want to use the configurator", + "symfony/validator": "If you want to use the configurator", + "symfony/yaml": "If you want to use the configurator" + }, + "type": "symfony-bundle", + "extra": { + "branch-alias": { + "dev-master": "4.0.x-dev" + } + }, + "autoload": { + "psr-0": { + "Sensio\\Bundle\\DistributionBundle": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "Base bundle for Symfony Distributions", + "keywords": [ + "configuration", + "distribution" + ], + "time": "2016-04-25 20:49:44" + }, + { + "name": "sensio/framework-extra-bundle", + "version": "v3.0.16", + "source": { + "type": "git", + "url": "https://github.com/sensiolabs/SensioFrameworkExtraBundle.git", + "reference": "507a15f56fa7699f6cc8c2c7de4080b19ce22546" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sensiolabs/SensioFrameworkExtraBundle/zipball/507a15f56fa7699f6cc8c2c7de4080b19ce22546", + "reference": "507a15f56fa7699f6cc8c2c7de4080b19ce22546", + "shasum": "" + }, + "require": { + "doctrine/common": "~2.2", + "symfony/dependency-injection": "~2.3|~3.0", + "symfony/framework-bundle": "~2.3|~3.0" + }, + "require-dev": { + "symfony/browser-kit": "~2.3|~3.0", + "symfony/dom-crawler": "~2.3|~3.0", + "symfony/expression-language": "~2.4|~3.0", + "symfony/finder": "~2.3|~3.0", + "symfony/phpunit-bridge": "~2.7|~3.0", + "symfony/security-bundle": "~2.4|~3.0", + "symfony/twig-bundle": "~2.3|~3.0", + "twig/twig": "~1.11|~2.0" + }, + "suggest": { + "symfony/expression-language": "", + "symfony/psr-http-message-bridge": "To use the PSR-7 converters", + "symfony/security-bundle": "" + }, + "type": "symfony-bundle", + "extra": { + "branch-alias": { + "dev-master": "3.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Sensio\\Bundle\\FrameworkExtraBundle\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "This bundle provides a way to configure your controllers with annotations", + "keywords": [ + "annotations", + "controllers" + ], + "time": "2016-03-25 17:08:27" + }, + { + "name": "sensiolabs/security-checker", + "version": "v3.0.2", + "source": { + "type": "git", + "url": "https://github.com/sensiolabs/security-checker.git", + "reference": "21696b0daa731064c23cfb694c60a2584a7b6e93" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sensiolabs/security-checker/zipball/21696b0daa731064c23cfb694c60a2584a7b6e93", + "reference": "21696b0daa731064c23cfb694c60a2584a7b6e93", + "shasum": "" + }, + "require": { + "symfony/console": "~2.0|~3.0" + }, + "bin": [ + "security-checker" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "psr-0": { + "SensioLabs\\Security": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien.potencier@gmail.com" + } + ], + "description": "A security checker for your composer.lock", + "time": "2015-11-07 08:07:40" + }, + { + "name": "swiftmailer/swiftmailer", + "version": "v5.4.2", + "source": { + "type": "git", + "url": "https://github.com/swiftmailer/swiftmailer.git", + "reference": "d8db871a54619458a805229a057ea2af33c753e8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/d8db871a54619458a805229a057ea2af33c753e8", + "reference": "d8db871a54619458a805229a057ea2af33c753e8", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "mockery/mockery": "~0.9.1,<0.9.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.4-dev" + } + }, + "autoload": { + "files": [ + "lib/swift_required.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Chris Corbyn" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "Swiftmailer, free feature-rich PHP mailer", + "homepage": "http://swiftmailer.org", + "keywords": [ + "email", + "mail", + "mailer" + ], + "time": "2016-05-01 08:45:47" + }, + { + "name": "symfony/assetic-bundle", + "version": "v2.8.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/assetic-bundle.git", + "reference": "aa5b4f8b712f38745928fa845ddb73300bb2af6d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/assetic-bundle/zipball/aa5b4f8b712f38745928fa845ddb73300bb2af6d", + "reference": "aa5b4f8b712f38745928fa845ddb73300bb2af6d", + "shasum": "" + }, + "require": { + "kriswallsmith/assetic": "~1.3", + "php": ">=5.3.0", + "symfony/console": "~2.3|~3.0", + "symfony/dependency-injection": "~2.3|~3.0", + "symfony/framework-bundle": "~2.3|~3.0", + "symfony/yaml": "~2.3|~3.0" + }, + "conflict": { + "kriswallsmith/spork": "<=0.2", + "twig/twig": "<1.20" + }, + "require-dev": { + "kriswallsmith/spork": "~0.3", + "patchwork/jsqueeze": "~1.0", + "symfony/class-loader": "~2.3|~3.0", + "symfony/css-selector": "~2.3|~3.0", + "symfony/dom-crawler": "~2.3|~3.0", + "symfony/phpunit-bridge": "~2.7|~3.0", + "symfony/twig-bundle": "~2.3|~3.0" + }, + "suggest": { + "kriswallsmith/spork": "to be able to dump assets in parallel", + "symfony/twig-bundle": "to use the Twig integration" + }, + "type": "symfony-bundle", + "extra": { + "branch-alias": { + "dev-master": "2.7-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Bundle\\AsseticBundle\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Kris Wallsmith", + "email": "kris.wallsmith@gmail.com", + "homepage": "http://kriswallsmith.net/" + } + ], + "description": "Integrates Assetic into Symfony2", + "homepage": "https://github.com/symfony/AsseticBundle", + "keywords": [ + "assets", + "compression", + "minification" + ], + "time": "2015-12-28 13:12:39" + }, + { + "name": "symfony/monolog-bundle", + "version": "2.11.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/monolog-bundle.git", + "reference": "e7caf4936c7be82bc6d68df87f1d23a0d5bf6e00" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/monolog-bundle/zipball/e7caf4936c7be82bc6d68df87f1d23a0d5bf6e00", + "reference": "e7caf4936c7be82bc6d68df87f1d23a0d5bf6e00", + "shasum": "" + }, + "require": { + "monolog/monolog": "~1.18", + "php": ">=5.3.2", + "symfony/config": "~2.3|~3.0", + "symfony/dependency-injection": "~2.3|~3.0", + "symfony/http-kernel": "~2.3|~3.0", + "symfony/monolog-bridge": "~2.3|~3.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8", + "symfony/console": "~2.3|~3.0", + "symfony/yaml": "~2.3|~3.0" + }, + "type": "symfony-bundle", + "extra": { + "branch-alias": { + "dev-master": "2.x-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Bundle\\MonologBundle\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Symfony Community", + "homepage": "http://symfony.com/contributors" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "Symfony MonologBundle", + "homepage": "http://symfony.com", + "keywords": [ + "log", + "logging" + ], + "time": "2016-04-13 16:21:01" + }, + { + "name": "symfony/polyfill-apcu", + "version": "v1.1.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-apcu.git", + "reference": "0c901e4e65a2f7ece68f0fd249b56d6ad3adc214" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-apcu/zipball/0c901e4e65a2f7ece68f0fd249b56d6ad3adc214", + "reference": "0c901e4e65a2f7ece68f0fd249b56d6ad3adc214", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting apcu_* functions to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "apcu", + "compatibility", + "polyfill", + "portable", + "shim" + ], + "time": "2016-03-03 16:49:40" + }, + { + "name": "symfony/polyfill-intl-icu", + "version": "v1.1.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-intl-icu.git", + "reference": "8328069d9f5322f0e7b3c3518485acfdc94c3942" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-intl-icu/zipball/8328069d9f5322f0e7b3c3518485acfdc94c3942", + "reference": "8328069d9f5322f0e7b3c3518485acfdc94c3942", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "symfony/intl": "~2.3|~3.0" + }, + "suggest": { + "ext-intl": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for intl's ICU-related data and classes", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "icu", + "intl", + "polyfill", + "portable", + "shim" + ], + "time": "2016-02-26 16:18:12" + }, + { + "name": "symfony/polyfill-mbstring", + "version": "v1.1.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "1289d16209491b584839022f29257ad859b8532d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/1289d16209491b584839022f29257ad859b8532d", + "reference": "1289d16209491b584839022f29257ad859b8532d", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for the Mbstring extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" + ], + "time": "2016-01-20 09:13:37" + }, + { + "name": "symfony/polyfill-php54", + "version": "v1.1.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php54.git", + "reference": "9ba741ca01c77282ecf5796c2c1d667f03454ffb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php54/zipball/9ba741ca01c77282ecf5796c2c1d667f03454ffb", + "reference": "9ba741ca01c77282ecf5796c2c1d667f03454ffb", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Php54\\": "" + }, + "files": [ + "bootstrap.php" + ], + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 5.4+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "time": "2016-01-25 19:13:00" + }, + { + "name": "symfony/polyfill-php55", + "version": "v1.1.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php55.git", + "reference": "b4f3f07d91702f8f926339fc4fcf81671d8c27e6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php55/zipball/b4f3f07d91702f8f926339fc4fcf81671d8c27e6", + "reference": "b4f3f07d91702f8f926339fc4fcf81671d8c27e6", + "shasum": "" + }, + "require": { + "ircmaxell/password-compat": "~1.0", + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Php55\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 5.5+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "time": "2016-01-20 09:13:37" + }, + { + "name": "symfony/polyfill-php56", + "version": "v1.1.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php56.git", + "reference": "4d891fff050101a53a4caabb03277284942d1ad9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php56/zipball/4d891fff050101a53a4caabb03277284942d1ad9", + "reference": "4d891fff050101a53a4caabb03277284942d1ad9", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "symfony/polyfill-util": "~1.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Php56\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 5.6+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "time": "2016-01-20 09:13:37" + }, + { + "name": "symfony/polyfill-php70", + "version": "v1.1.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php70.git", + "reference": "386c1be9cad3ab531425211919e78c37971be4ce" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/386c1be9cad3ab531425211919e78c37971be4ce", + "reference": "386c1be9cad3ab531425211919e78c37971be4ce", + "shasum": "" + }, + "require": { + "paragonie/random_compat": "~1.0", + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Php70\\": "" + }, + "files": [ + "bootstrap.php" + ], + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 7.0+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "time": "2016-01-28 22:42:02" + }, + { + "name": "symfony/polyfill-util", + "version": "v1.1.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-util.git", + "reference": "8de62801aa12bc4dfcf85eef5d21981ae7bb3cc4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-util/zipball/8de62801aa12bc4dfcf85eef5d21981ae7bb3cc4", + "reference": "8de62801aa12bc4dfcf85eef5d21981ae7bb3cc4", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Util\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony utilities for portability of PHP codes", + "homepage": "https://symfony.com", + "keywords": [ + "compat", + "compatibility", + "polyfill", + "shim" + ], + "time": "2016-01-20 09:13:37" + }, + { + "name": "symfony/security-acl", + "version": "v3.0.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/security-acl.git", + "reference": "053b49bf4aa333a392c83296855989bcf88ddad1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/security-acl/zipball/053b49bf4aa333a392c83296855989bcf88ddad1", + "reference": "053b49bf4aa333a392c83296855989bcf88ddad1", + "shasum": "" + }, + "require": { + "php": ">=5.5.9", + "symfony/security-core": "~2.8|~3.0" + }, + "require-dev": { + "doctrine/common": "~2.2", + "doctrine/dbal": "~2.2", + "psr/log": "~1.0", + "symfony/phpunit-bridge": "~2.8|~3.0" + }, + "suggest": { + "doctrine/dbal": "For using the built-in ACL implementation", + "symfony/class-loader": "For using the ACL generateSql script", + "symfony/finder": "For using the ACL generateSql script" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Security\\Acl\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Security Component - ACL (Access Control List)", + "homepage": "https://symfony.com", + "time": "2015-12-28 09:39:46" + }, + { + "name": "symfony/swiftmailer-bundle", + "version": "v2.3.11", + "source": { + "type": "git", + "url": "https://github.com/symfony/swiftmailer-bundle.git", + "reference": "5e1a90f28213231ceee19c953bbebc5b5b95c690" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/swiftmailer-bundle/zipball/5e1a90f28213231ceee19c953bbebc5b5b95c690", + "reference": "5e1a90f28213231ceee19c953bbebc5b5b95c690", + "shasum": "" + }, + "require": { + "php": ">=5.3.2", + "swiftmailer/swiftmailer": ">=4.2.0,~5.0", + "symfony/config": "~2.3|~3.0", + "symfony/dependency-injection": "~2.3|~3.0", + "symfony/http-kernel": "~2.3|~3.0", + "symfony/yaml": "~2.3|~3.0" + }, + "require-dev": { + "symfony/phpunit-bridge": "~2.7|~3.0" + }, + "suggest": { + "psr/log": "Allows logging" + }, + "type": "symfony-bundle", + "extra": { + "branch-alias": { + "dev-master": "2.3-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Bundle\\SwiftmailerBundle\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Symfony Community", + "homepage": "http://symfony.com/contributors" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "Symfony SwiftmailerBundle", + "homepage": "http://symfony.com", + "time": "2016-01-15 16:41:20" + }, + { + "name": "symfony/symfony", + "version": "v2.8.6", + "source": { + "type": "git", + "url": "https://github.com/symfony/symfony.git", + "reference": "8408816780215fae055599d100b5385d9a247151" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/symfony/zipball/8408816780215fae055599d100b5385d9a247151", + "reference": "8408816780215fae055599d100b5385d9a247151", + "shasum": "" + }, + "require": { + "doctrine/common": "~2.4", + "php": ">=5.3.9", + "psr/log": "~1.0", + "symfony/polyfill-apcu": "~1.1", + "symfony/polyfill-intl-icu": "~1.0", + "symfony/polyfill-mbstring": "~1.0", + "symfony/polyfill-php54": "~1.0", + "symfony/polyfill-php55": "~1.0", + "symfony/polyfill-php56": "~1.0", + "symfony/polyfill-php70": "~1.0", + "symfony/polyfill-util": "~1.0", + "symfony/security-acl": "~2.7|~3.0.0", + "twig/twig": "~1.23|~2.0" + }, + "conflict": { + "phpdocumentor/reflection": "<1.0.7" + }, + "replace": { + "symfony/asset": "self.version", + "symfony/browser-kit": "self.version", + "symfony/class-loader": "self.version", + "symfony/config": "self.version", + "symfony/console": "self.version", + "symfony/css-selector": "self.version", + "symfony/debug": "self.version", + "symfony/debug-bundle": "self.version", + "symfony/dependency-injection": "self.version", + "symfony/doctrine-bridge": "self.version", + "symfony/dom-crawler": "self.version", + "symfony/event-dispatcher": "self.version", + "symfony/expression-language": "self.version", + "symfony/filesystem": "self.version", + "symfony/finder": "self.version", + "symfony/form": "self.version", + "symfony/framework-bundle": "self.version", + "symfony/http-foundation": "self.version", + "symfony/http-kernel": "self.version", + "symfony/intl": "self.version", + "symfony/ldap": "self.version", + "symfony/locale": "self.version", + "symfony/monolog-bridge": "self.version", + "symfony/options-resolver": "self.version", + "symfony/process": "self.version", + "symfony/property-access": "self.version", + "symfony/property-info": "self.version", + "symfony/proxy-manager-bridge": "self.version", + "symfony/routing": "self.version", + "symfony/security": "self.version", + "symfony/security-bundle": "self.version", + "symfony/security-core": "self.version", + "symfony/security-csrf": "self.version", + "symfony/security-guard": "self.version", + "symfony/security-http": "self.version", + "symfony/serializer": "self.version", + "symfony/stopwatch": "self.version", + "symfony/swiftmailer-bridge": "self.version", + "symfony/templating": "self.version", + "symfony/translation": "self.version", + "symfony/twig-bridge": "self.version", + "symfony/twig-bundle": "self.version", + "symfony/validator": "self.version", + "symfony/var-dumper": "self.version", + "symfony/web-profiler-bundle": "self.version", + "symfony/yaml": "self.version" + }, + "require-dev": { + "doctrine/data-fixtures": "1.0.*", + "doctrine/dbal": "~2.4", + "doctrine/doctrine-bundle": "~1.2", + "doctrine/orm": "~2.4,>=2.4.5", + "egulias/email-validator": "~1.2", + "monolog/monolog": "~1.11", + "ocramius/proxy-manager": "~0.4|~1.0|~2.0", + "phpdocumentor/reflection": "^1.0.7" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.8-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Bridge\\Doctrine\\": "src/Symfony/Bridge/Doctrine/", + "Symfony\\Bridge\\Monolog\\": "src/Symfony/Bridge/Monolog/", + "Symfony\\Bridge\\ProxyManager\\": "src/Symfony/Bridge/ProxyManager/", + "Symfony\\Bridge\\Swiftmailer\\": "src/Symfony/Bridge/Swiftmailer/", + "Symfony\\Bridge\\Twig\\": "src/Symfony/Bridge/Twig/", + "Symfony\\Bundle\\": "src/Symfony/Bundle/", + "Symfony\\Component\\": "src/Symfony/Component/" + }, + "classmap": [ + "src/Symfony/Component/Intl/Resources/stubs" + ], + "exclude-from-classmap": [ + "**/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "The Symfony PHP framework", + "homepage": "https://symfony.com", + "keywords": [ + "framework" + ], + "time": "2016-05-09 21:45:54" + }, + { + "name": "twig/twig", + "version": "v1.24.0", + "source": { + "type": "git", + "url": "https://github.com/twigphp/Twig.git", + "reference": "3e5aa30ebfbafd5951fb1b01e338e1800ce7e0e8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/3e5aa30ebfbafd5951fb1b01e338e1800ce7e0e8", + "reference": "3e5aa30ebfbafd5951fb1b01e338e1800ce7e0e8", + "shasum": "" + }, + "require": { + "php": ">=5.2.7" + }, + "require-dev": { + "symfony/debug": "~2.7", + "symfony/phpunit-bridge": "~2.7" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.24-dev" + } + }, + "autoload": { + "psr-0": { + "Twig_": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com", + "homepage": "http://fabien.potencier.org", + "role": "Lead Developer" + }, + { + "name": "Armin Ronacher", + "email": "armin.ronacher@active-4.com", + "role": "Project Founder" + }, + { + "name": "Twig Team", + "homepage": "http://twig.sensiolabs.org/contributors", + "role": "Contributors" + } + ], + "description": "Twig, the flexible, fast, and secure template language for PHP", + "homepage": "http://twig.sensiolabs.org", + "keywords": [ + "templating" + ], + "time": "2016-01-25 21:22:18" + } + ], + "packages-dev": [ + { + "name": "sensio/generator-bundle", + "version": "v2.5.3", + "target-dir": "Sensio/Bundle/GeneratorBundle", + "source": { + "type": "git", + "url": "https://github.com/sensiolabs/SensioGeneratorBundle.git", + "reference": "e50108c2133ee5c9c484555faed50c17a61221d3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sensiolabs/SensioGeneratorBundle/zipball/e50108c2133ee5c9c484555faed50c17a61221d3", + "reference": "e50108c2133ee5c9c484555faed50c17a61221d3", + "shasum": "" + }, + "require": { + "symfony/console": "~2.5", + "symfony/framework-bundle": "~2.2" + }, + "require-dev": { + "doctrine/orm": "~2.2,>=2.2.3", + "symfony/doctrine-bridge": "~2.2", + "twig/twig": "~1.11" + }, + "type": "symfony-bundle", + "extra": { + "branch-alias": { + "dev-master": "2.5.x-dev" + } + }, + "autoload": { + "psr-0": { + "Sensio\\Bundle\\GeneratorBundle": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "This bundle generates code for you", + "time": "2015-03-17 06:36:52" + } + ], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": { + "php": ">=5.3.9" + }, + "platform-dev": [] +} diff --git a/src/.htaccess b/src/.htaccess new file mode 100755 index 00000000..fb1de45b --- /dev/null +++ b/src/.htaccess @@ -0,0 +1,7 @@ + + Require all denied + + + Order deny,allow + Deny from all + diff --git a/src/AppBundle/AppBundle.php b/src/AppBundle/AppBundle.php new file mode 100755 index 00000000..05123b67 --- /dev/null +++ b/src/AppBundle/AppBundle.php @@ -0,0 +1,9 @@ +get('security.context')->isGranted('ROLE_ADMIN'); + $em = $this->getDoctrine()->getManager(); + $datasetUid = $em->getRepository('AppBundle:Dataset') + ->getNewDatasetId(); + $dataset->setDatasetUid($datasetUid); + + if ($userIsAdmin) { + $form = $this->createForm(new DatasetAsAdminType($userIsAdmin, $datasetUid), $dataset, array( + 'action' => $this->generateUrl('ingest_dataset'))); + return $this->render('default/add_dataset_admin.html.twig', array( + 'form'=> $form->createView(), + 'adminPage'=>true, + 'userIsAdmin'=>$userIsAdmin, + )); + } else { + $form = $this->createForm(new DatasetAsUserType($userIsAdmin, $datasetUid), $dataset, array( + 'action' => $this->generateUrl('ingest_dataset'))); + return $this->render('default/add_dataset_user.html.twig', array( + 'form'=> $form->createView(), + 'adminPage'=>true, + 'userIsAdmin'=>$userIsAdmin, + )); + } + + + } + + + /** + * Validate the form. Ingest if valid, send user back otherwise· + * + * @param Request The current HTTP request + * + * @return Response A Response instance + * + * @Route("/ingest_dataset", name="ingest_dataset") + */ + public function ingestDataset(Request $request) { + $dataset = new Dataset(); + $em = $this->getDoctrine()->getManager(); + $userIsAdmin = $this->get('security.context')->isGranted('ROLE_ADMIN'); + $datasetUid = $em->getRepository('AppBundle:Dataset') + ->getNewDatasetId(); + $dataset->setDatasetUid($datasetUid); + + if ($userIsAdmin) { + $form = $this->createForm(new DatasetAsAdminType($userIsAdmin, $datasetUid), $dataset); + } else { + $form = $this->createForm(new DatasetAsUserType($userIsAdmin, $datasetUid), $dataset); + } + + $form->handleRequest($request); + + if ($form->isValid()) { + $dataset = $form->getData(); + + $addedEntityName = $dataset->getTitle(); + $slug = Slugger::slugify($addedEntityName); + $dataset->setSlug($slug); + + + $em->persist($dataset); + $em->flush(); + return $this->render('default/add_success.html.twig', array( + 'adminPage'=>true, + 'entityName'=>'Dataset', + 'displayName'=>'Dataset', + 'addedEntityName'=>$addedEntityName, + 'userIsAdmin'=>$userIsAdmin, + 'newSlug'=>$slug, + )); + } + return $this->render('default/add_dataset.html.twig', array( + 'form' => $form->createView(), + 'userIsAdmin'=>$userIsAdmin, + 'entityName'=>'Dataset', + 'adminPage'=>true,)); + + } + + + /** + * Create a form to add an instance of the entity specified in the URL. + * Also validates and ingests the object. + *· + * @param string $entityName The name of the new entity + * @param Request $request The current HTTP request + *· + * @return Response A Response instance + * + * @Route("/add/{entityName}", name="add_new_entity") + */ + public function addNewEntity($entityName, Request $request) { + //check if form will appear in a modal + $modal = $request->get('modal', false); + $addTemplate = 'add.html.twig'; + $successTemplate = 'add_success.html.twig'; + $action = '/add/'.$entityName; + if ($modal) { + $action . '?modal=true'; + $addTemplate = "modal_" . $addTemplate; + $successTemplate = "modal_" . $successTemplate; + } + + //make user-friendly name for display + $entityTypeDisplayName = trim(preg_replace('/(?personEntities)) { + $newEntity = 'AppBundle\Entity\\Person'; + } else { + $newEntity = 'AppBundle\Entity\\' . $entityName; + } + $newEntityFormType = 'AppBundle\Form\Type\\' . $entityName . "Type"; + + $em = $this->getDoctrine()->getManager(); + $form = $this->createForm(new $newEntityFormType(), + new $newEntity(), + array( + 'action'=>$action, + 'method'=>'POST')); + $form->handleRequest($request); + if ($form->isValid()) { + $entity = $form->getData(); + + // Create a slug using each entity's getDisplayName method + $addedEntityName = $entity->getDisplayName(); + $slug = Slugger::slugify($addedEntityName); + $entity->setSlug($slug); + + $em->persist($entity); + $em->flush(); + return $this->render('default/'.$successTemplate, array( + 'displayName' => $entityTypeDisplayName, + 'adminPage'=>true, + 'newSlug'=>$slug, + 'entityName'=>$entityName, + 'addedEntityName'=> $addedEntityName)); + } + return $this->render('default/'.$addTemplate, array( + 'form' => $form->createView(), + 'displayName' => $entityTypeDisplayName, + 'adminPage'=>true, + 'entityName' => $entityName)); + + } + + +} diff --git a/src/AppBundle/Controller/AdminController.php b/src/AppBundle/Controller/AdminController.php new file mode 100755 index 00000000..c5a3d22f --- /dev/null +++ b/src/AppBundle/Controller/AdminController.php @@ -0,0 +1,76 @@ +render('default/admin-home.html.twig',array( + 'adminPage'=>true, + )); + + } + + + /** + * Produce the entity management page + * + * @param Request The current HTTP request + * + * @return Response A Response instance + * + * @Route("/manage", name="admin_manage") + */ + public function adminManageAction(Request $request) { + + + return $this->render('default/admin-manage.html.twig',array( + 'adminPage'=>true, + )); + + } + + /** + * Produce the user management page + * + * @param Request The current HTTP request + * + * @return Response A Response instance + * + * @Route("/users", name="admin_users") + */ + public function adminUsersAction(Request $request) { + + + return $this->render('default/admin-users.html.twig',array( + 'adminPage'=>true, + )); + + } + +} diff --git a/src/AppBundle/Controller/CacheController.php b/src/AppBundle/Controller/CacheController.php new file mode 100755 index 00000000..729b3309 --- /dev/null +++ b/src/AppBundle/Controller/CacheController.php @@ -0,0 +1,63 @@ +get('security.context')->isGranted('ROLE_ADMIN'); + + if ($userIsAdmin) { + apc_clear_cache(); + apc_clear_cache('user'); + apc_clear_cache('opcode'); + return new Response('success'); + } else { + throw new AccessDeniedException(); + } + + } + + /** + * Prints contents of APC cache if user has admin privileges + * + * @param Request The current HTTP request + * + * @return Response A Response instance + * + * @Route("/admin/cache/view", name="cache_info") + */ + public function viewCache(Request $request) { + + $userIsAdmin = $this->get('security.context')->isGranted('ROLE_ADMIN'); + + if ($userIsAdmin) { + return new Response(var_dump(apc_cache_info())); + } else { + throw new AccessDeniedException(); + } + + } +} diff --git a/src/AppBundle/Controller/GeneralController.php b/src/AppBundle/Controller/GeneralController.php new file mode 100755 index 00000000..078e8dd3 --- /dev/null +++ b/src/AppBundle/Controller/GeneralController.php @@ -0,0 +1,172 @@ +get('SolrSearchr'); + $solr->setUserSearch($currentSearch); + $resultsFromSolr = $solr->fetchFromSolr(); + + $results = new SearchResults($resultsFromSolr); + + if ($results->numResults == 0) { + return $this->render('default/no_results.html.twig', array( + 'results' => $results, + 'currentSearch'=>$currentSearch, + )); + } else { + return $this->render('default/results.html.twig',array( + 'results' => $results, + 'currentSearch' => $currentSearch, + )); + } + + } + + + /** + * Produce the About page, checking if we have an institution- + * specific version. + * + * @param Request The current HTTP request + * + * @return Response A Response instance + * @Route("/about", name="about") + */ + public function aboutAction(Request $request) { + + if ($this->get('templating')->exists('institution/about.html.twig')) { + return $this->render('institution/about.html.twig',array()); + } + else { + return $this->render('default/about.html.twig', array()); + } + + } + + + /** + * Produce the Contact Us page and send emails to the + * users specified in parameters.yml + * NOTE: The setTo() and setFrom() methods are supposed + * to accept arrays for multiple recipients, but this appears + * not to work. + * + * @param Request The current HTTP request + * + * @return Response A Response instance + * + * @Route("/contact-us", name="contact") + */ + public function contactAction(Request $request) { + $contactFormEmail = new \AppBundle\Entity\ContactFormEmail(); + + // Get email addresses from parameters.yml + $emailTo = $this->container->getParameter('contact_email_to'); + $emailFrom = $this->container->getParameter('contact_email_from'); + + $em = $this->getDoctrine()->getManager(); + $form = $this->createForm(new \AppBundle\Form\Type\ContactFormEmailType(), $contactFormEmail); + $form->handleRequest($request); + if ($form->isValid()) { + $email = $form->getData(); + + // save their submission to the database first + $em->persist($email); + $em->flush(); + + $mailer = $this->get('mailer'); + $message = $mailer->createMessage() + ->setSubject('New Feedback about Data Catalog') + ->setFrom($emailFrom) + ->setTo($emailTo) + ->setBody( + $this->renderView( + 'default/feedback_email.html.twig', + array('msg' => $email) + ), + 'text/html' + ); + $mailer->send($message); + + return $this->render('default/contact_email_send_success.html.twig', array( + 'form' => $form->createView(), + )); + } + + return $this->render('default/contact.html.twig', array( + 'form' => $form->createView(), + )); + + } + + + /** + * Produce the detailed pages for individual datasets + * + * @param string $slug The slug of the dataset to be viewed + * @param Request The current HTTP request + * + * @return Response A Response instance + * + * @Route("/dataset/{slug}", name="view_dataset") + */ + public function viewAction($slug, Request $request) { + $dataset = $this->getDoctrine() + ->getRepository('AppBundle:Dataset') + ->findOneBySlug($slug); + + // dataset not found + if (!$dataset) { + throw $this->createNotFoundException( + 'No dataset matching title "' . $slug . '"' + ); + } + // dataset is unpublished, and user is not admin + if (!$dataset->getPublished() && !$this->get('security.context')->isGranted('ROLE_ADMIN')) { + throw $this->createAccessDeniedException( + 'You are not authorized to view this resource.'); + } + + + if ($dataset->getOrigin() == 'Internal') { + return $this->render('default/view_dataset_internal.html.twig', array( + 'dataset' => $dataset, + )); + } else { + return $this->render('default/view_dataset_external.html.twig', array( + 'dataset' => $dataset, + )); + } + } + +} diff --git a/src/AppBundle/Controller/JSONController.php b/src/AppBundle/Controller/JSONController.php new file mode 100755 index 00000000..f510bf28 --- /dev/null +++ b/src/AppBundle/Controller/JSONController.php @@ -0,0 +1,77 @@ +getDoctrine()->getManager(); + + if ($slug == "all") { + $datasets = $em->getRepository('AppBundle:Dataset') + ->findBy(array('published'=>1)); + } else { + $datasets = $em->getRepository('AppBundle:Dataset') + ->findOneBy(array('slug'=>$slug,'published'=>1)); + } + + if ($_format == "json") { + $jsonContent = json_encode($datasets); + $response = new Response(); + $response->setContent($jsonContent); + $response->headers->set('Content-Type', 'application/json'); + + } + + return $response; + + + } + + + /** + * Accept JSON submissions + * + * @TODO + * + * @Route( + * "/api/add/dataset", name="json_input" + * ) + */ + public function JSONInputAction() { + + throw new NotFoundHttpException(); + + } + + + + + + +} diff --git a/src/AppBundle/Controller/QueueController.php b/src/AppBundle/Controller/QueueController.php new file mode 100755 index 00000000..27a7e424 --- /dev/null +++ b/src/AppBundle/Controller/QueueController.php @@ -0,0 +1,64 @@ +getDoctrine()->getManager(); + + $queueLength = $em->getRepository('AppBundle:Dataset') + ->countAllUnpublished(); + + + return $this->render('default/queue_notification.html.twig',array( + 'queueLength' => $queueLength, + 'adminPage'=>true, + )); + + } + + + /** + * Produce a list of all the unpublished datasets + * + * @return Response A Response instance + * + * @Route("/admin/approval-queue", name="approval_queue") + */ + public function viewApprovalQueueAction() { + + $em = $this->getDoctrine()->getManager(); + $approvalQueue = $em->getRepository('AppBundle:Dataset') + ->findAllUnpublished(); + + return $this->render('default/approval_queue.html.twig',array( + 'approvalQueue' => $approvalQueue, + 'adminPage'=>true, + )); + + } + + + +} diff --git a/src/AppBundle/Controller/RelatedDatasetController.php b/src/AppBundle/Controller/RelatedDatasetController.php new file mode 100755 index 00000000..5cff30fc --- /dev/null +++ b/src/AppBundle/Controller/RelatedDatasetController.php @@ -0,0 +1,42 @@ +getDoctrine()->getManager(); + + $dataset = $em->getRepository('AppBundle:Dataset') + ->findOneBy(array('dataset_uid'=>$id)); + + return $this->render('default/related_dataset_link.html.twig',array( + 'title' => $dataset->getTitle(), + 'slug'=> $dataset->getSlug(), + + )); + + } + + + +} diff --git a/src/AppBundle/Controller/RemoveController.php b/src/AppBundle/Controller/RemoveController.php new file mode 100755 index 00000000..a962a7d4 --- /dev/null +++ b/src/AppBundle/Controller/RemoveController.php @@ -0,0 +1,86 @@ +getDoctrine()->getManager(); + + $userIsAdmin = $this->get('security.context')->isGranted('ROLE_ADMIN'); + + if ($slug == null) { + $allEntities = $em->getRepository($removeEntity)->findAll(); + return $this->render('default/list_of_entities_to_remove.html.twig', array( + 'entities' => $allEntities, + 'entityName' => $entityName, + 'adminPage'=>true, + 'displayName' => $entityTypeDisplayName + )); + } + + $thisEntity = $em->getRepository($removeEntity)->findOneBySlug($slug); + + if (!$thisEntity) { + throw $this->createNotFoundException( + 'No entity of type ' . $entityName . ' was found matching this slug: ' . $slug + ); + } + if($entityName == 'Dataset') { + $datasetUid = $thisEntity->getDatasetUid(); + $form = $this->createForm(new DatasetAsAdminType($userIsAdmin, $datasetUid), $thisEntity); + } + else { + $form = $this->createForm(new $entityFormType(), $thisEntity); + } + $form->handleRequest($request); + if ($form->isValid() && $userIsAdmin) { + $em->remove($thisEntity); + $em->flush(); + return $this->render('default/remove_success.html.twig', array( + 'entityName'=>$entityTypeDisplayName, + 'adminPage'=>true, + )); + } + + return $this->render('default/remove.html.twig', array( + 'form' => $form->createView(), + 'displayName'=>$entityTypeDisplayName, + 'adminPage'=>true, + 'thisEntityName'=>$thisEntity->getDisplayName(), + 'entityName' =>$entityName)); + } + +} diff --git a/src/AppBundle/Controller/SecurityController.php b/src/AppBundle/Controller/SecurityController.php new file mode 100755 index 00000000..b73b30bd --- /dev/null +++ b/src/AppBundle/Controller/SecurityController.php @@ -0,0 +1,59 @@ +get('security.authentication_utils'); + + // get login error if exists + $error = $authenticationUtils->getLastAuthenticationError(); + + //last username entered by the user + $lastUsername = $authenticationUtils->getLastUsername(); + + return $this->render( + 'security/login.html.twig', + array( + 'last_username' => $lastUsername, + 'error' => $error, + ) + ); + } + + + /** + * Placeholder function for Symfony + * + * @Route("/login_check", name="login_check") + */ + public function loginCheckAction(Request $request) { + } + + /** + * Placeholder function for Symfony + * + * @Route("/logout", name="logout") + */ + public function logoutAction(Request $request) { + } + +} diff --git a/src/AppBundle/Controller/UpdateController.php b/src/AppBundle/Controller/UpdateController.php new file mode 100755 index 00000000..9abce5a1 --- /dev/null +++ b/src/AppBundle/Controller/UpdateController.php @@ -0,0 +1,122 @@ +getDoctrine()->getManager(); + + $userIsAdmin = $this->get('security.context')->isGranted('ROLE_ADMIN'); + + if ($slug == null) { + $allEntities = $em->getRepository($updateEntity)->findAll(); + return $this->render('default/list_of_entities_to_update.html.twig', array( + 'entities' => $allEntities, + 'entityName' => $entityName, + 'adminPage'=>true, + 'userIsAdmin'=>$userIsAdmin, + 'displayName' => $entityTypeDisplayName + )); + } + + $thisEntity = $em->getRepository($updateEntity)->findOneBySlug($slug); + if (!$thisEntity) { + throw $this->createNotFoundException( + 'No entity of type ' . $entityName . ' was found matching this slug: ' . $slug + ); + } + + if ($entityName == 'Dataset') { + $datasetUid = $thisEntity->getDatasetUid(); + if ($userIsAdmin) { + $form = $this->createForm(new DatasetAsAdminType($userIsAdmin, $datasetUid), $thisEntity); + } else { + $form = $this->createForm(new DatasetAsUserType($userIsAdmin, $datasetUid), $thisEntity); + } + } + else { + $form = $this->createForm(new $entityFormType(), $thisEntity); + } + $form->handleRequest($request); + if ($form->isValid()) { + $addedEntityName = $thisEntity->getDisplayName(); + $newSlug = Slugger::slugify($addedEntityName); + $thisEntity->setSlug($newSlug); + if (method_exists($thisEntity, 'setDateUpdated')) { + $thisEntity->setDateUpdated(new \DateTime("now")); + } + $em->flush(); + return $this->render('default/update_success.html.twig', array( + 'adminPage'=>true, + 'displayName'=>$entityTypeDisplayName, + 'entityName' =>$entityName, + 'addedEntityName' => $addedEntityName, + 'newSlug' => $newSlug,)); + + } + + if ($entityName == 'Dataset') { + if ($userIsAdmin) { + return $this->render('default/update_dataset_admin.html.twig', array( + 'form' => $form->createView(), + 'displayName'=>$entityTypeDisplayName, + 'adminPage'=>true, + 'userIsAdmin'=>$userIsAdmin, + 'slug' =>$slug, + 'entityName' =>$entityName)); + } else { + return $this->render('default/update_dataset_user.html.twig', array( + 'form' => $form->createView(), + 'displayName'=>$entityTypeDisplayName, + 'adminPage'=>true, + 'userIsAdmin'=>$userIsAdmin, + 'slug' =>$slug, + 'entityName' =>$entityName)); + } + } else { + return $this->render('default/update.html.twig', array( + 'form' => $form->createView(), + 'adminPage'=>true, + 'displayName'=>$entityTypeDisplayName, + 'slug' => $slug, + 'entityName' =>$entityName)); + } + } +} diff --git a/src/AppBundle/Entity/AccessRestriction.php b/src/AppBundle/Entity/AccessRestriction.php new file mode 100755 index 00000000..26dce525 --- /dev/null +++ b/src/AppBundle/Entity/AccessRestriction.php @@ -0,0 +1,144 @@ +datasets = new \Doctrine\Common\Collections\ArrayCollection(); + } + + /** + * Get name for display + * + * @return string + */ + public function getDisplayName() { + return $this->restriction; + } + + + + /** + * Get id + * + * @return integer + */ + public function getId() + { + return $this->id; + } + + /** + * Set restriction + * + * @param string $restriction + * @return AccessRestriction + */ + public function setRestriction($restriction) + { + $this->restriction = $restriction; + + return $this; + } + + /** + * Get restriction + * + * @return string + */ + public function getRestriction() + { + return $this->restriction; + } + + /** + * Set slug + * + * @param string $slug + * @return AccessRestriction + */ + public function setSlug($slug) + { + $this->slug = $slug; + + return $this; + } + + /** + * Get slug + * + * @return string + */ + public function getSlug() + { + return $this->slug; + } + + /** + * Add datasets + * + * @param \AppBundle\Entity\Dataset $datasets + * @return AccessRestriction + */ + public function addDataset(\AppBundle\Entity\Dataset $datasets) + { + $this->datasets[] = $datasets; + + return $this; + } + + /** + * Remove datasets + * + * @param \AppBundle\Entity\Dataset $datasets + */ + public function removeDataset(\AppBundle\Entity\Dataset $datasets) + { + $this->datasets->removeElement($datasets); + } + + /** + * Get datasets + * + * @return \Doctrine\Common\Collections\Collection + */ + public function getDatasets() + { + return $this->datasets; + } +} diff --git a/src/AppBundle/Entity/Award.php b/src/AppBundle/Entity/Award.php new file mode 100755 index 00000000..3a57c084 --- /dev/null +++ b/src/AppBundle/Entity/Award.php @@ -0,0 +1,227 @@ +datasets = new \Doctrine\Common\Collections\ArrayCollection(); + } + + /** + * Get name for display + * + * @return string + */ + public function getDisplayName() { + return $this->award; + } + + + /** + * Get id + * + * @return integer + */ + public function getId() + { + return $this->id; + } + + /** + * Set award + * + * @param string $award + * @return Award + */ + public function setAward($award) + { + $this->award = $award; + + return $this; + } + + /** + * Get award + * + * @return string + */ + public function getAward() + { + return $this->award; + } + + /** + * Set award_funder + * + * @param string $awardFunder + * @return Award + */ + public function setAwardFunder($awardFunder) + { + $this->award_funder = $awardFunder; + + return $this; + } + + /** + * Get award_funder + * + * @return string + */ + public function getAwardFunder() + { + return $this->award_funder; + } + + /** + * Set award_url + * + * @param string $awardUrl + * @return Award + */ + public function setAwardUrl($awardUrl) + { + $this->award_url = $awardUrl; + + return $this; + } + + /** + * Get award_url + * + * @return string + */ + public function getAwardUrl() + { + return $this->award_url; + } + + /** + * Set slug + * + * @param string $slug + * @return Award + */ + public function setSlug($slug) + { + $this->slug = $slug; + + return $this; + } + + /** + * Get slug + * + * @return string + */ + public function getSlug() + { + return $this->slug; + } + + /** + * Set funder_type + * + * @param string $funderType + * @return Award + */ + public function setFunderType($funderType) + { + $this->funder_type = $funderType; + + return $this; + } + + /** + * Get funder_type + * + * @return string + */ + public function getFunderType() + { + return $this->funder_type; + } + + /** + * Add datasets + * + * @param \AppBundle\Entity\Dataset $datasets + * @return Award + */ + public function addDataset(\AppBundle\Entity\Dataset $datasets) + { + $this->datasets[] = $datasets; + + return $this; + } + + /** + * Remove datasets + * + * @param \AppBundle\Entity\Dataset $datasets + */ + public function removeDataset(\AppBundle\Entity\Dataset $datasets) + { + $this->datasets->removeElement($datasets); + } + + /** + * Get datasets + * + * @return \Doctrine\Common\Collections\Collection + */ + public function getDatasets() + { + return $this->datasets; + } +} diff --git a/src/AppBundle/Entity/ContactFormEmail.php b/src/AppBundle/Entity/ContactFormEmail.php new file mode 100755 index 00000000..f1fdcf55 --- /dev/null +++ b/src/AppBundle/Entity/ContactFormEmail.php @@ -0,0 +1,242 @@ +full_name; + } + + + /** + * Get id + * + * @return integer + */ + public function getId() + { + return $this->id; + } + + /** + * Set employee_id + * + * @param string $employeeId + * @return ContactFormEmail + */ + public function setEmployeeId($employeeId) + { + $this->employee_id = $employeeId; + + return $this; + } + + /** + * Get employee_id + * + * @return string + */ + public function getEmployeeId() + { + return $this->employee_id; + } + + /** + * Set full_name + * + * @param string $fullName + * @return ContactFormEmail + */ + public function setFullName($fullName) + { + $this->full_name = $fullName; + + return $this; + } + + /** + * Get full_name + * + * @return string + */ + public function getFullName() + { + return $this->full_name; + } + + /** + * Set email_address + * + * @param string $emailAddress + * @return ContactFormEmail + */ + public function setEmailAddress($emailAddress) + { + $this->email_address = $emailAddress; + + return $this; + } + + /** + * Get email_address + * + * @return string + */ + public function getEmailAddress() + { + return $this->email_address; + } + + /** + * Set affiliation + * + * @param string $affiliation + * @return ContactFormEmail + */ + public function setAffiliation($affiliation) + { + $this->affiliation = $affiliation; + + return $this; + } + + /** + * Get affiliation + * + * @return string + */ + public function getAffiliation() + { + return $this->affiliation; + } + + /** + * Set reason + * + * @param string $reason + * @return ContactFormEmail + */ + public function setReason($reason) + { + $this->reason = $reason; + + return $this; + } + + /** + * Get reason + * + * @return string + */ + public function getReason() + { + return $this->reason; + } + + /** + * Set message_body + * + * @param string $messageBody + * @return ContactFormEmail + */ + public function setMessageBody($messageBody) + { + $this->message_body = $messageBody; + + return $this; + } + + /** + * Get message_body + * + * @return string + */ + public function getMessageBody() + { + return $this->message_body; + } + + /** + * Set checker + * + * @param string $checker + * @return ContactFormEmail + */ + public function setChecker($checker) + { + $this->checker = $checker; + + return $this; + } + + /** + * Get checker + * + * @return string + */ + public function getChecker() + { + return $this->checker; + } +} diff --git a/src/AppBundle/Entity/DataLocation.php b/src/AppBundle/Entity/DataLocation.php new file mode 100755 index 00000000..40ea426f --- /dev/null +++ b/src/AppBundle/Entity/DataLocation.php @@ -0,0 +1,154 @@ +id; + } + + /** + * get name for display + * + * @return string + */ + public function getDisplayName() { + return $this->data_access_url; + } + + + /** + * Set data_access_url + * + * @param string $dataAccessUrl + * @return DataLocationURL + */ + public function setDataAccessUrl($dataAccessUrl) + { + $this->data_access_url = $dataAccessUrl; + + return $this; + } + + /** + * Get data_access_url + * + * @return string + */ + public function getDataAccessUrl() + { + return $this->data_access_url; + } + + /** + * Set datasets_dataset_uid + * + * @param \AppBundle\Entity\Dataset $datasetsDatasetUid + * @return DataLocationURL + */ + public function setDatasetsDatasetUid(\AppBundle\Entity\Dataset $datasetsDatasetUid = null) + { + $this->datasets_dataset_uid = $datasetsDatasetUid; + + return $this; + } + + /** + * Get datasets_dataset_uid + * + * @return \AppBundle\Entity\Dataset + */ + public function getDatasetsDatasetUid() + { + return $this->datasets_dataset_uid; + } + + /** + * Set data_location + * + * @param string $dataLocation + * @return DataLocation + */ + public function setDataLocation($dataLocation) + { + $this->data_location = $dataLocation; + + return $this; + } + + /** + * Get data_location + * + * @return string + */ + public function getDataLocation() + { + return $this->data_location; + } + + /** + * Set location_content + * + * @param string $locationContent + * @return DataLocation + */ + public function setLocationContent($locationContent) + { + $this->location_content = $locationContent; + + return $this; + } + + /** + * Get location_content + * + * @return string + */ + public function getLocationContent() + { + return $this->location_content; + } +} diff --git a/src/AppBundle/Entity/DataLocationURL.php b/src/AppBundle/Entity/DataLocationURL.php new file mode 100755 index 00000000..3e24f65c --- /dev/null +++ b/src/AppBundle/Entity/DataLocationURL.php @@ -0,0 +1,97 @@ +id; + } + + /** + * get name for display + * + * @return string + */ + public function getDisplayName() { + return $this->data_access_url; + } + + + /** + * Set data_access_url + * + * @param string $dataAccessUrl + * @return DataLocationURL + */ + public function setDataAccessUrl($dataAccessUrl) + { + $this->data_access_url = $dataAccessUrl; + + return $this; + } + + /** + * Get data_access_url + * + * @return string + */ + public function getDataAccessUrl() + { + return $this->data_access_url; + } + + /** + * Set datasets_dataset_uid + * + * @param \AppBundle\Entity\Dataset $datasetsDatasetUid + * @return DataLocationURL + */ + public function setDatasetsDatasetUid(\AppBundle\Entity\Dataset $datasetsDatasetUid = null) + { + $this->datasets_dataset_uid = $datasetsDatasetUid; + + return $this; + } + + /** + * Get datasets_dataset_uid + * + * @return \AppBundle\Entity\Dataset + */ + public function getDatasetsDatasetUid() + { + return $this->datasets_dataset_uid; + } +} diff --git a/src/AppBundle/Entity/DataType.php b/src/AppBundle/Entity/DataType.php new file mode 100755 index 00000000..ef940e50 --- /dev/null +++ b/src/AppBundle/Entity/DataType.php @@ -0,0 +1,171 @@ +datasets = new \Doctrine\Common\Collections\ArrayCollection(); + } + + /** + * Get name for display + * + * @return string + */ + public function getDisplayName() { + return $this->data_type; + } + + + /** + * Get id + * + * @return integer + */ + public function getId() + { + return $this->id; + } + + /** + * Set data_type + * + * @param string $dataType + * @return DataType + */ + public function setDataType($dataType) + { + $this->data_type = $dataType; + + return $this; + } + + /** + * Get data_type + * + * @return string + */ + public function getDataType() + { + return $this->data_type; + } + + /** + * Set authority + * + * @param string $authority + * @return DataType + */ + public function setAuthority($authority) + { + $this->authority = $authority; + + return $this; + } + + /** + * Get authority + * + * @return string + */ + public function getAuthority() + { + return $this->authority; + } + + /** + * Set slug + * + * @param string $slug + * @return DataType + */ + public function setSlug($slug) + { + $this->slug = $slug; + + return $this; + } + + /** + * Get slug + * + * @return string + */ + public function getSlug() + { + return $this->slug; + } + + /** + * Add datasets + * + * @param \AppBundle\Entity\Dataset $datasets + * @return DataType + */ + public function addDataset(\AppBundle\Entity\Dataset $datasets) + { + $this->datasets[] = $datasets; + + return $this; + } + + /** + * Remove datasets + * + * @param \AppBundle\Entity\Dataset $datasets + */ + public function removeDataset(\AppBundle\Entity\Dataset $datasets) + { + $this->datasets->removeElement($datasets); + } + + /** + * Get datasets + * + * @return \Doctrine\Common\Collections\Collection + */ + public function getDatasets() + { + return $this->datasets; + } +} diff --git a/src/AppBundle/Entity/Dataset.php b/src/AppBundle/Entity/Dataset.php new file mode 100755 index 00000000..1f8ab19d --- /dev/null +++ b/src/AppBundle/Entity/Dataset.php @@ -0,0 +1,1853 @@ +date_added = new \DateTime("now"); + $this->dataset_formats = new \Doctrine\Common\Collections\ArrayCollection(); + $this->awards = new \Doctrine\Common\Collections\ArrayCollection(); + $this->access_restrictions = new \Doctrine\Common\Collections\ArrayCollection(); + $this->measurement_standards = new \Doctrine\Common\Collections\ArrayCollection(); + $this->subject_genders = new \Doctrine\Common\Collections\ArrayCollection(); + $this->subject_population_ages = new \Doctrine\Common\Collections\ArrayCollection(); + $this->data_types = new \Doctrine\Common\Collections\ArrayCollection(); + $this->subject_geographic_areas = new \Doctrine\Common\Collections\ArrayCollection(); + $this->subject_geographic_area_details = new \Doctrine\Common\Collections\ArrayCollection(); + $this->subject_domains = new \Doctrine\Common\Collections\ArrayCollection(); + $this->publications = new \Doctrine\Common\Collections\ArrayCollection(); + $this->subject_keywords = new \Doctrine\Common\Collections\ArrayCollection(); + $this->publishers = new \Doctrine\Common\Collections\ArrayCollection(); + $this->data_locations = new \Doctrine\Common\Collections\ArrayCollection(); + $this->other_resources = new \Doctrine\Common\Collections\ArrayCollection(); + $this->dataset_alternate_titles = new \Doctrine\Common\Collections\ArrayCollection(); + $this->related_datasets = new \Doctrine\Common\Collections\ArrayCollection(); + $this->related_software = new \Doctrine\Common\Collections\ArrayCollection(); + $this->related_equipment = new \Doctrine\Common\Collections\ArrayCollection(); + $this->subject_of_study = new \Doctrine\Common\Collections\ArrayCollection(); + + $this->published = false; + } + + /** + * get name for display + * + * @return string + */ + public function getDisplayName() { + return $this->title; + } + + /** + * Get id + * + * @return integer + */ + public function getId() + { + return $this->dataset_uid; + } + + /** + * Set origin + * + * @param string $origin + * @return Dataset + */ + public function setOrigin($origin) + { + $this->origin = $origin; + + return $this; + } + + /** + * Get origin + * + * @return string + */ + public function getOrigin() + { + return $this->origin; + } + + /** + * Set title + * + * @param string $title + * @return Dataset + */ + public function setTitle($title) + { + $this->title = $title; + + return $this; + } + + /** + * Get title + * + * @return string + */ + public function getTitle() + { + return $this->title; + } + + + /** + * Get published + * + * @return boolean + */ + public function getPublished() { + return $this->published; + } + + /** + * Set published + * + * @return boolean + */ + public function setPublished($published) { + $this->published = $published; + + return $this; + } + + /** + * Set slug + * + * @param string $slug + * @return Dataset + */ + public function setSlug($slug) + { + $this->slug = $slug; + + return $this; + } + + /** + * Get slug + * + * @return string + */ + public function getSlug() + { + return $this->slug; + } + + + /** + * Set description + * + * @param string $description + * @return Dataset + */ + public function setDescription($description) + { + $this->description = $description; + + return $this; + } + + /** + * Get description + * + * @return string + */ + public function getDescription() + { + return $this->description; + } + + + + /** + * Set subject_start_date + * + * @param \DateTime $subjectStartDate + * @return Dataset + */ + public function setSubjectStartDate($subjectStartDate) + { + $this->subject_start_date = $subjectStartDate; + + return $this; + } + + /** + * Get subject_start_date + * + * @return \DateTime + */ + public function getSubjectStartDate() + { + return $this->subject_start_date; + } + + /** + * Set subject_end_date + * + * @param \DateTime $subjectEndDate + * @return Dataset + */ + public function setSubjectEndDate($subjectEndDate) + { + $this->subject_end_date = $subjectEndDate; + + return $this; + } + + /** + * Get subject_end_date + * + * @return \DateTime + */ + public function getSubjectEndDate() + { + return $this->subject_end_date; + } + + /** + * Set dataset_size + * + * @param string $datasetSize + * @return Dataset + */ + public function setDatasetSize($datasetSize) + { + $this->dataset_size = $datasetSize; + + return $this; + } + + /** + * Get dataset_size + * + * @return string + */ + public function getDatasetSize() + { + return $this->dataset_size; + } + + /** + * Set subscriber + * + * @param string $subscriber + * @return Dataset + */ + public function setSubscriber($subscriber) + { + $this->subscriber = $subscriber; + + return $this; + } + + /** + * Get subscriber + * + * @return string + */ + public function getSubscriber() + { + return $this->subscriber; + } + + /** + * Set access_instructions + * + * @param string $accessInstructions + * @return Dataset + */ + public function setAccessInstructions($accessInstructions) + { + $this->access_instructions = $accessInstructions; + + return $this; + } + + /** + * Get access_instructions + * + * @return string + */ + public function getAccessInstructions() + { + return $this->access_instructions; + } + + /** + * Set licensing_details + * + * @param string $licensingDetails + * @return Dataset + */ + public function setLicensingDetails($licensingDetails) + { + $this->licensing_details = $licensingDetails; + + return $this; + } + + /** + * Get licensing_details + * + * @return string + */ + public function getLicensingDetails() + { + return $this->licensing_details; + } + + /** + * Set license_expiration_date + * + * @param \DateTime $licenseExpirationDate + * @return Dataset + */ + public function setLicenseExpirationDate($licenseExpirationDate) + { + $this->license_expiration_date = $licenseExpirationDate; + + return $this; + } + + /** + * Get license_expiration_date + * + * @return \DateTime + */ + public function getLicenseExpirationDate() + { + return $this->license_expiration_date; + } + + /** + * Set erd_url + * + * @param string $erdUrl + * @return Dataset + */ + public function setErdUrl($erdUrl) + { + $this->erd_url = $erdUrl; + + return $this; + } + + /** + * Get erd_url + * + * @return string + */ + public function getErdUrl() + { + return $this->erd_url; + } + + /** + * Set library_catalog_url + * + * @param string $libraryCatalogUrl + * @return Dataset + */ + public function setLibraryCatalogUrl($libraryCatalogUrl) + { + $this->library_catalog_url = $libraryCatalogUrl; + + return $this; + } + + /** + * Get library_catalog_url + * + * @return string + */ + public function getLibraryCatalogUrl() + { + return $this->library_catalog_url; + } + + /** + * Set funder_category + * + * @param string $funderCategory + * @return Dataset + */ + public function setFunderCategory($funderCategory) + { + $this->funder_category = $funderCategory; + + return $this; + } + + /** + * Get funder_category + * + * @return string + */ + public function getFunderCategory() + { + return $this->funder_category; + } + + /** + * Set pubmed_search + * + * @param string $pubmedSearch + * @return Dataset + */ + public function setPubmedSearch($pubmedSearch) + { + $this->pubmed_search = $pubmedSearch; + + return $this; + } + + /** + * Get pubmed_search + * + * @return string + */ + public function getPubmedSearch() + { + return $this->pubmed_search; + } + + /** + * Set date_added + * + * @param \DateTime $dateAdded + * @return Dataset + */ + public function setDateAdded($dateAdded) + { + $this->date_added = $dateAdded; + + return $this; + } + + /** + * Get date_added + * + * @return \DateTime + */ + public function getDateAdded() + { + return $this->date_added; + } + + /** + * Set date_updated + * + * @param \DateTime $dateUpdated + * @return Dataset + */ + public function setDateUpdated($dateUpdated) + { + $this->date_updated = $dateUpdated; + + return $this; + } + + /** + * Get date_updated + * + * @return \DateTime + */ + public function getDateUpdated() + { + return $this->date_updated; + } + + /** + * Set date_archived + * + * @param \DateTime $dateArchived + * @return Dataset + */ + public function setDateArchived($dateArchived) + { + $this->date_archived = $dateArchived; + + return $this; + } + + /** + * Get date_archived + * + * @return \DateTime + */ + public function getDateArchived() + { + return $this->date_archived; + } + + /** + * Set accession_number + * + * @param string $accessionNumber + * @return Dataset + */ + public function setAccessionNumber($accessionNumber) + { + $this->accession_number = $accessionNumber; + + return $this; + } + + /** + * Get accession_number + * + * @return string + */ + public function getAccessionNumber() + { + return $this->accession_number; + } + + /** + * Set data_location_description + * + * @param string $dataLocationDescription + * @return Dataset + */ + public function setDataLocationDescription($dataLocationDescription) + { + $this->data_location_description = $dataLocationDescription; + + return $this; + } + + /** + * Get data_location_description + * + * @return string + */ + public function getDataLocationDescription() + { + return $this->data_location_description; + } + + /** + * Add dataset_formats + * + * @param \AppBundle\Entity\DatasetFormat $datasetFormats + * @return Dataset + */ + public function addDatasetFormat(\AppBundle\Entity\DatasetFormat $datasetFormats) + { + $this->dataset_formats[] = $datasetFormats; + + return $this; + } + + /** + * Remove dataset_formats + * + * @param \AppBundle\Entity\DatasetFormat $datasetFormats + */ + public function removeDatasetFormat(\AppBundle\Entity\DatasetFormat $datasetFormats) + { + $this->dataset_formats->removeElement($datasetFormats); + } + + /** + * Get dataset_formats + * + * @return \Doctrine\Common\Collections\Collection + */ + public function getDatasetFormats() + { + return $this->dataset_formats; + } + + /** + * Add awards + * + * @param \AppBundle\Entity\Award $awards + * @return Dataset + */ + public function addAward(\AppBundle\Entity\Award $awards) + { + $this->awards[] = $awards; + + return $this; + } + + /** + * Remove awards + * + * @param \AppBundle\Entity\Award $awards + */ + public function removeAward(\AppBundle\Entity\Award $awards) + { + $this->awards->removeElement($awards); + } + + /** + * Get awards + * + * @return \Doctrine\Common\Collections\Collection + */ + public function getAwards() + { + return $this->awards; + } + + /** + * Add access_restrictions + * + * @param \AppBundle\Entity\AccessRestriction $accessRestrictions + * @return Dataset + */ + public function addAccessRestriction(\AppBundle\Entity\AccessRestriction $accessRestrictions) + { + $this->access_restrictions[] = $accessRestrictions; + + return $this; + } + + /** + * Remove access_restrictions + * + * @param \AppBundle\Entity\AccessRestriction $accessRestrictions + */ + public function removeAccessRestriction(\AppBundle\Entity\AccessRestriction $accessRestrictions) + { + $this->access_restrictions->removeElement($accessRestrictions); + } + + /** + * Get access_restrictions + * + * @return \Doctrine\Common\Collections\Collection + */ + public function getAccessRestrictions() + { + return $this->access_restrictions; + } + + /** + * Add measurement_standards + * + * @param \AppBundle\Entity\MeasurementStandard $measurementStandards + * @return Dataset + */ + public function addMeasurementStandard(\AppBundle\Entity\MeasurementStandard $measurementStandards) + { + $this->measurement_standards[] = $measurementStandards; + + return $this; + } + + /** + * Remove measurement_standards + * + * @param \AppBundle\Entity\MeasurementStandard $measurementStandards + */ + public function removeMeasurementStandard(\AppBundle\Entity\MeasurementStandard $measurementStandards) + { + $this->measurement_standards->removeElement($measurementStandards); + } + + /** + * Get measurement_standards + * + * @return \Doctrine\Common\Collections\Collection + */ + public function getMeasurementStandards() + { + return $this->measurement_standards; + } + + /** + * Add subject_genders + * + * @param \AppBundle\Entity\SubjectGender $subjectGenders + * @return Dataset + */ + public function addSubjectGender(\AppBundle\Entity\SubjectGender $subjectGenders) + { + $this->subject_genders[] = $subjectGenders; + + return $this; + } + + /** + * Remove subject_genders + * + * @param \AppBundle\Entity\SubjectGender $subjectGenders + */ + public function removeSubjectGender(\AppBundle\Entity\SubjectGender $subjectGenders) + { + $this->subject_genders->removeElement($subjectGenders); + } + + /** + * Get subject_genders + * + * @return \Doctrine\Common\Collections\Collection + */ + public function getSubjectGenders() + { + return $this->subject_genders; + } + + /** + * Add subject_population_ages + * + * @param \AppBundle\Entity\SubjectPopulationAge $subjectPopulationAges + * @return Dataset + */ + public function addSubjectPopulationAge(\AppBundle\Entity\SubjectPopulationAge $subjectPopulationAges) + { + $this->subject_population_ages[] = $subjectPopulationAges; + + return $this; + } + + /** + * Remove subject_population_ages + * + * @param \AppBundle\Entity\SubjectPopulationAge $subjectPopulationAges + */ + public function removeSubjectPopulationAge(\AppBundle\Entity\SubjectPopulationAge $subjectPopulationAges) + { + $this->subject_population_ages->removeElement($subjectPopulationAges); + } + + /** + * Get subject_population_ages + * + * @return \Doctrine\Common\Collections\Collection + */ + public function getSubjectPopulationAges() + { + return $this->subject_population_ages; + } + + /** + * Add data_types + * + * @param \AppBundle\Entity\DataType $dataTypes + * @return Dataset + */ + public function addDataType(\AppBundle\Entity\DataType $dataTypes) + { + $this->data_types[] = $dataTypes; + + return $this; + } + + /** + * Remove data_types + * + * @param \AppBundle\Entity\DataType $dataTypes + */ + public function removeDataType(\AppBundle\Entity\DataType $dataTypes) + { + $this->data_types->removeElement($dataTypes); + } + + /** + * Get data_types + * + * @return \Doctrine\Common\Collections\Collection + */ + public function getDataTypes() + { + return $this->data_types; + } + + /** + * Add subject_geographic_areas + * + * @param \AppBundle\Entity\SubjectGeographicArea $subjectGeographicAreas + * @return Dataset + */ + public function addSubjectGeographicArea(\AppBundle\Entity\SubjectGeographicArea $subjectGeographicAreas) + { + $this->subject_geographic_areas[] = $subjectGeographicAreas; + + return $this; + } + + /** + * Remove subject_geographic_areas + * + * @param \AppBundle\Entity\SubjectGeographicArea $subjectGeographicAreas + */ + public function removeSubjectGeographicArea(\AppBundle\Entity\SubjectGeographicArea $subjectGeographicAreas) + { + $this->subject_geographic_areas->removeElement($subjectGeographicAreas); + } + + /** + * Get subject_geographic_areas + * + * @return \Doctrine\Common\Collections\Collection + */ + public function getSubjectGeographicAreas() + { + return $this->subject_geographic_areas; + } + /** + * Add subject_geographic_area_details + * + * @param \AppBundle\Entity\SubjectGeographicAreaDetail $subjectGeographicAreaDetail + * @return Dataset + */ + public function addSubjectGeographicAreaDetail(\AppBundle\Entity\SubjectGeographicAreaDetail $subjectGeographicAreaDetails) + { + $this->subject_geographic_area_details[] = $subjectGeographicAreaDetails; + + return $this; + } + + /** + * Remove subject_geographic_area_details + * + * @param \AppBundle\Entity\SubjectGeographicAreaDetail $subjectGeographicAreaDetails + */ + public function removeSubjectGeographicAreaDetail(\AppBundle\Entity\SubjectGeographicAreaDetail $subjectGeographicAreaDetails) + { + $this->subject_geographic_area_details->removeElement($subjectGeographicAreaDetails); + } + + /** + * Get subject_geographic_area_details + * + * @return \Doctrine\Common\Collections\Collection + */ + public function getSubjectGeographicAreaDetails() + { + return $this->subject_geographic_area_details; + } + + /** + * Add subject_domains + * + * @param \AppBundle\Entity\SubjectDomain $subjectDomains + * @return Dataset + */ + public function addSubjectDomain(\AppBundle\Entity\SubjectDomain $subjectDomains) + { + $this->subject_domains[] = $subjectDomains; + + return $this; + } + + /** + * Remove subject_domains + * + * @param \AppBundle\Entity\SubjectDomain $subjectDomains + */ + public function removeSubjectDomain(\AppBundle\Entity\SubjectDomain $subjectDomains) + { + $this->subject_domains->removeElement($subjectDomains); + } + + /** + * Get subject_domains + * + * @return \Doctrine\Common\Collections\Collection + */ + public function getSubjectDomains() + { + return $this->subject_domains; + } + + /** + * Add publications + * + * @param \AppBundle\Entity\Publication $publications + * @return Dataset + */ + public function addPublication(\AppBundle\Entity\Publication $publications) + { + $this->publications[] = $publications; + + return $this; + } + + /** + * Remove publications + * + * @param \AppBundle\Entity\Publication $publications + */ + public function removePublication(\AppBundle\Entity\Publication $publications) + { + $this->publications->removeElement($publications); + } + + /** + * Get publications + * + * @return \Doctrine\Common\Collections\Collection + */ + public function getPublications() + { + return $this->publications; + } + + /** + * Add subject_keywords + * + * @param \AppBundle\Entity\SubjectKeyword $subjectKeywords + * @return Dataset + */ + public function addSubjectKeyword(\AppBundle\Entity\SubjectKeyword $subjectKeywords) + { + $this->subject_keywords[] = $subjectKeywords; + + return $this; + } + + /** + * Remove subject_keywords + * + * @param \AppBundle\Entity\SubjectKeyword $subjectKeywords + */ + public function removeSubjectKeyword(\AppBundle\Entity\SubjectKeyword $subjectKeywords) + { + $this->subject_keywords->removeElement($subjectKeywords); + } + + /** + * Get subject_keywords + * + * @return \Doctrine\Common\Collections\Collection + */ + public function getSubjectKeywords() + { + return $this->subject_keywords; + } + + + + + /** + * Add study_types + * + * @param \AppBundle\Entity\StudyType $studyType + * @return Dataset + */ + public function addStudyType(\AppBundle\Entity\StudyType $studyType) + { + $this->study_types[] = $studyType; + + return $this; + } + + /** + * Remove study_types + * + * @param \AppBundle\Entity\StudyType $studyType + */ + public function removeStudyType(\AppBundle\Entity\StudyType $studyType) + { + $this->study_types->removeElement($studyType); + } + + /** + * Get study_types + * + * @return \Doctrine\Common\Collections\Collection + */ + public function getStudyTypes() + { + return $this->study_types; + } + + + + + /** + * Add publishers + * + * @param \AppBundle\Entity\Publisher $publishers + * @return Dataset + */ + public function addPublisher(\AppBundle\Entity\Publisher $publishers) + { + $this->publishers[] = $publishers; + + return $this; + } + + /** + * Remove publishers + * + * @param \AppBundle\Entity\Publisher $publishers + */ + public function removePublisher(\AppBundle\Entity\Publisher $publishers) + { + $this->publishers->removeElement($publishers); + } + + /** + * Get publishers + * + * @return \Doctrine\Common\Collections\Collection + */ + public function getPublishers() + { + return $this->publishers; + } + + /** + * Add data_location + * + * @param \AppBundle\Entity\DataLocation $dataLocation + * @return Dataset + */ + public function addDataLocation(\AppBundle\Entity\DataLocation $dataLocation) + { + if (!$this->data_locations->contains($dataLocation)) { + $this->data_locations[] = $dataLocation; + $dataLocation->setDatasetsDatasetUid($this); + } + + return $this; + } + + /** + * Remove data_location + * + * @param \AppBundle\Entity\DataLocation $dataLocation + */ + public function removeDataLocation(\AppBundle\Entity\DataLocation $dataLocation) + { + if ($this->data_locations->contains($dataLocation)) { + $this->data_locations->removeElement($dataLocation); + $dataLocation->setDatasetsDatasetUid(null); + } + } + + /** + * Get data_location + * + * @return \Doctrine\Common\Collections\Collection + */ + public function getDataLocations() + { + return $this->data_locations; + } + + /** + * Add other_resource + * + * @param \AppBundle\Entity\OtherResource $otherResource + * @return Dataset + */ + public function addOtherResource(\AppBundle\Entity\OtherResource $otherResource) + { + if (!$this->other_resources->contains($otherResource)) { + $this->other_resources[] = $otherResource; + $otherResource->setDatasetsDatasetUid($this); + } + + return $this; + } + + /** + * Remove other_resource + * + * @param \AppBundle\Entity\OtherResource $otherResource + */ + public function removeOtherResource(\AppBundle\Entity\OtherResource $otherResource) + { + if ($this->other_resources->contains($otherResource)) { + $this->other_resources->removeElement($otherResource); + $otherResource->setDatasetsDatasetUid(null); + } + } + + /** + * Get other_resource + * + * @return \Doctrine\Common\Collections\Collection + */ + public function getOtherResources() + { + return $this->other_resources; + } + + + /** + * Add dataset_alternate_titles + * + * @param \AppBundle\Entity\DatasetAlternateTitle $datasetAlternateTitle + * @return Dataset + */ + public function addDatasetAlternateTitle(\AppBundle\Entity\DatasetAlternateTitle $datasetAlternateTitle) + { + if (!$this->dataset_alternate_titles->contains($datasetAlternateTitle)) { + $this->dataset_alternate_titles[] = $datasetAlternateTitle; + $datasetAlternateTitle->setDatasetsDatasetUid($this); + } + + return $this; + } + + /** + * Remove dataset_alternate_titles + * + * @param \AppBundle\Entity\DatasetAlternateTitle $datasetAlternateTitle + */ + public function removeDatasetAlternateTitle(\AppBundle\Entity\DatasetAlternateTitle $datasetAlternateTitle) + { + if ($this->dataset_alternate_titles->contains($datasetAlternateTitle)) { + $this->dataset_alternate_titles->removeElement($datasetAlternateTitle); + $datasetAlternateTitle->setDatasetsDatasetUid(null); + } + } + + /** + * Get dataset_alternate_titles + * + * @return \Doctrine\Common\Collections\Collection + */ + public function getDatasetAlternateTitles() + { + return $this->dataset_alternate_titles; + } + + /** + * Add related_datasets + * + * @param \AppBundle\Entity\DatasetRelationship $relatedDataset + * @return Dataset + */ + public function addRelatedDataset(\AppBundle\Entity\DatasetRelationship $relatedDataset) + { + if (!$this->related_datasets->contains($relatedDataset)) { + $this->related_datasets[] = $relatedDataset; + $relatedDataset->setParentDatasetUid($this); + } + + return $this; + } + + /** + * Remove related_datasets + * + * @param \AppBundle\Entity\DatasetRelationship $relatedDataset + */ + public function removeRelatedDataset(\AppBundle\Entity\DatasetRelationship $relatedDataset) + { + if ($this->related_datasets->contains($relatedDataset)) { + $this->related_datasets->removeElement($relatedDataset); + $relatedDatset->setParentDatasetUid(null); + } + } + + /** + * Get related_datasets + * + * @return \Doctrine\Common\Collections\Collection + */ + public function getRelatedDatasets() + { + return $this->related_datasets; + } + + /** + * Set dataset_uid + * + * @param integer $datasetUid + * @return Dataset + */ + public function setDatasetUid($datasetUid) + { + $this->dataset_uid = $datasetUid; + + return $this; + } + + /** + * Get dataset_uid + * + * @return integer + */ + public function getDatasetUid() + { + return $this->dataset_uid; + } + + + /** + * Produce custom serialized dataset for JSON output using PHP's + * JsonSerializable interface. Not the most elegant solution, but + * faster and more customizable than Symfony's Serializer component, + * and doesn't cause recursion like jms/serializer-bundle did. + * + * @return array + */ + public function jsonSerialize() { + + $formats = $awards = $restrictions = $stds = $genders = $ages = $equipment = $software = $subject_of_study = []; + $areas = $area_details = $domains = $publications = $keywords = $publishers = []; + $authors = $data_type_array = $types_of_study = $corresponding_authors = $experts = $data_locations = $akas = $related_datasets = []; + foreach ($this->dataset_formats as $format) { $formats[]=$format->getDisplayName(); } + foreach ($this->awards as $award) { $awards[]=$award->getDisplayName(); } + foreach ($this->access_restrictions as $restriction) { $restrictions[]=$restriction->getDisplayName(); } + foreach ($this->measurement_standards as $std) { $stds[]=$std->getDisplayName(); } + foreach ($this->subject_genders as $gender) { $genders[]=$gender->getDisplayName(); } + foreach ($this->subject_population_ages as $age) { $ages[]=$age->getDisplayName(); } + foreach ($this->subject_geographic_areas as $area) { $areas[]=$area->getDisplayName(); } + foreach ($this->subject_geographic_area_details as $detail) { $area_details[]=$detail->getDisplayName(); } + foreach ($this->subject_domains as $domain) { $domains[]=$domain->getDisplayName(); } + foreach ($this->publications as $pub) { $publications[]=$pub->getDisplayName(); } + foreach ($this->subject_keywords as $kwd) { $keywords[]=$kwd->getDisplayName(); } + foreach ($this->publishers as $pubber) { $publishers[]=$pubber->getDisplayName(); } + foreach ($this->data_types as $data_type) { $data_type_array[]=$data_type->getDisplayName(); } + foreach ($this->dataset_alternate_titles as $alt) { $akas[]=$alt->getDisplayName(); } + foreach ($this->study_types as $study_type) { $types_of_study[]=$study_type->getDisplayName(); } + foreach ($this->authors as $author) { $authors[]=$author->getDisplayName(); } + foreach ($this->corresponding_authors as $corresponding_author) { $corresponding_authors[]=$corresponding_author->getDisplayName(); } + foreach ($this->local_experts as $expert) { $experts[]=$expert->getDisplayName(); } + foreach ($this->subject_of_study as $subject) { $subject_of_study[]=$subject->getDisplayName(); } + foreach ($this->related_software as $sw) { $software[]=$sw->getDisplayName(); } + foreach ($this->related_equipment as $equip) { $equipment[]=$equip->getDisplayName(); } + return array( + 'id' => $this->dataset_uid, + 'dataset_title' => $this->title, + 'dataset_alt_title' =>$akas, + 'description' => $this->description, + 'dataset_end_date' => $this->subject_end_date, + 'dataset_start_date' => $this->subject_start_date, + 'local_experts' => $experts, + 'authors' => $authors, + 'corresponding_authors' => $corresponding_authors, + 'date_added' => $this->date_added, + 'dataset_formats' =>$formats, + 'data_types' =>$data_type_array, + 'study_types' =>$types_of_study, + 'collection_standards'=>$stds, + 'awards' =>$awards, + 'access_restrictions' =>$restrictions, + 'subject_population_ages'=>$ages, + 'subject_geographic_area'=>$areas, + 'subject_geographic_area_details'=>$area_details, + 'subject_domain' =>$domains, + 'subject_keywords' =>$keywords, + 'publishers' =>$publishers, + 'subject_of_study' =>$subject_of_study, + 'related_software' =>$software, + 'related_equipment' =>$equipment, + ); + + } + + + + /** + * Add authors + * + * @param \AppBundle\Entity\Person $authors + * @return Dataset + */ + public function addAuthor(\AppBundle\Entity\Person $authors) + { + $this->authors[] = $authors; + + return $this; + } + + /** + * Remove authors + * + * @param \AppBundle\Entity\Person $authors + */ + public function removeAuthor(\AppBundle\Entity\Person $authors) + { + $this->authors->removeElement($authors); + } + + /** + * Get authors + * + * @return \Doctrine\Common\Collections\Collection + */ + public function getAuthors() + { + return $this->authors; + } + + + /** + * Add corresponding authors + * + * @param \AppBundle\Entity\Person $corresponding_authors + * @return Dataset + */ + public function addCorrespondingAuthor(\AppBundle\Entity\Person $corresponding_authors) + { + $this->corresponding_authors[] = $corresponding_authors; + + return $this; + } + + /** + * Remove corresponding authors + * + * @param \AppBundle\Entity\Person $corresponding_authors + */ + public function removeCorrespondingAuthor(\AppBundle\Entity\Person $corresponding_authors) + { + $this->corresponding_authors->removeElement($corresponding_authors); + } + + /** + * Get corresponding_authors + * + * @return \Doctrine\Common\Collections\Collection + */ + public function getCorrespondingAuthors() + { + return $this->corresponding_authors; + } + + + /** + * Add local_experts + * + * @param \AppBundle\Entity\Person $localExperts + * @return Dataset + */ + public function addLocalExpert(\AppBundle\Entity\Person $localExperts) + { + $this->local_experts[] = $localExperts; + + return $this; + } + + /** + * Remove local_experts + * + * @param \AppBundle\Entity\Person $localExperts + */ + public function removeLocalExpert(\AppBundle\Entity\Person $localExperts) + { + $this->local_experts->removeElement($localExperts); + } + + /** + * Get local_experts + * + * @return \Doctrine\Common\Collections\Collection + */ + public function getLocalExperts() + { + return $this->local_experts; + } + + + /** + * Add related_software + * + * @param \AppBundle\Entity\RelatedSoftware $relatedSoftware + * @return Dataset + */ + public function addRelatedSoftware(\AppBundle\Entity\RelatedSoftware $relatedSoftware) + { + $this->related_software[] = $relatedSoftware; + + return $this; + } + + /** + * Remove related_software + * + * @param \AppBundle\Entity\RelatedSoftware $relatedSoftware + */ + public function removeRelatedSoftware(\AppBundle\Entity\RelatedSoftware $relatedSoftware) + { + $this->related_software->removeElement($relatedSoftware); + } + + /** + * Get related_software + * + * @return \Doctrine\Common\Collections\Collection + */ + public function getRelatedSoftware() + { + return $this->related_software; + } + + /** + * Add related_equipment + * + * @param \AppBundle\Entity\RelatedEquipment $relatedEquipment + * @return Dataset + */ + public function addRelatedEquipment(\AppBundle\Entity\RelatedEquipment $relatedEquipment) + { + $this->related_equipment[] = $relatedEquipment; + + return $this; + } + + /** + * Remove related_equipment + * + * @param \AppBundle\Entity\RelatedEquipment $relatedEquipment + */ + public function removeRelatedEquipment(\AppBundle\Entity\RelatedEquipment $relatedEquipment) + { + $this->related_equipment->removeElement($relatedEquipment); + } + + /** + * Get related_equipment + * + * @return \Doctrine\Common\Collections\Collection + */ + public function getRelatedEquipment() + { + return $this->related_equipment; + } + + /** + * Add subject_of_study + * + * @param \AppBundle\Entity\SubjectOfStudy $subjectOfStudy + * @return Dataset + */ + public function addSubjectOfStudy(\AppBundle\Entity\SubjectOfStudy $subjectOfStudy) + { + $this->subject_of_study[] = $subjectOfStudy; + + return $this; + } + + /** + * Remove subject_of_study + * + * @param \AppBundle\Entity\SubjectOfStudy $subjectOfStudy + */ + public function removeSubjectOfStudy(\AppBundle\Entity\SubjectOfStudy $subjectOfStudy) + { + $this->subject_of_study->removeElement($subjectOfStudy); + } + + /** + * Get subject_of_study + * + * @return \Doctrine\Common\Collections\Collection + */ + public function getSubjectOfStudy() + { + return $this->subject_of_study; + } +} diff --git a/src/AppBundle/Entity/DatasetAlternateTitle.php b/src/AppBundle/Entity/DatasetAlternateTitle.php new file mode 100755 index 00000000..063f0273 --- /dev/null +++ b/src/AppBundle/Entity/DatasetAlternateTitle.php @@ -0,0 +1,98 @@ +alt_title; + } + + + /** + * Get id + * + * @return integer + */ + public function getId() + { + return $this->id; + } + + /** + * Set alt_title + * + * @param string $altTitle + * @return DatasetAlternateTitle + */ + public function setAltTitle($altTitle) + { + $this->alt_title = $altTitle; + + return $this; + } + + /** + * Get alt_title + * + * @return string + */ + public function getAltTitle() + { + return $this->alt_title; + } + + /** + * Set datasets_dataset_uid + * + * @param \AppBundle\Entity\Dataset $datasetsDatasetUid + * @return DatasetAlternateTitle + */ + public function setDatasetsDatasetUid(\AppBundle\Entity\Dataset $datasetsDatasetUid = null) + { + $this->datasets_dataset_uid = $datasetsDatasetUid; + + return $this; + } + + /** + * Get datasets_dataset_uid + * + * @return \AppBundle\Entity\Dataset + */ + public function getDatasetsDatasetUid() + { + return $this->datasets_dataset_uid; + } +} diff --git a/src/AppBundle/Entity/DatasetFormat.php b/src/AppBundle/Entity/DatasetFormat.php new file mode 100755 index 00000000..c73a335b --- /dev/null +++ b/src/AppBundle/Entity/DatasetFormat.php @@ -0,0 +1,141 @@ +datasets = new \Doctrine\Common\Collections\ArrayCollection(); + } + + /** + * Get name for display + * + * @return string + */ + public function getDisplayName() { + return $this->format; + } + + + /** + * Get id + * + * @return integer + */ + public function getId() + { + return $this->id; + } + + /** + * Set format + * + * @param string $format + * @return DatasetFormat + */ + public function setFormat($format) + { + $this->format = $format; + + return $this; + } + + /** + * Get format + * + * @return string + */ + public function getFormat() + { + return $this->format; + } + + /** + * Set slug + * + * @param string $slug + * @return DatasetFormat + */ + public function setSlug($slug) + { + $this->slug = $slug; + + return $this; + } + + /** + * Get slug + * + * @return string + */ + public function getSlug() + { + return $this->slug; + } + + /** + * Add datasets + * + * @param \AppBundle\Entity\Dataset $datasets + * @return DatasetFormat + */ + public function addDataset(\AppBundle\Entity\Dataset $datasets) + { + $this->datasets[] = $datasets; + + return $this; + } + + /** + * Remove datasets + * + * @param \AppBundle\Entity\Dataset $datasets + */ + public function removeDataset(\AppBundle\Entity\Dataset $datasets) + { + $this->datasets->removeElement($datasets); + } + + /** + * Get datasets + * + * @return \Doctrine\Common\Collections\Collection + */ + public function getDatasets() + { + return $this->datasets; + } +} diff --git a/src/AppBundle/Entity/DatasetRelationship.php b/src/AppBundle/Entity/DatasetRelationship.php new file mode 100755 index 00000000..c1ab6aae --- /dev/null +++ b/src/AppBundle/Entity/DatasetRelationship.php @@ -0,0 +1,144 @@ +id; + } + + /** + * Set relationship_attributes + * + * @param string $relationshipAttributes + * @return DatasetRelationship + */ + public function setRelationshipAttributes($relationshipAttributes) + { + $this->relationship_attributes = $relationshipAttributes; + + return $this; + } + + /** + * Get relationship_attributes + * + * @return string + */ + public function getRelationshipAttributes() + { + return $this->relationship_attributes; + } + + /** + * Set relationship_notes + * + * @param string $relationshipNotes + * @return DatasetRelationship + */ + public function setRelationshipNotes($relationshipNotes) + { + $this->relationship_notes = $relationshipNotes; + + return $this; + } + + /** + * Get relationship_notes + * + * @return string + */ + public function getRelationshipNotes() + { + return $this->relationship_notes; + } + + /** + * Set related_dataset_uid + * + * @param integer $relatedDatasetUid + * @return DatasetRelationship + */ + public function setRelatedDatasetUid($relatedDatasetUid) + { + $this->related_dataset_uid = $relatedDatasetUid; + + return $this; + } + + /** + * Get related_dataset_uid + * + * @return integer + */ + public function getRelatedDatasetUid() + { + return $this->related_dataset_uid; + } + + /** + * Set parent_dataset_uid + * + * @param \AppBundle\Entity\Dataset $parentDatasetUid + * @return DatasetRelationship + */ + public function setParentDatasetUid(\AppBundle\Entity\Dataset $parentDatasetUid = null) + { + $this->parent_dataset_uid = $parentDatasetUid; + + return $this; + } + + /** + * Get parent_dataset_uid + * + * @return \AppBundle\Entity\Dataset + */ + public function getParentDatasetUid() + { + return $this->parent_dataset_uid; + } +} diff --git a/src/AppBundle/Entity/DatasetRepository.php b/src/AppBundle/Entity/DatasetRepository.php new file mode 100755 index 00000000..38d9c928 --- /dev/null +++ b/src/AppBundle/Entity/DatasetRepository.php @@ -0,0 +1,40 @@ +getEntityManager() + ->createQuery( + 'SELECT count(d) FROM AppBundle:Dataset d WHERE d.published=false' + ) + ->getSingleScalarResult(); + } + + public function findAllUnpublished() { + return $this->getEntityManager() + ->createQuery( + 'SELECT d FROM AppBundle:Dataset d WHERE d.published=false' + ) + ->getResult(); + } + + + public function getNewDatasetId() { + $newId = $this->getEntityManager() + ->createQuery( + 'SELECT max(d.dataset_uid) + 1 FROM AppBundle:Dataset d' + ) + ->getSingleScalarResult(); + + return $newId; + + } + + +} diff --git a/src/AppBundle/Entity/MeasurementStandard.php b/src/AppBundle/Entity/MeasurementStandard.php new file mode 100755 index 00000000..3b43c509 --- /dev/null +++ b/src/AppBundle/Entity/MeasurementStandard.php @@ -0,0 +1,168 @@ +datasets = new \Doctrine\Common\Collections\ArrayCollection(); + } + + /** + * Get name for display + * + * @return string + */ + public function getDisplayName() { + return $this->measurement_standard_name; + } + + /** + * Get id + * + * @return integer + */ + public function getId() + { + return $this->id; + } + + /** + * Set measurement_standard_name + * + * @param string $measurementStandardName + * @return MeasurementStandard + */ + public function setMeasurementStandardName($measurementStandardName) + { + $this->measurement_standard_name = $measurementStandardName; + + return $this; + } + + /** + * Get measurement_standard_name + * + * @return string + */ + public function getMeasurementStandardName() + { + return $this->measurement_standard_name; + } + + /** + * Set measurement_standard_authority + * + * @param string $measurementStandardAuthority + * @return MeasurementStandard + */ + public function setMeasurementStandardAuthority($measurementStandardAuthority) + { + $this->measurement_standard_authority = $measurementStandardAuthority; + + return $this; + } + + /** + * Get measurement_standard_authority + * + * @return string + */ + public function getMeasurementStandardAuthority() + { + return $this->measurement_standard_authority; + } + + /** + * Set slug + * + * @param string $slug + * @return MeasurementStandard + */ + public function setSlug($slug) + { + $this->slug = $slug; + + return $this; + } + + /** + * Get slug + * + * @return string + */ + public function getSlug() + { + return $this->slug; + } + + /** + * Add datasets + * + * @param \AppBundle\Entity\Dataset $datasets + * @return MeasurementStandard + */ + public function addDataset(\AppBundle\Entity\Dataset $datasets) + { + $this->datasets[] = $datasets; + + return $this; + } + + /** + * Remove datasets + * + * @param \AppBundle\Entity\Dataset $datasets + */ + public function removeDataset(\AppBundle\Entity\Dataset $datasets) + { + $this->datasets->removeElement($datasets); + } + + /** + * Get datasets + * + * @return \Doctrine\Common\Collections\Collection + */ + public function getDatasets() + { + return $this->datasets; + } +} diff --git a/src/AppBundle/Entity/OtherResource.php b/src/AppBundle/Entity/OtherResource.php new file mode 100755 index 00000000..07e3b2d3 --- /dev/null +++ b/src/AppBundle/Entity/OtherResource.php @@ -0,0 +1,154 @@ +id; + } + + /** + * get name for display + * + * @return string + */ + public function getDisplayName() { + return $this->resource_name; + } + + /** + * Set datasets_dataset_uid + * + * @param \AppBundle\Entity\Dataset $datasetsDatasetUid + * @return OtherResource + */ + public function setDatasetsDatasetUid(\AppBundle\Entity\Dataset $datasetsDatasetUid = null) + { + $this->datasets_dataset_uid = $datasetsDatasetUid; + + return $this; + } + + /** + * Get datasets_dataset_uid + * + * @return \AppBundle\Entity\Dataset + */ + public function getDatasetsDatasetUid() + { + return $this->datasets_dataset_uid; + } + + + /** + * Set resource_name + * + * @param string $resourceName + * @return OtherResource + */ + public function setResourceName($resourceName) + { + $this->resource_name = $resourceName; + + return $this; + } + + /** + * Get resource_name + * + * @return string + */ + public function getResourceName() + { + return $this->resource_name; + } + + /** + * Set resource_description + * + * @param string $resourceDescription + * @return OtherResource + */ + public function setResourceDescription($resourceDescription) + { + $this->resource_description = $resourceDescription; + + return $this; + } + + /** + * Get resource_description + * + * @return string + */ + public function getResourceDescription() + { + return $this->resource_description; + } + + /** + * Set resource_url + * + * @param string $resourceUrl + * @return OtherResource + */ + public function setResourceUrl($resourceUrl) + { + $this->resource_url = $resourceUrl; + + return $this; + } + + /** + * Get resource_url + * + * @return string + */ + public function getResourceUrl() + { + return $this->resource_url; + } +} diff --git a/src/AppBundle/Entity/Person.php b/src/AppBundle/Entity/Person.php new file mode 100755 index 00000000..846cf964 --- /dev/null +++ b/src/AppBundle/Entity/Person.php @@ -0,0 +1,254 @@ +full_name; + } + + /** + * Constructor + */ + public function __construct() + { + } + + /** + * Get id + * + * @return integer + */ + public function getId() + { + return $this->id; + } + + /** + * Set full_name + * + * @param string $fullName + * @return Person + */ + public function setFullName($fullName) + { + $this->full_name = $fullName; + + return $this; + } + + /** + * Get full_name + * + * @return string + */ + public function getFullName() + { + return $this->full_name; + } + + /** + * Set last_name + * + * @param string $lastName + * @return Person + */ + public function setLastName($lastName) + { + $this->last_name = $lastName; + + return $this; + } + + /** + * Get last_name + * + * @return string + */ + public function getLastName() + { + return $this->last_name; + } + + /** + * Set first_name + * + * @param string $firstName + * @return Person + */ + public function setFirstName($firstName) + { + $this->first_name = $firstName; + + return $this; + } + + /** + * Get first_name + * + * @return string + */ + public function getFirstName() + { + return $this->first_name; + } + + /** + * Set kid + * + * @param string $kid + * @return Person + */ + public function setKid($kid) + { + $this->kid = $kid; + + return $this; + } + + /** + * Get kid + * + * @return string + */ + public function getKid() + { + return $this->kid; + } + + /** + * Set bio_url + * + * @param string $bioUrl + * @return Person + */ + public function setBioUrl($bioUrl) + { + $this->bio_url = $bioUrl; + + return $this; + } + + /** + * Get bio_url + * + * @return string + */ + public function getBioUrl() + { + return $this->bio_url; + } + + + /** + * Set slug + * + * @param string $slug + * @return Person + */ + public function setSlug($slug) + { + $this->slug = $slug; + + return $this; + } + + /** + * Get slug + * + * @return string + */ + public function getSlug() + { + return $this->slug; + } + + /** + * Set orcid_id + * + * @param string $orcidId + * @return Person + */ + public function setOrcidId($orcidId) + { + $this->orcid_id = $orcidId; + + return $this; + } + + /** + * Get orcid_id + * + * @return string + */ + public function getOrcidId() + { + return $this->orcid_id; + } +} diff --git a/src/AppBundle/Entity/PersonAssociation.php b/src/AppBundle/Entity/PersonAssociation.php new file mode 100755 index 00000000..efccc4b5 --- /dev/null +++ b/src/AppBundle/Entity/PersonAssociation.php @@ -0,0 +1,117 @@ +id; + } + + /** + * Set role + * + * @param string $role + * @return PersonAssociation + */ + public function setRole($role) + { + $this->role = $role; + + return $this; + } + + /** + * Get role + * + * @return string + */ + public function getRole() + { + return $this->role; + } + + + /** + * Set person + * + * @param \AppBundle\Entity\Person $person + * @return PersonAssociation + */ + public function setPerson(\AppBundle\Entity\Person $person = null) + { + $this->person = $person; + + return $this; + } + + /** + * Get person + * + * @return \AppBundle\Entity\Person + */ + public function getPerson() + { + return $this->person; + } + + /** + * Set dataset_uid + * + * @param \AppBundle\Entity\Dataset $datasetUid + * @return PersonAssociation + */ + public function setDatasetUid(\AppBundle\Entity\Dataset $datasetUid = null) + { + $this->dataset_uid = $datasetUid; + + return $this; + } + + /** + * Get dataset_uid + * + * @return \AppBundle\Entity\Dataset + */ + public function getDatasetUid() + { + return $this->dataset_uid; + } +} diff --git a/src/AppBundle/Entity/Publication.php b/src/AppBundle/Entity/Publication.php new file mode 100755 index 00000000..35232730 --- /dev/null +++ b/src/AppBundle/Entity/Publication.php @@ -0,0 +1,198 @@ +datasets = new \Doctrine\Common\Collections\ArrayCollection(); + } + + /** + * Get name for display + * + * @return string + */ + public function getDisplayName() { + return $this->citation; + } + + + /** + * Get id + * + * @return integer + */ + public function getId() + { + return $this->id; + } + + /** + * Set citation + * + * @param string $citation + * @return Publication + */ + public function setCitation($citation) + { + $this->citation = $citation; + + return $this; + } + + /** + * Get citation + * + * @return string + */ + public function getCitation() + { + return $this->citation; + } + + /** + * Set url + * + * @param string $url + * @return Publication + */ + public function setUrl($url) + { + $this->url = $url; + + return $this; + } + + /** + * Get url + * + * @return string + */ + public function getUrl() + { + return $this->url; + } + + /** + * Set doi + * + * @param string $doi + * @return Publication + */ + public function setDoi($doi) + { + $this->doi = $doi; + + return $this; + } + + /** + * Get doi + * + * @return string + */ + public function getDoi() + { + return $this->doi; + } + + /** + * Set slug + * + * @param string $slug + * @return Publication + */ + public function setSlug($slug) + { + $this->slug = $slug; + + return $this; + } + + /** + * Get slug + * + * @return string + */ + public function getSlug() + { + return $this->slug; + } + + /** + * Add datasets + * + * @param \AppBundle\Entity\Dataset $datasets + * @return Publication + */ + public function addDataset(\AppBundle\Entity\Dataset $datasets) + { + $this->datasets[] = $datasets; + + return $this; + } + + /** + * Remove datasets + * + * @param \AppBundle\Entity\Dataset $datasets + */ + public function removeDataset(\AppBundle\Entity\Dataset $datasets) + { + $this->datasets->removeElement($datasets); + } + + /** + * Get datasets + * + * @return \Doctrine\Common\Collections\Collection + */ + public function getDatasets() + { + return $this->datasets; + } +} diff --git a/src/AppBundle/Entity/Publisher.php b/src/AppBundle/Entity/Publisher.php new file mode 100755 index 00000000..0ef24099 --- /dev/null +++ b/src/AppBundle/Entity/Publisher.php @@ -0,0 +1,182 @@ +publisher_name; + } + + + /** + * Get id + * + * @return integer + */ + public function getId() + { + return $this->id; + } + + /** + * Set publisher_name + * + * @param string $publisherName + * @return Publisher + */ + public function setPublisherName($publisherName) + { + $this->publisher_name = $publisherName; + + return $this; + } + + /** + * Get publisher_name + * + * @return string + */ + public function getPublisherName() + { + return $this->publisher_name; + } + + /** + * Set publisher_url + * + * @param string $publisherUrl + * @return Publisher + */ + public function setPublisherUrl($publisherUrl) + { + $this->publisher_url = $publisherUrl; + + return $this; + } + + /** + * Get publisher_url + * + * @return string + */ + public function getPublisherUrl() + { + return $this->publisher_url; + } + + /** + * Add publisher_categories + * + * @param \AppBundle\Entity\PublisherCategory $publisherCategories + * @return Publisher + */ + public function addPublisherCategory(\AppBundle\Entity\PublisherCategory $publisherCategories) + { + $this->publisher_categories[] = $publisherCategories; + + return $this; + } + + /** + * Remove publisher_categories + * + * @param \AppBundle\Entity\PublisherCategory $publisherCategories + */ + public function removePublisherCategory(\AppBundle\Entity\PublisherCategory $publisherCategories) + { + $this->publisher_categories->removeElement($publisherCategories); + } + + /** + * Get publisher_categories + * + * @return \Doctrine\Common\Collections\Collection + */ + public function getPublisherCategories() + { + return $this->publisher_categories; + } + + + /** + * Constructor + */ + public function __construct() + { + $this->publisher_categories = new \Doctrine\Common\Collections\ArrayCollection(); + } + + /** + * Set slug + * + * @param string $slug + * @return Publisher + */ + public function setSlug($slug) + { + $this->slug = $slug; + + return $this; + } + + /** + * Get slug + * + * @return string + */ + public function getSlug() + { + return $this->slug; + } +} diff --git a/src/AppBundle/Entity/PublisherCategory.php b/src/AppBundle/Entity/PublisherCategory.php new file mode 100755 index 00000000..19dc3656 --- /dev/null +++ b/src/AppBundle/Entity/PublisherCategory.php @@ -0,0 +1,101 @@ +publisher_category; + } + + + /** + * Get id + * + * @return integer + */ + public function getId() + { + return $this->id; + } + + /** + * Set publisher_category + * + * @param string $publisherCategory + * @return PublisherCategory + */ + public function setPublisherCategory($publisherCategory) + { + $this->publisher_category = $publisherCategory; + + return $this; + } + + /** + * Get publisher_category + * + * @return string + */ + public function getPublisherCategory() + { + return $this->publisher_category; + } + + /** + * Set slug + * + * @param string $slug + * @return PublisherCategory + */ + public function setSlug($slug) + { + $this->slug = $slug; + + return $this; + } + + /** + * Get slug + * + * @return string + */ + public function getSlug() + { + return $this->slug; + } +} diff --git a/src/AppBundle/Entity/RelatedEquipment.php b/src/AppBundle/Entity/RelatedEquipment.php new file mode 100755 index 00000000..9cca2657 --- /dev/null +++ b/src/AppBundle/Entity/RelatedEquipment.php @@ -0,0 +1,142 @@ +related_equipment; + } + + + /** + * Get id + * + * @return integer + */ + public function getId() + { + return $this->id; + } + + /** + * Set related_equipment + * + * @param string $related_equipment + * @return RelatedEquipment + */ + public function setRelatedEquipment($related_equipment) + { + $this->related_equipment = $related_equipment; + + return $this; + } + + /** + * Get related_equipment + * + * @return string + */ + public function getRelatedEquipment() + { + return $this->related_equipment; + } + + /** + * Set slug + * + * @param string $slug + * @return RelatedEquipment + */ + public function setSlug($slug) + { + $this->slug = $slug; + + return $this; + } + + /** + * Get slug + * + * @return string + */ + public function getSlug() + { + return $this->slug; + } + + public function __construct() { + $this->datasets = new \Doctrine\Common\Collections\ArrayCollection(); + } + + /** + * Add datasets + * + * @param \AppBundle\Entity\Dataset $datasets + * @return RelatedEquipment + */ + public function addDataset(\AppBundle\Entity\Dataset $datasets) + { + $this->datasets[] = $datasets; + + return $this; + } + + /** + * Remove datasets + * + * @param \AppBundle\Entity\Dataset $datasets + */ + public function removeDataset(\AppBundle\Entity\Dataset $datasets) + { + $this->datasets->removeElement($datasets); + } + + /** + * Get datasets + * + * @return \Doctrine\Common\Collections\Collection + */ + public function getDatasets() + { + return $this->datasets; + } +} diff --git a/src/AppBundle/Entity/RelatedSoftware.php b/src/AppBundle/Entity/RelatedSoftware.php new file mode 100755 index 00000000..f9544429 --- /dev/null +++ b/src/AppBundle/Entity/RelatedSoftware.php @@ -0,0 +1,142 @@ +related_software; + } + + + /** + * Get id + * + * @return integer + */ + public function getId() + { + return $this->id; + } + + /** + * Set related_software + * + * @param string $related_software + * @return RelatedSoftware + */ + public function setRelatedSoftware($related_software) + { + $this->related_software = $related_software; + + return $this; + } + + /** + * Get related_software + * + * @return string + */ + public function getRelatedSoftware() + { + return $this->related_software; + } + + /** + * Set slug + * + * @param string $slug + * @return RelatedSoftware + */ + public function setSlug($slug) + { + $this->slug = $slug; + + return $this; + } + + /** + * Get slug + * + * @return string + */ + public function getSlug() + { + return $this->slug; + } + + public function __construct() { + $this->datasets = new \Doctrine\Common\Collections\ArrayCollection(); + } + + /** + * Add datasets + * + * @param \AppBundle\Entity\Dataset $datasets + * @return RelatedSoftware + */ + public function addDataset(\AppBundle\Entity\Dataset $datasets) + { + $this->datasets[] = $datasets; + + return $this; + } + + /** + * Remove datasets + * + * @param \AppBundle\Entity\Dataset $datasets + */ + public function removeDataset(\AppBundle\Entity\Dataset $datasets) + { + $this->datasets->removeElement($datasets); + } + + /** + * Get datasets + * + * @return \Doctrine\Common\Collections\Collection + */ + public function getDatasets() + { + return $this->datasets; + } +} diff --git a/src/AppBundle/Entity/SearchResults.php b/src/AppBundle/Entity/SearchResults.php new file mode 100755 index 00000000..49232bce --- /dev/null +++ b/src/AppBundle/Entity/SearchResults.php @@ -0,0 +1,96 @@ + 'subject_domain_fq', + 'Timeframe' => 'dataset_years', + 'Geographic Coverage' => 'subject_geographic_area_fq', + 'Access Restrictions' => 'access_restrictions_fq', + 'subject_domain_fq' => 'Subject Domain', + 'dataset_years' => 'Dataset Timeframes', + 'subject_geographic_area_fq' => 'Geographic Coverage', + 'access_restrictions_fq' => 'Access Restrictions', + ); + + + /** + * On instantiation, translate the JSON response from Solr + * into properties on this object + * + * @param string $solrResponse A JSON response from Solr + */ + public function __construct($solrResponse) { + $this->solrResponse = json_decode($solrResponse); + if (isset($this->solrResponse->facet_counts->facet_fields)) { + $this->facets = (array) $this->solrResponse->facet_counts->facet_fields; + } + else { + throw new \RuntimeException('Solr server is reachable, but returns unexpected response. Check the full URL that is being requested'); + } + $this->dateFacets = (array) $this->solrResponse->facet_counts->facet_ranges->dataset_years->counts; + array_unshift($this->dateFacets, 'before',$this->solrResponse->facet_counts->facet_ranges->dataset_years->before); + $this->facets['dataset_years'] = $this->dateFacets; + $this->numResults = $this->solrResponse->response->numFound; + $this->resultItems = (array) $this->solrResponse->response->docs; + foreach ($this->resultItems as $dataset) { + $dataset->slug = Slugger::slugify($dataset->dataset_title); + } + + $this->facets = $this->translateFacets($this->facets); + + } + + + /** + * We need to get the facets info out of Solr's odd array structure + * so templates can make use of it easier + * + * @param array $rawFacets Facets data from Solr + * + * @return array $translatedFacets A sane array of facet data for Twig + */ + protected function translateFacets($rawFacets) { + $translatedFacets = array(); + $rawFacets = (array) $rawFacets; + foreach ($rawFacets as $key=>$value) { + for ($i=0,$size=count($value);$i<$size;$i+=2) { + $newFacetName = array_search($key, $this->facetMappings); + $facetItemName = $rawFacets[$key][$i]; + $facetItemCount= $rawFacets[$key][$i+1]; + $translatedFacets[$newFacetName][] = array( + 'facetItem' => $facetItemName, + 'facetCount'=> $facetItemCount + ); + } + } + // display names for date facets + $translatedFacets['Timeframe'][0]['facetItem'] = 'Prior to 1975'; + $translatedFacets['Timeframe'][1]['facetItem'] = '1975 - 1984'; + $translatedFacets['Timeframe'][2]['facetItem'] = '1985 - 1994'; + $translatedFacets['Timeframe'][3]['facetItem'] = '1995 - 2004'; + $translatedFacets['Timeframe'][4]['facetItem'] = '2005 - Present'; + + return $translatedFacets; + } + + +} diff --git a/src/AppBundle/Entity/SearchState.php b/src/AppBundle/Entity/SearchState.php new file mode 100755 index 00000000..9e8dee1b --- /dev/null +++ b/src/AppBundle/Entity/SearchState.php @@ -0,0 +1,46 @@ +facets = $request->query->get('facet'); + $this->keyword = $request->query->get('keyword'); + $this->resultsPP = ($request->query->get('results')) ? $request->query->get('results') : '10'; + $this->page = ($request->query->get('page')) ? $request->query->get('page') : '0'; + $this->sort = $request->query->get('sort'); + + if ($this->keyword && !$this->sort) { + // if a keyword was entered, but sort wasn't specified + $this->sort = 'relevance'; + } + elseif (!$this->sort) { + // if no keyword, and no sort specified (this is the default) + $this->sort = 'name'; + } + else { + // if no keyword, but sort is specified, then + // pass, using the sort from Request, set above + } + + } + + + +} diff --git a/src/AppBundle/Entity/Security/Role.php b/src/AppBundle/Entity/Security/Role.php new file mode 100755 index 00000000..bcb8c446 --- /dev/null +++ b/src/AppBundle/Entity/Security/Role.php @@ -0,0 +1,172 @@ +users = new ArrayCollection(); + } + /** + * @see RoleInterface + */ + public function getRole() + { + return $this->role; + } + /** + * Get id + * + * @return integer + */ + public function getId() + { + return $this->id; + } + /** + * Set name + * + * @param string $name + * @return Role + */ + public function setName($name) + { + $this->name = $name; + return $this; + } + /** + * Get name + * + * @return string + */ + public function getName() + { + return $this->name; + } + /** + * Set role + * + * @param string $role + * @return Role + */ + public function setRole($role) + { + $this->role = $role; + return $this; + } + /** + * Add users + * + * @param \AppBundle\Entity\Security\User $users + * @return Role + */ + public function addUser(\AppBundle\Entity\Security\User $users) + { + $this->users[] = $users; + return $this; + } + /** + * Remove users + * + * @param \AppBundle\Entity\Security\User $users + */ + public function removeUser(\AppBundle\Entity\Security\User $users) + { + $this->users->removeElement($users); + } + /** + * Get users + * + * @return \Doctrine\Common\Collections\Collection + */ + public function getUsers() + { + return $this->users; + } + + /** + * Set id + * + * @param integer $id + * @return Role + */ + public function setId($id) + { + $this->id = $id; + + return $this; + } + + /** + * Get role_id + * + * @return integer + */ + public function getRoleId() + { + return $this->role_id; + } + + + /** + * @see \Serializable::serialize() + * DON'T serialize Users + */ + public function serialize() + { + return \serialize(array( + $this->role_id, + $this->name, + $this->role + )); + } + + /** + * @see \Serializable::unserialize() + */ + public function unserialize($serialized) + { + list( + $this->role_id, + $this->name, + $this->role + ) = \unserialize($serialized); + } +} diff --git a/src/AppBundle/Entity/Security/User.php b/src/AppBundle/Entity/Security/User.php new file mode 100755 index 00000000..132de780 --- /dev/null +++ b/src/AppBundle/Entity/Security/User.php @@ -0,0 +1,340 @@ +roles = new ArrayCollection(); + + } + + /** + * Get name for display + * + * @return string + */ + public function getDisplayName() { + return $this->username; + } + + /** + * Get roles + * + * @return array User roles + */ + public function getRoles() { + return $this->roles->toArray(); + } + + + /** + * Get password (not used) + * + * @return string The password + */ + public function getPassword() + { + return $this->password; + } + + /** + * Get salt + * + * @return string The salt + */ + public function getSalt() + { + return null; + } + + /** + * Get first name + * + * @return string + */ + public function getFirstName() + { + return $this->firstName; + } + + /** + * Get username + * + * @return string + */ + public function getUsername() + { + return $this->username; + } + + /** + * Erase credentials + */ + public function eraseCredentials() + { + } + + /** + * Required by interface + * + * @param UserInterface + * + * @return bool + */ + public function isEqualTo(UserInterface $user) + { + if (!$user instanceof User) { + return false; + } + + if ($this->password !== $user->getPassword()) { + return false; + } + + if ($this->username !== $user->getUsername()) { + return false; + } + + return true; + } + + /** + * Get id + * + * @return integer + */ + public function getId() + { + return $this->id; + } + + /** + * Set username + * + * @param string $username + * @return User + */ + public function setUsername($username) + { + $this->username = $username; + + return $this; + } + + /** + * Set password + * + * @param string $password + * @return User + */ + public function setPassword($password) + { + $this->password = $password; + + return $this; + } + + /** + * Set firstName + * + * @param string $firstName + * @return User + */ + public function setFirstName($firstName) + { + $this->firstName = $firstName; + + return $this; + } + + + + + /** + * Set lastName + * + * @param string $lastName + * @return User + */ + public function setLastName($lastName) + { + $this->lastName = $lastName; + + return $this; + } + + /** + * Get lastName + * + * @return string + */ + public function getLastName() + { + return $this->lastName; + } + + /** + * Set slug + * + * @param string $slug + * @return User + */ + public function setSlug($slug) + { + $this->slug = $slug; + + return $this; + } + + /** + * Get slug + * + * @return string + */ + public function getSlug() + { + return $this->slug; + } + + + /** + * Add roles + * + * @param \AppBundle\Entity\Security\Role $roles + * @return User + */ + public function addRole(\AppBundle\Entity\Security\Role $roles) + { + $this->roles[] = $roles; + + return $this; + } + + /** + * Remove roles + * + * @param \AppBundle\Entity\Security\Role $roles + */ + public function removeRole(\AppBundle\Entity\Security\Role $roles) + { + $this->roles->removeElement($roles); + } + + /** + * Set id + * + * @param integer $id + * @return User + */ + public function setId($id) + { + $this->id = $id; + + return $this; + } + + /** + * Get user_id + * + * @return integer + */ + public function getUserId() + { + return $this->user_id; + } + + + /** + * @see \Serializable::serialize() + */ + public function serialize() + { + /* + * Don't serialize Roles + */ + return \serialize(array( + $this->user_id, + $this->username, + $this->slug, + $this->password, + $this->firstName, + $this->lastName + )); + } + + /** + * @see \Serializable::unserialize() + */ + public function unserialize($serialized) + { + list ( + $this->user_id, + $this->username, + $this->slug, + $this->password, + $this->firstName, + $this->lastName + ) = \unserialize($serialized); + } + +} diff --git a/src/AppBundle/Entity/Security/UserRepository.php b/src/AppBundle/Entity/Security/UserRepository.php new file mode 100755 index 00000000..95998ea6 --- /dev/null +++ b/src/AppBundle/Entity/Security/UserRepository.php @@ -0,0 +1,81 @@ +createQueryBuilder('u') + ->where('u.username = :username') + ->setParameter('username',$username) + ->getQuery(); + try { + $userData = $q->getSingleResult(); + } catch (NoResultException $e) { + $message = sprintf( + 'Unable to find user "%s"', $username + ); + throw new UsernameNotFoundException($message, 0, $e); + } + + return $userData; + + } + + + /** + * Reload user data + * + * @param UserInterface + * + * @return mixed The user's data + * + * @throws UnsupportedUserException + */ + public function refreshUser(UserInterface $user) + { + if (!$user instanceof User) { + throw new UnsupportedUserException( + sprintf('Instances of "%s" are not supported.', get_class($user)) + ); + } + + return $this->loadUserByUsername($user->getUsername()); + } + + + /** + * Check if a given class is identical to User class + * + * @param mixed $class The class we're checking + * + * @return bool + */ + public function supportsClass($class) + { + return $class === 'AppBundle\Entity\Security\User'; + } +} diff --git a/src/AppBundle/Entity/StudyType.php b/src/AppBundle/Entity/StudyType.php new file mode 100755 index 00000000..3e02bcd4 --- /dev/null +++ b/src/AppBundle/Entity/StudyType.php @@ -0,0 +1,142 @@ +study_type; + } + + + /** + * Get id + * + * @return integer + */ + public function getId() + { + return $this->id; + } + + /** + * Set study_type + * + * @param string $study_type + * @return StudyType + */ + public function setStudyType($study_type) + { + $this->study_type = $study_type; + + return $this; + } + + /** + * Get study_type + * + * @return string + */ + public function getStudyType() + { + return $this->study_type; + } + + /** + * Set slug + * + * @param string $slug + * @return StudyType + */ + public function setSlug($slug) + { + $this->slug = $slug; + + return $this; + } + + /** + * Get slug + * + * @return string + */ + public function getSlug() + { + return $this->slug; + } + + public function __construct() { + $this->datasets = new \Doctrine\Common\Collections\ArrayCollection(); + } + + /** + * Add datasets + * + * @param \AppBundle\Entity\Dataset $datasets + * @return StudyType + */ + public function addDataset(\AppBundle\Entity\Dataset $datasets) + { + $this->datasets[] = $datasets; + + return $this; + } + + /** + * Remove datasets + * + * @param \AppBundle\Entity\Dataset $datasets + */ + public function removeDataset(\AppBundle\Entity\Dataset $datasets) + { + $this->datasets->removeElement($datasets); + } + + /** + * Get datasets + * + * @return \Doctrine\Common\Collections\Collection + */ + public function getDatasets() + { + return $this->datasets; + } +} diff --git a/src/AppBundle/Entity/SubjectDomain.php b/src/AppBundle/Entity/SubjectDomain.php new file mode 100755 index 00000000..5d04dd22 --- /dev/null +++ b/src/AppBundle/Entity/SubjectDomain.php @@ -0,0 +1,170 @@ +datasets = new \Doctrine\Common\Collections\ArrayCollection(); + } + + /** + * Get name for display + * + * @return string + */ + public function getDisplayName() { + return $this->subject_domain; + } + + + /** + * Get id + * + * @return integer + */ + public function getId() + { + return $this->id; + } + + /** + * Set subject_domain + * + * @param string $subjectDomain + * @return SubjectDomain + */ + public function setSubjectDomain($subjectDomain) + { + $this->subject_domain = $subjectDomain; + + return $this; + } + + /** + * Get subject_domain + * + * @return string + */ + public function getSubjectDomain() + { + return $this->subject_domain; + } + + /** + * Set mesh_code + * + * @param string $meshCode + * @return SubjectDomain + */ + public function setMeshCode($meshCode) + { + $this->mesh_code = $meshCode; + + return $this; + } + + /** + * Get mesh_code + * + * @return string + */ + public function getMeshCode() + { + return $this->mesh_code; + } + + + /** + * Set slug + * + * @param string $slug + * @return SubjectDomain + */ + public function setSlug($slug) + { + $this->slug = $slug; + + return $this; + } + + /** + * Get slug + * + * @return string + */ + public function getSlug() + { + return $this->slug; + } + + /** + * Add datasets + * + * @param \AppBundle\Entity\Dataset $datasets + * @return SubjectDomain + */ + public function addDataset(\AppBundle\Entity\Dataset $datasets) + { + $this->datasets[] = $datasets; + + return $this; + } + + /** + * Remove datasets + * + * @param \AppBundle\Entity\Dataset $datasets + */ + public function removeDataset(\AppBundle\Entity\Dataset $datasets) + { + $this->datasets->removeElement($datasets); + } + + /** + * Get datasets + * + * @return \Doctrine\Common\Collections\Collection + */ + public function getDatasets() + { + return $this->datasets; + } +} diff --git a/src/AppBundle/Entity/SubjectGender.php b/src/AppBundle/Entity/SubjectGender.php new file mode 100755 index 00000000..833878c1 --- /dev/null +++ b/src/AppBundle/Entity/SubjectGender.php @@ -0,0 +1,138 @@ +datasets = new \Doctrine\Common\Collections\ArrayCollection(); + } + + /** + * Get name for display + * + * @return string + */ + public function getDisplayName() { + return $this->subject_gender; + } + + + /** + * Get id + * + * @return integer + */ + public function getId() + { + return $this->id; + } + + /** + * Set subject_gender + * + * @param string $subjectGender + * @return SubjectGender + */ + public function setSubjectGender($subjectGender) + { + $this->subject_gender = $subjectGender; + + return $this; + } + + /** + * Get subject_gender + * + * @return string + */ + public function getSubjectGender() + { + return $this->subject_gender; + } + + /** + * Set slug + * + * @param string $slug + * @return SubjectGender + */ + public function setSlug($slug) + { + $this->slug = $slug; + + return $this; + } + + /** + * Get slug + * + * @return string + */ + public function getSlug() + { + return $this->slug; + } + + /** + * Add datasets + * + * @param \AppBundle\Entity\Dataset $datasets + * @return SubjectGender + */ + public function addDataset(\AppBundle\Entity\Dataset $datasets) + { + $this->datasets[] = $datasets; + + return $this; + } + + /** + * Remove datasets + * + * @param \AppBundle\Entity\Dataset $datasets + */ + public function removeDataset(\AppBundle\Entity\Dataset $datasets) + { + $this->datasets->removeElement($datasets); + } + + /** + * Get datasets + * + * @return \Doctrine\Common\Collections\Collection + */ + public function getDatasets() + { + return $this->datasets; + } +} diff --git a/src/AppBundle/Entity/SubjectGeographicArea.php b/src/AppBundle/Entity/SubjectGeographicArea.php new file mode 100755 index 00000000..d850c805 --- /dev/null +++ b/src/AppBundle/Entity/SubjectGeographicArea.php @@ -0,0 +1,171 @@ +datasets = new \Doctrine\Common\Collections\ArrayCollection(); + } + + /** + * Get name for display + * + * @return string + */ + public function getDisplayName() { + return $this->geographic_area_name; + } + + + /** + * Get id + * + * @return integer + */ + public function getId() + { + return $this->id; + } + + /** + * Set geographic_area_name + * + * @param string $geographicAreaName + * @return SubjectGeographicArea + */ + public function setGeographicAreaName($geographicAreaName) + { + $this->geographic_area_name = $geographicAreaName; + + return $this; + } + + /** + * Get geographic_area_name + * + * @return string + */ + public function getGeographicAreaName() + { + return $this->geographic_area_name; + } + + /** + * Set geographic_area_authority + * + * @param string $geographicAreaAuthority + * @return SubjectGeographicArea + */ + public function setGeographicAreaAuthority($geographicAreaAuthority) + { + $this->geographic_area_authority = $geographicAreaAuthority; + + return $this; + } + + /** + * Get geographic_area_authority + * + * @return string + */ + public function getGeographicAreaAuthority() + { + return $this->geographic_area_authority; + } + + /** + * Set slug + * + * @param string $slug + * @return SubjectGeographicArea + */ + public function setSlug($slug) + { + $this->slug = $slug; + + return $this; + } + + /** + * Get slug + * + * @return string + */ + public function getSlug() + { + return $this->slug; + } + + /** + * Add datasets + * + * @param \AppBundle\Entity\Dataset $datasets + * @return SubjectGeographicArea + */ + public function addDataset(\AppBundle\Entity\Dataset $datasets) + { + $this->datasets[] = $datasets; + + return $this; + } + + /** + * Remove datasets + * + * @param \AppBundle\Entity\Dataset $datasets + */ + public function removeDataset(\AppBundle\Entity\Dataset $datasets) + { + $this->datasets->removeElement($datasets); + } + + /** + * Get datasets + * + * @return \Doctrine\Common\Collections\Collection + */ + public function getDatasets() + { + return $this->datasets; + } +} diff --git a/src/AppBundle/Entity/SubjectGeographicAreaDetail.php b/src/AppBundle/Entity/SubjectGeographicAreaDetail.php new file mode 100755 index 00000000..adf59da1 --- /dev/null +++ b/src/AppBundle/Entity/SubjectGeographicAreaDetail.php @@ -0,0 +1,171 @@ +datasets = new \Doctrine\Common\Collections\ArrayCollection(); + } + + /** + * Get name for display + * + * @return string + */ + public function getDisplayName() { + return $this->geographic_area_detail_name; + } + + + /** + * Get id + * + * @return integer + */ + public function getId() + { + return $this->id; + } + + /** + * Set geographic_area_detail_name + * + * @param string $geographicAreaDetailName + * @return SubjectGeographicAreaDetail + */ + public function setGeographicAreaDetailName($geographicAreaDetailName) + { + $this->geographic_area_detail_name = $geographicAreaDetailName; + + return $this; + } + + /** + * Get geographic_area_detail_name + * + * @return string + */ + public function getGeographicAreaDetailName() + { + return $this->geographic_area_detail_name; + } + + /** + * Set geographic_area_detail_authority + * + * @param string $geographicAreaDetailAuthority + * @return SubjectGeographicAreaDetail + */ + public function setGeographicAreaDetailAuthority($geographicAreaDetailAuthority) + { + $this->geographic_area_detail_authority = $geographicAreaDetailAuthority; + + return $this; + } + + /** + * Get geographic_area_detail_authority + * + * @return string + */ + public function getGeographicAreaDetailAuthority() + { + return $this->geographic_area_detail_authority; + } + + /** + * Set slug + * + * @param string $slug + * @return SubjectGeographicAreaDetail + */ + public function setSlug($slug) + { + $this->slug = $slug; + + return $this; + } + + /** + * Get slug + * + * @return string + */ + public function getSlug() + { + return $this->slug; + } + + /** + * Add datasets + * + * @param \AppBundle\Entity\Dataset $datasets + * @return SubjectGeographicAreaDetail + */ + public function addDataset(\AppBundle\Entity\Dataset $datasets) + { + $this->datasets[] = $datasets; + + return $this; + } + + /** + * Remove datasets + * + * @param \AppBundle\Entity\Dataset $datasets + */ + public function removeDataset(\AppBundle\Entity\Dataset $datasets) + { + $this->datasets->removeElement($datasets); + } + + /** + * Get datasets + * + * @return \Doctrine\Common\Collections\Collection + */ + public function getDatasets() + { + return $this->datasets; + } +} diff --git a/src/AppBundle/Entity/SubjectKeyword.php b/src/AppBundle/Entity/SubjectKeyword.php new file mode 100755 index 00000000..2e04e2dc --- /dev/null +++ b/src/AppBundle/Entity/SubjectKeyword.php @@ -0,0 +1,142 @@ +keyword; + } + + + /** + * Get id + * + * @return integer + */ + public function getId() + { + return $this->id; + } + + /** + * Set keyword + * + * @param string $keyword + * @return SubjectKeyword + */ + public function setKeyword($keyword) + { + $this->keyword = $keyword; + + return $this; + } + + /** + * Get keyword + * + * @return string + */ + public function getKeyword() + { + return $this->keyword; + } + + /** + * Set slug + * + * @param string $slug + * @return SubjectKeyword + */ + public function setSlug($slug) + { + $this->slug = $slug; + + return $this; + } + + /** + * Get slug + * + * @return string + */ + public function getSlug() + { + return $this->slug; + } + + public function __construct() { + $this->datasets = new \Doctrine\Common\Collections\ArrayCollection(); + } + + /** + * Add datasets + * + * @param \AppBundle\Entity\Dataset $datasets + * @return SubjectKeyword + */ + public function addDataset(\AppBundle\Entity\Dataset $datasets) + { + $this->datasets[] = $datasets; + + return $this; + } + + /** + * Remove datasets + * + * @param \AppBundle\Entity\Dataset $datasets + */ + public function removeDataset(\AppBundle\Entity\Dataset $datasets) + { + $this->datasets->removeElement($datasets); + } + + /** + * Get datasets + * + * @return \Doctrine\Common\Collections\Collection + */ + public function getDatasets() + { + return $this->datasets; + } +} diff --git a/src/AppBundle/Entity/SubjectOfStudy.php b/src/AppBundle/Entity/SubjectOfStudy.php new file mode 100755 index 00000000..cfca3dd9 --- /dev/null +++ b/src/AppBundle/Entity/SubjectOfStudy.php @@ -0,0 +1,142 @@ +subject_of_study; + } + + + /** + * Get id + * + * @return integer + */ + public function getId() + { + return $this->id; + } + + /** + * Set subject_of_study + * + * @param string $subject_of_study + * @return SubjectOfStudy + */ + public function setSubjectOfStudy($subject_of_study) + { + $this->subject_of_study = $subject_of_study; + + return $this; + } + + /** + * Get subject_of_study + * + * @return string + */ + public function getSubjectOfStudy() + { + return $this->subject_of_study; + } + + /** + * Set slug + * + * @param string $slug + * @return SubjectOfStudy + */ + public function setSlug($slug) + { + $this->slug = $slug; + + return $this; + } + + /** + * Get slug + * + * @return string + */ + public function getSlug() + { + return $this->slug; + } + + public function __construct() { + $this->datasets = new \Doctrine\Common\Collections\ArrayCollection(); + } + + /** + * Add datasets + * + * @param \AppBundle\Entity\Dataset $datasets + * @return SubjectOfStudy + */ + public function addDataset(\AppBundle\Entity\Dataset $datasets) + { + $this->datasets[] = $datasets; + + return $this; + } + + /** + * Remove datasets + * + * @param \AppBundle\Entity\Dataset $datasets + */ + public function removeDataset(\AppBundle\Entity\Dataset $datasets) + { + $this->datasets->removeElement($datasets); + } + + /** + * Get datasets + * + * @return \Doctrine\Common\Collections\Collection + */ + public function getDatasets() + { + return $this->datasets; + } +} diff --git a/src/AppBundle/Entity/SubjectPopulationAge.php b/src/AppBundle/Entity/SubjectPopulationAge.php new file mode 100755 index 00000000..69d0a911 --- /dev/null +++ b/src/AppBundle/Entity/SubjectPopulationAge.php @@ -0,0 +1,141 @@ +datasets = new \Doctrine\Common\Collections\ArrayCollection(); + } + + /** + * Get name for display + * + * @return string + */ + public function getDisplayName() { + return $this->age_group; + } + + + /** + * Get id + * + * @return integer + */ + public function getId() + { + return $this->id; + } + + /** + * Set age_group + * + * @param string $ageGroup + * @return SubjectPopulationAge + */ + public function setAgeGroup($ageGroup) + { + $this->age_group = $ageGroup; + + return $this; + } + + /** + * Get age_group + * + * @return string + */ + public function getAgeGroup() + { + return $this->age_group; + } + + /** + * Set slug + * + * @param string $slug + * @return SubjectPopulationAge + */ + public function setSlug($slug) + { + $this->slug = $slug; + + return $this; + } + + /** + * Get slug + * + * @return string + */ + public function getSlug() + { + return $this->slug; + } + + /** + * Add datasets + * + * @param \AppBundle\Entity\Dataset $datasets + * @return SubjectPopulationAge + */ + public function addDataset(\AppBundle\Entity\Dataset $datasets) + { + $this->datasets[] = $datasets; + + return $this; + } + + /** + * Remove datasets + * + * @param \AppBundle\Entity\Dataset $datasets + */ + public function removeDataset(\AppBundle\Entity\Dataset $datasets) + { + $this->datasets->removeElement($datasets); + } + + /** + * Get datasets + * + * @return \Doctrine\Common\Collections\Collection + */ + public function getDatasets() + { + return $this->datasets; + } +} diff --git a/src/AppBundle/Form/DataTransformer/AccessRestrictionToStringTransformer.php b/src/AppBundle/Form/DataTransformer/AccessRestrictionToStringTransformer.php new file mode 100755 index 00000000..f07a32b0 --- /dev/null +++ b/src/AppBundle/Form/DataTransformer/AccessRestrictionToStringTransformer.php @@ -0,0 +1,73 @@ +om = $om; + } + + + /** + * Transforms an AccessRestriction object to a string (the restriction) + * + * @param AccessRestriction|null $accessRestriction + * @return string + */ + public function transform($accessRestriction) { + if (null === $accessRestriction) { + return ""; + } + $options = array(); + foreach ($accessRestriction as $restriction) { + $options[] = $restriction->getRestriction(); + } + $opts = implode(",", $options); + return $opts; + } + + + /** + * Transforms a string (the restriction) to an object (AccessRestriction) + * + * @param string $restriction + * @return AccessRestriction|null + * @throws TransformationFailedException if object (restriction) is not found + */ + public function reverseTransform($restriction) { + if (!$restriction) { + return null; + } + + $issue = $this->om + ->getRepository('AppBundle:AccessRestriction') + ->findOneBy(array('restriction'=>$restriction)); + + if (null === $restriction) { + throw new TransformationFailedException(sprintf( + 'The restriction "%s" does not exist', + $restriction + )); + } + + return $restriction; + } + +} diff --git a/src/AppBundle/Form/Type/AccessRestrictionSelectorType.php b/src/AppBundle/Form/Type/AccessRestrictionSelectorType.php new file mode 100755 index 00000000..fd0f3220 --- /dev/null +++ b/src/AppBundle/Form/Type/AccessRestrictionSelectorType.php @@ -0,0 +1,59 @@ +om = $om; + } + + /** + * Build form + * + * @param FormBuilderInterface + * @param array $options + */ + public function buildForm(FormBuilderInterface $builder, array $options) + { + $transformer = new AccessRestrictionToStringTransformer($this->om); + $builder->addModelTransformer($transformer); + } + + /** + * @param OptionsResolverInterface + */ + public function setDefaultOptions(OptionsResolverInterface $resolver) + { + $resolver->setDefaults(array( + 'invalid_message' => 'The selected access restriction does not exist', + )); + } + + public function getParent() + { + return 'text'; + } + + public function getName() + { + return 'access_restriction_selector'; + } +} diff --git a/src/AppBundle/Form/Type/AccessRestrictionType.php b/src/AppBundle/Form/Type/AccessRestrictionType.php new file mode 100755 index 00000000..969e01c4 --- /dev/null +++ b/src/AppBundle/Form/Type/AccessRestrictionType.php @@ -0,0 +1,40 @@ +add('restriction'); + $builder->add('save','submit',array('label'=>'Submit')); + } + + /** + * Set default options + * + * @param OptionsResolverInterface + */ + public function setDefaultOptions(OptionsResolverInterface $resolver) { + $resolver + ->setDefaults(array('data_class' => 'AppBundle\Entity\AccessRestriction')); + } + + public function getName() { + return 'accessRestriction'; + } + +} + diff --git a/src/AppBundle/Form/Type/AuthorType.php b/src/AppBundle/Form/Type/AuthorType.php new file mode 100755 index 00000000..a754dd3a --- /dev/null +++ b/src/AppBundle/Form/Type/AuthorType.php @@ -0,0 +1,46 @@ +add('full_name'); + $builder->add('kid'); + $builder->add('orcid_id', 'text', array( + 'required' => false, + 'label' => 'ORCID ID', + )); + $builder->add('bio_url'); + $builder->add('save','submit',array('label'=>'Submit')); + } + + /** + * Set default options + * + * @param OptionsResolverInterface + */ + public function setDefaultOptions(OptionsResolverInterface $resolver) { + $resolver->setDefaults(array( + 'data_class' => 'AppBundle\Entity\Person' + )); + } + + public function getName() { + return 'author'; + } + +} + diff --git a/src/AppBundle/Form/Type/AwardType.php b/src/AppBundle/Form/Type/AwardType.php new file mode 100755 index 00000000..9a2b5739 --- /dev/null +++ b/src/AppBundle/Form/Type/AwardType.php @@ -0,0 +1,41 @@ +add('award','text',array( + 'label'=>'Grant Number', + )); + $builder->add('award_funder','text',array( + 'label'=>'Funding Agency', + )); + $builder->add('funder_type','choice',array( + 'label'=>'Funder Type', + 'choices'=>array('Federal, NIH' => 'Federal, NIH', + 'Federal, non-NIH'=> 'Federal, non-NIH', + 'Non-federal' => 'Non-federal'), + )); + $builder->add('award_url', 'text',array( + 'required'=>false, + 'label'=>'NIH Reporter URL', + )); + $builder->add('save','submit',array('label'=>'Submit')); + } + + public function setDefaultOptions(OptionsResolverInterface $resolver) { + $resolver->setDefaults(array( + 'data_class' => 'AppBundle\Entity\Award' + )); + } + + public function getName() { + return 'award'; + } + +} + diff --git a/src/AppBundle/Form/Type/ContactFormEmailType.php b/src/AppBundle/Form/Type/ContactFormEmailType.php new file mode 100755 index 00000000..1a2bd2fd --- /dev/null +++ b/src/AppBundle/Form/Type/ContactFormEmailType.php @@ -0,0 +1,76 @@ +add('employee_id', 'text', array( + 'label'=> 'Employee ID', + 'label_attr'=>array('class'=>'no-asterisk'), + )); + $builder->add('full_name', 'text', array( + 'label_attr'=>array('class'=>'no-asterisk'))); + $builder->add('email_address', 'email', array( + 'label_attr'=>array('class'=>'no-asterisk'))); + $builder->add('affiliation', 'choice', array( + 'label'=>'Institutional Affiliation', + 'label_attr'=>array('class'=>'no-asterisk'), + 'choices' => array( + 'Set these options' => 'Set these options', + 'in the file' => 'in the file', + 'src/AppBundle/Form/Type/ContactFormEmailType' => 'src/AppBundle/Form/Type/ContactFormEmailType', + ))); + + $builder->add('reason', 'choice', array( + 'expanded'=>true, + 'label_attr'=>array('class'=>'no-asterisk'), + 'choices' =>array( + 'Volunteer as a local expert' => 'Volunteer as a local expert', + 'Suggest a new dataset' => 'Suggest a new dataset', + 'Request uploading of dataset' => 'Request uploading of your dataset(s)', + 'General inquiry' => 'General inquiry or comments', + ), + 'multiple'=>false) + ); + $builder->add('message_body', 'textarea', array( + 'attr' => array('rows'=>'5'), + 'label_attr'=>array('class'=>'no-asterisk'), + 'label'=>'Please provide some details about your question/comment', + )); + $builder->add('checker', 'text', array( + 'required'=>false, + 'attr'=>array('class'=>'checker'), + 'label_attr'=>array('class'=>'no-asterisk checker'))); + $builder->add('save','submit',array('label'=>'Send')); + } + + /** + * Set defaults + * + * @param OptionsResolverInterface + */ + public function setDefaultOptions(OptionsResolverInterface $resolver) { + $resolver->setDefaults(array( + 'data_class' => 'AppBundle\Entity\ContactFormEmail' + )); + } + + public function getName() { + return 'contactFormEmail'; + } + +} + diff --git a/src/AppBundle/Form/Type/CorrespondingAuthorType.php b/src/AppBundle/Form/Type/CorrespondingAuthorType.php new file mode 100755 index 00000000..25bd0f69 --- /dev/null +++ b/src/AppBundle/Form/Type/CorrespondingAuthorType.php @@ -0,0 +1,32 @@ +add('full_name'); + $builder->add('kid'); + $builder->add('orcid_id', 'text', array( + 'required' => false, + 'label' => 'ORCID ID', + )); + $builder->add('bio_url'); + $builder->add('save','submit',array('label'=>'Submit')); + } + + public function setDefaultOptions(OptionsResolverInterface $resolver) { + $resolver->setDefaults(array( + 'data_class' => 'AppBundle\Entity\Person' + )); + } + + public function getName() { + return 'correspondingAuthor'; + } + +} + diff --git a/src/AppBundle/Form/Type/DataLocationType.php b/src/AppBundle/Form/Type/DataLocationType.php new file mode 100755 index 00000000..5097feb5 --- /dev/null +++ b/src/AppBundle/Form/Type/DataLocationType.php @@ -0,0 +1,53 @@ +add('data_location','text',array( + 'label'=>false, + 'required'=>false, + 'attr'=>array('placeholder'=>'Data Location')) + ); + $builder->add('location_content','text',array( + 'label'=>false, + 'required'=>false, + 'attr'=>array('placeholder'=>'Location Content')) + ); + $builder->add('data_access_url','text',array( + 'label'=>false, + 'required'=>false, + 'attr'=>array('placeholder'=>'Location URL')) + ); + } + + /** + * Set defaults + * + * @param OptionsResolverInterface + */ + public function setDefaultOptions(OptionsResolverInterface $resolver) { + $resolver->setDefaults(array( + 'data_class' => 'AppBundle\Entity\DataLocation' + )); + } + + public function getName() { + return 'dataLocation'; + } + +} + diff --git a/src/AppBundle/Form/Type/DataLocationURLType.php b/src/AppBundle/Form/Type/DataLocationURLType.php new file mode 100755 index 00000000..dbe1911b --- /dev/null +++ b/src/AppBundle/Form/Type/DataLocationURLType.php @@ -0,0 +1,42 @@ +add('data_access_url','text',array( + 'label'=>false, + 'attr'=>array('placeholder'=>'Data Location URL')) + ); + } + + /** + * Set defaults + * + * @param OptionsResolverInterface + */ + public function setDefaultOptions(OptionsResolverInterface $resolver) { + $resolver->setDefaults(array( + 'data_class' => 'AppBundle\Entity\DataLocationURL' + )); + } + + public function getName() { + return 'dataLocationURL'; + } + +} + diff --git a/src/AppBundle/Form/Type/DataTypeType.php b/src/AppBundle/Form/Type/DataTypeType.php new file mode 100755 index 00000000..b50f38b2 --- /dev/null +++ b/src/AppBundle/Form/Type/DataTypeType.php @@ -0,0 +1,41 @@ +add('data_type'); + $builder->add('authority'); + $builder->add('save','submit',array('label'=>'Submit')); + } + + /** + * Set defaults + * + * @param OptionsResolverInterface + */ + public function setDefaultOptions(OptionsResolverInterface $resolver) { + $resolver->setDefaults(array( + 'data_class' => 'AppBundle\Entity\DataType' + )); + } + + public function getName() { + return 'dataType'; + } + +} + diff --git a/src/AppBundle/Form/Type/DatasetAlternateTitleType.php b/src/AppBundle/Form/Type/DatasetAlternateTitleType.php new file mode 100755 index 00000000..bc5360b3 --- /dev/null +++ b/src/AppBundle/Form/Type/DatasetAlternateTitleType.php @@ -0,0 +1,42 @@ +add('alt_title','text',array( + 'label'=>false, + 'attr'=>array('placeholder'=>'Alternate Title')) + ); + } + + /** + * Set defaults + * + * @param OptionsResolverInterface + */ + public function setDefaultOptions(OptionsResolverInterface $resolver) { + $resolver->setDefaults(array( + 'data_class' => 'AppBundle\Entity\DatasetAlternateTitle' + )); + } + + public function getName() { + return 'datasetAlternateTitle'; + } + +} + diff --git a/src/AppBundle/Form/Type/DatasetAsAdminType.php b/src/AppBundle/Form/Type/DatasetAsAdminType.php new file mode 100755 index 00000000..820b735d --- /dev/null +++ b/src/AppBundle/Form/Type/DatasetAsAdminType.php @@ -0,0 +1,389 @@ +add('dataset_uid', 'text', array( + 'disabled' => true, + 'data' => $this->datasetUid, + 'label' => 'Dataset ID', + )); + $builder->add('title', 'text', array( + 'required' => true, + 'label' => 'Dataset Title')); + $builder->add('dataset_alternate_titles', 'collection', array( + 'type' => new DatasetAlternateTitleType(), + 'required' => false, + 'label' => 'Alternate Titles', + 'by_reference'=>false, + 'prototype' => true, + 'allow_delete' => true, + 'allow_add' => true + )); + $builder->add('origin','choice',array( + 'required'=> true, + 'label' => 'Origin', + 'choices' => array('Internal'=>'Internal', + 'External'=>'External'), + 'expanded'=>true, + )); + $builder->add('description', 'textarea', array( + 'required' => true, + 'attr'=>array('rows'=>'7','placeholder'=>'Please provide a brief description of the dataset'), + 'label' => 'Description')); + $builder->add('published', 'choice', array( + 'required' => true, + 'expanded' => true, + 'label' => 'Published to Data Catalog?', + 'choice_list'=> new ChoiceList(array(true,false), array('Yes','Not yet')), + )); + + + + $builder->add('publishers', 'entity', array( + 'class' => 'AppBundle:Publisher', + 'property'=> 'publisher_name', + 'required' => false, + 'query_builder'=> function(EntityRepository $er) { + return $er->createQueryBuilder('u')->orderBy('u.publisher_name','ASC'); + }, + 'attr'=>array('style'=>'width:100%'), + 'multiple' => true, + 'by_reference'=>false, + 'label' => 'Publishers', + )); + $builder->add('access_restrictions', 'entity', array( + 'class' => 'AppBundle:AccessRestriction', + 'property' => 'restriction', + 'attr'=>array('style'=>'width:100%'), + 'query_builder'=> function(EntityRepository $er) { + return $er->createQueryBuilder('u')->orderBy('u.restriction','ASC'); + }, + 'required' => false, + 'by_reference'=>false, + 'multiple' => true, + 'label' => 'Access Restrictions', + )); + $builder->add('access_instructions', 'textarea', array( + 'attr'=>array('rows'=>'7', 'placeholder'=>'Provide any information on restrictions or conditions for gaining access to data'), + 'label' => 'Access Instructions')); + //accession information + $builder->add('data_locations', 'collection', array( + 'type' => new DataLocationType(), + 'required' => false, + 'by_reference'=>false, + 'label' => 'Data Location', + 'prototype' => true, + 'allow_delete' => true, + 'allow_add' => true + )); + $builder->add('pubmed_search', 'text', array( + 'required' => false, + 'label' => 'PubMed Search URL')); + $builder->add('date_archived', 'date', array( + 'years' => $this->years, + 'required' => false, + 'label' => 'Date Archived')); + $builder->add('other_resources', 'collection', array( + 'type' => new OtherResourceType(), + 'required' => false, + 'by_reference'=>false, + 'label' => 'Other Resources', + 'prototype' => true, + 'allow_delete' => true, + 'allow_add' => true + )); + $builder->add('accession_number', 'text', array( + 'required' => false, + 'label' => 'Repository Accession Number')); + //technical details + $builder->add('related_equipment', 'entity', array( + 'class' => 'AppBundle:RelatedEquipment', + 'property'=> 'related_equipment', + 'query_builder'=> function(EntityRepository $er) { + return $er->createQueryBuilder('u')->orderBy('u.related_equipment','ASC'); + }, + 'required' => false, + 'attr' => array('style'=>'width:100%'), + 'multiple' => true, + 'by_reference'=>false, + 'label' => 'Equipment used to collect/create the dataset', + )); + $builder->add('related_software', 'entity', array( + 'class' => 'AppBundle:RelatedSoftware', + 'property'=> 'related_software', + 'query_builder'=> function(EntityRepository $er) { + return $er->createQueryBuilder('u')->orderBy('u.related_software','ASC'); + }, + 'required' => false, + 'attr' => array('style'=>'width:100%'), + 'multiple' => true, + 'by_reference'=>false, + 'label' => 'Software used to create, collect or analyze the dataset', + )); + $builder->add('dataset_formats', 'entity', array( + 'class' => 'AppBundle:DatasetFormat', + 'property'=> 'format', + 'query_builder'=> function(EntityRepository $er) { + return $er->createQueryBuilder('u')->orderBy('u.format','ASC'); + }, + 'required' => false, + 'attr' => array('id'=>'dataset_subject_population_ages','style'=>'width:100%'), + 'multiple' => true, + 'by_reference'=>false, + 'label' => 'Dataset File Format', + )); + $builder->add('dataset_size', 'text', array( + 'required' => false, + 'label' => 'Dataset Size')); + $builder->add('measurement_standards', 'entity', array( + 'class' => 'AppBundle:MeasurementStandard', + 'property'=> 'measurement_standard_name', + 'required' => false, + 'attr'=>array('style'=>'width:100%', 'placeholder'=>''), + 'multiple' => true, + 'by_reference'=>false, + 'label' => 'Data Collection Standards (e.g. CDISC, DICOM, MINI, CDE)', + )); + $builder->add('data_types', 'entity', array( + 'class' => 'AppBundle:DataType', + 'property' => 'data_type', + 'required' => false, + 'query_builder'=> function(EntityRepository $er) { + return $er->createQueryBuilder('u')->orderBy('u.data_type','ASC'); + }, + 'attr'=>array('style'=>'width:100%'), + 'multiple' => true, + 'by_reference'=>false, + 'label' => 'Data Types', + )); + //people and relations + $builder->add('publications', 'entity', array( + 'class' => 'AppBundle:Publication', + 'property'=>'citation', + 'required' => false, + 'attr'=>array('style'=>'width:100%'), + 'multiple' => true, + 'by_reference'=>false, + 'label' => 'Publications describing the collection or use of the dataset', + )); + $builder->add('awards', 'entity', array( + 'class' => 'AppBundle:Award', + 'property'=> 'award', + 'required' => false, + 'attr' => array('id'=>'dataset_awards','style'=>'width:100%'), + 'multiple' => true, + 'by_reference'=>false, + 'label' => 'Grants', + )); + $builder->add('related_datasets', 'collection', array( + 'type' => new DatasetRelationshipType(), + 'required' => false, + 'by_reference'=>false, + 'prototype' => true, + 'label' => 'Related Datasets', + 'allow_delete' => true, + 'allow_add' => true + )); + //content information + $builder->add('authors', 'entity', array( + 'class' => 'AppBundle:Person', + 'property'=>'full_name', + 'required'=>false, + 'attr'=>array('style'=>'width:100%'), + 'multiple'=>true, + 'by_reference'=>false, + 'label'=>'Authors', + )); + $builder->add('corresponding_authors', 'entity', array( + 'class' => 'AppBundle:Person', + 'property'=>'full_name', + 'required'=>false, + 'attr'=>array('style'=>'width:100%'), + 'multiple'=>true, + 'by_reference'=>false, + 'label'=>'Corresponding Authors', + )); + $builder->add('local_experts', 'entity', array( + 'class' => 'AppBundle:Person', + 'property'=>'full_name', + 'required'=>false, + 'attr'=>array('style'=>'width:100%'), + 'multiple'=>true, + 'by_reference'=>false, + 'label'=>'Local Experts', + )); + $builder->add('subject_domains', 'entity', array( + 'class' => 'AppBundle:SubjectDomain', + 'property'=>'subject_domain', + 'required' => false, + 'query_builder'=> function(EntityRepository $er) { + return $er->createQueryBuilder('u')->orderBy('u.subject_domain','ASC'); + }, + 'attr'=>array('style'=>'width:100%'), + 'multiple' => true, + 'by_reference'=>false, + 'label' => 'Subject Domains', + )); + $builder->add('subject_start_date', 'choice', array( + 'choices' => $this->yearsIncludingPresent, + 'required' => false, + 'label' => 'Year Data Collection Started')); + $builder->add('subject_end_date', 'choice', array( + 'choices' => $this->yearsIncludingPresent, + 'required' => false, + 'label' => 'Year Data Collection Ended')); + $builder->add('subject_genders', 'entity', array( + 'class' => 'AppBundle:SubjectGender', + 'property' => 'subject_gender', + 'multiple' => true, + 'expanded' => true, + 'required' => false, + 'by_reference'=>false, + 'label' => 'Subject Genders', + )); + $builder->add('subject_population_ages', 'entity', array( + 'class' => 'AppBundle:SubjectPopulationAge', + 'property'=> 'age_group', + 'required' => false, + 'query_builder'=> function(EntityRepository $er) { + return $er->createQueryBuilder('u')->orderBy('u.age_group','ASC'); + }, + 'attr'=>array('style'=>'width:100%'), + 'multiple' => true, + 'by_reference'=>false, + 'label' => 'Subject Population Age', + )); + $builder->add('subject_geographic_areas', 'entity', array( + 'class' => 'AppBundle:SubjectGeographicArea', + 'attr'=>array('style'=>'width:100%'), + 'property'=> 'geographic_area_name', + 'query_builder'=> function(EntityRepository $er) { + return $er->createQueryBuilder('u')->orderBy('u.geographic_area_name','ASC'); + }, + 'required' => false, + 'multiple'=> true, + 'by_reference'=>false, + 'label' => 'Subject Geographic Areas', + )); + $builder->add('subject_geographic_area_details', 'entity', array( + 'class' => 'AppBundle:SubjectGeographicAreaDetail', + 'attr'=>array('style'=>'width:100%'), + 'query_builder'=> function(EntityRepository $er) { + return $er->createQueryBuilder('u')->orderBy('u.geographic_area_detail_name','ASC'); + }, + 'property'=> 'geographic_area_detail_name', + 'required' => false, + 'multiple'=> true, + 'by_reference'=>false, + 'label' => 'Subject Geographic Area Details', + )); + $builder->add('study_types', 'entity', array( + 'class' => 'AppBundle:StudyType', + 'property' => 'study_type', + 'required' => false, + 'query_builder'=> function(EntityRepository $er) { + return $er->createQueryBuilder('u')->orderBy('u.study_type','ASC'); + }, + 'expanded' => true, + 'multiple' => true, + 'attr'=>array('style'=>'width:100%'), + 'by_reference'=>false, + 'label' => 'Study Type', + )); + $builder->add('subject_of_study', 'entity', array( + 'class' => 'AppBundle:SubjectOfStudy', + 'property' => 'subject_of_study', + 'required' => false, + 'query_builder'=> function(EntityRepository $er) { + return $er->createQueryBuilder('u')->orderBy('u.subject_of_study','ASC'); + }, + 'multiple' => true, + 'attr'=>array('style'=>'width:100%'), + 'by_reference'=>false, + 'label' => 'Subject of Study', + )); + $builder->add('subject_keywords', 'entity', array( + 'class' => 'AppBundle:SubjectKeyword', + 'property'=> 'keyword', + 'required' => false, + 'query_builder'=> function(EntityRepository $er) { + return $er->createQueryBuilder('u')->orderBy('u.keyword','ASC'); + }, + 'multiple' => true, + 'attr'=>array('style'=>'width:100%'), + 'by_reference'=>false, + 'label' => 'Subject Keywords', + )); + + $builder->add('erd_url', 'text', array( + 'required' => false, + 'label' => 'ERD URL')); + $builder->add('library_catalog_url', 'text', array( + 'required' => false, + 'label' => 'Library Catalog URL')); + $builder->add('licensing_details', 'textarea', array( + 'required' => false, + 'label' => 'Licensing Details')); + $builder->add('license_expiration_date', 'date', array( + 'required' => false, + 'label' => 'License Expiration Date')); + $builder->add('subscriber', 'text', array( + 'required' => false, + 'label' => 'Subscriber')); + + $builder->add('save','submit',array( + "label"=>"Submit", + 'attr'=>array('class'=>'spacer'))); + + + } + + public function getName() { + return 'dataset'; + } + + public function __construct($userIsAdmin, $datasetUid) { + $this->years = range(date('Y'),1790); + $yearList = range(date('Y'),1790); + array_unshift($yearList, "Present"); + $this->yearsIncludingPresent = array_combine($yearList, $yearList); + $this->userIsAdmin = $userIsAdmin; + $this->datasetUid = $datasetUid; + } + + /** + * Set defaults + * + * @param OptionsResolverInterface + */ + public function setDefaultOptions(OptionsResolverInterface $resolver) { + $resolver->setDefaults(array( + 'data_class' => 'AppBundle\Entity\Dataset', + )); + } + +} diff --git a/src/AppBundle/Form/Type/DatasetAsUserType.php b/src/AppBundle/Form/Type/DatasetAsUserType.php new file mode 100755 index 00000000..9eec1116 --- /dev/null +++ b/src/AppBundle/Form/Type/DatasetAsUserType.php @@ -0,0 +1,160 @@ +add('title', 'text', array( + 'required' => true, + 'label' => 'Dataset Title')); + $builder->add('description', 'textarea', array( + 'required' => true, + 'attr'=>array('rows'=>'7','placeholder'=>'Please provide a brief description of the dataset'), + 'label' => 'Description')); + + $builder->add('access_instructions', 'textarea', array( + 'attr'=>array('rows'=>'7', 'placeholder'=>'Provide any information on restrictions or conditions for gaining access to data'), + 'label' => 'Access Instructions')); + //technical details + $builder->add('related_equipment', 'entity', array( + 'class' => 'AppBundle:RelatedEquipment', + 'property'=> 'related_equipment', + 'query_builder'=> function(EntityRepository $er) { + return $er->createQueryBuilder('u')->orderBy('u.related_equipment','ASC'); + }, + 'required' => false, + 'attr' => array('style'=>'width:100%'), + 'multiple' => true, + 'by_reference'=>false, + 'label' => 'Equipment used to collect/create the dataset', + )); + $builder->add('related_software', 'entity', array( + 'class' => 'AppBundle:RelatedSoftware', + 'property'=> 'related_software', + 'query_builder'=> function(EntityRepository $er) { + return $er->createQueryBuilder('u')->orderBy('u.related_software','ASC'); + }, + 'required' => false, + 'attr' => array('style'=>'width:100%'), + 'multiple' => true, + 'by_reference'=>false, + 'label' => 'Software used to create, collect or analyze the dataset', + )); + $builder->add('dataset_formats', 'entity', array( + 'class' => 'AppBundle:DatasetFormat', + 'property'=> 'format', + 'query_builder'=> function(EntityRepository $er) { + return $er->createQueryBuilder('u')->orderBy('u.format','ASC'); + }, + 'required' => false, + 'attr' => array('id'=>'dataset_subject_population_ages','style'=>'width:100%'), + 'multiple' => true, + 'by_reference'=>false, + 'label' => 'Dataset File Format', + )); + $builder->add('measurement_standards', 'entity', array( + 'class' => 'AppBundle:MeasurementStandard', + 'property'=> 'measurement_standard_name', + 'required' => false, + 'attr'=>array('style'=>'width:100%', 'placeholder'=>''), + 'multiple' => true, + 'by_reference'=>false, + 'label' => 'Data Collection Standards (e.g. CDISC, DICOM, MINI, CDE)', + )); + //content information + $builder->add('authors', 'entity', array( + 'class' => 'AppBundle:Person', + 'property'=>'full_name', + 'required'=>false, + 'attr'=>array('style'=>'width:100%'), + 'multiple'=>true, + 'by_reference'=>false, + 'label'=>'Authors', + )); + $builder->add('subject_start_date', 'choice', array( + 'choices' => $this->yearsIncludingPresent, + 'required' => false, + 'label' => 'Year Data Collection Started')); + $builder->add('subject_end_date', 'choice', array( + 'choices' => $this->yearsIncludingPresent, + 'required' => false, + 'label' => 'Year Data Collection Ended')); + $builder->add('subject_of_study', 'entity', array( + 'class' => 'AppBundle:SubjectOfStudy', + 'property' => 'subject_of_study', + 'required' => false, + 'query_builder'=> function(EntityRepository $er) { + return $er->createQueryBuilder('u')->orderBy('u.subject_of_study','ASC'); + }, + 'multiple' => true, + 'attr'=>array('style'=>'width:100%'), + 'by_reference'=>false, + 'label' => 'Subject of Study', + )); + $builder->add('subject_keywords', 'entity', array( + 'class' => 'AppBundle:SubjectKeyword', + 'property'=> 'keyword', + 'required' => false, + 'query_builder'=> function(EntityRepository $er) { + return $er->createQueryBuilder('u')->orderBy('u.keyword','ASC'); + }, + 'multiple' => true, + 'attr'=>array('style'=>'width:100%'), + 'by_reference'=>false, + 'label' => 'Subject Keywords', + )); + + + $builder->add('save','submit',array( + "label"=>"Submit", + 'attr'=>array('class'=>'spacer'))); + + + } + + public function getName() { + return 'dataset'; + } + + public function __construct($userIsAdmin, $datasetUid) { + $this->years = range(date('Y'),1790); + $yearList = range(date('Y'),1790); + array_unshift($yearList, "Present"); + $this->yearsIncludingPresent = array_combine($yearList, $yearList); + $this->userIsAdmin = $userIsAdmin; + $this->datasetUid = $datasetUid; + } + + /** + * Set defaults + * + * @param OptionsResolverInterface + */ + public function setDefaultOptions(OptionsResolverInterface $resolver) { + $resolver->setDefaults(array( + 'data_class' => 'AppBundle\Entity\Dataset', + )); + } + +} diff --git a/src/AppBundle/Form/Type/DatasetFormatType.php b/src/AppBundle/Form/Type/DatasetFormatType.php new file mode 100755 index 00000000..aedcd0e1 --- /dev/null +++ b/src/AppBundle/Form/Type/DatasetFormatType.php @@ -0,0 +1,41 @@ +add('format', 'text', array( + 'required' => false)); + $builder->add('save','submit',array('label'=>'Submit')); + } + + /** + * Set defaults + * + * @param OptionsResolverInterface + */ + public function setDefaultOptions(OptionsResolverInterface $resolver) { + $resolver->setDefaults(array( + 'data_class' => 'AppBundle\Entity\DatasetFormat' + )); + } + + public function getName() { + return 'datasetFormat'; + } + +} + diff --git a/src/AppBundle/Form/Type/DatasetRelationshipType.php b/src/AppBundle/Form/Type/DatasetRelationshipType.php new file mode 100755 index 00000000..0ef39cc0 --- /dev/null +++ b/src/AppBundle/Form/Type/DatasetRelationshipType.php @@ -0,0 +1,59 @@ +add('related_dataset_uid','text',array( + 'label'=>false, + 'attr'=>array('placeholder'=>'Related Dataset UID')) + ); + $builder->add('relationship_attributes','choice',array( + 'label'=>false, + 'required'=>false, + 'attr'=>array('data-placeholder'=>'Relationship'), + 'choices'=>array('Superceded by'=>'Superceded by', + 'Preceded by' =>'Preceded by', + 'Derived from' =>'Derived from', + 'Transformed to' =>'Transformed to', + 'Same publisher as' =>'Same publisher as', + 'Linkage dataset between' =>'Linkage dataset between'), + ) + ); + $builder->add('relationship_notes','text',array( + 'label'=>false, + 'required'=>false, + 'attr'=>array('placeholder'=>'Relationship Notes')) + ); + } + + /** + * Set defaults + * + * @param OptionsResolverInterface + */ + public function setDefaultOptions(OptionsResolverInterface $resolver) { + $resolver->setDefaults(array( + 'data_class' => 'AppBundle\Entity\DatasetRelationship' + )); + } + + public function getName() { + return 'datasetRelationship'; + } + +} + diff --git a/src/AppBundle/Form/Type/DatasetType.php b/src/AppBundle/Form/Type/DatasetType.php new file mode 100755 index 00000000..14dd3d5c --- /dev/null +++ b/src/AppBundle/Form/Type/DatasetType.php @@ -0,0 +1,368 @@ +add('dataset_uid', 'text', array( + 'disabled' => true, + 'data' => $this->datasetUid, + 'label' => 'Dataset ID')); + $builder->add('title', 'text', array( + 'required' => true, + 'label' => 'Dataset Title')); + $builder->add('dataset_alternate_titles', 'collection', array( + 'type' => new DatasetAlternateTitleType(), + 'required' => false, + 'label' => 'Alternate Titles', + 'by_reference'=>false, + 'prototype' => true, + 'allow_delete' => true, + 'allow_add' => true + )); + if ($this->userIsAdmin) { + $builder->add('origin','choice',array( + 'required'=> true, + 'label' => 'Origin', + 'choices' => array('Internal'=>'Internal', + 'External'=>'External'), + 'expanded'=>true, + )); + } + $builder->add('description', 'textarea', array( + 'required' => true, + 'attr'=>array('rows'=>'7','placeholder'=>'Please provide a brief description of the dataset'), + 'label' => 'Description')); + if ($this->userIsAdmin) { + $builder->add('published', 'choice', array( + 'required' => true, + 'expanded' => true, + 'label' => 'Published to Data Catalog?', + 'choice_list'=> new ChoiceList(array(true,false), array('Yes','Not yet')), + )); + } + + + + if ($this->userIsAdmin) { + $builder->add('publishers', 'entity', array( + 'class' => 'AppBundle:Publisher', + 'property'=> 'publisher_name', + 'required' => false, + 'query_builder'=> function(EntityRepository $er) { + return $er->createQueryBuilder('u')->orderBy('u.publisher_name','ASC'); + }, + 'attr'=>array('style'=>'width:100%'), + 'multiple' => true, + 'by_reference'=>false, + 'label' => 'Publishers', + )); + $builder->add('access_restrictions', 'entity', array( + 'class' => 'AppBundle:AccessRestriction', + 'property' => 'restriction', + 'attr'=>array('style'=>'width:100%'), + 'query_builder'=> function(EntityRepository $er) { + return $er->createQueryBuilder('u')->orderBy('u.restriction','ASC'); + }, + 'required' => false, + 'by_reference'=>false, + 'multiple' => true, + 'label' => 'Access Restrictions', + )); + } + $builder->add('access_instructions', 'textarea', array( + 'attr'=>array('rows'=>'7', 'placeholder'=>'Provide any information on restrictions or conditions for gaining access to data'), + 'label' => 'Access Instructions')); + + //accession information + $builder->add('data_locations', 'collection', array( + 'type' => new DataLocationType(), + 'required' => false, + 'by_reference'=>false, + 'label' => 'Data Location', + 'prototype' => true, + 'allow_delete' => true, + 'allow_add' => true + )); + if ($this->userIsAdmin) { + $builder->add('pubmed_search', 'text', array( + 'required' => false, + 'label' => 'PubMed Search URL')); + } + if ($this->userIsAdmin) { + $builder->add('date_archived', 'date', array( + 'years' => $this->years, + 'required' => false, + 'label' => 'Date Archived')); + } + $builder->add('other_resources', 'collection', array( + 'type' => new OtherResourceType(), + 'required' => false, + 'by_reference'=>false, + 'label' => 'Other Resources', + 'prototype' => true, + 'allow_delete' => true, + 'allow_add' => true + )); + $builder->add('accession_number', 'text', array( + 'required' => false, + 'label' => 'Repository Accession Number')); + + //technical details + $builder->add('dataset_formats', 'entity', array( + 'class' => 'AppBundle:DatasetFormat', + 'property'=> 'format', + 'query_builder'=> function(EntityRepository $er) { + return $er->createQueryBuilder('u')->orderBy('u.format','ASC'); + }, + 'required' => false, + 'attr' => array('id'=>'dataset_subject_population_ages','style'=>'width:100%'), + 'multiple' => true, + 'by_reference'=>false, + 'label' => 'Dataset Format', + )); + $builder->add('dataset_size', 'text', array( + 'required' => false, + 'label' => 'Dataset Size')); + $builder->add('measurement_standards', 'entity', array( + 'class' => 'AppBundle:MeasurementStandard', + 'property'=> 'measurement_standard_name', + 'required' => false, + 'attr'=>array('style'=>'width:100%', 'placeholder'=>''), + 'multiple' => true, + 'by_reference'=>false, + 'label' => 'Data Collection Standards (e.g. CDISC, DICOM, MINI, CDE)', + )); + $builder->add('data_types', 'entity', array( + 'class' => 'AppBundle:DataType', + 'property' => 'data_type', + 'required' => false, + 'query_builder'=> function(EntityRepository $er) { + return $er->createQueryBuilder('u')->orderBy('u.data_type','ASC'); + }, + 'attr'=>array('style'=>'width:100%'), + 'multiple' => true, + 'by_reference'=>false, + 'label' => 'Data Types', + )); + + //people and relations + $builder->add('publications', 'entity', array( + 'class' => 'AppBundle:Publication', + 'property'=>'citation', + 'required' => false, + 'attr'=>array('style'=>'width:100%'), + 'multiple' => true, + 'by_reference'=>false, + 'label' => 'Publications describing the collection or use of the dataset', + )); + $builder->add('awards', 'entity', array( + 'class' => 'AppBundle:Award', + 'property'=> 'award', + 'required' => false, + 'attr' => array('id'=>'dataset_awards','style'=>'width:100%'), + 'multiple' => true, + 'by_reference'=>false, + 'label' => 'Grants', + )); + if ($this->userIsAdmin) { + $builder->add('related_datasets', 'collection', array( + 'type' => new DatasetRelationshipType(), + 'required' => false, + 'by_reference'=>false, + 'prototype' => true, + 'label' => 'Related Datasets', + 'allow_delete' => true, + 'allow_add' => true + )); + } + //content information + $builder->add('authors', 'entity', array( + 'class' => 'AppBundle:Person', + 'property'=>'full_name', + 'required'=>false, + 'attr'=>array('style'=>'width:100%'), + 'multiple'=>true, + 'by_reference'=>false, + 'label'=>'Authors', + )); + $builder->add('corresponding_authors', 'entity', array( + 'class' => 'AppBundle:Person', + 'property'=>'full_name', + 'required'=>false, + 'attr'=>array('style'=>'width:100%'), + 'multiple'=>true, + 'by_reference'=>false, + 'label'=>'Corresponding Authors', + )); + $builder->add('local_experts', 'entity', array( + 'class' => 'AppBundle:Person', + 'property'=>'full_name', + 'required'=>false, + 'attr'=>array('style'=>'width:100%'), + 'multiple'=>true, + 'by_reference'=>false, + 'label'=>'Local Experts', + )); + $builder->add('subject_domains', 'entity', array( + 'class' => 'AppBundle:SubjectDomain', + 'property'=>'subject_domain', + 'required' => false, + 'query_builder'=> function(EntityRepository $er) { + return $er->createQueryBuilder('u')->orderBy('u.subject_domain','ASC'); + }, + 'attr'=>array('style'=>'width:100%'), + 'multiple' => true, + 'by_reference'=>false, + 'label' => 'Subject Domains', + )); + $builder->add('subject_start_date', 'choice', array( + 'choices' => $this->yearsIncludingPresent, + 'required' => false, + 'label' => 'Year Data Collection Started')); + $builder->add('subject_end_date', 'choice', array( + 'choices' => $this->yearsIncludingPresent, + 'required' => false, + 'label' => 'Year Data Collection Ended')); + $builder->add('subject_genders', 'entity', array( + 'class' => 'AppBundle:SubjectGender', + 'property' => 'subject_gender', + 'multiple' => true, + 'expanded' => true, + 'required' => false, + 'by_reference'=>false, + 'label' => 'Subject Genders', + )); + $builder->add('subject_population_ages', 'entity', array( + 'class' => 'AppBundle:SubjectPopulationAge', + 'property'=> 'age_group', + 'required' => false, + 'query_builder'=> function(EntityRepository $er) { + return $er->createQueryBuilder('u')->orderBy('u.age_group','ASC'); + }, + 'attr'=>array('style'=>'width:100%'), + 'multiple' => true, + 'by_reference'=>false, + 'label' => 'Subject Population Age', + )); + $builder->add('subject_geographic_areas', 'entity', array( + 'class' => 'AppBundle:SubjectGeographicArea', + 'attr'=>array('style'=>'width:100%'), + 'property'=> 'geographic_area_name', + 'query_builder'=> function(EntityRepository $er) { + return $er->createQueryBuilder('u')->orderBy('u.geographic_area_name','ASC'); + }, + 'required' => false, + 'multiple'=> true, + 'by_reference'=>false, + 'label' => 'Subject Geographic Areas', + )); + $builder->add('subject_geographic_area_details', 'entity', array( + 'class' => 'AppBundle:SubjectGeographicAreaDetail', + 'attr'=>array('style'=>'width:100%'), + 'query_builder'=> function(EntityRepository $er) { + return $er->createQueryBuilder('u')->orderBy('u.geographic_area_detail_name','ASC'); + }, + 'property'=> 'geographic_area_detail_name', + 'required' => false, + 'multiple'=> true, + 'by_reference'=>false, + 'label' => 'Subject Geographic Area Details', + )); + $builder->add('study_types', 'entity', array( + 'class' => 'AppBundle:StudyType', + 'property'=> 'study_type', + 'required' => false, + 'query_builder'=> function(EntityRepository $er) { + return $er->createQueryBuilder('u')->orderBy('u.study_type','ASC'); + }, + 'multiple' => true, + 'attr'=>array('style'=>'width:100%'), + 'by_reference'=>false, + 'label' => 'Study Type', + )); + $builder->add('subject_keywords', 'entity', array( + 'class' => 'AppBundle:SubjectKeyword', + 'property'=> 'keyword', + 'required' => false, + 'query_builder'=> function(EntityRepository $er) { + return $er->createQueryBuilder('u')->orderBy('u.keyword','ASC'); + }, + 'multiple' => true, + 'attr'=>array('style'=>'width:100%'), + 'by_reference'=>false, + 'label' => 'Subject Keywords', + )); + + if ($this->userIsAdmin) { + $builder->add('erd_url', 'text', array( + 'required' => false, + 'label' => 'ERD URL')); + $builder->add('library_catalog_url', 'text', array( + 'required' => false, + 'label' => 'Library Catalog URL')); + $builder->add('licensing_details', 'textarea', array( + 'required' => false, + 'label' => 'Licensing Details')); + $builder->add('license_expiration_date', 'date', array( + 'required' => false, + 'label' => 'License Expiration Date')); + $builder->add('subscriber', 'text', array( + 'required' => false, + 'label' => 'Subscriber')); + } + + $builder->add('save','submit',array( + "label"=>"Submit", + 'attr'=>array('class'=>'spacer'))); + + + } + + public function getName() { + return 'dataset'; + } + + public function __construct($userIsAdmin, $datasetUid) { + $this->years = range(date('Y'),1790); + $yearList = range(date('Y'),1790); + array_unshift($yearList, "Present"); + $this->yearsIncludingPresent = array_combine($yearList, $yearList); + $this->userIsAdmin = $userIsAdmin; + $this->datasetUid = $datasetUid; + } + + /** + * Set defaults + * + * @param OptionsResolverInterface + */ + public function setDefaultOptions(OptionsResolverInterface $resolver) { + $resolver->setDefaults(array( + 'data_class' => 'AppBundle\Entity\Dataset', + )); + } + +} diff --git a/src/AppBundle/Form/Type/LocalExpertType.php b/src/AppBundle/Form/Type/LocalExpertType.php new file mode 100755 index 00000000..91fe865c --- /dev/null +++ b/src/AppBundle/Form/Type/LocalExpertType.php @@ -0,0 +1,46 @@ +add('full_name'); + $builder->add('kid'); + $builder->add('orcid_id', 'text', array( + 'required' => false, + 'label' => 'ORCID ID', + )); + $builder->add('bio_url'); + $builder->add('save','submit',array('label'=>'Submit')); + } + + /** + * Set defaults + * + * @param OptionsResolverInterface + */ + public function setDefaultOptions(OptionsResolverInterface $resolver) { + $resolver->setDefaults(array( + 'data_class' => 'AppBundle\Entity\Person' + )); + } + + public function getName() { + return 'localExpert'; + } + +} + diff --git a/src/AppBundle/Form/Type/MeasurementStandardType.php b/src/AppBundle/Form/Type/MeasurementStandardType.php new file mode 100755 index 00000000..aa257069 --- /dev/null +++ b/src/AppBundle/Form/Type/MeasurementStandardType.php @@ -0,0 +1,41 @@ +add('measurement_standard_name'); + $builder->add('measurement_standard_authority'); + $builder->add('save','submit',array('label'=>'Submit')); + } + + /** + * Set defaults + * + * @param OptionsResolverInterface + */ + public function setDefaultOptions(OptionsResolverInterface $resolver) { + $resolver->setDefaults(array( + 'data_class' => 'AppBundle\Entity\MeasurementStandard' + )); + } + + public function getName() { + return 'measurementStandard'; + } + +} + diff --git a/src/AppBundle/Form/Type/OtherResourceType.php b/src/AppBundle/Form/Type/OtherResourceType.php new file mode 100755 index 00000000..498d8e63 --- /dev/null +++ b/src/AppBundle/Form/Type/OtherResourceType.php @@ -0,0 +1,50 @@ +add('resource_name','text',array( + 'label'=>false, + 'attr'=>array('placeholder'=>'Resource Name/Type')) + ); + $builder->add('resource_description','text',array( + 'label'=>false, + 'attr'=>array('placeholder'=>'Resource Description')) + ); + $builder->add('resource_url','text',array( + 'label'=>false, + 'attr'=>array('placeholder'=>'Resource URL')) + ); + } + + /** + * Set defaults + * + * @param OptionsResolverInterface + */ + public function setDefaultOptions(OptionsResolverInterface $resolver) { + $resolver->setDefaults(array( + 'data_class' => 'AppBundle\Entity\OtherResource' + )); + } + + public function getName() { + return 'OtherResource'; + } + +} + diff --git a/src/AppBundle/Form/Type/PersonAssociationType.php b/src/AppBundle/Form/Type/PersonAssociationType.php new file mode 100755 index 00000000..04ed8aef --- /dev/null +++ b/src/AppBundle/Form/Type/PersonAssociationType.php @@ -0,0 +1,48 @@ +add('role', 'choice', array( + 'label' => false, + 'choices' => array('Local Expert'=>'Local Expert', + 'Author'=>'Author'), + )); + $builder->add('person', 'entity', array( + 'class' => 'AppBundle:Person', + 'property'=> 'full_name', + 'multiple'=> false, + 'label' => false, + )); + + } + + public function getName() { + return 'personAssociation'; + } + + /** + * Set defaults + * + * @param OptionsResolverInterface + */ + public function setDefaultOptions(OptionsResolverInterface $resolver) { + $resolver->setDefaults(array( + 'data_class' => 'AppBundle\Entity\PersonAssociation', + )); + } + +} diff --git a/src/AppBundle/Form/Type/PersonType.php b/src/AppBundle/Form/Type/PersonType.php new file mode 100755 index 00000000..bf615d26 --- /dev/null +++ b/src/AppBundle/Form/Type/PersonType.php @@ -0,0 +1,46 @@ +add('full_name'); + $builder->add('kid'); + $builder->add('orcid_id', 'text', array( + 'required' => false, + 'label' => 'ORCID ID', + )); + $builder->add('bio_url'); + $builder->add('save', 'submit'); + } + + /** + * Set defaults + * + * @param OptionsResolverInterface + */ + public function setDefaultOptions(OptionsResolverInterface $resolver) { + $resolver->setDefaults(array( + 'data_class' => 'AppBundle\Entity\Person' + )); + } + + public function getName() { + return 'person'; + } + +} + diff --git a/src/AppBundle/Form/Type/PublicationType.php b/src/AppBundle/Form/Type/PublicationType.php new file mode 100755 index 00000000..03133661 --- /dev/null +++ b/src/AppBundle/Form/Type/PublicationType.php @@ -0,0 +1,45 @@ +add('citation'); + $builder->add('url', 'text', array( + 'label'=>'URL')); + $builder->add('doi', 'text',array( + 'required'=>false, + 'label' => 'DOI')); + $builder->add('save','submit',array('label'=>'Submit')); + } + + /** + * Set defaults + * + * @param OptionsResolverInterface + */ + public function setDefaultOptions(OptionsResolverInterface $resolver) { + $resolver->setDefaults(array( + 'data_class' => 'AppBundle\Entity\Publication' + )); + } + + public function getName() { + return 'publication'; + } + +} + diff --git a/src/AppBundle/Form/Type/PublisherType.php b/src/AppBundle/Form/Type/PublisherType.php new file mode 100755 index 00000000..aabd02f5 --- /dev/null +++ b/src/AppBundle/Form/Type/PublisherType.php @@ -0,0 +1,48 @@ +add('publisher_name'); + $builder->add('publisher_url'); + $builder->add('publisher_categories','entity',array( + 'class' => 'AppBundle:PublisherCategory', + 'property'=> 'publisherCategory', + 'multiple'=> true, + 'expanded'=> true, + 'label' => 'Publisher Type' + )); + $builder->add('save','submit',array('label'=>'Submit')); + } + + /** + * Set default + * + * @param OptionsResolverInterface + */ + public function setDefaultOptions(OptionsResolverInterface $resolver) { + $resolver->setDefaults(array( + 'data_class' => 'AppBundle\Entity\Publisher' + )); + } + + public function getName() { + return 'publisher'; + } + +} + diff --git a/src/AppBundle/Form/Type/RelatedEquipmentType.php b/src/AppBundle/Form/Type/RelatedEquipmentType.php new file mode 100755 index 00000000..7279c6b6 --- /dev/null +++ b/src/AppBundle/Form/Type/RelatedEquipmentType.php @@ -0,0 +1,40 @@ +add('related_equipment'); + $builder->add('save','submit',array('label'=>'Submit')); + } + + /** + * Set defaults + * + * @param OptionsResolverInterface + */ + public function setDefaultOptions(OptionsResolverInterface $resolver) { + $resolver->setDefaults(array( + 'data_class' => 'AppBundle\Entity\RelatedEquipment' + )); + } + + public function getName() { + return 'relatedEquipment'; + } + +} + diff --git a/src/AppBundle/Form/Type/RelatedSoftwareType.php b/src/AppBundle/Form/Type/RelatedSoftwareType.php new file mode 100755 index 00000000..d32afa90 --- /dev/null +++ b/src/AppBundle/Form/Type/RelatedSoftwareType.php @@ -0,0 +1,40 @@ +add('related_software'); + $builder->add('save','submit',array('label'=>'Submit')); + } + + /** + * Set defaults + * + * @param OptionsResolverInterface + */ + public function setDefaultOptions(OptionsResolverInterface $resolver) { + $resolver->setDefaults(array( + 'data_class' => 'AppBundle\Entity\RelatedSoftware' + )); + } + + public function getName() { + return 'relatedSoftware'; + } + +} + diff --git a/src/AppBundle/Form/Type/StudyTypeType.php b/src/AppBundle/Form/Type/StudyTypeType.php new file mode 100755 index 00000000..49dab06d --- /dev/null +++ b/src/AppBundle/Form/Type/StudyTypeType.php @@ -0,0 +1,40 @@ +add('study_type'); + $builder->add('save','submit',array('label'=>'Submit')); + } + + /** + * Set defaults + * + * @param OptionsResolverInterface + */ + public function setDefaultOptions(OptionsResolverInterface $resolver) { + $resolver->setDefaults(array( + 'data_class' => 'AppBundle\Entity\StudyType' + )); + } + + public function getName() { + return 'studyType'; + } + +} + diff --git a/src/AppBundle/Form/Type/SubjectDomainType.php b/src/AppBundle/Form/Type/SubjectDomainType.php new file mode 100755 index 00000000..3b8ad4c0 --- /dev/null +++ b/src/AppBundle/Form/Type/SubjectDomainType.php @@ -0,0 +1,41 @@ +add('subject_domain'); + $builder->add('mesh_code'); + $builder->add('save','submit',array('label'=>'Submit')); + } + + /** + * Set defaults + * + * @param OptionsResolverInterface + */ + public function setDefaultOptions(OptionsResolverInterface $resolver) { + $resolver->setDefaults(array( + 'data_class' => 'AppBundle\Entity\SubjectDomain' + )); + } + + public function getName() { + return 'subjectDomain'; + } + +} + diff --git a/src/AppBundle/Form/Type/SubjectGenderType.php b/src/AppBundle/Form/Type/SubjectGenderType.php new file mode 100755 index 00000000..439d8ae4 --- /dev/null +++ b/src/AppBundle/Form/Type/SubjectGenderType.php @@ -0,0 +1,40 @@ +add('subject_gender'); + $builder->add('save','submit',array('label'=>'Submit')); + } + + /** + * Set defaults + * + * @param OptionsResolverInterface + */ + public function setDefaultOptions(OptionsResolverInterface $resolver) { + $resolver->setDefaults(array( + 'data_class' => 'AppBundle\Entity\SubjectGender' + )); + } + + public function getName() { + return 'subjectGender'; + } + +} + diff --git a/src/AppBundle/Form/Type/SubjectGeographicAreaDetailType.php b/src/AppBundle/Form/Type/SubjectGeographicAreaDetailType.php new file mode 100755 index 00000000..cdb18bb4 --- /dev/null +++ b/src/AppBundle/Form/Type/SubjectGeographicAreaDetailType.php @@ -0,0 +1,41 @@ +add('geographic_area_detail_name'); + $builder->add('geographic_area_detail_authority'); + $builder->add('save','submit',array('label'=>'Submit')); + } + + /** + * Set defaults + * + * @param OptionsResolverInterface + */ + public function setDefaultOptions(OptionsResolverInterface $resolver) { + $resolver->setDefaults(array( + 'data_class' => 'AppBundle\Entity\SubjectGeographicAreaDetail' + )); + } + + public function getName() { + return 'subjectGeographicAreaDetail'; + } + +} + diff --git a/src/AppBundle/Form/Type/SubjectGeographicAreaType.php b/src/AppBundle/Form/Type/SubjectGeographicAreaType.php new file mode 100755 index 00000000..2ae36e01 --- /dev/null +++ b/src/AppBundle/Form/Type/SubjectGeographicAreaType.php @@ -0,0 +1,41 @@ +add('geographic_area_name'); + $builder->add('geographic_area_authority'); + $builder->add('save','submit',array('label'=>'Submit')); + } + + /** + * Set defaults + * + * @param OptionsResolverInterface + */ + public function setDefaultOptions(OptionsResolverInterface $resolver) { + $resolver->setDefaults(array( + 'data_class' => 'AppBundle\Entity\SubjectGeographicArea' + )); + } + + public function getName() { + return 'subjectGeographicArea'; + } + +} + diff --git a/src/AppBundle/Form/Type/SubjectKeywordType.php b/src/AppBundle/Form/Type/SubjectKeywordType.php new file mode 100755 index 00000000..4f7dcff6 --- /dev/null +++ b/src/AppBundle/Form/Type/SubjectKeywordType.php @@ -0,0 +1,40 @@ +add('keyword'); + $builder->add('save','submit',array('label'=>'Submit')); + } + + /** + * Set defaults + * + * @param OptionsResolverInterface + */ + public function setDefaultOptions(OptionsResolverInterface $resolver) { + $resolver->setDefaults(array( + 'data_class' => 'AppBundle\Entity\SubjectKeyword' + )); + } + + public function getName() { + return 'subjectKeyword'; + } + +} + diff --git a/src/AppBundle/Form/Type/SubjectOfStudyType.php b/src/AppBundle/Form/Type/SubjectOfStudyType.php new file mode 100755 index 00000000..b7986bd1 --- /dev/null +++ b/src/AppBundle/Form/Type/SubjectOfStudyType.php @@ -0,0 +1,40 @@ +add('subject_of_study'); + $builder->add('save','submit',array('label'=>'Submit')); + } + + /** + * Set defaults + * + * @param OptionsResolverInterface + */ + public function setDefaultOptions(OptionsResolverInterface $resolver) { + $resolver->setDefaults(array( + 'data_class' => 'AppBundle\Entity\SubjectOfStudy' + )); + } + + public function getName() { + return 'subjectOfStudy'; + } + +} + diff --git a/src/AppBundle/Form/Type/SubjectPopulationAgeType.php b/src/AppBundle/Form/Type/SubjectPopulationAgeType.php new file mode 100755 index 00000000..30ce4c9c --- /dev/null +++ b/src/AppBundle/Form/Type/SubjectPopulationAgeType.php @@ -0,0 +1,40 @@ +add('age_group'); + $builder->add('save','submit',array('label'=>'Submit')); + } + + /** + * Set defaults + * + * @param OptionsResolverInterface + */ + public function setDefaultOptions(OptionsResolverInterface $resolver) { + $resolver->setDefaults(array( + 'data_class' => 'AppBundle\Entity\SubjectPopulationAge' + )); + } + + public function getName() { + return 'subjectPopulationAge'; + } + +} + diff --git a/src/AppBundle/Form/Type/UserType.php b/src/AppBundle/Form/Type/UserType.php new file mode 100755 index 00000000..ce4d94bf --- /dev/null +++ b/src/AppBundle/Form/Type/UserType.php @@ -0,0 +1,52 @@ +add('username'); + $builder->add('firstName'); + $builder->add('lastName'); + $builder->add('roles', 'entity', array( + 'required'=>true, + 'class' =>'AppBundle\Entity\Security\Role', + 'property'=>'name', + 'multiple'=>true, + 'label' => 'Website role', + 'expanded'=>true, + )); + + $builder->add('save', 'submit'); + } + + /** + * Set defaults + * + * @param OptionsResolverInterface + */ + public function setDefaultOptions(OptionsResolverInterface $resolver) { + $resolver->setDefaults(array( + 'data_class' => 'AppBundle\Entity\Security\User' + )); + } + + public function getName() { + return 'user'; + } + +} + diff --git a/src/AppBundle/Resources/config/routing.yml b/src/AppBundle/Resources/config/routing.yml new file mode 100755 index 00000000..45346656 --- /dev/null +++ b/src/AppBundle/Resources/config/routing.yml @@ -0,0 +1,4 @@ +index: + resource: "@AppBundle/Controller/" + type: annotation + prefix: / diff --git a/src/AppBundle/Resources/config/services.yml b/src/AppBundle/Resources/config/services.yml new file mode 100755 index 00000000..c81ac437 --- /dev/null +++ b/src/AppBundle/Resources/config/services.yml @@ -0,0 +1,8 @@ +services: + SolrSearchr: + class: AppBundle\Service\SolrSearchr + arguments: + - "%solrsearchr_server%" + - "%solrsearchr_format%" + - "%solrsearchr_facets%" + - "%solrsearchr_fields_to_display%" diff --git a/src/AppBundle/Resources/views/Form/fields.html.twig b/src/AppBundle/Resources/views/Form/fields.html.twig new file mode 100755 index 00000000..910e3119 --- /dev/null +++ b/src/AppBundle/Resources/views/Form/fields.html.twig @@ -0,0 +1,3 @@ +{% block form_group_class %} +col-sm-4 +{% endblock form_group_class %} diff --git a/src/AppBundle/Security/User.php b/src/AppBundle/Security/User.php new file mode 100755 index 00000000..8190b51d --- /dev/null +++ b/src/AppBundle/Security/User.php @@ -0,0 +1,76 @@ +username = $username; + $this->password = $password; + $this->firstName = $firstName; + $this->salt = $salt; + $this->roles = $roles; + } + + public function getRoles() + { + return $this->roles; + } + + public function getPassword() + { + return $this->password; + } + + public function getSalt() + { + return $this->salt; + } + + public function getFirstName() + { + return $this->firstName; + } + + public function getUsername() + { + return $this->username; + } + + public function eraseCredentials() + { + } + + public function isEqualTo(UserInterface $user) + { + if (!$user instanceof User) { + return false; + } + + if ($this->password !== $user->getPassword()) { + return false; + } + + if ($this->salt !== $user->getSalt()) { + return false; + } + + if ($this->username !== $user->getUsername()) { + return false; + } + + return true; + } +} diff --git a/src/AppBundle/Security/UserAuthenticator.php b/src/AppBundle/Security/UserAuthenticator.php new file mode 100755 index 00000000..9de10013 --- /dev/null +++ b/src/AppBundle/Security/UserAuthenticator.php @@ -0,0 +1,65 @@ +encoder = $encoder; + } + + public function authenticateToken(TokenInterface $token, UserProviderInterface $userProvider, $providerKey) + { + try { + //search our database to see if this person has been granted access + $userData = $userProvider->loadUserByUsername($token->getUsername()); + } catch (UsernameNotFoundException $e) { + throw new AuthenticationException('Please use the \'Contact Us\' link above to request access to the Data Catalog'); + } + $username = $userData->getUsername(); + + // set up LDAP connection + $ldap = new adLDAP(); + + // authenticate against LDAP + $passwordValid = $ldap->authenticate($username,$token->getCredentials()); + + // if they authenticated successfully, return a user token + if ($passwordValid) { + return new UsernamePasswordToken( + $username, + $userData->getPassword(), + $providerKey, + $userData->getRoles() + ); + } else { + throw new AuthenticationException('Invalid username or password'); + } + } + + public function supportsToken(TokenInterface $token, $providerKey) + { + return $token instanceof UsernamePasswordToken + && $token->getProviderKey() === $providerKey; + } + + public function createToken(Request $request, $username, $password, $providerKey) + { + return new UsernamePasswordToken($username, $password, $providerKey); + } +} diff --git a/src/AppBundle/Service/SolrSearchr.php b/src/AppBundle/Service/SolrSearchr.php new file mode 100755 index 00000000..53293f33 --- /dev/null +++ b/src/AppBundle/Service/SolrSearchr.php @@ -0,0 +1,343 @@ + 'score+desc', + 'date added' => 'date_added+desc', + 'name' => 'dataset_title_str+asc', + ); + + + /** + * These config parameters are set in parameters.yml and supplied by Symfony automatically + * when this service is instantiated in GeneralController.php + */ + public function __construct($solrServer, + $solrFormat, + $solrFacets, + $solrDisplayFields) { + + $this->solrBaseURL = $solrServer; + $this->solrFormat = $solrFormat; + $this->solrFacets = $solrFacets; + $this->solrDisplayFields = $solrDisplayFields; + } + + + /** + * Set user search based on SearchState object properties (called in GeneralController.php) + * + * @param SearchState $currentSearch An object representing the user's query + */ + public function setUserSearch(SearchState $currentSearch) { + $this->setKeyword($currentSearch->keyword); + $this->setSort($currentSearch->sort); + $this->setPage($currentSearch->page); + $this->setResultsPP($currentSearch->resultsPP); + $this->setFacetQuery($currentSearch->facets); + } + + + /** + * Fetch results from Solr using the URL we constructed + * + * @return string A HTTP response from Solr + */ + public function fetchFromSolr() { + + $requestURL = $this->constructSolrURL(); + + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL, $requestURL); + curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-type: application/json")); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); + + if (!$resp = curl_exec($ch)) { + trigger_error('URL of Solr server not specified'); + } + + curl_close($ch); + return $resp; + + } + + + /** + * Cobble together all our little functions to create one Solr URL + * + * @return string The URL we can use to fetch from Solr + */ + protected function constructSolrURL() { + + $keywordQuery = $this->makeKeywordQuery(); + $facetQuery = $this->makeFacetQuery(); + $datesQuery = $this->makeDateRangeFacetQuery(); + $sortQuery = $this->makeSortQuery(); + $startQuery = $this->makeStartQuery(); + $rowsQuery = $this->makeRowsQuery(); + $fieldsQuery = $this->makeFieldsQuery(); + + $method = 'select'; + + $URL = $this->solrBaseURL + . $method + . '?' + . $keywordQuery + . $facetQuery + . $datesQuery + . $sortQuery + . $startQuery + . $rowsQuery + . $fieldsQuery + . '&wt=' . $this->solrFormat; + + return $URL; + + } + + + /** + * Produce the Keyword portion of the Solr URL + * + * @return string The Keyword portion of the URL + */ + protected function makeKeywordQuery() { + + $base_query = "q="; + $keyword_query_string = trim($this->solrKeyword); + // is this query trying to return all results? if so, let it through + if ($keyword_query_string != "*") { + // if not, is this query trying to limit to one specific field? (i.e. access_instructions:"query") if so, let it through + if (strpos($keyword_query_string, ":") === false) { + // else, if it's just a normal query, search the catch-all "text" field and the title field + $cleaned_query = urlencode($keyword_query_string); + $keyword_query_string = "text:\"" . $cleaned_query . "\" OR dataset_title:\"" . $cleaned_query . "\""; + } + } + + return $base_query . urlencode($keyword_query_string); + + } + + + /** + * Produce the Fields portion of the Solr URL + * + * @return string The Fields portion of the URL + */ + protected function makeFieldsQuery() { + $fields_query_string = '&fl=' . join(',', $this->solrDisplayFields); + + return $fields_query_string; + } + + + /** + * Make the Facets portion of the Solr URL + * + * @return string The Facets portion of the URL + */ + protected function makeFacetQuery() { + $facet_query_string = "&facet=true&facet.mincount=1"; + + // Tell Solr which fields we're making facets out of (stored in parameters.yml) + for($i=0, $size=count($this->solrFacets); $i<$size; ++$i) { + $this_facet = "&facet.field=" . $this->solrFacets[$i]; + $facet_query_string .= $this_facet; + } + + // Tell Solr if the user has filtered this search using any of the facets + if ($this->solrFacetQuery) { + for($i=0,$size=count($this->solrFacetQuery); $i<$size; ++$i) { + // If it's a date facet, we need to use a different function + if (strpos($this->solrFacetQuery[$i], 'dataset_years') !== FALSE) { + $this_facet_string = "&fq=" . urlencode($this->makeDateRangeFilterQuery($this->solrFacetQuery[$i])); + } else { + $this_facet_string = "&fq=" . urlencode($this->solrFacetQuery[$i]); + } + $facet_query_string .= $this_facet_string; + } + } + + return $facet_query_string; + + } + + + /** + * Make the Date Facets part of the URL + * + * @param string $facet The facet to be turned into a range facet + * + * @return string The date range facets portion of the Solr URL + */ + protected function makeDateRangeFilterQuery($facet) { + $parts = explode(':', str_replace('"','',$facet)); + if (strpos($parts[1], 'Prior to') !== FALSE) { + $start = '1700-01-01T00:00:00Z'; + $end = substr($parts[1], -4); + $end = ($end - 1) . '-12-29T12:59:59Z'; + } elseif (strpos($parts[1], 'Present') !== FALSE) { + $start = substr($parts[1], 0,4) . '-01-01T00:00:00Z'; + $end = "NOW"; + } else { + $years = explode(' - ', $parts[1]); + $start = $years[0] . "-01-01T00:00:00Z"; + $end = $years[1] . "-12-29T12:59:59Z"; + } + + $date_range = $parts[0] . ":" . "[" . $start . " TO " . $end . "]"; + + return $date_range; + } + + + /** + * Creates a date range facet query starting 40 years ago with an interval of 10 years b/w facets + * + * @return string The Date Range Facets portion of the query URL + **/ + protected function makeDateRangeFacetQuery() { + $date_range_query = "&facet.range=dataset_years&f.dataset_years.facet.range.start=NOW/YEAR-40YEAR"; + $date_range_query .= "&f.dataset_years.facet.range.end=NOW/YEAR&f.dataset_years.facet.range.gap=%2b10YEAR"; + $date_range_query .= "&f.dataset_years.facet.range.hardend=true&f.dataset_years.facet.range.other=before"; + + return $date_range_query; + + } + + + /** + * Produce the Sort portion of the Solr URL + * + * @return string The Sort portion of the URL + */ + protected function makeSortQuery() { + + $sort_query_string = "&sort=" . $this->sortMappings[$this->solrSort]; + return $sort_query_string; + + } + + + /** + * Tell Solr what page of results we're on + * + * @return The Start portion of the query URL + */ + protected function makeStartQuery() { + + $start_query_string = "&start="; + $start_num = ($this->solrPageNum - 1) * $this->solrResultsPP; + + $start_query_string .= $start_num; + + return $start_query_string; + } + + + /** + * Tell Solr how many results we want to see at a time + * + * @return string The Rows portion of the query URL + */ + protected function makeRowsQuery() { + + $rows_query_string = "&rows=" . $this->solrResultsPP; + return $rows_query_string; + + } + + + + # GETTERS 'N' SETTERS + + + /** + * Set Keyword + * + * @param string The Keyword + */ + public function setKeyword($keyword) { + if ($keyword) { + $this->solrKeyword = $keyword; + } + } + + + /** + * Set Sort + * + * @param string The Sorting of results + */ + public function setSort($sort) { + if ($sort) { + $this->solrSort = $sort; + } + } + + + /** + * Set Results Per Page + * + * @param int The results per page + */ + public function setResultsPP($resultsPP) { + if ($resultsPP) { + $this->solrResultsPP = $resultsPP; + } + } + + + /** + * Set Facet Query + * + * @param string The facet query + */ + public function setFacetQuery($facet_query) { + if ($facet_query) { + $this->solrFacetQuery = $facet_query; + } + } + + + /** + * Set page number + * + * @param int The page number + */ + public function setPage($page_num) { + if ($page_num) { + $this->solrPageNum = $page_num; + } + + } + + +} diff --git a/src/AppBundle/Tests/Controller/DefaultControllerTest.php b/src/AppBundle/Tests/Controller/DefaultControllerTest.php new file mode 100755 index 00000000..f35af752 --- /dev/null +++ b/src/AppBundle/Tests/Controller/DefaultControllerTest.php @@ -0,0 +1,18 @@ +request('GET', '/app/example'); + + $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $this->assertTrue($crawler->filter('html:contains("Homepage")')->count() > 0); + } +} diff --git a/src/AppBundle/Utils/Slugger.php b/src/AppBundle/Utils/Slugger.php new file mode 100755 index 00000000..b2ad0330 --- /dev/null +++ b/src/AppBundle/Utils/Slugger.php @@ -0,0 +1,43 @@ + + RewriteEngine On + + # Determine the RewriteBase automatically and set it as environment variable. + # If you are using Apache aliases to do mass virtual hosting or installed the + # project in a subdirectory, the base path will be prepended to allow proper + # resolution of the app.php file and to redirect to the correct URI. It will + # work in environments without path prefix as well, providing a safe, one-size + # fits all solution. But as you do not need it in this case, you can comment + # the following 2 lines to eliminate the overhead. + RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$ + RewriteRule ^(.*) - [E=BASE:%1] + + # Sets the HTTP_AUTHORIZATION header removed by apache + RewriteCond %{HTTP:Authorization} . + RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] + + # Redirect to URI without front controller to prevent duplicate content + # (with and without `/app.php`). Only do this redirect on the initial + # rewrite by Apache and not on subsequent cycles. Otherwise we would get an + # endless redirect loop (request -> rewrite to front controller -> + # redirect -> request -> ...). + # So in case you get a "too many redirects" error or you always get redirected + # to the start page because your Apache does not expose the REDIRECT_STATUS + # environment variable, you have 2 choices: + # - disable this feature by commenting the following 2 lines or + # - use Apache >= 2.3.9 and replace all L flags by END flags and remove the + # following RewriteCond (best solution) + RewriteCond %{ENV:REDIRECT_STATUS} ^$ + +######### CHANGE FOR DIFFERENT ENV ############# + RewriteRule ^app_dev\.php(/(.*)|$) %{CONTEXT_PREFIX}/$2 [R=301,L] +# RewriteRule ^app\.php(/(.*)|$) %{ENV:BASE}/$2 [R=301,L] +################################################ + + # If the requested filename exists, simply serve it. + # We only want to let Apache serve files and not directories. + RewriteCond %{REQUEST_FILENAME} -f + RewriteRule .? - [L] + + # Rewrite all other queries to the front controller. + +######### CHANGE FOR DIFFERENT ENV ############# + RewriteRule .? %{ENV:BASE}app_dev.php [L] +# RewriteRule .? %{ENV:BASE}/app.php [L] +################################################## + + + + + + # When mod_rewrite is not available, we instruct a temporary redirect of + # the start page to the front controller explicitly so that the website + # and the generated links can still be used. + +######### CHANGE FOR DIFFERENT ENV ############### + RedirectMatch 302 ^/$ /app_dev.php/ +# RedirectMatch 302 ^/$ /app.php/ +#################################################### + + # RedirectTemp cannot be used instead + + diff --git a/web/app.php b/web/app.php new file mode 100755 index 00000000..5824d437 --- /dev/null +++ b/web/app.php @@ -0,0 +1,33 @@ +unregister(); +$apcLoader->register(true); + + +require_once __DIR__.'/../app/AppKernel.php'; +require_once __DIR__.'/../app/AppCache.php'; + +$kernel = new AppKernel('prod', false); +$kernel->loadClassCache(); +$kernel = new AppCache($kernel); + +// When using the HttpCache, you need to call the method in your front controller instead of relying on the configuration parameter +#Request::enableHttpMethodParameterOverride(); +$request = Request::createFromGlobals(); +$response = $kernel->handle($request); +$response->send(); +$kernel->terminate($request, $response); diff --git a/web/app_dev.php b/web/app_dev.php new file mode 100755 index 00000000..327dcab7 --- /dev/null +++ b/web/app_dev.php @@ -0,0 +1,30 @@ +loadClassCache(); +$request = Request::createFromGlobals(); +$response = $kernel->handle($request); +$response->send(); +$kernel->terminate($request, $response); diff --git a/web/apple-touch-icon.png b/web/apple-touch-icon.png new file mode 100755 index 00000000..11f17e6d Binary files /dev/null and b/web/apple-touch-icon.png differ diff --git a/web/config.php b/web/config.php new file mode 100755 index 00000000..162acfc7 --- /dev/null +++ b/web/config.php @@ -0,0 +1,124 @@ +getFailedRequirements(); +$minorProblems = $symfonyRequirements->getFailedRecommendations(); + +?> + + + + + + Symfony Configuration + + + + + +
+
+ + + +
+ +
+
+
+

Welcome!

+

Welcome to your new Symfony project.

+

+ This script will guide you through the basic configuration of your project. + You can also do the same by editing the ‘app/config/parameters.yml’ file directly. +

+ + +

Major problems

+

Major problems have been detected and must be fixed before continuing:

+
    + +
  1. getHelpHtml() ?>
  2. + +
+ + + +

Recommendations

+

+ Additionally, toTo enhance your Symfony experience, + it’s recommended that you fix the following: +

+
    + +
  1. getHelpHtml() ?>
  2. + +
+ + + hasPhpIniConfigIssue()): ?> +

* + getPhpIniConfigPath()): ?> + Changes to the php.ini file must be done in "getPhpIniConfigPath() ?>". + + To change settings, create a "php.ini". + +

+ + + +

Your configuration looks good to run Symfony.

+ + + +
+
+
+
Symfony Standard Edition
+
+ + diff --git a/web/css/style.css b/web/css/style.css new file mode 100755 index 00000000..9fd2df55 --- /dev/null +++ b/web/css/style.css @@ -0,0 +1,628 @@ +* { + margin: 0; +} +html, body { + height: 100%; +} +.page-wrapper { + min-height: 100%; + margin: 0 auto -175px; /* the bottom margin is the negative value of the footer's height */ +} +footer, .push { + height: 175px; /* '.push' must be the same height as 'footer' */ + clear:both; +} + +/* + +Sticky Footer by Ryan Fait +http://ryanfait.com/ + +*/ + + +.label-warning { + background:#C25019; +} + +.spacer25 { + height:25px; +} +.spacer50 { + height:50px; +} +#page-header { + height:100px; + background: black; + position:relative; + padding:1em; +} +#page-header span { + display:inline-block; +} +#header-logo { + height:75px; +} +#content-wrapper { + margin-bottom:5em; +} +.page-header { + margin-top:1em; +} +.pagetitle { + color:white; + vertical-align:bottom; + margin-left:3em; +} +.pagetitlelink { + color:rgb(243,243,243); +} +.pagetitlelink:hover { + color:white; + text-decoration:none; +} + +#logged-in-badge { + text-align:right; + margin-right:.2em; + margin-bottom:1.25em; +} + +.queue-notification:hover, +.greeting:hover { + text-decoration:underline; +} + +.nav-links { + display:inline-block; + position:absolute; + bottom:0; + right:0; +} + +.nav-tabs { + border-bottom:none; +} +.nav-tabs li { + margin-bottom:0px; +} +.nav-tabs>li>a { + border-radius:2px 2px 0px 0px; + + height:32px; +} +.nav-tabs>li>a { + padding:5px 15px; + color:rgb(200,200,200); +} +.nav-tabs>li>a:hover { + color:black; +} +.nav-tabs>li:hover { +} +.nav-tabs>li.active>a { + background:#f8f8f8; + margin-right:0px; +} +.nav-tabs>li:not(.active) { + background: rgba(140,140,140,.42); +} +.nav-tabs>li.privileged-nav-link>a { + color:rgb(236, 161, 108); +} + + +.admin-nav-sidebar { + max-width:250px; + font-size:.9em; + margin-top:1em; + min-width:245px; + border-bottom:1px dotted gray; + padding:1em 1em 3em 1em; +} +.admin-nav-sidebar li.active>a { + background:#e8e8e8; + color:rgb(82, 82, 82); +} +.list-group-item.active>.badge, .nav-pills>.active>a>.badge { + color:white; + background:#777; +} + + +#content { +} +.update-dataset-link { + padding-top:.5em; +} +.update-dataset-link a, +.entity-add-link, +.entity-remove-link { + color:rgb(224, 101, 101); +} +.entity-remove-link:hover { + color:red; +} + +#facets-pane { + padding:.5em; + border-right:1px solid lightgray; + border-bottom:1px solid lightgray; + +} +.facet-section { + padding:.5em; +} +.facetBreadcrumb { + margin:.25em; +} + +.facetBreadcrumb:hover .facetRemove { + color:white; + font-weight:bold; +} + + + +button.nextPage { + float:right; +} +button.prevPage { + float:left; +} + +#pagerContainer { + margin:0 auto; +margin-top:1.5em; +margin-bottom:10em; + width:70%; +} + +#results-list { + padding-left:3em; +} + +#results-list li { + padding:1.25em 0em; + border-bottom:1px solid lightgray; +} + +#facets-list { + font-size:.9em; + padding-left:.25em; +} + +#results-list dd,dt { + padding:.25em 0em; +} + +.facet-header { + padding:.25em 0em; + border-bottom:1px solid lightgray; + color:rgb(100,100,100); +} + +li.facet-item { + padding:.5em 0em; + overflow:auto; + font-size:.9em; +} + + +li span.facet-name { + float:left; +} + +li span.facet-numresults { + float:right; + color:rgb(121,121,121); +} + +.search-box-description { +color:gray; +} +#search-header { + text-align:center; + background:#f8f8f8; + width:100%; + border-bottom:1px solid lightgray; + padding:2em 0em; +} + + + + + +/** + * FORMS + **/ +a.btn-add { + cursor:pointer; +} +form .visual-break { + margin-top:3em !important; + border-top:1px solid rgb(140, 0, 197); + padding-top:3em !important; +} + +.select2-container, .select2-drop, .select2-search, .select2-search input { + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + width: 100%; +} +.select2-container .select2-choice { + height: 34px; +} +.select2-container .select2-choice .select2-arrow { + display: none; +} +form.input-group { + width:50%; + margin:0 auto; + vertical-align:middle; +} +form.form-group input { +} +.form-horizontal .form-group { + clear:both; + padding:1.25em 0em; + margin:0em; +/* border-top:1px dotted lightgray;*/ + +} +fieldset { + margin-bottom:5em; +} +legend { + border-bottom:2px solid #59008D; + padding:.5em; + color:#59008D; +} +.form-group.multiple:first { + margin-top:3em; +} +.form-group.multiple div[class^="col-sm-"] { + padding-top:7px; +} +.form-group .control-label { + text-align:right; +} +:not(.radio) > label.required:not(.no-asterisk):before { + content: "* "; +} + +.remove-entity-warning { + color:red; +} + +#pager-wrapper { + text-align:right; + font-size:.9em; + float:right; + clear:both; +} +#pagenum-input { + border-radius:3px; + border:1px solid darkgray; + text-align:right; +} + +#pager-wrapper .pager-text { + margin:.25em .5em; +} + + +#search-stats-header { +padding:.5em 0em; +overflow:auto; +} +#sort-and-results select { + font-size:.8em; +} + +#sort-and-results { + font-size:.9em; +} + +#sort-and-results #dropdowns-wrapper { +float:right; +font-size:.9em; +text-align:right; +clear:both; +margin-top:.25em; +} + +#sort-dropdown-wrapper, #results-dropdown-wrapper { + display:inline-block; +} + +#sort-and-results .dropdown-label { +font-size:.9em; +} + +#numresults-wrapper { +float:right; +clear:both; +text-align:right; +color:gray; +font-size:.95em; +margin-top:.25em; +} +#number-of-results { +font-size:1.1em; +} + +div[data-prototype] div[data-content] { + width:66%; + margin-left:34%; + padding:.25em; + clear:both; + border-radius:5px; + position:relative; + margin-top:1em; +} + + +div[data-prototype] div[data-content] .form-group { + border-top:none; + padding:0em; + margin-bottom:1.5em; +} +div[data-prototype] div[data-content] .form-group .col-sm-8 { + width:100% !important; +} +div[data-prototype] div[data-content] .btn-remove { + position:absolute; + right:19px; + bottom:7px; +} + +form.remove-form button { + background:rgb(255, 62, 62); +} + +.form-group.has-error .help-block, +.form-group.has-error label { + color:red; +} + + +.modal-success.glyphicon-ok-sign { + font-size:4em; + color:green; +} +#added-entity-name { + font-weight:bold; +} + +/************** + * + * DATASET DETAIL VIEW + * + *************/ +#dataset-detail-titlebox { + margin-bottom:1.5em; + border-bottom: 1px solid lightgray; +} +#dataset-detail-description dd, +#dataset-detail-sidebar dd { + margin-bottom:1em; +} + +#dataset-detail-description { + padding-right:35px; +} + + +.dataset-detail-alttitle, +.dataset-detail-id, +.dataset-detail-authors, +.dataset-detail-issued { + color:gray; +} +.dataset-detail-access-instructions { + font-size:.9em; +} + +.dataset-detail-authors { + margin-bottom:0em; +} + +.dataset-authors-section { + margin-bottom:0em; +} +.corresponding-author-note { + font-size:.75em; +} +.data-location-description { + font-size:.85em; + color:rgb(110,110,110); + margin-bottom:14px; +} +.data-location-title { + font-weight:bold; +} + +.related-dataset-note, +.other-resource-description { + padding-left:1em; + border-left:1px solid lightgray; + color:rgb(77,77,77); +} + +#other-resources, +#related-datasets { + font-size:.9em; +} + +.internal-dataset { + color:orange; + font-weight:bold; + font-size:45%; +} + +.assoc-publication { + font-size:85%; + margin-bottom:1em; +} + +.assoc-publication-link { + +} + +.grant-item { + margin-bottom:.75em; +} + +.dataset-detail-authors .author-name { + cursor: pointer; +} + +#suggest-dataset-link { + margin-top:10em; +} + + +/******************* + * CONTACT FORM + *****************/ +.reason-list { + height:100px; +} +#contact-form { +} +.contact-form-copy { + margin:2.5em 0em 4em 0em; + width:50%; +} +.button-centerer { + width:50%; + text-align:center; + margin-top:2em; + margin-bottom:8em; +} +.alert-success { + text-align:center; +} +#contactFormEmail .checker { + display:none; +} + + +/***************** + * ABOUT PAGE + * **************/ +.about-page-title { + margin:1em 0em; +} + + + +/***************** + * FOOTER + * **************/ +#footer { + background-color: #333; + background: url(../img/background_gradient.gif) repeat-x 0 0 #333; + margin-top:7em; + clear:both; + width:100%; +} +div.footer-wrapper { + margin: 1em auto 0 auto; + position: relative; + min-height: 150px; + height: 175px; + padding: 40px 0 30px 0; + background: transparent; +} + +#footer_logo { + float: right; + padding: 5px 0 0; + position: relative; + right: 1em; + top: 70px; +} +p#phone_number { + position: absolute; + top: 42px; + right: 0; + color: #fff; + text-align: right; + padding-right: 20px; + background: url(../img/icon_phone.gif) no-repeat right top; +} +p#phone_number strong { + font-family: SortsMillGoudy, Georgia, "Times New Roman", Times, Serif; + display: block; + font-weight: bold; + font-size: 28px; + line-height: 24px; + letter-spacing: 2px; + *padding-bottom: 10px; +} +/* style to make the phone number white +on mobile devices that convert this to a link */ +p#phone_number strong a { + color: #fff; +} + +#footer_primary, +#footer_secondary { + /*display: block;*/ + /*ORIGINAL WIDTH width: 760px;*/ + width: 85%; + zoom: 1; + clear: none; + margin: 0 0 15px 0; + +} +#footer_primary:after, +#footer_secondary:after { + content: '.'; + display: block; + height: 0px; + visibility: hidden; + clear: both; +} +#footer_primary li, +#footer_secondary li { + list-style: none; + float: left; + *display: inline; + padding: 0 15px 0 0; + font-size: 11px; + color: #ccc; +} +#footer_primary li { + padding: 0 15px 0 19px; + background: url(../img/bullet.gif) no-repeat left 8px; +} +#footer_primary li:first-child, +#footer_primary li.first { + padding: 0 15px 0 0; + background: none; +} +#footer_primary li a, +#footer_secondary li a { + color: #a5a5a5; + font-size: 16px; + border-bottom: 1px solid #333; + *zoom: 1; + background: transparent; +} +#footer_secondary li a { + color: #ccc; + font-size: 12px; +} +#footer_primary li a:hover, +#footer_secondary li a:hover { + text-decoration: none; + border-bottom: 1px dotted #999; +} +#footer_logo { background-color: transparent; } +#footer-copyright { position: absolute; left: 20px; bottom: 40px; } + + diff --git a/web/favicon.ico b/web/favicon.ico new file mode 100755 index 00000000..3f23e2d0 Binary files /dev/null and b/web/favicon.ico differ diff --git a/web/img/ajax-loader.gif b/web/img/ajax-loader.gif new file mode 100755 index 00000000..e192ca89 Binary files /dev/null and b/web/img/ajax-loader.gif differ diff --git a/web/img/logo.jpg b/web/img/logo.jpg new file mode 100644 index 00000000..68264dce Binary files /dev/null and b/web/img/logo.jpg differ diff --git a/web/js/add_form.js b/web/js/add_form.js new file mode 100755 index 00000000..e705fa5e --- /dev/null +++ b/web/js/add_form.js @@ -0,0 +1,166 @@ +/** + * Functions and behaviors for working with our data entry forms + */ +jQuery(function($) { + + // Set up Select2.js on all box accepts multiple choices, produce an "Add New" link by seeing what entity this field + * is for, and constructing a URL for the modal form + */ + function makeAddNewLink() { + sel = $(this); + if (sel.attr('multiple') !== undefined) { + var thisField = sel.attr('id').replace('dataset_',''); + thisField = toTitleCase(thisField.replace(/_/g,' ')).replace(/ /g,''); + if (thisField.charAt(thisField.length - 1) == 's') { + thisField = thisField.substr(0, thisField.length - 1); + } + var addNewLink = "Add new"; + sel.parent('div').append(addNewLink); + } + } + + + /** + * Make sure we can remove items from embedded forms + */ + var removeItemLink = 'Remove item'; + $('.form-group.multiple div[data-content]').append(removeItemLink); + + + /** + * Show the modal form when the user clicks on an "Add New" link + */ + $('.addNewEntity').click(function(e) { + var fieldName = $(this).attr('data-fieldname'); + e.preventDefault(); + var url = $(this).attr('href'); + $.get(url, function(data) { + $("#addEntityFormModalContent").html(data); + $("#addEntityFormModal").modal({show:true}); + }); + }); + + + /** + * When a new item is added via a modal form, we handle that form submission here, + * and then add the new item to the element we're dealing with here + var displayName = $('#addEntityFormModalContent #entity-display-name').attr('data-displayname'); + var addedEntityName = $('#addEntityFormModalContent #added-entity-name').text().trim(); + var selectBoxId = 'select#dataset_' + displayName.replace(/ /g,'_') +'s'; + if (!$(selectBoxId).length){selectBoxId = selectBoxId.slice(0,-1);} + // Symfony uses the actual database IDs as the values in s + var childSelects = collectionHolder.find('select'); + childSelects.select2({width:'resolve'}); + + event && event.preventDefault(); + }); + + + /** + * Remove a form element from the DOM when the "Remove Item" links are clicked + * Removing it from the DOM will ensure it doesn't get accidentally submitted + */ + $(document).on('click', '.btn-remove', function(event) { + $(this).closest('div[data-content]').fadeOut(300, function() { $(this).remove(); }); + event && event.preventDefault(); + }); + + + /** + * Convert string to Title Case + */ + function toTitleCase(str) + { + return str.replace(/\w\S*/g, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();}); + } + + +}); diff --git a/web/js/jquery-ui.min.js b/web/js/jquery-ui.min.js new file mode 100755 index 00000000..65e9df30 --- /dev/null +++ b/web/js/jquery-ui.min.js @@ -0,0 +1,7 @@ +/*! jQuery UI - v1.11.4 - 2015-10-23 +* http://jqueryui.com +* Includes: core.js, widget.js, mouse.js, position.js, sortable.js +* Copyright 2015 jQuery Foundation and other contributors; Licensed MIT */ + +(function(e){"function"==typeof define&&define.amd?define(["jquery"],e):e(jQuery)})(function(e){function t(t,s){var n,a,o,r=t.nodeName.toLowerCase();return"area"===r?(n=t.parentNode,a=n.name,t.href&&a&&"map"===n.nodeName.toLowerCase()?(o=e("img[usemap='#"+a+"']")[0],!!o&&i(o)):!1):(/^(input|select|textarea|button|object)$/.test(r)?!t.disabled:"a"===r?t.href||s:s)&&i(t)}function i(t){return e.expr.filters.visible(t)&&!e(t).parents().addBack().filter(function(){return"hidden"===e.css(this,"visibility")}).length}e.ui=e.ui||{},e.extend(e.ui,{version:"1.11.4",keyCode:{BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38}}),e.fn.extend({scrollParent:function(t){var i=this.css("position"),s="absolute"===i,n=t?/(auto|scroll|hidden)/:/(auto|scroll)/,a=this.parents().filter(function(){var t=e(this);return s&&"static"===t.css("position")?!1:n.test(t.css("overflow")+t.css("overflow-y")+t.css("overflow-x"))}).eq(0);return"fixed"!==i&&a.length?a:e(this[0].ownerDocument||document)},uniqueId:function(){var e=0;return function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++e)})}}(),removeUniqueId:function(){return this.each(function(){/^ui-id-\d+$/.test(this.id)&&e(this).removeAttr("id")})}}),e.extend(e.expr[":"],{data:e.expr.createPseudo?e.expr.createPseudo(function(t){return function(i){return!!e.data(i,t)}}):function(t,i,s){return!!e.data(t,s[3])},focusable:function(i){return t(i,!isNaN(e.attr(i,"tabindex")))},tabbable:function(i){var s=e.attr(i,"tabindex"),n=isNaN(s);return(n||s>=0)&&t(i,!n)}}),e("").outerWidth(1).jquery||e.each(["Width","Height"],function(t,i){function s(t,i,s,a){return e.each(n,function(){i-=parseFloat(e.css(t,"padding"+this))||0,s&&(i-=parseFloat(e.css(t,"border"+this+"Width"))||0),a&&(i-=parseFloat(e.css(t,"margin"+this))||0)}),i}var n="Width"===i?["Left","Right"]:["Top","Bottom"],a=i.toLowerCase(),o={innerWidth:e.fn.innerWidth,innerHeight:e.fn.innerHeight,outerWidth:e.fn.outerWidth,outerHeight:e.fn.outerHeight};e.fn["inner"+i]=function(t){return void 0===t?o["inner"+i].call(this):this.each(function(){e(this).css(a,s(this,t)+"px")})},e.fn["outer"+i]=function(t,n){return"number"!=typeof t?o["outer"+i].call(this,t):this.each(function(){e(this).css(a,s(this,t,!0,n)+"px")})}}),e.fn.addBack||(e.fn.addBack=function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}),e("").data("a-b","a").removeData("a-b").data("a-b")&&(e.fn.removeData=function(t){return function(i){return arguments.length?t.call(this,e.camelCase(i)):t.call(this)}}(e.fn.removeData)),e.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase()),e.fn.extend({focus:function(t){return function(i,s){return"number"==typeof i?this.each(function(){var t=this;setTimeout(function(){e(t).focus(),s&&s.call(t)},i)}):t.apply(this,arguments)}}(e.fn.focus),disableSelection:function(){var e="onselectstart"in document.createElement("div")?"selectstart":"mousedown";return function(){return this.bind(e+".ui-disableSelection",function(e){e.preventDefault()})}}(),enableSelection:function(){return this.unbind(".ui-disableSelection")},zIndex:function(t){if(void 0!==t)return this.css("zIndex",t);if(this.length)for(var i,s,n=e(this[0]);n.length&&n[0]!==document;){if(i=n.css("position"),("absolute"===i||"relative"===i||"fixed"===i)&&(s=parseInt(n.css("zIndex"),10),!isNaN(s)&&0!==s))return s;n=n.parent()}return 0}}),e.ui.plugin={add:function(t,i,s){var n,a=e.ui[t].prototype;for(n in s)a.plugins[n]=a.plugins[n]||[],a.plugins[n].push([i,s[n]])},call:function(e,t,i,s){var n,a=e.plugins[t];if(a&&(s||e.element[0].parentNode&&11!==e.element[0].parentNode.nodeType))for(n=0;a.length>n;n++)e.options[a[n][0]]&&a[n][1].apply(e.element,i)}};var s=0,n=Array.prototype.slice;e.cleanData=function(t){return function(i){var s,n,a;for(a=0;null!=(n=i[a]);a++)try{s=e._data(n,"events"),s&&s.remove&&e(n).triggerHandler("remove")}catch(o){}t(i)}}(e.cleanData),e.widget=function(t,i,s){var n,a,o,r,h={},l=t.split(".")[0];return t=t.split(".")[1],n=l+"-"+t,s||(s=i,i=e.Widget),e.expr[":"][n.toLowerCase()]=function(t){return!!e.data(t,n)},e[l]=e[l]||{},a=e[l][t],o=e[l][t]=function(e,t){return this._createWidget?(arguments.length&&this._createWidget(e,t),void 0):new o(e,t)},e.extend(o,a,{version:s.version,_proto:e.extend({},s),_childConstructors:[]}),r=new i,r.options=e.widget.extend({},r.options),e.each(s,function(t,s){return e.isFunction(s)?(h[t]=function(){var e=function(){return i.prototype[t].apply(this,arguments)},n=function(e){return i.prototype[t].apply(this,e)};return function(){var t,i=this._super,a=this._superApply;return this._super=e,this._superApply=n,t=s.apply(this,arguments),this._super=i,this._superApply=a,t}}(),void 0):(h[t]=s,void 0)}),o.prototype=e.widget.extend(r,{widgetEventPrefix:a?r.widgetEventPrefix||t:t},h,{constructor:o,namespace:l,widgetName:t,widgetFullName:n}),a?(e.each(a._childConstructors,function(t,i){var s=i.prototype;e.widget(s.namespace+"."+s.widgetName,o,i._proto)}),delete a._childConstructors):i._childConstructors.push(o),e.widget.bridge(t,o),o},e.widget.extend=function(t){for(var i,s,a=n.call(arguments,1),o=0,r=a.length;r>o;o++)for(i in a[o])s=a[o][i],a[o].hasOwnProperty(i)&&void 0!==s&&(t[i]=e.isPlainObject(s)?e.isPlainObject(t[i])?e.widget.extend({},t[i],s):e.widget.extend({},s):s);return t},e.widget.bridge=function(t,i){var s=i.prototype.widgetFullName||t;e.fn[t]=function(a){var o="string"==typeof a,r=n.call(arguments,1),h=this;return o?this.each(function(){var i,n=e.data(this,s);return"instance"===a?(h=n,!1):n?e.isFunction(n[a])&&"_"!==a.charAt(0)?(i=n[a].apply(n,r),i!==n&&void 0!==i?(h=i&&i.jquery?h.pushStack(i.get()):i,!1):void 0):e.error("no such method '"+a+"' for "+t+" widget instance"):e.error("cannot call methods on "+t+" prior to initialization; "+"attempted to call method '"+a+"'")}):(r.length&&(a=e.widget.extend.apply(null,[a].concat(r))),this.each(function(){var t=e.data(this,s);t?(t.option(a||{}),t._init&&t._init()):e.data(this,s,new i(a,this))})),h}},e.Widget=function(){},e.Widget._childConstructors=[],e.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"
",options:{disabled:!1,create:null},_createWidget:function(t,i){i=e(i||this.defaultElement||this)[0],this.element=e(i),this.uuid=s++,this.eventNamespace="."+this.widgetName+this.uuid,this.bindings=e(),this.hoverable=e(),this.focusable=e(),i!==this&&(e.data(i,this.widgetFullName,this),this._on(!0,this.element,{remove:function(e){e.target===i&&this.destroy()}}),this.document=e(i.style?i.ownerDocument:i.document||i),this.window=e(this.document[0].defaultView||this.document[0].parentWindow)),this.options=e.widget.extend({},this.options,this._getCreateOptions(),t),this._create(),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:e.noop,_getCreateEventData:e.noop,_create:e.noop,_init:e.noop,destroy:function(){this._destroy(),this.element.unbind(this.eventNamespace).removeData(this.widgetFullName).removeData(e.camelCase(this.widgetFullName)),this.widget().unbind(this.eventNamespace).removeAttr("aria-disabled").removeClass(this.widgetFullName+"-disabled "+"ui-state-disabled"),this.bindings.unbind(this.eventNamespace),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")},_destroy:e.noop,widget:function(){return this.element},option:function(t,i){var s,n,a,o=t;if(0===arguments.length)return e.widget.extend({},this.options);if("string"==typeof t)if(o={},s=t.split("."),t=s.shift(),s.length){for(n=o[t]=e.widget.extend({},this.options[t]),a=0;s.length-1>a;a++)n[s[a]]=n[s[a]]||{},n=n[s[a]];if(t=s.pop(),1===arguments.length)return void 0===n[t]?null:n[t];n[t]=i}else{if(1===arguments.length)return void 0===this.options[t]?null:this.options[t];o[t]=i}return this._setOptions(o),this},_setOptions:function(e){var t;for(t in e)this._setOption(t,e[t]);return this},_setOption:function(e,t){return this.options[e]=t,"disabled"===e&&(this.widget().toggleClass(this.widgetFullName+"-disabled",!!t),t&&(this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus"))),this},enable:function(){return this._setOptions({disabled:!1})},disable:function(){return this._setOptions({disabled:!0})},_on:function(t,i,s){var n,a=this;"boolean"!=typeof t&&(s=i,i=t,t=!1),s?(i=n=e(i),this.bindings=this.bindings.add(i)):(s=i,i=this.element,n=this.widget()),e.each(s,function(s,o){function r(){return t||a.options.disabled!==!0&&!e(this).hasClass("ui-state-disabled")?("string"==typeof o?a[o]:o).apply(a,arguments):void 0}"string"!=typeof o&&(r.guid=o.guid=o.guid||r.guid||e.guid++);var h=s.match(/^([\w:-]*)\s*(.*)$/),l=h[1]+a.eventNamespace,u=h[2];u?n.delegate(u,l,r):i.bind(l,r)})},_off:function(t,i){i=(i||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,t.unbind(i).undelegate(i),this.bindings=e(this.bindings.not(t).get()),this.focusable=e(this.focusable.not(t).get()),this.hoverable=e(this.hoverable.not(t).get())},_delay:function(e,t){function i(){return("string"==typeof e?s[e]:e).apply(s,arguments)}var s=this;return setTimeout(i,t||0)},_hoverable:function(t){this.hoverable=this.hoverable.add(t),this._on(t,{mouseenter:function(t){e(t.currentTarget).addClass("ui-state-hover")},mouseleave:function(t){e(t.currentTarget).removeClass("ui-state-hover")}})},_focusable:function(t){this.focusable=this.focusable.add(t),this._on(t,{focusin:function(t){e(t.currentTarget).addClass("ui-state-focus")},focusout:function(t){e(t.currentTarget).removeClass("ui-state-focus")}})},_trigger:function(t,i,s){var n,a,o=this.options[t];if(s=s||{},i=e.Event(i),i.type=(t===this.widgetEventPrefix?t:this.widgetEventPrefix+t).toLowerCase(),i.target=this.element[0],a=i.originalEvent)for(n in a)n in i||(i[n]=a[n]);return this.element.trigger(i,s),!(e.isFunction(o)&&o.apply(this.element[0],[i].concat(s))===!1||i.isDefaultPrevented())}},e.each({show:"fadeIn",hide:"fadeOut"},function(t,i){e.Widget.prototype["_"+t]=function(s,n,a){"string"==typeof n&&(n={effect:n});var o,r=n?n===!0||"number"==typeof n?i:n.effect||i:t;n=n||{},"number"==typeof n&&(n={duration:n}),o=!e.isEmptyObject(n),n.complete=a,n.delay&&s.delay(n.delay),o&&e.effects&&e.effects.effect[r]?s[t](n):r!==t&&s[r]?s[r](n.duration,n.easing,a):s.queue(function(i){e(this)[t](),a&&a.call(s[0]),i()})}}),e.widget;var a=!1;e(document).mouseup(function(){a=!1}),e.widget("ui.mouse",{version:"1.11.4",options:{cancel:"input,textarea,button,select,option",distance:1,delay:0},_mouseInit:function(){var t=this;this.element.bind("mousedown."+this.widgetName,function(e){return t._mouseDown(e)}).bind("click."+this.widgetName,function(i){return!0===e.data(i.target,t.widgetName+".preventClickEvent")?(e.removeData(i.target,t.widgetName+".preventClickEvent"),i.stopImmediatePropagation(),!1):void 0}),this.started=!1},_mouseDestroy:function(){this.element.unbind("."+this.widgetName),this._mouseMoveDelegate&&this.document.unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(t){if(!a){this._mouseMoved=!1,this._mouseStarted&&this._mouseUp(t),this._mouseDownEvent=t;var i=this,s=1===t.which,n="string"==typeof this.options.cancel&&t.target.nodeName?e(t.target).closest(this.options.cancel).length:!1;return s&&!n&&this._mouseCapture(t)?(this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){i.mouseDelayMet=!0},this.options.delay)),this._mouseDistanceMet(t)&&this._mouseDelayMet(t)&&(this._mouseStarted=this._mouseStart(t)!==!1,!this._mouseStarted)?(t.preventDefault(),!0):(!0===e.data(t.target,this.widgetName+".preventClickEvent")&&e.removeData(t.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(e){return i._mouseMove(e)},this._mouseUpDelegate=function(e){return i._mouseUp(e)},this.document.bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate),t.preventDefault(),a=!0,!0)):!0}},_mouseMove:function(t){if(this._mouseMoved){if(e.ui.ie&&(!document.documentMode||9>document.documentMode)&&!t.button)return this._mouseUp(t);if(!t.which)return this._mouseUp(t)}return(t.which||t.button)&&(this._mouseMoved=!0),this._mouseStarted?(this._mouseDrag(t),t.preventDefault()):(this._mouseDistanceMet(t)&&this._mouseDelayMet(t)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,t)!==!1,this._mouseStarted?this._mouseDrag(t):this._mouseUp(t)),!this._mouseStarted)},_mouseUp:function(t){return this.document.unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,t.target===this._mouseDownEvent.target&&e.data(t.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(t)),a=!1,!1},_mouseDistanceMet:function(e){return Math.max(Math.abs(this._mouseDownEvent.pageX-e.pageX),Math.abs(this._mouseDownEvent.pageY-e.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}}),function(){function t(e,t,i){return[parseFloat(e[0])*(p.test(e[0])?t/100:1),parseFloat(e[1])*(p.test(e[1])?i/100:1)]}function i(t,i){return parseInt(e.css(t,i),10)||0}function s(t){var i=t[0];return 9===i.nodeType?{width:t.width(),height:t.height(),offset:{top:0,left:0}}:e.isWindow(i)?{width:t.width(),height:t.height(),offset:{top:t.scrollTop(),left:t.scrollLeft()}}:i.preventDefault?{width:0,height:0,offset:{top:i.pageY,left:i.pageX}}:{width:t.outerWidth(),height:t.outerHeight(),offset:t.offset()}}e.ui=e.ui||{};var n,a,o=Math.max,r=Math.abs,h=Math.round,l=/left|center|right/,u=/top|center|bottom/,d=/[\+\-]\d+(\.[\d]+)?%?/,c=/^\w+/,p=/%$/,f=e.fn.position;e.position={scrollbarWidth:function(){if(void 0!==n)return n;var t,i,s=e("
"),a=s.children()[0];return e("body").append(s),t=a.offsetWidth,s.css("overflow","scroll"),i=a.offsetWidth,t===i&&(i=s[0].clientWidth),s.remove(),n=t-i},getScrollInfo:function(t){var i=t.isWindow||t.isDocument?"":t.element.css("overflow-x"),s=t.isWindow||t.isDocument?"":t.element.css("overflow-y"),n="scroll"===i||"auto"===i&&t.widthi?"left":t>0?"right":"center",vertical:0>a?"top":s>0?"bottom":"middle"};d>m&&m>r(t+i)&&(h.horizontal="center"),c>g&&g>r(s+a)&&(h.vertical="middle"),h.important=o(r(t),r(i))>o(r(s),r(a))?"horizontal":"vertical",n.using.call(this,e,h)}),u.offset(e.extend(N,{using:l}))})},e.ui.position={fit:{left:function(e,t){var i,s=t.within,n=s.isWindow?s.scrollLeft:s.offset.left,a=s.width,r=e.left-t.collisionPosition.marginLeft,h=n-r,l=r+t.collisionWidth-a-n;t.collisionWidth>a?h>0&&0>=l?(i=e.left+h+t.collisionWidth-a-n,e.left+=h-i):e.left=l>0&&0>=h?n:h>l?n+a-t.collisionWidth:n:h>0?e.left+=h:l>0?e.left-=l:e.left=o(e.left-r,e.left)},top:function(e,t){var i,s=t.within,n=s.isWindow?s.scrollTop:s.offset.top,a=t.within.height,r=e.top-t.collisionPosition.marginTop,h=n-r,l=r+t.collisionHeight-a-n;t.collisionHeight>a?h>0&&0>=l?(i=e.top+h+t.collisionHeight-a-n,e.top+=h-i):e.top=l>0&&0>=h?n:h>l?n+a-t.collisionHeight:n:h>0?e.top+=h:l>0?e.top-=l:e.top=o(e.top-r,e.top)}},flip:{left:function(e,t){var i,s,n=t.within,a=n.offset.left+n.scrollLeft,o=n.width,h=n.isWindow?n.scrollLeft:n.offset.left,l=e.left-t.collisionPosition.marginLeft,u=l-h,d=l+t.collisionWidth-o-h,c="left"===t.my[0]?-t.elemWidth:"right"===t.my[0]?t.elemWidth:0,p="left"===t.at[0]?t.targetWidth:"right"===t.at[0]?-t.targetWidth:0,f=-2*t.offset[0];0>u?(i=e.left+c+p+f+t.collisionWidth-o-a,(0>i||r(u)>i)&&(e.left+=c+p+f)):d>0&&(s=e.left-t.collisionPosition.marginLeft+c+p+f-h,(s>0||d>r(s))&&(e.left+=c+p+f))},top:function(e,t){var i,s,n=t.within,a=n.offset.top+n.scrollTop,o=n.height,h=n.isWindow?n.scrollTop:n.offset.top,l=e.top-t.collisionPosition.marginTop,u=l-h,d=l+t.collisionHeight-o-h,c="top"===t.my[1],p=c?-t.elemHeight:"bottom"===t.my[1]?t.elemHeight:0,f="top"===t.at[1]?t.targetHeight:"bottom"===t.at[1]?-t.targetHeight:0,m=-2*t.offset[1];0>u?(s=e.top+p+f+m+t.collisionHeight-o-a,(0>s||r(u)>s)&&(e.top+=p+f+m)):d>0&&(i=e.top-t.collisionPosition.marginTop+p+f+m-h,(i>0||d>r(i))&&(e.top+=p+f+m))}},flipfit:{left:function(){e.ui.position.flip.left.apply(this,arguments),e.ui.position.fit.left.apply(this,arguments)},top:function(){e.ui.position.flip.top.apply(this,arguments),e.ui.position.fit.top.apply(this,arguments)}}},function(){var t,i,s,n,o,r=document.getElementsByTagName("body")[0],h=document.createElement("div");t=document.createElement(r?"div":"body"),s={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"},r&&e.extend(s,{position:"absolute",left:"-1000px",top:"-1000px"});for(o in s)t.style[o]=s[o];t.appendChild(h),i=r||document.documentElement,i.insertBefore(t,i.firstChild),h.style.cssText="position: absolute; left: 10.7432222px;",n=e(h).offset().left,a=n>10&&11>n,t.innerHTML="",i.removeChild(t)}()}(),e.ui.position,e.widget("ui.sortable",e.ui.mouse,{version:"1.11.4",widgetEventPrefix:"sort",ready:!1,options:{appendTo:"parent",axis:!1,connectWith:!1,containment:!1,cursor:"auto",cursorAt:!1,dropOnEmpty:!0,forcePlaceholderSize:!1,forceHelperSize:!1,grid:!1,handle:!1,helper:"original",items:"> *",opacity:!1,placeholder:!1,revert:!1,scroll:!0,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1e3,activate:null,beforeStop:null,change:null,deactivate:null,out:null,over:null,receive:null,remove:null,sort:null,start:null,stop:null,update:null},_isOverAxis:function(e,t,i){return e>=t&&t+i>e},_isFloating:function(e){return/left|right/.test(e.css("float"))||/inline|table-cell/.test(e.css("display"))},_create:function(){this.containerCache={},this.element.addClass("ui-sortable"),this.refresh(),this.offset=this.element.offset(),this._mouseInit(),this._setHandleClassName(),this.ready=!0},_setOption:function(e,t){this._super(e,t),"handle"===e&&this._setHandleClassName()},_setHandleClassName:function(){this.element.find(".ui-sortable-handle").removeClass("ui-sortable-handle"),e.each(this.items,function(){(this.instance.options.handle?this.item.find(this.instance.options.handle):this.item).addClass("ui-sortable-handle")})},_destroy:function(){this.element.removeClass("ui-sortable ui-sortable-disabled").find(".ui-sortable-handle").removeClass("ui-sortable-handle"),this._mouseDestroy();for(var e=this.items.length-1;e>=0;e--)this.items[e].item.removeData(this.widgetName+"-item");return this},_mouseCapture:function(t,i){var s=null,n=!1,a=this;return this.reverting?!1:this.options.disabled||"static"===this.options.type?!1:(this._refreshItems(t),e(t.target).parents().each(function(){return e.data(this,a.widgetName+"-item")===a?(s=e(this),!1):void 0}),e.data(t.target,a.widgetName+"-item")===a&&(s=e(t.target)),s?!this.options.handle||i||(e(this.options.handle,s).find("*").addBack().each(function(){this===t.target&&(n=!0)}),n)?(this.currentItem=s,this._removeCurrentsFromItems(),!0):!1:!1)},_mouseStart:function(t,i,s){var n,a,o=this.options;if(this.currentContainer=this,this.refreshPositions(),this.helper=this._createHelper(t),this._cacheHelperProportions(),this._cacheMargins(),this.scrollParent=this.helper.scrollParent(),this.offset=this.currentItem.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},e.extend(this.offset,{click:{left:t.pageX-this.offset.left,top:t.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.helper.css("position","absolute"),this.cssPosition=this.helper.css("position"),this.originalPosition=this._generatePosition(t),this.originalPageX=t.pageX,this.originalPageY=t.pageY,o.cursorAt&&this._adjustOffsetFromHelper(o.cursorAt),this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]},this.helper[0]!==this.currentItem[0]&&this.currentItem.hide(),this._createPlaceholder(),o.containment&&this._setContainment(),o.cursor&&"auto"!==o.cursor&&(a=this.document.find("body"),this.storedCursor=a.css("cursor"),a.css("cursor",o.cursor),this.storedStylesheet=e("").appendTo(a)),o.opacity&&(this.helper.css("opacity")&&(this._storedOpacity=this.helper.css("opacity")),this.helper.css("opacity",o.opacity)),o.zIndex&&(this.helper.css("zIndex")&&(this._storedZIndex=this.helper.css("zIndex")),this.helper.css("zIndex",o.zIndex)),this.scrollParent[0]!==this.document[0]&&"HTML"!==this.scrollParent[0].tagName&&(this.overflowOffset=this.scrollParent.offset()),this._trigger("start",t,this._uiHash()),this._preserveHelperProportions||this._cacheHelperProportions(),!s)for(n=this.containers.length-1;n>=0;n--)this.containers[n]._trigger("activate",t,this._uiHash(this));return e.ui.ddmanager&&(e.ui.ddmanager.current=this),e.ui.ddmanager&&!o.dropBehaviour&&e.ui.ddmanager.prepareOffsets(this,t),this.dragging=!0,this.helper.addClass("ui-sortable-helper"),this._mouseDrag(t),!0},_mouseDrag:function(t){var i,s,n,a,o=this.options,r=!1;for(this.position=this._generatePosition(t),this.positionAbs=this._convertPositionTo("absolute"),this.lastPositionAbs||(this.lastPositionAbs=this.positionAbs),this.options.scroll&&(this.scrollParent[0]!==this.document[0]&&"HTML"!==this.scrollParent[0].tagName?(this.overflowOffset.top+this.scrollParent[0].offsetHeight-t.pageY=0;i--)if(s=this.items[i],n=s.item[0],a=this._intersectsWithPointer(s),a&&s.instance===this.currentContainer&&n!==this.currentItem[0]&&this.placeholder[1===a?"next":"prev"]()[0]!==n&&!e.contains(this.placeholder[0],n)&&("semi-dynamic"===this.options.type?!e.contains(this.element[0],n):!0)){if(this.direction=1===a?"down":"up","pointer"!==this.options.tolerance&&!this._intersectsWithSides(s))break;this._rearrange(t,s),this._trigger("change",t,this._uiHash());break}return this._contactContainers(t),e.ui.ddmanager&&e.ui.ddmanager.drag(this,t),this._trigger("sort",t,this._uiHash()),this.lastPositionAbs=this.positionAbs,!1},_mouseStop:function(t,i){if(t){if(e.ui.ddmanager&&!this.options.dropBehaviour&&e.ui.ddmanager.drop(this,t),this.options.revert){var s=this,n=this.placeholder.offset(),a=this.options.axis,o={};a&&"x"!==a||(o.left=n.left-this.offset.parent.left-this.margins.left+(this.offsetParent[0]===this.document[0].body?0:this.offsetParent[0].scrollLeft)),a&&"y"!==a||(o.top=n.top-this.offset.parent.top-this.margins.top+(this.offsetParent[0]===this.document[0].body?0:this.offsetParent[0].scrollTop)),this.reverting=!0,e(this.helper).animate(o,parseInt(this.options.revert,10)||500,function(){s._clear(t)})}else this._clear(t,i);return!1}},cancel:function(){if(this.dragging){this._mouseUp({target:null}),"original"===this.options.helper?this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"):this.currentItem.show();for(var t=this.containers.length-1;t>=0;t--)this.containers[t]._trigger("deactivate",null,this._uiHash(this)),this.containers[t].containerCache.over&&(this.containers[t]._trigger("out",null,this._uiHash(this)),this.containers[t].containerCache.over=0)}return this.placeholder&&(this.placeholder[0].parentNode&&this.placeholder[0].parentNode.removeChild(this.placeholder[0]),"original"!==this.options.helper&&this.helper&&this.helper[0].parentNode&&this.helper.remove(),e.extend(this,{helper:null,dragging:!1,reverting:!1,_noFinalSort:null}),this.domPosition.prev?e(this.domPosition.prev).after(this.currentItem):e(this.domPosition.parent).prepend(this.currentItem)),this},serialize:function(t){var i=this._getItemsAsjQuery(t&&t.connected),s=[];return t=t||{},e(i).each(function(){var i=(e(t.item||this).attr(t.attribute||"id")||"").match(t.expression||/(.+)[\-=_](.+)/);i&&s.push((t.key||i[1]+"[]")+"="+(t.key&&t.expression?i[1]:i[2]))}),!s.length&&t.key&&s.push(t.key+"="),s.join("&")},toArray:function(t){var i=this._getItemsAsjQuery(t&&t.connected),s=[];return t=t||{},i.each(function(){s.push(e(t.item||this).attr(t.attribute||"id")||"")}),s},_intersectsWith:function(e){var t=this.positionAbs.left,i=t+this.helperProportions.width,s=this.positionAbs.top,n=s+this.helperProportions.height,a=e.left,o=a+e.width,r=e.top,h=r+e.height,l=this.offset.click.top,u=this.offset.click.left,d="x"===this.options.axis||s+l>r&&h>s+l,c="y"===this.options.axis||t+u>a&&o>t+u,p=d&&c;return"pointer"===this.options.tolerance||this.options.forcePointerForContainers||"pointer"!==this.options.tolerance&&this.helperProportions[this.floating?"width":"height"]>e[this.floating?"width":"height"]?p:t+this.helperProportions.width/2>a&&o>i-this.helperProportions.width/2&&s+this.helperProportions.height/2>r&&h>n-this.helperProportions.height/2},_intersectsWithPointer:function(e){var t="x"===this.options.axis||this._isOverAxis(this.positionAbs.top+this.offset.click.top,e.top,e.height),i="y"===this.options.axis||this._isOverAxis(this.positionAbs.left+this.offset.click.left,e.left,e.width),s=t&&i,n=this._getDragVerticalDirection(),a=this._getDragHorizontalDirection();return s?this.floating?a&&"right"===a||"down"===n?2:1:n&&("down"===n?2:1):!1},_intersectsWithSides:function(e){var t=this._isOverAxis(this.positionAbs.top+this.offset.click.top,e.top+e.height/2,e.height),i=this._isOverAxis(this.positionAbs.left+this.offset.click.left,e.left+e.width/2,e.width),s=this._getDragVerticalDirection(),n=this._getDragHorizontalDirection();return this.floating&&n?"right"===n&&i||"left"===n&&!i:s&&("down"===s&&t||"up"===s&&!t)},_getDragVerticalDirection:function(){var e=this.positionAbs.top-this.lastPositionAbs.top;return 0!==e&&(e>0?"down":"up")},_getDragHorizontalDirection:function(){var e=this.positionAbs.left-this.lastPositionAbs.left;return 0!==e&&(e>0?"right":"left")},refresh:function(e){return this._refreshItems(e),this._setHandleClassName(),this.refreshPositions(),this},_connectWith:function(){var e=this.options;return e.connectWith.constructor===String?[e.connectWith]:e.connectWith},_getItemsAsjQuery:function(t){function i(){r.push(this)}var s,n,a,o,r=[],h=[],l=this._connectWith();if(l&&t)for(s=l.length-1;s>=0;s--)for(a=e(l[s],this.document[0]),n=a.length-1;n>=0;n--)o=e.data(a[n],this.widgetFullName),o&&o!==this&&!o.options.disabled&&h.push([e.isFunction(o.options.items)?o.options.items.call(o.element):e(o.options.items,o.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),o]);for(h.push([e.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):e(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),this]),s=h.length-1;s>=0;s--)h[s][0].each(i);return e(r)},_removeCurrentsFromItems:function(){var t=this.currentItem.find(":data("+this.widgetName+"-item)");this.items=e.grep(this.items,function(e){for(var i=0;t.length>i;i++)if(t[i]===e.item[0])return!1;return!0})},_refreshItems:function(t){this.items=[],this.containers=[this];var i,s,n,a,o,r,h,l,u=this.items,d=[[e.isFunction(this.options.items)?this.options.items.call(this.element[0],t,{item:this.currentItem}):e(this.options.items,this.element),this]],c=this._connectWith();if(c&&this.ready)for(i=c.length-1;i>=0;i--)for(n=e(c[i],this.document[0]),s=n.length-1;s>=0;s--)a=e.data(n[s],this.widgetFullName),a&&a!==this&&!a.options.disabled&&(d.push([e.isFunction(a.options.items)?a.options.items.call(a.element[0],t,{item:this.currentItem}):e(a.options.items,a.element),a]),this.containers.push(a));for(i=d.length-1;i>=0;i--)for(o=d[i][1],r=d[i][0],s=0,l=r.length;l>s;s++)h=e(r[s]),h.data(this.widgetName+"-item",o),u.push({item:h,instance:o,width:0,height:0,left:0,top:0})},refreshPositions:function(t){this.floating=this.items.length?"x"===this.options.axis||this._isFloating(this.items[0].item):!1,this.offsetParent&&this.helper&&(this.offset.parent=this._getParentOffset());var i,s,n,a;for(i=this.items.length-1;i>=0;i--)s=this.items[i],s.instance!==this.currentContainer&&this.currentContainer&&s.item[0]!==this.currentItem[0]||(n=this.options.toleranceElement?e(this.options.toleranceElement,s.item):s.item,t||(s.width=n.outerWidth(),s.height=n.outerHeight()),a=n.offset(),s.left=a.left,s.top=a.top);if(this.options.custom&&this.options.custom.refreshContainers)this.options.custom.refreshContainers.call(this);else for(i=this.containers.length-1;i>=0;i--)a=this.containers[i].element.offset(),this.containers[i].containerCache.left=a.left,this.containers[i].containerCache.top=a.top,this.containers[i].containerCache.width=this.containers[i].element.outerWidth(),this.containers[i].containerCache.height=this.containers[i].element.outerHeight(); +return this},_createPlaceholder:function(t){t=t||this;var i,s=t.options;s.placeholder&&s.placeholder.constructor!==String||(i=s.placeholder,s.placeholder={element:function(){var s=t.currentItem[0].nodeName.toLowerCase(),n=e("<"+s+">",t.document[0]).addClass(i||t.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper");return"tbody"===s?t._createTrPlaceholder(t.currentItem.find("tr").eq(0),e("",t.document[0]).appendTo(n)):"tr"===s?t._createTrPlaceholder(t.currentItem,n):"img"===s&&n.attr("src",t.currentItem.attr("src")),i||n.css("visibility","hidden"),n},update:function(e,n){(!i||s.forcePlaceholderSize)&&(n.height()||n.height(t.currentItem.innerHeight()-parseInt(t.currentItem.css("paddingTop")||0,10)-parseInt(t.currentItem.css("paddingBottom")||0,10)),n.width()||n.width(t.currentItem.innerWidth()-parseInt(t.currentItem.css("paddingLeft")||0,10)-parseInt(t.currentItem.css("paddingRight")||0,10)))}}),t.placeholder=e(s.placeholder.element.call(t.element,t.currentItem)),t.currentItem.after(t.placeholder),s.placeholder.update(t,t.placeholder)},_createTrPlaceholder:function(t,i){var s=this;t.children().each(function(){e(" ",s.document[0]).attr("colspan",e(this).attr("colspan")||1).appendTo(i)})},_contactContainers:function(t){var i,s,n,a,o,r,h,l,u,d,c=null,p=null;for(i=this.containers.length-1;i>=0;i--)if(!e.contains(this.currentItem[0],this.containers[i].element[0]))if(this._intersectsWith(this.containers[i].containerCache)){if(c&&e.contains(this.containers[i].element[0],c.element[0]))continue;c=this.containers[i],p=i}else this.containers[i].containerCache.over&&(this.containers[i]._trigger("out",t,this._uiHash(this)),this.containers[i].containerCache.over=0);if(c)if(1===this.containers.length)this.containers[p].containerCache.over||(this.containers[p]._trigger("over",t,this._uiHash(this)),this.containers[p].containerCache.over=1);else{for(n=1e4,a=null,u=c.floating||this._isFloating(this.currentItem),o=u?"left":"top",r=u?"width":"height",d=u?"clientX":"clientY",s=this.items.length-1;s>=0;s--)e.contains(this.containers[p].element[0],this.items[s].item[0])&&this.items[s].item[0]!==this.currentItem[0]&&(h=this.items[s].item.offset()[o],l=!1,t[d]-h>this.items[s][r]/2&&(l=!0),n>Math.abs(t[d]-h)&&(n=Math.abs(t[d]-h),a=this.items[s],this.direction=l?"up":"down"));if(!a&&!this.options.dropOnEmpty)return;if(this.currentContainer===this.containers[p])return this.currentContainer.containerCache.over||(this.containers[p]._trigger("over",t,this._uiHash()),this.currentContainer.containerCache.over=1),void 0;a?this._rearrange(t,a,null,!0):this._rearrange(t,null,this.containers[p].element,!0),this._trigger("change",t,this._uiHash()),this.containers[p]._trigger("change",t,this._uiHash(this)),this.currentContainer=this.containers[p],this.options.placeholder.update(this.currentContainer,this.placeholder),this.containers[p]._trigger("over",t,this._uiHash(this)),this.containers[p].containerCache.over=1}},_createHelper:function(t){var i=this.options,s=e.isFunction(i.helper)?e(i.helper.apply(this.element[0],[t,this.currentItem])):"clone"===i.helper?this.currentItem.clone():this.currentItem;return s.parents("body").length||e("parent"!==i.appendTo?i.appendTo:this.currentItem[0].parentNode)[0].appendChild(s[0]),s[0]===this.currentItem[0]&&(this._storedCSS={width:this.currentItem[0].style.width,height:this.currentItem[0].style.height,position:this.currentItem.css("position"),top:this.currentItem.css("top"),left:this.currentItem.css("left")}),(!s[0].style.width||i.forceHelperSize)&&s.width(this.currentItem.width()),(!s[0].style.height||i.forceHelperSize)&&s.height(this.currentItem.height()),s},_adjustOffsetFromHelper:function(t){"string"==typeof t&&(t=t.split(" ")),e.isArray(t)&&(t={left:+t[0],top:+t[1]||0}),"left"in t&&(this.offset.click.left=t.left+this.margins.left),"right"in t&&(this.offset.click.left=this.helperProportions.width-t.right+this.margins.left),"top"in t&&(this.offset.click.top=t.top+this.margins.top),"bottom"in t&&(this.offset.click.top=this.helperProportions.height-t.bottom+this.margins.top)},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var t=this.offsetParent.offset();return"absolute"===this.cssPosition&&this.scrollParent[0]!==this.document[0]&&e.contains(this.scrollParent[0],this.offsetParent[0])&&(t.left+=this.scrollParent.scrollLeft(),t.top+=this.scrollParent.scrollTop()),(this.offsetParent[0]===this.document[0].body||this.offsetParent[0].tagName&&"html"===this.offsetParent[0].tagName.toLowerCase()&&e.ui.ie)&&(t={top:0,left:0}),{top:t.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:t.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"===this.cssPosition){var e=this.currentItem.position();return{top:e.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:e.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.currentItem.css("marginLeft"),10)||0,top:parseInt(this.currentItem.css("marginTop"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var t,i,s,n=this.options;"parent"===n.containment&&(n.containment=this.helper[0].parentNode),("document"===n.containment||"window"===n.containment)&&(this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,"document"===n.containment?this.document.width():this.window.width()-this.helperProportions.width-this.margins.left,("document"===n.containment?this.document.width():this.window.height()||this.document[0].body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]),/^(document|window|parent)$/.test(n.containment)||(t=e(n.containment)[0],i=e(n.containment).offset(),s="hidden"!==e(t).css("overflow"),this.containment=[i.left+(parseInt(e(t).css("borderLeftWidth"),10)||0)+(parseInt(e(t).css("paddingLeft"),10)||0)-this.margins.left,i.top+(parseInt(e(t).css("borderTopWidth"),10)||0)+(parseInt(e(t).css("paddingTop"),10)||0)-this.margins.top,i.left+(s?Math.max(t.scrollWidth,t.offsetWidth):t.offsetWidth)-(parseInt(e(t).css("borderLeftWidth"),10)||0)-(parseInt(e(t).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,i.top+(s?Math.max(t.scrollHeight,t.offsetHeight):t.offsetHeight)-(parseInt(e(t).css("borderTopWidth"),10)||0)-(parseInt(e(t).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top])},_convertPositionTo:function(t,i){i||(i=this.position);var s="absolute"===t?1:-1,n="absolute"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&e.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,a=/(html|body)/i.test(n[0].tagName);return{top:i.top+this.offset.relative.top*s+this.offset.parent.top*s-("fixed"===this.cssPosition?-this.scrollParent.scrollTop():a?0:n.scrollTop())*s,left:i.left+this.offset.relative.left*s+this.offset.parent.left*s-("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():a?0:n.scrollLeft())*s}},_generatePosition:function(t){var i,s,n=this.options,a=t.pageX,o=t.pageY,r="absolute"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&e.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,h=/(html|body)/i.test(r[0].tagName);return"relative"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&this.scrollParent[0]!==this.offsetParent[0]||(this.offset.relative=this._getRelativeOffset()),this.originalPosition&&(this.containment&&(t.pageX-this.offset.click.leftthis.containment[2]&&(a=this.containment[2]+this.offset.click.left),t.pageY-this.offset.click.top>this.containment[3]&&(o=this.containment[3]+this.offset.click.top)),n.grid&&(i=this.originalPageY+Math.round((o-this.originalPageY)/n.grid[1])*n.grid[1],o=this.containment?i-this.offset.click.top>=this.containment[1]&&i-this.offset.click.top<=this.containment[3]?i:i-this.offset.click.top>=this.containment[1]?i-n.grid[1]:i+n.grid[1]:i,s=this.originalPageX+Math.round((a-this.originalPageX)/n.grid[0])*n.grid[0],a=this.containment?s-this.offset.click.left>=this.containment[0]&&s-this.offset.click.left<=this.containment[2]?s:s-this.offset.click.left>=this.containment[0]?s-n.grid[0]:s+n.grid[0]:s)),{top:o-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.scrollParent.scrollTop():h?0:r.scrollTop()),left:a-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():h?0:r.scrollLeft())}},_rearrange:function(e,t,i,s){i?i[0].appendChild(this.placeholder[0]):t.item[0].parentNode.insertBefore(this.placeholder[0],"down"===this.direction?t.item[0]:t.item[0].nextSibling),this.counter=this.counter?++this.counter:1;var n=this.counter;this._delay(function(){n===this.counter&&this.refreshPositions(!s)})},_clear:function(e,t){function i(e,t,i){return function(s){i._trigger(e,s,t._uiHash(t))}}this.reverting=!1;var s,n=[];if(!this._noFinalSort&&this.currentItem.parent().length&&this.placeholder.before(this.currentItem),this._noFinalSort=null,this.helper[0]===this.currentItem[0]){for(s in this._storedCSS)("auto"===this._storedCSS[s]||"static"===this._storedCSS[s])&&(this._storedCSS[s]="");this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")}else this.currentItem.show();for(this.fromOutside&&!t&&n.push(function(e){this._trigger("receive",e,this._uiHash(this.fromOutside))}),!this.fromOutside&&this.domPosition.prev===this.currentItem.prev().not(".ui-sortable-helper")[0]&&this.domPosition.parent===this.currentItem.parent()[0]||t||n.push(function(e){this._trigger("update",e,this._uiHash())}),this!==this.currentContainer&&(t||(n.push(function(e){this._trigger("remove",e,this._uiHash())}),n.push(function(e){return function(t){e._trigger("receive",t,this._uiHash(this))}}.call(this,this.currentContainer)),n.push(function(e){return function(t){e._trigger("update",t,this._uiHash(this))}}.call(this,this.currentContainer)))),s=this.containers.length-1;s>=0;s--)t||n.push(i("deactivate",this,this.containers[s])),this.containers[s].containerCache.over&&(n.push(i("out",this,this.containers[s])),this.containers[s].containerCache.over=0);if(this.storedCursor&&(this.document.find("body").css("cursor",this.storedCursor),this.storedStylesheet.remove()),this._storedOpacity&&this.helper.css("opacity",this._storedOpacity),this._storedZIndex&&this.helper.css("zIndex","auto"===this._storedZIndex?"":this._storedZIndex),this.dragging=!1,t||this._trigger("beforeStop",e,this._uiHash()),this.placeholder[0].parentNode.removeChild(this.placeholder[0]),this.cancelHelperRemoval||(this.helper[0]!==this.currentItem[0]&&this.helper.remove(),this.helper=null),!t){for(s=0;n.length>s;s++)n[s].call(this,e);this._trigger("stop",e,this._uiHash())}return this.fromOutside=!1,!this.cancelHelperRemoval},_trigger:function(){e.Widget.prototype._trigger.apply(this,arguments)===!1&&this.cancel()},_uiHash:function(t){var i=t||this;return{helper:i.helper,placeholder:i.placeholder||e([]),position:i.position,originalPosition:i.originalPosition,offset:i.positionAbs,item:i.currentItem,sender:t?t.element:null}}})}); \ No newline at end of file diff --git a/web/js/respond.js b/web/js/respond.js new file mode 100755 index 00000000..d5dc6261 --- /dev/null +++ b/web/js/respond.js @@ -0,0 +1,6 @@ +/*! Respond.js v1.4.2: min/max-width media query polyfill + * Copyright 2014 Scott Jehl + * Licensed under MIT + * http://j.mp/respondjs */ + +!function(a){"use strict";a.matchMedia=a.matchMedia||function(a){var b,c=a.documentElement,d=c.firstElementChild||c.firstChild,e=a.createElement("body"),f=a.createElement("div");return f.id="mq-test-1",f.style.cssText="position:absolute;top:-100em",e.style.background="none",e.appendChild(f),function(a){return f.innerHTML='­',c.insertBefore(e,d),b=42===f.offsetWidth,c.removeChild(e),{matches:b,media:a}}}(a.document)}(this),function(a){"use strict";function b(){v(!0)}var c={};a.respond=c,c.update=function(){};var d=[],e=function(){var b=!1;try{b=new a.XMLHttpRequest}catch(c){b=new a.ActiveXObject("Microsoft.XMLHTTP")}return function(){return b}}(),f=function(a,b){var c=e();c&&(c.open("GET",a,!0),c.onreadystatechange=function(){4!==c.readyState||200!==c.status&&304!==c.status||b(c.responseText)},4!==c.readyState&&c.send(null))},g=function(a){return a.replace(c.regex.minmaxwh,"").match(c.regex.other)};if(c.ajax=f,c.queue=d,c.unsupportedmq=g,c.regex={media:/@media[^\{]+\{([^\{\}]*\{[^\}\{]*\})+/gi,keyframes:/@(?:\-(?:o|moz|webkit)\-)?keyframes[^\{]+\{(?:[^\{\}]*\{[^\}\{]*\})+[^\}]*\}/gi,comments:/\/\*[^*]*\*+([^/][^*]*\*+)*\//gi,urls:/(url\()['"]?([^\/\)'"][^:\)'"]+)['"]?(\))/g,findStyles:/@media *([^\{]+)\{([\S\s]+?)$/,only:/(only\s+)?([a-zA-Z]+)\s?/,minw:/\(\s*min\-width\s*:\s*(\s*[0-9\.]+)(px|em)\s*\)/,maxw:/\(\s*max\-width\s*:\s*(\s*[0-9\.]+)(px|em)\s*\)/,minmaxwh:/\(\s*m(in|ax)\-(height|width)\s*:\s*(\s*[0-9\.]+)(px|em)\s*\)/gi,other:/\([^\)]*\)/g},c.mediaQueriesSupported=a.matchMedia&&null!==a.matchMedia("only all")&&a.matchMedia("only all").matches,!c.mediaQueriesSupported){var h,i,j,k=a.document,l=k.documentElement,m=[],n=[],o=[],p={},q=30,r=k.getElementsByTagName("head")[0]||l,s=k.getElementsByTagName("base")[0],t=r.getElementsByTagName("link"),u=function(){var a,b=k.createElement("div"),c=k.body,d=l.style.fontSize,e=c&&c.style.fontSize,f=!1;return b.style.cssText="position:absolute;font-size:1em;width:1em",c||(c=f=k.createElement("body"),c.style.background="none"),l.style.fontSize="100%",c.style.fontSize="100%",c.appendChild(b),f&&l.insertBefore(c,l.firstChild),a=b.offsetWidth,f?l.removeChild(c):c.removeChild(b),l.style.fontSize=d,e&&(c.style.fontSize=e),a=j=parseFloat(a)},v=function(b){var c="clientWidth",d=l[c],e="CSS1Compat"===k.compatMode&&d||k.body[c]||d,f={},g=t[t.length-1],p=(new Date).getTime();if(b&&h&&q>p-h)return a.clearTimeout(i),i=a.setTimeout(v,q),void 0;h=p;for(var s in m)if(m.hasOwnProperty(s)){var w=m[s],x=w.minw,y=w.maxw,z=null===x,A=null===y,B="em";x&&(x=parseFloat(x)*(x.indexOf(B)>-1?j||u():1)),y&&(y=parseFloat(y)*(y.indexOf(B)>-1?j||u():1)),w.hasquery&&(z&&A||!(z||e>=x)||!(A||y>=e))||(f[w.media]||(f[w.media]=[]),f[w.media].push(n[w.rules]))}for(var C in o)o.hasOwnProperty(C)&&o[C]&&o[C].parentNode===r&&r.removeChild(o[C]);o.length=0;for(var D in f)if(f.hasOwnProperty(D)){var E=k.createElement("style"),F=f[D].join("\n");E.type="text/css",E.media=D,r.insertBefore(E,g.nextSibling),E.styleSheet?E.styleSheet.cssText=F:E.appendChild(k.createTextNode(F)),o.push(E)}},w=function(a,b,d){var e=a.replace(c.regex.comments,"").replace(c.regex.keyframes,"").match(c.regex.media),f=e&&e.length||0;b=b.substring(0,b.lastIndexOf("/"));var h=function(a){return a.replace(c.regex.urls,"$1"+b+"$2$3")},i=!f&&d;b.length&&(b+="/"),i&&(f=1);for(var j=0;f>j;j++){var k,l,o,p;i?(k=d,n.push(h(a))):(k=e[j].match(c.regex.findStyles)&&RegExp.$1,n.push(RegExp.$2&&h(RegExp.$2))),o=k.split(","),p=o.length;for(var q=0;p>q;q++)l=o[q],g(l)||m.push({media:l.split("(")[0].match(c.regex.only)&&RegExp.$2||"all",rules:n.length-1,hasquery:l.indexOf("(")>-1,minw:l.match(c.regex.minw)&&parseFloat(RegExp.$1)+(RegExp.$2||""),maxw:l.match(c.regex.maxw)&&parseFloat(RegExp.$1)+(RegExp.$2||"")})}v()},x=function(){if(d.length){var b=d.shift();f(b.href,function(c){w(c,b.href,b.media),p[b.href]=!0,a.setTimeout(function(){x()},0)})}},y=function(){for(var b=0;b'); + }, + function() { + $(this).attr('class','keyword-breadcrumb btn btn-xs btn-default'); + $(this).children('.glyphicon').remove(); + }); + + + /** + * Call alterSearch() when a breadcrumb is removed + */ + $('.keyword-breadcrumb').on('click', function(e) { + e.preventDefault && e.preventDefault(); + $(this).fadeOut(150); + alterSearch('remove', 'keyword', null); + return false; + }); + + + /** + * If you want different behavior for Facet breadcrumbs, you can specify that here + */ + $('.facetBreadcrumb.btn').on({ + mouseover: function() { + $(this).attr('class','facetBreadcrumb btn btn-xs btn-danger'); + $(this).append(''); + }, + mouseout: function() { + $(this).attr('class','facetBreadcrumb btn btn-xs btn-default'); + $(this).children('.glyphicon').remove(); + } + }); + + + /** + * Call alterSearch() when a facet is removed + */ + $('.facetBreadcrumb').on('click', function(e) { + e.preventDefault && e.preventDefault(); + var content = $(this).attr('data-machine-name'); + + $(this).fadeOut(); + alterSearch('remove', 'facet', content); + return false; + }); + + + /** + * Handle keyword searches + */ + var keywordForm = $('#keyword-search-form'); + var keywordInput = $('#keyword-search-input'); + keywordForm.on('submit', function(e) { + e.preventDefault && e.preventDefault(); + var term = keywordInput.val(); + alterSearch('replace', 'keyword', term); + return false; + }); + keywordForm.on('keyUp', function(e) { + e.preventDefault && e.preventDefault(); + if (e.which===13) { + var term = keywordInput.val(); + alterSearch('replace', 'keyword', term); + return false; + } + }); + + + /** + * Handle page selection + */ + var pagerInput = $('#pagenum-input'); + var maxPages = pagerInput.attr('max'); + var minPages = pagerInput.attr('min'); + pagerInput.on('keyup', function(e) { + e.preventDefault && e.preventDefault(); + if (e.which===13) { + var newPage = pagerInput.val(); + if (newPage > maxPages) { newPage = maxPages; } + if (newPage < minPages) { newPage = minPages; } + alterSearch('jump', 'page', newPage); + return false; + } + }); + + + /** + * Handle sorting and pagination options + */ + $('#sort-dropdown').on('change', function(e) { + e.preventDefault && e.preventDefault(); + alterSearch('replace', 'sort', $('#sort-dropdown').val()); + return false; + }); + $('#results_pp-dropdown').on('change', function(e) { + e.preventDefault && e.preventDefault(); + alterSearch('replace', 'results', $('#results_pp-dropdown').val()); + return false; + }); + + + /** + * Solr-readable facet names are stored in the "data-solrfacetvalue" attributes. + * When a user selects a facet, we call alterSearch() using a string that can ultimately + * be read by Solr. + */ + $('.facet-item a').on('click', function(e) { + e.preventDefault && e.preventDefault(); + var category = $(this).attr('data-solrfacetcategory'); + var facetChoice = '"' + $(this).attr('data-solrfacetvalue') + '"'; + var facetString = category + ':' + facetChoice; + //console.log(facetString); + alterSearch('add', 'facet', facetString); + return false; + }); + + + /** + * Pager buttons + */ + $('#nextPage-button, .pager-next').on('click', function(e) { + e.preventDefault && e.preventDefault(); + alterSearch('next', 'page', null); + return false; + }); + $('#prevPage-button, .pager-previous').on('click', function(e) { + e.preventDefault && e.preventDefault(); + alterSearch('previous', 'page', null); + return false; + }); + + + /** + * This function does most of the leg work for searching. We chose to do all this with JS + * because the search environment is dynamic and the parameters are complex, so we wanted to + * have the most control over it we could. + * + * Basically, you tell this function what you want to do, what parameter to do it to, and what content/data there is + * The function creates an object representing the current search as read from the URL parameters. + * Any adjustments are made and then a new URL is constructed and then navigated to. + * I.e. alterSearch('remove''keyword',null) will remove the current keyword search + * and alterSearch('add','facet','subject_domain_fq:"Delivery of Health Care"') will add that facet. + */ + function alterSearch(action, target, content) { + + var params = $.deparam(window.location.search.substring(1)); + + // handle page selection + if (target == 'page') { + var curPage = parseInt(params['page']) || 1; + if (action=='next') { + var goPage = curPage+1; + params['page'] = goPage; + } else if (action == 'jump') { + params['page'] = content; + } else if (curPage > 1) { + var goPage = curPage-1; + params['page'] = goPage; + } else { + } + } + // if we've changed the sorting, # of results per page, or ran a keyword search, + // we need to go back to page 1 + if ((target == 'results') || (target == 'sort') || (target == 'keyword')) { + params['page'] = 1; + } + + // simply replace the old value with a new one + if (action=='replace') { + params[target] = content; + } + + // Remove a parameter, but first check if we're dealing with an array that already contains + // our content + if (action=='remove') { + if (params[target]) { + if (content) { + if (params[target].indexOf(content) > -1) { + params[target].splice($.inArray(content, params[target]),1); + } + } + else { + params[target]=null; + } + } + } + + + // Add an item + if (action=='add') { + if (!params[target]) { + target = target+'[]'; + params[target] = content; + params['page'] = 1; + } + // if it's an array, check if it already contains this item + else if ($.isArray(params[target])) { + if (params[target].indexOf(content)==-1) { + params[target].push(content); + params['page'] = 1; + } else { + return false; + } + } + else { + $.makeArray(params[target]); + params[target].push(content); + params['page'] = 1; + } + + } + + var newURL = "/search?" + $.param(params); + window.location.href = newURL; + } + + + + + + /** + * http://stackoverflow.com/a/10997390/11236 + */ + function updateURLParameter(url, param, paramVal){ + var newAdditionalURL = ""; + var tempArray = url.split("?"); + var baseURL = tempArray[0]; + var additionalURL = tempArray[1]; + var temp = ""; + if (additionalURL) { + tempArray = additionalURL.split("&"); + for (i=0; i